https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84614
Bug ID: 84614 Summary: [8 Regression] wrong code with u16->u128 extension at aarch64 -fno-split-wide-types -g3 --param=max-combine-insns=3 Product: gcc Version: 8.0 Status: UNCONFIRMED Keywords: wrong-code Severity: normal Priority: P3 Component: rtl-optimization Assignee: unassigned at gcc dot gnu.org Reporter: zsojka at seznam dot cz Target Milestone: --- Host: x86_64-pc-linux-gnu Target: aarch64-unknown-linux-gnu Build: x86_64-pc-linux-gnu Created attachment 43528 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=43528&action=edit reduced testcase Output: $ aarch64-unknown-linux-gnu-gcc -Og -fno-split-wide-types -fno-tree-coalesce-vars -g --param=max-combine-insns=3 testcase.c -static $ ./a.out qemu: uncaught target signal 6 (Aborted) - core dumped Aborted The only extra 3-insns combination is: ... Trying 2, 16 -> 27: 2: r102:SI=zero_extend(x0:HI) REG_DEAD x0:HI 16: r105:SI=~r102:SI REG_DEAD r102:SI 27: r109:TI#0=zero_extend(r105:SI#0) REG_DEAD r105:SI ... deferring deletion of insn with uid = 2. modifying insn i2 16: r105:DI=~x0:DI REG_DEAD x0:HI deferring rescan insn with uid = 16. modifying insn i3 27: r109:TI#0=zero_extend(r105:DI#0) REG_DEAD r105:DI deferring rescan insn with uid = 27. ... which looks wrong, because the original does: r109:TI=zero_ext(~r102:SI)=zero_ext(~x0:HI) "e = 0 - d" but the new isns do: r109:TI=zero_ext(~x0:DI) "e = 0 - (u32)d" (extends to DI before ~) -g needs to be present, and there is a -fcompare-debug failure: $ aarch64-unknown-linux-gnu-gcc -Og -fno-split-wide-types -fno-tree-coalesce-vars -g --param=max-combine-insns=3 testcase.c -static -fcompare-debug aarch64-unknown-linux-gnu-gcc: error: testcase.c: -fcompare-debug failure (length) so it seems that debug insns affect this combination. $ aarch64-unknown-linux-gnu-gcc -v Using built-in specs. COLLECT_GCC=/repo/gcc-trunk/binary-latest-aarch64/bin/aarch64-unknown-linux-gnu-gcc COLLECT_LTO_WRAPPER=/repo/gcc-trunk/binary-trunk-258031-checking-yes-rtl-df-extra-aarch64/bin/../libexec/gcc/aarch64-unknown-linux-gnu/8.0.1/lto-wrapper Target: aarch64-unknown-linux-gnu Configured with: /repo/gcc-trunk//configure --enable-languages=c,c++ --enable-valgrind-annotations --disable-nls --enable-checking=yes,rtl,df,extra --with-cloog --with-ppl --with-isl --with-sysroot=/usr/aarch64-unknown-linux-gnu --build=x86_64-pc-linux-gnu --host=x86_64-pc-linux-gnu --target=aarch64-unknown-linux-gnu --with-ld=/usr/bin/aarch64-unknown-linux-gnu-ld --with-as=/usr/bin/aarch64-unknown-linux-gnu-as --disable-libstdcxx-pch --prefix=/repo/gcc-trunk//binary-trunk-258031-checking-yes-rtl-df-extra-aarch64 Thread model: posix gcc version 8.0.1 20180227 (experimental) (GCC) Tested revisions: r258031 - FAIL r257139 - FAIL 7-branch r257043 - OK