i386: Fix split_double_mode with paradoxical subreg [PR100626]
authorUros Bizjak <ubizjak@gmail.com>
Tue, 18 May 2021 13:45:54 +0000 (15:45 +0200)
committerUros Bizjak <ubizjak@gmail.com>
Tue, 18 May 2021 13:46:32 +0000 (15:46 +0200)
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.

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 od the paradoxical subreg.

gcc/config/i386/i386-expand.c

index 0fa8d45..9f3d419 100644 (file)
@@ -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);
        }
     }
 }