1 ; RUN: llc -mtriple=arm-eabi -mattr=+v6 %s -o - | FileCheck %s --check-prefix=CHECK-V6
2 ; RUN: llc -mtriple=arm-eabi -mattr=+v7 %s -o - | FileCheck %s --check-prefix=CHECK-V7
4 define zeroext i8 @test1(i32 %A.u) {
8 %B.u = trunc i32 %A.u to i8
12 define zeroext i32 @test2(i32 %A.u, i32 %B.u) {
14 ; CHECK-V6: uxtab r0, r0, r1
15 ; CHECK-V7: uxtab r0, r0, r1
16 %C.u = trunc i32 %B.u to i8
17 %D.u = zext i8 %C.u to i32
18 %E.u = add i32 %A.u, %D.u
22 define zeroext i32 @test3(i32 %A.u) {
25 ; CHECK-V7: ubfx r0, r0, #8, #16
26 %B.u = lshr i32 %A.u, 8
27 %C.u = shl i32 %A.u, 24
28 %D.u = or i32 %B.u, %C.u
29 %E.u = trunc i32 %D.u to i16
30 %F.u = zext i16 %E.u to i32
34 define zeroext i32 @test4(i32 %A.u) {
37 ; CHECK-V7: ubfx r0, r0, #8, #8
38 %B.u = lshr i32 %A.u, 8
39 %C.u = shl i32 %A.u, 24
40 %D.u = or i32 %B.u, %C.u
41 %E.u = trunc i32 %D.u to i8
42 %F.u = zext i8 %E.u to i32
46 define zeroext i16 @test5(i32 %A.u) {
50 %B.u = trunc i32 %A.u to i16
54 define zeroext i32 @test6(i32 %A.u, i32 %B.u) {
56 ; CHECK-V6: uxtah r0, r0, r1
57 ; CHECK-V7: uxtah r0, r0, r1
58 %C.u = trunc i32 %B.u to i16
59 %D.u = zext i16 %C.u to i32
60 %E.u = add i32 %A.u, %D.u
64 define zeroext i32 @test7(i32 %A, i32 %X) {
66 ; CHECK-V6: uxtab r0, r1, r0, ror #8
67 ; CHECK-V7: uxtab r0, r1, r0, ror #8
71 %E = trunc i32 %D to i8
72 %F = zext i8 %E to i32
77 define zeroext i32 @test8(i32 %A, i32 %X) {
79 ; CHECK-V6: uxtab r0, r1, r0, ror #16
80 ; CHECK-V7: uxtab r0, r1, r0, ror #16
84 %E = trunc i32 %D to i8
85 %F = zext i8 %E to i32
90 define zeroext i32 @test9(i32 %A, i32 %X) {
92 ; CHECK-V6: uxtah r0, r1, r0, ror #8
93 ; CHECK-V7: uxtah r0, r1, r0, ror #8
97 %E = trunc i32 %D to i16
98 %F = zext i16 %E to i32
103 define zeroext i32 @test10(i32 %A, i32 %X) {
104 ; CHECK-LABEL: test10
105 ; CHECK-V6: uxtah r0, r1, r0, ror #24
106 ; CHECK-V7: uxtah r0, r1, r0, ror #24
110 %E = trunc i32 %D to i16
111 %F = zext i16 %E to i32
116 define zeroext i32 @test11(i32 %A, i32 %X) {
117 ; CHECK-LABEL: test11
118 ; CHECK-V6: uxtab r0, r1, r0
119 ; CHECK-V7: uxtab r0, r1, r0
121 %add = add i32 %X, %B
125 define zeroext i32 @test12(i32 %A, i32 %X) {
126 ; CHECK-LABEL: test12
127 ; CHECK-V6: uxtab r0, r1, r0, ror #8
128 ; CHECK-V7: uxtab r0, r1, r0, ror #8
130 %and = and i32 %B, 255
131 %add = add i32 %and, %X
135 define zeroext i32 @test13(i32 %A, i32 %X) {
136 ; CHECK-LABEL: test13
137 ; CHECK-V6: uxtab r0, r1, r0, ror #16
138 ; CHECK-V7: uxtab r0, r1, r0, ror #16
140 %and = and i32 %B, 255
141 %add = add i32 %and, %X
145 define zeroext i32 @test14(i32 %A, i32 %X) {
146 ; CHECK-LABEL: test14
147 ; CHECK-V6: uxtah r0, r1, r0
148 ; CHECK-V7: uxtah r0, r1, r0
149 %B = and i32 %A, 65535
150 %add = add i32 %X, %B
154 define zeroext i32 @test15(i32 %A, i32 %X) {
155 ; CHECK-LABEL: test15
156 ; CHECK-V6: uxtah r0, r1, r0, ror #8
157 ; CHECK-V7: uxtah r0, r1, r0, ror #8
159 %and = and i32 %B, 65535
160 %add = add i32 %and, %X
164 define zeroext i32 @test16(i32 %A, i32 %X) {
165 ; CHECK-LABEL: test16
166 ; CHECK-V6: uxtah r0, r1, r0, ror #24
167 ; CHECK-V7: uxtah r0, r1, r0, ror #24
171 %E = and i32 %D, 65535