From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1039) id 4C37C385840E; Tue, 25 Oct 2022 17:31:07 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 4C37C385840E DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1666719073; bh=5PfVQIDkG2eoE7qfw+tCs2JhNxjyms0skrRzQXaNjos=; h=From:To:Subject:Date:From; b=AvhTAF0lm5e8MoBlIytT6SHT1erbFkUhbQNhslSQXwf+/MFqL9YVHjmdK0IDWV6uY R1sV5Oo/HnNkZmmWoQMUkwWuNMTu82j/D5mNNQChDByg3/mbr35yQyf9sYxIWLgN3o LW/FONxk00s3lr4z89fZ8oMo9yOv5b/BxGn1GRYE= MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="utf-8" From: H.J. Lu To: gcc-cvs@gcc.gnu.org Subject: [gcc r13-3490] Always use TYPE_MODE instead of DECL_MODE for vector field X-Act-Checkin: gcc X-Git-Author: H.J. Lu X-Git-Refname: refs/heads/master X-Git-Oldrev: e6a29aab51122103e677ffed523371c9c816ec98 X-Git-Newrev: 1c64aba8cdf6509533f554ad86640f274cdbe37f Message-Id: <20221025173113.4C37C385840E@sourceware.org> Date: Tue, 25 Oct 2022 17:31:07 +0000 (GMT) List-Id: https://gcc.gnu.org/g:1c64aba8cdf6509533f554ad86640f274cdbe37f commit r13-3490-g1c64aba8cdf6509533f554ad86640f274cdbe37f Author: H.J. Lu Date: Wed Oct 19 12:53:35 2022 -0700 Always use TYPE_MODE instead of DECL_MODE for vector field e034c5c8957 re PR target/78643 (ICE in convert_move, at expr.c:230) fixed the case where DECL_MODE of a vector field is BLKmode and its TYPE_MODE is a vector mode because of target attribute. Remove the BLKmode check for the case where DECL_MODE of a vector field is a vector mode and its TYPE_MODE isn't a vector mode because of target attribute. gcc/ PR target/107304 * expr.cc (get_inner_reference): Always use TYPE_MODE for vector field with vector raw mode. gcc/testsuite/ PR target/107304 * gcc.target/i386/pr107304.c: New test. Diff: --- gcc/expr.cc | 3 +-- gcc/testsuite/gcc.target/i386/pr107304.c | 39 ++++++++++++++++++++++++++++++++ 2 files changed, 40 insertions(+), 2 deletions(-) diff --git a/gcc/expr.cc b/gcc/expr.cc index efe387e6173..9145193c2c1 100644 --- a/gcc/expr.cc +++ b/gcc/expr.cc @@ -7905,8 +7905,7 @@ get_inner_reference (tree exp, poly_int64_pod *pbitsize, /* For vector fields re-check the target flags, as DECL_MODE could have been set with different target flags than the current function has. */ - if (mode == BLKmode - && VECTOR_TYPE_P (TREE_TYPE (field)) + if (VECTOR_TYPE_P (TREE_TYPE (field)) && VECTOR_MODE_P (TYPE_MODE_RAW (TREE_TYPE (field)))) mode = TYPE_MODE (TREE_TYPE (field)); } diff --git a/gcc/testsuite/gcc.target/i386/pr107304.c b/gcc/testsuite/gcc.target/i386/pr107304.c new file mode 100644 index 00000000000..24d68795e7f --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/pr107304.c @@ -0,0 +1,39 @@ +/* { dg-do compile } */ +/* { dg-options "-O0 -march=tigerlake" } */ + +#include + +typedef union { + uint8_t v __attribute__((aligned(256))) __attribute__ ((vector_size(64 * sizeof(uint8_t)))); + uint8_t i[64] __attribute__((aligned(256))); +} stress_vec_u8_64_t; + +typedef struct { + struct { + stress_vec_u8_64_t s; + stress_vec_u8_64_t o; + stress_vec_u8_64_t mask1; + stress_vec_u8_64_t mask2; + } u8_64; +} stress_vec_data_t; + +__attribute__((target_clones("arch=alderlake", "default"))) +void +stress_vecshuf_u8_64(stress_vec_data_t *data) +{ + stress_vec_u8_64_t *__restrict s; + stress_vec_u8_64_t *__restrict mask1; + stress_vec_u8_64_t *__restrict mask2; + register int i; + + s = &data->u8_64.s; + mask1 = &data->u8_64.mask1; + mask2 = &data->u8_64.mask2; + + for (i = 0; i < 256; i++) { /* was i < 65536 */ + stress_vec_u8_64_t tmp; + + tmp.v = __builtin_shuffle(s->v, mask1->v); + s->v = __builtin_shuffle(tmp.v, mask2->v); + } +}