mvn.ll
5.63 KB
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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
; RUN: llc -mtriple=thumbv6m-eabi -asm-verbose=false %s -o - | FileCheck %s
define void @test8(i8* %a) {
; CHECK-LABEL: test8:
; CHECK: ldrb r1, [r0]
; CHECK-NEXT: mvns r1, r1
; CHECK-NEXT: strb r1, [r0]
; CHECK-NEXT: bx lr
%x = load i8, i8* %a
%xn = xor i8 %x, -1
store i8 %xn, i8* %a
ret void
}
define void @test8_2(i8* %a, i8* %b) {
; CHECK-LABEL: test8_2:
; CHECK: ldrb r2, [r1]
; CHECK-NEXT: ldrb r3, [r0]
; CHECK-NEXT: mvns r3, r3
; CHECK-NEXT: strb r3, [r0]
; CHECK-NEXT: mvns r0, r2
; CHECK-NEXT: strb r0, [r1]
; CHECK-NEXT: bx lr
%x = load i8, i8* %a
%y = load i8, i8* %b
%xn = xor i8 %x, -1
%yn = xor i8 %y, -1
store i8 %xn, i8* %a
store i8 %yn, i8* %b
ret void
}
define void @loop8(i8* %a) {
; CHECK-LABEL: loop8:
; CHECK: movs r1, #0
; CHECK-NEXT: .LBB2_1:
; CHECK-NEXT: ldrb r2, [r0, r1]
; CHECK-NEXT: mvns r2, r2
; CHECK-NEXT: strb r2, [r0, r1]
; CHECK-NEXT: adds r1, r1, #1
; CHECK-NEXT: cmp r1, #10
; CHECK-NEXT: bne .LBB2_1
; CHECK-NEXT: bx lr
entry:
br label %for.body
for.body:
%i = phi i32 [ 0, %entry ], [ %inc, %for.body ]
%arrayidx = getelementptr inbounds i8, i8* %a, i32 %i
%x = load i8, i8* %arrayidx
%xn = xor i8 %x, -1
store i8 %xn, i8* %arrayidx
%inc = add nuw nsw i32 %i, 1
%exitcond = icmp eq i32 %inc, 10
br i1 %exitcond, label %for.cond.cleanup, label %for.body
for.cond.cleanup:
ret void
}
define void @loop8_2(i8* %a, i8* %b) {
; CHECK-LABEL: loop8_2:
; CHECK: .save {r4, lr}
; CHECK-NEXT: push {r4, lr}
; CHECK-NEXT: movs r2, #0
; CHECK-NEXT: .LBB3_1:
; CHECK-NEXT: ldrb r3, [r1, r2]
; CHECK-NEXT: ldrb r4, [r0, r2]
; CHECK-NEXT: mvns r4, r4
; CHECK-NEXT: strb r4, [r0, r2]
; CHECK-NEXT: mvns r3, r3
; CHECK-NEXT: strb r3, [r1, r2]
; CHECK-NEXT: adds r2, r2, #1
; CHECK-NEXT: cmp r2, #10
; CHECK-NEXT: bne .LBB3_1
; CHECK-NEXT: pop {r4, pc}
entry:
br label %for.body
for.body:
%i = phi i32 [ 0, %entry ], [ %inc, %for.body ]
%arrayidx = getelementptr inbounds i8, i8* %a, i32 %i
%arrayidx2 = getelementptr inbounds i8, i8* %b, i32 %i
%x = load i8, i8* %arrayidx
%y = load i8, i8* %arrayidx2
%xn = xor i8 %x, -1
%yn = xor i8 %y, -1
store i8 %xn, i8* %arrayidx
store i8 %yn, i8* %arrayidx2
%inc = add nuw nsw i32 %i, 1
%exitcond = icmp eq i32 %inc, 10
br i1 %exitcond, label %for.cond.cleanup, label %for.body
for.cond.cleanup:
ret void
}
define void @test32(i32* %a) {
; CHECK-LABEL: test32:
; CHECK: ldr r1, [r0]
; CHECK-NEXT: mvns r1, r1
; CHECK-NEXT: str r1, [r0]
; CHECK-NEXT: bx lr
%x = load i32, i32* %a
%xn = xor i32 %x, -1
store i32 %xn, i32* %a
ret void
}
define void @test32_2(i32* %a, i32* %b) {
; CHECK-LABEL: test32_2:
; CHECK: ldr r2, [r1]
; CHECK-NEXT: ldr r3, [r0]
; CHECK-NEXT: mvns r3, r3
; CHECK-NEXT: str r3, [r0]
; CHECK-NEXT: mvns r0, r2
; CHECK-NEXT: str r0, [r1]
; CHECK-NEXT: bx lr
%x = load i32, i32* %a
%y = load i32, i32* %b
%xn = xor i32 %x, -1
%yn = xor i32 %y, -1
store i32 %xn, i32* %a
store i32 %yn, i32* %b
ret void
}
define void @loop32(i32* %a) {
; CHECK-LABEL: loop32:
; CHECK: movs r1, #0
; CHECK-NEXT: .LBB6_1:
; CHECK-NEXT: ldr r2, [r0, r1]
; CHECK-NEXT: mvns r2, r2
; CHECK-NEXT: str r2, [r0, r1]
; CHECK-NEXT: adds r1, r1, #4
; CHECK-NEXT: cmp r1, #40
; CHECK-NEXT: bne .LBB6_1
; CHECK-NEXT: bx lr
entry:
br label %for.body
for.body:
%i = phi i32 [ 0, %entry ], [ %inc, %for.body ]
%arrayidx = getelementptr inbounds i32, i32* %a, i32 %i
%x = load i32, i32* %arrayidx
%xn = xor i32 %x, -1
store i32 %xn, i32* %arrayidx
%inc = add nuw nsw i32 %i, 1
%exitcond = icmp eq i32 %inc, 10
br i1 %exitcond, label %for.cond.cleanup, label %for.body
for.cond.cleanup:
ret void
}
define void @loop32_2(i32* %a, i32* %b) {
; CHECK-LABEL: loop32_2:
; CHECK: .save {r4, lr}
; CHECK-NEXT: push {r4, lr}
; CHECK-NEXT: movs r2, #0
; CHECK-NEXT: .LBB7_1:
; CHECK-NEXT: ldr r3, [r1, r2]
; CHECK-NEXT: ldr r4, [r0, r2]
; CHECK-NEXT: mvns r4, r4
; CHECK-NEXT: str r4, [r0, r2]
; CHECK-NEXT: mvns r3, r3
; CHECK-NEXT: str r3, [r1, r2]
; CHECK-NEXT: adds r2, r2, #4
; CHECK-NEXT: cmp r2, #40
; CHECK-NEXT: bne .LBB7_1
; CHECK-NEXT: pop {r4, pc}
entry:
br label %for.body
for.body:
%i = phi i32 [ 0, %entry ], [ %inc, %for.body ]
%arrayidx = getelementptr inbounds i32, i32* %a, i32 %i
%arrayidx2 = getelementptr inbounds i32, i32* %b, i32 %i
%x = load i32, i32* %arrayidx
%y = load i32, i32* %arrayidx2
%xn = xor i32 %x, -1
%yn = xor i32 %y, -1
store i32 %xn, i32* %arrayidx
store i32 %yn, i32* %arrayidx2
%inc = add nuw nsw i32 %i, 1
%exitcond = icmp eq i32 %inc, 10
br i1 %exitcond, label %for.cond.cleanup, label %for.body
for.cond.cleanup:
ret void
}
define void @test128(i128* %a) {
; CHECK-LABEL: test128:
; CHECK: ldr r1, [r0, #8]
; CHECK-NEXT: ldr r2, .LCPI8_0
; CHECK-NEXT: eors r2, r1
; CHECK-NEXT: str r2, [r0, #8]
; CHECK-NEXT: ldr r1, [r0]
; CHECK-NEXT: ldr r2, .LCPI8_1
; CHECK-NEXT: eors r2, r1
; CHECK-NEXT: str r2, [r0]
; CHECK-NEXT: ldr r1, [r0, #4]
; CHECK-NEXT: ldr r2, .LCPI8_2
; CHECK-NEXT: eors r2, r1
; CHECK-NEXT: str r2, [r0, #4]
; CHECK-NEXT: bx lr
; CHECK-NEXT: .p2align 2
; CHECK-NEXT: .LCPI8_0:
; CHECK-NEXT: .long 6692605
; CHECK-NEXT: .LCPI8_1:
; CHECK-NEXT: .long 2080661269
; CHECK-NEXT: .LCPI8_2:
; CHECK-NEXT: .long 4075008415
%x = load i128, i128* %a
%xn = xor i128 %x, 123456789123456789123456789
store i128 %xn, i128* %a
ret void
}