diff mbox series

Fix REG_EQUAL note in x86 -m8bit-idiv code

Message ID 20170929205932.GO1701@tucnak
State New
Headers show
Series Fix REG_EQUAL note in x86 -m8bit-idiv code | expand

Commit Message

Jakub Jelinek Sept. 29, 2017, 8:59 p.m. UTC
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.


	Jakub

Comments

Uros Bizjak Sept. 30, 2017, 7:42 a.m. UTC | #1
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
diff mbox series

Patch

--- 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.  */