gcc define __ARM_PCS_VFP for -mfloat-abi=hard, use it to detect armhf builds.

Signed-off-by: Xerxes Rånby <xerxes@zafena.se>
This commit is contained in:
Xerxes Rånby 2012-10-01 13:39:18 +02:00
parent 1d4c9d32fb
commit 2a15201b18
3 changed files with 14 additions and 4 deletions

View File

@ -57,7 +57,7 @@ LOCAL(loop):
// setup argument registers if necessary // setup argument registers if necessary
tst r6, r6 tst r6, r6
ldmneia r6, {r0-r3} ldmneia r6, {r0-r3}
#if defined(__VFP_FP__) && (! defined(__SOFTFP__)) && (! defined(__QNX__)) #if defined(__ARM_PCS_VFP)
// and VFP registers // and VFP registers
vldmia r7, {d0-d7} vldmia r7, {d0-d7}
#endif #endif
@ -70,7 +70,7 @@ LOCAL(loop):
#endif #endif
add sp, sp, r5 // deallocate stack add sp, sp, r5 // deallocate stack
#if defined(__VFP_FP__) && (! defined(__SOFTFP__)) && (! defined(__QNX__)) #if defined(__ARM_PCS_VFP)
cmp r8,#FLOAT_TYPE cmp r8,#FLOAT_TYPE
bne LOCAL(double) bne LOCAL(double)
fmrs r0,s0 fmrs r0,s0

View File

@ -245,7 +245,17 @@ inline int bpl(int offset) { return SETCOND(b(offset), PL); }
inline int fmstat() { return fmrx(15, FPSCR); } inline int fmstat() { return fmrx(15, FPSCR); }
// HARDWARE FLAGS // HARDWARE FLAGS
bool vfpSupported() { bool vfpSupported() {
return true; // TODO // TODO: Use at runtime detection
#if defined(__ARM_PCS_VFP)
// armhf
return true;
#else
// armel
// TODO: allow VFP use for -mfloat-abi=softfp armel builds.
// GCC -mfloat-abi=softfp flag allows use of VFP while remaining compatible
// with soft-float code.
return false;
#endif
} }
} }

View File

@ -163,7 +163,7 @@ dynamicCall(void* function, uintptr_t* arguments, uint8_t* argumentTypes,
for (unsigned ati = 0; ati < argumentCount; ++ ati) { for (unsigned ati = 0; ati < argumentCount; ++ ati) {
switch (argumentTypes[ati]) { switch (argumentTypes[ati]) {
case DOUBLE_TYPE: case DOUBLE_TYPE:
#if (defined(__VFP_FP__) && !defined(__SOFTFP__)) && !defined(__QNX__) #if defined(__ARM_PCS_VFP)
{ {
if (vfpIndex + Alignment <= VfpCount) { if (vfpIndex + Alignment <= VfpCount) {
if (vfpIndex % Alignment) { if (vfpIndex % Alignment) {