DynASM/x64: Add VREG support to mov64.

Thanks to Peter Cawley.
This commit is contained in:
Mike Pall 2013-07-18 08:51:32 +02:00
parent 9aa5d04137
commit ec96d8b494

View File

@ -1678,7 +1678,7 @@ if x64 then
function map_op.mov64_2(params) function map_op.mov64_2(params)
if not params then return { "reg, imm", "reg, [disp]", "[disp], reg" } end if not params then return { "reg, imm", "reg, [disp]", "[disp], reg" } end
if secpos+2 > maxsecpos then wflush() end if secpos+2 > maxsecpos then wflush() end
local opcode, op64, sz, rex local opcode, op64, sz, rex, vreg
local op64 = match(params[1], "^%[%s*(.-)%s*%]$") local op64 = match(params[1], "^%[%s*(.-)%s*%]$")
if op64 then if op64 then
local a = parseoperand(params[2]) local a = parseoperand(params[2])
@ -1699,11 +1699,17 @@ if x64 then
werror("bad operand mode") werror("bad operand mode")
end end
op64 = params[2] op64 = params[2]
opcode = 0xb8 + band(a.reg, 7) -- !x64: no VREG support. if a.reg == -1 then
vreg = a.vreg
opcode = 0xb8
else
opcode = 0xb8 + band(a.reg, 7)
end
rex = a.reg > 7 and 9 or 8 rex = a.reg > 7 and 9 or 8
end end
end end
wputop(sz, opcode, rex) wputop(sz, opcode, rex)
if vreg then waction("VREG", vreg); wputxb(0) end
waction("IMM_D", format("(unsigned int)(%s)", op64)) waction("IMM_D", format("(unsigned int)(%s)", op64))
waction("IMM_D", format("(unsigned int)((%s)>>32)", op64)) waction("IMM_D", format("(unsigned int)((%s)>>32)", op64))
end end