This is the mail archive of the gcc-patches@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: [patch] h8300.md: Optimize one case of zero_extract.


On Mon, 3 Mar 2003, Kazu Hirata wrote:
> but this can be optimized to
>
> 	sub.l	er0,er0
>  	mov.b	r3h,r0l
>
> if X and Y are different registers.

For reference, this is usually done through constraints.
Simple usage example:
 ..._operand:SI 0 "r,r"
 ..._operand:SI 1 "?0,r"
 ...
"@
 same
 different"

Shorter than C and IMHO less error-prone.  The "?" is to make
GCC penalize that alternative a bit (not prefer it over the
other case due to the order), since the same-register
alternative IIUC would be more costly in this particular case.

brgds, H-P


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