* expmed.c (expand_mult): Write REG_EQUAL note with proper mode.
authorRichard Kenner <kenner@vlsi1.ultra.nyu.edu>
Sat, 16 Dec 2000 15:43:55 +0000 (15:43 +0000)
committerRichard Kenner <kenner@gcc.gnu.org>
Sat, 16 Dec 2000 15:43:55 +0000 (10:43 -0500)
From-SVN: r38306

gcc/ChangeLog
gcc/expmed.c

index 5d5829766f360ebc6c72f63a6804dcdb1bc320d9..3a5637adf769bcbf9d9c3411a8bb1ac326186693 100644 (file)
@@ -1,3 +1,7 @@
+Sat Dec 16 10:41:11 2000  Richard Kenner  <kenner@vlsi1.ultra.nyu.edu>
+
+       * expmed.c (expand_mult): Write REG_EQUAL note with proper mode.
+
 2000-12-16  Neil Booth  <neil@daikokuya.demon.co.uk>
 
         * tradcpp.c: T_WARNING: New.
index af5d36d6de17970c700037c191eb2f952af3ec88..351dfe4e7ffe002cd109f5a55c3b521caa91bb67 100644 (file)
@@ -2401,6 +2401,7 @@ expand_mult (mode, op0, op1, target, unsignedp)
          /* We found something cheaper than a multiply insn.  */
          int opno;
          rtx accum, tem;
+         enum machine_mode nmode;
 
          op0 = protect_from_queue (op0, 0);
 
@@ -2505,12 +2506,21 @@ expand_mult (mode, op0, op1, target, unsignedp)
                }
 
              /* Write a REG_EQUAL note on the last insn so that we can cse
-                multiplication sequences.  */
+                multiplication sequences.  Note that if ACCUM is a SUBREG,
+                we've set the inner register and must properly indicate
+                that.  */
+
+             tem = op0, nmode = mode;
+             if (GET_CODE (accum) == SUBREG)
+               {
+                 nmode = GET_MODE (SUBREG_REG (accum));
+                 tem = gen_lowpart (nmode, op0);
+               }
 
              insn = get_last_insn ();
              set_unique_reg_note (insn, 
                                   REG_EQUAL,
-                                  gen_rtx_MULT (mode, op0, 
+                                  gen_rtx_MULT (nmode, tem,
                                                 GEN_INT (val_so_far)));
            }