mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-04-11 00:39:36 +00:00
[PowerPC] Implement some additional TLI callbacks
Add implementations of: bool isLegalICmpImmediate(int64_t Imm) const bool isLegalAddImmediate(int64_t Imm) const bool isTruncateFree(Type *Ty1, Type *Ty2) const bool isTruncateFree(EVT VT1, EVT VT2) const bool shouldConvertConstantLoadToIntImm(const APInt &Imm, Type *Ty) const Unfortunately, this regresses counter-register-based loop formation because some of the loops now end up in forms were SE cannot compute loop counts. However, nevertheless, the test-suite results favor committing: SingleSource/Benchmarks/BenchmarkGame/puzzle: 26% speedup MultiSource/Benchmarks/FreeBench/analyzer/analyzer: 21% speedup MultiSource/Benchmarks/MiBench/automotive-susan/automotive-susan: 20% speedup SingleSource/Benchmarks/Polybench/linear-algebra/kernels/trisolv/trisolv: 19% speedup SingleSource/Benchmarks/Polybench/linear-algebra/kernels/gesummv/gesummv: 15% speedup MultiSource/Benchmarks/FreeBench/pcompress2/pcompress2: 2% speedup MultiSource/Benchmarks/VersaBench/bmm/bmm: 26% slowdown git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@206120 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
df40801dff
commit
f4c3a5601a
@ -8795,6 +8795,42 @@ EVT PPCTargetLowering::getOptimalMemOpType(uint64_t Size,
|
||||
}
|
||||
}
|
||||
|
||||
/// \brief Returns true if it is beneficial to convert a load of a constant
|
||||
/// to just the constant itself.
|
||||
bool PPCTargetLowering::shouldConvertConstantLoadToIntImm(const APInt &Imm,
|
||||
Type *Ty) const {
|
||||
assert(Ty->isIntegerTy());
|
||||
|
||||
unsigned BitSize = Ty->getPrimitiveSizeInBits();
|
||||
if (BitSize == 0 || BitSize > 64)
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
bool PPCTargetLowering::isTruncateFree(Type *Ty1, Type *Ty2) const {
|
||||
if (!Ty1->isIntegerTy() || !Ty2->isIntegerTy())
|
||||
return false;
|
||||
unsigned NumBits1 = Ty1->getPrimitiveSizeInBits();
|
||||
unsigned NumBits2 = Ty2->getPrimitiveSizeInBits();
|
||||
return NumBits1 == 64 && NumBits2 == 32;
|
||||
}
|
||||
|
||||
bool PPCTargetLowering::isTruncateFree(EVT VT1, EVT VT2) const {
|
||||
if (!VT1.isInteger() || !VT2.isInteger())
|
||||
return false;
|
||||
unsigned NumBits1 = VT1.getSizeInBits();
|
||||
unsigned NumBits2 = VT2.getSizeInBits();
|
||||
return NumBits1 == 64 && NumBits2 == 32;
|
||||
}
|
||||
|
||||
bool PPCTargetLowering::isLegalICmpImmediate(int64_t Imm) const {
|
||||
return isInt<16>(Imm) || isUInt<16>(Imm);
|
||||
}
|
||||
|
||||
bool PPCTargetLowering::isLegalAddImmediate(int64_t Imm) const {
|
||||
return isInt<16>(Imm) || isUInt<16>(Imm);
|
||||
}
|
||||
|
||||
bool PPCTargetLowering::allowsUnalignedMemoryAccesses(EVT VT,
|
||||
unsigned,
|
||||
bool *Fast) const {
|
||||
|
@ -447,6 +447,29 @@ namespace llvm {
|
||||
/// by AM is legal for this target, for a load/store of the specified type.
|
||||
virtual bool isLegalAddressingMode(const AddrMode &AM, Type *Ty)const;
|
||||
|
||||
/// isLegalICmpImmediate - Return true if the specified immediate is legal
|
||||
/// icmp immediate, that is the target has icmp instructions which can
|
||||
/// compare a register against the immediate without having to materialize
|
||||
/// the immediate into a register.
|
||||
bool isLegalICmpImmediate(int64_t Imm) const override;
|
||||
|
||||
/// isLegalAddImmediate - Return true if the specified immediate is legal
|
||||
/// add immediate, that is the target has add instructions which can
|
||||
/// add a register and the immediate without having to materialize
|
||||
/// the immediate into a register.
|
||||
bool isLegalAddImmediate(int64_t Imm) const override;
|
||||
|
||||
/// isTruncateFree - Return true if it's free to truncate a value of
|
||||
/// type Ty1 to type Ty2. e.g. On PPC it's free to truncate a i64 value in
|
||||
/// register X1 to i32 by referencing its sub-register R1.
|
||||
bool isTruncateFree(Type *Ty1, Type *Ty2) const override;
|
||||
bool isTruncateFree(EVT VT1, EVT VT2) const override;
|
||||
|
||||
/// \brief Returns true if it is beneficial to convert a load of a constant
|
||||
/// to just the constant itself.
|
||||
bool shouldConvertConstantLoadToIntImm(const APInt &Imm,
|
||||
Type *Ty) const override;
|
||||
|
||||
virtual bool isOffsetFoldingLegal(const GlobalAddressSDNode *GA) const;
|
||||
|
||||
/// getOptimalMemOpType - Returns the target specific optimal type for load
|
||||
|
@ -2,6 +2,9 @@ target datalayout = "E-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f3
|
||||
target triple = "powerpc64-unknown-linux-gnu"
|
||||
; RUN: llc < %s -march=ppc64 | FileCheck %s
|
||||
|
||||
; XFAIL: *
|
||||
; SE needs improvement
|
||||
|
||||
; CHECK: test_pos1_ir_sle
|
||||
; CHECK: bdnz
|
||||
; a < b
|
||||
|
@ -2,6 +2,9 @@ target datalayout = "E-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f3
|
||||
target triple = "powerpc64-unknown-linux-gnu"
|
||||
; RUN: llc < %s -march=ppc64 | FileCheck %s
|
||||
|
||||
; XFAIL: *
|
||||
; SE needs improvement
|
||||
|
||||
; CHECK: test_pos1_ir_slt
|
||||
; CHECK: bdnz
|
||||
; a < b
|
||||
|
@ -18,7 +18,8 @@ entry:
|
||||
|
||||
; CHECK-LABEL: test_fn_static:
|
||||
; CHECK: addis [[REG1:[0-9]+]], 2, [[VAR:[a-z0-9A-Z_.]+]]@toc@ha
|
||||
; CHECK: lwz {{[0-9]+}}, [[VAR]]@toc@l([[REG1]])
|
||||
; CHECK: lwa {{[0-9]+}}, [[VAR]]@toc@l([[REG1]])
|
||||
; CHECK-NOT: extsw
|
||||
; CHECK: stw {{[0-9]+}}, [[VAR]]@toc@l([[REG1]])
|
||||
; CHECK: .type [[VAR]],@object
|
||||
; CHECK: .local [[VAR]]
|
||||
|
@ -18,7 +18,8 @@ entry:
|
||||
|
||||
; CHECK-LABEL: test_file_static:
|
||||
; CHECK: addis [[REG1:[0-9]+]], 2, [[VAR:[a-z0-9A-Z_.]+]]@toc@ha
|
||||
; CHECK: lwz {{[0-9]+}}, [[VAR]]@toc@l([[REG1]])
|
||||
; CHECK: lwa {{[0-9]+}}, [[VAR]]@toc@l([[REG1]])
|
||||
; CHECK-NOT: extsw
|
||||
; CHECK: stw {{[0-9]+}}, [[VAR]]@toc@l([[REG1]])
|
||||
; CHECK: .type [[VAR]],@object
|
||||
; CHECK: .data
|
||||
|
@ -22,7 +22,7 @@ entry:
|
||||
; CHECK: Relocations [
|
||||
; CHECK: Section (2) .rela.text {
|
||||
; CHECK: 0x{{[0-9,A-F]+}} R_PPC64_TOC16_HA [[SYM2:[^ ]+]]
|
||||
; CHECK: 0x{{[0-9,A-F]+}} R_PPC64_TOC16_LO [[SYM2]]
|
||||
; CHECK: 0x{{[0-9,A-F]+}} R_PPC64_TOC16_LO_DS [[SYM2]]
|
||||
; CHECK: 0x{{[0-9,A-F]+}} R_PPC64_TOC16_LO [[SYM2]]
|
||||
|
||||
@gi = global i32 5, align 4
|
||||
@ -39,7 +39,7 @@ entry:
|
||||
; accessing file-scope variable gi.
|
||||
;
|
||||
; CHECK: 0x{{[0-9,A-F]+}} R_PPC64_TOC16_HA [[SYM3:[^ ]+]]
|
||||
; CHECK: 0x{{[0-9,A-F]+}} R_PPC64_TOC16_LO [[SYM3]]
|
||||
; CHECK: 0x{{[0-9,A-F]+}} R_PPC64_TOC16_LO_DS [[SYM3]]
|
||||
; CHECK: 0x{{[0-9,A-F]+}} R_PPC64_TOC16_LO [[SYM3]]
|
||||
|
||||
define double @test_double_const() nounwind {
|
||||
|
Loading…
x
Reference in New Issue
Block a user