blob: 35b23e84557e69c667b1af19d92537594b6369ef (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
|
; RUN: opt %s -instcombine -S | grep ret | count 6
; RUN: opt %s -instcombine -S | not grep call.*bswap
define i1 @test1(i16 %tmp2) {
%tmp10 = call i16 @llvm.bswap.i16( i16 %tmp2 ) ; <i16> [#uses=1]
%tmp = icmp eq i16 %tmp10, 1 ; <i1> [#uses=1]
ret i1 %tmp
}
define i1 @test2(i32 %tmp) {
%tmp34 = tail call i32 @llvm.bswap.i32( i32 %tmp ) ; <i32> [#uses=1]
%tmp.upgrd.1 = icmp eq i32 %tmp34, 1 ; <i1> [#uses=1]
ret i1 %tmp.upgrd.1
}
declare i32 @llvm.bswap.i32(i32)
define i1 @test3(i64 %tmp) {
%tmp34 = tail call i64 @llvm.bswap.i64( i64 %tmp ) ; <i64> [#uses=1]
%tmp.upgrd.2 = icmp eq i64 %tmp34, 1 ; <i1> [#uses=1]
ret i1 %tmp.upgrd.2
}
declare i64 @llvm.bswap.i64(i64)
declare i16 @llvm.bswap.i16(i16)
; rdar://5992453
; A & 255
define i32 @test4(i32 %a) nounwind {
entry:
%tmp2 = tail call i32 @llvm.bswap.i32( i32 %a )
%tmp4 = lshr i32 %tmp2, 24
ret i32 %tmp4
}
; A
define i32 @test5(i32 %a) nounwind {
entry:
%tmp2 = tail call i32 @llvm.bswap.i32( i32 %a )
%tmp4 = tail call i32 @llvm.bswap.i32( i32 %tmp2 )
ret i32 %tmp4
}
; a >> 24
define i32 @test6(i32 %a) nounwind {
entry:
%tmp2 = tail call i32 @llvm.bswap.i32( i32 %a )
%tmp4 = and i32 %tmp2, 255
ret i32 %tmp4
}
|