bits in registers

Ben Elliston bje@redhat.com
Sun Jan 14 14:51:00 GMT 2001


dje wrote:

    > Is there a simple way to, for example, modify bit 2 in (reg h-cr 2),
    > or do I have to mask and or it into place?

   The appropriate rtx fns need only be created ...

Yes, these would be extremely useful.  As would a pair rtl expressions for
testing if a particular bit is set or clear.  Here are two pmacros I have
used for this in the past:

  (define-pmacro (bitset? value bit-num)
    (and value (sll 1 bit-num)))
  (define-pmacro (bitclear? value bit-num)
    (not (bitset? value bit-num)))

Ben



More information about the Cgen mailing list