https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113729
Bug ID: 113729
Summary: Missing APX NDD optimization
Product: gcc
Version: 14.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: target
Assignee: unassigned at gcc dot gnu.org
Reporter: hjl.tools at gmail dot com
CC: crazylht at gmail dot com, hongyuw at gcc dot gnu.org
Target Milestone: ---
Target: x86-64
APX spec has
---
Unlike the merge-upper behavior at a destination register of a typical x86
integer instruction when OSIZE
is 8b or 16b, the NDD register is always zero-uppered
---
But GCC 14 generates:
[hjl@gnu-tgl-3 pr113711]$ cat b.c
extern unsigned char b;
unsigned int
foo (void)
{
return 200 + b;
}
[hjl@gnu-tgl-3 pr113711]$ make b.s
/export/build/gnu/tools-build/gcc-gitlab-debug/build-x86_64-linux/gcc/xgcc
-B/export/build/gnu/tools-build/gcc-gitlab-debug/build-x86_64-linux/gcc/ -mapxf
-O3 -S b.c
[hjl@gnu-tgl-3 pr113711]$ cat b.s
.file "b.c"
.text
.p2align 4
.globl foo
.type foo, @function
foo:
.LFB0:
.cfi_startproc
movzbl b(%rip), %eax
addl $200, %eax
ret
.cfi_endproc
.LFE0:
.size foo, .-foo
.ident "GCC: (GNU) 14.0.1 20240202 (experimental)"
.section .note.G
[hjl@gnu-tgl-3 pr113711]$
addb $200, b(%rip), %al
should be generated.