Bug 33732 - [4.3 Regression] gcc.c-torture/execute/longlong.c execution at -O3
Summary: [4.3 Regression] gcc.c-torture/execute/longlong.c execution at -O3
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: rtl-optimization (show other bugs)
Version: 4.3.0
: P1 normal
Target Milestone: 4.3.0
Assignee: Eric Botcazou
URL: http://gcc.gnu.org/ml/gcc-patches/200...
Keywords: wrong-code
Depends on:
Blocks:
 
Reported: 2007-10-11 02:04 UTC by John David Anglin
Modified: 2007-11-09 12:51 UTC (History)
3 users (show)

See Also:
Host: hppa-unknown-linux-gnu
Target: hppa-unknown-linux-gnu
Build: hppa-unknown-linux-gnu
Known to work:
Known to fail:
Last reconfirmed: 2007-11-04 09:58:11


Attachments
longlong.s2 (2.05 KB, text/plain)
2007-10-20 20:53 UTC, dave
Details
longlong.s3 (2.22 KB, text/plain)
2007-10-20 20:53 UTC, dave
Details
longlong.c.174r.lreg (5.02 KB, text/plain)
2007-10-22 01:30 UTC, dave
Details
longlong.c.175r.greg (7.03 KB, text/plain)
2007-10-22 01:30 UTC, dave
Details

Note You need to log in before you can comment on or make changes to this bug.
Description John David Anglin 2007-10-11 02:04:20 UTC
Executing on host: /home/dave/gcc-4.3/objdir/gcc/xgcc -B/home/dave/gcc-4.3/objdi
r/gcc/ /home/dave/gcc-4.3/gcc/gcc/testsuite/gcc.c-torture/execute/longlong.c  -w
  -O2  -fno-show-column  -lm   -o /home/dave/gcc-4.3/objdir/gcc/testsuite/gcc/lo
nglong.x2    (timeout = 300)
PASS: gcc.c-torture/execute/longlong.c compilation,  -O2
Setting LD_LIBRARY_PATH to :/home/dave/gcc-4.3/objdir/gcc::/home/dave/gcc-4.3/ob
jdir/gcc:/home/dave/gcc-4.3/objdir/hppa-linux/libstdc++-v3/.libs:/home/dave/gcc-
4.3/objdir/hppa-linux/libmudflap/.libs:/home/dave/gcc-4.3/objdir/hppa-linux/libs
sp/.libs:/home/dave/gcc-4.3/objdir/hppa-linux/libgomp/.libs:/home/dave/gcc-4.3/o
bjdir/./gcc:/home/dave/gcc-4.3/objdir/./prev-gcc
PASS: gcc.c-torture/execute/longlong.c execution,  -O2
Executing on host: /home/dave/gcc-4.3/objdir/gcc/xgcc -B/home/dave/gcc-4.3/objdi
r/gcc/ /home/dave/gcc-4.3/gcc/gcc/testsuite/gcc.c-torture/execute/longlong.c  -w
  -O3 -fomit-frame-pointer  -fno-show-column  -lm   -o /home/dave/gcc-4.3/objdir
/gcc/testsuite/gcc/longlong.x3    (timeout = 300)
PASS: gcc.c-torture/execute/longlong.c compilation,  -O3 -fomit-frame-pointer
Setting LD_LIBRARY_PATH to :/home/dave/gcc-4.3/objdir/gcc::/home/dave/gcc-4.3/ob
jdir/gcc:/home/dave/gcc-4.3/objdir/hppa-linux/libstdc++-v3/.libs:/home/dave/gcc-
4.3/objdir/hppa-linux/libmudflap/.libs:/home/dave/gcc-4.3/objdir/hppa-linux/libs
sp/.libs:/home/dave/gcc-4.3/objdir/hppa-linux/libgomp/.libs:/home/dave/gcc-4.3/o
bjdir/./gcc:/home/dave/gcc-4.3/objdir/./prev-gcc
FAIL: gcc.c-torture/execute/longlong.c execution,  -O3 -fomit-frame-pointer

(gdb) p b
$4 = {0, 0, 48, 0 <repeats 14 times>, 3160194, 0 <repeats 14 times>}

This failure is probably caused by the tree-sra.c changes by Alex.  Fails
with stage1 compiler.
Comment 1 dave 2007-10-20 20:53:06 UTC
Subject: Re:   New:
	gcc.c-torture/execute/longlong.c execution at -O3

Comparing 4.2 to 4.3, the significant difference in main appears to be:

