public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/63302] New: [4.9,5.0 Regression] Code with 64-bit long long constants is miscompiled on 32-bit host
@ 2014-09-18 23:20 danglin at gcc dot gnu.org
2014-09-24 1:45 ` [Bug tree-optimization/63302] " danglin at gcc dot gnu.org
` (25 more replies)
0 siblings, 26 replies; 27+ messages in thread
From: danglin at gcc dot gnu.org @ 2014-09-18 23:20 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63302
Bug ID: 63302
Summary: [4.9,5.0 Regression] Code with 64-bit long long
constants is miscompiled on 32-bit host
Product: gcc
Version: 4.9.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: tree-optimization
Assignee: unassigned at gcc dot gnu.org
Reporter: danglin at gcc dot gnu.org
Host: hppa-unknown-linux-gnu
Target: hppa-unknown-linux-gnu
Build: hppa-unknown-linux-gnu
The following function from pa.c is miscompiled when generating a hppa64
cross compiler:
dave@mx3210:~/hardware/ldil$ cat ldil.c
#define HOST_WIDE_INT long long
int
pa_ldil_cint_p (HOST_WIDE_INT ival)
{
HOST_WIDE_INT x = ival & (((HOST_WIDE_INT) -1 << 31) | 0x7ff);
return x == 0 || x == ((HOST_WIDE_INT) -1 << 31);
}
gcc-4.9 -S -O1 ldil.c:
dave@mx3210:~/hardware/ldil$ cat ldil.s
.LEVEL 1.1
.text
.align 4
.globl pa_ldil_cint_p
.type pa_ldil_cint_p, @function
pa_ldil_cint_p:
.PROC
.CALLINFO FRAME=0,NO_CALLS
.ENTRY
extru %r26,31,11,%r28
comiclr,<> 0,%r28,%r28
ldi 1,%r28
bv,n %r0(%r2)
.EXIT
.PROCEND
.size pa_ldil_cint_p, .-pa_ldil_cint_p
.ident "GCC: (Debian 4.9.1-14) 4.9.1"
The high order bits are not checked in the assembly code. We have the
following in ldil.c.170r.expand:
pa_ldil_cint_p (long long int ival)
{
int _6;
long long int _8;
_Bool _9;
;; basic block 2, loop depth 0
;; pred: ENTRY
_8 = ival_1(D) & 2047;
_9 = _8 == 0;
_6 = (int) _9;
return _6;
;; succ: EXIT
}
This breaks 64-bit kernel build. 4.8 branch is ok.
^ permalink raw reply [flat|nested] 27+ messages in thread
* [Bug tree-optimization/63302] [4.9,5.0 Regression] Code with 64-bit long long constants is miscompiled on 32-bit host
2014-09-18 23:20 [Bug tree-optimization/63302] New: [4.9,5.0 Regression] Code with 64-bit long long constants is miscompiled on 32-bit host danglin at gcc dot gnu.org
@ 2014-09-24 1:45 ` danglin at gcc dot gnu.org
2014-09-26 13:01 ` [Bug tree-optimization/63302] [4.9 " danglin at gcc dot gnu.org
` (24 subsequent siblings)
25 siblings, 0 replies; 27+ messages in thread
From: danglin at gcc dot gnu.org @ 2014-09-24 1:45 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63302
--- Comment #1 from John David Anglin <danglin at gcc dot gnu.org> ---
This is with:
dave@mx3210:~/debian/gcc/gcc/gcc-4.9-4.9.1$ gcc-4.9 -v
Using built-in specs.
COLLECT_GCC=/usr/bin/gcc-4.9.real
COLLECT_LTO_WRAPPER=/usr/lib/gcc/hppa-linux-gnu/4.9/lto-wrapper
Target: hppa-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Debian 4.9.1-14+b1'
--with-bugurl=file:///usr/share/doc/gcc-4.9/README.Bugs
--enable-languages=c,c++,java,d,fortran,objc,obj-c++ --prefix=/usr
--program-suffix=-4.9 --enable-shared --enable-linker-build-id
--libexecdir=/usr/lib --without-included-gettext --enable-threads=posix
--with-gxx-include-dir=/usr/include/c++/4.9 --libdir=/usr/lib --enable-nls
--with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug
--enable-libstdcxx-time=yes --enable-gnu-unique-object --disable-libssp
--disable-libitm --disable-libsanitizer --disable-libquadmath --enable-plugin
--with-system-zlib --disable-browser-plugin --enable-java-awt=gtk
--enable-gtk-cairo --with-java-home=/usr/lib/jvm/java-1.5.0-gcj-4.9-hppa/jre
--enable-java-home --with-jvm-root-dir=/usr/lib/jvm/java-1.5.0-gcj-4.9-hppa
--with-jvm-jar-dir=/usr/lib/jvm-exports/java-1.5.0-gcj-4.9-hppa
--with-arch-directory=parisc --with-ecj-jar=/usr/share/java/eclipse-ecj.jar
--enable-objc-gc --enable-multiarch --disable-libstdcxx-pch
--enable-checking=release --build=hppa-linux-gnu --host=hppa-linux-gnu
--target=hppa-linux-gnu
Thread model: posix
gcc version 4.9.1 (Debian 4.9.1-14+b1)
^ permalink raw reply [flat|nested] 27+ messages in thread
* [Bug tree-optimization/63302] [4.9 Regression] Code with 64-bit long long constants is miscompiled on 32-bit host
2014-09-18 23:20 [Bug tree-optimization/63302] New: [4.9,5.0 Regression] Code with 64-bit long long constants is miscompiled on 32-bit host danglin at gcc dot gnu.org
2014-09-24 1:45 ` [Bug tree-optimization/63302] " danglin at gcc dot gnu.org
@ 2014-09-26 13:01 ` danglin at gcc dot gnu.org
2014-09-26 16:21 ` law at redhat dot com
` (23 subsequent siblings)
25 siblings, 0 replies; 27+ messages in thread
From: danglin at gcc dot gnu.org @ 2014-09-26 13:01 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63302
John David Anglin <danglin at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |law at gcc dot gnu.org
--- Comment #2 from John David Anglin <danglin at gcc dot gnu.org> ---
Introduced in r203627:
2013-10-15 Zhenqiang Chen <zhenqiang.chen@arm.com>
* tree-ssa-reassoc.c: Include rtl.h and tm_p.h.
(optimize_range_tests_1): New function,
extracted from optimize_range_tests.
(optimize_range_tests_xor): Similarly.
(optimize_range_tests_diff): New function.
(optimize_range_tests): Use optimize_range_tests_1.
It was fixed on trunk in wide-int merge but it still is present on 4.9
branch.
^ permalink raw reply [flat|nested] 27+ messages in thread
* [Bug tree-optimization/63302] [4.9 Regression] Code with 64-bit long long constants is miscompiled on 32-bit host
2014-09-18 23:20 [Bug tree-optimization/63302] New: [4.9,5.0 Regression] Code with 64-bit long long constants is miscompiled on 32-bit host danglin at gcc dot gnu.org
2014-09-24 1:45 ` [Bug tree-optimization/63302] " danglin at gcc dot gnu.org
2014-09-26 13:01 ` [Bug tree-optimization/63302] [4.9 " danglin at gcc dot gnu.org
@ 2014-09-26 16:21 ` law at redhat dot com
2014-09-26 19:46 ` law at redhat dot com
` (22 subsequent siblings)
25 siblings, 0 replies; 27+ messages in thread
From: law at redhat dot com @ 2014-09-26 16:21 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63302
Jeffrey A. Law <law at redhat dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |law at redhat dot com
--- Comment #3 from Jeffrey A. Law <law at redhat dot com> ---
Ugh. Clearly merging the wide-int back to 4.9 wouldn't make sense.
^ permalink raw reply [flat|nested] 27+ messages in thread
* [Bug tree-optimization/63302] [4.9 Regression] Code with 64-bit long long constants is miscompiled on 32-bit host
2014-09-18 23:20 [Bug tree-optimization/63302] New: [4.9,5.0 Regression] Code with 64-bit long long constants is miscompiled on 32-bit host danglin at gcc dot gnu.org
` (2 preceding siblings ...)
2014-09-26 16:21 ` law at redhat dot com
@ 2014-09-26 19:46 ` law at redhat dot com
2014-09-26 22:39 ` dave.anglin at bell dot net
` (21 subsequent siblings)
25 siblings, 0 replies; 27+ messages in thread
From: law at redhat dot com @ 2014-09-26 19:46 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63302
--- Comment #4 from Jeffrey A. Law <law at redhat dot com> ---
Have you tried with the current 4.9.2 bits? I get the following with a 32bit
host cross to hppa64-unknown-linux-gnu:
depdi 0,52,20,%r26
depdi,z 1,32,4,%r28
add,l %r26,%r28,%r28
depdi 0,32,1,%r28
or,*>= %r0,%r28,%r28
subi 0,%r28,%r28
ldo -1(%r28),%r28
bve (%r2)
extrd,u %r28,0,1,%r28
Which is identical to what I get on the trunk.
^ permalink raw reply [flat|nested] 27+ messages in thread
* [Bug tree-optimization/63302] [4.9 Regression] Code with 64-bit long long constants is miscompiled on 32-bit host
2014-09-18 23:20 [Bug tree-optimization/63302] New: [4.9,5.0 Regression] Code with 64-bit long long constants is miscompiled on 32-bit host danglin at gcc dot gnu.org
` (3 preceding siblings ...)
2014-09-26 19:46 ` law at redhat dot com
@ 2014-09-26 22:39 ` dave.anglin at bell dot net
2014-09-28 5:31 ` zhenqiang.chen at arm dot com
` (20 subsequent siblings)
25 siblings, 0 replies; 27+ messages in thread
From: dave.anglin at bell dot net @ 2014-09-26 22:39 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63302
--- Comment #5 from dave.anglin at bell dot net ---
On 26-Sep-14, at 3:46 PM, law at redhat dot com wrote:
> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63302
>
> --- Comment #4 from Jeffrey A. Law <law at redhat dot com> ---
> Have you tried with the current 4.9.2 bits? I get the following
> with a 32bit
> host cross to hppa64-unknown-linux-gnu:
The wrong code is actually generated by the native 32-bit hppa-unknown-
linux-gnu compiler.
This results in the hppa64-unknown-linux-gnu cross compiler being
miscompiled and incorrect
ldil instructions in its output. The hppa64-unknown-linux-gnu cross
compiler correctly compiles
the test case.
In my regression search, I got wrong code with r215536 from the 4.9
branch. Then,
I switched to checking trunk. I just checked r215649 from 4.9 branch
and still get the following
incorrect code for the testcase:
extru %r26,31,11,%r28
comiclr,<> 0,%r28,%r28
ldi 1,%r28
bv,n %r0(%r2)
Note that this is 32-bit code.
Dave
--
John David Anglin dave.anglin@bell.net
^ permalink raw reply [flat|nested] 27+ messages in thread
* [Bug tree-optimization/63302] [4.9 Regression] Code with 64-bit long long constants is miscompiled on 32-bit host
2014-09-18 23:20 [Bug tree-optimization/63302] New: [4.9,5.0 Regression] Code with 64-bit long long constants is miscompiled on 32-bit host danglin at gcc dot gnu.org
` (4 preceding siblings ...)
2014-09-26 22:39 ` dave.anglin at bell dot net
@ 2014-09-28 5:31 ` zhenqiang.chen at arm dot com
2014-09-28 14:34 ` dave.anglin at bell dot net
` (19 subsequent siblings)
25 siblings, 0 replies; 27+ messages in thread
From: zhenqiang.chen at arm dot com @ 2014-09-28 5:31 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63302
--- Comment #6 from Zhenqiang Chen <zhenqiang.chen at arm dot com> ---
I double checked the function optimize_range_tests_diff. Overall, I think it
does the right thing. X86 and ARM work correctly. The ldil.c.169t.optimized is
<bb 2>:
x_2 = ival_1(D) & -2147481601;
_8 = x_2 + 2147483648;
_9 = _8 & -2147483649;
_10 = _9 == 0;
_6 = (int) _10;
return _6;
If we can not fix the wide-int issue, I will create a patch to workaround it
for 4.9 since I never expected optimize_range_tests_diff can work between a
positive value and a negative value.
^ permalink raw reply [flat|nested] 27+ messages in thread
* [Bug tree-optimization/63302] [4.9 Regression] Code with 64-bit long long constants is miscompiled on 32-bit host
2014-09-18 23:20 [Bug tree-optimization/63302] New: [4.9,5.0 Regression] Code with 64-bit long long constants is miscompiled on 32-bit host danglin at gcc dot gnu.org
` (5 preceding siblings ...)
2014-09-28 5:31 ` zhenqiang.chen at arm dot com
@ 2014-09-28 14:34 ` dave.anglin at bell dot net
2014-09-28 14:47 ` dave.anglin at bell dot net
` (18 subsequent siblings)
25 siblings, 0 replies; 27+ messages in thread
From: dave.anglin at bell dot net @ 2014-09-28 14:34 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63302
--- Comment #7 from dave.anglin at bell dot net ---
On 28-Sep-14, at 1:30 AM, zhenqiang.chen at arm dot com wrote:
> I double checked the function optimize_range_tests_diff. Overall, I
> think it
> does the right thing. X86 and ARM work correctly. The ldil.c.
> 169t.optimized is
>
> <bb 2>:
> x_2 = ival_1(D) & -2147481601;
> _8 = x_2 + 2147483648;
> _9 = _8 & -2147483649;
> _10 = _9 == 0;
> _6 = (int) _10;
> return _6;
This is what I see on the trunk, but 4.9 is wrong. Possibly, there is
a transformation
after optimize_range_tests_diff where things go wrong on 4.9.
Dave
--
John David Anglin dave.anglin@bell.net
^ permalink raw reply [flat|nested] 27+ messages in thread
* [Bug tree-optimization/63302] [4.9 Regression] Code with 64-bit long long constants is miscompiled on 32-bit host
2014-09-18 23:20 [Bug tree-optimization/63302] New: [4.9,5.0 Regression] Code with 64-bit long long constants is miscompiled on 32-bit host danglin at gcc dot gnu.org
` (6 preceding siblings ...)
2014-09-28 14:34 ` dave.anglin at bell dot net
@ 2014-09-28 14:47 ` dave.anglin at bell dot net
2014-09-28 15:01 ` dave.anglin at bell dot net
` (17 subsequent siblings)
25 siblings, 0 replies; 27+ messages in thread
From: dave.anglin at bell dot net @ 2014-09-28 14:47 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63302
--- Comment #8 from dave.anglin at bell dot net ---
On 28-Sep-14, at 10:34 AM, dave.anglin at bell dot net wrote:
> This is what I see on the trunk, but 4.9 is wrong. Possibly, there is
> a transformation
> after optimize_range_tests_diff where things go wrong on 4.9.
It seems the difference actually occurs in reassoc1.
4.9:
<bb 2>:
x_2 = ival_1(D) & -2147481601;
_3 = x_2 == 0;
_8 = x_2 & 2147483647;
_9 = _8 == 0;
_4 = x_2 == -2147483648;
_5 = _9;
_6 = (int) _5;
return _6;
trunk:
<bb 2>:
x_2 = ival_1(D) & -2147481601;
_3 = x_2 == 0;
_8 = x_2 + 2147483648;
_9 = _8 & -2147483649;
_10 = _9 == 0;
_4 = x_2 == -2147483648;
_5 = _10;
_6 = (int) _5;
return _6;
The preceding dse1 is same for both branches:
<bb 2>:
x_2 = ival_1(D) & -2147481601;
_3 = x_2 == 0;
_4 = x_2 == -2147483648;
_5 = _3 | _4;
_6 = (int) _5;
return _6;
--
John David Anglin dave.anglin@bell.net
^ permalink raw reply [flat|nested] 27+ messages in thread
* [Bug tree-optimization/63302] [4.9 Regression] Code with 64-bit long long constants is miscompiled on 32-bit host
2014-09-18 23:20 [Bug tree-optimization/63302] New: [4.9,5.0 Regression] Code with 64-bit long long constants is miscompiled on 32-bit host danglin at gcc dot gnu.org
` (7 preceding siblings ...)
2014-09-28 14:47 ` dave.anglin at bell dot net
@ 2014-09-28 15:01 ` dave.anglin at bell dot net
2014-09-29 1:17 ` zhenqiang.chen at arm dot com
` (16 subsequent siblings)
25 siblings, 0 replies; 27+ messages in thread
From: dave.anglin at bell dot net @ 2014-09-28 15:01 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63302
--- Comment #9 from dave.anglin at bell dot net ---
On 28-Sep-14, at 1:30 AM, zhenqiang.chen at arm dot com wrote:
> X86 and ARM work correctly.
I suspect this is because both have "need_64bit_hwint=yes" in
config.gcc.
--
John David Anglin dave.anglin@bell.net
^ permalink raw reply [flat|nested] 27+ messages in thread
* [Bug tree-optimization/63302] [4.9 Regression] Code with 64-bit long long constants is miscompiled on 32-bit host
2014-09-18 23:20 [Bug tree-optimization/63302] New: [4.9,5.0 Regression] Code with 64-bit long long constants is miscompiled on 32-bit host danglin at gcc dot gnu.org
` (8 preceding siblings ...)
2014-09-28 15:01 ` dave.anglin at bell dot net
@ 2014-09-29 1:17 ` zhenqiang.chen at arm dot com
2014-09-29 1:28 ` dave.anglin at bell dot net
` (15 subsequent siblings)
25 siblings, 0 replies; 27+ messages in thread
From: zhenqiang.chen at arm dot com @ 2014-09-29 1:17 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63302
--- Comment #10 from Zhenqiang Chen <zhenqiang.chen at arm dot com> ---
(In reply to dave.anglin from comment #8)
> On 28-Sep-14, at 10:34 AM, dave.anglin at bell dot net wrote:
>
> > This is what I see on the trunk, but 4.9 is wrong. Possibly, there is
> > a transformation
> > after optimize_range_tests_diff where things go wrong on 4.9.
>
> It seems the difference actually occurs in reassoc1.
>
> 4.9:
>
> <bb 2>:
> x_2 = ival_1(D) & -2147481601;
> _3 = x_2 == 0;
> _8 = x_2 & 2147483647;
> _9 = _8 == 0;
> _4 = x_2 == -2147483648;
> _5 = _9;
> _6 = (int) _5;
> return _6;
This is not optimized by my patch: optimize_range_tests_diff
> trunk:
>
> <bb 2>:
> x_2 = ival_1(D) & -2147481601;
> _3 = x_2 == 0;
> _8 = x_2 + 2147483648;
> _9 = _8 & -2147483649;
> _10 = _9 == 0;
> _4 = x_2 == -2147483648;
> _5 = _10;
> _6 = (int) _5;
> return _6;
This is optimized by the patch. optimize_range_tests_diff is the only change I
added for the patch. Others were just reorganization.
Can you show more detail dumps with -fdump-tree-reassoc1-details?
Thanks!
-Zhenqiang
^ permalink raw reply [flat|nested] 27+ messages in thread
* [Bug tree-optimization/63302] [4.9 Regression] Code with 64-bit long long constants is miscompiled on 32-bit host
2014-09-18 23:20 [Bug tree-optimization/63302] New: [4.9,5.0 Regression] Code with 64-bit long long constants is miscompiled on 32-bit host danglin at gcc dot gnu.org
` (9 preceding siblings ...)
2014-09-29 1:17 ` zhenqiang.chen at arm dot com
@ 2014-09-29 1:28 ` dave.anglin at bell dot net
2014-09-29 1:39 ` dave.anglin at bell dot net
` (14 subsequent siblings)
25 siblings, 0 replies; 27+ messages in thread
From: dave.anglin at bell dot net @ 2014-09-29 1:28 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63302
--- Comment #11 from dave.anglin at bell dot net ---
On 28-Sep-14, at 9:17 PM, zhenqiang.chen at arm dot com wrote:
> Can you show more detail dumps with -fdump-tree-reassoc1-details?
Attached is 4.9 dump with more details.
Dave
--
John David Anglin dave.anglin@bell.net
^ permalink raw reply [flat|nested] 27+ messages in thread
* [Bug tree-optimization/63302] [4.9 Regression] Code with 64-bit long long constants is miscompiled on 32-bit host
2014-09-18 23:20 [Bug tree-optimization/63302] New: [4.9,5.0 Regression] Code with 64-bit long long constants is miscompiled on 32-bit host danglin at gcc dot gnu.org
` (10 preceding siblings ...)
2014-09-29 1:28 ` dave.anglin at bell dot net
@ 2014-09-29 1:39 ` dave.anglin at bell dot net
2014-09-29 2:19 ` zhenqiang.chen at arm dot com
` (13 subsequent siblings)
25 siblings, 0 replies; 27+ messages in thread
From: dave.anglin at bell dot net @ 2014-09-29 1:39 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63302
--- Comment #12 from dave.anglin at bell dot net ---
On 28-Sep-14, at 9:17 PM, zhenqiang.chen at arm dot com wrote:
> Can you show more detail dumps with -fdump-tree-reassoc1-details?
Same for trunk.
Dave
--
John David Anglin dave.anglin@bell.net
^ permalink raw reply [flat|nested] 27+ messages in thread
* [Bug tree-optimization/63302] [4.9 Regression] Code with 64-bit long long constants is miscompiled on 32-bit host
2014-09-18 23:20 [Bug tree-optimization/63302] New: [4.9,5.0 Regression] Code with 64-bit long long constants is miscompiled on 32-bit host danglin at gcc dot gnu.org
` (11 preceding siblings ...)
2014-09-29 1:39 ` dave.anglin at bell dot net
@ 2014-09-29 2:19 ` zhenqiang.chen at arm dot com
2014-09-29 6:43 ` zhenqiang.chen at arm dot com
` (12 subsequent siblings)
25 siblings, 0 replies; 27+ messages in thread
From: zhenqiang.chen at arm dot com @ 2014-09-29 2:19 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63302
--- Comment #13 from Zhenqiang Chen <zhenqiang.chen at arm dot com> ---
For 4.9, some function optimizes the code as:
Optimizing range tests x_2 -[-2147483648, -2147483648] and -[0, 0]
into (x_2 & 2147483647) != 0
For trunk, optimize_range_tests_diff optimizes the code as:
Optimizing range tests x_2 -[-2147483648, -2147483648] and -[0, 0]
into (x_2 + 2147483648 & -2147483649) != 0
I tried to remove need_64bit_hwint=yes" from config.gcc to build i686. But it
does not build. So still need your help to idnetify the root cause.
Can you try to remove the line in tree-ssa-reassoc.c?
any_changes |= optimize_range_tests_1 (opcode, first, length, true,
ops, ranges);
And add a printf at the place:
printf ("changes: %d\n", any_changes);
^ permalink raw reply [flat|nested] 27+ messages in thread
* [Bug tree-optimization/63302] [4.9 Regression] Code with 64-bit long long constants is miscompiled on 32-bit host
2014-09-18 23:20 [Bug tree-optimization/63302] New: [4.9,5.0 Regression] Code with 64-bit long long constants is miscompiled on 32-bit host danglin at gcc dot gnu.org
` (12 preceding siblings ...)
2014-09-29 2:19 ` zhenqiang.chen at arm dot com
@ 2014-09-29 6:43 ` zhenqiang.chen at arm dot com
2014-09-29 13:02 ` dave.anglin at bell dot net
` (11 subsequent siblings)
25 siblings, 0 replies; 27+ messages in thread
From: zhenqiang.chen at arm dot com @ 2014-09-29 6:43 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63302
--- Comment #14 from Zhenqiang Chen <zhenqiang.chen at arm dot com> ---
Created attachment 33608
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=33608&action=edit
patch
After investigation, I found I mis-use tree_log2.
Please try the attached patch. If it works, I will run all tests and send it
for community review.
Thanks!
^ permalink raw reply [flat|nested] 27+ messages in thread
* [Bug tree-optimization/63302] [4.9 Regression] Code with 64-bit long long constants is miscompiled on 32-bit host
2014-09-18 23:20 [Bug tree-optimization/63302] New: [4.9,5.0 Regression] Code with 64-bit long long constants is miscompiled on 32-bit host danglin at gcc dot gnu.org
` (13 preceding siblings ...)
2014-09-29 6:43 ` zhenqiang.chen at arm dot com
@ 2014-09-29 13:02 ` dave.anglin at bell dot net
2014-10-02 19:37 ` dave.anglin at bell dot net
` (10 subsequent siblings)
25 siblings, 0 replies; 27+ messages in thread
From: dave.anglin at bell dot net @ 2014-09-29 13:02 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63302
--- Comment #15 from dave.anglin at bell dot net ---
On 29-Sep-14, at 2:43 AM, zhenqiang.chen at arm dot com wrote:
> Please try the attached patch. If it works, I will run all tests and
> send it
> for community review.
The patch appears to fix the testcase. I've started a full build and
check
with 4.9 branch. I'll also test it on hpux starting this evening.
Thanks very much for investigating.
Dave
--
John David Anglin dave.anglin@bell.net
^ permalink raw reply [flat|nested] 27+ messages in thread
* [Bug tree-optimization/63302] [4.9 Regression] Code with 64-bit long long constants is miscompiled on 32-bit host
2014-09-18 23:20 [Bug tree-optimization/63302] New: [4.9,5.0 Regression] Code with 64-bit long long constants is miscompiled on 32-bit host danglin at gcc dot gnu.org
` (14 preceding siblings ...)
2014-09-29 13:02 ` dave.anglin at bell dot net
@ 2014-10-02 19:37 ` dave.anglin at bell dot net
2014-10-04 17:24 ` mikpelinux at gmail dot com
` (9 subsequent siblings)
25 siblings, 0 replies; 27+ messages in thread
From: dave.anglin at bell dot net @ 2014-10-02 19:37 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63302
--- Comment #16 from dave.anglin at bell dot net ---
On 9/29/2014 9:02 AM, dave.anglin at bell dot net wrote:
> I've started a full build and
> check
> with 4.9 branch. I'll also test it on hpux starting this evening.
I see no regressions with the change on 4.9 and trunk. Tested on
hppa2.0w-hp-hpux11.11,
hppa64-hp-hpux11.11 and hppa-unknown-linux-gnu on 4.9. Tested on
hppa2.0w-hp-hpux11.11
and hppa64-hp-hpux1.11 on trunk.
Dave
^ permalink raw reply [flat|nested] 27+ messages in thread
* [Bug tree-optimization/63302] [4.9 Regression] Code with 64-bit long long constants is miscompiled on 32-bit host
2014-09-18 23:20 [Bug tree-optimization/63302] New: [4.9,5.0 Regression] Code with 64-bit long long constants is miscompiled on 32-bit host danglin at gcc dot gnu.org
` (15 preceding siblings ...)
2014-10-02 19:37 ` dave.anglin at bell dot net
@ 2014-10-04 17:24 ` mikpelinux at gmail dot com
2014-10-04 17:33 ` danglin at gcc dot gnu.org
` (8 subsequent siblings)
25 siblings, 0 replies; 27+ messages in thread
From: mikpelinux at gmail dot com @ 2014-10-04 17:24 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63302
Mikael Pettersson <mikpelinux at gmail dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |mikpelinux at gmail dot com
--- Comment #17 from Mikael Pettersson <mikpelinux at gmail dot com> ---
This bug also affects m68k-linux, since it doesn't set need_64bit_hwint=yes.
On m68k-linux, gcc-4.8 -O1 -fomit-frame-pointer generates:
pa_ldil_cint_p:
move.l %d2,-(%sp)
move.l 8(%sp),%d0
move.l 12(%sp),%d1
and.l #-2147481601,%d1
move.l %d0,%d2
or.l %d1,%d2
jeq .L3
move.w #-1,%a0
move.l #-2147483648,%a1
cmp.l %a0,%d0
jne .L4
cmp.l %a1,%d1
.L4:
seq %d0
extb.l %d0
neg.l %d0
jra .L2
.L3:
moveq #1,%d0
.L2:
move.l (%sp)+,%d2
rts
while gcc-4.9 generates:
pa_ldil_cint_p:
move.l 8(%sp),%d0
and.l #2047,%d0
seq %d0
neg.b %d0
and.l #255,%d0
rts
The gcc-4.9 code completely ignores the high 32-bits.
I'll try the patch in a couple of days when my current 4.9 bootstrap+regtest is
done.
^ permalink raw reply [flat|nested] 27+ messages in thread
* [Bug tree-optimization/63302] [4.9 Regression] Code with 64-bit long long constants is miscompiled on 32-bit host
2014-09-18 23:20 [Bug tree-optimization/63302] New: [4.9,5.0 Regression] Code with 64-bit long long constants is miscompiled on 32-bit host danglin at gcc dot gnu.org
` (16 preceding siblings ...)
2014-10-04 17:24 ` mikpelinux at gmail dot com
@ 2014-10-04 17:33 ` danglin at gcc dot gnu.org
2014-10-11 17:53 ` danglin at gcc dot gnu.org
` (7 subsequent siblings)
25 siblings, 0 replies; 27+ messages in thread
From: danglin at gcc dot gnu.org @ 2014-10-04 17:33 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63302
John David Anglin <danglin at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Last reconfirmed| |2014-10-04
Ever confirmed|0 |1
^ permalink raw reply [flat|nested] 27+ messages in thread
* [Bug tree-optimization/63302] [4.9 Regression] Code with 64-bit long long constants is miscompiled on 32-bit host
2014-09-18 23:20 [Bug tree-optimization/63302] New: [4.9,5.0 Regression] Code with 64-bit long long constants is miscompiled on 32-bit host danglin at gcc dot gnu.org
` (17 preceding siblings ...)
2014-10-04 17:33 ` danglin at gcc dot gnu.org
@ 2014-10-11 17:53 ` danglin at gcc dot gnu.org
2014-10-15 11:40 ` jakub at gcc dot gnu.org
` (6 subsequent siblings)
25 siblings, 0 replies; 27+ messages in thread
From: danglin at gcc dot gnu.org @ 2014-10-11 17:53 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63302
--- Comment #18 from John David Anglin <danglin at gcc dot gnu.org> ---
Hi Zhenqiang,
Do you plan to submit patch to gcc-patches soon?
^ permalink raw reply [flat|nested] 27+ messages in thread
* [Bug tree-optimization/63302] [4.9 Regression] Code with 64-bit long long constants is miscompiled on 32-bit host
2014-09-18 23:20 [Bug tree-optimization/63302] New: [4.9,5.0 Regression] Code with 64-bit long long constants is miscompiled on 32-bit host danglin at gcc dot gnu.org
` (18 preceding siblings ...)
2014-10-11 17:53 ` danglin at gcc dot gnu.org
@ 2014-10-15 11:40 ` jakub at gcc dot gnu.org
2014-10-15 16:19 ` law at redhat dot com
` (5 subsequent siblings)
25 siblings, 0 replies; 27+ messages in thread
From: jakub at gcc dot gnu.org @ 2014-10-15 11:40 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63302
Jakub Jelinek <jakub at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |ASSIGNED
Assignee|unassigned at gcc dot gnu.org |jakub at gcc dot gnu.org
--- Comment #20 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Created attachment 33722
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=33722&action=edit
gcc49-pr63302.patch
IMHO better fix, we already have the right predicate, it doesn't make sense to
add another one.
^ permalink raw reply [flat|nested] 27+ messages in thread
* [Bug tree-optimization/63302] [4.9 Regression] Code with 64-bit long long constants is miscompiled on 32-bit host
2014-09-18 23:20 [Bug tree-optimization/63302] New: [4.9,5.0 Regression] Code with 64-bit long long constants is miscompiled on 32-bit host danglin at gcc dot gnu.org
` (19 preceding siblings ...)
2014-10-15 11:40 ` jakub at gcc dot gnu.org
@ 2014-10-15 16:19 ` law at redhat dot com
2014-10-15 18:34 ` dave.anglin at bell dot net
` (4 subsequent siblings)
25 siblings, 0 replies; 27+ messages in thread
From: law at redhat dot com @ 2014-10-15 16:19 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63302
--- Comment #21 from Jeffrey A. Law <law at redhat dot com> ---
John, I know those PA boxes are slow, but if you could try Jakub's patch, it'd
be appreciated.
BTW, are you using strictly PA 2.0 (PA8000+) hardware? I was pondering doing a
reimplementation of pa_combine_instructions using Bin's infrastructure for insn
fusion as part of the review process for that code and having a box where I
could do performance testing would be helpful.
I can certainly test on PA8000+ hardware (assuming mine doesn't overheat), but
fmpyadd/fmpysub tend to degrade performance on the more modern hardware. I
guess I could look for a performance degradation and call that a victory since
that would indicate we're doing a better job at fusing the independent FP mult
and add/sub instructions.
^ permalink raw reply [flat|nested] 27+ messages in thread
* [Bug tree-optimization/63302] [4.9 Regression] Code with 64-bit long long constants is miscompiled on 32-bit host
2014-09-18 23:20 [Bug tree-optimization/63302] New: [4.9,5.0 Regression] Code with 64-bit long long constants is miscompiled on 32-bit host danglin at gcc dot gnu.org
` (20 preceding siblings ...)
2014-10-15 16:19 ` law at redhat dot com
@ 2014-10-15 18:34 ` dave.anglin at bell dot net
2014-10-17 10:50 ` jakub at gcc dot gnu.org
` (3 subsequent siblings)
25 siblings, 0 replies; 27+ messages in thread
From: dave.anglin at bell dot net @ 2014-10-15 18:34 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63302
--- Comment #22 from dave.anglin at bell dot net ---
On 10/15/2014 12:19 PM, law at redhat dot com wrote:
> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63302
>
> --- Comment #21 from Jeffrey A. Law <law at redhat dot com> ---
> John, I know those PA boxes are slow, but if you could try Jakub's patch, it'd
> be appreciated.
I started a build and check on hppa2.0w-hp-hpux11.11. Will take a day
or so for full
build and check. Jakub's patch appears to fix ldil.c testcase.
>
> BTW, are you using strictly PA 2.0 (PA8000+) hardware? I was pondering doing a
> reimplementation of pa_combine_instructions using Bin's infrastructure for insn
> fusion as part of the review process for that code and having a box where I
> could do performance testing would be helpful.
Almost all my testing is on PA 2.0 hardware. I have a c8000, rp3440 and
c3750 at home.
Mostly use the rp3440.
Probably, the best machine to use for development is sibaris (4-way 1
GHz c8000 linux). It's
our primary buildd machine but others have used it for development
testing. I'll check with Helge Deller
who manages the machine and get back.
>
> I can certainly test on PA8000+ hardware (assuming mine doesn't overheat), but
> fmpyadd/fmpysub tend to degrade performance on the more modern hardware. I
> guess I could look for a performance degradation and call that a victory since
> that would indicate we're doing a better job at fusing the independent FP mult
> and add/sub instructions.
>
Dave
^ permalink raw reply [flat|nested] 27+ messages in thread
* [Bug tree-optimization/63302] [4.9 Regression] Code with 64-bit long long constants is miscompiled on 32-bit host
2014-09-18 23:20 [Bug tree-optimization/63302] New: [4.9,5.0 Regression] Code with 64-bit long long constants is miscompiled on 32-bit host danglin at gcc dot gnu.org
` (21 preceding siblings ...)
2014-10-15 18:34 ` dave.anglin at bell dot net
@ 2014-10-17 10:50 ` jakub at gcc dot gnu.org
2014-10-17 10:54 ` jakub at gcc dot gnu.org
` (2 subsequent siblings)
25 siblings, 0 replies; 27+ messages in thread
From: jakub at gcc dot gnu.org @ 2014-10-17 10:50 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63302
--- Comment #23 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Author: jakub
Date: Fri Oct 17 10:50:16 2014
New Revision: 216391
URL: https://gcc.gnu.org/viewcvs?rev=216391&root=gcc&view=rev
Log:
PR tree-optimization/63302
* tree-ssa-reassoc.c (optimize_range_tests_xor,
optimize_range_tests_diff): Use !integer_pow2p () instead of
tree_log2 () < 0.
* gcc.c-torture/execute/pr63302.c: New test.
Added:
trunk/gcc/testsuite/gcc.c-torture/execute/pr63302.c
Modified:
trunk/gcc/ChangeLog
trunk/gcc/testsuite/ChangeLog
trunk/gcc/tree-ssa-reassoc.c
^ permalink raw reply [flat|nested] 27+ messages in thread
* [Bug tree-optimization/63302] [4.9 Regression] Code with 64-bit long long constants is miscompiled on 32-bit host
2014-09-18 23:20 [Bug tree-optimization/63302] New: [4.9,5.0 Regression] Code with 64-bit long long constants is miscompiled on 32-bit host danglin at gcc dot gnu.org
` (22 preceding siblings ...)
2014-10-17 10:50 ` jakub at gcc dot gnu.org
@ 2014-10-17 10:54 ` jakub at gcc dot gnu.org
2014-10-17 11:10 ` jakub at gcc dot gnu.org
2014-10-17 12:36 ` dave.anglin at bell dot net
25 siblings, 0 replies; 27+ messages in thread
From: jakub at gcc dot gnu.org @ 2014-10-17 10:54 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63302
--- Comment #24 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Author: jakub
Date: Fri Oct 17 10:53:36 2014
New Revision: 216392
URL: https://gcc.gnu.org/viewcvs?rev=216392&root=gcc&view=rev
Log:
PR tree-optimization/63302
* tree-ssa-reassoc.c (optimize_range_tests_xor,
optimize_range_tests_diff): Use !integer_pow2p () instead of
tree_log2 () < 0.
* gcc.c-torture/execute/pr63302.c: New test.
Added:
branches/gcc-4_9-branch/gcc/testsuite/gcc.c-torture/execute/pr63302.c
Modified:
branches/gcc-4_9-branch/gcc/ChangeLog
branches/gcc-4_9-branch/gcc/testsuite/ChangeLog
branches/gcc-4_9-branch/gcc/tree-ssa-reassoc.c
^ permalink raw reply [flat|nested] 27+ messages in thread
* [Bug tree-optimization/63302] [4.9 Regression] Code with 64-bit long long constants is miscompiled on 32-bit host
2014-09-18 23:20 [Bug tree-optimization/63302] New: [4.9,5.0 Regression] Code with 64-bit long long constants is miscompiled on 32-bit host danglin at gcc dot gnu.org
` (23 preceding siblings ...)
2014-10-17 10:54 ` jakub at gcc dot gnu.org
@ 2014-10-17 11:10 ` jakub at gcc dot gnu.org
2014-10-17 12:36 ` dave.anglin at bell dot net
25 siblings, 0 replies; 27+ messages in thread
From: jakub at gcc dot gnu.org @ 2014-10-17 11:10 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63302
Jakub Jelinek <jakub at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|ASSIGNED |RESOLVED
Resolution|--- |FIXED
--- Comment #25 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Should be fixed now.
^ permalink raw reply [flat|nested] 27+ messages in thread
* [Bug tree-optimization/63302] [4.9 Regression] Code with 64-bit long long constants is miscompiled on 32-bit host
2014-09-18 23:20 [Bug tree-optimization/63302] New: [4.9,5.0 Regression] Code with 64-bit long long constants is miscompiled on 32-bit host danglin at gcc dot gnu.org
` (24 preceding siblings ...)
2014-10-17 11:10 ` jakub at gcc dot gnu.org
@ 2014-10-17 12:36 ` dave.anglin at bell dot net
25 siblings, 0 replies; 27+ messages in thread
From: dave.anglin at bell dot net @ 2014-10-17 12:36 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63302
--- Comment #26 from dave.anglin at bell dot net ---
On 17-Oct-14, at 7:10 AM, jakub at gcc dot gnu.org wrote:
> Should be fixed now.
Thanks, Jakub.
Dave
--
John David Anglin dave.anglin@bell.net
^ permalink raw reply [flat|nested] 27+ messages in thread
end of thread, other threads:[~2014-10-17 12:36 UTC | newest]
Thread overview: 27+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-09-18 23:20 [Bug tree-optimization/63302] New: [4.9,5.0 Regression] Code with 64-bit long long constants is miscompiled on 32-bit host danglin at gcc dot gnu.org
2014-09-24 1:45 ` [Bug tree-optimization/63302] " danglin at gcc dot gnu.org
2014-09-26 13:01 ` [Bug tree-optimization/63302] [4.9 " danglin at gcc dot gnu.org
2014-09-26 16:21 ` law at redhat dot com
2014-09-26 19:46 ` law at redhat dot com
2014-09-26 22:39 ` dave.anglin at bell dot net
2014-09-28 5:31 ` zhenqiang.chen at arm dot com
2014-09-28 14:34 ` dave.anglin at bell dot net
2014-09-28 14:47 ` dave.anglin at bell dot net
2014-09-28 15:01 ` dave.anglin at bell dot net
2014-09-29 1:17 ` zhenqiang.chen at arm dot com
2014-09-29 1:28 ` dave.anglin at bell dot net
2014-09-29 1:39 ` dave.anglin at bell dot net
2014-09-29 2:19 ` zhenqiang.chen at arm dot com
2014-09-29 6:43 ` zhenqiang.chen at arm dot com
2014-09-29 13:02 ` dave.anglin at bell dot net
2014-10-02 19:37 ` dave.anglin at bell dot net
2014-10-04 17:24 ` mikpelinux at gmail dot com
2014-10-04 17:33 ` danglin at gcc dot gnu.org
2014-10-11 17:53 ` danglin at gcc dot gnu.org
2014-10-15 11:40 ` jakub at gcc dot gnu.org
2014-10-15 16:19 ` law at redhat dot com
2014-10-15 18:34 ` dave.anglin at bell dot net
2014-10-17 10:50 ` jakub at gcc dot gnu.org
2014-10-17 10:54 ` jakub at gcc dot gnu.org
2014-10-17 11:10 ` jakub at gcc dot gnu.org
2014-10-17 12:36 ` dave.anglin at bell dot net
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).