Re: Issue with subregs

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello Segher, Richard, all,

- I found the cause of the problem.
 When subregging, from imode (the larger mode) , to omode (the smaller mode)
  [routine validate_subreg() in emit_rtl.c], it sets :

/poly_uint64 regsize = REGMODE_NATURAL_SIZE (imode);//
/
 If this 'hook' is not defined, it returns 4 on a 32-bit machine (...).
  As the register is in fact byte-organized, it should return 1.
- Now, how should I fix this ??.
  - I need the CCreg to have 2 modes:
    a. The mode wherein it is address as fields of boolean.
        - The nicest would be to have this BImode, but QImode is also acceptable.            [In case of QI mode, the description is such that the RTL constains the values that
            can be contained in the registers to 1 and 0, no other.]
    b. The mode wherein the field is written. (3 or 4 bits) for the compare instruction.         - I have now the 'bit' mode at QImode, and the 'field' mode at SI mode,           and because this 'hook' regmode_natural_size returns 4 for SImode, the           validate_subreg() logic fails. When I disable the check, the whole thing works fine.         - I a way, the logic that GCC calculates REGMODE_NATURAL_SIZE based on the mode,           is wrong. I do understand why it is done like this, but here, there is a situation that           some registers capable of holding SImode have a natural size 4, others 1.         - In GCC, of course, the register type is not knows when this check is run, so
          they cannot check on the register type. This is OK.
        - To solve this, basically:
          a. Make the 'larger' mode CCmode,  and then define the natural size as 1.           b. Submode the SImode. I mean, the CCmode has different 'flavours'. It would be               nice if this can be done for the SImode also, and then these submodes have different
              natural size.
          c. Use some 'unused' mode , and define its natural size as 1.
Q. From your experience, do you know what is worth trying and what not ?.

Best Regards,

Henri.

On 02/03/2020 01:44 PM, Richard Sandiford wrote:
Segher Boessenkool <segher@xxxxxxxxxxxxxxxxxxx> writes:
Hi Richard,

On Mon, Feb 03, 2020 at 11:04:39AM +0000, Richard Sandiford wrote:
Another unfortunate assumption from the old days is:

     case MODE_CC:
       /* Again, nothing more need be said.  For historical reasons,
	 the size of a CC mode is four units.  */
       validate_mode (m, UNSET, UNSET, UNSET, UNSET, UNSET);

       m->bytesize = 4;
       m->ncomponents = 1;
       m->component = 0;
       break;

(genmodes.c).  Nothing much should depend on this behaviour though.
Wow.  Yeah, I don't remember ever seeing this, is size of CC ever used
at all?

So one option might be to:

- Add a new genmodes.c macro (e.g. CC_MODE_WITH_SIZE) that creates a CC
   mode with a specific byte size.
But Henri needs CC regs that are three bits.  The hardware reg is 12 bits,
four times three bits, packed, so subregs can still not work after your
extra macro.
The idea to use a byte size for the smallest thing that needs to be
addressed individually, then use aggregates for everything else.
It doesn't matter whether that thing has 8 significant bits or not.

Richard





[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux