]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
expr: Fix up VEC_PACK_TRUNC_EXPR expansion [PR101046]
authorJakub Jelinek <jakub@redhat.com>
Tue, 15 Jun 2021 09:36:47 +0000 (11:36 +0200)
committerJakub Jelinek <jakub@redhat.com>
Tue, 10 May 2022 08:14:23 +0000 (10:14 +0200)
The following testcase ICEs, because we have a mode mismatch.
VEC_PACK_TRUNC_EXPR's operands have different modes from the result
(same vector mode size but twice as large element),
but we were passing non-NULL subtarget with the mode of the result
to the expansion of its arguments, so the VEC_PERM_EXPR in one of the
operands which had V8SImode operands and result had V16HImode target.

Fixed by clearing the subtarget if we are changing mode.

2021-06-15  Jakub Jelinek  <jakub@redhat.com>

PR target/101046
* expr.c (expand_expr_real_2) <case VEC_PACK_FIX_TRUNC_EXPR,
case VEC_PACK_TRUNC_EXPR>: Clear subtarget when changing mode.

(cherry picked from commit 008153c8435ca3bf587e11654c31f05c0f99b43a)

gcc/expr.c

index c4bffd0f1995fb93ed2aac431336c7491bd8694f..10f0b816dd1875ab944d336e58e987ee68b0ec75 100644 (file)
@@ -9658,6 +9658,7 @@ expand_expr_real_2 (sepops ops, rtx target, machine_mode tmode,
     case VEC_PACK_SAT_EXPR:
     case VEC_PACK_FIX_TRUNC_EXPR:
       mode = TYPE_MODE (TREE_TYPE (treeop0));
+      subtarget = NULL_RTX;
       goto binop;
 
     case VEC_PACK_TRUNC_EXPR:
@@ -9681,6 +9682,7 @@ expand_expr_real_2 (sepops ops, rtx target, machine_mode tmode,
          return eops[0].value;
        }
       mode = TYPE_MODE (TREE_TYPE (treeop0));
+      subtarget = NULL_RTX;
       goto binop;
 
     case VEC_PACK_FLOAT_EXPR: