https://sourceware.org/bugzilla/show_bug.cgi?id=24353

            Bug ID: 24353
           Summary: -Os doesn't work correcly
           Product: binutils
           Version: 2.33 (HEAD)
            Status: NEW
          Severity: normal
          Priority: P2
         Component: gas
          Assignee: unassigned at sourceware dot org
          Reporter: hjl.tools at gmail dot com
  Target Milestone: ---
            Target: i386

The assembler manual has

'-O0 | -O | -O1 | -O2 | -Os'
     Optimize instruction encoding with smaller instruction size.  '-O'
     and '-O1' encode 64-bit register load instructions with 64-bit
     immediate as 32-bit register load instructions with 31-bit or
     32-bits immediates and encode 64-bit register clearing instructions
     with 32-bit register clearing instructions.  '-O2' includes '-O1'
     optimization plus encodes 256-bit and 512-bit vector register
     clearing instructions with 128-bit vector register clearing
     instructions.  '-Os' includes '-O2' optimization plus encodes
     16-bit, 32-bit and 64-bit register tests with immediate as 8-bit
     register test with immediate.  '-O0' turns off this optimization.

But we got

[hjl@gnu-gram-1 testsuite]$ cat /tmp/x.s
vandnpd %zmm1, %zmm1, %zmm5
[hjl@gnu-gram-1 testsuite]$ as -O2 -o x.o /tmp/x.s
[hjl@gnu-gram-1 testsuite]$ objdump -dw x.o

x.o:     file format elf64-x86-64


Disassembly of section .text:

0000000000000000 <.text>:
   0:   c5 f1 55 e9             vandnpd %xmm1,%xmm1,%xmm5
[hjl@gnu-gram-1 testsuite]$ as -Os -o x.o /tmp/x.s
[hjl@gnu-gram-1 testsuite]$ objdump -dw x.o

x.o:     file format elf64-x86-64


Disassembly of section .text:

0000000000000000 <.text>:
   0:   62 f1 f5 48 55 e9       vandnpd %zmm1,%zmm1,%zmm5
[hjl@gnu-gram-1 testsuite]$ 

-Os didn't enable -O2.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
bug-binutils mailing list
bug-binutils@gnu.org
https://lists.gnu.org/mailman/listinfo/bug-binutils

Reply via email to