This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: expr.c: don't assume MUL for scaling pointers
- From: Paul Koning <paulkoning at comcast dot net>
- To: GCC Patches <gcc-patches at gcc dot gnu dot org>
- Date: Tue, 8 Nov 2011 14:19:00 -0500
- Subject: Re: expr.c: don't assume MUL for scaling pointers
- References: <201111030323.pA33Nm9W029413@greed.delorie.com> <09787EF419216C41A903FD14EE5506DD030DA81774@AUSX7MCPC103.AMER.DELL.COM>
>
> -----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