1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc < %s -mtriple=arm-eabi -mattr=+v6 | FileCheck %s --check-prefixes=CHECK,CHECK-V6
3 ; RUN: llc < %s -mtriple=arm-eabi -mattr=+v7 | FileCheck %s --check-prefixes=CHECK,CHECK-V7
5 define zeroext i8 @test1(i32 %A.u) {
8 ; CHECK-NEXT: uxtb r0, r0
10 %B.u = trunc i32 %A.u to i8
14 define zeroext i32 @test2(i32 %A.u, i32 %B.u) {
17 ; CHECK-NEXT: uxtab r0, r0, r1
19 %C.u = trunc i32 %B.u to i8
20 %D.u = zext i8 %C.u to i32
21 %E.u = add i32 %A.u, %D.u
25 define zeroext i32 @test3(i32 %A.u) {
26 ; CHECK-V6-LABEL: test3:
28 ; CHECK-V6-NEXT: lsr r0, r0, #8
29 ; CHECK-V6-NEXT: uxth r0, r0
30 ; CHECK-V6-NEXT: bx lr
32 ; CHECK-V7-LABEL: test3:
34 ; CHECK-V7-NEXT: ubfx r0, r0, #8, #16
35 ; CHECK-V7-NEXT: bx lr
36 %B.u = lshr i32 %A.u, 8
37 %C.u = shl i32 %A.u, 24
38 %D.u = or i32 %B.u, %C.u
39 %E.u = trunc i32 %D.u to i16
40 %F.u = zext i16 %E.u to i32
44 define zeroext i32 @test4(i32 %A.u) {
45 ; CHECK-V6-LABEL: test4:
47 ; CHECK-V6-NEXT: lsr r0, r0, #8
48 ; CHECK-V6-NEXT: uxtb r0, r0
49 ; CHECK-V6-NEXT: bx lr
51 ; CHECK-V7-LABEL: test4:
53 ; CHECK-V7-NEXT: ubfx r0, r0, #8, #8
54 ; CHECK-V7-NEXT: bx lr
55 %B.u = lshr i32 %A.u, 8
56 %C.u = shl i32 %A.u, 24
57 %D.u = or i32 %B.u, %C.u
58 %E.u = trunc i32 %D.u to i8
59 %F.u = zext i8 %E.u to i32
63 define zeroext i16 @test5(i32 %A.u) {
66 ; CHECK-NEXT: uxth r0, r0
68 %B.u = trunc i32 %A.u to i16
72 define zeroext i32 @test6(i32 %A.u, i32 %B.u) {
75 ; CHECK-NEXT: uxtah r0, r0, r1
77 %C.u = trunc i32 %B.u to i16
78 %D.u = zext i16 %C.u to i32
79 %E.u = add i32 %A.u, %D.u
83 define zeroext i32 @test7(i32 %A, i32 %X) {
86 ; CHECK-NEXT: uxtab r0, r1, r0, ror #8
91 %E = trunc i32 %D to i8
92 %F = zext i8 %E to i32
97 define zeroext i32 @test8(i32 %A, i32 %X) {
100 ; CHECK-NEXT: uxtab r0, r1, r0, ror #16
105 %E = trunc i32 %D to i8
106 %F = zext i8 %E to i32
111 define zeroext i32 @test9(i32 %A, i32 %X) {
112 ; CHECK-LABEL: test9:
114 ; CHECK-NEXT: uxtah r0, r1, r0, ror #8
119 %E = trunc i32 %D to i16
120 %F = zext i16 %E to i32
125 define zeroext i32 @test10(i32 %A, i32 %X) {
126 ; CHECK-LABEL: test10:
128 ; CHECK-NEXT: uxtah r0, r1, r0, ror #24
133 %E = trunc i32 %D to i16
134 %F = zext i16 %E to i32
139 define zeroext i32 @test11(i32 %A, i32 %X) {
140 ; CHECK-LABEL: test11:
142 ; CHECK-NEXT: uxtab r0, r1, r0
145 %add = add i32 %X, %B
149 define zeroext i32 @test12(i32 %A, i32 %X) {
150 ; CHECK-LABEL: test12:
152 ; CHECK-NEXT: uxtab r0, r1, r0, ror #8
155 %and = and i32 %B, 255
156 %add = add i32 %and, %X
160 define zeroext i32 @test13(i32 %A, i32 %X) {
161 ; CHECK-LABEL: test13:
163 ; CHECK-NEXT: uxtab r0, r1, r0, ror #16
166 %and = and i32 %B, 255
167 %add = add i32 %and, %X
171 define zeroext i32 @test14(i32 %A, i32 %X) {
172 ; CHECK-LABEL: test14:
174 ; CHECK-NEXT: uxtah r0, r1, r0
176 %B = and i32 %A, 65535
177 %add = add i32 %X, %B
181 define zeroext i32 @test15(i32 %A, i32 %X) {
182 ; CHECK-LABEL: test15:
184 ; CHECK-NEXT: uxtah r0, r1, r0, ror #8
187 %and = and i32 %B, 65535
188 %add = add i32 %and, %X
192 define zeroext i32 @test16(i32 %A, i32 %X) {
193 ; CHECK-LABEL: test16:
195 ; CHECK-NEXT: uxtah r0, r1, r0, ror #24
200 %E = and i32 %D, 65535