brintos

brintos / llvm-project-archived public Read only

0
0
Text · 3.7 KiB · 4d82cd0 Raw
59 lines · plain
1; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 62; RUN: opt < %s -passes=gvn -S | FileCheck %s3 4declare void @llvm.masked.scatter.v2i32.v2p0(<2 x i32> , <2 x ptr> , i32 , <2 x i1> )5declare <2 x i32> @llvm.masked.gather.v2i32.v2p0(<2 x ptr>, i32, <2 x i1>, <2 x i32>)6 7; This test ensures that masked scatter and gather operations, which take vectors of pointers,8; do not have pointer aliasing ignored when being processed.9; No scatter/gather calls should end up eliminated.10 11define spir_kernel void @test(<2 x ptr> %in1, <2 x ptr> %in2, ptr %out) {12; CHECK-LABEL: define spir_kernel void @test(13; CHECK-SAME: <2 x ptr> [[IN1:%.*]], <2 x ptr> [[IN2:%.*]], ptr [[OUT:%.*]]) {14; CHECK-NEXT:  [[ENTRY:.*:]]15; CHECK-NEXT:    [[TMP_0:%.*]] = alloca i32, align 416; CHECK-NEXT:    [[TMP_1:%.*]] = alloca i32, align 417; CHECK-NEXT:    [[TMP_I:%.*]] = insertelement <2 x ptr> undef, ptr [[TMP_0]], i32 018; CHECK-NEXT:    [[TMP:%.*]] = insertelement <2 x ptr> [[TMP_I]], ptr [[TMP_1]], i32 119; CHECK-NEXT:    [[IN1_V:%.*]] = call <2 x i32> @llvm.masked.gather.v2i32.v2p0(<2 x ptr> align 1 [[IN1]], <2 x i1> splat (i1 true), <2 x i32> undef)20; CHECK-NEXT:    [[IN2_V:%.*]] = call <2 x i32> @llvm.masked.gather.v2i32.v2p0(<2 x ptr> align 1 [[IN2]], <2 x i1> splat (i1 true), <2 x i32> undef)21; CHECK-NEXT:    call void @llvm.masked.scatter.v2i32.v2p0(<2 x i32> [[IN1_V]], <2 x ptr> align 1 [[TMP]], <2 x i1> splat (i1 true))22; CHECK-NEXT:    [[TMP_V_0:%.*]] = call <2 x i32> @llvm.masked.gather.v2i32.v2p0(<2 x ptr> align 1 [[TMP]], <2 x i1> splat (i1 true), <2 x i32> undef)23; CHECK-NEXT:    call void @llvm.masked.scatter.v2i32.v2p0(<2 x i32> [[IN2_V]], <2 x ptr> align 1 [[TMP]], <2 x i1> splat (i1 true))24; CHECK-NEXT:    [[TMP_V_1:%.*]] = call <2 x i32> @llvm.masked.gather.v2i32.v2p0(<2 x ptr> align 1 [[TMP]], <2 x i1> splat (i1 true), <2 x i32> undef)25; CHECK-NEXT:    [[TMP_V_1_0:%.*]] = extractelement <2 x i32> [[TMP_V_1]], i32 026; CHECK-NEXT:    [[TMP_V_1_1:%.*]] = extractelement <2 x i32> [[TMP_V_1]], i32 127; CHECK-NEXT:    store i32 [[TMP_V_1_0]], ptr [[OUT]], align 428; CHECK-NEXT:    [[OUT_1:%.*]] = getelementptr i32, ptr [[OUT]], i32 129; CHECK-NEXT:    store i32 [[TMP_V_1_1]], ptr [[OUT_1]], align 430; CHECK-NEXT:    ret void31;32entry:33  ; Just some temporary storage34  %tmp.0 = alloca i3235  %tmp.1 = alloca i3236  %tmp.i = insertelement <2 x ptr> undef, ptr %tmp.0, i32 037  %tmp = insertelement <2 x ptr> %tmp.i, ptr %tmp.1, i32 138  ; Read from in1 and in239  %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) #140  %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) #141  ; Store in1 to the allocas42  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>);43  ; Read in1 from the allocas44  ; This gather should alias the scatter we just saw45  %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) #146  ; Store in2 to the allocas47  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>);48  ; Read in2 from the allocas49  ; This gather should alias the scatter we just saw, and not be eliminated50  %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) #151  ; Store in2 to out for good measure52  %tmp.v.1.0 = extractelement <2 x i32> %tmp.v.1, i32 053  %tmp.v.1.1 = extractelement <2 x i32> %tmp.v.1, i32 154  store i32 %tmp.v.1.0, ptr %out55  %out.1 = getelementptr i32, ptr %out, i32 156  store i32 %tmp.v.1.1, ptr %out.157  ret void58}59