1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc -mtriple=x86_64-darwin-unknown < %s | FileCheck %s --check-prefix=X64
3 ; RUN: llc -mtriple=i686-darwin-unknown < %s | FileCheck %s --check-prefix=X86
5 define zeroext i1 @saddoi128(i128 %v1, i128 %v2, ptr %res) nounwind {
6 ; X64-LABEL: saddoi128:
8 ; X64-NEXT: addq %rdx, %rdi
9 ; X64-NEXT: adcq %rcx, %rsi
11 ; X64-NEXT: movq %rdi, (%r8)
12 ; X64-NEXT: movq %rsi, 8(%r8)
15 ; X86-LABEL: saddoi128:
17 ; X86-NEXT: pushl %ebx
18 ; X86-NEXT: pushl %edi
19 ; X86-NEXT: pushl %esi
20 ; X86-NEXT: movl {{[0-9]+}}(%esp), %ecx
21 ; X86-NEXT: movl {{[0-9]+}}(%esp), %edx
22 ; X86-NEXT: movl {{[0-9]+}}(%esp), %esi
23 ; X86-NEXT: movl {{[0-9]+}}(%esp), %edi
24 ; X86-NEXT: movl {{[0-9]+}}(%esp), %ebx
25 ; X86-NEXT: addl {{[0-9]+}}(%esp), %edi
26 ; X86-NEXT: adcl {{[0-9]+}}(%esp), %ebx
27 ; X86-NEXT: adcl {{[0-9]+}}(%esp), %esi
28 ; X86-NEXT: adcl {{[0-9]+}}(%esp), %edx
30 ; X86-NEXT: movl %edi, (%ecx)
31 ; X86-NEXT: movl %ebx, 4(%ecx)
32 ; X86-NEXT: movl %esi, 8(%ecx)
33 ; X86-NEXT: movl %edx, 12(%ecx)
38 %t = call {i128, i1} @llvm.sadd.with.overflow.i128(i128 %v1, i128 %v2)
39 %val = extractvalue {i128, i1} %t, 0
40 %obit = extractvalue {i128, i1} %t, 1
41 store i128 %val, ptr %res
45 define zeroext i1 @uaddoi128(i128 %v1, i128 %v2, ptr %res) nounwind {
46 ; X64-LABEL: uaddoi128:
48 ; X64-NEXT: addq %rdx, %rdi
49 ; X64-NEXT: adcq %rcx, %rsi
51 ; X64-NEXT: movq %rdi, (%r8)
52 ; X64-NEXT: movq %rsi, 8(%r8)
55 ; X86-LABEL: uaddoi128:
57 ; X86-NEXT: pushl %ebx
58 ; X86-NEXT: pushl %edi
59 ; X86-NEXT: pushl %esi
60 ; X86-NEXT: movl {{[0-9]+}}(%esp), %ecx
61 ; X86-NEXT: movl {{[0-9]+}}(%esp), %edx
62 ; X86-NEXT: movl {{[0-9]+}}(%esp), %esi
63 ; X86-NEXT: movl {{[0-9]+}}(%esp), %edi
64 ; X86-NEXT: movl {{[0-9]+}}(%esp), %ebx
65 ; X86-NEXT: addl {{[0-9]+}}(%esp), %edi
66 ; X86-NEXT: adcl {{[0-9]+}}(%esp), %ebx
67 ; X86-NEXT: adcl {{[0-9]+}}(%esp), %esi
68 ; X86-NEXT: adcl {{[0-9]+}}(%esp), %edx
70 ; X86-NEXT: movl %edi, (%ecx)
71 ; X86-NEXT: movl %ebx, 4(%ecx)
72 ; X86-NEXT: movl %esi, 8(%ecx)
73 ; X86-NEXT: movl %edx, 12(%ecx)
78 %t = call {i128, i1} @llvm.uadd.with.overflow.i128(i128 %v1, i128 %v2)
79 %val = extractvalue {i128, i1} %t, 0
80 %obit = extractvalue {i128, i1} %t, 1
81 store i128 %val, ptr %res
86 define zeroext i1 @ssuboi128(i128 %v1, i128 %v2, ptr %res) nounwind {
87 ; X64-LABEL: ssuboi128:
89 ; X64-NEXT: subq %rdx, %rdi
90 ; X64-NEXT: sbbq %rcx, %rsi
92 ; X64-NEXT: movq %rdi, (%r8)
93 ; X64-NEXT: movq %rsi, 8(%r8)
96 ; X86-LABEL: ssuboi128:
98 ; X86-NEXT: pushl %ebx
99 ; X86-NEXT: pushl %edi
100 ; X86-NEXT: pushl %esi
101 ; X86-NEXT: movl {{[0-9]+}}(%esp), %ecx
102 ; X86-NEXT: movl {{[0-9]+}}(%esp), %edx
103 ; X86-NEXT: movl {{[0-9]+}}(%esp), %esi
104 ; X86-NEXT: movl {{[0-9]+}}(%esp), %edi
105 ; X86-NEXT: movl {{[0-9]+}}(%esp), %ebx
106 ; X86-NEXT: subl {{[0-9]+}}(%esp), %edi
107 ; X86-NEXT: sbbl {{[0-9]+}}(%esp), %ebx
108 ; X86-NEXT: sbbl {{[0-9]+}}(%esp), %esi
109 ; X86-NEXT: sbbl {{[0-9]+}}(%esp), %edx
111 ; X86-NEXT: movl %edi, (%ecx)
112 ; X86-NEXT: movl %ebx, 4(%ecx)
113 ; X86-NEXT: movl %esi, 8(%ecx)
114 ; X86-NEXT: movl %edx, 12(%ecx)
115 ; X86-NEXT: popl %esi
116 ; X86-NEXT: popl %edi
117 ; X86-NEXT: popl %ebx
119 %t = call {i128, i1} @llvm.ssub.with.overflow.i128(i128 %v1, i128 %v2)
120 %val = extractvalue {i128, i1} %t, 0
121 %obit = extractvalue {i128, i1} %t, 1
122 store i128 %val, ptr %res
126 define zeroext i1 @usuboi128(i128 %v1, i128 %v2, ptr %res) nounwind {
127 ; X64-LABEL: usuboi128:
129 ; X64-NEXT: subq %rdx, %rdi
130 ; X64-NEXT: sbbq %rcx, %rsi
132 ; X64-NEXT: movq %rdi, (%r8)
133 ; X64-NEXT: movq %rsi, 8(%r8)
136 ; X86-LABEL: usuboi128:
138 ; X86-NEXT: pushl %ebx
139 ; X86-NEXT: pushl %edi
140 ; X86-NEXT: pushl %esi
141 ; X86-NEXT: movl {{[0-9]+}}(%esp), %ecx
142 ; X86-NEXT: movl {{[0-9]+}}(%esp), %edx
143 ; X86-NEXT: movl {{[0-9]+}}(%esp), %esi
144 ; X86-NEXT: movl {{[0-9]+}}(%esp), %edi
145 ; X86-NEXT: movl {{[0-9]+}}(%esp), %ebx
146 ; X86-NEXT: subl {{[0-9]+}}(%esp), %edi
147 ; X86-NEXT: sbbl {{[0-9]+}}(%esp), %ebx
148 ; X86-NEXT: sbbl {{[0-9]+}}(%esp), %esi
149 ; X86-NEXT: sbbl {{[0-9]+}}(%esp), %edx
151 ; X86-NEXT: movl %edi, (%ecx)
152 ; X86-NEXT: movl %ebx, 4(%ecx)
153 ; X86-NEXT: movl %esi, 8(%ecx)
154 ; X86-NEXT: movl %edx, 12(%ecx)
155 ; X86-NEXT: popl %esi
156 ; X86-NEXT: popl %edi
157 ; X86-NEXT: popl %ebx
159 %t = call {i128, i1} @llvm.usub.with.overflow.i128(i128 %v1, i128 %v2)
160 %val = extractvalue {i128, i1} %t, 0
161 %obit = extractvalue {i128, i1} %t, 1
162 store i128 %val, ptr %res
166 declare {i128, i1} @llvm.sadd.with.overflow.i128(i128, i128) nounwind readnone
167 declare {i128, i1} @llvm.uadd.with.overflow.i128(i128, i128) nounwind readnone
168 declare {i128, i1} @llvm.ssub.with.overflow.i128(i128, i128) nounwind readnone
169 declare {i128, i1} @llvm.usub.with.overflow.i128(i128, i128) nounwind readnone