1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-24 03:33:20 +01:00

Add substarget feature for FP16

llvm-svn: 98503
This commit is contained in:
Anton Korobeynikov 2010-03-14 18:42:38 +00:00
parent 48357cdc62
commit 90fcfccc91
4 changed files with 10 additions and 1 deletions

View File

@ -40,6 +40,8 @@ def FeatureNEON : SubtargetFeature<"neon", "ARMFPUType", "NEON",
"Enable NEON instructions">; "Enable NEON instructions">;
def FeatureThumb2 : SubtargetFeature<"thumb2", "ThumbMode", "Thumb2", def FeatureThumb2 : SubtargetFeature<"thumb2", "ThumbMode", "Thumb2",
"Enable Thumb2 instructions">; "Enable Thumb2 instructions">;
def FeatureFP16 : SubtargetFeature<"fp16", "HasFP16", "true",
"Enable half-precision floating point">;
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
// ARM Processors supported. // ARM Processors supported.

View File

@ -436,7 +436,7 @@ ARMTargetLowering::ARMTargetLowering(TargetMachine &TM)
setOperationAction(ISD::FP_TO_SINT, MVT::i32, Custom); setOperationAction(ISD::FP_TO_SINT, MVT::i32, Custom);
} }
// Special handling for half-precision FP. // Special handling for half-precision FP.
if (Subtarget->hasVFP3()) { if (Subtarget->hasVFP3() && Subtarget->hasFP16()) {
setOperationAction(ISD::FP16_TO_FP32, MVT::f32, Custom); setOperationAction(ISD::FP16_TO_FP32, MVT::f32, Custom);
setOperationAction(ISD::FP32_TO_FP16, MVT::i32, Custom); setOperationAction(ISD::FP32_TO_FP16, MVT::i32, Custom);
} }

View File

@ -41,6 +41,7 @@ ARMSubtarget::ARMSubtarget(const std::string &TT, const std::string &FS,
, PostRAScheduler(false) , PostRAScheduler(false)
, IsR9Reserved(ReserveR9) , IsR9Reserved(ReserveR9)
, UseMovt(UseMOVT) , UseMovt(UseMOVT)
, HasFP16(false)
, stackAlignment(4) , stackAlignment(4)
, CPUString("generic") , CPUString("generic")
, TargetType(isELF) // Default to ELF unless otherwise specified. , TargetType(isELF) // Default to ELF unless otherwise specified.

View File

@ -66,6 +66,10 @@ protected:
/// imms (including global addresses). /// imms (including global addresses).
bool UseMovt; bool UseMovt;
/// HasFP16 - True if subtarget supports half-precision FP (We support VFP+HF
/// only so far)
bool HasFP16;
/// stackAlignment - The minimum alignment known to hold of the stack frame on /// stackAlignment - The minimum alignment known to hold of the stack frame on
/// entry to the function and which must be maintained by every function. /// entry to the function and which must be maintained by every function.
unsigned stackAlignment; unsigned stackAlignment;
@ -116,6 +120,8 @@ protected:
bool useNEONForSinglePrecisionFP() const { bool useNEONForSinglePrecisionFP() const {
return hasNEON() && UseNEONForSinglePrecisionFP; } return hasNEON() && UseNEONForSinglePrecisionFP; }
bool hasFP16() const { return HasFP16; }
bool isTargetDarwin() const { return TargetType == isDarwin; } bool isTargetDarwin() const { return TargetType == isDarwin; }
bool isTargetELF() const { return TargetType == isELF; } bool isTargetELF() const { return TargetType == isELF; }