public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug rtl-optimization/54524] New: Spurious add on sum of bitshifts
@ 2012-09-08  9:28 jan.smets@alcatel-lucent.com
  2012-09-08 13:19 ` [Bug rtl-optimization/54524] " jan.smets@alcatel-lucent.com
                   ` (12 more replies)
  0 siblings, 13 replies; 14+ messages in thread
From: jan.smets@alcatel-lucent.com @ 2012-09-08  9:28 UTC (permalink / raw)
  To: gcc-bugs

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


^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2013-01-07 13:31 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-09-08  9:28 [Bug rtl-optimization/54524] New: Spurious add on sum of bitshifts jan.smets@alcatel-lucent.com
2012-09-08 13:19 ` [Bug rtl-optimization/54524] " jan.smets@alcatel-lucent.com
2012-09-18  8:22 ` [Bug rtl-optimization/54524] Spurious add on sum of bitshifts (forward-propagate issue) jan.smets@alcatel-lucent.com
2012-09-18 12:42 ` jan.smets@alcatel-lucent.com
2012-09-18 13:06 ` [Bug rtl-optimization/54524] [4.6/4.7/4.8 Regression] " rguenth at gcc dot gnu.org
2012-09-18 21:49 ` jan.smets@alcatel-lucent.com
2012-09-19  1:39 ` pinskia at gcc dot gnu.org
2012-09-19  8:46 ` rguenth at gcc dot gnu.org
2012-09-22 22:26 ` pinskia at gcc dot gnu.org
2012-11-02 23:33 ` pinskia at gcc dot gnu.org
2012-11-02 23:34 ` [Bug rtl-optimization/54524] [4.6/4.7 " pinskia at gcc dot gnu.org
2012-11-03 18:25 ` jan.smets@alcatel-lucent.com
2012-12-03 15:43 ` rguenth at gcc dot gnu.org
2013-01-07 13:31 ` jan.smets@alcatel-lucent.com

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