Skip to content

Commit f4a1b54

Browse files
committed
[X86] Add PR25858 test cases
llvm-svn: 352075
1 parent cf8baa8 commit f4a1b54

File tree

1 file changed

+124
-0
lines changed

1 file changed

+124
-0
lines changed

llvm/test/CodeGen/X86/combine-sbb.ll

Lines changed: 124 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,124 @@
1+
; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2+
; RUN: llc < %s -mtriple=i686-unknown-unknown | FileCheck %s --check-prefixes=X86
3+
; RUN: llc < %s -mtriple=x86_64-unknown-unknown | FileCheck %s --check-prefixes=X64
4+
5+
%WideUInt32 = type { i32, i32 }
6+
7+
define void @PR25858_i32(%WideUInt32* sret, %WideUInt32*, %WideUInt32*) nounwind {
8+
; X86-LABEL: PR25858_i32:
9+
; X86: # %bb.0: # %top
10+
; X86-NEXT: pushl %esi
11+
; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
12+
; X86-NEXT: movl {{[0-9]+}}(%esp), %ecx
13+
; X86-NEXT: movl {{[0-9]+}}(%esp), %edx
14+
; X86-NEXT: movl (%edx), %esi
15+
; X86-NEXT: movl 4(%edx), %edx
16+
; X86-NEXT: subl 4(%ecx), %edx
17+
; X86-NEXT: subl (%ecx), %esi
18+
; X86-NEXT: sbbl $0, %edx
19+
; X86-NEXT: movl %esi, (%eax)
20+
; X86-NEXT: movl %edx, 4(%eax)
21+
; X86-NEXT: popl %esi
22+
; X86-NEXT: retl $4
23+
;
24+
; X64-LABEL: PR25858_i32:
25+
; X64: # %bb.0: # %top
26+
; X64-NEXT: movq %rdi, %rax
27+
; X64-NEXT: movl (%rsi), %ecx
28+
; X64-NEXT: movl 4(%rsi), %esi
29+
; X64-NEXT: subl 4(%rdx), %esi
30+
; X64-NEXT: subl (%rdx), %ecx
31+
; X64-NEXT: sbbl $0, %esi
32+
; X64-NEXT: movl %ecx, (%rdi)
33+
; X64-NEXT: movl %esi, 4(%rdi)
34+
; X64-NEXT: retq
35+
top:
36+
%3 = bitcast %WideUInt32* %1 to i32*
37+
%4 = load i32, i32* %3, align 4
38+
%5 = bitcast %WideUInt32* %2 to i32*
39+
%6 = load i32, i32* %5, align 4
40+
%7 = sub i32 %4, %6
41+
%8 = call { i32, i1 } @llvm.usub.with.overflow.i32(i32 %4, i32 %6)
42+
%9 = extractvalue { i32, i1 } %8, 1
43+
%10 = getelementptr inbounds %WideUInt32, %WideUInt32* %1, i32 0, i32 1
44+
%11 = load i32, i32* %10, align 8
45+
%12 = getelementptr inbounds %WideUInt32, %WideUInt32* %2, i32 0, i32 1
46+
%13 = load i32, i32* %12, align 8
47+
%14 = sub i32 %11, %13
48+
%.neg1 = sext i1 %9 to i32
49+
%15 = add i32 %14, %.neg1
50+
%16 = insertvalue %WideUInt32 undef, i32 %7, 0
51+
%17 = insertvalue %WideUInt32 %16, i32 %15, 1
52+
store %WideUInt32 %17, %WideUInt32* %0, align 4
53+
ret void
54+
}
55+
56+
declare { i32, i1 } @llvm.usub.with.overflow.i32(i32, i32)
57+
58+
%WideUInt64 = type { i64, i64 }
59+
60+
define void @PR25858_i64(%WideUInt64* sret, %WideUInt64*, %WideUInt64*) nounwind {
61+
; X86-LABEL: PR25858_i64:
62+
; X86: # %bb.0: # %top
63+
; X86-NEXT: pushl %ebp
64+
; X86-NEXT: pushl %ebx
65+
; X86-NEXT: pushl %edi
66+
; X86-NEXT: pushl %esi
67+
; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
68+
; X86-NEXT: movl {{[0-9]+}}(%esp), %ecx
69+
; X86-NEXT: movl {{[0-9]+}}(%esp), %edx
70+
; X86-NEXT: movl (%edx), %esi
71+
; X86-NEXT: movl 4(%edx), %edi
72+
; X86-NEXT: subl (%ecx), %esi
73+
; X86-NEXT: sbbl 4(%ecx), %edi
74+
; X86-NEXT: setb %bl
75+
; X86-NEXT: movl 12(%edx), %ebp
76+
; X86-NEXT: movl 8(%edx), %edx
77+
; X86-NEXT: subl 8(%ecx), %edx
78+
; X86-NEXT: sbbl 12(%ecx), %ebp
79+
; X86-NEXT: movzbl %bl, %ecx
80+
; X86-NEXT: subl %ecx, %edx
81+
; X86-NEXT: sbbl $0, %ebp
82+
; X86-NEXT: movl %edi, 4(%eax)
83+
; X86-NEXT: movl %esi, (%eax)
84+
; X86-NEXT: movl %edx, 8(%eax)
85+
; X86-NEXT: movl %ebp, 12(%eax)
86+
; X86-NEXT: popl %esi
87+
; X86-NEXT: popl %edi
88+
; X86-NEXT: popl %ebx
89+
; X86-NEXT: popl %ebp
90+
; X86-NEXT: retl $4
91+
;
92+
; X64-LABEL: PR25858_i64:
93+
; X64: # %bb.0: # %top
94+
; X64-NEXT: movq %rdi, %rax
95+
; X64-NEXT: movq (%rsi), %rcx
96+
; X64-NEXT: movq 8(%rsi), %rsi
97+
; X64-NEXT: subq 8(%rdx), %rsi
98+
; X64-NEXT: subq (%rdx), %rcx
99+
; X64-NEXT: sbbq $0, %rsi
100+
; X64-NEXT: movq %rcx, (%rdi)
101+
; X64-NEXT: movq %rsi, 8(%rdi)
102+
; X64-NEXT: retq
103+
top:
104+
%3 = bitcast %WideUInt64* %1 to i64*
105+
%4 = load i64, i64* %3, align 8
106+
%5 = bitcast %WideUInt64* %2 to i64*
107+
%6 = load i64, i64* %5, align 8
108+
%7 = sub i64 %4, %6
109+
%8 = call { i64, i1 } @llvm.usub.with.overflow.i64(i64 %4, i64 %6)
110+
%9 = extractvalue { i64, i1 } %8, 1
111+
%10 = getelementptr inbounds %WideUInt64, %WideUInt64* %1, i64 0, i32 1
112+
%11 = load i64, i64* %10, align 8
113+
%12 = getelementptr inbounds %WideUInt64, %WideUInt64* %2, i64 0, i32 1
114+
%13 = load i64, i64* %12, align 8
115+
%14 = sub i64 %11, %13
116+
%.neg1 = sext i1 %9 to i64
117+
%15 = add i64 %14, %.neg1
118+
%16 = insertvalue %WideUInt64 undef, i64 %7, 0
119+
%17 = insertvalue %WideUInt64 %16, i64 %15, 1
120+
store %WideUInt64 %17, %WideUInt64* %0, align 8
121+
ret void
122+
}
123+
124+
declare { i64, i1 } @llvm.usub.with.overflow.i64(i64, i64)

0 commit comments

Comments
 (0)