diff options
| author | Mike Pall <mike> | 2025-11-27 17:45:17 +0100 |
|---|---|---|
| committer | Mike Pall <mike> | 2025-11-27 17:45:17 +0100 |
| commit | f80b349d5490aa289b2925d297f3f3c618977570 (patch) | |
| tree | 8d8fb0d2beb3e863592139d603ada63e5aa6ce77 /src/lj_opt_split.c | |
| parent | 3215838aa744d148e79a8ea0bd7c014e984302cb (diff) | |
| download | luajit-f80b349d5490aa289b2925d297f3f3c618977570.tar.gz luajit-f80b349d5490aa289b2925d297f3f3c618977570.tar.bz2 luajit-f80b349d5490aa289b2925d297f3f3c618977570.zip | |
Unify Lua number to FFI integer conversions.
Phew. #1411
Diffstat (limited to 'src/lj_opt_split.c')
| -rw-r--r-- | src/lj_opt_split.c | 15 |
1 files changed, 5 insertions, 10 deletions
diff --git a/src/lj_opt_split.c b/src/lj_opt_split.c index 8d025911..d29d1eab 100644 --- a/src/lj_opt_split.c +++ b/src/lj_opt_split.c | |||
| @@ -573,13 +573,9 @@ static void split_ir(jit_State *J) | |||
| 573 | case IR_CONV: { /* Conversion to 64 bit integer. Others handled below. */ | 573 | case IR_CONV: { /* Conversion to 64 bit integer. Others handled below. */ |
| 574 | IRType st = (IRType)(ir->op2 & IRCONV_SRCMASK); | 574 | IRType st = (IRType)(ir->op2 & IRCONV_SRCMASK); |
| 575 | #if LJ_SOFTFP | 575 | #if LJ_SOFTFP |
| 576 | lj_assertJ(st != IRT_FLOAT, "bad CONV *64.float emitted"); | ||
| 576 | if (st == IRT_NUM) { /* NUM to 64 bit int conv. */ | 577 | if (st == IRT_NUM) { /* NUM to 64 bit int conv. */ |
| 577 | hi = split_call_l(J, hisubst, oir, ir, | 578 | hi = split_call_l(J, hisubst, oir, ir, IRCALL_lj_vm_num2u64); |
| 578 | irt_isi64(ir->t) ? IRCALL_fp64_d2l : IRCALL_fp64_d2ul); | ||
| 579 | } else if (st == IRT_FLOAT) { /* FLOAT to 64 bit int conv. */ | ||
| 580 | nir->o = IR_CALLN; | ||
| 581 | nir->op2 = irt_isi64(ir->t) ? IRCALL_fp64_f2l : IRCALL_fp64_f2ul; | ||
| 582 | hi = split_emit(J, IRTI(IR_HIOP), nref, nref); | ||
| 583 | } | 579 | } |
| 584 | #else | 580 | #else |
| 585 | if (st == IRT_NUM || st == IRT_FLOAT) { /* FP to 64 bit int conv. */ | 581 | if (st == IRT_NUM || st == IRT_FLOAT) { /* FP to 64 bit int conv. */ |
| @@ -692,8 +688,9 @@ static void split_ir(jit_State *J) | |||
| 692 | nir->op2 = st == IRT_INT ? IRCALL_softfp_i2f : IRCALL_softfp_ui2f; | 688 | nir->op2 = st == IRT_INT ? IRCALL_softfp_i2f : IRCALL_softfp_ui2f; |
| 693 | } | 689 | } |
| 694 | } else if (st == IRT_FLOAT) { | 690 | } else if (st == IRT_FLOAT) { |
| 691 | lj_assertJ(!irt_isu32(ir->t), "bad CONV u32.fp emitted"); | ||
| 695 | nir->o = IR_CALLN; | 692 | nir->o = IR_CALLN; |
| 696 | nir->op2 = irt_isint(ir->t) ? IRCALL_softfp_f2i : IRCALL_softfp_f2ui; | 693 | nir->op2 = IRCALL_softfp_f2i; |
| 697 | } else | 694 | } else |
| 698 | #endif | 695 | #endif |
| 699 | #if LJ_SOFTFP | 696 | #if LJ_SOFTFP |
| @@ -705,9 +702,7 @@ static void split_ir(jit_State *J) | |||
| 705 | } else { | 702 | } else { |
| 706 | split_call_l(J, hisubst, oir, ir, | 703 | split_call_l(J, hisubst, oir, ir, |
| 707 | #if LJ_32 && LJ_HASFFI | 704 | #if LJ_32 && LJ_HASFFI |
| 708 | st == IRT_NUM ? | 705 | st == IRT_NUM ? IRCALL_softfp_d2i : IRCALL_softfp_f2i |
| 709 | (irt_isint(ir->t) ? IRCALL_softfp_d2i : IRCALL_softfp_d2ui) : | ||
| 710 | (irt_isint(ir->t) ? IRCALL_softfp_f2i : IRCALL_softfp_f2ui) | ||
| 711 | #else | 706 | #else |
| 712 | IRCALL_softfp_d2i | 707 | IRCALL_softfp_d2i |
| 713 | #endif | 708 | #endif |
