1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-24 13:33:37 +02:00
llvm-mirror/test/CodeGen/Mips/2008-06-05-Carry.ll
Simon Dardis a1f0320a27 [mips] Fix multiprecision arithmetic.
For multiprecision arithmetic on MIPS, rather than using ISD::ADDE / ISD::ADDC,
get SelectionDAG to break down the operation into ISD::ADDs and ISD::SETCCs.

For MIPS, only the DSP ASE has a carry flag, so in the general case it is not
useful to directly support ISD::{ADDE, ADDC, SUBE, SUBC} nodes.

Also improve the generation code in such cases for targets with
TargetLoweringBase::ZeroOrOneBooleanContent by directly using the result of the
comparison node rather than using it in selects. Similarly for ISD::SUBE /
ISD::SUBC.

Address optimization breakage by moving the generation of MIPS specific integer
multiply-accumulate nodes to before legalization.

This revolves PR32713 and PR33424.

Thanks to Simonas Kazlauskas and Pirama Arumuga Nainar for reporting the issue!

Reviewers: slthakur

Differential Revision: https://reviews.llvm.org/D33494

llvm-svn: 305389
2017-06-14 14:46:30 +00:00

24 lines
408 B
LLVM

; RUN: llc -march=mips < %s | FileCheck %s
define i64 @add64(i64 %u, i64 %v) nounwind {
entry:
; CHECK-LABEL: add64:
; CHECK: addu
; CHECK-DAG: sltu
; CHECK-DAG: addu
; CHECK: addu
%tmp2 = add i64 %u, %v
ret i64 %tmp2
}
define i64 @sub64(i64 %u, i64 %v) nounwind {
entry:
; CHECK-LABEL: sub64
; CHECK-DAG: sltu
; CHECK-DAG: subu
; CHECK: subu
; CHECK: subu
%tmp2 = sub i64 %u, %v
ret i64 %tmp2
}