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: seto %r11b
21 ; X64-NEXT: orb %r10b, %r11b
22 ; X64-NEXT: orb %r9b, %r11b
23 ; X64-NEXT: leaq (%rsi,%rax), %rcx
24 ; X64-NEXT: movq %rdi, %rax
26 ; X64-NEXT: addq %rcx, %rdx
28 ; X64-NEXT: orb %r11b, %cl
31 ; X86-LABEL: muloti_test:
32 ; X86: # %bb.0: # %start
33 ; X86-NEXT: pushl %ebp
34 ; X86-NEXT: .cfi_def_cfa_offset 8
35 ; X86-NEXT: pushl %ebx
36 ; X86-NEXT: .cfi_def_cfa_offset 12
37 ; X86-NEXT: pushl %edi
38 ; X86-NEXT: .cfi_def_cfa_offset 16
39 ; X86-NEXT: pushl %esi
40 ; X86-NEXT: .cfi_def_cfa_offset 20
41 ; X86-NEXT: subl $24, %esp
42 ; X86-NEXT: .cfi_def_cfa_offset 44
43 ; X86-NEXT: .cfi_offset %esi, -20
44 ; X86-NEXT: .cfi_offset %edi, -16
45 ; X86-NEXT: .cfi_offset %ebx, -12
46 ; X86-NEXT: .cfi_offset %ebp, -8
47 ; X86-NEXT: movl {{[0-9]+}}(%esp), %edi
48 ; X86-NEXT: movl %edi, {{[-0-9]+}}(%e{{[sb]}}p) # 4-byte Spill
49 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
50 ; X86-NEXT: movl {{[0-9]+}}(%esp), %ecx
51 ; X86-NEXT: movl {{[0-9]+}}(%esp), %esi
53 ; X86-NEXT: movl %ecx, %ebx
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: leal (%ecx,%eax), %esi
59 ; X86-NEXT: seto {{[-0-9]+}}(%e{{[sb]}}p) # 1-byte Folded Spill
60 ; X86-NEXT: movl %edi, %eax
62 ; X86-NEXT: movl %eax, {{[-0-9]+}}(%e{{[sb]}}p) # 4-byte Spill
63 ; X86-NEXT: movl %edx, %ecx
64 ; X86-NEXT: addl %esi, %ecx
65 ; X86-NEXT: setb {{[-0-9]+}}(%e{{[sb]}}p) # 1-byte Folded Spill
66 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
67 ; X86-NEXT: movl {{[0-9]+}}(%esp), %edi
69 ; X86-NEXT: movl %eax, %esi
70 ; X86-NEXT: seto {{[-0-9]+}}(%e{{[sb]}}p) # 1-byte Folded Spill
71 ; X86-NEXT: movl {{[0-9]+}}(%esp), %ebx
72 ; X86-NEXT: movl %ebx, {{[-0-9]+}}(%e{{[sb]}}p) # 4-byte Spill
73 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
75 ; X86-NEXT: leal (%esi,%eax), %esi
76 ; X86-NEXT: seto {{[-0-9]+}}(%e{{[sb]}}p) # 1-byte Folded Spill
77 ; X86-NEXT: movl %ebx, %eax
79 ; X86-NEXT: movl %eax, %ebp
80 ; X86-NEXT: movl %edx, %ebx
81 ; X86-NEXT: addl %esi, %ebx
82 ; X86-NEXT: setb {{[-0-9]+}}(%e{{[sb]}}p) # 1-byte Folded Spill
83 ; X86-NEXT: addl {{[-0-9]+}}(%e{{[sb]}}p), %ebp # 4-byte Folded Reload
84 ; X86-NEXT: adcl %ecx, %ebx
85 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
87 ; X86-NEXT: movl %edx, %ecx
88 ; X86-NEXT: movl %eax, {{[-0-9]+}}(%e{{[sb]}}p) # 4-byte Spill
89 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
91 ; X86-NEXT: movl %edx, %esi
92 ; X86-NEXT: movl %eax, %edi
93 ; X86-NEXT: addl %ecx, %edi
94 ; X86-NEXT: adcl $0, %esi
95 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
96 ; X86-NEXT: mull {{[0-9]+}}(%esp)
97 ; X86-NEXT: movl %edx, %ecx
98 ; X86-NEXT: addl %edi, %eax
99 ; X86-NEXT: movl %eax, {{[-0-9]+}}(%e{{[sb]}}p) # 4-byte Spill
100 ; X86-NEXT: adcl %esi, %ecx
101 ; X86-NEXT: setb {{[-0-9]+}}(%e{{[sb]}}p) # 1-byte Folded Spill
102 ; X86-NEXT: movl {{[0-9]+}}(%esp), %esi
103 ; X86-NEXT: movl %esi, %eax
104 ; X86-NEXT: movl {{[0-9]+}}(%esp), %edi
105 ; X86-NEXT: mull %edi
106 ; X86-NEXT: addl %ecx, %eax
107 ; X86-NEXT: movzbl {{[-0-9]+}}(%e{{[sb]}}p), %ecx # 1-byte Folded Reload
108 ; X86-NEXT: adcl %ecx, %edx
109 ; X86-NEXT: addl %ebp, %eax
110 ; X86-NEXT: adcl %ebx, %edx
111 ; X86-NEXT: setb {{[-0-9]+}}(%e{{[sb]}}p) # 1-byte Folded Spill
112 ; X86-NEXT: testl %esi, %esi
113 ; X86-NEXT: setne %cl
114 ; X86-NEXT: movl {{[0-9]+}}(%esp), %esi
115 ; X86-NEXT: testl %esi, %esi
116 ; X86-NEXT: setne %ch
117 ; X86-NEXT: andb %cl, %ch
118 ; X86-NEXT: movb {{[-0-9]+}}(%e{{[sb]}}p), %cl # 1-byte Reload
119 ; X86-NEXT: orb {{[-0-9]+}}(%e{{[sb]}}p), %cl # 1-byte Folded Reload
120 ; X86-NEXT: orb %ch, %cl
121 ; X86-NEXT: orb {{[-0-9]+}}(%e{{[sb]}}p), %cl # 1-byte Folded Reload
122 ; X86-NEXT: movb %cl, {{[-0-9]+}}(%e{{[sb]}}p) # 1-byte Spill
123 ; X86-NEXT: testl %edi, %edi
124 ; X86-NEXT: setne %cl
125 ; X86-NEXT: movl {{[0-9]+}}(%esp), %edi
126 ; X86-NEXT: testl %edi, %edi
127 ; X86-NEXT: setne %ch
128 ; X86-NEXT: andb %cl, %ch
129 ; X86-NEXT: movzbl {{[-0-9]+}}(%e{{[sb]}}p), %ebx # 1-byte Folded Reload
130 ; X86-NEXT: orb {{[-0-9]+}}(%e{{[sb]}}p), %bl # 1-byte Folded Reload
131 ; X86-NEXT: orb %ch, %bl
132 ; X86-NEXT: orb {{[-0-9]+}}(%e{{[sb]}}p), %bl # 1-byte Folded Reload
133 ; X86-NEXT: orl %esi, {{[-0-9]+}}(%e{{[sb]}}p) # 4-byte Folded Spill
134 ; X86-NEXT: setne %bh
135 ; X86-NEXT: orl %edi, {{[-0-9]+}}(%e{{[sb]}}p) # 4-byte Folded Spill
136 ; X86-NEXT: movl {{[0-9]+}}(%esp), %ecx
137 ; X86-NEXT: movl {{[-0-9]+}}(%e{{[sb]}}p), %esi # 4-byte Reload
138 ; X86-NEXT: movl %esi, 4(%ecx)
139 ; X86-NEXT: movl {{[-0-9]+}}(%e{{[sb]}}p), %esi # 4-byte Reload
140 ; X86-NEXT: movl %esi, (%ecx)
141 ; X86-NEXT: movl %eax, 8(%ecx)
142 ; X86-NEXT: movl %edx, 12(%ecx)
143 ; X86-NEXT: setne %al
144 ; X86-NEXT: andb %bh, %al
145 ; X86-NEXT: orb %bl, %al
146 ; X86-NEXT: orb {{[-0-9]+}}(%e{{[sb]}}p), %al # 1-byte Folded Reload
147 ; X86-NEXT: orb {{[-0-9]+}}(%e{{[sb]}}p), %al # 1-byte Folded Reload
148 ; X86-NEXT: andb $1, %al
149 ; X86-NEXT: movb %al, 16(%ecx)
150 ; X86-NEXT: movl %ecx, %eax
151 ; X86-NEXT: addl $24, %esp
152 ; X86-NEXT: .cfi_def_cfa_offset 20
153 ; X86-NEXT: popl %esi
154 ; X86-NEXT: .cfi_def_cfa_offset 16
155 ; X86-NEXT: popl %edi
156 ; X86-NEXT: .cfi_def_cfa_offset 12
157 ; X86-NEXT: popl %ebx
158 ; X86-NEXT: .cfi_def_cfa_offset 8
159 ; X86-NEXT: popl %ebp
160 ; X86-NEXT: .cfi_def_cfa_offset 4
163 %0 = tail call { i128, i1 } @llvm.umul.with.overflow.i128(i128 %l, i128 %r) #2
164 %1 = extractvalue { i128, i1 } %0, 0
165 %2 = extractvalue { i128, i1 } %0, 1
166 %3 = zext i1 %2 to i8
167 %4 = insertvalue { i128, i8 } undef, i128 %1, 0
168 %5 = insertvalue { i128, i8 } %4, i8 %3, 1
172 ; Function Attrs: nounwind readnone speculatable
173 declare { i128, i1 } @llvm.umul.with.overflow.i128(i128, i128) #1
175 attributes #0 = { nounwind readnone uwtable }
176 attributes #1 = { nounwind readnone speculatable }
177 attributes #2 = { nounwind }