diff options
| author | Mike Pall <mike> | 2026-07-28 00:44:24 +0200 |
|---|---|---|
| committer | Mike Pall <mike> | 2026-07-28 00:44:24 +0200 |
| commit | faaf663340347a78b22ed94c63c24fe090bd9784 (patch) | |
| tree | 063c135292ca7cbbe872873eb77173bd59fd394e /src/lj_obj.h | |
| parent | a471ab78c7b670b4f92dae111fc3c96fb824c768 (diff) | |
| download | luajit-faaf663340347a78b22ed94c63c24fe090bd9784.tar.gz luajit-faaf663340347a78b22ed94c63c24fe090bd9784.tar.bz2 luajit-faaf663340347a78b22ed94c63c24fe090bd9784.zip | |
x86: Conditionally use SSE3 for 64 bit conversions.
Reported by Gero Schwäricke. #1496 #1411
Diffstat (limited to 'src/lj_obj.h')
| -rw-r--r-- | src/lj_obj.h | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/src/lj_obj.h b/src/lj_obj.h index 96dc1e0d0..30991a7e9 100644 --- a/src/lj_obj.h +++ b/src/lj_obj.h | |||
| @@ -1035,11 +1035,30 @@ LJ_ASMF LJ_CONSTF int64_t lj_vm_num2int_check(double x); | |||
| 1035 | ** The uint64_t conversion accepts the union of the unsigned + signed range. | 1035 | ** The uint64_t conversion accepts the union of the unsigned + signed range. |
| 1036 | */ | 1036 | */ |
| 1037 | LJ_ASMF LJ_CONSTF int64_t lj_vm_num2i64(double x); | 1037 | LJ_ASMF LJ_CONSTF int64_t lj_vm_num2i64(double x); |
| 1038 | LJ_ASMF LJ_CONSTF int64_t lj_vm_num2u64(double x); | 1038 | LJ_ASMF LJ_CONSTF uint64_t lj_vm_num2u64(double x); |
| 1039 | |||
| 1040 | #if LJ_TARGET_X86 | ||
| 1041 | |||
| 1042 | LJ_ASMF LJ_CONSTF int64_t lj_vm_num2i64_sse3(double x); | ||
| 1043 | LJ_ASMF LJ_CONSTF uint64_t lj_vm_num2u64_sse3(double x); | ||
| 1044 | LJ_ASMF int64_t (*lj_vm_num2i64_ptr)(double x); | ||
| 1045 | LJ_ASMF uint64_t (*lj_vm_num2u64_ptr)(double x); | ||
| 1046 | static LJ_AINLINE int64_t lj_num2i64(double x) | ||
| 1047 | { | ||
| 1048 | return (*lj_vm_num2i64_ptr)(x); | ||
| 1049 | } | ||
| 1050 | static LJ_AINLINE uint64_t lj_num2u64(double x) | ||
| 1051 | { | ||
| 1052 | return (*lj_vm_num2u64_ptr)(x); | ||
| 1053 | } | ||
| 1054 | |||
| 1055 | #else | ||
| 1039 | 1056 | ||
| 1040 | #define lj_num2i64(x) (lj_vm_num2i64((x))) | 1057 | #define lj_num2i64(x) (lj_vm_num2i64((x))) |
| 1041 | #define lj_num2u64(x) (lj_vm_num2u64((x))) | 1058 | #define lj_num2u64(x) (lj_vm_num2u64((x))) |
| 1042 | 1059 | ||
| 1060 | #endif | ||
| 1061 | |||
| 1043 | /* Lua BitOp conversion semantics use the 2^52 + 2^51 trick. */ | 1062 | /* Lua BitOp conversion semantics use the 2^52 + 2^51 trick. */ |
| 1044 | LJ_ASMF LJ_CONSTF int32_t lj_vm_tobit(double x); | 1063 | LJ_ASMF LJ_CONSTF int32_t lj_vm_tobit(double x); |
| 1045 | 1064 | ||
