public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/103252] New: questionable codegen with kmovd
@ 2021-11-15 14:58 jason at zx2c4 dot com
  2021-11-15 15:18 ` [Bug c/103252] " jason at zx2c4 dot com
                   ` (14 more replies)
  0 siblings, 15 replies; 16+ messages in thread
From: jason at zx2c4 dot com @ 2021-11-15 14:58 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103252

            Bug ID: 103252
           Summary: questionable codegen with kmovd
           Product: gcc
           Version: 11.2.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: jason at zx2c4 dot com
  Target Milestone: ---

Created attachment 51798
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=51798&action=edit
preprocessed source

gcc 11.2 with -march=native is generating avx512 code that seems less efficient
than the non avx512 case, for inet_aton_end in glibc 2.34.

Non-avx512 (-march=skylake):

mov     ecx, ds:(__libc_tsd_CTYPE_B_tpoff - _GLOBAL_OFFSET_TABLE_)[ebx]
mov     ecx, gs:[ecx]

Avx512:

kmovd   k0, ds:(__libc_tsd_CTYPE_B_tpoff - _GLOBAL_OFFSET_TABLE_)[ebx]
kmovd   edx, k0
kmovd   k0, dword ptr gs:[edx]
kmovd   edx, k0

Command line is:

thinkpad /var/tmp/portage/sys-libs/glibc-2.34-r2/work/glibc-2.34/resolv #
x86_64-pc-linux-gnu-gcc -m32 -march=native -pipe -O2 -Wl,-O1 -Wl,--as-needed
inet_addr.c -c -std=gnu11 -fgnu89-inline  -march=native -pipe -O2 -Wall
-Wwrite-strings -Wundef -fmerge-all-constants -frounding-math
-fstack-protector-strong -fno-common -Wstrict-prototypes -Wold-style-definition
-fmath-errno    -Wa,-mtune=i686   -ftls-model=initial-exec   -U_FORTIFY_SOURCE 
 -I../include
-I/var/tmp/portage/sys-libs/glibc-2.34-r2/work/build-x86-x86_64-pc-linux-gnu-nptl/resolv

-I/var/tmp/portage/sys-libs/glibc-2.34-r2/work/build-x86-x86_64-pc-linux-gnu-nptl
 -I../sysdeps/unix/sysv/linux/i386/i686  -I../sysdeps/i386/i686/nptl 
-I../sysdeps/unix/sysv/linux/i386  -I../sysdeps/unix/sysv/linux/x86/include
-I../sysdeps/unix/sysv/linux/x86  -I../sysdeps/x86/nptl  -I../sysdeps/i386/nptl
 -I../sysdeps/unix/sysv/linux/include -I../sysdeps/unix/sysv/linux 
-I../sysdeps/nptl  -I../sysdeps/pthread  -I../sysdeps/gnu 
-I../sysdeps/unix/inet  -I../sysdeps/unix/sysv  -I../sysdeps/unix/i386 
-I../sysdeps/unix  -I../sysdeps/posix  -I../sysdeps/i386/i686/fpu/multiarch 
-I../sysdeps/i386/i686/fpu  -I../sysdeps/i386/i686/multiarch 
-I../sysdeps/i386/i686  -I../sysdeps/i386/fpu  -I../sysdeps/x86/fpu 
-I../sysdeps/i386  -I../sysdeps/x86/include -I../sysdeps/x86 
-I../sysdeps/wordsize-32  -I../sysdeps/ieee754/float128 
-I../sysdeps/ieee754/ldbl-96/include -I../sysdeps/ieee754/ldbl-96 
-I../sysdeps/ieee754/dbl-64  -I../sysdeps/ieee754/flt-32  -I../sysdeps/ieee754 
-I../sysdeps/generic  -I.. -I../libio -I. -nostdinc -isystem
/usr/lib/gcc/x86_64-pc-linux-gnu/11.2.0/include -isystem
/usr/lib/gcc/x86_64-pc-linux-gnu/11.2.0/include-fixed -isystem /usr/include
-D_LIBC_REENTRANT -include
/var/tmp/portage/sys-libs/glibc-2.34-r2/work/build-x86-x86_64-pc-linux-gnu-nptl/libc-modules.h
-DMODULE_NAME=libc -include ../include/libc-symbols.h  -DPIC    
-DTOP_NAMESPACE=glibc -o
/var/tmp/portage/sys-libs/glibc-2.34-r2/work/build-x86-x86_64-pc-linux-gnu-nptl/resolv/inet_addr.o
-MD -MP -MF
/var/tmp/portage/sys-libs/glibc-2.34-r2/work/build-x86-x86_64-pc-linux-gnu-nptl/resolv/inet_addr.o.dt
-MT
/var/tmp/portage/sys-libs/glibc-2.34-r2/work/build-x86-x86_64-pc-linux-gnu-nptl/resolv/inet_addr.o

And the preprocessed -E source is attached. This was noticed during
investigating https://www.sourceware.org/bugzilla/show_bug.cgi?id=28595 , which
seems likely to be a binutils or glibc bug instead. But nonetheless, the code
gen here seems surprising.

^ permalink raw reply	[flat|nested] 16+ messages in thread

end of thread, other threads:[~2021-11-24  5:47 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-15 14:58 [Bug c/103252] New: questionable codegen with kmovd jason at zx2c4 dot com
2021-11-15 15:18 ` [Bug c/103252] " jason at zx2c4 dot com
2021-11-15 17:10 ` jason at zx2c4 dot com
2021-11-15 17:52 ` [Bug target/103252] " jakub at gcc dot gnu.org
2021-11-15 17:59 ` pinskia at gcc dot gnu.org
2021-11-15 18:07 ` jason at zx2c4 dot com
2021-11-16  1:20 ` crazylht at gmail dot com
2021-11-16  9:29 ` rguenth at gcc dot gnu.org
2021-11-16 11:51 ` jason at zx2c4 dot com
2021-11-16 11:56 ` jakub at gcc dot gnu.org
2021-11-16 12:06 ` jason at zx2c4 dot com
2021-11-18  7:09 ` crazylht at gmail dot com
2021-11-18  8:26 ` crazylht at gmail dot com
2021-11-19  2:42 ` crazylht at gmail dot com
2021-11-19  6:27 ` crazylht at gmail dot com
2021-11-24  5:47 ` crazylht at gmail dot com

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).