mirror of
https://github.com/RPCS3/llvm.git
synced 2025-04-02 21:31:41 +00:00
PR8359: The ARM backend may end up allocating registers D16 to D31 when
"-mattr=+vfp3" is specified. However, this will not work for hardware that only supports 16 registers. Add a new flag to support -"mattr=+vfp3,+d16". Patch by Jan Voung! git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@116310 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
1541877941
commit
77f42b5278
@ -33,6 +33,8 @@ def FeatureNoARM : SubtargetFeature<"noarm", "NoARM", "true",
|
|||||||
"Does not support ARM mode execution">;
|
"Does not support ARM mode execution">;
|
||||||
def FeatureFP16 : SubtargetFeature<"fp16", "HasFP16", "true",
|
def FeatureFP16 : SubtargetFeature<"fp16", "HasFP16", "true",
|
||||||
"Enable half-precision floating point">;
|
"Enable half-precision floating point">;
|
||||||
|
def FeatureD16 : SubtargetFeature<"d16", "HasD16", "true",
|
||||||
|
"Restrict VFP3 to 16 double registers">;
|
||||||
def FeatureHWDiv : SubtargetFeature<"hwdiv", "HasHardwareDivide", "true",
|
def FeatureHWDiv : SubtargetFeature<"hwdiv", "HasHardwareDivide", "true",
|
||||||
"Enable divide instructions">;
|
"Enable divide instructions">;
|
||||||
def FeatureT2XtPk : SubtargetFeature<"t2xtpk", "HasT2ExtractPack", "true",
|
def FeatureT2XtPk : SubtargetFeature<"t2xtpk", "HasT2ExtractPack", "true",
|
||||||
|
@ -381,7 +381,7 @@ def DPR : RegisterClass<"ARM", [f64, v8i8, v4i16, v2i32, v1i64, v2f32], 64,
|
|||||||
iterator allocation_order_end(const MachineFunction &MF) const;
|
iterator allocation_order_end(const MachineFunction &MF) const;
|
||||||
}];
|
}];
|
||||||
let MethodBodies = [{
|
let MethodBodies = [{
|
||||||
// VFP2
|
// VFP2 / VFPv3-D16
|
||||||
static const unsigned ARM_DPR_VFP2[] = {
|
static const unsigned ARM_DPR_VFP2[] = {
|
||||||
ARM::D0, ARM::D1, ARM::D2, ARM::D3,
|
ARM::D0, ARM::D1, ARM::D2, ARM::D3,
|
||||||
ARM::D4, ARM::D5, ARM::D6, ARM::D7,
|
ARM::D4, ARM::D5, ARM::D6, ARM::D7,
|
||||||
@ -403,7 +403,7 @@ def DPR : RegisterClass<"ARM", [f64, v8i8, v4i16, v2i32, v1i64, v2f32], 64,
|
|||||||
DPRClass::allocation_order_begin(const MachineFunction &MF) const {
|
DPRClass::allocation_order_begin(const MachineFunction &MF) const {
|
||||||
const TargetMachine &TM = MF.getTarget();
|
const TargetMachine &TM = MF.getTarget();
|
||||||
const ARMSubtarget &Subtarget = TM.getSubtarget<ARMSubtarget>();
|
const ARMSubtarget &Subtarget = TM.getSubtarget<ARMSubtarget>();
|
||||||
if (Subtarget.hasVFP3())
|
if (Subtarget.hasVFP3() && !Subtarget.hasD16())
|
||||||
return ARM_DPR_VFP3;
|
return ARM_DPR_VFP3;
|
||||||
return ARM_DPR_VFP2;
|
return ARM_DPR_VFP2;
|
||||||
}
|
}
|
||||||
@ -412,7 +412,7 @@ def DPR : RegisterClass<"ARM", [f64, v8i8, v4i16, v2i32, v1i64, v2f32], 64,
|
|||||||
DPRClass::allocation_order_end(const MachineFunction &MF) const {
|
DPRClass::allocation_order_end(const MachineFunction &MF) const {
|
||||||
const TargetMachine &TM = MF.getTarget();
|
const TargetMachine &TM = MF.getTarget();
|
||||||
const ARMSubtarget &Subtarget = TM.getSubtarget<ARMSubtarget>();
|
const ARMSubtarget &Subtarget = TM.getSubtarget<ARMSubtarget>();
|
||||||
if (Subtarget.hasVFP3())
|
if (Subtarget.hasVFP3() && !Subtarget.hasD16())
|
||||||
return ARM_DPR_VFP3 + (sizeof(ARM_DPR_VFP3)/sizeof(unsigned));
|
return ARM_DPR_VFP3 + (sizeof(ARM_DPR_VFP3)/sizeof(unsigned));
|
||||||
else
|
else
|
||||||
return ARM_DPR_VFP2 + (sizeof(ARM_DPR_VFP2)/sizeof(unsigned));
|
return ARM_DPR_VFP2 + (sizeof(ARM_DPR_VFP2)/sizeof(unsigned));
|
||||||
|
@ -46,6 +46,7 @@ ARMSubtarget::ARMSubtarget(const std::string &TT, const std::string &FS,
|
|||||||
, IsR9Reserved(ReserveR9)
|
, IsR9Reserved(ReserveR9)
|
||||||
, UseMovt(UseMOVT)
|
, UseMovt(UseMOVT)
|
||||||
, HasFP16(false)
|
, HasFP16(false)
|
||||||
|
, HasD16(false)
|
||||||
, HasHardwareDivide(false)
|
, HasHardwareDivide(false)
|
||||||
, HasT2ExtractPack(false)
|
, HasT2ExtractPack(false)
|
||||||
, HasDataBarrier(false)
|
, HasDataBarrier(false)
|
||||||
|
@ -87,6 +87,10 @@ protected:
|
|||||||
/// only so far)
|
/// only so far)
|
||||||
bool HasFP16;
|
bool HasFP16;
|
||||||
|
|
||||||
|
/// HasD16 - True if subtarget is limited to 16 double precision
|
||||||
|
/// FP registers for VFPv3.
|
||||||
|
bool HasD16;
|
||||||
|
|
||||||
/// HasHardwareDivide - True if subtarget supports [su]div
|
/// HasHardwareDivide - True if subtarget supports [su]div
|
||||||
bool HasHardwareDivide;
|
bool HasHardwareDivide;
|
||||||
|
|
||||||
@ -174,6 +178,7 @@ protected:
|
|||||||
bool prefers32BitThumb() const { return Pref32BitThumb; }
|
bool prefers32BitThumb() const { return Pref32BitThumb; }
|
||||||
|
|
||||||
bool hasFP16() const { return HasFP16; }
|
bool hasFP16() const { return HasFP16; }
|
||||||
|
bool hasD16() const { return HasD16; }
|
||||||
|
|
||||||
bool isTargetDarwin() const { return TargetType == isDarwin; }
|
bool isTargetDarwin() const { return TargetType == isDarwin; }
|
||||||
bool isTargetELF() const { return TargetType == isELF; }
|
bool isTargetELF() const { return TargetType == isELF; }
|
||||||
|
Loading…
x
Reference in New Issue
Block a user