mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2025-01-31 12:41:49 +01:00
[CodeGen][X86][NFC] Tests for (sub Carry, X) -> (addcarry (sub 0, X), 0, Carry) fold (D62392)
llvm-svn: 372258
This commit is contained in:
parent
ad7efc958c
commit
e34754387d
@ -162,3 +162,24 @@ entry:
|
|||||||
%40 = insertvalue %S undef, [4 x i64] %39, 0
|
%40 = insertvalue %S undef, [4 x i64] %39, 0
|
||||||
ret %S %40
|
ret %S %40
|
||||||
}
|
}
|
||||||
|
|
||||||
|
declare {i64, i1} @llvm.uadd.with.overflow(i64, i64)
|
||||||
|
declare {i64, i1} @llvm.usub.with.overflow(i64, i64)
|
||||||
|
|
||||||
|
define i64 @sub_from_carry(i64 %x, i64 %y, i64* %valout, i64 %z) {
|
||||||
|
; CHECK-LABEL: sub_from_carry:
|
||||||
|
; CHECK: # %bb.0:
|
||||||
|
; CHECK-NEXT: xorl %eax, %eax
|
||||||
|
; CHECK-NEXT: addq %rsi, %rdi
|
||||||
|
; CHECK-NEXT: setb %al
|
||||||
|
; CHECK-NEXT: movq %rdi, (%rdx)
|
||||||
|
; CHECK-NEXT: subq %rcx, %rax
|
||||||
|
; CHECK-NEXT: retq
|
||||||
|
%agg = call {i64, i1} @llvm.uadd.with.overflow(i64 %x, i64 %y)
|
||||||
|
%val = extractvalue {i64, i1} %agg, 0
|
||||||
|
%ov = extractvalue {i64, i1} %agg, 1
|
||||||
|
store i64 %val, i64* %valout, align 4
|
||||||
|
%carry = zext i1 %ov to i64
|
||||||
|
%res = sub i64 %carry, %z
|
||||||
|
ret i64 %res
|
||||||
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user