brintos

brintos / llvm-project-archived public Read only

0
0
Text · 3.6 KiB · a98a219 Raw
75 lines · plain
1; NOTE: Assertions have been autogenerated by utils/update_test_checks.py2; RUN: opt %s -passes='function(scalarizer<load-store>)' -S | FileCheck %s3 4; This verifies that the order of extract element instructions is5; deterministic. In the past we could end up with different results depending6; on the compiler used (due to argument evaluation order being undefined in7; C++). The order of the extracts is not really important for correctness of8; the result, but when debugging and creating test cases it is helpful if we9; get the same out put regardless of which compiler we use when building the10; compiler.11 12define <2 x i32> @test1(i1 %b, <2 x i32> %i, <2 x i32> %j) {13; CHECK-LABEL: @test1(14; CHECK-NEXT:    [[I_I0:%.*]] = extractelement <2 x i32> [[I:%.*]], i64 015; CHECK-NEXT:    [[J_I0:%.*]] = extractelement <2 x i32> [[J:%.*]], i64 016; CHECK-NEXT:    [[RES_I0:%.*]] = select i1 [[B:%.*]], i32 [[I_I0]], i32 [[J_I0]]17; CHECK-NEXT:    [[I_I1:%.*]] = extractelement <2 x i32> [[I]], i64 118; CHECK-NEXT:    [[J_I1:%.*]] = extractelement <2 x i32> [[J]], i64 119; CHECK-NEXT:    [[RES_I1:%.*]] = select i1 [[B]], i32 [[I_I1]], i32 [[J_I1]]20; CHECK-NEXT:    [[RES_UPTO0:%.*]] = insertelement <2 x i32> poison, i32 [[RES_I0]], i64 021; CHECK-NEXT:    [[RES:%.*]] = insertelement <2 x i32> [[RES_UPTO0]], i32 [[RES_I1]], i64 122; CHECK-NEXT:    ret <2 x i32> [[RES]]23;24  %res = select i1 %b, <2 x i32> %i, <2 x i32> %j25  ret <2 x i32> %res26}27 28define <2 x i32> @test2(<2 x i1> %b, <2 x i32> %i, <2 x i32> %j) {29; CHECK-LABEL: @test2(30; CHECK-NEXT:    [[B_I0:%.*]] = extractelement <2 x i1> [[B:%.*]], i64 031; CHECK-NEXT:    [[I_I0:%.*]] = extractelement <2 x i32> [[I:%.*]], i64 032; CHECK-NEXT:    [[J_I0:%.*]] = extractelement <2 x i32> [[J:%.*]], i64 033; CHECK-NEXT:    [[RES_I0:%.*]] = select i1 [[B_I0]], i32 [[I_I0]], i32 [[J_I0]]34; CHECK-NEXT:    [[B_I1:%.*]] = extractelement <2 x i1> [[B]], i64 135; CHECK-NEXT:    [[I_I1:%.*]] = extractelement <2 x i32> [[I]], i64 136; CHECK-NEXT:    [[J_I1:%.*]] = extractelement <2 x i32> [[J]], i64 137; CHECK-NEXT:    [[RES_I1:%.*]] = select i1 [[B_I1]], i32 [[I_I1]], i32 [[J_I1]]38; CHECK-NEXT:    [[RES_UPTO0:%.*]] = insertelement <2 x i32> poison, i32 [[RES_I0]], i64 039; CHECK-NEXT:    [[RES:%.*]] = insertelement <2 x i32> [[RES_UPTO0]], i32 [[RES_I1]], i64 140; CHECK-NEXT:    ret <2 x i32> [[RES]]41;42  %res = select <2 x i1> %b, <2 x i32> %i, <2 x i32> %j43  ret <2 x i32> %res44}45 46define <2 x i32> @test3(<2 x i32> %i, <2 x i32> %j) {47; CHECK-LABEL: @test3(48; CHECK-NEXT:    [[I_I0:%.*]] = extractelement <2 x i32> [[I:%.*]], i64 049; CHECK-NEXT:    [[J_I0:%.*]] = extractelement <2 x i32> [[J:%.*]], i64 050; CHECK-NEXT:    [[RES_I0:%.*]] = add nuw nsw i32 [[I_I0]], [[J_I0]]51; CHECK-NEXT:    [[I_I1:%.*]] = extractelement <2 x i32> [[I]], i64 152; CHECK-NEXT:    [[J_I1:%.*]] = extractelement <2 x i32> [[J]], i64 153; CHECK-NEXT:    [[RES_I1:%.*]] = add nuw nsw i32 [[I_I1]], [[J_I1]]54; CHECK-NEXT:    [[RES_UPTO0:%.*]] = insertelement <2 x i32> poison, i32 [[RES_I0]], i64 055; CHECK-NEXT:    [[RES:%.*]] = insertelement <2 x i32> [[RES_UPTO0]], i32 [[RES_I1]], i64 156; CHECK-NEXT:    ret <2 x i32> [[RES]]57;58  %res = add nuw nsw <2 x i32> %i, %j59  ret <2 x i32> %res60}61 62define void @test4(ptr %ptr, <2 x i32> %val) {63; CHECK-LABEL: @test4(64; CHECK-NEXT:    [[VAL_I0:%.*]] = extractelement <2 x i32> [[VAL:%.*]], i64 065; CHECK-NEXT:    store i32 [[VAL_I0]], ptr [[PTR:%.*]], align 866; CHECK-NEXT:    [[VAL_I1:%.*]] = extractelement <2 x i32> [[VAL]], i64 167; CHECK-NEXT:    [[PTR_I1:%.*]] = getelementptr i32, ptr [[PTR]], i32 168; CHECK-NEXT:    store i32 [[VAL_I1]], ptr [[PTR_I1]], align 469; CHECK-NEXT:    ret void70;71  store <2 x i32> %val, ptr %ptr72  ret void73}74 75