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, 15 Jun 2021 09:36:47 +0000 (11:36 +0200)
commit008153c8435ca3bf587e11654c31f05c0f99b43a
tree8f593a3242e9e03901cd75e7deec30f3a12754b1
parentdfef1164b1c8d0b7abdf302f94d4be99a75ca791
expr: Fix up VEC_PACK_TRUNC_EXPR expansion [PR101046]

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.

* gcc.target/i386/pr101046.c: New test.
gcc/expr.c
gcc/testsuite/gcc.target/i386/pr101046.c [new file with mode: 0644]