This is the mail archive of the
cgen@sources.redhat.com
mailing list for the CGEN project.
Re: bits in registers
- To: Doug Evans <dje at transmeta dot com>
- Subject: Re: bits in registers
- From: Ben Elliston <bje at redhat dot com>
- Date: Mon, 15 Jan 2001 09:51:29 +1100 (EST)
- Cc: Johan Rydberg <johan dot rydberg at netinsight dot se>, <cgen at sources dot redhat dot com>
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