This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] Fix REG_EQUAL note in x86 -m8bit-idiv code
- From: Uros Bizjak <ubizjak at gmail dot com>
- To: Jakub Jelinek <jakub at redhat dot com>
- Cc: "gcc-patches at gcc dot gnu dot org" <gcc-patches at gcc dot gnu dot org>
- Date: Sat, 30 Sep 2017 09:42:14 +0200
- Subject: Re: [PATCH] Fix REG_EQUAL note in x86 -m8bit-idiv code
- Authentication-results: sourceware.org; auth=none
- References: <20170929205932.GO1701@tucnak>
On Fri, Sep 29, 2017 at 10:59 PM, Jakub Jelinek <jakub@redhat.com> wrote:
> Hi!
>
> While working on the following patch, I've discovered that the REG_EQUAL
> notes for DImode signed/unsigned division/modulo are wrong, there is
> e.g. (div:SI (reg:DI ...) (reg:DI ...)).
>
> Fixed thusly, bootstrapped/regtested on x86_64-linux and i686-linux, ok for
> trunk?
>
> 2017-09-29 Jakub Jelinek <jakub@redhat.com>
>
> * config/i386/i386.c (ix86_split_idivmod): Use mode instead of
> always SImode for DIV and MOD in REG_EQUAL notes.
OK for mainline and release branches.
Thanks,
Uros.
> --- gcc/config/i386/i386.c.jj 2017-09-28 20:35:14.000000000 +0200
> +++ gcc/config/i386/i386.c 2017-09-29 19:15:27.822267844 +0200
> @@ -21980,13 +21980,13 @@ ix86_split_idivmod (machine_mode mode, r
>
> if (signed_p)
> {
> - div = gen_rtx_DIV (SImode, operands[2], operands[3]);
> - mod = gen_rtx_MOD (SImode, operands[2], operands[3]);
> + div = gen_rtx_DIV (mode, operands[2], operands[3]);
> + mod = gen_rtx_MOD (mode, operands[2], operands[3]);
> }
> else
> {
> - div = gen_rtx_UDIV (SImode, operands[2], operands[3]);
> - mod = gen_rtx_UMOD (SImode, operands[2], operands[3]);
> + div = gen_rtx_UDIV (mode, operands[2], operands[3]);
> + mod = gen_rtx_UMOD (mode, operands[2], operands[3]);
> }
>
> /* Extract remainder from AH. */
>
> Jakub