1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc < %s -mtriple=x86_64-unknown-linux-gnu | FileCheck %s --check-prefixes=X64
3 ; RUN: llc < %s -mtriple=i686-unknown-linux-gnu | FileCheck %s --check-prefixes=X86
5 define { i128, i8 } @muloti_test(i128 %l, i128 %r) unnamed_addr #0 {
6 ; X64-LABEL: muloti_test:
7 ; X64: # %bb.0: # %start
8 ; X64-NEXT: movq %rdx, %r8
9 ; X64-NEXT: movq %rsi, %rax
10 ; X64-NEXT: testq %rcx, %rcx
12 ; X64-NEXT: testq %rsi, %rsi
13 ; X64-NEXT: setne %r9b
14 ; X64-NEXT: andb %dl, %r9b
16 ; X64-NEXT: movq %rax, %rsi
17 ; X64-NEXT: seto %r10b
18 ; X64-NEXT: movq %rcx, %rax
20 ; X64-NEXT: movq %rax, %rcx
21 ; X64-NEXT: seto %r11b
22 ; X64-NEXT: orb %r10b, %r11b
23 ; X64-NEXT: addq %rsi, %rcx
24 ; X64-NEXT: movq %rdi, %rax
26 ; X64-NEXT: addq %rcx, %rdx
28 ; X64-NEXT: orb %r11b, %cl
29 ; X64-NEXT: orb %r9b, %cl
32 ; X86-LABEL: muloti_test:
33 ; X86: # %bb.0: # %start
34 ; X86-NEXT: pushl %ebp
35 ; X86-NEXT: .cfi_def_cfa_offset 8
36 ; X86-NEXT: pushl %ebx
37 ; X86-NEXT: .cfi_def_cfa_offset 12
38 ; X86-NEXT: pushl %edi
39 ; X86-NEXT: .cfi_def_cfa_offset 16
40 ; X86-NEXT: pushl %esi
41 ; X86-NEXT: .cfi_def_cfa_offset 20
42 ; X86-NEXT: subl $28, %esp
43 ; X86-NEXT: .cfi_def_cfa_offset 48
44 ; X86-NEXT: .cfi_offset %esi, -20
45 ; X86-NEXT: .cfi_offset %edi, -16
46 ; X86-NEXT: .cfi_offset %ebx, -12
47 ; X86-NEXT: .cfi_offset %ebp, -8
48 ; X86-NEXT: movl {{[0-9]+}}(%esp), %edi
49 ; X86-NEXT: movl %edi, {{[-0-9]+}}(%e{{[sb]}}p) # 4-byte Spill
50 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
51 ; X86-NEXT: movl {{[0-9]+}}(%esp), %ebx
52 ; X86-NEXT: movl {{[0-9]+}}(%esp), %esi
54 ; X86-NEXT: movl %eax, %ecx
55 ; X86-NEXT: seto {{[-0-9]+}}(%e{{[sb]}}p) # 1-byte Folded Spill
56 ; X86-NEXT: movl %esi, %eax
58 ; X86-NEXT: movl %eax, %esi
59 ; X86-NEXT: seto {{[-0-9]+}}(%e{{[sb]}}p) # 1-byte Folded Spill
60 ; X86-NEXT: addl %ecx, %esi
61 ; X86-NEXT: movl %edi, %eax
63 ; X86-NEXT: movl %eax, {{[-0-9]+}}(%e{{[sb]}}p) # 4-byte Spill
64 ; X86-NEXT: movl %edx, %ecx
65 ; X86-NEXT: addl %esi, %ecx
66 ; X86-NEXT: setb {{[-0-9]+}}(%e{{[sb]}}p) # 1-byte Folded Spill
67 ; X86-NEXT: movl {{[0-9]+}}(%esp), %ebp
68 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
70 ; X86-NEXT: movl %eax, %edi
71 ; X86-NEXT: seto {{[-0-9]+}}(%e{{[sb]}}p) # 1-byte Folded Spill
72 ; X86-NEXT: movl {{[0-9]+}}(%esp), %ebx
73 ; X86-NEXT: movl %ebx, {{[-0-9]+}}(%e{{[sb]}}p) # 4-byte Spill
74 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
76 ; X86-NEXT: movl %eax, %esi
77 ; X86-NEXT: seto {{[-0-9]+}}(%e{{[sb]}}p) # 1-byte Folded Spill
78 ; X86-NEXT: addl %edi, %esi
79 ; X86-NEXT: movl %ebx, %eax
81 ; X86-NEXT: movl %ebp, %ebx
82 ; X86-NEXT: movl %edx, %edi
83 ; X86-NEXT: addl %esi, %edi
84 ; X86-NEXT: setb {{[-0-9]+}}(%e{{[sb]}}p) # 1-byte Folded Spill
85 ; X86-NEXT: addl {{[-0-9]+}}(%e{{[sb]}}p), %eax # 4-byte Folded Reload
86 ; X86-NEXT: movl %eax, {{[-0-9]+}}(%e{{[sb]}}p) # 4-byte Spill
87 ; X86-NEXT: adcl %ecx, %edi
88 ; X86-NEXT: movl {{[0-9]+}}(%esp), %ebp
89 ; X86-NEXT: movl %ebp, %eax
90 ; X86-NEXT: movl %ebx, %ecx
92 ; X86-NEXT: movl %edx, %ebx
93 ; X86-NEXT: movl %eax, {{[-0-9]+}}(%e{{[sb]}}p) # 4-byte Spill
94 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
96 ; X86-NEXT: movl %edx, %esi
97 ; X86-NEXT: movl %eax, %ecx
98 ; X86-NEXT: addl %ebx, %ecx
99 ; X86-NEXT: adcl $0, %esi
100 ; X86-NEXT: movl %ebp, %eax
101 ; X86-NEXT: movl {{[0-9]+}}(%esp), %ebp
102 ; X86-NEXT: mull %ebp
103 ; X86-NEXT: movl %edx, %ebx
104 ; X86-NEXT: addl %ecx, %eax
105 ; X86-NEXT: movl %eax, {{[-0-9]+}}(%e{{[sb]}}p) # 4-byte Spill
106 ; X86-NEXT: adcl %esi, %ebx
107 ; X86-NEXT: setb {{[-0-9]+}}(%e{{[sb]}}p) # 1-byte Folded Spill
108 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
109 ; X86-NEXT: mull %ebp
110 ; X86-NEXT: movl %edx, %ecx
111 ; X86-NEXT: movl %eax, %esi
112 ; X86-NEXT: addl %ebx, %esi
113 ; X86-NEXT: movzbl {{[-0-9]+}}(%e{{[sb]}}p), %eax # 1-byte Folded Reload
114 ; X86-NEXT: adcl %eax, %ecx
115 ; X86-NEXT: xorl %edx, %edx
116 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
117 ; X86-NEXT: mull %edx
118 ; X86-NEXT: movl %edx, %ebp
119 ; X86-NEXT: movl %eax, %ebx
120 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
121 ; X86-NEXT: xorl %edx, %edx
122 ; X86-NEXT: mull %edx
123 ; X86-NEXT: addl %ebx, %eax
124 ; X86-NEXT: adcl %ebp, %edx
125 ; X86-NEXT: addl %esi, %eax
126 ; X86-NEXT: adcl %ecx, %edx
127 ; X86-NEXT: addl {{[-0-9]+}}(%e{{[sb]}}p), %eax # 4-byte Folded Reload
128 ; X86-NEXT: adcl %edi, %edx
129 ; X86-NEXT: setb {{[-0-9]+}}(%e{{[sb]}}p) # 1-byte Folded Spill
130 ; X86-NEXT: cmpl $0, {{[0-9]+}}(%esp)
131 ; X86-NEXT: setne %cl
132 ; X86-NEXT: movl {{[0-9]+}}(%esp), %esi
133 ; X86-NEXT: testl %esi, %esi
134 ; X86-NEXT: setne %ch
135 ; X86-NEXT: andb %cl, %ch
136 ; X86-NEXT: movb {{[-0-9]+}}(%e{{[sb]}}p), %cl # 1-byte Reload
137 ; X86-NEXT: orb {{[-0-9]+}}(%e{{[sb]}}p), %cl # 1-byte Folded Reload
138 ; X86-NEXT: orb {{[-0-9]+}}(%e{{[sb]}}p), %cl # 1-byte Folded Reload
139 ; X86-NEXT: orb %ch, %cl
140 ; X86-NEXT: movb %cl, {{[-0-9]+}}(%e{{[sb]}}p) # 1-byte Spill
141 ; X86-NEXT: cmpl $0, {{[0-9]+}}(%esp)
142 ; X86-NEXT: setne %cl
143 ; X86-NEXT: movl {{[0-9]+}}(%esp), %edi
144 ; X86-NEXT: testl %edi, %edi
145 ; X86-NEXT: setne %bh
146 ; X86-NEXT: andb %cl, %bh
147 ; X86-NEXT: movb {{[-0-9]+}}(%e{{[sb]}}p), %cl # 1-byte Reload
148 ; X86-NEXT: orb {{[-0-9]+}}(%e{{[sb]}}p), %cl # 1-byte Folded Reload
149 ; X86-NEXT: orb {{[-0-9]+}}(%e{{[sb]}}p), %cl # 1-byte Folded Reload
150 ; X86-NEXT: movb %cl, {{[-0-9]+}}(%e{{[sb]}}p) # 1-byte Spill
151 ; X86-NEXT: orl %esi, {{[-0-9]+}}(%e{{[sb]}}p) # 4-byte Folded Spill
152 ; X86-NEXT: setne %bl
153 ; X86-NEXT: orl %edi, {{[-0-9]+}}(%e{{[sb]}}p) # 4-byte Folded Spill
154 ; X86-NEXT: movl {{[0-9]+}}(%esp), %ecx
155 ; X86-NEXT: movl {{[-0-9]+}}(%e{{[sb]}}p), %esi # 4-byte Reload
156 ; X86-NEXT: movl %esi, (%ecx)
157 ; X86-NEXT: movl {{[-0-9]+}}(%e{{[sb]}}p), %esi # 4-byte Reload
158 ; X86-NEXT: movl %esi, 4(%ecx)
159 ; X86-NEXT: movl %eax, 8(%ecx)
160 ; X86-NEXT: movl %edx, 12(%ecx)
161 ; X86-NEXT: setne %al
162 ; X86-NEXT: andb %bl, %al
163 ; X86-NEXT: orb {{[-0-9]+}}(%e{{[sb]}}p), %al # 1-byte Folded Reload
164 ; X86-NEXT: orb {{[-0-9]+}}(%e{{[sb]}}p), %al # 1-byte Folded Reload
165 ; X86-NEXT: orb {{[-0-9]+}}(%e{{[sb]}}p), %al # 1-byte Folded Reload
166 ; X86-NEXT: orb %bh, %al
167 ; X86-NEXT: andb $1, %al
168 ; X86-NEXT: movb %al, 16(%ecx)
169 ; X86-NEXT: movl %ecx, %eax
170 ; X86-NEXT: addl $28, %esp
171 ; X86-NEXT: .cfi_def_cfa_offset 20
172 ; X86-NEXT: popl %esi
173 ; X86-NEXT: .cfi_def_cfa_offset 16
174 ; X86-NEXT: popl %edi
175 ; X86-NEXT: .cfi_def_cfa_offset 12
176 ; X86-NEXT: popl %ebx
177 ; X86-NEXT: .cfi_def_cfa_offset 8
178 ; X86-NEXT: popl %ebp
179 ; X86-NEXT: .cfi_def_cfa_offset 4
182 %0 = tail call { i128, i1 } @llvm.umul.with.overflow.i128(i128 %l, i128 %r) #2
183 %1 = extractvalue { i128, i1 } %0, 0
184 %2 = extractvalue { i128, i1 } %0, 1
185 %3 = zext i1 %2 to i8
186 %4 = insertvalue { i128, i8 } undef, i128 %1, 0
187 %5 = insertvalue { i128, i8 } %4, i8 %3, 1
191 ; Function Attrs: nounwind readnone speculatable
192 declare { i128, i1 } @llvm.umul.with.overflow.i128(i128, i128) #1
194 attributes #0 = { nounwind readnone uwtable }
195 attributes #1 = { nounwind readnone speculatable }
196 attributes #2 = { nounwind }