brintos

brintos / llvm-project-archived public Read only

0
0
Text · 3.7 KiB · 7b3f33b Raw
64 lines · plain
1; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 42; XFAIL: *3; RUN: opt < %s -passes=newgvn -S | FileCheck %s4 5declare void @llvm.masked.scatter.v2i32.v2p0(<2 x i32> , <2 x ptr> , i32 , <2 x i1> )6declare <2 x i32> @llvm.masked.gather.v2i32.v2p0(<2 x ptr>, i32, <2 x i1>, <2 x i32>)7 8; This test ensures that masked scatter and gather operations, which take vectors of pointers,9; do not have pointer aliasing ignored when being processed.10; No scatter/gather calls should end up eliminated11; CHECK: llvm.masked.gather12; CHECK: llvm.masked.gather13; CHECK: llvm.masked.scatter14; CHECK: llvm.masked.gather15; CHECK: llvm.masked.scatter16; CHECK: llvm.masked.gather17define spir_kernel void @test(<2 x ptr> %in1, <2 x ptr> %in2, ptr %out) {18; CHECK-LABEL: define spir_kernel void @test(19; CHECK-SAME: <2 x ptr> [[IN1:%.*]], <2 x ptr> [[IN2:%.*]], ptr [[OUT:%.*]]) {20; CHECK-NEXT:  entry:21; CHECK-NEXT:    [[TMP_0:%.*]] = alloca i32, align 422; CHECK-NEXT:    [[TMP_1:%.*]] = alloca i32, align 423; CHECK-NEXT:    [[TMP_I:%.*]] = insertelement <2 x ptr> poison, ptr [[TMP_0]], i32 024; CHECK-NEXT:    [[TMP:%.*]] = insertelement <2 x ptr> [[TMP_I]], ptr [[TMP_1]], i32 125; CHECK-NEXT:    [[IN1_V:%.*]] = call <2 x i32> @llvm.masked.gather.v2i32.v2p0(<2 x ptr> [[IN1]], i32 1, <2 x i1> <i1 true, i1 true>, <2 x i32> undef)26; CHECK-NEXT:    [[IN2_V:%.*]] = call <2 x i32> @llvm.masked.gather.v2i32.v2p0(<2 x ptr> [[IN2]], i32 1, <2 x i1> <i1 true, i1 true>, <2 x i32> undef)27; CHECK-NEXT:    call void @llvm.masked.scatter.v2i32.v2p0(<2 x i32> [[IN1_V]], <2 x ptr> [[TMP]], i32 1, <2 x i1> <i1 true, i1 true>)28; CHECK-NEXT:    call void @llvm.masked.scatter.v2i32.v2p0(<2 x i32> [[IN2_V]], <2 x ptr> [[TMP]], i32 1, <2 x i1> <i1 true, i1 true>)29; CHECK-NEXT:    [[TMP_V_1:%.*]] = call <2 x i32> @llvm.masked.gather.v2i32.v2p0(<2 x ptr> [[TMP]], i32 1, <2 x i1> <i1 true, i1 true>, <2 x i32> undef)30; CHECK-NEXT:    [[TMP_V_1_0:%.*]] = extractelement <2 x i32> [[TMP_V_1]], i32 031; CHECK-NEXT:    [[TMP_V_1_1:%.*]] = extractelement <2 x i32> [[TMP_V_1]], i32 132; CHECK-NEXT:    store i32 [[TMP_V_1_0]], ptr [[OUT]], align 433; CHECK-NEXT:    [[OUT_1:%.*]] = getelementptr i32, ptr [[OUT]], i32 134; CHECK-NEXT:    store i32 [[TMP_V_1_1]], ptr [[OUT_1]], align 435; CHECK-NEXT:    ret void36;37entry:38  ; Just some temporary storage39  %tmp.0 = alloca i3240  %tmp.1 = alloca i3241  %tmp.i = insertelement <2 x ptr> poison, ptr %tmp.0, i32 042  %tmp = insertelement <2 x ptr> %tmp.i, ptr %tmp.1, i32 143  ; Read from in1 and in244  %in1.v = call <2 x i32> @llvm.masked.gather.v2i32.v2p0(<2 x ptr> %in1, i32 1, <2 x i1> <i1 true, i1 true>, <2 x i32> undef) #145  %in2.v = call <2 x i32> @llvm.masked.gather.v2i32.v2p0(<2 x ptr> %in2, i32 1, <2 x i1> <i1 true, i1 true>, <2 x i32> undef) #146  ; Store in1 to the allocas47  call void @llvm.masked.scatter.v2i32.v2p0(<2 x i32> %in1.v, <2 x ptr> %tmp, i32 1, <2 x i1> <i1 true, i1 true>);48  ; Read in1 from the allocas49  ; This gather should alias the scatter we just saw50  %tmp.v.0 = call <2 x i32> @llvm.masked.gather.v2i32.v2p0(<2 x ptr> %tmp, i32 1, <2 x i1> <i1 true, i1 true>, <2 x i32> undef) #151  ; Store in2 to the allocas52  call void @llvm.masked.scatter.v2i32.v2p0(<2 x i32> %in2.v, <2 x ptr> %tmp, i32 1, <2 x i1> <i1 true, i1 true>);53  ; Read in2 from the allocas54  ; This gather should alias the scatter we just saw, and not be eliminated55  %tmp.v.1 = call <2 x i32> @llvm.masked.gather.v2i32.v2p0(<2 x ptr> %tmp, i32 1, <2 x i1> <i1 true, i1 true>, <2 x i32> undef) #156  ; Store in2 to out for good measure57  %tmp.v.1.0 = extractelement <2 x i32> %tmp.v.1, i32 058  %tmp.v.1.1 = extractelement <2 x i32> %tmp.v.1, i32 159  store i32 %tmp.v.1.0, ptr %out60  %out.1 = getelementptr i32, ptr %out, i32 161  store i32 %tmp.v.1.1, ptr %out.162  ret void63}64