• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2; RUN: llc < %s -mtriple=x86_64-- | FileCheck %s
3
4; Utilize implicit zero-extension on x86-64 to eliminate explicit
5; zero-extensions. Shrink 64-bit adds to 32-bit when the high
6; 32-bits will be zeroed.
7
8define void @bar(i64 %x, i64 %y, i64* %z) nounwind readnone {
9; CHECK-LABEL: bar:
10; CHECK:       # %bb.0: # %entry
11; CHECK-NEXT:    addl %esi, %edi
12; CHECK-NEXT:    movq %rdi, (%rdx)
13; CHECK-NEXT:    retq
14entry:
15	%t0 = add i64 %x, %y
16	%t1 = and i64 %t0, 4294967295
17        store i64 %t1, i64* %z
18	ret void
19}
20define void @easy(i32 %x, i32 %y, i64* %z) nounwind readnone {
21; CHECK-LABEL: easy:
22; CHECK:       # %bb.0: # %entry
23; CHECK-NEXT:    # kill: def $edi killed $edi def $rdi
24; CHECK-NEXT:    addl %esi, %edi
25; CHECK-NEXT:    movq %rdi, (%rdx)
26; CHECK-NEXT:    retq
27entry:
28	%t0 = add i32 %x, %y
29        %tn = zext i32 %t0 to i64
30	%t1 = and i64 %tn, 4294967295
31        store i64 %t1, i64* %z
32	ret void
33}
34define void @cola(i64 *%x, i64 %y, i64* %z, i64 %u) nounwind readnone {
35; CHECK-LABEL: cola:
36; CHECK:       # %bb.0: # %entry
37; CHECK-NEXT:    addl (%rdi), %esi
38; CHECK-NEXT:    xorq %rcx, %rsi
39; CHECK-NEXT:    movq %rsi, (%rdx)
40; CHECK-NEXT:    retq
41entry:
42        %p = load i64, i64* %x
43	%t0 = add i64 %p, %y
44	%t1 = and i64 %t0, 4294967295
45        %t2 = xor i64 %t1, %u
46        store i64 %t2, i64* %z
47	ret void
48}
49define void @yaks(i64 *%x, i64 %y, i64* %z, i64 %u) nounwind readnone {
50; CHECK-LABEL: yaks:
51; CHECK:       # %bb.0: # %entry
52; CHECK-NEXT:    addl (%rdi), %esi
53; CHECK-NEXT:    xorl %esi, %ecx
54; CHECK-NEXT:    movq %rcx, (%rdx)
55; CHECK-NEXT:    retq
56entry:
57        %p = load i64, i64* %x
58	%t0 = add i64 %p, %y
59        %t1 = xor i64 %t0, %u
60	%t2 = and i64 %t1, 4294967295
61        store i64 %t2, i64* %z
62	ret void
63}
64define void @foo(i64 *%x, i64 *%y, i64* %z) nounwind readnone {
65; CHECK-LABEL: foo:
66; CHECK:       # %bb.0: # %entry
67; CHECK-NEXT:    movl (%rdi), %eax
68; CHECK-NEXT:    addl (%rsi), %eax
69; CHECK-NEXT:    movq %rax, (%rdx)
70; CHECK-NEXT:    retq
71entry:
72        %a = load i64, i64* %x
73        %b = load i64, i64* %y
74	%t0 = add i64 %a, %b
75	%t1 = and i64 %t0, 4294967295
76        store i64 %t1, i64* %z
77	ret void
78}
79define void @avo(i64 %x, i64* %z, i64 %u) nounwind readnone {
80; CHECK-LABEL: avo:
81; CHECK:       # %bb.0: # %entry
82; CHECK-NEXT:    addl $734847, %edi # imm = 0xB367F
83; CHECK-NEXT:    xorq %rdx, %rdi
84; CHECK-NEXT:    movq %rdi, (%rsi)
85; CHECK-NEXT:    retq
86entry:
87	%t0 = add i64 %x, 734847
88	%t1 = and i64 %t0, 4294967295
89        %t2 = xor i64 %t1, %u
90        store i64 %t2, i64* %z
91	ret void
92}
93define void @phe(i64 %x, i64* %z, i64 %u) nounwind readnone {
94; CHECK-LABEL: phe:
95; CHECK:       # %bb.0: # %entry
96; CHECK-NEXT:    addl $734847, %edi # imm = 0xB367F
97; CHECK-NEXT:    xorl %edi, %edx
98; CHECK-NEXT:    movq %rdx, (%rsi)
99; CHECK-NEXT:    retq
100entry:
101	%t0 = add i64 %x, 734847
102        %t1 = xor i64 %t0, %u
103	%t2 = and i64 %t1, 4294967295
104        store i64 %t2, i64* %z
105	ret void
106}
107define void @oze(i64 %y, i64* %z) nounwind readnone {
108; CHECK-LABEL: oze:
109; CHECK:       # %bb.0: # %entry
110; CHECK-NEXT:    incl %edi
111; CHECK-NEXT:    movq %rdi, (%rsi)
112; CHECK-NEXT:    retq
113entry:
114	%t0 = add i64 %y, 1
115	%t1 = and i64 %t0, 4294967295
116        store i64 %t1, i64* %z
117	ret void
118}
119
120define void @sbar(i64 %x, i64 %y, i64* %z) nounwind readnone {
121; CHECK-LABEL: sbar:
122; CHECK:       # %bb.0: # %entry
123; CHECK-NEXT:    subl %esi, %edi
124; CHECK-NEXT:    movq %rdi, (%rdx)
125; CHECK-NEXT:    retq
126entry:
127	%t0 = sub i64 %x, %y
128	%t1 = and i64 %t0, 4294967295
129        store i64 %t1, i64* %z
130	ret void
131}
132define void @seasy(i32 %x, i32 %y, i64* %z) nounwind readnone {
133; CHECK-LABEL: seasy:
134; CHECK:       # %bb.0: # %entry
135; CHECK-NEXT:    # kill: def $edi killed $edi def $rdi
136; CHECK-NEXT:    subl %esi, %edi
137; CHECK-NEXT:    movq %rdi, (%rdx)
138; CHECK-NEXT:    retq
139entry:
140	%t0 = sub i32 %x, %y
141        %tn = zext i32 %t0 to i64
142	%t1 = and i64 %tn, 4294967295
143        store i64 %t1, i64* %z
144	ret void
145}
146define void @scola(i64 *%x, i64 %y, i64* %z, i64 %u) nounwind readnone {
147; CHECK-LABEL: scola:
148; CHECK:       # %bb.0: # %entry
149; CHECK-NEXT:    movl (%rdi), %eax
150; CHECK-NEXT:    subl %esi, %eax
151; CHECK-NEXT:    xorq %rcx, %rax
152; CHECK-NEXT:    movq %rax, (%rdx)
153; CHECK-NEXT:    retq
154entry:
155        %p = load i64, i64* %x
156	%t0 = sub i64 %p, %y
157	%t1 = and i64 %t0, 4294967295
158        %t2 = xor i64 %t1, %u
159        store i64 %t2, i64* %z
160	ret void
161}
162define void @syaks(i64 *%x, i64 %y, i64* %z, i64 %u) nounwind readnone {
163; CHECK-LABEL: syaks:
164; CHECK:       # %bb.0: # %entry
165; CHECK-NEXT:    movl (%rdi), %eax
166; CHECK-NEXT:    subl %esi, %eax
167; CHECK-NEXT:    xorl %eax, %ecx
168; CHECK-NEXT:    movq %rcx, (%rdx)
169; CHECK-NEXT:    retq
170entry:
171        %p = load i64, i64* %x
172	%t0 = sub i64 %p, %y
173        %t1 = xor i64 %t0, %u
174	%t2 = and i64 %t1, 4294967295
175        store i64 %t2, i64* %z
176	ret void
177}
178define void @sfoo(i64 *%x, i64 *%y, i64* %z) nounwind readnone {
179; CHECK-LABEL: sfoo:
180; CHECK:       # %bb.0: # %entry
181; CHECK-NEXT:    movl (%rdi), %eax
182; CHECK-NEXT:    subl (%rsi), %eax
183; CHECK-NEXT:    movq %rax, (%rdx)
184; CHECK-NEXT:    retq
185entry:
186        %a = load i64, i64* %x
187        %b = load i64, i64* %y
188	%t0 = sub i64 %a, %b
189	%t1 = and i64 %t0, 4294967295
190        store i64 %t1, i64* %z
191	ret void
192}
193define void @swya(i64 %y, i64* %z) nounwind readnone {
194; CHECK-LABEL: swya:
195; CHECK:       # %bb.0: # %entry
196; CHECK-NEXT:    negl %edi
197; CHECK-NEXT:    movq %rdi, (%rsi)
198; CHECK-NEXT:    retq
199entry:
200	%t0 = sub i64 0, %y
201	%t1 = and i64 %t0, 4294967295
202        store i64 %t1, i64* %z
203	ret void
204}
205define void @soze(i64 %y, i64* %z) nounwind readnone {
206; CHECK-LABEL: soze:
207; CHECK:       # %bb.0: # %entry
208; CHECK-NEXT:    decl %edi
209; CHECK-NEXT:    movq %rdi, (%rsi)
210; CHECK-NEXT:    retq
211entry:
212	%t0 = sub i64 %y, 1
213	%t1 = and i64 %t0, 4294967295
214        store i64 %t1, i64* %z
215	ret void
216}
217