diff mbox series

i386: Fix split_double_mode with paradoxical subreg [PR100626]

Message ID CAFULd4bJo16Np4dn14huTrMaEFPn0S+jUX3w9m_VRx6JSzzFmg@mail.gmail.com
State New
Headers show
Series i386: Fix split_double_mode with paradoxical subreg [PR100626] | expand

Commit Message

Uros Bizjak May 18, 2021, 1:51 p.m. UTC
split_double_mode calls simplify_gen_subreg, which fails for the
high half of the paradoxical subreg.  Return temporary register
instead of NULL RTX in this case.

I was not able to construct a testcase without warnings.

2021-05-18  Uroš Bizjak  <ubizjak@gmail.com>

gcc/
    PR target/100626
    * config/i386/i386-expand.c (split_double_mode): Return
    temporary register when simplify_gen_subreg fails with
    the high half of the paradoxical subreg.

Bootstrapped and regression tested on x86_64-linux-gnu {,-m32}.

Pushed to master, will be backported to other release branches.

Uros.
diff mbox series

Patch

diff --git a/gcc/config/i386/i386-expand.c b/gcc/config/i386/i386-expand.c
index 0fa8d45a684..9f3d41955a2 100644
--- a/gcc/config/i386/i386-expand.c
+++ b/gcc/config/i386/i386-expand.c
@@ -154,9 +154,13 @@  split_double_mode (machine_mode mode, rtx operands[],
 	  lo_half[num] = simplify_gen_subreg (half_mode, op,
 					      GET_MODE (op) == VOIDmode
 					      ? mode : GET_MODE (op), 0);
-	  hi_half[num] = simplify_gen_subreg (half_mode, op,
-					      GET_MODE (op) == VOIDmode
-					      ? mode : GET_MODE (op), byte);
+
+	  rtx tmp = simplify_gen_subreg (half_mode, op,
+					 GET_MODE (op) == VOIDmode
+					 ? mode : GET_MODE (op), byte);
+	  /* simplify_gen_subreg will return NULL RTX for the
+	     high half of the paradoxical subreg. */
+	  hi_half[num] = tmp ? tmp : gen_reg_rtx (half_mode);
 	}
     }
 }