1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc -mtriple=thumbv6m-eabi -asm-verbose=false %s -o - | FileCheck %s --check-prefix=V6M
4 define i32 @uxth(i32 %x) {
8 %xn = and i32 %x, 65535
12 define i32 @uxtb(i32 %x) {
20 define i32 @uxth_2(i32 %x, i32 %y) {
23 ; V6M-NEXT: uxth r0, r0
24 ; V6M-NEXT: muls r0, r1, r0
26 %xn = and i32 %x, 65535
27 %yn = and i32 %y, 65535
28 %r = mul nuw i32 %xn, %yn
32 define i32 @uxtb_2(i32 %x, i32 %y) {
35 ; V6M-NEXT: uxtb r0, r0
36 ; V6M-NEXT: muls r0, r1, r0
40 %r = mul nuw nsw i32 %xn, %yn
44 define void @uxth_loop(i32* %a, i32 %n) {
45 ; V6M-LABEL: uxth_loop:
47 ; V6M-NEXT: ldrh r2, [r0]
48 ; V6M-NEXT: stm r0!, {r2}
49 ; V6M-NEXT: subs r1, r1, #1
50 ; V6M-NEXT: bne .LBB4_1
56 %i = phi i32 [ 0, %entry ], [ %inc, %for.body ]
57 %arrayidx = getelementptr inbounds i32, i32* %a, i32 %i
58 %x = load i32, i32* %arrayidx
59 %xn = and i32 %x, 65535
60 store i32 %xn, i32* %arrayidx
61 %inc = add nuw nsw i32 %i, 1
62 %exitcond = icmp eq i32 %inc, %n
63 br i1 %exitcond, label %for.cond.cleanup, label %for.body
69 define void @uxth_loop_2(i32* %a, i32 %n) {
70 ; V6M-LABEL: uxth_loop_2:
72 ; V6M-NEXT: push {r4, lr}
73 ; V6M-NEXT: movs r2, #0
75 ; V6M-NEXT: uxth r3, r2
76 ; V6M-NEXT: ldrh r4, [r0]
77 ; V6M-NEXT: muls r4, r3, r4
78 ; V6M-NEXT: stm r0!, {r4}
79 ; V6M-NEXT: adds r2, r2, #1
80 ; V6M-NEXT: cmp r1, r2
81 ; V6M-NEXT: bne .LBB5_1
82 ; V6M-NEXT: pop {r4, pc}
87 %i = phi i32 [ 0, %entry ], [ %inc, %for.body ]
88 %arrayidx = getelementptr inbounds i32, i32* %a, i32 %i
89 %x = load i32, i32* %arrayidx
90 %xn = and i32 %x, 65535
91 %in = and i32 %i, 65535
93 store i32 %s, i32* %arrayidx
94 %inc = add nuw nsw i32 %i, 1
95 %exitcond = icmp eq i32 %inc, %n
96 br i1 %exitcond, label %for.cond.cleanup, label %for.body
102 define void @uxtb_loop(i32* %a, i32 %n) {
103 ; V6M-LABEL: uxtb_loop:
105 ; V6M-NEXT: ldrb r2, [r0]
106 ; V6M-NEXT: stm r0!, {r2}
107 ; V6M-NEXT: subs r1, r1, #1
108 ; V6M-NEXT: bne .LBB6_1
114 %i = phi i32 [ 0, %entry ], [ %inc, %for.body ]
115 %arrayidx = getelementptr inbounds i32, i32* %a, i32 %i
116 %x = load i32, i32* %arrayidx
117 %xn = and i32 %x, 255
118 store i32 %xn, i32* %arrayidx
119 %inc = add nuw nsw i32 %i, 1
120 %exitcond = icmp eq i32 %inc, %n
121 br i1 %exitcond, label %for.cond.cleanup, label %for.body
127 define void @uxtb_loop_2(i32* %a, i32 %n) {
128 ; V6M-LABEL: uxtb_loop_2:
129 ; V6M: .save {r4, lr}
130 ; V6M-NEXT: push {r4, lr}
131 ; V6M-NEXT: movs r2, #0
133 ; V6M-NEXT: uxtb r3, r2
134 ; V6M-NEXT: ldrb r4, [r0]
135 ; V6M-NEXT: muls r4, r3, r4
136 ; V6M-NEXT: stm r0!, {r4}
137 ; V6M-NEXT: adds r2, r2, #1
138 ; V6M-NEXT: cmp r1, r2
139 ; V6M-NEXT: bne .LBB7_1
140 ; V6M-NEXT: pop {r4, pc}
145 %i = phi i32 [ 0, %entry ], [ %inc, %for.body ]
146 %arrayidx = getelementptr inbounds i32, i32* %a, i32 %i
147 %x = load i32, i32* %arrayidx
148 %xn = and i32 %x, 255
149 %in = and i32 %i, 255
150 %s = mul i32 %xn, %in
151 store i32 %s, i32* %arrayidx
152 %inc = add nuw nsw i32 %i, 1
153 %exitcond = icmp eq i32 %inc, %n
154 br i1 %exitcond, label %for.cond.cleanup, label %for.body