mirror of
https://github.com/LuaJIT/LuaJIT.git
synced 2025-02-08 07:34:07 +00:00
Add FOLD rule for FLOAT->NUM->FLOAT conversions.
This commit is contained in:
parent
48438b9e13
commit
3acd4892e9
@ -111,13 +111,15 @@ static uint32_t nexttoken(char **pp, int allowlit, int allowany)
|
|||||||
if (!strcmp(ircall_names[i], p+7))
|
if (!strcmp(ircall_names[i], p+7))
|
||||||
return i;
|
return i;
|
||||||
} else if (allowlit && !strncmp(p, "IRCONV_", 7)) {
|
} else if (allowlit && !strncmp(p, "IRCONV_", 7)) {
|
||||||
for (i = 0; irt_names[i]; i++)
|
for (i = 0; irt_names[i]; i++) {
|
||||||
if (!strncmp(irt_names[i], p+7, 3) && p[10] == '_') {
|
const char *r = strchr(p+7, '_');
|
||||||
|
if (r && !strncmp(irt_names[i], p+7, r-(p+7))) {
|
||||||
uint32_t j;
|
uint32_t j;
|
||||||
for (j = 0; irt_names[j]; j++)
|
for (j = 0; irt_names[j]; j++)
|
||||||
if (!strncmp(irt_names[j], p+11, 3))
|
if (!strcmp(irt_names[j], r+1))
|
||||||
return (i << 5) + j;
|
return (i << 5) + j;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
} else if (allowlit && *p >= '0' && *p <= '9') {
|
} else if (allowlit && *p >= '0' && *p <= '9') {
|
||||||
for (i = 0; *p >= '0' && *p <= '9'; p++)
|
for (i = 0; *p >= '0' && *p <= '9'; p++)
|
||||||
i = i*10 + (*p - '0');
|
i = i*10 + (*p - '0');
|
||||||
|
@ -914,6 +914,15 @@ LJFOLDF(simplify_conv_int_i64)
|
|||||||
return NEXTFOLD;
|
return NEXTFOLD;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
LJFOLD(CONV CONV IRCONV_NUM_FLOAT) /* _NUM */
|
||||||
|
LJFOLDF(simplify_conv_flt_num)
|
||||||
|
{
|
||||||
|
PHIBARRIER(fleft);
|
||||||
|
if ((fleft->op2 & IRCONV_SRCMASK) == IRT_NUM)
|
||||||
|
return fleft->op1;
|
||||||
|
return NEXTFOLD;
|
||||||
|
}
|
||||||
|
|
||||||
/* Shortcut TOBIT + IRT_NUM <- IRT_INT/IRT_U32 conversion. */
|
/* Shortcut TOBIT + IRT_NUM <- IRT_INT/IRT_U32 conversion. */
|
||||||
LJFOLD(TOBIT CONV KNUM)
|
LJFOLD(TOBIT CONV KNUM)
|
||||||
LJFOLDF(simplify_tobit_conv)
|
LJFOLDF(simplify_tobit_conv)
|
||||||
|
Loading…
Reference in New Issue
Block a user