blob: 3d354a102161734455d60bf0c18b9e175c14f422 [file] [log] [blame]
Tanya Lattneraa6f5c92008-03-09 08:16:40 +00001; RUN: llvm-as < %s | opt -instcombine | llvm-dis | \
Dan Gohmanf9dd1702007-08-15 13:36:28 +00002; RUN: grep ret | count 3
Tanya Lattneraa6f5c92008-03-09 08:16:40 +00003; RUN: llvm-as < %s | opt -instcombine | llvm-dis | \
Reid Spencer91948d42007-04-14 20:13:02 +00004; RUN: not grep call.*bswap
Chris Lattnere7f83dc2006-11-29 05:00:14 +00005
Tanya Lattneraa6f5c92008-03-09 08:16:40 +00006define i1 @test1(i16 %tmp2) {
7 %tmp10 = call i16 @llvm.bswap.i16( i16 %tmp2 ) ; <i16> [#uses=1]
8 %tmp = icmp eq i16 %tmp10, 1 ; <i1> [#uses=1]
9 ret i1 %tmp
Chris Lattnere7f83dc2006-11-29 05:00:14 +000010}
11
Tanya Lattneraa6f5c92008-03-09 08:16:40 +000012define i1 @test2(i32 %tmp) {
13 %tmp34 = tail call i32 @llvm.bswap.i32( i32 %tmp ) ; <i32> [#uses=1]
14 %tmp.upgrd.1 = icmp eq i32 %tmp34, 1 ; <i1> [#uses=1]
15 ret i1 %tmp.upgrd.1
Chris Lattnere7f83dc2006-11-29 05:00:14 +000016}
17
Tanya Lattneraa6f5c92008-03-09 08:16:40 +000018declare i32 @llvm.bswap.i32(i32)
Reid Spencera5f996b2007-04-02 00:51:15 +000019
Tanya Lattneraa6f5c92008-03-09 08:16:40 +000020define i1 @test3(i64 %tmp) {
21 %tmp34 = tail call i64 @llvm.bswap.i64( i64 %tmp ) ; <i64> [#uses=1]
22 %tmp.upgrd.2 = icmp eq i64 %tmp34, 1 ; <i1> [#uses=1]
23 ret i1 %tmp.upgrd.2
Chris Lattnere7f83dc2006-11-29 05:00:14 +000024}
25
Tanya Lattneraa6f5c92008-03-09 08:16:40 +000026declare i64 @llvm.bswap.i64(i64)
Chris Lattnere7f83dc2006-11-29 05:00:14 +000027
Tanya Lattneraa6f5c92008-03-09 08:16:40 +000028declare i16 @llvm.bswap.i16(i16)
29