https://gcc.gnu.org/bugzilla/show_bug.cgi?id=124294
Bug ID: 124294
Summary: wrong operand order of "vmovw" of xmm16 with
-masm=intel
Product: gcc
Version: 16.0
Status: UNCONFIRMED
Keywords: wrong-code
Severity: normal
Priority: P3
Component: target
Assignee: unassigned at gcc dot gnu.org
Reporter: zsojka at seznam dot cz
Target Milestone: ---
Host: x86_64-pc-linux-gnu
Target: x86_64-pc-linux-gnu
Created attachment 63794
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=63794&action=edit
auto-reduced testcase
The attached code is miscompiled with -masm=intel, according to the assembler
and disassembler.
$ x86_64-pc-linux-gnu-gcc -fwrapv -mavx10.2 -O1 -masm=intel xxx.c -o ai.o
-save-temps -w
$ grep vmovw ai.o-xxx.s
vmovw xmm5, xmm16
vmovw eax, xmm7
vmovw ecx, xmm9
$ x86_64-pc-linux-gnu-gcc -fwrapv -mavx10.2 -O1 xxx.c -o ag.o -save-temps -w
$ grep vmovw ag.o-xxx.s
vmovw %xmm5, %xmm16
vmovw %xmm7, %eax
vmovw %xmm9, %ecx
$ objdump -S ag.o > ag.S
$ objdump -S ai.o > ai.S
$ diff -u ai.S ag.S
--- ai.S 2026-02-27 19:30:37.543465472 +0100
+++ ag.S 2026-02-27 19:30:36.279090718 +0100
@@ -1,5 +1,5 @@
-ai.o: file format elf64-x86-64
+ag.o: file format elf64-x86-64
Disassembly of section .init:
@@ -135,7 +135,7 @@
4011a3: ff
4011a4: 62 71 7d 48 fc 1d 12 vpaddb 0x2f12(%rip),%zmm0,%zmm11
# 4040c0 <foo0_v512s64_0>
4011ab: 2f 00 00
- 4011ae: 62 b5 7e 08 6e e8 vmovw %xmm16,%xmm5
+ 4011ae: 62 e5 7e 08 6e c5 vmovw %xmm5,%xmm16
4011b4: c5 79 7e c8 vmovd %xmm9,%eax
4011b8: c5 79 6e f8 vmovd %eax,%xmm15
4011bc: c5 f9 6f 05 4c 0e 00 vmovdqa 0xe4c(%rip),%xmm0 #
402010 <_IO_stdin_used+0x10>
$ x86_64-pc-linux-gnu-gcc -v
Using built-in specs.
COLLECT_GCC=/repo/gcc-trunk/binary-latest-amd64//bin/x86_64-pc-linux-gnu-gcc
COLLECT_LTO_WRAPPER=/repo/gcc-trunk/binary-trunk-20260226181826-r16-7743-g132139c00a8ed6-checking-yes-rtl-df-extra-nobootstrap-amd64/bin/../libexec/gcc/x86_64-pc-linux-gnu/16.0.1/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: /repo/gcc-trunk//configure --enable-languages=c,c++
--enable-valgrind-annotations --disable-nls --enable-checking=yes,rtl,df,extra
--disable-bootstrap --enable-libsanitizer --build=x86_64-pc-linux-gnu
--host=x86_64-pc-linux-gnu --target=x86_64-pc-linux-gnu
--with-ld=/usr/bin/x86_64-pc-linux-gnu-ld
--with-as=/usr/bin/x86_64-pc-linux-gnu-as --disable-libstdcxx-pch
--prefix=/repo/gcc-trunk//binary-trunk-20260226181826-r16-7743-g132139c00a8ed6-checking-yes-rtl-df-extra-nobootstrap-amd64
Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 16.0.1 20260226 (experimental) (GCC)