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

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).