1; RUN: opt < %s -instcombine -S | FileCheck %s 2 3define <4 x i32> @psignd_3(<4 x i32> %a, <4 x i32> %b) nounwind ssp { 4entry: 5 %cmp = icmp slt <4 x i32> %b, zeroinitializer 6 %sext = sext <4 x i1> %cmp to <4 x i32> 7 %sub = sub nsw <4 x i32> zeroinitializer, %a 8 %0 = icmp slt <4 x i32> %sext, zeroinitializer 9 %sext3 = sext <4 x i1> %0 to <4 x i32> 10 %1 = xor <4 x i32> %sext3, <i32 -1, i32 -1, i32 -1, i32 -1> 11 %2 = and <4 x i32> %a, %1 12 %3 = and <4 x i32> %sext3, %sub 13 %cond = or <4 x i32> %2, %3 14 ret <4 x i32> %cond 15 16; CHECK-LABEL: @psignd_3 17; CHECK: ashr <4 x i32> %b, <i32 31, i32 31, i32 31, i32 31> 18; CHECK: sub nsw <4 x i32> zeroinitializer, %a 19; CHECK: xor <4 x i32> %b.lobit, <i32 -1, i32 -1, i32 -1, i32 -1> 20; CHECK: and <4 x i32> %a, %0 21; CHECK: and <4 x i32> %b.lobit, %sub 22; CHECK: or <4 x i32> %1, %2 23} 24 25define <4 x i32> @test1(<4 x i32> %a, <4 x i32> %b) nounwind ssp { 26entry: 27 %cmp = icmp sgt <4 x i32> %b, <i32 -1, i32 -1, i32 -1, i32 -1> 28 %sext = sext <4 x i1> %cmp to <4 x i32> 29 %sub = sub nsw <4 x i32> zeroinitializer, %a 30 %0 = icmp slt <4 x i32> %sext, zeroinitializer 31 %sext3 = sext <4 x i1> %0 to <4 x i32> 32 %1 = xor <4 x i32> %sext3, <i32 -1, i32 -1, i32 -1, i32 -1> 33 %2 = and <4 x i32> %a, %1 34 %3 = and <4 x i32> %sext3, %sub 35 %cond = or <4 x i32> %2, %3 36 ret <4 x i32> %cond 37 38; CHECK-LABEL: @test1 39; CHECK: ashr <4 x i32> %b, <i32 31, i32 31, i32 31, i32 31> 40; CHECK: xor <4 x i32> %b.lobit, <i32 -1, i32 -1, i32 -1, i32 -1> 41; CHECK: sub nsw <4 x i32> zeroinitializer, %a 42; CHECK: and <4 x i32> %b.lobit, %a 43; CHECK: and <4 x i32> %b.lobit.not, %sub 44; CHECK: or <4 x i32> %0, %1 45} 46