Address issues found by Duncan during post-commit review of r177856.
[oota-llvm.git] / test / Transforms / InstCombine / vec_sext.ll
1 ; RUN: opt < %s -instcombine -S | FileCheck %s
2
3 define <4 x i32> @psignd_3(<4 x i32> %a, <4 x i32> %b) nounwind ssp {
4 entry:
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:   ashr <4 x i32> %b, <i32 31, i32 31, i32 31, i32 31>
17 ; CHECK:   sub nsw <4 x i32> zeroinitializer, %a
18 ; CHECK:   xor <4 x i32> %b.lobit, <i32 -1, i32 -1, i32 -1, i32 -1>
19 ; CHECK:   and <4 x i32> %a, %0
20 ; CHECK:   and <4 x i32> %b.lobit, %sub
21 ; CHECK:   or <4 x i32> %1, %2
22 }