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: expr.c: don't assume MUL for scaling pointers


> 
> -----Original Message-----
> From: gcc-patches-owner@gcc.gnu.org [mailto:gcc-patches-owner@gcc.gnu.org] On Behalf Of DJ Delorie
> Sent: Wednesday, November 02, 2011 11:24 PM
> To: gcc-patches@gcc.gnu.org
> Subject: expr.c: don't assume MUL for scaling pointers
> 
> 
> GCC assumes the target has a multiply insn, but better code is generated using shifts if it doesn't (vs a libcall).  Found with the rl78-elf port.
> 
> 	* expr.c (expand_expr_real_2): Don't try to emit a MUL-based
> 	expression if the target doesn't have a multiply pattern.  Fall
> 	back to shifts instead of using libgcc calls.

Does this also work if the target has a multiply pattern but that is only enabled some of the time (for example, depending on the specified -march=xyz value)?  What about the case where mul is available but much higher cost than shift?

	paul


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