From 89654116199b56e30767848beebaeee5d2dc5c78 Mon Sep 17 00:00:00 2001 From: Sanjay Patel Date: Mon, 28 Jan 2019 20:37:18 +0000 Subject: [PATCH] [InstCombine] add another saturating uadd test (no undefs); NFC I forgot that our undef matching hasn't been completed in the previous commit. llvm-svn: 352424 --- .../InstCombine/saturating-add-sub.ll | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/llvm/test/Transforms/InstCombine/saturating-add-sub.ll b/llvm/test/Transforms/InstCombine/saturating-add-sub.ll index 0d038a414797..7e6e18001f62 100644 --- a/llvm/test/Transforms/InstCombine/saturating-add-sub.ll +++ b/llvm/test/Transforms/InstCombine/saturating-add-sub.ll @@ -680,13 +680,26 @@ define <4 x i32> @uadd_sat_constant_vec(<4 x i32> %x) { define <4 x i32> @uadd_sat_constant_vec_commute(<4 x i32> %x) { ; CHECK-LABEL: @uadd_sat_constant_vec_commute( -; CHECK-NEXT: [[A:%.*]] = add <4 x i32> [[X:%.*]], +; CHECK-NEXT: [[A:%.*]] = add <4 x i32> [[X:%.*]], ; CHECK-NEXT: [[C:%.*]] = icmp ult <4 x i32> [[X]], +; CHECK-NEXT: [[R:%.*]] = select <4 x i1> [[C]], <4 x i32> [[A]], <4 x i32> +; CHECK-NEXT: ret <4 x i32> [[R]] +; + %a = add <4 x i32> %x, + %c = icmp ult <4 x i32> %x, + %r = select <4 x i1> %c, <4 x i32> %a, <4 x i32> + ret <4 x i32> %r +} + +define <4 x i32> @uadd_sat_constant_vec_commute_undefs(<4 x i32> %x) { +; CHECK-LABEL: @uadd_sat_constant_vec_commute_undefs( +; CHECK-NEXT: [[A:%.*]] = add <4 x i32> [[X:%.*]], +; CHECK-NEXT: [[C:%.*]] = icmp ult <4 x i32> [[X]], ; CHECK-NEXT: [[R:%.*]] = select <4 x i1> [[C]], <4 x i32> [[A]], <4 x i32> ; CHECK-NEXT: ret <4 x i32> [[R]] ; %a = add <4 x i32> %x, - %c = icmp ult <4 x i32> %x, + %c = icmp ult <4 x i32> %x, %r = select <4 x i1> %c, <4 x i32> %a, <4 x i32> ret <4 x i32> %r }