From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 12197 invoked by alias); 8 Sep 2012 09:28:39 -0000 Received: (qmail 12188 invoked by uid 22791); 8 Sep 2012 09:28:38 -0000 X-SWARE-Spam-Status: No, hits=-3.5 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00,TW_SR X-Spam-Check-By: sourceware.org Received: from localhost (HELO gcc.gnu.org) (127.0.0.1) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Sat, 08 Sep 2012 09:28:26 +0000 From: "jan.smets@alcatel-lucent.com" To: gcc-bugs@gcc.gnu.org Subject: [Bug rtl-optimization/54524] New: Spurious add on sum of bitshifts Date: Sat, 08 Sep 2012 09:28:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: rtl-optimization X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: jan.smets@alcatel-lucent.com X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Changed-Fields: Message-ID: X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated Content-Type: text/plain; charset="UTF-8" MIME-Version: 1.0 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org X-SW-Source: 2012-09/txt/msg00665.txt.bz2 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54524 Bug #: 54524 Summary: Spurious add on sum of bitshifts Classification: Unclassified Product: gcc Version: 4.6.3 Status: UNCONFIRMED Severity: normal Priority: P3 Component: rtl-optimization AssignedTo: unassigned@gcc.gnu.org ReportedBy: jan.smets@alcatel-lucent.com There is an spurious addiu a2,a2,1 which causes the result to be incorrect. tUint32 is unsigned long long MIPS O32 GCC 4.6.3 -nostdinc -funsigned-char -fno-builtin -march=mips2 -G 0 -mno-gpopt -msoft-float -fno-merge-constants -pipe -Wall -O2 -fno-optimize-sibling-calls -fno-partial-inlining -fno-reorder-blocks -fno-strict-aliasing PUBLIC void function( tUint32 index160, tUint8 * data) { tUint8 temp_data[160/8]; tUint32 scrambled_address; *(tUint64*)(temp_data+8) = *(tUint64*)(data+8); scrambled_address = index160; printf("%16llX.\n", 0x4000000000400000ull + (((tUint64)*(tUint16*)(temp_data+12)) << 24) + ((tUint64)(scrambled_address & 0xFF) << 56)); } 0x364c70c 27bdffd0 addiu sp,sp,-48 0x364c710 afbf002c sw ra,44(sp) 0x364c714 8ca8000c lw t0,12(a1) t0 = pp qq rr ss 0x364c718 3c030040 lui v1,0x40 v1 = 00 40 00 00 0x364c71c 3c024000 lui v0,0x4000 v0 = 40 00 00 00 0x364c720 00085402 srl t2,t0,16 t2 = 00 00 pp qq 0x364c724 000a4e00 sll t1,t2,24 t1 = qq 00 00 00 0x364c728 01233821 addu a3,t1,v1 a3 = qq 40 00 00 0x364c72c 000a5202 srl t2,t2,8 t2 = 00 00 00 pp 0x364c730 00e9482b sltu t1,a3,t1 t1 = carry? 0x364c734 01421021 addu v0,t2,v0 v0 = 40 00 00 pp 0x364c738 00042600 sll a0,a0,24 a0 = index160 << 24 0x364c73c 8ca30008 lw v1,8(a1) 0x364c740 01221021 addu v0,t1,v0 v0 += carry 0x364c744 00443021 addu a2,v0,a0 a2 = v0 + index160 << 24 0x364c748 3c04066e lui a0,0x66e \_ String address 0x364c74c 24842084 addiu a0,a0,8324 / 0x364c750 24c60001 addiu a2,a2,1 - Spurious add 0x364c754 afa30018 sw v1,24(sp) 0x364c758 0cb402e1 jal printf - Takes a0 = string. a1 = low word, a2 = high word 0x364c75c afa8001c sw t0,28(sp) 0x364c760 8fbf002c lw ra,44(sp) 0x364c764 8fe00000 lw zero,0(ra) (internal extension) 0x364c768 03e00008 jr ra 0x364c76c 27bd0030 addiu sp,sp,48