mirror of
https://github.com/RPCSX/llvm.git
synced 2024-12-28 15:33:14 +00:00
c004eec71b
(sbbl x, x) sets the registers to 0 or ~0. Combined with two's complement arithmetic, we can fold the intermediate AND and the ADD into a single SUB. This fixes <rdar://problem/8449754>. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@114460 91177308-0d34-0410-b5e6-96231b3b80d8
15 lines
344 B
LLVM
15 lines
344 B
LLVM
; RUN: llc < %s -march=x86 | FileCheck %s
|
|
; <rdar://problem/8449754>
|
|
|
|
define i32 @add32carry(i32 %sum, i32 %x) nounwind readnone ssp {
|
|
entry:
|
|
; CHECK: sbbl %ecx, %ecx
|
|
; CHECK-NOT: addl
|
|
; CHECK: subl %ecx, %eax
|
|
%add4 = add i32 %x, %sum
|
|
%cmp = icmp ult i32 %add4, %x
|
|
%inc = zext i1 %cmp to i32
|
|
%z.0 = add i32 %add4, %inc
|
|
ret i32 %z.0
|
|
}
|