Hi!

For movrs<mode> the insn was using insn suffix unconditionally, so
movrsl or movrsq even for -masm=intel, when gas expects movrs and derives
what size of insn it is from the operands.

There is no movrs effective target, so I've just used dg-do compile with
scan-assembler to test it instead of dg-do assemble.

Bootstrapped/regtested on x86_64-linux and i686-linux, approved by Uros
in the PR, committed to trunk so far.

2026-03-13  Jakub Jelinek  <[email protected]>

        PR target/124461
        * config/i386/i386.md (movrs<mode>): Use <imodesuffix> only for
        -masm=att, not for -masm=intel.

        * gcc.target/i386/movrs-pr124461.c: New test.

--- gcc/config/i386/i386.md.jj  2026-03-05 11:24:50.512438191 +0100
+++ gcc/config/i386/i386.md     2026-03-12 12:49:52.467929549 +0100
@@ -30796,7 +30796,7 @@ (define_insn "movrs<mode>"
       [(match_operand:SWI1248x 1 "memory_operand" "m")]
       UNSPECV_MOVRS))]
   "TARGET_MOVRS && TARGET_64BIT"
-  "movrs<imodesuffix>\t{%1, %0|%0, %1}"
+  "movrs{<imodesuffix>}\t{%1, %0|%0, %1}"
   [(set_attr "prefix" "orig")
    (set_attr "type" "other")
    (set_attr "mode" "<MODE>")])
--- gcc/testsuite/gcc.target/i386/movrs-pr124461.c.jj   2026-03-12 
12:57:41.784050100 +0100
+++ gcc/testsuite/gcc.target/i386/movrs-pr124461.c      2026-03-12 
13:01:06.108620234 +0100
@@ -0,0 +1,19 @@
+/* PR target/124461 */
+/* { dg-do compile { target { masm_intel && { ! ia32 } } } } */
+/* { dg-options "-O2 -mmovrs -masm=intel" } */
+/* { dg-final { scan-assembler "\tmovrs\teax, DWORD PTR \\\[\[er]di\\\]" } } */
+/* { dg-final { scan-assembler "\tmovrs\trax, QWORD PTR \\\[\[er]di\\\]" } } */
+
+#include <x86intrin.h>
+
+int
+foo (const void *p)
+{
+  return _movrs_i32 (p);
+}
+
+long long
+bar (const void *p)
+{
+  return _movrs_i64 (p);
+}

        Jakub

Reply via email to