public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug optimization/13250] New: [SH] Gcc code for rotation clobbers the register, but gcc continues to use the register as if it was not clobbered
@ 2003-12-01 1:49 uwe at netbsd dot org
2003-12-01 1:50 ` [Bug optimization/13250] " uwe at netbsd dot org
` (11 more replies)
0 siblings, 12 replies; 13+ messages in thread
From: uwe at netbsd dot org @ 2003-12-01 1:49 UTC (permalink / raw)
To: gcc-bugs
gcc-3.3.2 and 3.4 miscompile sha256 digest code for SuperH, minimized test case
attached.
The sha256 transformation computes a sum that has (amongst others) the following
subexpressions:
+ (... ^ ((((e)) >> (25)) | (((e)) << (32 - (25)))))
+ (((e) & (f)) ^ ((~(e)) & (g)))
Code generated with -O is:
swap.w r4,r1 ! r4 contains "e"
shll8 r4 ! "e" in r4 gets clobbered
shlr8 r1
or r4,r1
rotr r1 ! rotate "e" 25 bits
xor r1,r2
mov.l @(8,r14),r1
add r1,r2 ! enclosing sum
mov r4,r3 ! <-- gcc thinks r4 still has the value of "e" !!!
and r13,r3 ! e & f
not r4,r1 ! ~e
and r6,r1 ! ~e & g
xor r1,r3 ! (e & f) ^ (~e & g)
add r3,r2 ! add into the sum
--
Summary: [SH] Gcc code for rotation clobbers the register, but
gcc continues to use the register as if it was not
clobbered
Product: gcc
Version: 3.4
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: optimization
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: uwe at netbsd dot org
CC: gcc-bugs at gcc dot gnu dot org
GCC build triplet: i386-unknown-freebsd4.8
GCC host triplet: i386-unknown-freebsd4.8
GCC target triplet: shle--netbsdelf
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=13250
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug optimization/13250] [SH] Gcc code for rotation clobbers the register, but gcc continues to use the register as if it was not clobbered
2003-12-01 1:49 [Bug optimization/13250] New: [SH] Gcc code for rotation clobbers the register, but gcc continues to use the register as if it was not clobbered uwe at netbsd dot org
@ 2003-12-01 1:50 ` uwe at netbsd dot org
2003-12-01 1:55 ` pinskia at gcc dot gnu dot org
` (10 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: uwe at netbsd dot org @ 2003-12-01 1:50 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From uwe at netbsd dot org 2003-12-01 01:50 -------
Created an attachment (id=5247)
--> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=5247&action=view)
test case that demonstrates the problem
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=13250
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug optimization/13250] [SH] Gcc code for rotation clobbers the register, but gcc continues to use the register as if it was not clobbered
2003-12-01 1:49 [Bug optimization/13250] New: [SH] Gcc code for rotation clobbers the register, but gcc continues to use the register as if it was not clobbered uwe at netbsd dot org
2003-12-01 1:50 ` [Bug optimization/13250] " uwe at netbsd dot org
@ 2003-12-01 1:55 ` pinskia at gcc dot gnu dot org
2004-01-21 4:03 ` dhazeghi at yahoo dot com
` (9 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2003-12-01 1:55 UTC (permalink / raw)
To: gcc-bugs
--
What |Removed |Added
----------------------------------------------------------------------------
Keywords| |wrong-code
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=13250
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug optimization/13250] [SH] Gcc code for rotation clobbers the register, but gcc continues to use the register as if it was not clobbered
2003-12-01 1:49 [Bug optimization/13250] New: [SH] Gcc code for rotation clobbers the register, but gcc continues to use the register as if it was not clobbered uwe at netbsd dot org
2003-12-01 1:50 ` [Bug optimization/13250] " uwe at netbsd dot org
2003-12-01 1:55 ` pinskia at gcc dot gnu dot org
@ 2004-01-21 4:03 ` dhazeghi at yahoo dot com
2004-05-27 17:31 ` [Bug target/13250] " kkojima at gcc dot gnu dot org
` (8 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: dhazeghi at yahoo dot com @ 2004-01-21 4:03 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From dhazeghi at yahoo dot com 2004-01-21 04:03 -------
Confirmed on both branches (and mainline). Any sh expert want to take a look?
--
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Ever Confirmed| |1
Last reconfirmed|0000-00-00 00:00:00 |2004-01-21 04:03:24
date| |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=13250
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug target/13250] [SH] Gcc code for rotation clobbers the register, but gcc continues to use the register as if it was not clobbered
2003-12-01 1:49 [Bug optimization/13250] New: [SH] Gcc code for rotation clobbers the register, but gcc continues to use the register as if it was not clobbered uwe at netbsd dot org
` (2 preceding siblings ...)
2004-01-21 4:03 ` dhazeghi at yahoo dot com
@ 2004-05-27 17:31 ` kkojima at gcc dot gnu dot org
2004-05-28 16:05 ` uwe at ptc dot spbu dot ru
` (7 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: kkojima at gcc dot gnu dot org @ 2004-05-27 17:31 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From kkojima at gcc dot gnu dot org 2004-05-27 03:19 -------
This looks an SH target specific problem when generating rtl for rotation
like (e << 8) | (e >> 24). It seems the patch below for sh.md fixes this.
I'll propose it to gcc-patch list after bootstrap and regtest.
--- ORIG/gcc/gcc/config/sh/sh.md 2004-05-14 10:08:34.000000000 +0900
+++ LOCAL/gcc/gcc/config/sh/sh.md 2004-05-27 08:32:37.000000000 +0900
@@ -2194,7 +2194,7 @@
parts[0] = gen_reg_rtx (SImode);
parts[1] = gen_reg_rtx (SImode);
emit_insn (gen_rotlsi3_16 (parts[2-choice], operands[1]));
- parts[choice-1] = operands[1];
+ emit_move_insn (parts[choice-1], operands[1]);
emit_insn (gen_ashlsi3 (parts[0], parts[0], GEN_INT (8)));
emit_insn (gen_lshrsi3 (parts[1], parts[1], GEN_INT (8)));
emit_insn (gen_iorsi3 (operands[0], parts[0], parts[1]));
--
What |Removed |Added
----------------------------------------------------------------------------
AssignedTo|unassigned at gcc dot gnu |kkojima at gcc dot gnu dot
|dot org |org
Status|NEW |ASSIGNED
Component|rtl-optimization |target
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=13250
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug target/13250] [SH] Gcc code for rotation clobbers the register, but gcc continues to use the register as if it was not clobbered
2003-12-01 1:49 [Bug optimization/13250] New: [SH] Gcc code for rotation clobbers the register, but gcc continues to use the register as if it was not clobbered uwe at netbsd dot org
` (3 preceding siblings ...)
2004-05-27 17:31 ` [Bug target/13250] " kkojima at gcc dot gnu dot org
@ 2004-05-28 16:05 ` uwe at ptc dot spbu dot ru
2004-05-28 20:17 ` kkojima at gcc dot gnu dot org
` (6 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: uwe at ptc dot spbu dot ru @ 2004-05-28 16:05 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From uwe at ptc dot spbu dot ru 2004-05-27 21:03 -------
Subject: Re: [SH] Gcc code for rotation clobbers the register, but gcc continues to use the register as if it was not clobbered
With this fix applied the test case program passes its tests.
-uwe
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=13250
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug target/13250] [SH] Gcc code for rotation clobbers the register, but gcc continues to use the register as if it was not clobbered
2003-12-01 1:49 [Bug optimization/13250] New: [SH] Gcc code for rotation clobbers the register, but gcc continues to use the register as if it was not clobbered uwe at netbsd dot org
` (4 preceding siblings ...)
2004-05-28 16:05 ` uwe at ptc dot spbu dot ru
@ 2004-05-28 20:17 ` kkojima at gcc dot gnu dot org
2004-05-28 21:04 ` cvs-commit at gcc dot gnu dot org
` (5 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: kkojima at gcc dot gnu dot org @ 2004-05-28 20:17 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From kkojima at gcc dot gnu dot org 2004-05-28 04:24 -------
FYI, I've proposed the above patch:
http://gcc.gnu.org/ml/gcc-patches/2004-05/msg01782.html
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=13250
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug target/13250] [SH] Gcc code for rotation clobbers the register, but gcc continues to use the register as if it was not clobbered
2003-12-01 1:49 [Bug optimization/13250] New: [SH] Gcc code for rotation clobbers the register, but gcc continues to use the register as if it was not clobbered uwe at netbsd dot org
` (5 preceding siblings ...)
2004-05-28 20:17 ` kkojima at gcc dot gnu dot org
@ 2004-05-28 21:04 ` cvs-commit at gcc dot gnu dot org
2004-05-28 22:18 ` [Bug target/13250] [3.4 only] " pinskia at gcc dot gnu dot org
` (4 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: cvs-commit at gcc dot gnu dot org @ 2004-05-28 21:04 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From cvs-commit at gcc dot gnu dot org 2004-05-28 05:47 -------
Subject: Bug 13250
CVSROOT: /cvs/gcc
Module name: gcc
Changes by: kkojima@gcc.gnu.org 2004-05-28 05:47:37
Modified files:
gcc : ChangeLog
gcc/config/sh : sh.md
Log message:
PR target/13250
* config/sh/sh.md (rotlsi3): Use emit_move_insn.
Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/ChangeLog.diff?cvsroot=gcc&r1=2.3767&r2=2.3768
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/config/sh/sh.md.diff?cvsroot=gcc&r1=1.171&r2=1.172
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=13250
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug target/13250] [3.4 only] [SH] Gcc code for rotation clobbers the register, but gcc continues to use the register as if it was not clobbered
2003-12-01 1:49 [Bug optimization/13250] New: [SH] Gcc code for rotation clobbers the register, but gcc continues to use the register as if it was not clobbered uwe at netbsd dot org
` (6 preceding siblings ...)
2004-05-28 21:04 ` cvs-commit at gcc dot gnu dot org
@ 2004-05-28 22:18 ` pinskia at gcc dot gnu dot org
2004-06-01 0:08 ` cvs-commit at gcc dot gnu dot org
` (3 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-05-28 22:18 UTC (permalink / raw)
To: gcc-bugs
--
What |Removed |Added
----------------------------------------------------------------------------
Known to work| |3.5.0
Summary|[SH] Gcc code for rotation |[3.4 only] [SH] Gcc code for
|clobbers the register, but |rotation clobbers the
|gcc continues to use the |register, but gcc continues
|register as if it was not |to use the register as if it
|clobbered |was not clobbered
Target Milestone|--- |3.4.1
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=13250
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug target/13250] [3.4 only] [SH] Gcc code for rotation clobbers the register, but gcc continues to use the register as if it was not clobbered
2003-12-01 1:49 [Bug optimization/13250] New: [SH] Gcc code for rotation clobbers the register, but gcc continues to use the register as if it was not clobbered uwe at netbsd dot org
` (7 preceding siblings ...)
2004-05-28 22:18 ` [Bug target/13250] [3.4 only] " pinskia at gcc dot gnu dot org
@ 2004-06-01 0:08 ` cvs-commit at gcc dot gnu dot org
2004-06-01 0:13 ` pinskia at gcc dot gnu dot org
` (2 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: cvs-commit at gcc dot gnu dot org @ 2004-06-01 0:08 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From cvs-commit at gcc dot gnu dot org 2004-06-01 00:07 -------
Subject: Bug 13250
CVSROOT: /cvs/gcc
Module name: gcc
Branch: gcc-3_4-branch
Changes by: kkojima@gcc.gnu.org 2004-06-01 00:07:52
Modified files:
gcc : ChangeLog
gcc/config/sh : sh.md
Log message:
PR target/13250
Backport from mainline:
2004-05-28 Kaz Kojima <kkojima@gcc.gnu.org>
* config/sh/sh.md (rotlsi3): Use emit_move_insn.
Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=2.2326.2.461&r2=2.2326.2.462
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/config/sh/sh.md.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=1.165.4.2&r2=1.165.4.3
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=13250
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug target/13250] [3.4 only] [SH] Gcc code for rotation clobbers the register, but gcc continues to use the register as if it was not clobbered
2003-12-01 1:49 [Bug optimization/13250] New: [SH] Gcc code for rotation clobbers the register, but gcc continues to use the register as if it was not clobbered uwe at netbsd dot org
` (8 preceding siblings ...)
2004-06-01 0:08 ` cvs-commit at gcc dot gnu dot org
@ 2004-06-01 0:13 ` pinskia at gcc dot gnu dot org
2004-07-26 0:48 ` cvs-commit at gcc dot gnu dot org
2004-07-26 0:52 ` pinskia at gcc dot gnu dot org
11 siblings, 0 replies; 13+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-06-01 0:13 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From pinskia at gcc dot gnu dot org 2004-06-01 00:13 -------
Fixed.
--
What |Removed |Added
----------------------------------------------------------------------------
Status|ASSIGNED |RESOLVED
Resolution| |FIXED
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=13250
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug target/13250] [3.4 only] [SH] Gcc code for rotation clobbers the register, but gcc continues to use the register as if it was not clobbered
2003-12-01 1:49 [Bug optimization/13250] New: [SH] Gcc code for rotation clobbers the register, but gcc continues to use the register as if it was not clobbered uwe at netbsd dot org
` (9 preceding siblings ...)
2004-06-01 0:13 ` pinskia at gcc dot gnu dot org
@ 2004-07-26 0:48 ` cvs-commit at gcc dot gnu dot org
2004-07-26 0:52 ` pinskia at gcc dot gnu dot org
11 siblings, 0 replies; 13+ messages in thread
From: cvs-commit at gcc dot gnu dot org @ 2004-07-26 0:48 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From cvs-commit at gcc dot gnu dot org 2004-07-26 00:48 -------
Subject: Bug 13250
CVSROOT: /cvs/gcc
Module name: gcc
Branch: gcc-3_3-branch
Changes by: kkojima@gcc.gnu.org 2004-07-26 00:48:24
Modified files:
gcc : ChangeLog
gcc/config/sh : sh.md t-linux
libstdc++-v3 : ChangeLog configure
Added files:
gcc/config/sh : libgcc-std.ver
Log message:
PR target/13250
Backport from mainline:
* config/sh/sh.md (rotlsi3): Use emit_move_insn.
PR target/15647
Backport from mainline:
* config/sh/t-linux (SHLIB_MAPFILES): Use sh specific
libgcc-std.ver.
* config/sh/libgcc-std.ver: New file.
PR bootstrap/15120
* libstdc++-v3/configure: Rebuilt.
Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-3_3-branch&r1=1.16114.2.1006&r2=1.16114.2.1007
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/config/sh/libgcc-std.ver.diff?cvsroot=gcc&only_with_tag=gcc-3_3-branch&r1=NONE&r2=1.2.10.1
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/config/sh/sh.md.diff?cvsroot=gcc&only_with_tag=gcc-3_3-branch&r1=1.133.2.3&r2=1.133.2.4
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/config/sh/t-linux.diff?cvsroot=gcc&only_with_tag=gcc-3_3-branch&r1=1.6.20.2&r2=1.6.20.3
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libstdc++-v3/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-3_3-branch&r1=1.1464.2.188&r2=1.1464.2.189
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libstdc++-v3/configure.diff?cvsroot=gcc&only_with_tag=gcc-3_3-branch&r1=1.286.2.22&r2=1.286.2.23
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=13250
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug target/13250] [3.4 only] [SH] Gcc code for rotation clobbers the register, but gcc continues to use the register as if it was not clobbered
2003-12-01 1:49 [Bug optimization/13250] New: [SH] Gcc code for rotation clobbers the register, but gcc continues to use the register as if it was not clobbered uwe at netbsd dot org
` (10 preceding siblings ...)
2004-07-26 0:48 ` cvs-commit at gcc dot gnu dot org
@ 2004-07-26 0:52 ` pinskia at gcc dot gnu dot org
11 siblings, 0 replies; 13+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-07-26 0:52 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From pinskia at gcc dot gnu dot org 2004-07-26 00:52 -------
Fixed also in 3.3.5
--
What |Removed |Added
----------------------------------------------------------------------------
Known to work|3.5.0 |3.5.0 3.4.1 3.3.5
Target Milestone|3.4.1 |3.3.5
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=13250
^ permalink raw reply [flat|nested] 13+ messages in thread
end of thread, other threads:[~2004-07-26 0:52 UTC | newest]
Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-12-01 1:49 [Bug optimization/13250] New: [SH] Gcc code for rotation clobbers the register, but gcc continues to use the register as if it was not clobbered uwe at netbsd dot org
2003-12-01 1:50 ` [Bug optimization/13250] " uwe at netbsd dot org
2003-12-01 1:55 ` pinskia at gcc dot gnu dot org
2004-01-21 4:03 ` dhazeghi at yahoo dot com
2004-05-27 17:31 ` [Bug target/13250] " kkojima at gcc dot gnu dot org
2004-05-28 16:05 ` uwe at ptc dot spbu dot ru
2004-05-28 20:17 ` kkojima at gcc dot gnu dot org
2004-05-28 21:04 ` cvs-commit at gcc dot gnu dot org
2004-05-28 22:18 ` [Bug target/13250] [3.4 only] " pinskia at gcc dot gnu dot org
2004-06-01 0:08 ` cvs-commit at gcc dot gnu dot org
2004-06-01 0:13 ` pinskia at gcc dot gnu dot org
2004-07-26 0:48 ` cvs-commit at gcc dot gnu dot org
2004-07-26 0:52 ` pinskia at gcc dot gnu dot org
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).