[PATCH] D41595: Incorrect operand sizes for some MMX instructions: punpcklwd, punpcklbw and punpckldq
Andrew V. Tischenko via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Dec 27 06:05:21 PST 2017
avt77 created this revision.
avt77 added reviewers: RKSimon, spatel, dtemirbulatov.
It's a fix for Bug 33838 - Incorrect operand sizes for MMX instructions: I changed the description of the instrs in td file. When I was working with this issue I seriously changed the debug logging for asm-matcher but I decided to introduce those changes in a separate patch which will be published soon.
https://reviews.llvm.org/D41595
Files:
lib/Target/X86/X86InstrMMX.td
test/MC/X86/punpack-intel.s
Index: test/MC/X86/punpack-intel.s
===================================================================
--- test/MC/X86/punpack-intel.s
+++ test/MC/X86/punpack-intel.s
@@ -0,0 +1,16 @@
+; RUN: not llvm-mc -x86-asm-syntax=intel -triple=x86_64 < %s 2>&1 | FileCheck %s
+
+; CHECK: punpcklbw
+punpcklbw mm0, dword ptr [rsp]
+; CHECK: punpcklwd
+punpcklwd mm0, dword ptr [rsp]
+; CHECK: punpckldq
+punpckldq mm0, dword ptr [rsp]
+
+; CHECK: error: invalid operand for instruction
+punpcklbw mm0, qword ptr [rsp]
+; CHECK: error: invalid operand for instruction
+punpcklwd mm0, word ptr [rsp]
+; CHECK: error: invalid operand for instruction
+punpckldq mm0, qword ptr [rsp]
+
Index: lib/Target/X86/X86InstrMMX.td
===================================================================
--- lib/Target/X86/X86InstrMMX.td
+++ lib/Target/X86/X86InstrMMX.td
@@ -109,6 +109,23 @@
(bitconvert (load_mmx addr:$src2))))],
itins.rm>, Sched<[itins.Sched.Folded, ReadAfterLd]>;
}
+ // MMXI_binop_rm32_int is like MMXI_binop_rm_int above but for mem32 input
+ multiclass MMXI_binop_rm32_int<bits<8> opc, string OpcodeStr, Intrinsic IntId,
+ OpndItins itins, bit Commutable = 0> {
+ def irr : MMXI<opc, MRMSrcReg, (outs VR64:$dst),
+ (ins VR64:$src1, VR64:$src2),
+ !strconcat(OpcodeStr, "\t{$src2, $dst|$dst, $src2}"),
+ [(set VR64:$dst, (IntId VR64:$src1, VR64:$src2))], itins.rr>,
+ Sched<[itins.Sched]> {
+ let isCommutable = Commutable;
+ }
+ def irm : MMXI<opc, MRMSrcMem, (outs VR64:$dst),
+ (ins VR64:$src1, i32mem:$src2),
+ !strconcat(OpcodeStr, "\t{$src2, $dst|$dst, $src2}"),
+ [(set VR64:$dst, (IntId VR64:$src1,
+ (bitconvert (load_mmx addr:$src2))))],
+ itins.rm>, Sched<[itins.Sched.Folded, ReadAfterLd]>;
+ }
multiclass MMXI_binop_rmi_int<bits<8> opc, bits<8> opc2, Format ImmForm,
string OpcodeStr, Intrinsic IntId,
@@ -522,13 +539,13 @@
defm MMX_PUNPCKHDQ : MMXI_binop_rm_int<0x6A, "punpckhdq",
int_x86_mmx_punpckhdq,
MMX_UNPCK_H_ITINS>;
-defm MMX_PUNPCKLBW : MMXI_binop_rm_int<0x60, "punpcklbw",
+defm MMX_PUNPCKLBW : MMXI_binop_rm32_int<0x60, "punpcklbw",
int_x86_mmx_punpcklbw,
MMX_UNPCK_L_ITINS>;
-defm MMX_PUNPCKLWD : MMXI_binop_rm_int<0x61, "punpcklwd",
+defm MMX_PUNPCKLWD : MMXI_binop_rm32_int<0x61, "punpcklwd",
int_x86_mmx_punpcklwd,
MMX_UNPCK_L_ITINS>;
-defm MMX_PUNPCKLDQ : MMXI_binop_rm_int<0x62, "punpckldq",
+defm MMX_PUNPCKLDQ : MMXI_binop_rm32_int<0x62, "punpckldq",
int_x86_mmx_punpckldq,
MMX_UNPCK_L_ITINS>;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D41595.128227.patch
Type: text/x-patch
Size: 3051 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20171227/70ef8078/attachment.bin>
More information about the llvm-commits
mailing list