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