aboutsummaryrefslogtreecommitdiffstats
path: root/test/CodeGen/ARM/rev.ll
blob: 0072daef59d01be2a6d48350f32d6ff5d3022d6a (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
; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm -mattr=+v6 | grep rev16
; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm -mattr=+v6 | grep revsh

int %test1(uint %X) {
        %tmp1 = shr uint %X, ubyte 8            ; <uint> [#uses=1]
        %tmp1 = cast uint %tmp1 to int          ; <int> [#uses=2]
        %X15 = cast uint %X to int              ; <int> [#uses=1]
        %tmp4 = shl int %X15, ubyte 8           ; <int> [#uses=2]
        %tmp2 = and int %tmp1, 16711680         ; <int> [#uses=1]
        %tmp5 = and int %tmp4, -16777216                ; <int> [#uses=1]
        %tmp9 = and int %tmp1, 255              ; <int> [#uses=1]
        %tmp13 = and int %tmp4, 65280           ; <int> [#uses=1]
        %tmp6 = or int %tmp5, %tmp2             ; <int> [#uses=1]
        %tmp10 = or int %tmp6, %tmp13           ; <int> [#uses=1]
        %tmp14 = or int %tmp10, %tmp9           ; <int> [#uses=1]
        ret int %tmp14
}

int %test2(uint %X) {   ; revsh
        %tmp1 = shr uint %X, ubyte 8            ; <uint> [#uses=1]
        %tmp1 = cast uint %tmp1 to short                ; <short> [#uses=1]
        %tmp3 = cast uint %X to short           ; <short> [#uses=1]
        %tmp2 = and short %tmp1, 255            ; <short> [#uses=1]
        %tmp4 = shl short %tmp3, ubyte 8                ; <short> [#uses=1]
        %tmp5 = or short %tmp2, %tmp4           ; <short> [#uses=1]
        %tmp5 = cast short %tmp5 to int         ; <int> [#uses=1]
        ret int %tmp5
}