This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
continous complexes & bad reload class if LIMIT_RELOAD_CLASS not defined
- To: gcc-bugs at gcc dot gnu dot org, gcc at gcc dot gnu dot org
- Subject: continous complexes & bad reload class if LIMIT_RELOAD_CLASS not defined
- From: Benedetto Proietti <betto at ifh dot de>
- Date: Tue, 04 Jul 2000 22:53:11 +0200
Hi,
in our machine there are two kind of processors, and in my port of GNU I
essentially use two different classes of register to model this fact.
One kind of them handles integer numbers and pointers, the other handles
floating point numbers (including complexes).
The two classes are obviously completely separated in the machine
description, meaning that each machine mode instructions has the
constraints relative to the right processor.
Moreover the macro HARD_REGNO_MODE_OK ensures that the register are
loaded with the proper value.
I want to speak about 2 facts: one possible proposal & one possible bug.
1.
Our machine complexes are natively supported, meaning that single
instructions can manipulate them, move them and so on.
They need to be contiguous on the register file, and starting at an even
register.
The second requirement is easy to obtain, the first is not in the GNU
compiler.
As far as I know complexes are handled as a CONCAT, that is a
concatenation of two registers that can be also not contiguous: this to
help for processors that don't support complexes.
What for processors that do?
I have tried in many ways to support complexes in contiguous registers,
with no success.
Then I have changed few lines and it works!
Simply, in gen_rtx_reg, I have changed the piece that allocate two
SFmode registers and makes a CONCAT of them. Now, it allocates a SCmode
register!
The good thing is that gcc is smart enough to access the real and
imaginary parts with a SUBREG!
See the old and the new code, at emit-rtl.c line 570.
/* OLD gcc
realpart = gen_reg_rtx (partmode);
imagpart = gen_reg_rtx (partmode);
return gen_rtx_CONCAT (mode, realpart, imagpart);
*/
//New code
rtx reg_32 = gen_reg_rtx (DFmode);
PUT_MODE (reg_32, SCmode);
return reg_32;
For instance that's the only way I know to make a register in SCmode.
2.
Multiplying a float and a complex brings gcc to see the float as a
complex number with zero imaginary part. OK.
So it loaded an even register with the float number (real part) and the
following register (imag) with zero.
But when reloading the imaginary part, gcc used to reload it in a
register of the "integer" class!
Note that LIMIT_RELOAD_CLASS was not defined.
I just defined it to CLASS, and then works fine!
Having modified something in the internal representation I don't know if
I have brought the problem or if it a bug of gcc.
Please let me know your opinion.
bye
Benedetto