This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug target/81291] [5/6/7/8 Regression] wrong code with -O2 -fno-rerun-cse-after-loop -fno-tree-ter -fno-tree-vrp -funroll-loops due to improper carry
- From: "zsojka at seznam dot cz" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Tue, 04 Jul 2017 10:27:03 +0000
- Subject: [Bug target/81291] [5/6/7/8 Regression] wrong code with -O2 -fno-rerun-cse-after-loop -fno-tree-ter -fno-tree-vrp -funroll-loops due to improper carry
- Auto-submitted: auto-generated
- References: <bug-81291-4@http.gcc.gnu.org/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81291
--- Comment #1 from Zdenek Sojka <zsojka at seznam dot cz> ---
Created attachment 41673
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=41673&action=edit
testcase needing less compiler flags
$ powerpc-unknown-linux-gnu-gcc -Og -fgcse -fweb testcase.c
$ qemu-ppc ./a.out
qemu: uncaught target signal 6 (Aborted) - core dumped
Aborted
$ powerpc-unknown-linux-gnu-gcc -v
Using built-in specs.
COLLECT_GCC=/repo/gcc-trunk//binary-latest-powerpc/bin/powerpc-unknown-linux-gnu-gcc
COLLECT_LTO_WRAPPER=/repo/gcc-trunk/binary-trunk-249846-checking-yes-rtl-df-extra-nographite-powerpc/bin/../libexec/gcc/powerpc-unknown-linux-gnu/8.0.0/lto-wrapper
Target: powerpc-unknown-linux-gnu
Configured with: /repo/gcc-trunk//configure --enable-languages=c,c++
--enable-valgrind-annotations --disable-nls --enable-checking=yes,rtl,df,extra
--without-cloog --without-ppl --without-isl
--with-sysroot=/usr/powerpc-unknown-linux-gnu --build=x86_64-pc-linux-gnu
--host=x86_64-pc-linux-gnu --target=powerpc-unknown-linux-gnu
--with-ld=/usr/bin/powerpc-unknown-linux-gnu-ld
--with-as=/usr/bin/powerpc-unknown-linux-gnu-as --disable-libstdcxx-pch
--prefix=/repo/gcc-trunk//binary-trunk-249846-checking-yes-rtl-df-extra-nographite-powerpc
Thread model: posix
gcc version 8.0.0 20170630 (experimental) (GCC)
The situations seems to be the same as in comment #0:
$ cat testcase.c.259.init-regs
...
(insn 73 99 75 5 (parallel [
(set (reg:SI 185 [+4 ])
(minus:SI (const_int 0 [0])
(reg:SI 179 [ _5+4 ])))
(set (reg:SI 76 ca)
(leu:SI (reg:SI 179 [ _5+4 ])
(const_int 0 [0])))
]) "testcase.c":12 104 {subfsi3_carry}
(expr_list:REG_UNUSED (reg:SI 76 ca)
(nil)))
...
(insn 79 78 80 5 (parallel [
(set (reg:SI 187 [+4 ])
(plus:SI (reg:SI 189 [+4 ])
(const_int 1 [0x1])))
(set (reg:SI 76 ca)
(geu:SI (reg:SI 189 [+4 ])
(const_int -1 [0xffffffffffffffff])))
]) "testcase.c":14 79 {*addsi3_imm_carry_pos}
(expr_list:REG_DEAD (reg:SI 189 [+4 ])
(nil)))
(insn 80 79 102 5 (parallel [
(set (reg:SI 186)
(plus:SI (reg:SI 185 [+4 ])
(reg:SI 76 ca)))
(clobber (reg:SI 76 ca))
]) "testcase.c":14 85 {addsi3_carry_in_0}
(expr_list:REG_DEAD (reg:SI 185 [+4 ])
(expr_list:REG_DEAD (reg:SI 76 ca)
(expr_list:REG_UNUSED (reg:SI 76 ca)
(nil)))))
...
$ cat testcase.c.261.combine
...
Trying 73 -> 80:
Failed to match this instruction:
(parallel [
(set (reg:SI 186)
(const_int 1 [0x1]))
(clobber (reg:SI 76 ca))
])
Successfully matched this instruction:
(set (reg:SI 186)
(const_int 1 [0x1]))
allowing combination of insns 73 and 80
original costs 0 + 4 = 0
replacement cost 4
deferring deletion of insn with uid = 73.
deferring deletion of insn with uid = 73.
modifying insn i3 80: r186:SI=0x1
deferring rescan insn with uid = 80.
...
But the analysis I did in comment #0 is not correct, since I misunderstood some
of the semantics from the dumps.