Merging r259696:
[oota-llvm.git] / test / Transforms / InstSimplify / bswap.ll
1 ; RUN: opt < %s -S -instsimplify | FileCheck %s
2
3 declare i16 @llvm.bswap.i16(i16)
4
5 define i1 @test1(i16 %arg) {
6 ; CHECK-LABEL: @test1
7 ; CHECK: ret i1 false
8   %a = or i16 %arg, 1
9   %b = call i16 @llvm.bswap.i16(i16 %a)
10   %res = icmp eq i16 %b, 0
11   ret i1 %res
12 }
13
14 define i1 @test2(i16 %arg) {
15 ; CHECK-LABEL: @test2
16 ; CHECK: ret i1 false
17   %a = or i16 %arg, 1024
18   %b = call i16 @llvm.bswap.i16(i16 %a)
19   %res = icmp eq i16 %b, 0
20   ret i1 %res
21 }
22
23 define i1 @test3(i16 %arg) {
24 ; CHECK-LABEL: @test3
25 ; CHECK: ret i1 false
26   %a = and i16 %arg, 1
27   %b = call i16 @llvm.bswap.i16(i16 %a)
28   %and = and i16 %b, 1
29   %res = icmp eq i16 %and, 1
30   ret i1 %res
31 }
32
33 define i1 @test4(i16 %arg) {
34 ; CHECK-LABEL: @test4
35 ; CHECK: ret i1 false
36   %a = and i16 %arg, 511
37   %b = call i16 @llvm.bswap.i16(i16 %a)
38   %and = and i16 %b, 256
39   %res = icmp eq i16 %and, 1
40   ret i1 %res
41 }