diff options
| author | 2026-03-08 18:40:22 +0100 | |
|---|---|---|
| committer | 2026-03-08 19:03:59 +0100 | |
| commit | 77f78e58c94812d1ec40b57df86d2a87e6f32b41 (patch) | |
| tree | 72163e01b8820247cdc9b4ef0757a8329868da52 /x86_64 | |
| parent | 429bb2eaaa1f2dd62b7cab8eaaf7d1f20b738a93 (diff) | |
x86_64/emit: fix float store zero, unsafe range check for mul immediate
Diffstat (limited to 'x86_64')
| -rw-r--r-- | x86_64/emit.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/x86_64/emit.c b/x86_64/emit.c index f951689..fbee46b 100644 --- a/x86_64/emit.c +++ b/x86_64/emit.c @@ -496,6 +496,10 @@ static void Xmov(uchar **pcode, enum irclass k, struct oper dst, struct oper src [KF32] = 7, [KF64] = 10, }; + if (kisflt(k) && src.t == OIMM && src.imm == 0) { + /* special case for storing zero float : use integer instruction with zero immediate */ + k = KI32 + (k - KF32); + } encode(pcode, all + k2off[k], countof(all) - k2off[k], k, dst, src); } DEFINSTR2(Xmovsxl, @@ -704,7 +708,7 @@ Ximul(uchar **pcode, enum irclass k, struct oper dst, struct oper s1, struct ope return; } assert(s2.t == OIMM); - if ((uint)(s2.imm + 128) < 256) { + if (-128 <= s2.imm && s2.imm < 128) { encode(pcode, imul3_imm8tab, countof(imul3_imm8tab), k, dst, s1); B(s2.imm); } else { |