diff --git a/llvm/test/Transforms/InstSimplify/saturating-add-sub.ll b/llvm/test/Transforms/InstSimplify/saturating-add-sub.ll new file mode 100644 index 000000000000..b314e59b5cb2 --- /dev/null +++ b/llvm/test/Transforms/InstSimplify/saturating-add-sub.ll @@ -0,0 +1,448 @@ +; NOTE: Assertions have been autogenerated by utils/update_test_checks.py +; RUN: opt < %s -instsimplify -S | FileCheck %s + +declare i3 @llvm.uadd.sat.i3(i3, i3) +declare i8 @llvm.uadd.sat.i8(i8, i8) +declare <2 x i8> @llvm.uadd.sat.v2i8(<2 x i8>, <2 x i8>) +declare <2 x i9> @llvm.uadd.sat.v2i9(<2 x i9>, <2 x i9>) + +declare i8 @llvm.sadd.sat.i8(i8, i8) +declare <2 x i8> @llvm.sadd.sat.v2i8(<2 x i8>, <2 x i8>) + +declare i8 @llvm.usub.sat.i8(i8, i8) +declare i8 @llvm.ssub.sat.i8(i8, i8) +declare <2 x i8> @llvm.usub.sat.v2i8(<2 x i8>, <2 x i8>) +declare <2 x i8> @llvm.ssub.sat.v2i8(<2 x i8>, <2 x i8>) + +define i8 @uadd_scalar_0(i8 %a) { +; CHECK-LABEL: @uadd_scalar_0( +; CHECK-NEXT: [[X1:%.*]] = call i8 @llvm.uadd.sat.i8(i8 [[A:%.*]], i8 0) +; CHECK-NEXT: ret i8 [[X1]] +; + %x1 = call i8 @llvm.uadd.sat.i8(i8 %a, i8 0) + ret i8 %x1 +} + +define <2 x i8> @uadd_vector_0(<2 x i8> %a) { +; CHECK-LABEL: @uadd_vector_0( +; CHECK-NEXT: [[X1V:%.*]] = call <2 x i8> @llvm.uadd.sat.v2i8(<2 x i8> [[A:%.*]], <2 x i8> zeroinitializer) +; CHECK-NEXT: ret <2 x i8> [[X1V]] +; + %x1v = call <2 x i8> @llvm.uadd.sat.v2i8(<2 x i8> %a, <2 x i8> zeroinitializer) + ret <2 x i8> %x1v +} + +define i3 @uadd_scalar_0_commute(i3 %a) { +; CHECK-LABEL: @uadd_scalar_0_commute( +; CHECK-NEXT: [[X2:%.*]] = call i3 @llvm.uadd.sat.i3(i3 0, i3 [[A:%.*]]) +; CHECK-NEXT: ret i3 [[X2]] +; + %x2 = call i3 @llvm.uadd.sat.i3(i3 0, i3 %a) + ret i3 %x2 +} + +define <2 x i8> @uadd_vector_0_commute(<2 x i8> %a) { +; CHECK-LABEL: @uadd_vector_0_commute( +; CHECK-NEXT: [[X2V:%.*]] = call <2 x i8> @llvm.uadd.sat.v2i8(<2 x i8> , <2 x i8> [[A:%.*]]) +; CHECK-NEXT: ret <2 x i8> [[X2V]] +; + %x2v = call <2 x i8> @llvm.uadd.sat.v2i8(<2 x i8> , <2 x i8> %a) + ret <2 x i8> %x2v +} + +define i8 @uadd_scalar_maxval(i8 %a) { +; CHECK-LABEL: @uadd_scalar_maxval( +; CHECK-NEXT: [[X3:%.*]] = call i8 @llvm.uadd.sat.i8(i8 [[A:%.*]], i8 -1) +; CHECK-NEXT: ret i8 [[X3]] +; + %x3 = call i8 @llvm.uadd.sat.i8(i8 %a, i8 255) + ret i8 %x3 +} + +define <2 x i9> @uadd_vector_maxval(<2 x i9> %a) { +; CHECK-LABEL: @uadd_vector_maxval( +; CHECK-NEXT: [[X3V:%.*]] = call <2 x i9> @llvm.uadd.sat.v2i9(<2 x i9> [[A:%.*]], <2 x i9> ) +; CHECK-NEXT: ret <2 x i9> [[X3V]] +; + %x3v = call <2 x i9> @llvm.uadd.sat.v2i9(<2 x i9> %a, <2 x i9> ) + ret <2 x i9> %x3v +} + +define i3 @uadd_scalar_maxval_commute(i3 %a) { +; CHECK-LABEL: @uadd_scalar_maxval_commute( +; CHECK-NEXT: [[X4:%.*]] = call i3 @llvm.uadd.sat.i3(i3 -1, i3 [[A:%.*]]) +; CHECK-NEXT: ret i3 [[X4]] +; + %x4 = call i3 @llvm.uadd.sat.i3(i3 7, i3 %a) + ret i3 %x4 +} + +define <2 x i8> @uadd_vector_maxval_commute(<2 x i8> %a) { +; CHECK-LABEL: @uadd_vector_maxval_commute( +; CHECK-NEXT: [[X4V:%.*]] = call <2 x i8> @llvm.uadd.sat.v2i8(<2 x i8> , <2 x i8> [[A:%.*]]) +; CHECK-NEXT: ret <2 x i8> [[X4V]] +; + %x4v = call <2 x i8> @llvm.uadd.sat.v2i8(<2 x i8> , <2 x i8> %a) + ret <2 x i8> %x4v +} + +define i8 @uadd_scalar_undef(i8 %a) { +; CHECK-LABEL: @uadd_scalar_undef( +; CHECK-NEXT: [[X5:%.*]] = call i8 @llvm.uadd.sat.i8(i8 [[A:%.*]], i8 undef) +; CHECK-NEXT: ret i8 [[X5]] +; + %x5 = call i8 @llvm.uadd.sat.i8(i8 %a, i8 undef) + ret i8 %x5 +} + +define <2 x i8> @uadd_vector_undef(<2 x i8> %a) { +; CHECK-LABEL: @uadd_vector_undef( +; CHECK-NEXT: [[X5V:%.*]] = call <2 x i8> @llvm.uadd.sat.v2i8(<2 x i8> [[A:%.*]], <2 x i8> undef) +; CHECK-NEXT: ret <2 x i8> [[X5V]] +; + %x5v = call <2 x i8> @llvm.uadd.sat.v2i8(<2 x i8> %a, <2 x i8> ) + ret <2 x i8> %x5v +} + +define i8 @uadd_scalar_undef_commute(i8 %a) { +; CHECK-LABEL: @uadd_scalar_undef_commute( +; CHECK-NEXT: [[X6:%.*]] = call i8 @llvm.uadd.sat.i8(i8 undef, i8 [[A:%.*]]) +; CHECK-NEXT: ret i8 [[X6]] +; + %x6 = call i8 @llvm.uadd.sat.i8(i8 undef, i8 %a) + ret i8 %x6 +} + +define <2 x i8> @uadd_vector_undef_commute(<2 x i8> %a) { +; CHECK-LABEL: @uadd_vector_undef_commute( +; CHECK-NEXT: [[X5V:%.*]] = call <2 x i8> @llvm.uadd.sat.v2i8(<2 x i8> undef, <2 x i8> [[A:%.*]]) +; CHECK-NEXT: ret <2 x i8> [[X5V]] +; + %x5v = call <2 x i8> @llvm.uadd.sat.v2i8(<2 x i8> undef, <2 x i8> %a) + ret <2 x i8> %x5v +} + +define i8 @sadd_scalar_0(i8 %a) { +; CHECK-LABEL: @sadd_scalar_0( +; CHECK-NEXT: [[Y1:%.*]] = call i8 @llvm.sadd.sat.i8(i8 [[A:%.*]], i8 0) +; CHECK-NEXT: ret i8 [[Y1]] +; + %y1 = call i8 @llvm.sadd.sat.i8(i8 %a, i8 0) + ret i8 %y1 +} + +define <2 x i8> @sadd_vector_0(<2 x i8> %a) { +; CHECK-LABEL: @sadd_vector_0( +; CHECK-NEXT: [[Y1V:%.*]] = call <2 x i8> @llvm.sadd.sat.v2i8(<2 x i8> [[A:%.*]], <2 x i8> ) +; CHECK-NEXT: ret <2 x i8> [[Y1V]] +; + %y1v = call <2 x i8> @llvm.sadd.sat.v2i8(<2 x i8> %a, <2 x i8> ) + ret <2 x i8> %y1v +} + +define i8 @sadd_scalar_0_commute(i8 %a) { +; CHECK-LABEL: @sadd_scalar_0_commute( +; CHECK-NEXT: [[Y2:%.*]] = call i8 @llvm.sadd.sat.i8(i8 0, i8 [[A:%.*]]) +; CHECK-NEXT: ret i8 [[Y2]] +; + %y2 = call i8 @llvm.sadd.sat.i8(i8 0, i8 %a) + ret i8 %y2 +} + +define <2 x i8> @sadd_vector_0_commute(<2 x i8> %a) { +; CHECK-LABEL: @sadd_vector_0_commute( +; CHECK-NEXT: [[Y2V:%.*]] = call <2 x i8> @llvm.sadd.sat.v2i8(<2 x i8> zeroinitializer, <2 x i8> [[A:%.*]]) +; CHECK-NEXT: ret <2 x i8> [[Y2V]] +; + %y2v = call <2 x i8> @llvm.sadd.sat.v2i8(<2 x i8> zeroinitializer, <2 x i8> %a) + ret <2 x i8> %y2v +} + +define i8 @sadd_scalar_maxval(i8 %a) { +; CHECK-LABEL: @sadd_scalar_maxval( +; CHECK-NEXT: [[Y3:%.*]] = call i8 @llvm.sadd.sat.i8(i8 [[A:%.*]], i8 127) +; CHECK-NEXT: ret i8 [[Y3]] +; + %y3 = call i8 @llvm.sadd.sat.i8(i8 %a, i8 127) + ret i8 %y3 +} + +define <2 x i8> @sadd_vector_maxval(<2 x i8> %a) { +; CHECK-LABEL: @sadd_vector_maxval( +; CHECK-NEXT: [[Y3V:%.*]] = call <2 x i8> @llvm.sadd.sat.v2i8(<2 x i8> [[A:%.*]], <2 x i8> ) +; CHECK-NEXT: ret <2 x i8> [[Y3V]] +; + %y3v = call <2 x i8> @llvm.sadd.sat.v2i8(<2 x i8> %a, <2 x i8> ) + ret <2 x i8> %y3v +} + +define i8 @sadd_scalar_maxval_commute(i8 %a) { +; CHECK-LABEL: @sadd_scalar_maxval_commute( +; CHECK-NEXT: [[Y4:%.*]] = call i8 @llvm.sadd.sat.i8(i8 127, i8 [[A:%.*]]) +; CHECK-NEXT: ret i8 [[Y4]] +; + %y4 = call i8 @llvm.sadd.sat.i8(i8 127, i8 %a) + ret i8 %y4 +} + +define <2 x i8> @sadd_vector_maxval_commute(<2 x i8> %a) { +; CHECK-LABEL: @sadd_vector_maxval_commute( +; CHECK-NEXT: [[Y4V:%.*]] = call <2 x i8> @llvm.sadd.sat.v2i8(<2 x i8> , <2 x i8> [[A:%.*]]) +; CHECK-NEXT: ret <2 x i8> [[Y4V]] +; + %y4v = call <2 x i8> @llvm.sadd.sat.v2i8(<2 x i8> , <2 x i8> %a) + ret <2 x i8> %y4v +} + +define i8 @sadd_scalar_undef(i8 %a) { +; CHECK-LABEL: @sadd_scalar_undef( +; CHECK-NEXT: [[Y5:%.*]] = call i8 @llvm.sadd.sat.i8(i8 [[A:%.*]], i8 undef) +; CHECK-NEXT: ret i8 [[Y5]] +; + %y5 = call i8 @llvm.sadd.sat.i8(i8 %a, i8 undef) + ret i8 %y5 +} + +define <2 x i8> @sadd_vector_undef(<2 x i8> %a) { +; CHECK-LABEL: @sadd_vector_undef( +; CHECK-NEXT: [[Y5V:%.*]] = call <2 x i8> @llvm.sadd.sat.v2i8(<2 x i8> [[A:%.*]], <2 x i8> undef) +; CHECK-NEXT: ret <2 x i8> [[Y5V]] +; + %y5v = call <2 x i8> @llvm.sadd.sat.v2i8(<2 x i8> %a, <2 x i8> undef) + ret <2 x i8> %y5v +} + +define i8 @sadd_scalar_undef_commute(i8 %a) { +; CHECK-LABEL: @sadd_scalar_undef_commute( +; CHECK-NEXT: [[Y6:%.*]] = call i8 @llvm.sadd.sat.i8(i8 undef, i8 [[A:%.*]]) +; CHECK-NEXT: ret i8 [[Y6]] +; + %y6 = call i8 @llvm.sadd.sat.i8(i8 undef, i8 %a) + ret i8 %y6 +} + +define <2 x i8> @sadd_vector_undef_commute(<2 x i8> %a) { +; CHECK-LABEL: @sadd_vector_undef_commute( +; CHECK-NEXT: [[Y6V:%.*]] = call <2 x i8> @llvm.sadd.sat.v2i8(<2 x i8> undef, <2 x i8> [[A:%.*]]) +; CHECK-NEXT: ret <2 x i8> [[Y6V]] +; + %y6v = call <2 x i8> @llvm.sadd.sat.v2i8(<2 x i8> undef, <2 x i8> %a) + ret <2 x i8> %y6v +} + +define i8 @usub_scalar_0(i8 %a) { +; CHECK-LABEL: @usub_scalar_0( +; CHECK-NEXT: [[X1:%.*]] = call i8 @llvm.usub.sat.i8(i8 [[A:%.*]], i8 0) +; CHECK-NEXT: ret i8 [[X1]] +; + %x1 = call i8 @llvm.usub.sat.i8(i8 %a, i8 0) + ret i8 %x1 +} + +define <2 x i8> @usub_vector_0(<2 x i8> %a) { +; CHECK-LABEL: @usub_vector_0( +; CHECK-NEXT: [[X1V:%.*]] = call <2 x i8> @llvm.usub.sat.v2i8(<2 x i8> [[A:%.*]], <2 x i8> zeroinitializer) +; CHECK-NEXT: ret <2 x i8> [[X1V]] +; + %x1v = call <2 x i8> @llvm.usub.sat.v2i8(<2 x i8> %a, <2 x i8> ) + ret <2 x i8> %x1v +} + +define i8 @usub_scalar_0_commute(i8 %a) { +; CHECK-LABEL: @usub_scalar_0_commute( +; CHECK-NEXT: [[X2:%.*]] = call i8 @llvm.usub.sat.i8(i8 0, i8 [[A:%.*]]) +; CHECK-NEXT: ret i8 [[X2]] +; + %x2 = call i8 @llvm.usub.sat.i8(i8 0, i8 %a) + ret i8 %x2 +} + +define <2 x i8> @usub_vector_0_commute(<2 x i8> %a) { +; CHECK-LABEL: @usub_vector_0_commute( +; CHECK-NEXT: [[X2V:%.*]] = call <2 x i8> @llvm.usub.sat.v2i8(<2 x i8> zeroinitializer, <2 x i8> [[A:%.*]]) +; CHECK-NEXT: ret <2 x i8> [[X2V]] +; + %x2v = call <2 x i8> @llvm.usub.sat.v2i8(<2 x i8> , <2 x i8> %a) + ret <2 x i8> %x2v +} + +define i8 @usub_scalar_maxval(i8 %a) { +; CHECK-LABEL: @usub_scalar_maxval( +; CHECK-NEXT: [[X3:%.*]] = call i8 @llvm.usub.sat.i8(i8 [[A:%.*]], i8 -1) +; CHECK-NEXT: ret i8 [[X3]] +; + %x3 = call i8 @llvm.usub.sat.i8(i8 %a, i8 255) + ret i8 %x3 +} + +define <2 x i8> @usub_vector_maxval(<2 x i8> %a) { +; CHECK-LABEL: @usub_vector_maxval( +; CHECK-NEXT: [[X3V:%.*]] = call <2 x i8> @llvm.usub.sat.v2i8(<2 x i8> [[A:%.*]], <2 x i8> ) +; CHECK-NEXT: ret <2 x i8> [[X3V]] +; + %x3v = call <2 x i8> @llvm.usub.sat.v2i8(<2 x i8> %a, <2 x i8> ) + ret <2 x i8> %x3v +} + +define i8 @usub_scalar_undef(i8 %a) { +; CHECK-LABEL: @usub_scalar_undef( +; CHECK-NEXT: [[X4:%.*]] = call i8 @llvm.usub.sat.i8(i8 [[A:%.*]], i8 undef) +; CHECK-NEXT: ret i8 [[X4]] +; + %x4 = call i8 @llvm.usub.sat.i8(i8 %a, i8 undef) + ret i8 %x4 +} + +define <2 x i8> @usub_vector_undef(<2 x i8> %a) { +; CHECK-LABEL: @usub_vector_undef( +; CHECK-NEXT: [[X4V:%.*]] = call <2 x i8> @llvm.usub.sat.v2i8(<2 x i8> [[A:%.*]], <2 x i8> ) +; CHECK-NEXT: ret <2 x i8> [[X4V]] +; + %x4v = call <2 x i8> @llvm.usub.sat.v2i8(<2 x i8> %a, <2 x i8> ) + ret <2 x i8> %x4v +} + +define i8 @usub_scalar_undef_commute(i8 %a) { +; CHECK-LABEL: @usub_scalar_undef_commute( +; CHECK-NEXT: [[X5:%.*]] = call i8 @llvm.usub.sat.i8(i8 undef, i8 [[A:%.*]]) +; CHECK-NEXT: ret i8 [[X5]] +; + %x5 = call i8 @llvm.usub.sat.i8(i8 undef, i8 %a) + ret i8 %x5 +} + +define <2 x i8> @usub_vector_undef_commute(<2 x i8> %a) { +; CHECK-LABEL: @usub_vector_undef_commute( +; CHECK-NEXT: [[X5V:%.*]] = call <2 x i8> @llvm.usub.sat.v2i8(<2 x i8> [[A:%.*]], <2 x i8> undef) +; CHECK-NEXT: ret <2 x i8> [[X5V]] +; + %x5v = call <2 x i8> @llvm.usub.sat.v2i8(<2 x i8> %a, <2 x i8> ) + ret <2 x i8> %x5v +} + +define i8 @usub_scalar_same(i8 %a) { +; CHECK-LABEL: @usub_scalar_same( +; CHECK-NEXT: [[X6:%.*]] = call i8 @llvm.usub.sat.i8(i8 [[A:%.*]], i8 [[A]]) +; CHECK-NEXT: ret i8 [[X6]] +; + %x6 = call i8 @llvm.usub.sat.i8(i8 %a, i8 %a) + ret i8 %x6 +} + +define <2 x i8> @usub_vector_same(<2 x i8> %a) { +; CHECK-LABEL: @usub_vector_same( +; CHECK-NEXT: [[X6V:%.*]] = call <2 x i8> @llvm.usub.sat.v2i8(<2 x i8> [[A:%.*]], <2 x i8> [[A]]) +; CHECK-NEXT: ret <2 x i8> [[X6V]] +; + %x6v = call <2 x i8> @llvm.usub.sat.v2i8(<2 x i8> %a, <2 x i8> %a) + ret <2 x i8> %x6v +} + +define i8 @ssub_scalar_0(i8 %a) { +; CHECK-LABEL: @ssub_scalar_0( +; CHECK-NEXT: [[Y1:%.*]] = call i8 @llvm.ssub.sat.i8(i8 [[A:%.*]], i8 0) +; CHECK-NEXT: ret i8 [[Y1]] +; + %y1 = call i8 @llvm.ssub.sat.i8(i8 %a, i8 0) + ret i8 %y1 +} + +define <2 x i8> @ssub_vector_0(<2 x i8> %a) { +; CHECK-LABEL: @ssub_vector_0( +; CHECK-NEXT: [[Y1V:%.*]] = call <2 x i8> @llvm.ssub.sat.v2i8(<2 x i8> [[A:%.*]], <2 x i8> zeroinitializer) +; CHECK-NEXT: ret <2 x i8> [[Y1V]] +; + %y1v = call <2 x i8> @llvm.ssub.sat.v2i8(<2 x i8> %a, <2 x i8> ) + ret <2 x i8> %y1v +} + +define i8 @ssub_scalar_0_commute(i8 %a) { +; CHECK-LABEL: @ssub_scalar_0_commute( +; CHECK-NEXT: [[Y2:%.*]] = call i8 @llvm.ssub.sat.i8(i8 0, i8 [[A:%.*]]) +; CHECK-NEXT: ret i8 [[Y2]] +; + %y2 = call i8 @llvm.ssub.sat.i8(i8 0, i8 %a) + ret i8 %y2 +} + +define <2 x i8> @ssub_vector_0_commute(<2 x i8> %a) { +; CHECK-LABEL: @ssub_vector_0_commute( +; CHECK-NEXT: [[Y2V:%.*]] = call <2 x i8> @llvm.ssub.sat.v2i8(<2 x i8> zeroinitializer, <2 x i8> [[A:%.*]]) +; CHECK-NEXT: ret <2 x i8> [[Y2V]] +; + %y2v = call <2 x i8> @llvm.ssub.sat.v2i8(<2 x i8> , <2 x i8> %a) + ret <2 x i8> %y2v +} + +define i8 @ssub_scalar_maxval(i8 %a) { +; CHECK-LABEL: @ssub_scalar_maxval( +; CHECK-NEXT: [[Y3:%.*]] = call i8 @llvm.ssub.sat.i8(i8 [[A:%.*]], i8 127) +; CHECK-NEXT: ret i8 [[Y3]] +; + %y3 = call i8 @llvm.ssub.sat.i8(i8 %a, i8 127) + ret i8 %y3 +} + +define <2 x i8> @ssub_vector_maxval(<2 x i8> %a) { +; CHECK-LABEL: @ssub_vector_maxval( +; CHECK-NEXT: [[Y3V:%.*]] = call <2 x i8> @llvm.ssub.sat.v2i8(<2 x i8> [[A:%.*]], <2 x i8> ) +; CHECK-NEXT: ret <2 x i8> [[Y3V]] +; + %y3v = call <2 x i8> @llvm.ssub.sat.v2i8(<2 x i8> %a, <2 x i8> ) + ret <2 x i8> %y3v +} + +define i8 @ssub_scalar_undef(i8 %a) { +; CHECK-LABEL: @ssub_scalar_undef( +; CHECK-NEXT: [[Y4:%.*]] = call i8 @llvm.ssub.sat.i8(i8 [[A:%.*]], i8 undef) +; CHECK-NEXT: ret i8 [[Y4]] +; + %y4 = call i8 @llvm.ssub.sat.i8(i8 %a, i8 undef) + ret i8 %y4 +} + +define <2 x i8> @ssub_vector_undef(<2 x i8> %a) { +; CHECK-LABEL: @ssub_vector_undef( +; CHECK-NEXT: [[Y4V:%.*]] = call <2 x i8> @llvm.ssub.sat.v2i8(<2 x i8> [[A:%.*]], <2 x i8> undef) +; CHECK-NEXT: ret <2 x i8> [[Y4V]] +; + %y4v = call <2 x i8> @llvm.ssub.sat.v2i8(<2 x i8> %a, <2 x i8> undef) + ret <2 x i8> %y4v +} + +define i8 @ssub_scalar_undef_commute(i8 %a) { +; CHECK-LABEL: @ssub_scalar_undef_commute( +; CHECK-NEXT: [[Y5:%.*]] = call i8 @llvm.ssub.sat.i8(i8 undef, i8 [[A:%.*]]) +; CHECK-NEXT: ret i8 [[Y5]] +; + %y5 = call i8 @llvm.ssub.sat.i8(i8 undef, i8 %a) + ret i8 %y5 +} + +define <2 x i8> @ssub_vector_undef_commute(<2 x i8> %a) { +; CHECK-LABEL: @ssub_vector_undef_commute( +; CHECK-NEXT: [[Y5V:%.*]] = call <2 x i8> @llvm.ssub.sat.v2i8(<2 x i8> undef, <2 x i8> [[A:%.*]]) +; CHECK-NEXT: ret <2 x i8> [[Y5V]] +; + %y5v = call <2 x i8> @llvm.ssub.sat.v2i8(<2 x i8> , <2 x i8> %a) + ret <2 x i8> %y5v +} + +define i8 @ssub_scalar_same(i8 %a) { +; CHECK-LABEL: @ssub_scalar_same( +; CHECK-NEXT: [[Y6:%.*]] = call i8 @llvm.ssub.sat.i8(i8 [[A:%.*]], i8 [[A]]) +; CHECK-NEXT: ret i8 [[Y6]] +; + %y6 = call i8 @llvm.ssub.sat.i8(i8 %a, i8 %a) + ret i8 %y6 +} + +define <2 x i8> @ssub_vector_same(<2 x i8> %a) { +; CHECK-LABEL: @ssub_vector_same( +; CHECK-NEXT: [[Y6V:%.*]] = call <2 x i8> @llvm.ssub.sat.v2i8(<2 x i8> [[A:%.*]], <2 x i8> [[A]]) +; CHECK-NEXT: ret <2 x i8> [[Y6V]] +; + %y6v = call <2 x i8> @llvm.ssub.sat.v2i8(<2 x i8> %a, <2 x i8> %a) + ret <2 x i8> %y6v +} +