summaryrefslogtreecommitdiff
path: root/src/lj_ircall.h
diff options
context:
space:
mode:
authorMike Pall <mike>2011-10-22 01:59:10 +0200
committerMike Pall <mike>2011-10-22 01:59:10 +0200
commitc805a49d304c344d69630a4282d21d753c70e1bd (patch)
treecb3aa44be781e82fcca3c9a82ccbe48176cba109 /src/lj_ircall.h
parentff7f7a7180d25da9d425671a48867b50bb7e7ac2 (diff)
downloadluajit2-c805a49d304c344d69630a4282d21d753c70e1bd.tar.gz
Separate/rename NUM/FLOAT <-> I64/U64 conversion functions.
Diffstat (limited to 'src/lj_ircall.h')
-rw-r--r--src/lj_ircall.h88
1 files changed, 58 insertions, 30 deletions
diff --git a/src/lj_ircall.h b/src/lj_ircall.h
index 00209d4c..b1e0e446 100644
--- a/src/lj_ircall.h
+++ b/src/lj_ircall.h
@@ -58,6 +58,14 @@ typedef struct CCallInfo {
#define IRCALLCOND_SOFTFP_FFI(x) NULL
#endif
+#define LJ_NEED_FP64 LJ_TARGET_PPC
+
+#if LJ_HASFFI && (LJ_SOFTFP || LJ_NEED_FP64)
+#define IRCALLCOND_FP64_FFI(x) x
+#else
+#define IRCALLCOND_FP64_FFI(x) NULL
+#endif
+
#if LJ_HASFFI
#define IRCALLCOND_FFI(x) x
#if LJ_32
@@ -130,21 +138,21 @@ typedef struct CCallInfo {
_(SOFTFP, softfp_i2d, 1, N, NUM, 0) \
_(SOFTFP, softfp_d2i, 2, N, INT, 0) \
_(SOFTFP_FFI, softfp_ui2d, 1, N, NUM, 0) \
- _(SOFTFP_FFI, softfp_l2d, 2, N, NUM, 0) \
- _(SOFTFP_FFI, softfp_ul2d, 2, N, NUM, 0) \
_(SOFTFP_FFI, softfp_f2d, 1, N, NUM, 0) \
_(SOFTFP_FFI, softfp_d2ui, 2, N, INT, 0) \
- _(SOFTFP_FFI, softfp_d2l, 2, N, I64, 0) \
- _(SOFTFP_FFI, softfp_d2ul, 2, N, U64, 0) \
_(SOFTFP_FFI, softfp_d2f, 2, N, FLOAT, 0) \
_(SOFTFP_FFI, softfp_i2f, 1, N, FLOAT, 0) \
_(SOFTFP_FFI, softfp_ui2f, 1, N, FLOAT, 0) \
- _(SOFTFP_FFI, softfp_l2f, 2, N, FLOAT, 0) \
- _(SOFTFP_FFI, softfp_ul2f, 2, N, FLOAT, 0) \
_(SOFTFP_FFI, softfp_f2i, 1, N, INT, 0) \
_(SOFTFP_FFI, softfp_f2ui, 1, N, INT, 0) \
- _(SOFTFP_FFI, softfp_f2l, 1, N, I64, 0) \
- _(SOFTFP_FFI, softfp_f2ul, 1, N, U64, 0) \
+ _(FP64_FFI, fp64_l2d, 2, N, NUM, 0) \
+ _(FP64_FFI, fp64_ul2d, 2, N, NUM, 0) \
+ _(FP64_FFI, fp64_l2f, 2, N, FLOAT, 0) \
+ _(FP64_FFI, fp64_ul2f, 2, N, FLOAT, 0) \
+ _(FP64_FFI, fp64_d2l, 2, N, I64, 0) \
+ _(FP64_FFI, fp64_d2ul, 2, N, U64, 0) \
+ _(FP64_FFI, fp64_f2l, 1, N, I64, 0) \
+ _(FP64_FFI, fp64_f2ul, 1, N, U64, 0) \
_(FFI, lj_carith_divi64, ARG2_64, N, I64, CCI_NOFPRCLOBBER) \
_(FFI, lj_carith_divu64, ARG2_64, N, U64, CCI_NOFPRCLOBBER) \
_(FFI, lj_carith_modi64, ARG2_64, N, I64, CCI_NOFPRCLOBBER) \
@@ -179,29 +187,29 @@ LJ_DATA const CCallInfo lj_ir_callinfo[IRCALL__MAX+1];
#define softfp_div __aeabi_ddiv
#define softfp_cmp __aeabi_cdcmple
#define softfp_i2d __aeabi_i2d
+#define softfp_d2i __aeabi_d2iz
#define softfp_ui2d __aeabi_ui2d
-#define softfp_l2d __aeabi_l2d
-#define softfp_ul2d __aeabi_ul2d
#define softfp_f2d __aeabi_f2d
-#define softfp_d2i __aeabi_d2iz
#define softfp_d2ui __aeabi_d2uiz
#define softfp_d2f __aeabi_d2f
#define softfp_i2f __aeabi_i2f
#define softfp_ui2f __aeabi_ui2f
-#define softfp_l2f __aeabi_l2f
-#define softfp_ul2f __aeabi_ul2f
#define softfp_f2i __aeabi_f2iz
#define softfp_f2ui __aeabi_f2uiz
+#define fp64_l2d __aeabi_l2d
+#define fp64_ul2d __aeabi_ul2d
+#define fp64_l2f __aeabi_l2f
+#define fp64_ul2f __aeabi_ul2f
#if LJ_TARGET_OSX
-#define softfp_d2l __fixdfdi
-#define softfp_d2ul __fixunsdfdi
-#define softfp_f2l __fixsfdi
-#define softfp_f2ul __fixunssfdi
+#define fp64_d2l __fixdfdi
+#define fp64_d2ul __fixunsdfdi
+#define fp64_f2l __fixsfdi
+#define fp64_f2ul __fixunssfdi
#else
-#define softfp_d2l __aeabi_d2lz
-#define softfp_d2ul __aeabi_d2ulz
-#define softfp_f2l __aeabi_f2lz
-#define softfp_f2ul __aeabi_f2ulz
+#define fp64_d2l __aeabi_d2lz
+#define fp64_d2ul __aeabi_d2ulz
+#define fp64_f2l __aeabi_f2lz
+#define fp64_f2ul __aeabi_f2ulz
#endif
#else
#error "Missing soft-float definitions for target architecture"
@@ -212,23 +220,43 @@ extern double softfp_mul(double a, double b);
extern double softfp_div(double a, double b);
extern void softfp_cmp(double a, double b);
extern double softfp_i2d(int32_t a);
+extern int32_t softfp_d2i(double a);
+#if LJ_HASFFI
extern double softfp_ui2d(uint32_t a);
-extern double softfp_l2d(int64_t a);
-extern double softfp_ul2d(uint64_t a);
extern double softfp_f2d(float a);
-extern int32_t softfp_d2i(double a);
extern uint32_t softfp_d2ui(double a);
-extern int64_t softfp_d2l(double a);
-extern uint64_t softfp_d2ul(double a);
extern float softfp_d2f(double a);
extern float softfp_i2f(int32_t a);
extern float softfp_ui2f(uint32_t a);
-extern float softfp_l2f(int64_t a);
-extern float softfp_ul2f(uint64_t a);
extern int32_t softfp_f2i(float a);
extern uint32_t softfp_f2ui(float a);
-extern int64_t softfp_f2l(float a);
-extern uint64_t softfp_f2ul(float a);
+#endif
+#endif
+
+#if LJ_HASFFI && LJ_NEED_FP64
+#ifdef __GNUC__
+#define fp64_l2d __floatdidf
+#define fp64_ul2d __floatundidf
+#define fp64_l2f __floatdisf
+#define fp64_ul2f __floatundisf
+#define fp64_d2l __fixdfdi
+#define fp64_d2ul __fixunsdfdi
+#define fp64_f2l __fixsfdi
+#define fp64_f2ul __fixunssfdi
+#else
+#error "Missing fp64 helper definitions for this compiler"
+#endif
+#endif
+
+#if LJ_HASFFI && (LJ_SOFTFP || LJ_NEED_FP64)
+extern double fp64_l2d(int64_t a);
+extern double fp64_ul2d(uint64_t a);
+extern float fp64_l2f(int64_t a);
+extern float fp64_ul2f(uint64_t a);
+extern int64_t fp64_d2l(double a);
+extern uint64_t fp64_d2ul(double a);
+extern int64_t fp64_f2l(float a);
+extern uint64_t fp64_f2ul(float a);
#endif
#endif