4.2)

        ldw 140(%r20),%r19      ;, tmp115
	extru %r19,31,3,%r29    ; tmp115,, tmp113
	zdep %r28,28,29,%r21    ;,,
	extru %r29,2,3,%r19     ; tmp113,, tmp117
	zdep %r29,28,29,%r22    ; tmp113,, tmp116
	or %r19,%r21,%r21       ; tmp117,,
	ldi 0,%r28      ;, tmp122

4.3)

        ldw 140(%r20),%r28      ;, tmp115
	zdep %r28,28,3,%r24     ; tmp115,,, tmp116
	ldi 0,%r28      ;, tmp122

Dave
Comment 2 dave 2007-10-20 20:53:07 UTC
Created attachment 14377 [details]
longlong.s2
Comment 3 dave 2007-10-20 20:53:07 UTC
Created attachment 14378 [details]
longlong.s3
Comment 4 John David Anglin 2007-10-22 00:43:54 UTC
The actual code that is wrong is the following:

0x00010670 <main+176>:  ldw 10(r20),r19
0x00010674 <main+180>:  uaddcm r0,r23,r21
0x00010678 <main+184>:  uaddcm r0,r24,r22
0x0001067c <main+188>:  depw,z r19,30,31,r19
0x00010680 <main+192>:  subi 1f,r22,r21
0x00010684 <main+196>:  mtsar r21
0x00010688 <main+200>:  depw,z r19,sar,32,r19
0x0001068c <main+204>:  b,l 0x10648 <main+136>,r0
0x00010690 <main+208>:  or r19,r21,r21

The 4.2 code is:

0x00010650 <main+192>:  uaddcm r0,r21,ret0
0x00010654 <main+196>:  uaddcm r0,r22,ret1
0x00010658 <main+200>:  mtsar r22
0x0001065c <main+204>:  ldw 10(r20),r20
0x00010660 <main+208>:  ldw 4(r31),r19
0x00010664 <main+212>:  subi 1f,ret1,ret1
0x00010668 <main+216>:  shrpw r0,r19,sar,r24
0x0001066c <main+220>:  depw,z r20,30,31,ret0
0x00010670 <main+224>:  mtsar ret1
0x00010674 <main+228>:  depw,z ret0,sar,32,ret0
0x00010678 <main+232>:  b,l 0x10628 <main+152>,r0
0x0001067c <main+236>:  or ret0,r24,r24

The 4.3 code is missing the load at 0x00010660 and the shift at
0x00010668.  Also, the shift amount somehow ends up being or'ed
into the result of the calculation (r21), leading to the abort.
Comment 5 dave 2007-10-22 01:30:02 UTC
Subject: Re:  gcc.c-torture/execute/longlong.c
	execution at -O3

Things appear to go wrong in the greg pass:

(insn 73 133 70 4 /home/dave/gnu/gcc-4.3/gcc/gcc/testsuite/gcc.c-torture/execute
/longlong.c:19 (set (reg:SI 21 %r21 [orig:154+4 ] [154])
        (lshiftrt:SI (reg:SI 28 %r28 [141])
    (reg:SI 88 SAR))) 190 {lshrsi3} (nil))

(insn 70 73 134 4 /home/dave/gnu/gcc-4.3/gcc/gcc/testsuite/gcc.c-torture/execute
/longlong.c:19 (set (reg:SI 21 %r21)
	(minus:SI (const_int 31 [0x1f])
    (reg:SI 22 %r22 [orig:137+4 ] [137]))) 119 {*pa.md:5698} (nil))

The use of register r21 in insn 73 is clobbered by the use in insn 70.

Dave
Comment 6 dave 2007-10-22 01:30:03 UTC
Created attachment 14383 [details]
longlong.c.174r.lreg
Comment 7 dave 2007-10-22 01:30:03 UTC
Created attachment 14384 [details]
longlong.c.175r.greg
Comment 8 Eric Botcazou 2007-11-04 09:57:52 UTC
By visual inspection.
Comment 9 Eric Botcazou 2007-11-04 09:58:11 UTC
Investigating.
Comment 10 Eric Botcazou 2007-11-09 12:50:09 UTC
Subject: Bug 33732

Author: ebotcazou
Date: Fri Nov  9 12:49:55 2007
New Revision: 130042

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=130042
Log:
	PR rtl-optimization/33732
	* reload.c (push_reload): Check that the REG_DEAD note was referring
	to a hardreg or to a pseudo that has been assigned exactly one hardreg
	before considering it in order to select the reload register.
	(combine_reloads): Likewise.
	(find_dummy_reload): Likewise.


Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/reload.c

Comment 11 Eric Botcazou 2007-11-09 12:51:49 UTC
Thanks for the preliminary analysis.