aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Matz <matz@suse.de>2016-05-15 19:07:13 +0200
committerMichael Matz <matz@suse.de>2016-12-15 17:47:05 +0100
commit58963828abff22dad0a8b4acf2e7b70877177d52 (patch)
treea1da8876c45f594439c0b81a79a4943a8b7f98a9
parent5a222588a81f1ad1d1a1fdf64a54109f809b9923 (diff)
downloadtinycc-58963828abff22dad0a8b4acf2e7b70877177d52.tar.gz
tinycc-58963828abff22dad0a8b4acf2e7b70877177d52.tar.bz2
x86-asm: Correct mem64->xmm movq
Now we can express prefixes with 0x0fxx opcodes we can correct the movq mem64->xmm opcode, and restrict the movq xmm->mem64 movq to not invalidly accept mmx.
-rw-r--r--i386-asm.h7
-rw-r--r--tests/asmtest.S1
-rw-r--r--x86_64-asm.h9
3 files changed, 6 insertions, 11 deletions
diff --git a/i386-asm.h b/i386-asm.h
index c97f7ea..338fa69 100644
--- a/i386-asm.h
+++ b/i386-asm.h
@@ -390,11 +390,8 @@ ALT(DEF_ASM_OP2(cmovo, 0x0f40, 0, OPC_MODRM | OPC_TEST | OPC_WLX, OPT_REGW | OPT
DEF_ASM_OP2(movq, 0x0f6f, 0, OPC_MODRM, OPT_EA | OPT_MMX, OPT_MMX )
ALT(DEF_ASM_OP2(movd, 0x0f7e, 0, OPC_MODRM, OPT_MMXSSE, OPT_EA | OPT_REG32 ))
ALT(DEF_ASM_OP2(movq, 0x0f7f, 0, OPC_MODRM, OPT_MMX, OPT_EA | OPT_MMX ))
- /* Hack: movq d6 only accepts xmm->mem/xmm, we use MMXSSE in source
- to get the 0x66 prefix that is added automatically. The mmx->mem
- is accepted by 0f7f above, and mmx->xmm doesn't exist (but is
- invalidly accepted by this entry). */
-ALT(DEF_ASM_OP2(movq, 0x0fd6, 0, OPC_MODRM, OPT_MMXSSE, OPT_EA | OPT_SSE ))
+ALT(DEF_ASM_OP2(movq, 0x660fd6, 0, OPC_MODRM, OPT_SSE, OPT_EA | OPT_SSE ))
+ALT(DEF_ASM_OP2(movq, 0xf30f7e, 0, OPC_MODRM, OPT_EA | OPT_SSE, OPT_SSE ))
DEF_ASM_OP2(packssdw, 0x0f6b, 0, OPC_MODRM, OPT_EA | OPT_MMXSSE, OPT_MMXSSE )
DEF_ASM_OP2(packsswb, 0x0f63, 0, OPC_MODRM, OPT_EA | OPT_MMXSSE, OPT_MMXSSE )
diff --git a/tests/asmtest.S b/tests/asmtest.S
index 1215d5a..462fc52 100644
--- a/tests/asmtest.S
+++ b/tests/asmtest.S
@@ -738,6 +738,7 @@ ft1: ft2: ft3: ft4: ft5: ft6: ft7: ft8: ft9:
movq (%ebp), %mm1
movq %mm2, (%edi)
+ movq (%edi), %xmm3
#ifdef __x86_64__
movq %rcx, %mm1
movq %rdx, %xmm2
diff --git a/x86_64-asm.h b/x86_64-asm.h
index 0560ffc..11e505a 100644
--- a/x86_64-asm.h
+++ b/x86_64-asm.h
@@ -398,15 +398,12 @@ ALT(DEF_ASM_OP2(movd, 0x0f6e, 0, OPC_MODRM, OPT_EA | OPT_REG64, OPT_MMXSSE ))
mem->mmx/sse. 6E is disassembled by GAS as movd, so there would
be discrepancies in the asmtest.S. */
ALT(DEF_ASM_OP2(movq, 0x0f6f, 0, OPC_MODRM, OPT_EA | OPT_MMX, OPT_MMX ))
-ALT(DEF_ASM_OP2(movq, 0x0f6e, 0, OPC_MODRM, OPT_EA | OPT_REG64, OPT_MMXSSE ))
+ALT(DEF_ASM_OP2(movq, 0x480f6e, 0, OPC_MODRM, OPT_REG64, OPT_MMXSSE ))
ALT(DEF_ASM_OP2(movd, 0x0f7e, 0, OPC_MODRM, OPT_MMXSSE, OPT_EA | OPT_REG32 ))
ALT(DEF_ASM_OP2(movd, 0x0f7e, 0, OPC_MODRM, OPT_MMXSSE, OPT_EA | OPT_REG64 ))
ALT(DEF_ASM_OP2(movq, 0x0f7f, 0, OPC_MODRM, OPT_MMX, OPT_EA | OPT_MMX ))
- /* Hack: movq d6 only accepts xmm->mem/xmm, we use MMXSSE in source
- to get the 0x66 prefix that is added automatically. The mmx->mem
- is accepted by 0f7f above, and mmx->xmm doesn't exist (but is
- invalidly accepted by this entry). */
-ALT(DEF_ASM_OP2(movq, 0x0fd6, 0, OPC_MODRM, OPT_MMXSSE, OPT_EA | OPT_SSE ))
+ALT(DEF_ASM_OP2(movq, 0x660fd6, 0, OPC_MODRM, OPT_SSE, OPT_EA | OPT_SSE ))
+ALT(DEF_ASM_OP2(movq, 0xf30f7e, 0, OPC_MODRM, OPT_EA | OPT_SSE, OPT_SSE ))
ALT(DEF_ASM_OP2(movq, 0x0f7e, 0, OPC_MODRM, OPT_MMXSSE, OPT_EA | OPT_REG64 ))
DEF_ASM_OP2(packssdw, 0x0f6b, 0, OPC_MODRM, OPT_EA | OPT_MMXSSE, OPT_MMXSSE )