[pypy-commit] pypy arm-backend-2: get rid of the hack to detect the hard float calling convention and use a gcc preprocessor symbol
bivab
noreply at buildbot.pypy.org
Sat Jul 21 22:41:26 CEST 2012
Author: David Schneider <david.schneider at picle.org>
Branch: arm-backend-2
Changeset: r56383:3d37fbe666b7
Date: 2012-07-21 22:40 +0200
http://bitbucket.org/pypy/pypy/changeset/3d37fbe666b7/
Log: get rid of the hack to detect the hard float calling convention and
use a gcc preprocessor symbol
diff --git a/pypy/jit/backend/arm/detect.py b/pypy/jit/backend/arm/detect.py
--- a/pypy/jit/backend/arm/detect.py
+++ b/pypy/jit/backend/arm/detect.py
@@ -3,72 +3,6 @@
from pypy.rpython.tool import rffi_platform
from pypy.translator.platform import CompilationError
-class Exec(rffi_platform.CConfigEntry):
- """An entry in a CConfig class that stands for an integer result of a call.
- """
- def __init__(self, call):
- self.call = call
-
- def prepare_code(self):
- yield 'long int result = %s;' % (self.call,)
- yield 'if ((result) <= 0) {'
- yield ' long long x = (long long)(result);'
- yield ' printf("value: %lld\\n", x);'
- yield '} else {'
- yield ' unsigned long long x = (unsigned long long)(result);'
- yield ' printf("value: %llu\\n", x);'
- yield '}'
-
- def build_result(self, info, config_result):
- return rffi_platform.expose_value_as_rpython(info['value'])
-
-
-hard_float_check = """
-// HACK HACK HACK
-// We need to make sure we do not optimize too much of the code
-// below we need that check is called in the original version without constant
-// propagation or anything that could affect the order and number of the
-// arguments passed to it
-// For the same reason we call pypy__arm_hard_float_check using a function
-// pointer instead of calling it directly
-
-int pypy__arm_hard_float_check(int a, float b, int c) __attribute__((optimize("O0")));
-long int pypy__arm_is_hf(void) __attribute__((optimize("O0")));
-
-int pypy__arm_hard_float_check(int a, float b, int c)
-{
- int reg_value;
- // get the value that is in the second GPR when we enter the call
- asm volatile("mov %[result], r1"
- : [result]"=l" (reg_value) : : );
- assert(a == 1);
- assert(b == 2.0);
- assert(c == 3);
- /* if reg_value is 3, then we are using hard
- floats, because the third argument to this call was stored in the
- second core register;*/
- return reg_value == 3;
-}
-
-long int pypy__arm_is_hf(void)
-{
- int (*f)(int, float, int);
- // trash argument registers, just in case
- asm volatile("movw r0, #65535\\n\\t"
- "movw r1, #65535\\n\\t"
- "movw r2, #65535\\n\\t");
- f = &pypy__arm_hard_float_check;
- return f(1, 2.0, 3);
-}
- """
-class CConfig:
- _compilation_info_ = ExternalCompilationInfo(
- includes=['assert.h'],
- post_include_bits=[hard_float_check])
-
- hard_float = Exec('pypy__arm_is_hf()')
-
-
eci = ExternalCompilationInfo(
post_include_bits=["""
// we need to disable optimizations so the compiler does not remove this
@@ -79,10 +13,11 @@
}
"""])
-hard_float = rffi_platform.configure(CConfig)['hard_float']
-
def detect_hardfloat():
- return hard_float
+ # http://gcc.gnu.org/ml/gcc-patches/2010-10/msg02419.html
+ if rffi_platform.getdefined('__ARM_PCS_VFP', ''):
+ return rffi_platform.getconstantinteger('__ARM_PCS_VFP', '')
+ return False
def detect_float():
"""Check for hardware float support
More information about the pypy-commit
mailing list