DynASM/x86: Fix movd/movq and vmovd/vmovq operand sizes.

Thanks to Dmitry Stogov. #1489
This commit is contained in:
Mike Pall 2026-07-24 16:14:33 +02:00
parent 2460b3ff93
commit 346ab587cb
3 changed files with 22 additions and 22 deletions

View File

@ -1310,7 +1310,7 @@ local map_op = {
mfence_0 = "0FAEF0",
movapd_2 = "rmo:660F28rM|mro:660F29Rm",
movaps_2 = "rmo:0F28rM|mro:0F29Rm",
movd_2 = "rm/od:660F6ErM|rm/oq:660F6ErXM|mr/do:660F7ERm|mr/qo:",
movd_2 = "rm/od:660F6ErM|mr/do:660F7ERm",
movdqa_2 = "rmo:660F6FrM|mro:660F7FRm",
movdqu_2 = "rmo:F30F6FrM|mro:F30F7FRm",
movhlps_2 = "rro:0F12rM",
@ -1325,7 +1325,7 @@ local map_op = {
movnti_2 = "xrqd:0FC3Rm",
movntpd_2 = "xro:660F2BRm",
movntps_2 = "xro:0F2BRm",
movq_2 = "rro:F30F7ErM|rx/oq:|xr/qo:n660FD6Rm",
movq_2 = x64 and "rro:F30F7ErM|rx/oq:|xr/qo:n660FD6Rm|rm/oq:660F6ErXM|mr/qo:660F7ERm" or "rro:F30F7ErM|rx/oq:|xr/qo:n660FD6Rm",
movsd_2 = "rro:F20F10rM|rx/oq:|xr/qo:nF20F11Rm",
movss_2 = "rro:F30F10rM|rx/od:|xr/do:F30F11Rm",
movupd_2 = "rmo:660F10rM|mro:660F11Rm",
@ -1529,8 +1529,8 @@ local map_op = {
vmaskmovpd_3 = "rrxoy:660F38V2DrM|xrroy:660F38V2FRm",
vmovapd_2 = "rmoy:660Fu28rM|mroy:660Fu29Rm",
vmovaps_2 = "rmoy:0Fu28rM|mroy:0Fu29Rm",
vmovd_2 = "rm/od:660Fu6ErM|rm/oq:660FuX6ErM|mr/do:660Fu7ERm|mr/qo:",
vmovq_2 = "rro:F30Fu7ErM|rx/oq:|xr/qo:660FuD6Rm",
vmovd_2 = "rm/od:660Fu6ErM|mr/do:660Fu7ERm",
vmovq_2 = x64 and "rro:F30Fu7ErM|rx/oq:|xr/qo:660FuD6Rm|rm/oq:660FuX6ErM|mr/qo:660Fu7ERm" or "rro:F30Fu7ErM|rx/oq:|xr/qo:660FuD6Rm",
vmovddup_2 = "rmy:F20Fu12rM|rro:|rx/oq:",
vmovhlps_3 = "rrro:0FV12rM",
vmovhpd_2 = "xr/qo:660Fu17Rm",

View File

@ -354,11 +354,11 @@
|
|// Synthesize SSE FP constants.
|.macro sseconst_abs, reg, tmp // Synthesize abs mask.
| mov64 tmp, U64x(7fffffff,ffffffff); movd reg, tmp
| mov64 tmp, U64x(7fffffff,ffffffff); movq reg, tmp
|.endmacro
|
|.macro sseconst_hi, reg, tmp, val // Synthesize hi-32 bit const.
| mov64 tmp, U64x(val,00000000); movd reg, tmp
| mov64 tmp, U64x(val,00000000); movq reg, tmp
|.endmacro
|
|.macro sseconst_sign, reg, tmp // Synthesize sign mask.
@ -2087,7 +2087,7 @@ static void build_subroutines(BuildCtx *ctx)
|.endif
|1:
| ja ->fff_fallback
| movd xmm0, RB
| movq xmm0, RB
|.else
| checknumtp [BASE], ->fff_fallback
| movsd xmm0, qword [BASE]
@ -2122,7 +2122,7 @@ static void build_subroutines(BuildCtx *ctx)
| jmp <1
|2:
| ja ->fff_fallback_bit_op
| movd xmm0, RA
| movq xmm0, RA
|.else
| checknumtp [RD], ->fff_fallback_bit_op
| movsd xmm0, qword [RD]
@ -2693,7 +2693,7 @@ static void build_subroutines(BuildCtx *ctx)
| ret
|1:
| mov64 rdx, U64x(c3f00000,00000000) // -0x1p64 (double).
| movd xmm1, rdx
| movq xmm1, rdx
| addsd xmm0, xmm1
| cvttsd2si rax, xmm0 // Convert [2^63..2^64+2^63) range.
| // Note that -0x1p63 converts to -0x8000000000000000LL either way.
@ -3005,16 +3005,16 @@ static void build_ins(BuildCtx *ctx, BCOp op, int defop)
| ja ->vmeta_comp
| // RA is an integer, RD is a number.
| cvtsi2sd xmm1, RAd
| movd xmm0, RD
| movq xmm0, RD
| jmp >3
|.else
| cmp ITYPEd, LJ_TISNUM; jae ->vmeta_comp
| cmp RBd, LJ_TISNUM; jae ->vmeta_comp
|.endif
|1:
| movd xmm0, RD
| movq xmm0, RD
|2:
| movd xmm1, RA
| movq xmm1, RA
|3:
| add PC, 4
| ucomisd xmm0, xmm1
@ -3059,7 +3059,7 @@ static void build_ins(BuildCtx *ctx, BCOp op, int defop)
|7: // RD is not an integer.
| ja >5
| // RD is a number.
| movd xmm1, RD
| movq xmm1, RD
| cmp ITYPEd, LJ_TISNUM; jb >1; jne >5
| // RD is a number, RA is an integer.
| cvtsi2sd xmm0, RAd
@ -3074,10 +3074,10 @@ static void build_ins(BuildCtx *ctx, BCOp op, int defop)
|.else
| cmp RBd, LJ_TISNUM; jae >5
| cmp ITYPEd, LJ_TISNUM; jae >5
| movd xmm1, RD
| movq xmm1, RD
|.endif
|1:
| movd xmm0, RA
| movq xmm0, RA
|2:
| ucomisd xmm0, xmm1
|4:
@ -3199,11 +3199,11 @@ static void build_ins(BuildCtx *ctx, BCOp op, int defop)
|
|8: // RA is an integer, RD is a number.
| cvtsi2sd xmm0, RBd
| movd xmm1, RD
| movq xmm1, RD
| ucomisd xmm0, xmm1
| jmp >4
|1:
| movd xmm0, RD
| movq xmm0, RD
|.else
| checknum RB, >3
|1:
@ -3881,7 +3881,7 @@ static void build_ins(BuildCtx *ctx, BCOp op, int defop)
|.else
| // Convert number to int and back and compare.
| checknum RC, >5
| movd xmm0, RC
| movq xmm0, RC
| cvttsd2si RCd, xmm0
| cvtsi2sd xmm1, RCd
| ucomisd xmm0, xmm1
@ -4007,7 +4007,7 @@ static void build_ins(BuildCtx *ctx, BCOp op, int defop)
|.else
| // Convert number to int and back and compare.
| checknum RC, >5
| movd xmm0, RC
| movq xmm0, RC
| cvttsd2si RCd, xmm0
| cvtsi2sd xmm1, RCd
| ucomisd xmm0, xmm1

View File

@ -444,7 +444,7 @@
|// Synthesize SSE FP constants.
|.macro sseconst_abs, reg, tmp // Synthesize abs mask.
|.if X64
| mov64 tmp, U64x(7fffffff,ffffffff); movd reg, tmp
| mov64 tmp, U64x(7fffffff,ffffffff); movq reg, tmp
|.else
| pxor reg, reg; pcmpeqd reg, reg; psrlq reg, 1
|.endif
@ -452,7 +452,7 @@
|
|.macro sseconst_hi, reg, tmp, val // Synthesize hi-32 bit const.
|.if X64
| mov64 tmp, U64x(val,00000000); movd reg, tmp
| mov64 tmp, U64x(val,00000000); movq reg, tmp
|.else
| mov tmp, 0x .. val; movd reg, tmp; pshufd reg, reg, 0x51
|.endif
@ -3156,7 +3156,7 @@ static void build_subroutines(BuildCtx *ctx)
| ret
|1:
| mov64 rdx, U64x(c3f00000,00000000) // -0x1p64 (double).
| movd xmm1, rdx
| movq xmm1, rdx
| addsd xmm0, xmm1
| cvttsd2si rax, xmm0 // Convert [2^63..2^64+2^63) range.
| // Note that -0x1p63 converts to -0x8000000000000000LL either way.