blob: 68f6264e8a0635a1890ad60dfaa91f8033a86c1c [file] [log] [blame]
Tanya Lattner6263f942008-02-17 20:02:20 +00001; RUN: llvm-as < %s | llc -march=arm -mattr=+v6 | grep rev16
2; RUN: llvm-as < %s | llc -march=arm -mattr=+v6 | grep revsh
Evan Cheng02b985c2007-01-19 09:20:23 +00003
Tanya Lattner6263f942008-02-17 20:02:20 +00004define i32 @test1(i32 %X) {
5 %tmp1 = lshr i32 %X, 8 ; <i32> [#uses=3]
6 %X15 = bitcast i32 %X to i32 ; <i32> [#uses=1]
7 %tmp4 = shl i32 %X15, 8 ; <i32> [#uses=2]
8 %tmp2 = and i32 %tmp1, 16711680 ; <i32> [#uses=1]
9 %tmp5 = and i32 %tmp4, -16777216 ; <i32> [#uses=1]
10 %tmp9 = and i32 %tmp1, 255 ; <i32> [#uses=1]
11 %tmp13 = and i32 %tmp4, 65280 ; <i32> [#uses=1]
12 %tmp6 = or i32 %tmp5, %tmp2 ; <i32> [#uses=1]
13 %tmp10 = or i32 %tmp6, %tmp13 ; <i32> [#uses=1]
14 %tmp14 = or i32 %tmp10, %tmp9 ; <i32> [#uses=1]
15 ret i32 %tmp14
Evan Cheng02b985c2007-01-19 09:20:23 +000016}
17
Tanya Lattner6263f942008-02-17 20:02:20 +000018define i32 @test2(i32 %X) {
19 %tmp1 = lshr i32 %X, 8 ; <i32> [#uses=1]
20 %tmp1.upgrd.1 = trunc i32 %tmp1 to i16 ; <i16> [#uses=1]
21 %tmp3 = trunc i32 %X to i16 ; <i16> [#uses=1]
22 %tmp2 = and i16 %tmp1.upgrd.1, 255 ; <i16> [#uses=1]
23 %tmp4 = shl i16 %tmp3, 8 ; <i16> [#uses=1]
24 %tmp5 = or i16 %tmp2, %tmp4 ; <i16> [#uses=1]
25 %tmp5.upgrd.2 = sext i16 %tmp5 to i32 ; <i32> [#uses=1]
26 ret i32 %tmp5.upgrd.2
Evan Cheng02b985c2007-01-19 09:20:23 +000027}