]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - test/Transforms/InstCombine/onehot_merge.ll
Vendor import of llvm RELEASE_350/final tag r216957 (effectively, 3.5.0 release):
[FreeBSD/FreeBSD.git] / test / Transforms / InstCombine / onehot_merge.ll
1 ; RUN: opt < %s -instcombine -S | FileCheck %s
2
3 ;CHECK: @and_consts
4 ;CHECK: and i32 %k, 12
5 ;CHECK: icmp ne i32 %0, 12
6 ;CHECK: ret
7 define i1 @and_consts(i32 %k, i32 %c1, i32 %c2) {
8 bb:
9   %tmp1 = and i32 4, %k
10   %tmp2 = icmp eq i32 %tmp1, 0
11   %tmp5 = and i32 8, %k
12   %tmp6 = icmp eq i32 %tmp5, 0
13   %or = or i1 %tmp2, %tmp6
14   ret i1 %or
15 }
16
17 ;CHECK: @foo1_and
18 ;CHECK:  shl i32 1, %c1
19 ;CHECK-NEXT:  lshr i32 -2147483648, %c2
20 ;CHECK-NEXT:  or i32
21 ;CHECK-NEXT:  and i32
22 ;CHECK-NEXT:  icmp ne i32 %1, %0
23 ;CHECK: ret
24 define i1 @foo1_and(i32 %k, i32 %c1, i32 %c2) {
25 bb:
26   %tmp = shl i32 1, %c1
27   %tmp4 = lshr i32 -2147483648, %c2
28   %tmp1 = and i32 %tmp, %k
29   %tmp2 = icmp eq i32 %tmp1, 0
30   %tmp5 = and i32 %tmp4, %k
31   %tmp6 = icmp eq i32 %tmp5, 0
32   %or = or i1 %tmp2, %tmp6
33   ret i1 %or
34 }
35