implement PR8524, apparently mainline gas accepts movq as an alias for movd
authorChris Lattner <sabre@nondot.org>
Sun, 21 Nov 2010 08:18:57 +0000 (08:18 +0000)
committerChris Lattner <sabre@nondot.org>
Sun, 21 Nov 2010 08:18:57 +0000 (08:18 +0000)
when transfering between i64 gprs and mmx regs.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@119931 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Target/X86/X86InstrInfo.td
test/MC/X86/x86-64.s

index 0a60eb7b9179105b71eb7405d86f5afd58ed2e1d..10e9e9a88e48240bd7eb420f67bd47856f3df8e5 100644 (file)
@@ -1497,6 +1497,10 @@ def : InstAlias<"mov $seg, $mem", (MOV32ms i32mem:$mem, SEGMENT_REG:$seg)>;
 // Match 'movq <largeimm>, <reg>' as an alias for movabsq.
 def : InstAlias<"movq $imm, $reg", (MOV64ri GR64:$reg, i64imm:$imm)>;
 
+// Match 'movq GR64, MMX' as an alias for movd.
+def : InstAlias<"movq $src, $dst", (MMX_MOVD64to64rr VR64:$dst, GR64:$src)>;
+def : InstAlias<"movq $src, $dst", (MMX_MOVD64from64rr GR64:$dst, VR64:$src)>;
+
 // movsd with no operands (as opposed to the SSE scalar move of a double) is an
 // alias for movsl. (as in rep; movsd)
 def : InstAlias<"movsd", (MOVSD)>;
index b8b093c19b86e502b1cf42cf6d0f816186f51a4d..f1a14e871f1382522a3d5f625c7d54b5b7c49328 100644 (file)
@@ -902,3 +902,10 @@ mov %gs, (%rsi)  // CHECK: movl    %gs, (%rsi) # encoding: [0x8c,0x2e]
        idiv    0x7eed,%eax
        idiv    0xbabecafe,%eax
        idiv    0x12345678,%eax
+
+// PR8524
+movd   %rax, %mm5 // CHECK: movd %rax, %mm5 # encoding: [0x48,0x0f,0x6e,0xe8]
+movd   %mm5, %rbx // CHECK: movd %mm5, %rbx # encoding: [0x48,0x0f,0x7e,0xeb]
+movq   %rax, %mm5 // CHECK: movd %rax, %mm5 # encoding: [0x48,0x0f,0x6e,0xe8]
+movq   %mm5, %rbx // CHECK: movd %mm5, %rbx # encoding: [0x48,0x0f,0x7e,0xeb]
+