1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc -mtriple=i686-unknown-linux-gnu %s -o - | FileCheck %s --check-prefix=CHECK --check-prefix=CHECK32
3 ; RUN: llc -mtriple=x86_64-unknown-linux-gnu %s -o - | FileCheck %s --check-prefix=CHECK --check-prefix=CHECK64
5 define void @zero_optsize(i32* %p) optsize {
6 ; CHECK32-LABEL: zero_optsize:
7 ; CHECK32: # %bb.0: # %entry
8 ; CHECK32-NEXT: movl {{[0-9]+}}(%esp), %eax
9 ; CHECK32-NEXT: movl $0, (%eax)
12 ; CHECK64-LABEL: zero_optsize:
13 ; CHECK64: # %bb.0: # %entry
14 ; CHECK64-NEXT: movl $0, (%rdi)
22 define void @minus_one_optsize(i32* %p) optsize {
23 ; CHECK32-LABEL: minus_one_optsize:
24 ; CHECK32: # %bb.0: # %entry
25 ; CHECK32-NEXT: movl {{[0-9]+}}(%esp), %eax
26 ; CHECK32-NEXT: movl $-1, (%eax)
29 ; CHECK64-LABEL: minus_one_optsize:
30 ; CHECK64: # %bb.0: # %entry
31 ; CHECK64-NEXT: movl $-1, (%rdi)
40 define void @zero_64(i64* %p) minsize {
41 ; CHECK32-LABEL: zero_64:
42 ; CHECK32: # %bb.0: # %entry
43 ; CHECK32-NEXT: movl {{[0-9]+}}(%esp), %eax
44 ; CHECK32-NEXT: andl $0, 4(%eax)
45 ; CHECK32-NEXT: andl $0, (%eax)
48 ; CHECK64-LABEL: zero_64:
49 ; CHECK64: # %bb.0: # %entry
50 ; CHECK64-NEXT: andq $0, (%rdi)
58 define void @zero_32(i32* %p) minsize {
59 ; CHECK32-LABEL: zero_32:
60 ; CHECK32: # %bb.0: # %entry
61 ; CHECK32-NEXT: movl {{[0-9]+}}(%esp), %eax
62 ; CHECK32-NEXT: andl $0, (%eax)
65 ; CHECK64-LABEL: zero_32:
66 ; CHECK64: # %bb.0: # %entry
67 ; CHECK64-NEXT: andl $0, (%rdi)
75 define void @zero_16(i16* %p) minsize {
76 ; CHECK32-LABEL: zero_16:
77 ; CHECK32: # %bb.0: # %entry
78 ; CHECK32-NEXT: movl {{[0-9]+}}(%esp), %eax
79 ; CHECK32-NEXT: andw $0, (%eax)
82 ; CHECK64-LABEL: zero_16:
83 ; CHECK64: # %bb.0: # %entry
84 ; CHECK64-NEXT: andw $0, (%rdi)
93 define void @minus_one_64(i64* %p) minsize {
94 ; CHECK32-LABEL: minus_one_64:
95 ; CHECK32: # %bb.0: # %entry
96 ; CHECK32-NEXT: movl {{[0-9]+}}(%esp), %eax
97 ; CHECK32-NEXT: orl $-1, 4(%eax)
98 ; CHECK32-NEXT: orl $-1, (%eax)
101 ; CHECK64-LABEL: minus_one_64:
102 ; CHECK64: # %bb.0: # %entry
103 ; CHECK64-NEXT: orq $-1, (%rdi)
106 store i64 -1, i64* %p
111 define void @minus_one_32(i32* %p) minsize {
112 ; CHECK32-LABEL: minus_one_32:
113 ; CHECK32: # %bb.0: # %entry
114 ; CHECK32-NEXT: movl {{[0-9]+}}(%esp), %eax
115 ; CHECK32-NEXT: orl $-1, (%eax)
118 ; CHECK64-LABEL: minus_one_32:
119 ; CHECK64: # %bb.0: # %entry
120 ; CHECK64-NEXT: orl $-1, (%rdi)
123 store i32 -1, i32* %p
128 define void @minus_one_16(i16* %p) minsize {
129 ; CHECK32-LABEL: minus_one_16:
130 ; CHECK32: # %bb.0: # %entry
131 ; CHECK32-NEXT: movl {{[0-9]+}}(%esp), %eax
132 ; CHECK32-NEXT: orw $-1, (%eax)
135 ; CHECK64-LABEL: minus_one_16:
136 ; CHECK64: # %bb.0: # %entry
137 ; CHECK64-NEXT: orw $-1, (%rdi)
140 store i16 -1, i16* %p
145 ; FIXME: Make sure we don't use the and/or trick on volatile stores.
146 define void @volatile_zero_64(i64* %p) minsize {
147 ; CHECK32-LABEL: volatile_zero_64:
148 ; CHECK32: # %bb.0: # %entry
149 ; CHECK32-NEXT: movl {{[0-9]+}}(%esp), %eax
150 ; CHECK32-NEXT: xorl %ecx, %ecx
151 ; CHECK32-NEXT: movl %ecx, 4(%eax)
152 ; CHECK32-NEXT: movl %ecx, (%eax)
155 ; CHECK64-LABEL: volatile_zero_64:
156 ; CHECK64: # %bb.0: # %entry
157 ; CHECK64-NEXT: movq $0, (%rdi)
160 store volatile i64 0, i64* %p
164 define void @volatile_zero_32(i32* %p) minsize {
165 ; CHECK32-LABEL: volatile_zero_32:
166 ; CHECK32: # %bb.0: # %entry
167 ; CHECK32-NEXT: movl {{[0-9]+}}(%esp), %eax
168 ; CHECK32-NEXT: movl $0, (%eax)
171 ; CHECK64-LABEL: volatile_zero_32:
172 ; CHECK64: # %bb.0: # %entry
173 ; CHECK64-NEXT: movl $0, (%rdi)
176 store volatile i32 0, i32* %p
180 define void @volatile_zero_16(i16* %p) minsize {
181 ; CHECK32-LABEL: volatile_zero_16:
182 ; CHECK32: # %bb.0: # %entry
183 ; CHECK32-NEXT: movl {{[0-9]+}}(%esp), %eax
184 ; CHECK32-NEXT: movw $0, (%eax)
187 ; CHECK64-LABEL: volatile_zero_16:
188 ; CHECK64: # %bb.0: # %entry
189 ; CHECK64-NEXT: movw $0, (%rdi)
192 store volatile i16 0, i16* %p
197 define void @volatile_minus_one_64(i64* %p) minsize {
198 ; CHECK32-LABEL: volatile_minus_one_64:
199 ; CHECK32: # %bb.0: # %entry
200 ; CHECK32-NEXT: movl {{[0-9]+}}(%esp), %eax
201 ; CHECK32-NEXT: xorl %ecx, %ecx
202 ; CHECK32-NEXT: decl %ecx
203 ; CHECK32-NEXT: movl %ecx, 4(%eax)
204 ; CHECK32-NEXT: movl %ecx, (%eax)
207 ; CHECK64-LABEL: volatile_minus_one_64:
208 ; CHECK64: # %bb.0: # %entry
209 ; CHECK64-NEXT: movq $-1, (%rdi)
212 store volatile i64 -1, i64* %p
216 define void @volatile_minus_one_32(i32* %p) minsize {
217 ; CHECK32-LABEL: volatile_minus_one_32:
218 ; CHECK32: # %bb.0: # %entry
219 ; CHECK32-NEXT: movl {{[0-9]+}}(%esp), %eax
220 ; CHECK32-NEXT: movl $-1, (%eax)
223 ; CHECK64-LABEL: volatile_minus_one_32:
224 ; CHECK64: # %bb.0: # %entry
225 ; CHECK64-NEXT: movl $-1, (%rdi)
228 store volatile i32 -1, i32* %p
232 define void @volatile_minus_one_16(i16* %p) minsize {
233 ; CHECK32-LABEL: volatile_minus_one_16:
234 ; CHECK32: # %bb.0: # %entry
235 ; CHECK32-NEXT: movl {{[0-9]+}}(%esp), %eax
236 ; CHECK32-NEXT: movw $-1, (%eax)
239 ; CHECK64-LABEL: volatile_minus_one_16:
240 ; CHECK64: # %bb.0: # %entry
241 ; CHECK64-NEXT: movw $-1, (%rdi)
244 store volatile i16 -1, i16* %p