From 9555d1edb0d16f135ae57695fc2da55deaabf082 Mon Sep 17 00:00:00 2001 From: Sanjay Patel Date: Sun, 19 Sep 2021 09:18:07 -0400 Subject: [PATCH] [InstCombine] add/adjust tests for min/max intrinsics; NFC If we transform these, we have to propagate no-wrap/undef carefully. --- .../Transforms/InstCombine/minmax-intrinsics.ll | 23 ++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/llvm/test/Transforms/InstCombine/minmax-intrinsics.ll b/llvm/test/Transforms/InstCombine/minmax-intrinsics.ll index d0d65f8..b84eee0 100644 --- a/llvm/test/Transforms/InstCombine/minmax-intrinsics.ll +++ b/llvm/test/Transforms/InstCombine/minmax-intrinsics.ll @@ -1924,11 +1924,11 @@ define i8 @smax_offset_uses(i8 %x) { define <3 x i8> @smin_offset(<3 x i8> %x) { ; CHECK-LABEL: @smin_offset( -; CHECK-NEXT: [[A:%.*]] = add nsw <3 x i8> [[X:%.*]], +; CHECK-NEXT: [[A:%.*]] = add nuw nsw <3 x i8> [[X:%.*]], ; CHECK-NEXT: [[M:%.*]] = call <3 x i8> @llvm.smin.v3i8(<3 x i8> [[A]], <3 x i8> ) ; CHECK-NEXT: ret <3 x i8> [[M]] ; - %a = add nsw <3 x i8> %x, + %a = add nsw nuw <3 x i8> %x, %m = call <3 x i8> @llvm.smin.v3i8(<3 x i8> %a, <3 x i8> ) ret <3 x i8> %m } @@ -1977,12 +1977,12 @@ define i8 @smin_offset_uses(i8 %x) { define <3 x i8> @umax_offset(<3 x i8> %x) { ; CHECK-LABEL: @umax_offset( -; CHECK-NEXT: [[A:%.*]] = add nuw <3 x i8> [[X:%.*]], -; CHECK-NEXT: [[M:%.*]] = call <3 x i8> @llvm.umax.v3i8(<3 x i8> [[A]], <3 x i8> ) +; CHECK-NEXT: [[A:%.*]] = add nuw nsw <3 x i8> [[X:%.*]], +; CHECK-NEXT: [[M:%.*]] = call <3 x i8> @llvm.umax.v3i8(<3 x i8> [[A]], <3 x i8> ) ; CHECK-NEXT: ret <3 x i8> [[M]] ; - %a = add nuw <3 x i8> %x, - %m = call <3 x i8> @llvm.umax.v3i8(<3 x i8> %a, <3 x i8> ) + %a = add nsw nuw <3 x i8> %x, + %m = call <3 x i8> @llvm.umax.v3i8(<3 x i8> %a, <3 x i8> ) ret <3 x i8> %m } @@ -2082,3 +2082,14 @@ define i8 @umin_offset_uses(i8 %x) { %m = call i8 @llvm.umin.i8(i8 %a, i8 252) ret i8 %m } + +define <3 x i8> @umax_vector_splat_undef(<3 x i8> %x) { +; CHECK-LABEL: @umax_vector_splat_undef( +; CHECK-NEXT: [[A:%.*]] = add nuw <3 x i8> [[X:%.*]], +; CHECK-NEXT: [[R:%.*]] = call <3 x i8> @llvm.umax.v3i8(<3 x i8> [[A]], <3 x i8> ) +; CHECK-NEXT: ret <3 x i8> [[R]] +; + %a = add nuw <3 x i8> %x, + %r = call <3 x i8> @llvm.umax.v3i8(<3 x i8> %a, <3 x i8> ) + ret <3 x i8> %r +} -- 2.7.4