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]

[PATCH] Fix REG_EQUAL note in x86 -m8bit-idiv code


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.

--- 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


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