This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: redundant divmodsi4 not optimized away
- From: Ian Lance Taylor <iant at google dot com>
- To: Greg McGary <greg at mcgary dot org>
- Cc: gcc at gcc dot gnu dot org
- Date: Mon, 26 Apr 2010 22:09:51 -0700
- Subject: Re: redundant divmodsi4 not optimized away
- References: <4BD636EF.2050605@mcgary.org>
Greg McGary <greg@mcgary.org> writes:
> I have a port without div or mod machine instructions. I wrote
> divmodsi4 patterns that do the libcall directly, hoping that GCC would
> recognize the opportunity to use a single divmodsi4 to compute both
> quotient and remainder. Alas, GCC calls divmodsi4 twice with the same
> divisor and dividend operands. Is this supposed to work? Is there a
> special trick to help the optimizer recognize the redundant insn? I
> saw the 4yr-old thread regarding picochip's desire for the same effect
> and followed the same approach implemented in the current picochip.md
> (as well as my own approach) but no luck.
Using a divmodsi4 insn instead of divsi3/modsi3 insns ought to work.
You may need to give more information, such as the test case you are
using, and what your divmodsi4 insn looks like.
Ian