https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103710
Bug ID: 103710 Summary: Missed optimization: common bit prefix/suffixes of multiple values Product: gcc Version: 11.2.1 Status: UNCONFIRMED Severity: normal Priority: P3 Component: rtl-optimization Assignee: unassigned at gcc dot gnu.org Reporter: jengelh at inai dot de Target Milestone: --- Environment: ยป ./xgcc -v ... Reading specs from /home/jengelh/repos/gcc/host-x86_64-pc-linux-gnu/gcc/specs COLLECT_GCC=./xgcc Target: x86_64-pc-linux-gnu Configured with: ./configure --enable-languages=c,c++ Thread model: posix Supported LTO compression algorithms: zlib zstd gcc version 12.0.0 20211214 (experimental) (GCC) COLLECT_GCC_OPTIONS='-v' '-B' '/home/jengelh/repos/gcc/host-x86_64-pc-linux-gnu/gcc' '-D' 'noexcept=' '-c' '-O2' '-mtune=generic' '-march=x86-64' GNU C17 (GCC) version 12.0.0 20211214 (experimental) (x86_64-pc-linux-gnu) compiled by GNU C version 11.2.1 20211124 [revision 7510c23c1ec53aa4a62705f0384079661342ff7b], GMP version 6.2.1, MPFR version 4.1.0-p7, MPC version 1.2.1, isl version none GGC heuristics: --param ggc-min-expand=30 --param ggc-min-heapsize=4096 Input: attachment #0 Observed output: $ ./xgcc -B. -x c++ -c -O2 t.cpp && readelf -a t.o | grep fct 3: 0000000000000000 54 FUNC GLOBAL DEFAULT 1 _Z4fct0j 4: 0000000000000040 54 FUNC GLOBAL DEFAULT 1 _Z4fct4j 5: 0000000000000080 54 FUNC GLOBAL DEFAULT 1 _Z4fct8j 6: 00000000000000c0 54 FUNC GLOBAL DEFAULT 1 _Z5fct12j 7: 0000000000000100 54 FUNC GLOBAL DEFAULT 1 _Z5fct16j 8: 0000000000000140 54 FUNC GLOBAL DEFAULT 1 _Z5fct20j 9: 0000000000000180 38 FUNC GLOBAL DEFAULT 1 _Z5fct24j 10: 00000000000001b0 32 FUNC GLOBAL DEFAULT 1 _Z5fct25j 11: 00000000000001d0 35 FUNC GLOBAL DEFAULT 1 _Z6fctmaxj Desired output: Provided I made no mistake in the equivalency of all fct functions, the fct functions should, preferably, all compile to the same machine code.