From 6f834087d0553b68b61770c69109894bf3f375ef Mon Sep 17 00:00:00 2001 From: Mike Pall Date: Thu, 15 Aug 2024 00:22:47 +0200 Subject: ARM64: Use movi to materialize FP constants. Thanks to Peter Cawley. #1245 --- src/jit/dis_arm64.lua | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'src/jit') diff --git a/src/jit/dis_arm64.lua b/src/jit/dis_arm64.lua index 84677666..2741cd2e 100644 --- a/src/jit/dis_arm64.lua +++ b/src/jit/dis_arm64.lua @@ -658,6 +658,10 @@ local map_datafp = { -- Data processing, SIMD and FP. } } } + }, + { -- 010 + shift = 0, mask = 0x81f8fc00, + [0x100e400] = "moviDdG" } } @@ -832,6 +836,20 @@ local function parse_fpimm8(op) return sign * frac * 2^exp end +local function decode_fpmovi(op) + local lo = rshift(op, 5) + local hi = rshift(op, 9) + lo = bor(band(lo, 1) * 0xff, band(lo, 2) * 0x7f80, band(lo, 4) * 0x3fc000, + band(lo, 8) * 0x1fe00000) + hi = bor(band(hi, 1) * 0xff, band(hi, 0x80) * 0x1fe, + band(hi, 0x100) * 0xff00, band(hi, 0x200) * 0x7f8000) + if hi ~= 0 then + return fmt_hex32(hi)..tohex(lo) + else + return fmt_hex32(lo) + end +end + local function prefer_bfx(sf, uns, imms, immr) if imms < immr or imms == 31 or imms == 63 then return false @@ -1131,6 +1149,8 @@ local function disass_ins(ctx) x = 0 elseif p == "F" then x = parse_fpimm8(op) + elseif p == "G" then + x = "#0x"..decode_fpmovi(op) elseif p == "g" or p == "f" or p == "x" or p == "w" or p == "d" or p == "s" then -- These are handled in D/N/M/A. -- cgit v1.2.3-55-g6feb