Skip to content

Commit 4089c5d

Browse files
committed
Pre-commit tests (NFC)
1 parent aec8883 commit 4089c5d

File tree

2 files changed

+568
-25
lines changed

2 files changed

+568
-25
lines changed

llvm/test/CodeGen/X86/sub-with-overflow.ll

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,3 +93,79 @@ entry:
9393
ret i1 %obit
9494

9595
}
96+
97+
define i1 @usubo_uge_i64_overflow_used(i64 %x, i64 %y, ptr %p) {
98+
; CHECK-LABEL: usubo_uge_i64_overflow_used:
99+
; CHECK: # %bb.0:
100+
; CHECK-NEXT: movl {{[0-9]+}}(%esp), %eax
101+
; CHECK-NEXT: movl {{[0-9]+}}(%esp), %ecx
102+
; CHECK-NEXT: cmpl {{[0-9]+}}(%esp), %eax
103+
; CHECK-NEXT: sbbl {{[0-9]+}}(%esp), %ecx
104+
; CHECK-NEXT: setae %al
105+
; CHECK-NEXT: retl
106+
%s = sub i64 %x, %y
107+
%ov = icmp uge i64 %x, %y
108+
ret i1 %ov
109+
}
110+
111+
define i1 @usubo_uge_i64_math_overflow_used(i64 %x, i64 %y, ptr %p) {
112+
; CHECK-LABEL: usubo_uge_i64_math_overflow_used:
113+
; CHECK: # %bb.0:
114+
; CHECK-NEXT: movl {{[0-9]+}}(%esp), %eax
115+
; CHECK-NEXT: movl {{[0-9]+}}(%esp), %ecx
116+
; CHECK-NEXT: movl {{[0-9]+}}(%esp), %edx
117+
; CHECK-NEXT: subl {{[0-9]+}}(%esp), %ecx
118+
; CHECK-NEXT: movl %ecx, (%eax)
119+
; CHECK-NEXT: sbbl {{[0-9]+}}(%esp), %edx
120+
; CHECK-NEXT: movl %edx, 4(%eax)
121+
; CHECK-NEXT: setae %al
122+
; CHECK-NEXT: retl
123+
%s = sub i64 %x, %y
124+
store i64 %s, ptr %p
125+
%ov = icmp uge i64 %x, %y
126+
ret i1 %ov
127+
}
128+
129+
define i1 @usubo_ule_i32_overflow_used(i32 %x, i32 %y, ptr %p) {
130+
; CHECK-LABEL: usubo_ule_i32_overflow_used:
131+
; CHECK: # %bb.0:
132+
; CHECK-NEXT: movl {{[0-9]+}}(%esp), %eax
133+
; CHECK-NEXT: cmpl {{[0-9]+}}(%esp), %eax
134+
; CHECK-NEXT: setae %al
135+
; CHECK-NEXT: retl
136+
%s = sub i32 %y, %x
137+
%ov = icmp ule i32 %x, %y
138+
ret i1 %ov
139+
}
140+
141+
define i1 @usubo_ne_zero_i16_overflow_used(i16 %x, ptr %p) {
142+
; CHECK-LABEL: usubo_ne_zero_i16_overflow_used:
143+
; CHECK: # %bb.0:
144+
; CHECK-NEXT: movl {{[0-9]+}}(%esp), %eax
145+
; CHECK-NEXT: movl {{[0-9]+}}(%esp), %ecx
146+
; CHECK-NEXT: movl %eax, %edx
147+
; CHECK-NEXT: decl %edx
148+
; CHECK-NEXT: movw %dx, (%ecx)
149+
; CHECK-NEXT: testw %ax, %ax
150+
; CHECK-NEXT: setne %al
151+
; CHECK-NEXT: retl
152+
%s = sub i16 %x, 1
153+
store i16 %s, ptr %p
154+
%ov = icmp ne i16 %x, 0
155+
ret i1 %ov
156+
}
157+
158+
define i1 @usubo_eq_zero_i8_overflow_used(i8 %x, ptr %p) {
159+
; CHECK-LABEL: usubo_eq_zero_i8_overflow_used:
160+
; CHECK: # %bb.0:
161+
; CHECK-NEXT: movl {{[0-9]+}}(%esp), %eax
162+
; CHECK-NEXT: movzbl {{[0-9]+}}(%esp), %ecx
163+
; CHECK-NEXT: negb %cl
164+
; CHECK-NEXT: movb %cl, (%eax)
165+
; CHECK-NEXT: setae %al
166+
; CHECK-NEXT: retl
167+
%s = sub i8 0, %x
168+
store i8 %s, ptr %p
169+
%ov = icmp eq i8 %x, 0
170+
ret i1 %ov
171+
}

0 commit comments

Comments
 (0)