This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Even numbered register pairs restriction on some instructions


On 31/08/18 18:06, Jeff Law wrote:
On 08/31/2018 09:41 AM, Matthew Malcomson wrote:
Hi there,

I'm looking into whether it's possible to require even numbered
registers on
modes that need more than one hard-register to represent them. But only in
some cases.

The problem is the one mentioned explicitly here
https://gcc.gnu.org/onlinedocs/gccint/Register-Classes.html about
enforcing a
requirement for a register pair to start with an even-numbered register.
I can't use TARGET_HARD_REGNO_MODE_OK as suggested in that document
because I'd
like to allow register pairs starting with odd-numbered registers in
general,
but not in some specific cases.

 From a comment in gcc/config/sparc/constraints.md above the constraint
"U" it
looks like there isn't a way to define such a constraint when using LRA,
and I
haven't found any hook that could do so but I'm hoping there's something
I'm
missing.

The best thing I can think of is to define a bunch of classes ZERO_ONE,
TWO_THREE, FOUR_FIVE, ..., define a constraint on each of those classes,
then
use all the constraints as one alternative in my pattern.

Is there a better method?

Is there some small change that could enable a nicer method?
It would help to know more about when you want to allow odd registers.
For concreteness: I'm looking at TImode registers that will span 2 hard registers.

In most cases it's fine for these register pairs to start at either an odd or even hard register.

I'd like to restrict TImode registers to even registers only in one or two patterns.
(for concreteness: in order to use the aarch64 casp instruction)

I'd be surprised if creating a class, but still rejecting in
HARD_REGNO_MODE_OK worked...
Sorry: I don't know what you mean by creating a class and rejecting it in HARD_REGNO_MODE_OK. As far as I can tell, HARD_REGNO_MODE_OK is only given information on the register number and the mode of the value, so it knows nothing about the register class any constraint may be applying.

I mentioned HARD_REGNO_MODE_OK just because the documentation page I linked to said that was the way to implement limiting register pairs to those beginning with an even numbered register and I wanted to explain why this wasn't applicable in my case (due to not being able to limit the restriction
to certain patterns).
Jeff
Matthew


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]