This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [RFT] PR19154: New AVR bit extraction patter
- From: Paul Schlie <schlie at comcast dot net>
- To: Roger Sayle <roger at eyesopen dot com>,Andrew Hutchinson <andrewhutchinson at cox dot net>
- Cc: <gcc-patches at gcc dot gnu dot org>
- Date: Mon, 14 Mar 2005 09:18:01 -0500
- Subject: Re: [RFT] PR19154: New AVR bit extraction patter
> Roger Sayle <roger@eyesopen.com> writes:
>
> The following patch is my attempt to resolve PR middle-end/19154. The
> proposed solution is to introduce new patterns to the AVR backend that
> can be used to efficiently extract a bit from a register. ...
How about something like: (both a little smaller and register agnostic)
For control flow: if (x & (1 << b)) { } else { } ;
BST Rd:4, b:3 ; save Rd bit b in T flag
BRTS/C offset:7 ; branch if T set/clear
For bool values: (x & (1 << b)) ? 1 : 0 ;
BST Rd:4, b:3 ; save Rd bit b in T flag
CLR Rd:4 ; clear Rd bool target
BLD Rd:4, b:3 ; load Rd bit b from T flag