aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Pall <mike>2020-05-22 04:53:35 +0200
committerMike Pall <mike>2020-05-22 04:53:35 +0200
commit5655be4546d9177890c69f0d0accac4773ff0887 (patch)
tree794518da2d5a42ec79013eda0c92f7f1e4e8d3ce
parentc5b8e9168bae3efb6eb0fe2d4c9466c57fa5f971 (diff)
downloadluajit-5655be4546d9177890c69f0d0accac4773ff0887.tar.gz
luajit-5655be4546d9177890c69f0d0accac4773ff0887.tar.bz2
luajit-5655be4546d9177890c69f0d0accac4773ff0887.zip
Cleanup math function compilation and fix inconsistencies.
-rw-r--r--src/lib_math.c22
-rw-r--r--src/lj_asm.c8
-rw-r--r--src/lj_asm_arm.h1
-rw-r--r--src/lj_asm_arm64.h1
-rw-r--r--src/lj_asm_mips.h1
-rw-r--r--src/lj_asm_ppc.h1
-rw-r--r--src/lj_asm_x86.h2
-rw-r--r--src/lj_ffrecord.c19
-rw-r--r--src/lj_ir.h4
-rw-r--r--src/lj_ircall.h14
-rw-r--r--src/lj_opt_fold.c25
-rw-r--r--src/lj_opt_split.c3
-rw-r--r--src/lj_target_x86.h6
-rw-r--r--src/lj_vmmath.c6
14 files changed, 48 insertions, 65 deletions
diff --git a/src/lib_math.c b/src/lib_math.c
index 02aa21d7..4cc2ba6e 100644
--- a/src/lib_math.c
+++ b/src/lib_math.c
@@ -33,17 +33,17 @@ LJLIB_ASM(math_sqrt) LJLIB_REC(math_unary IRFPM_SQRT)
33 lj_lib_checknum(L, 1); 33 lj_lib_checknum(L, 1);
34 return FFH_RETRY; 34 return FFH_RETRY;
35} 35}
36LJLIB_ASM_(math_log10) LJLIB_REC(math_unary IRFPM_LOG10) 36LJLIB_ASM_(math_log10) LJLIB_REC(math_call IRCALL_log10)
37LJLIB_ASM_(math_exp) LJLIB_REC(math_unary IRFPM_EXP) 37LJLIB_ASM_(math_exp) LJLIB_REC(math_call IRCALL_exp)
38LJLIB_ASM_(math_sin) LJLIB_REC(math_unary IRFPM_SIN) 38LJLIB_ASM_(math_sin) LJLIB_REC(math_call IRCALL_sin)
39LJLIB_ASM_(math_cos) LJLIB_REC(math_unary IRFPM_COS) 39LJLIB_ASM_(math_cos) LJLIB_REC(math_call IRCALL_cos)
40LJLIB_ASM_(math_tan) LJLIB_REC(math_unary IRFPM_TAN) 40LJLIB_ASM_(math_tan) LJLIB_REC(math_call IRCALL_tan)
41LJLIB_ASM_(math_asin) LJLIB_REC(math_atrig FF_math_asin) 41LJLIB_ASM_(math_asin) LJLIB_REC(math_call IRCALL_asin)
42LJLIB_ASM_(math_acos) LJLIB_REC(math_atrig FF_math_acos) 42LJLIB_ASM_(math_acos) LJLIB_REC(math_call IRCALL_acos)
43LJLIB_ASM_(math_atan) LJLIB_REC(math_atrig FF_math_atan) 43LJLIB_ASM_(math_atan) LJLIB_REC(math_call IRCALL_atan)
44LJLIB_ASM_(math_sinh) LJLIB_REC(math_htrig IRCALL_sinh) 44LJLIB_ASM_(math_sinh) LJLIB_REC(math_call IRCALL_sinh)
45LJLIB_ASM_(math_cosh) LJLIB_REC(math_htrig IRCALL_cosh) 45LJLIB_ASM_(math_cosh) LJLIB_REC(math_call IRCALL_cosh)
46LJLIB_ASM_(math_tanh) LJLIB_REC(math_htrig IRCALL_tanh) 46LJLIB_ASM_(math_tanh) LJLIB_REC(math_call IRCALL_tanh)
47LJLIB_ASM_(math_frexp) 47LJLIB_ASM_(math_frexp)
48LJLIB_ASM_(math_modf) 48LJLIB_ASM_(math_modf)
49 49
diff --git a/src/lj_asm.c b/src/lj_asm.c
index 68d28fb0..20d63731 100644
--- a/src/lj_asm.c
+++ b/src/lj_asm.c
@@ -1657,14 +1657,13 @@ static void asm_ir(ASMState *as, IRIns *ir)
1657 case IR_NEG: asm_neg(as, ir); break; 1657 case IR_NEG: asm_neg(as, ir); break;
1658#if LJ_SOFTFP32 1658#if LJ_SOFTFP32
1659 case IR_DIV: case IR_POW: case IR_ABS: 1659 case IR_DIV: case IR_POW: case IR_ABS:
1660 case IR_ATAN2: case IR_LDEXP: case IR_FPMATH: case IR_TOBIT: 1660 case IR_LDEXP: case IR_FPMATH: case IR_TOBIT:
1661 lua_assert(0); /* Unused for LJ_SOFTFP32. */ 1661 lua_assert(0); /* Unused for LJ_SOFTFP32. */
1662 break; 1662 break;
1663#else 1663#else
1664 case IR_DIV: asm_div(as, ir); break; 1664 case IR_DIV: asm_div(as, ir); break;
1665 case IR_POW: asm_pow(as, ir); break; 1665 case IR_POW: asm_pow(as, ir); break;
1666 case IR_ABS: asm_abs(as, ir); break; 1666 case IR_ABS: asm_abs(as, ir); break;
1667 case IR_ATAN2: asm_atan2(as, ir); break;
1668 case IR_LDEXP: asm_ldexp(as, ir); break; 1667 case IR_LDEXP: asm_ldexp(as, ir); break;
1669 case IR_FPMATH: asm_fpmath(as, ir); break; 1668 case IR_FPMATH: asm_fpmath(as, ir); break;
1670 case IR_TOBIT: asm_tobit(as, ir); break; 1669 case IR_TOBIT: asm_tobit(as, ir); break;
@@ -2158,11 +2157,6 @@ static void asm_setup_regsp(ASMState *as)
2158 as->modset = RSET_SCRATCH; 2157 as->modset = RSET_SCRATCH;
2159 break; 2158 break;
2160#if !LJ_SOFTFP 2159#if !LJ_SOFTFP
2161 case IR_ATAN2:
2162#if LJ_TARGET_X86
2163 if (as->evenspill < 4) /* Leave room to call atan2(). */
2164 as->evenspill = 4;
2165#endif
2166#if !LJ_TARGET_X86ORX64 2160#if !LJ_TARGET_X86ORX64
2167 case IR_LDEXP: 2161 case IR_LDEXP:
2168#endif 2162#endif
diff --git a/src/lj_asm_arm.h b/src/lj_asm_arm.h
index d2579349..ccb8ccb6 100644
--- a/src/lj_asm_arm.h
+++ b/src/lj_asm_arm.h
@@ -1510,7 +1510,6 @@ static void asm_mul(ASMState *as, IRIns *ir)
1510#define asm_div(as, ir) asm_fparith(as, ir, ARMI_VDIV_D) 1510#define asm_div(as, ir) asm_fparith(as, ir, ARMI_VDIV_D)
1511#define asm_pow(as, ir) asm_callid(as, ir, IRCALL_lj_vm_powi) 1511#define asm_pow(as, ir) asm_callid(as, ir, IRCALL_lj_vm_powi)
1512#define asm_abs(as, ir) asm_fpunary(as, ir, ARMI_VABS_D) 1512#define asm_abs(as, ir) asm_fpunary(as, ir, ARMI_VABS_D)
1513#define asm_atan2(as, ir) asm_callid(as, ir, IRCALL_atan2)
1514#define asm_ldexp(as, ir) asm_callid(as, ir, IRCALL_ldexp) 1513#define asm_ldexp(as, ir) asm_callid(as, ir, IRCALL_ldexp)
1515#endif 1514#endif
1516 1515
diff --git a/src/lj_asm_arm64.h b/src/lj_asm_arm64.h
index f640b91b..da857355 100644
--- a/src/lj_asm_arm64.h
+++ b/src/lj_asm_arm64.h
@@ -1455,7 +1455,6 @@ static void asm_pow(ASMState *as, IRIns *ir)
1455#define asm_mulov(as, ir) asm_mul(as, ir) 1455#define asm_mulov(as, ir) asm_mul(as, ir)
1456 1456
1457#define asm_abs(as, ir) asm_fpunary(as, ir, A64I_FABS) 1457#define asm_abs(as, ir) asm_fpunary(as, ir, A64I_FABS)
1458#define asm_atan2(as, ir) asm_callid(as, ir, IRCALL_atan2)
1459#define asm_ldexp(as, ir) asm_callid(as, ir, IRCALL_ldexp) 1458#define asm_ldexp(as, ir) asm_callid(as, ir, IRCALL_ldexp)
1460 1459
1461static void asm_mod(ASMState *as, IRIns *ir) 1460static void asm_mod(ASMState *as, IRIns *ir)
diff --git a/src/lj_asm_mips.h b/src/lj_asm_mips.h
index a242904e..8b5efc35 100644
--- a/src/lj_asm_mips.h
+++ b/src/lj_asm_mips.h
@@ -1838,7 +1838,6 @@ static void asm_abs(ASMState *as, IRIns *ir)
1838} 1838}
1839#endif 1839#endif
1840 1840
1841#define asm_atan2(as, ir) asm_callid(as, ir, IRCALL_atan2)
1842#define asm_ldexp(as, ir) asm_callid(as, ir, IRCALL_ldexp) 1841#define asm_ldexp(as, ir) asm_callid(as, ir, IRCALL_ldexp)
1843 1842
1844static void asm_arithov(ASMState *as, IRIns *ir) 1843static void asm_arithov(ASMState *as, IRIns *ir)
diff --git a/src/lj_asm_ppc.h b/src/lj_asm_ppc.h
index afcd6b7a..d9e4ad04 100644
--- a/src/lj_asm_ppc.h
+++ b/src/lj_asm_ppc.h
@@ -1387,7 +1387,6 @@ static void asm_neg(ASMState *as, IRIns *ir)
1387} 1387}
1388 1388
1389#define asm_abs(as, ir) asm_fpunary(as, ir, PPCI_FABS) 1389#define asm_abs(as, ir) asm_fpunary(as, ir, PPCI_FABS)
1390#define asm_atan2(as, ir) asm_callid(as, ir, IRCALL_atan2)
1391#define asm_ldexp(as, ir) asm_callid(as, ir, IRCALL_ldexp) 1390#define asm_ldexp(as, ir) asm_callid(as, ir, IRCALL_ldexp)
1392 1391
1393static void asm_arithov(ASMState *as, IRIns *ir, PPCIns pi) 1392static void asm_arithov(ASMState *as, IRIns *ir, PPCIns pi)
diff --git a/src/lj_asm_x86.h b/src/lj_asm_x86.h
index bf818f5a..d5cd6326 100644
--- a/src/lj_asm_x86.h
+++ b/src/lj_asm_x86.h
@@ -1957,8 +1957,6 @@ static void asm_fpmath(ASMState *as, IRIns *ir)
1957 } 1957 }
1958} 1958}
1959 1959
1960#define asm_atan2(as, ir) asm_callid(as, ir, IRCALL_atan2)
1961
1962static void asm_ldexp(ASMState *as, IRIns *ir) 1960static void asm_ldexp(ASMState *as, IRIns *ir)
1963{ 1961{
1964 int32_t ofs = sps_scale(ir->s); /* Use spill slot or temp slots. */ 1962 int32_t ofs = sps_scale(ir->s); /* Use spill slot or temp slots. */
diff --git a/src/lj_ffrecord.c b/src/lj_ffrecord.c
index 436d5037..42049511 100644
--- a/src/lj_ffrecord.c
+++ b/src/lj_ffrecord.c
@@ -563,7 +563,7 @@ static void LJ_FASTCALL recff_math_atan2(jit_State *J, RecordFFData *rd)
563{ 563{
564 TRef tr = lj_ir_tonum(J, J->base[0]); 564 TRef tr = lj_ir_tonum(J, J->base[0]);
565 TRef tr2 = lj_ir_tonum(J, J->base[1]); 565 TRef tr2 = lj_ir_tonum(J, J->base[1]);
566 J->base[0] = emitir(IRTN(IR_ATAN2), tr, tr2); 566 J->base[0] = lj_ir_call(J, IRCALL_atan2, tr, tr2);
567 UNUSED(rd); 567 UNUSED(rd);
568} 568}
569 569
@@ -580,22 +580,7 @@ static void LJ_FASTCALL recff_math_ldexp(jit_State *J, RecordFFData *rd)
580 UNUSED(rd); 580 UNUSED(rd);
581} 581}
582 582
583/* Record math.asin, math.acos, math.atan. */ 583static void LJ_FASTCALL recff_math_call(jit_State *J, RecordFFData *rd)
584static void LJ_FASTCALL recff_math_atrig(jit_State *J, RecordFFData *rd)
585{
586 TRef y = lj_ir_tonum(J, J->base[0]);
587 TRef x = lj_ir_knum_one(J);
588 uint32_t ffid = rd->data;
589 if (ffid != FF_math_atan) {
590 TRef tmp = emitir(IRTN(IR_MUL), y, y);
591 tmp = emitir(IRTN(IR_SUB), x, tmp);
592 tmp = emitir(IRTN(IR_FPMATH), tmp, IRFPM_SQRT);
593 if (ffid == FF_math_asin) { x = tmp; } else { x = y; y = tmp; }
594 }
595 J->base[0] = emitir(IRTN(IR_ATAN2), y, x);
596}
597
598static void LJ_FASTCALL recff_math_htrig(jit_State *J, RecordFFData *rd)
599{ 584{
600 TRef tr = lj_ir_tonum(J, J->base[0]); 585 TRef tr = lj_ir_tonum(J, J->base[0]);
601 J->base[0] = emitir(IRTN(IR_CALLN), tr, rd->data); 586 J->base[0] = emitir(IRTN(IR_CALLN), tr, rd->data);
diff --git a/src/lj_ir.h b/src/lj_ir.h
index 6bbe0a33..60e335c2 100644
--- a/src/lj_ir.h
+++ b/src/lj_ir.h
@@ -75,7 +75,6 @@
75 _(NEG, N , ref, ref) \ 75 _(NEG, N , ref, ref) \
76 \ 76 \
77 _(ABS, N , ref, ref) \ 77 _(ABS, N , ref, ref) \
78 _(ATAN2, N , ref, ref) \
79 _(LDEXP, N , ref, ref) \ 78 _(LDEXP, N , ref, ref) \
80 _(MIN, C , ref, ref) \ 79 _(MIN, C , ref, ref) \
81 _(MAX, C , ref, ref) \ 80 _(MAX, C , ref, ref) \
@@ -178,8 +177,7 @@ LJ_STATIC_ASSERT((int)IR_XLOAD + IRDELTA_L2S == (int)IR_XSTORE);
178/* FPMATH sub-functions. ORDER FPM. */ 177/* FPMATH sub-functions. ORDER FPM. */
179#define IRFPMDEF(_) \ 178#define IRFPMDEF(_) \
180 _(FLOOR) _(CEIL) _(TRUNC) /* Must be first and in this order. */ \ 179 _(FLOOR) _(CEIL) _(TRUNC) /* Must be first and in this order. */ \
181 _(SQRT) _(EXP) _(EXP2) _(LOG) _(LOG2) _(LOG10) \ 180 _(SQRT) _(EXP2) _(LOG) _(LOG2) \
182 _(SIN) _(COS) _(TAN) \
183 _(OTHER) 181 _(OTHER)
184 182
185typedef enum { 183typedef enum {
diff --git a/src/lj_ircall.h b/src/lj_ircall.h
index f4f3f781..35c02dc0 100644
--- a/src/lj_ircall.h
+++ b/src/lj_ircall.h
@@ -21,6 +21,7 @@ typedef struct CCallInfo {
21 21
22#define CCI_OTSHIFT 16 22#define CCI_OTSHIFT 16
23#define CCI_OPTYPE(ci) ((ci)->flags >> CCI_OTSHIFT) /* Get op/type. */ 23#define CCI_OPTYPE(ci) ((ci)->flags >> CCI_OTSHIFT) /* Get op/type. */
24#define CCI_TYPE(ci) (((ci)->flags>>CCI_OTSHIFT) & IRT_TYPE)
24#define CCI_OPSHIFT 24 25#define CCI_OPSHIFT 24
25#define CCI_OP(ci) ((ci)->flags >> CCI_OPSHIFT) /* Get op. */ 26#define CCI_OP(ci) ((ci)->flags >> CCI_OPSHIFT) /* Get op. */
26 27
@@ -172,6 +173,14 @@ typedef struct CCallInfo {
172 _(ANY, lj_mem_newgco, 2, FS, PGC, CCI_L) \ 173 _(ANY, lj_mem_newgco, 2, FS, PGC, CCI_L) \
173 _(ANY, lj_math_random_step, 1, FS, NUM, CCI_CASTU64) \ 174 _(ANY, lj_math_random_step, 1, FS, NUM, CCI_CASTU64) \
174 _(ANY, lj_vm_modi, 2, FN, INT, 0) \ 175 _(ANY, lj_vm_modi, 2, FN, INT, 0) \
176 _(ANY, log10, 1, N, NUM, XA_FP) \
177 _(ANY, exp, 1, N, NUM, XA_FP) \
178 _(ANY, sin, 1, N, NUM, XA_FP) \
179 _(ANY, cos, 1, N, NUM, XA_FP) \
180 _(ANY, tan, 1, N, NUM, XA_FP) \
181 _(ANY, asin, 1, N, NUM, XA_FP) \
182 _(ANY, acos, 1, N, NUM, XA_FP) \
183 _(ANY, atan, 1, N, NUM, XA_FP) \
175 _(ANY, sinh, 1, N, NUM, XA_FP) \ 184 _(ANY, sinh, 1, N, NUM, XA_FP) \
176 _(ANY, cosh, 1, N, NUM, XA_FP) \ 185 _(ANY, cosh, 1, N, NUM, XA_FP) \
177 _(ANY, tanh, 1, N, NUM, XA_FP) \ 186 _(ANY, tanh, 1, N, NUM, XA_FP) \
@@ -183,14 +192,9 @@ typedef struct CCallInfo {
183 _(FPMATH, lj_vm_ceil, 1, N, NUM, XA_FP) \ 192 _(FPMATH, lj_vm_ceil, 1, N, NUM, XA_FP) \
184 _(FPMATH, lj_vm_trunc, 1, N, NUM, XA_FP) \ 193 _(FPMATH, lj_vm_trunc, 1, N, NUM, XA_FP) \
185 _(FPMATH, sqrt, 1, N, NUM, XA_FP) \ 194 _(FPMATH, sqrt, 1, N, NUM, XA_FP) \
186 _(ANY, exp, 1, N, NUM, XA_FP) \
187 _(ANY, lj_vm_exp2, 1, N, NUM, XA_FP) \ 195 _(ANY, lj_vm_exp2, 1, N, NUM, XA_FP) \
188 _(ANY, log, 1, N, NUM, XA_FP) \ 196 _(ANY, log, 1, N, NUM, XA_FP) \
189 _(ANY, lj_vm_log2, 1, N, NUM, XA_FP) \ 197 _(ANY, lj_vm_log2, 1, N, NUM, XA_FP) \
190 _(ANY, log10, 1, N, NUM, XA_FP) \
191 _(ANY, sin, 1, N, NUM, XA_FP) \
192 _(ANY, cos, 1, N, NUM, XA_FP) \
193 _(ANY, tan, 1, N, NUM, XA_FP) \
194 _(ANY, lj_vm_powi, 2, N, NUM, XA_FP) \ 198 _(ANY, lj_vm_powi, 2, N, NUM, XA_FP) \
195 _(ANY, pow, 2, N, NUM, XA2_FP) \ 199 _(ANY, pow, 2, N, NUM, XA2_FP) \
196 _(ANY, atan2, 2, N, NUM, XA2_FP) \ 200 _(ANY, atan2, 2, N, NUM, XA2_FP) \
diff --git a/src/lj_opt_fold.c b/src/lj_opt_fold.c
index cefd69c8..ae65e15a 100644
--- a/src/lj_opt_fold.c
+++ b/src/lj_opt_fold.c
@@ -173,7 +173,6 @@ LJFOLD(ADD KNUM KNUM)
173LJFOLD(SUB KNUM KNUM) 173LJFOLD(SUB KNUM KNUM)
174LJFOLD(MUL KNUM KNUM) 174LJFOLD(MUL KNUM KNUM)
175LJFOLD(DIV KNUM KNUM) 175LJFOLD(DIV KNUM KNUM)
176LJFOLD(ATAN2 KNUM KNUM)
177LJFOLD(LDEXP KNUM KNUM) 176LJFOLD(LDEXP KNUM KNUM)
178LJFOLD(MIN KNUM KNUM) 177LJFOLD(MIN KNUM KNUM)
179LJFOLD(MAX KNUM KNUM) 178LJFOLD(MAX KNUM KNUM)
@@ -213,6 +212,30 @@ LJFOLDF(kfold_fpmath)
213 return lj_ir_knum(J, y); 212 return lj_ir_knum(J, y);
214} 213}
215 214
215LJFOLD(CALLN KNUM any)
216LJFOLDF(kfold_fpcall1)
217{
218 const CCallInfo *ci = &lj_ir_callinfo[fins->op2];
219 if (CCI_TYPE(ci) == IRT_NUM) {
220 double y = ((double (*)(double))ci->func)(knumleft);
221 return lj_ir_knum(J, y);
222 }
223 return NEXTFOLD;
224}
225
226LJFOLD(CALLN CARG IRCALL_atan2)
227LJFOLDF(kfold_fpcall2)
228{
229 if (irref_isk(fleft->op1) && irref_isk(fleft->op2)) {
230 const CCallInfo *ci = &lj_ir_callinfo[fins->op2];
231 double a = ir_knum(IR(fleft->op1))->n;
232 double b = ir_knum(IR(fleft->op2))->n;
233 double y = ((double (*)(double, double))ci->func)(a, b);
234 return lj_ir_knum(J, y);
235 }
236 return NEXTFOLD;
237}
238
216LJFOLD(POW KNUM KINT) 239LJFOLD(POW KNUM KINT)
217LJFOLDF(kfold_numpow) 240LJFOLDF(kfold_numpow)
218{ 241{
diff --git a/src/lj_opt_split.c b/src/lj_opt_split.c
index ee7cf0f9..e526b49d 100644
--- a/src/lj_opt_split.c
+++ b/src/lj_opt_split.c
@@ -426,9 +426,6 @@ static void split_ir(jit_State *J)
426 } 426 }
427 hi = split_call_l(J, hisubst, oir, ir, IRCALL_lj_vm_floor + ir->op2); 427 hi = split_call_l(J, hisubst, oir, ir, IRCALL_lj_vm_floor + ir->op2);
428 break; 428 break;
429 case IR_ATAN2:
430 hi = split_call_ll(J, hisubst, oir, ir, IRCALL_atan2);
431 break;
432 case IR_LDEXP: 429 case IR_LDEXP:
433 hi = split_call_li(J, hisubst, oir, ir, IRCALL_ldexp); 430 hi = split_call_li(J, hisubst, oir, ir, IRCALL_ldexp);
434 break; 431 break;
diff --git a/src/lj_target_x86.h b/src/lj_target_x86.h
index 71c930fe..fd72c71d 100644
--- a/src/lj_target_x86.h
+++ b/src/lj_target_x86.h
@@ -228,16 +228,10 @@ typedef enum {
228 /* Note: little-endian byte-order! */ 228 /* Note: little-endian byte-order! */
229 XI_FLDZ = 0xeed9, 229 XI_FLDZ = 0xeed9,
230 XI_FLD1 = 0xe8d9, 230 XI_FLD1 = 0xe8d9,
231 XI_FLDLG2 = 0xecd9,
232 XI_FLDLN2 = 0xedd9,
233 XI_FDUP = 0xc0d9, /* Really fld st0. */ 231 XI_FDUP = 0xc0d9, /* Really fld st0. */
234 XI_FPOP = 0xd8dd, /* Really fstp st0. */ 232 XI_FPOP = 0xd8dd, /* Really fstp st0. */
235 XI_FPOP1 = 0xd9dd, /* Really fstp st1. */ 233 XI_FPOP1 = 0xd9dd, /* Really fstp st1. */
236 XI_FRNDINT = 0xfcd9, 234 XI_FRNDINT = 0xfcd9,
237 XI_FSIN = 0xfed9,
238 XI_FCOS = 0xffd9,
239 XI_FPTAN = 0xf2d9,
240 XI_FPATAN = 0xf3d9,
241 XI_FSCALE = 0xfdd9, 235 XI_FSCALE = 0xfdd9,
242 XI_FYL2X = 0xf1d9, 236 XI_FYL2X = 0xf1d9,
243 237
diff --git a/src/lj_vmmath.c b/src/lj_vmmath.c
index e89405d7..36178f29 100644
--- a/src/lj_vmmath.c
+++ b/src/lj_vmmath.c
@@ -48,7 +48,6 @@ double lj_vm_foldarith(double x, double y, int op)
48 case IR_NEG - IR_ADD: return -x; break; 48 case IR_NEG - IR_ADD: return -x; break;
49 case IR_ABS - IR_ADD: return fabs(x); break; 49 case IR_ABS - IR_ADD: return fabs(x); break;
50#if LJ_HASJIT 50#if LJ_HASJIT
51 case IR_ATAN2 - IR_ADD: return atan2(x, y); break;
52 case IR_LDEXP - IR_ADD: return ldexp(x, (int)y); break; 51 case IR_LDEXP - IR_ADD: return ldexp(x, (int)y); break;
53 case IR_MIN - IR_ADD: return x < y ? x : y; break; 52 case IR_MIN - IR_ADD: return x < y ? x : y; break;
54 case IR_MAX - IR_ADD: return x > y ? x : y; break; 53 case IR_MAX - IR_ADD: return x > y ? x : y; break;
@@ -129,14 +128,9 @@ double lj_vm_foldfpm(double x, int fpm)
129 case IRFPM_CEIL: return lj_vm_ceil(x); 128 case IRFPM_CEIL: return lj_vm_ceil(x);
130 case IRFPM_TRUNC: return lj_vm_trunc(x); 129 case IRFPM_TRUNC: return lj_vm_trunc(x);
131 case IRFPM_SQRT: return sqrt(x); 130 case IRFPM_SQRT: return sqrt(x);
132 case IRFPM_EXP: return exp(x);
133 case IRFPM_EXP2: return lj_vm_exp2(x); 131 case IRFPM_EXP2: return lj_vm_exp2(x);
134 case IRFPM_LOG: return log(x); 132 case IRFPM_LOG: return log(x);
135 case IRFPM_LOG2: return lj_vm_log2(x); 133 case IRFPM_LOG2: return lj_vm_log2(x);
136 case IRFPM_LOG10: return log10(x);
137 case IRFPM_SIN: return sin(x);
138 case IRFPM_COS: return cos(x);
139 case IRFPM_TAN: return tan(x);
140 default: lua_assert(0); 134 default: lua_assert(0);
141 } 135 }
142 return 0; 136 return 0;