This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug rtl-optimization/35371] New: Missing REG_POINTER attribute causes bad indexed load/store operand ordering
- From: "bergner at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 25 Feb 2008 20:04:15 -0000
- Subject: [Bug rtl-optimization/35371] New: Missing REG_POINTER attribute causes bad indexed load/store operand ordering
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
We fail to correctly order the operands for the indexed store within the loop
below. This seems to be caused by a missing REG_POINTER attribute, so the code
added for PR28690 doesn't have a chance of getting the ordering correct. An
interesting thing is that if we replace the global array with an "extern int
*reg_values;", then we get the ordering correct.
bergner@etna:~/gcc/tests> cat a2-loop.c
int reg_values[1024];
void
clear_table (unsigned int n)
{
unsigned int i;
for (i = 0; i < n; i++)
reg_values[i] = 0;
}
The "bad" code gen looks like (using -O2 -S):
clear_table:
cmpwi 0,3,0
beqlr- 0
lis 9,reg_values@ha
slwi 3,3,2
la 9,reg_values@l(9)
li 11,0
li 0,0
.p2align 4,,15
.L3:
stwx 0,11,9
addi 11,11,4
cmpw 7,11,3
bne+ 7,.L3
blr
It's another question on why this isn't using an update form store and branch
on count loop, to halve the size of the loop. The loop size is particularly
glaring when you use -O2 -funroll-loops, then we get 8 indexed stores (all with
the wrong operand order) and 8 addi's...but I guess that's for another
bugzilla.
--
Summary: Missing REG_POINTER attribute causes bad indexed
load/store operand ordering
Product: gcc
Version: 4.4.0
Status: UNCONFIRMED
Keywords: missed-optimization
Severity: normal
Priority: P3
Component: rtl-optimization
AssignedTo: bergner at gcc dot gnu dot org
ReportedBy: bergner at gcc dot gnu dot org
GCC build triplet: powerpc64-linux
GCC host triplet: powerpc64-linux
GCC target triplet: powerpc64-linux
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=35371