1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc < %s -mtriple=arm-eabi | FileCheck %s -check-prefix=LE
3 ; RUN: llc < %s -mtriple=armeb-eabi | FileCheck %s -check-prefix=BE
5 define void @i24_or(i24* %a) {
8 ; LE-NEXT: ldrh r1, [r0]
9 ; LE-NEXT: orr r1, r1, #384
10 ; LE-NEXT: strh r1, [r0]
15 ; BE-NEXT: ldrh r1, [r0]
16 ; BE-NEXT: ldrb r2, [r0, #2]
17 ; BE-NEXT: orr r1, r2, r1, lsl #8
18 ; BE-NEXT: orr r1, r1, #384
19 ; BE-NEXT: strb r1, [r0, #2]
20 ; BE-NEXT: lsr r1, r1, #8
21 ; BE-NEXT: strh r1, [r0]
23 %aa = load i24, i24* %a, align 1
25 store i24 %b, i24* %a, align 1
29 define void @i24_and_or(i24* %a) {
30 ; LE-LABEL: i24_and_or:
32 ; LE-NEXT: ldrh r1, [r0]
33 ; LE-NEXT: orr r1, r1, #384
34 ; LE-NEXT: bic r1, r1, #127
35 ; LE-NEXT: strh r1, [r0]
38 ; BE-LABEL: i24_and_or:
40 ; BE-NEXT: mov r1, #128
41 ; BE-NEXT: strb r1, [r0, #2]
42 ; BE-NEXT: ldrh r1, [r0]
43 ; BE-NEXT: orr r1, r1, #1
44 ; BE-NEXT: strh r1, [r0]
46 %b = load i24, i24* %a, align 1
49 store i24 %d, i24* %a, align 1
53 define void @i24_insert_bit(i24* %a, i1 zeroext %bit) {
54 ; LE-LABEL: i24_insert_bit:
56 ; LE-NEXT: mov r3, #255
57 ; LE-NEXT: ldrh r2, [r0]
58 ; LE-NEXT: orr r3, r3, #57088
59 ; LE-NEXT: and r2, r2, r3
60 ; LE-NEXT: orr r1, r2, r1, lsl #13
61 ; LE-NEXT: strh r1, [r0]
64 ; BE-LABEL: i24_insert_bit:
66 ; BE-NEXT: ldrh r2, [r0]
67 ; BE-NEXT: mov r3, #57088
68 ; BE-NEXT: orr r3, r3, #16711680
69 ; BE-NEXT: and r2, r3, r2, lsl #8
70 ; BE-NEXT: orr r1, r2, r1, lsl #13
71 ; BE-NEXT: lsr r1, r1, #8
72 ; BE-NEXT: strh r1, [r0]
74 %extbit = zext i1 %bit to i24
75 %b = load i24, i24* %a, align 1
76 %extbit.shl = shl nuw nsw i24 %extbit, 13
77 %c = and i24 %b, -8193
78 %d = or i24 %c, %extbit.shl
79 store i24 %d, i24* %a, align 1
83 define void @i56_or(i56* %a) {
86 ; LE-NEXT: ldr r1, [r0]
87 ; LE-NEXT: orr r1, r1, #384
88 ; LE-NEXT: str r1, [r0]
94 ; BE-NEXT: ldr r12, [r0]
95 ; BE-NEXT: ldrh r2, [r1, #4]!
96 ; BE-NEXT: ldrb r3, [r1, #2]
97 ; BE-NEXT: orr r2, r3, r2, lsl #8
98 ; BE-NEXT: orr r2, r2, r12, lsl #24
99 ; BE-NEXT: orr r2, r2, #384
100 ; BE-NEXT: strb r2, [r1, #2]
101 ; BE-NEXT: lsr r3, r2, #8
102 ; BE-NEXT: strh r3, [r1]
103 ; BE-NEXT: bic r1, r12, #255
104 ; BE-NEXT: orr r1, r1, r2, lsr #24
105 ; BE-NEXT: str r1, [r0]
106 ; BE-NEXT: mov pc, lr
107 %aa = load i56, i56* %a
109 store i56 %b, i56* %a
113 define void @i56_and_or(i56* %a) {
114 ; LE-LABEL: i56_and_or:
116 ; LE-NEXT: ldr r1, [r0]
117 ; LE-NEXT: orr r1, r1, #384
118 ; LE-NEXT: bic r1, r1, #127
119 ; LE-NEXT: str r1, [r0]
120 ; LE-NEXT: mov pc, lr
122 ; BE-LABEL: i56_and_or:
124 ; BE-NEXT: mov r1, r0
125 ; BE-NEXT: ldr r12, [r0]
126 ; BE-NEXT: ldrh r2, [r1, #4]!
127 ; BE-NEXT: mov r3, #128
128 ; BE-NEXT: strb r3, [r1, #2]
129 ; BE-NEXT: lsl r2, r2, #8
130 ; BE-NEXT: orr r2, r2, r12, lsl #24
131 ; BE-NEXT: orr r2, r2, #384
132 ; BE-NEXT: lsr r3, r2, #8
133 ; BE-NEXT: strh r3, [r1]
134 ; BE-NEXT: bic r1, r12, #255
135 ; BE-NEXT: orr r1, r1, r2, lsr #24
136 ; BE-NEXT: str r1, [r0]
137 ; BE-NEXT: mov pc, lr
139 %b = load i56, i56* %a, align 1
140 %c = and i56 %b, -128
142 store i56 %d, i56* %a, align 1
146 define void @i56_insert_bit(i56* %a, i1 zeroext %bit) {
147 ; LE-LABEL: i56_insert_bit:
149 ; LE-NEXT: ldr r2, [r0]
150 ; LE-NEXT: bic r2, r2, #8192
151 ; LE-NEXT: orr r1, r2, r1, lsl #13
152 ; LE-NEXT: str r1, [r0]
153 ; LE-NEXT: mov pc, lr
155 ; BE-LABEL: i56_insert_bit:
157 ; BE-NEXT: .save {r11, lr}
158 ; BE-NEXT: push {r11, lr}
159 ; BE-NEXT: mov r2, r0
160 ; BE-NEXT: ldr lr, [r0]
161 ; BE-NEXT: ldrh r12, [r2, #4]!
162 ; BE-NEXT: ldrb r3, [r2, #2]
163 ; BE-NEXT: orr r12, r3, r12, lsl #8
164 ; BE-NEXT: orr r3, r12, lr, lsl #24
165 ; BE-NEXT: bic r3, r3, #8192
166 ; BE-NEXT: orr r1, r3, r1, lsl #13
167 ; BE-NEXT: lsr r3, r1, #8
168 ; BE-NEXT: strh r3, [r2]
169 ; BE-NEXT: bic r2, lr, #255
170 ; BE-NEXT: orr r1, r2, r1, lsr #24
171 ; BE-NEXT: str r1, [r0]
172 ; BE-NEXT: pop {r11, lr}
173 ; BE-NEXT: mov pc, lr
174 %extbit = zext i1 %bit to i56
175 %b = load i56, i56* %a, align 1
176 %extbit.shl = shl nuw nsw i56 %extbit, 13
177 %c = and i56 %b, -8193
178 %d = or i56 %c, %extbit.shl
179 store i56 %d, i56* %a, align 1