diff options
Diffstat (limited to 'llvm/test/Analysis/ConstantFolding/saturating-add-sub.ll')
-rw-r--r-- | llvm/test/Analysis/ConstantFolding/saturating-add-sub.ll | 72 |
1 files changed, 24 insertions, 48 deletions
diff --git a/llvm/test/Analysis/ConstantFolding/saturating-add-sub.ll b/llvm/test/Analysis/ConstantFolding/saturating-add-sub.ll index 269bb9a15e4..7c6fdbf1e1f 100644 --- a/llvm/test/Analysis/ConstantFolding/saturating-add-sub.ll +++ b/llvm/test/Analysis/ConstantFolding/saturating-add-sub.ll @@ -175,8 +175,7 @@ define <2 x i8> @test_ssub_vector_sat_neg(<2 x i8> %a) { define i8 @test_uadd_scalar_both_undef() { ; CHECK-LABEL: @test_uadd_scalar_both_undef( -; CHECK-NEXT: [[X:%.*]] = call i8 @llvm.uadd.sat.i8(i8 undef, i8 undef) -; CHECK-NEXT: ret i8 [[X]] +; CHECK-NEXT: ret i8 undef ; %x = call i8 @llvm.uadd.sat.i8(i8 undef, i8 undef) ret i8 %x @@ -184,8 +183,7 @@ define i8 @test_uadd_scalar_both_undef() { define i8 @test_sadd_scalar_both_undef() { ; CHECK-LABEL: @test_sadd_scalar_both_undef( -; CHECK-NEXT: [[X:%.*]] = call i8 @llvm.sadd.sat.i8(i8 undef, i8 undef) -; CHECK-NEXT: ret i8 [[X]] +; CHECK-NEXT: ret i8 undef ; %x = call i8 @llvm.sadd.sat.i8(i8 undef, i8 undef) ret i8 %x @@ -193,8 +191,7 @@ define i8 @test_sadd_scalar_both_undef() { define i8 @test_usub_scalar_both_undef() { ; CHECK-LABEL: @test_usub_scalar_both_undef( -; CHECK-NEXT: [[X:%.*]] = call i8 @llvm.usub.sat.i8(i8 undef, i8 undef) -; CHECK-NEXT: ret i8 [[X]] +; CHECK-NEXT: ret i8 undef ; %x = call i8 @llvm.usub.sat.i8(i8 undef, i8 undef) ret i8 %x @@ -202,8 +199,7 @@ define i8 @test_usub_scalar_both_undef() { define i8 @test_ssub_scalar_both_undef() { ; CHECK-LABEL: @test_ssub_scalar_both_undef( -; CHECK-NEXT: [[X:%.*]] = call i8 @llvm.ssub.sat.i8(i8 undef, i8 undef) -; CHECK-NEXT: ret i8 [[X]] +; CHECK-NEXT: ret i8 undef ; %x = call i8 @llvm.ssub.sat.i8(i8 undef, i8 undef) ret i8 %x @@ -211,8 +207,7 @@ define i8 @test_ssub_scalar_both_undef() { define i8 @test_uadd_scalar_op2_undef() { ; CHECK-LABEL: @test_uadd_scalar_op2_undef( -; CHECK-NEXT: [[X:%.*]] = call i8 @llvm.uadd.sat.i8(i8 10, i8 undef) -; CHECK-NEXT: ret i8 [[X]] +; CHECK-NEXT: ret i8 -1 ; %x = call i8 @llvm.uadd.sat.i8(i8 10, i8 undef) ret i8 %x @@ -220,8 +215,7 @@ define i8 @test_uadd_scalar_op2_undef() { define i8 @test_sadd_scalar_op1_undef() { ; CHECK-LABEL: @test_sadd_scalar_op1_undef( -; CHECK-NEXT: [[X:%.*]] = call i8 @llvm.sadd.sat.i8(i8 undef, i8 10) -; CHECK-NEXT: ret i8 [[X]] +; CHECK-NEXT: ret i8 -1 ; %x = call i8 @llvm.sadd.sat.i8(i8 undef, i8 10) ret i8 %x @@ -229,8 +223,7 @@ define i8 @test_sadd_scalar_op1_undef() { define i8 @test_usub_scalar_op2_undef() { ; CHECK-LABEL: @test_usub_scalar_op2_undef( -; CHECK-NEXT: [[X:%.*]] = call i8 @llvm.usub.sat.i8(i8 10, i8 undef) -; CHECK-NEXT: ret i8 [[X]] +; CHECK-NEXT: ret i8 0 ; %x = call i8 @llvm.usub.sat.i8(i8 10, i8 undef) ret i8 %x @@ -238,8 +231,7 @@ define i8 @test_usub_scalar_op2_undef() { define i8 @test_usub_scalar_op1_undef() { ; CHECK-LABEL: @test_usub_scalar_op1_undef( -; CHECK-NEXT: [[X:%.*]] = call i8 @llvm.usub.sat.i8(i8 undef, i8 10) -; CHECK-NEXT: ret i8 [[X]] +; CHECK-NEXT: ret i8 0 ; %x = call i8 @llvm.usub.sat.i8(i8 undef, i8 10) ret i8 %x @@ -247,8 +239,7 @@ define i8 @test_usub_scalar_op1_undef() { define <2 x i8> @test_uadd_vector_both_undef_splat() { ; CHECK-LABEL: @test_uadd_vector_both_undef_splat( -; CHECK-NEXT: [[X:%.*]] = call <2 x i8> @llvm.uadd.sat.v2i8(<2 x i8> undef, <2 x i8> undef) -; CHECK-NEXT: ret <2 x i8> [[X]] +; CHECK-NEXT: ret <2 x i8> undef ; %x = call <2 x i8> @llvm.uadd.sat.v2i8(<2 x i8> undef, <2 x i8> undef) ret <2 x i8> %x @@ -256,8 +247,7 @@ define <2 x i8> @test_uadd_vector_both_undef_splat() { define <2 x i8> @test_sadd_vector_both_undef_splat() { ; CHECK-LABEL: @test_sadd_vector_both_undef_splat( -; CHECK-NEXT: [[X:%.*]] = call <2 x i8> @llvm.sadd.sat.v2i8(<2 x i8> undef, <2 x i8> undef) -; CHECK-NEXT: ret <2 x i8> [[X]] +; CHECK-NEXT: ret <2 x i8> undef ; %x = call <2 x i8> @llvm.sadd.sat.v2i8(<2 x i8> undef, <2 x i8> undef) ret <2 x i8> %x @@ -265,8 +255,7 @@ define <2 x i8> @test_sadd_vector_both_undef_splat() { define <2 x i8> @test_usub_vector_both_undef_splat() { ; CHECK-LABEL: @test_usub_vector_both_undef_splat( -; CHECK-NEXT: [[X:%.*]] = call <2 x i8> @llvm.usub.sat.v2i8(<2 x i8> undef, <2 x i8> undef) -; CHECK-NEXT: ret <2 x i8> [[X]] +; CHECK-NEXT: ret <2 x i8> undef ; %x = call <2 x i8> @llvm.usub.sat.v2i8(<2 x i8> undef, <2 x i8> undef) ret <2 x i8> %x @@ -274,8 +263,7 @@ define <2 x i8> @test_usub_vector_both_undef_splat() { define <2 x i8> @test_ssub_vector_both_undef_splat() { ; CHECK-LABEL: @test_ssub_vector_both_undef_splat( -; CHECK-NEXT: [[X:%.*]] = call <2 x i8> @llvm.ssub.sat.v2i8(<2 x i8> undef, <2 x i8> undef) -; CHECK-NEXT: ret <2 x i8> [[X]] +; CHECK-NEXT: ret <2 x i8> undef ; %x = call <2 x i8> @llvm.ssub.sat.v2i8(<2 x i8> undef, <2 x i8> undef) ret <2 x i8> %x @@ -283,8 +271,7 @@ define <2 x i8> @test_ssub_vector_both_undef_splat() { define <2 x i8> @test_uadd_vector_op2_undef_splat() { ; CHECK-LABEL: @test_uadd_vector_op2_undef_splat( -; CHECK-NEXT: [[X:%.*]] = call <2 x i8> @llvm.uadd.sat.v2i8(<2 x i8> <i8 10, i8 20>, <2 x i8> undef) -; CHECK-NEXT: ret <2 x i8> [[X]] +; CHECK-NEXT: ret <2 x i8> <i8 -1, i8 -1> ; %x = call <2 x i8> @llvm.uadd.sat.v2i8(<2 x i8> <i8 10, i8 20>, <2 x i8> undef) ret <2 x i8> %x @@ -292,8 +279,7 @@ define <2 x i8> @test_uadd_vector_op2_undef_splat() { define <2 x i8> @test_sadd_vector_op1_undef_splat() { ; CHECK-LABEL: @test_sadd_vector_op1_undef_splat( -; CHECK-NEXT: [[X:%.*]] = call <2 x i8> @llvm.sadd.sat.v2i8(<2 x i8> undef, <2 x i8> <i8 10, i8 20>) -; CHECK-NEXT: ret <2 x i8> [[X]] +; CHECK-NEXT: ret <2 x i8> <i8 -1, i8 -1> ; %x = call <2 x i8> @llvm.sadd.sat.v2i8(<2 x i8> undef, <2 x i8> <i8 10, i8 20>) ret <2 x i8> %x @@ -301,8 +287,7 @@ define <2 x i8> @test_sadd_vector_op1_undef_splat() { define <2 x i8> @test_usub_vector_op2_undef_splat() { ; CHECK-LABEL: @test_usub_vector_op2_undef_splat( -; CHECK-NEXT: [[X:%.*]] = call <2 x i8> @llvm.usub.sat.v2i8(<2 x i8> <i8 10, i8 20>, <2 x i8> undef) -; CHECK-NEXT: ret <2 x i8> [[X]] +; CHECK-NEXT: ret <2 x i8> zeroinitializer ; %x = call <2 x i8> @llvm.usub.sat.v2i8(<2 x i8> <i8 10, i8 20>, <2 x i8> undef) ret <2 x i8> %x @@ -310,8 +295,7 @@ define <2 x i8> @test_usub_vector_op2_undef_splat() { define <2 x i8> @test_ssub_vector_op1_undef_splat() { ; CHECK-LABEL: @test_ssub_vector_op1_undef_splat( -; CHECK-NEXT: [[X:%.*]] = call <2 x i8> @llvm.ssub.sat.v2i8(<2 x i8> undef, <2 x i8> <i8 10, i8 20>) -; CHECK-NEXT: ret <2 x i8> [[X]] +; CHECK-NEXT: ret <2 x i8> zeroinitializer ; %x = call <2 x i8> @llvm.ssub.sat.v2i8(<2 x i8> undef, <2 x i8> <i8 10, i8 20>) ret <2 x i8> %x @@ -319,8 +303,7 @@ define <2 x i8> @test_ssub_vector_op1_undef_splat() { define <2 x i8> @test_uadd_vector_op2_undef_mix1() { ; CHECK-LABEL: @test_uadd_vector_op2_undef_mix1( -; CHECK-NEXT: [[X:%.*]] = call <2 x i8> @llvm.uadd.sat.v2i8(<2 x i8> <i8 10, i8 undef>, <2 x i8> <i8 20, i8 undef>) -; CHECK-NEXT: ret <2 x i8> [[X]] +; CHECK-NEXT: ret <2 x i8> <i8 30, i8 undef> ; %x = call <2 x i8> @llvm.uadd.sat.v2i8(<2 x i8> <i8 10, i8 undef>, <2 x i8> <i8 20, i8 undef>) ret <2 x i8> %x @@ -328,8 +311,7 @@ define <2 x i8> @test_uadd_vector_op2_undef_mix1() { define <2 x i8> @test_uadd_vector_op2_undef_mix2() { ; CHECK-LABEL: @test_uadd_vector_op2_undef_mix2( -; CHECK-NEXT: [[X:%.*]] = call <2 x i8> @llvm.uadd.sat.v2i8(<2 x i8> <i8 10, i8 undef>, <2 x i8> <i8 undef, i8 20>) -; CHECK-NEXT: ret <2 x i8> [[X]] +; CHECK-NEXT: ret <2 x i8> <i8 -1, i8 -1> ; %x = call <2 x i8> @llvm.uadd.sat.v2i8(<2 x i8> <i8 10, i8 undef>, <2 x i8> <i8 undef, i8 20>) ret <2 x i8> %x @@ -337,8 +319,7 @@ define <2 x i8> @test_uadd_vector_op2_undef_mix2() { define <2 x i8> @test_sadd_vector_op1_undef_mix1() { ; CHECK-LABEL: @test_sadd_vector_op1_undef_mix1( -; CHECK-NEXT: [[X:%.*]] = call <2 x i8> @llvm.sadd.sat.v2i8(<2 x i8> <i8 undef, i8 10>, <2 x i8> <i8 undef, i8 20>) -; CHECK-NEXT: ret <2 x i8> [[X]] +; CHECK-NEXT: ret <2 x i8> <i8 undef, i8 30> ; %x = call <2 x i8> @llvm.sadd.sat.v2i8(<2 x i8> <i8 undef, i8 10>, <2 x i8> <i8 undef, i8 20>) ret <2 x i8> %x @@ -346,8 +327,7 @@ define <2 x i8> @test_sadd_vector_op1_undef_mix1() { define <2 x i8> @test_sadd_vector_op1_undef_mix2() { ; CHECK-LABEL: @test_sadd_vector_op1_undef_mix2( -; CHECK-NEXT: [[X:%.*]] = call <2 x i8> @llvm.sadd.sat.v2i8(<2 x i8> <i8 undef, i8 10>, <2 x i8> <i8 20, i8 undef>) -; CHECK-NEXT: ret <2 x i8> [[X]] +; CHECK-NEXT: ret <2 x i8> <i8 -1, i8 -1> ; %x = call <2 x i8> @llvm.sadd.sat.v2i8(<2 x i8> <i8 undef, i8 10>, <2 x i8> <i8 20, i8 undef>) ret <2 x i8> %x @@ -355,8 +335,7 @@ define <2 x i8> @test_sadd_vector_op1_undef_mix2() { define <2 x i8> @test_usub_vector_op2_undef_mix1() { ; CHECK-LABEL: @test_usub_vector_op2_undef_mix1( -; CHECK-NEXT: [[X:%.*]] = call <2 x i8> @llvm.usub.sat.v2i8(<2 x i8> <i8 10, i8 undef>, <2 x i8> <i8 20, i8 undef>) -; CHECK-NEXT: ret <2 x i8> [[X]] +; CHECK-NEXT: ret <2 x i8> <i8 0, i8 undef> ; %x = call <2 x i8> @llvm.usub.sat.v2i8(<2 x i8> <i8 10, i8 undef>, <2 x i8> <i8 20, i8 undef>) ret <2 x i8> %x @@ -364,8 +343,7 @@ define <2 x i8> @test_usub_vector_op2_undef_mix1() { define <2 x i8> @test_usub_vector_op2_undef_mix2() { ; CHECK-LABEL: @test_usub_vector_op2_undef_mix2( -; CHECK-NEXT: [[X:%.*]] = call <2 x i8> @llvm.usub.sat.v2i8(<2 x i8> <i8 10, i8 undef>, <2 x i8> <i8 undef, i8 20>) -; CHECK-NEXT: ret <2 x i8> [[X]] +; CHECK-NEXT: ret <2 x i8> zeroinitializer ; %x = call <2 x i8> @llvm.usub.sat.v2i8(<2 x i8> <i8 10, i8 undef>, <2 x i8> <i8 undef, i8 20>) ret <2 x i8> %x @@ -373,8 +351,7 @@ define <2 x i8> @test_usub_vector_op2_undef_mix2() { define <2 x i8> @test_ssub_vector_op1_undef_mix1() { ; CHECK-LABEL: @test_ssub_vector_op1_undef_mix1( -; CHECK-NEXT: [[X:%.*]] = call <2 x i8> @llvm.ssub.sat.v2i8(<2 x i8> <i8 undef, i8 10>, <2 x i8> <i8 undef, i8 20>) -; CHECK-NEXT: ret <2 x i8> [[X]] +; CHECK-NEXT: ret <2 x i8> <i8 undef, i8 -10> ; %x = call <2 x i8> @llvm.ssub.sat.v2i8(<2 x i8> <i8 undef, i8 10>, <2 x i8> <i8 undef, i8 20>) ret <2 x i8> %x @@ -382,8 +359,7 @@ define <2 x i8> @test_ssub_vector_op1_undef_mix1() { define <2 x i8> @test_ssub_vector_op1_undef_mix2() { ; CHECK-LABEL: @test_ssub_vector_op1_undef_mix2( -; CHECK-NEXT: [[X:%.*]] = call <2 x i8> @llvm.ssub.sat.v2i8(<2 x i8> <i8 undef, i8 10>, <2 x i8> <i8 20, i8 undef>) -; CHECK-NEXT: ret <2 x i8> [[X]] +; CHECK-NEXT: ret <2 x i8> zeroinitializer ; %x = call <2 x i8> @llvm.ssub.sat.v2i8(<2 x i8> <i8 undef, i8 10>, <2 x i8> <i8 20, i8 undef>) ret <2 x i8> %x |