mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-24 03:33:20 +01:00
c43ce3d9fa
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 The previous version of this patch was too aggressive in producing fused integer multiple-addition instructions. llvm-svn: 307906
51 lines
1.4 KiB
LLVM
51 lines
1.4 KiB
LLVM
; RUN: llc -march=mipsel -mattr=mips16 -relocation-model=pic -O3 < %s | FileCheck %s -check-prefix=16
|
|
|
|
@i = global i64 4294967295, align 8
|
|
@j = global i64 15, align 8
|
|
@ii = global i64 4294967295, align 8
|
|
@k = common global i64 0, align 8
|
|
@l = common global i64 0, align 8
|
|
@m = common global i64 0, align 8
|
|
|
|
define void @test1() nounwind {
|
|
entry:
|
|
%0 = load i64, i64* @i, align 8
|
|
%1 = load i64, i64* @j, align 8
|
|
%add = add nsw i64 %1, %0
|
|
store i64 %add, i64* @k, align 8
|
|
; 16: addu ${{[0-9]+}}, ${{[0-9]+}}, ${{[0-9]+}}
|
|
; 16: addu ${{[0-9]+}}, ${{[0-9]+}}, ${{[0-9]+}}
|
|
; 16: sltu ${{[0-9]+}}, ${{[0-9]+}}
|
|
; 16: move ${{[0-9]+}}, $24
|
|
; 16: addu ${{[0-9]+}}, ${{[0-9]+}}, ${{[0-9]+}}
|
|
ret void
|
|
}
|
|
|
|
define void @test2() nounwind {
|
|
entry:
|
|
%0 = load i64, i64* @i, align 8
|
|
%1 = load i64, i64* @j, align 8
|
|
%sub = sub nsw i64 %0, %1
|
|
; 16: subu ${{[0-9]+}}, ${{[0-9]+}}, ${{[0-9]+}}
|
|
; 16: sltu ${{[0-9]+}}, ${{[0-9]+}}
|
|
; 16: move ${{[0-9]+}}, $24
|
|
; 16: subu ${{[0-9]+}}, ${{[0-9]+}}, ${{[0-9]+}}
|
|
; 16: subu ${{[0-9]+}}, ${{[0-9]+}}, ${{[0-9]+}}
|
|
store i64 %sub, i64* @l, align 8
|
|
ret void
|
|
}
|
|
|
|
define void @test3() nounwind {
|
|
entry:
|
|
%0 = load i64, i64* @ii, align 8
|
|
%add = add nsw i64 %0, 15
|
|
; 16: addiu ${{[0-9]+}}, 15
|
|
; 16: sltu ${{[0-9]+}}, ${{[0-9]+}}
|
|
; 16: move ${{[0-9]+}}, $24
|
|
; 16: addu ${{[0-9]+}}, ${{[0-9]+}}, ${{[0-9]+}}
|
|
store i64 %add, i64* @m, align 8
|
|
ret void
|
|
}
|
|
|
|
|