diff options
Diffstat (limited to 'llvm/test/Transforms/InstCombine/select_meta.ll')
| -rw-r--r-- | llvm/test/Transforms/InstCombine/select_meta.ll | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/llvm/test/Transforms/InstCombine/select_meta.ll b/llvm/test/Transforms/InstCombine/select_meta.ll index 6a2ca43a4cb..26b49f6f952 100644 --- a/llvm/test/Transforms/InstCombine/select_meta.ll +++ b/llvm/test/Transforms/InstCombine/select_meta.ll @@ -1,3 +1,4 @@ +; NOTE: Assertions have been autogenerated by utils/update_test_checks.py ; RUN: opt < %s -instcombine -S | FileCheck %s define i32 @foo(i32) local_unnamed_addr #0 { @@ -80,6 +81,25 @@ define i32 @abs_nabs_x01(i32 %x) { ; CHECK-NEXT: [[SEL:%[a-z0-9]+]] = select i1 [[CMP]], i32 %x, i32 [[NEG]], !prof ![[MD1]] } +; FIXME - vectors should get the same folds +define <2 x i32> @abs_nabs_x01_vec(<2 x i32> %x) { +; CHECK-LABEL: @abs_nabs_x01_vec( +; CHECK-NEXT: [[CMP:%.*]] = icmp sgt <2 x i32> %x, <i32 -1, i32 -1> +; CHECK-NEXT: [[SUB:%.*]] = sub nsw <2 x i32> zeroinitializer, %x +; CHECK-NEXT: [[COND:%.*]] = select <2 x i1> [[CMP]], <2 x i32> [[SUB]], <2 x i32> %x, !prof !0 +; CHECK-NEXT: [[CMP1:%.*]] = icmp sgt <2 x i32> [[COND]], <i32 -1, i32 -1> +; CHECK-NEXT: [[SUB16:%.*]] = sub nsw <2 x i32> zeroinitializer, [[COND]] +; CHECK-NEXT: [[COND18:%.*]] = select <2 x i1> [[CMP1]], <2 x i32> [[COND]], <2 x i32> [[SUB16]], !prof !2 +; CHECK-NEXT: ret <2 x i32> [[COND18]] +; + %cmp = icmp sgt <2 x i32> %x, <i32 -1, i32 -1> + %sub = sub nsw <2 x i32> zeroinitializer, %x + %cond = select <2 x i1> %cmp, <2 x i32> %sub, <2 x i32> %x, !prof !1 + %cmp1 = icmp sgt <2 x i32> %cond, <i32 -1, i32 -1> + %sub16 = sub nsw <2 x i32> zeroinitializer, %cond + %cond18 = select <2 x i1> %cmp1, <2 x i32> %cond, <2 x i32> %sub16, !prof !2 + ret <2 x i32> %cond18 +} ; SMAX(SMAX(x, y), x) -> SMAX(x, y) define i32 @test30(i32 %x, i32 %y) { |

