Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/torch/luajit-rocks.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'src/lj_ircall.h')
-rw-r--r--src/lj_ircall.h80
1 files changed, 51 insertions, 29 deletions
diff --git a/src/lj_ircall.h b/src/lj_ircall.h
index 84e41ec..973c36e 100644
--- a/src/lj_ircall.h
+++ b/src/lj_ircall.h
@@ -1,6 +1,6 @@
/*
** IR CALL* instruction definitions.
-** Copyright (C) 2005-2015 Mike Pall. See Copyright Notice in luajit.h
+** Copyright (C) 2005-2017 Mike Pall. See Copyright Notice in luajit.h
*/
#ifndef _LJ_IRCALL_H
@@ -78,7 +78,13 @@ typedef struct CCallInfo {
#define IRCALLCOND_SOFTFP_FFI(x) NULL
#endif
-#define LJ_NEED_FP64 (LJ_TARGET_ARM || LJ_TARGET_PPC || LJ_TARGET_MIPS)
+#if LJ_SOFTFP && LJ_TARGET_MIPS32
+#define IRCALLCOND_SOFTFP_MIPS(x) x
+#else
+#define IRCALLCOND_SOFTFP_MIPS(x) NULL
+#endif
+
+#define LJ_NEED_FP64 (LJ_TARGET_ARM || LJ_TARGET_PPC || LJ_TARGET_MIPS32)
#if LJ_HASFFI && (LJ_SOFTFP || LJ_NEED_FP64)
#define IRCALLCOND_FP64_FFI(x) x
@@ -98,12 +104,6 @@ typedef struct CCallInfo {
#define IRCALLCOND_FFI32(x) NULL
#endif
-#if LJ_TARGET_X86
-#define CCI_RANDFPR 0 /* Clang on OSX/x86 is overzealous. */
-#else
-#define CCI_RANDFPR CCI_NOFPRCLOBBER
-#endif
-
#if LJ_SOFTFP
#define XA_FP CCI_XA
#define XA2_FP (CCI_XA+CCI_XA)
@@ -123,40 +123,40 @@ typedef struct CCallInfo {
/* Function definitions for CALL* instructions. */
#define IRCALLDEF(_) \
_(ANY, lj_str_cmp, 2, FN, INT, CCI_NOFPRCLOBBER) \
- _(ANY, lj_str_find, 4, N, P32, 0) \
+ _(ANY, lj_str_find, 4, N, PGC, 0) \
_(ANY, lj_str_new, 3, S, STR, CCI_L) \
_(ANY, lj_strscan_num, 2, FN, INT, 0) \
_(ANY, lj_strfmt_int, 2, FN, STR, CCI_L) \
_(ANY, lj_strfmt_num, 2, FN, STR, CCI_L) \
_(ANY, lj_strfmt_char, 2, FN, STR, CCI_L) \
- _(ANY, lj_strfmt_putint, 2, FL, P32, 0) \
- _(ANY, lj_strfmt_putnum, 2, FL, P32, 0) \
- _(ANY, lj_strfmt_putquoted, 2, FL, P32, 0) \
- _(ANY, lj_strfmt_putfxint, 3, L, P32, XA_64) \
- _(ANY, lj_strfmt_putfnum_int, 3, L, P32, XA_FP) \
- _(ANY, lj_strfmt_putfnum_uint, 3, L, P32, XA_FP) \
- _(ANY, lj_strfmt_putfnum, 3, L, P32, XA_FP) \
- _(ANY, lj_strfmt_putfstr, 3, L, P32, 0) \
- _(ANY, lj_strfmt_putfchar, 3, L, P32, 0) \
- _(ANY, lj_buf_putmem, 3, S, P32, 0) \
- _(ANY, lj_buf_putstr, 2, FL, P32, 0) \
- _(ANY, lj_buf_putchar, 2, FL, P32, 0) \
- _(ANY, lj_buf_putstr_reverse, 2, FL, P32, 0) \
- _(ANY, lj_buf_putstr_lower, 2, FL, P32, 0) \
- _(ANY, lj_buf_putstr_upper, 2, FL, P32, 0) \
- _(ANY, lj_buf_putstr_rep, 3, L, P32, 0) \
- _(ANY, lj_buf_puttab, 5, L, P32, 0) \
+ _(ANY, lj_strfmt_putint, 2, FL, PGC, 0) \
+ _(ANY, lj_strfmt_putnum, 2, FL, PGC, 0) \
+ _(ANY, lj_strfmt_putquoted, 2, FL, PGC, 0) \
+ _(ANY, lj_strfmt_putfxint, 3, L, PGC, XA_64) \
+ _(ANY, lj_strfmt_putfnum_int, 3, L, PGC, XA_FP) \
+ _(ANY, lj_strfmt_putfnum_uint, 3, L, PGC, XA_FP) \
+ _(ANY, lj_strfmt_putfnum, 3, L, PGC, XA_FP) \
+ _(ANY, lj_strfmt_putfstr, 3, L, PGC, 0) \
+ _(ANY, lj_strfmt_putfchar, 3, L, PGC, 0) \
+ _(ANY, lj_buf_putmem, 3, S, PGC, 0) \
+ _(ANY, lj_buf_putstr, 2, FL, PGC, 0) \
+ _(ANY, lj_buf_putchar, 2, FL, PGC, 0) \
+ _(ANY, lj_buf_putstr_reverse, 2, FL, PGC, 0) \
+ _(ANY, lj_buf_putstr_lower, 2, FL, PGC, 0) \
+ _(ANY, lj_buf_putstr_upper, 2, FL, PGC, 0) \
+ _(ANY, lj_buf_putstr_rep, 3, L, PGC, 0) \
+ _(ANY, lj_buf_puttab, 5, L, PGC, 0) \
_(ANY, lj_buf_tostr, 1, FL, STR, 0) \
_(ANY, lj_tab_new_ah, 3, A, TAB, CCI_L) \
_(ANY, lj_tab_new1, 2, FS, TAB, CCI_L) \
_(ANY, lj_tab_dup, 2, FS, TAB, CCI_L) \
_(ANY, lj_tab_clear, 1, FS, NIL, 0) \
- _(ANY, lj_tab_newkey, 3, S, P32, CCI_L) \
+ _(ANY, lj_tab_newkey, 3, S, PGC, CCI_L) \
_(ANY, lj_tab_len, 1, FL, INT, 0) \
_(ANY, lj_gc_step_jit, 2, FS, NIL, CCI_L) \
_(ANY, lj_gc_barrieruv, 2, FS, NIL, 0) \
- _(ANY, lj_mem_newgco, 2, FS, P32, CCI_L) \
- _(ANY, lj_math_random_step, 1, FS, NUM, CCI_CASTU64|CCI_RANDFPR)\
+ _(ANY, lj_mem_newgco, 2, FS, PGC, CCI_L) \
+ _(ANY, lj_math_random_step, 1, FS, NUM, CCI_CASTU64) \
_(ANY, lj_vm_modi, 2, FN, INT, 0) \
_(ANY, sinh, 1, N, NUM, XA_FP) \
_(ANY, cosh, 1, N, NUM, XA_FP) \
@@ -189,6 +189,8 @@ typedef struct CCallInfo {
_(SOFTFP, softfp_cmp, 4, N, NIL, 0) \
_(SOFTFP, softfp_i2d, 1, N, NUM, 0) \
_(SOFTFP, softfp_d2i, 2, N, INT, 0) \
+ _(SOFTFP_MIPS, lj_vm_sfmin, 4, N, NUM, 0) \
+ _(SOFTFP_MIPS, lj_vm_sfmax, 4, N, NUM, 0) \
_(SOFTFP_FFI, softfp_ui2d, 1, N, NUM, 0) \
_(SOFTFP_FFI, softfp_f2d, 1, N, NUM, 0) \
_(SOFTFP_FFI, softfp_d2ui, 2, N, INT, 0) \
@@ -270,6 +272,22 @@ LJ_DATA const CCallInfo lj_ir_callinfo[IRCALL__MAX+1];
#define fp64_f2l __aeabi_f2lz
#define fp64_f2ul __aeabi_f2ulz
#endif
+#elif LJ_TARGET_MIPS
+#define softfp_add __adddf3
+#define softfp_sub __subdf3
+#define softfp_mul __muldf3
+#define softfp_div __divdf3
+#define softfp_cmp __ledf2
+#define softfp_i2d __floatsidf
+#define softfp_d2i __fixdfsi
+#define softfp_ui2d __floatunsidf
+#define softfp_f2d __extendsfdf2
+#define softfp_d2ui __fixunsdfsi
+#define softfp_d2f __truncdfsf2
+#define softfp_i2f __floatsisf
+#define softfp_ui2f __floatunsisf
+#define softfp_f2i __fixsfsi
+#define softfp_f2ui __fixunssfsi
#else
#error "Missing soft-float definitions for target architecture"
#endif
@@ -290,6 +308,10 @@ extern float softfp_ui2f(uint32_t a);
extern int32_t softfp_f2i(float a);
extern uint32_t softfp_f2ui(float a);
#endif
+#if LJ_TARGET_MIPS
+extern double lj_vm_sfmin(double a, double b);
+extern double lj_vm_sfmax(double a, double b);
+#endif
#endif
#if LJ_HASFFI && LJ_NEED_FP64 && !(LJ_TARGET_ARM && LJ_SOFTFP)