[Bug rtl-optimization/54524] New: Spurious add on sum of bitshifts
jan.smets@alcatel-lucent.com
gcc-bugzilla@gcc.gnu.org
Sat Sep 8 09:28:00 GMT 2012
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
More information about the Gcc-bugs
mailing list