1 ; RUN: opt < %s -S -instcombine | FileCheck %s
2 ; Note: This is testing functionality in computeKnownBits. I'd have rather
3 ; used instsimplify, but the bit test folding is apparently only in instcombine.
5 declare i16 @llvm.bswap.i16(i16)
6 declare i32 @llvm.bswap.i32(i32)
8 define i1 @test1(i16 %arg) {
12 %b = call i16 @llvm.bswap.i16(i16 %a)
13 %and = and i16 %b, 256
14 %res = icmp eq i16 %and, 256
18 define i1 @test2(i16 %arg) {
22 %b = call i16 @llvm.bswap.i16(i16 %a)
23 %and = and i16 %b, 256
24 %res = icmp eq i16 %and, 256
29 define i1 @test3(i16 %arg) {
33 %b = call i16 @llvm.bswap.i16(i16 %a)
35 %res = icmp eq i16 %and, 1
39 define i1 @test4(i32 %arg) {
42 %a = or i32 %arg, 2147483647 ; i32_MAX
43 %b = call i32 @llvm.bswap.i32(i32 %a)
44 %and = and i32 %b, 127
45 %res = icmp eq i32 %and, 127