]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
x86-64: Use `movsxd` to perform SI-to-DI extension in Intel syntax
authorLIU Hao <lh_mouse@126.com>
Sat, 25 Oct 2025 09:19:34 +0000 (17:19 +0800)
committerUros Bizjak <ubizjak@gmail.com>
Sun, 26 Oct 2025 16:28:08 +0000 (17:28 +0100)
Although there's no possibility of ambiguity, Intel manual says the mnemonic
for DWORD-to-QWORD sign-extension operation should be MOVSXD. Some assemblers
(GNU AS, NASM) also overload MOVSX, but some others don't accept MOVSX (LLVM,
MASM, YASM in NASM mode) and require MOVSXD.

This mnemonic was introduced in r0-34259-g123bf9e3f4056d in 2001, and has not
been updated ever since.

gcc/ChangeLog:

PR target/119079
* config/i386/i386.md: Use `movsxd` to perform SI-to-DI extension in Intel
syntax.

Signed-off-by: LIU Hao <lh_mouse@126.com>
(cherry picked from commit 66b38349273525dfb86f0f74d6c928abdbf7154f)

gcc/config/i386/i386.md

index 35a558cefc7e2b5d6d7d6533458ac997f3bc695e..fadd1ddf427c6de1e7fe98e9540aaaa570237775 100644 (file)
   "TARGET_64BIT"
   "@
    {cltq|cdqe}
-   movs{lq|x}\t{%1, %0|%0, %1}"
+   movs{lq|xd}\t{%1, %0|%0, %1}"
   [(set_attr "type" "imovx")
    (set_attr "mode" "DI")
    (set_attr "prefix_0f" "0")
   DONE;
 })
 
-
 ;; Avoid redundant prefixes by splitting HImode arithmetic to SImode.
 ;; Do not split instructions with mask registers.
 (define_split