From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 75243 invoked by alias); 4 Apr 2016 21:17:04 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Received: (qmail 72501 invoked by uid 89); 4 Apr 2016 21:17:03 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-0.8 required=5.0 tests=AWL,BAYES_00,FREEMAIL_FROM,KAM_ASCII_DIVIDERS,RCVD_IN_DNSWL_LOW,RP_MATCHES_RCVD,SPF_PASS autolearn=ham version=3.3.2 spammy=Hx-spam-relays-external:unknown, H*RU:unknown, UD:cz, H*c:HHHH X-Spam-User: qpsmtpd, 3 recipients X-HELO: mxs1.seznam.cz Received: from mxs1.seznam.cz (HELO mxs1.seznam.cz) (77.75.78.125) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-GCM-SHA384 encrypted) ESMTPS; Mon, 04 Apr 2016 21:16:53 +0000 Received: from email.seznam.cz by email-smtpc4b.ko.seznam.cz (email-smtpc4b.ko.seznam.cz [10.53.13.105]) id 155e0ddc05d6b7e01554209d; Mon, 04 Apr 2016 23:16:49 +0200 (CEST) Received: from unknown ([::ffff:94.112.80.8]) by email.seznam.cz (szn-ebox-4.5.109) with HTTP; Mon, 04 Apr 2016 23:16:48 +0200 (CEST) From: "Zdenek Sojka" To: Cc: , Subject: [PATCH] Fix PR70509 (wrong code with extract from a v64qi) Date: Mon, 04 Apr 2016 21:17:00 -0000 Message-Id: <1CZ.2iGu.5{uQO1HY3}W.1N0jd0@seznam.cz> Mime-Version: 1.0 (szn-mime-2.0.10) Content-Type: multipart/mixed; boundary="=_6ef0deec497247892e1c6edf=123100c6-f1f7-507f-8e5d-839dd5021d28_=" X-IsSubscribed: yes X-SW-Source: 2016-04/txt/msg00201.txt.bz2 --=_6ef0deec497247892e1c6edf=123100c6-f1f7-507f-8e5d-839dd5021d28_= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Content-length: 1232 Hello, as discussed in the PR, when forwprop propagates VEC_PERM_EXPR through BIT_= FIELD_REF in simplify_bitfield_ref(), the new BIT_FIELD_REF has the index o= f the same type as the vector base type. This patch changes the index to bi= tsize_int(). Bootstrapped on x86_64-pc-linux-gnu, regression test shows the same result = as without the patch. I've test both with/out the second patch mentioned in PR70509#c6 ; it was p= re-approved by Jakub in the PR. I haven't managed to generate a testcase fo= r it though. I was unable to run the testcase via "make check" since my CPU doesn't supp= ort the avx512bw instruction set; however I have tested a standalone testca= se in an emulator, before integrating it to the testsuite. Please replace the changelog entries with a better ones if needed. Thanks, Zdenek gcc/Changelog: 2016-04-04=C2=A0 Zdenek Sojka=C2=A0=20 =C2=A0=C2=A0=C2=A0 PR tree-optimization/70509 =C2=A0=C2=A0=C2=A0 * tree-ssa-forwprop.c (simplify_bitfield_ref): Use bitsi= ze_int () instead of the vector base type for index. gcc/testsuite/Changelog: 2016-04-04=C2=A0 Zdenek Sojka=C2=A0=20 =C2=A0=C2=A0=C2=A0 PR tree-optimization/70509 =C2=A0=C2=A0=C2=A0 * gcc.target/i386/avx512bw-pr70509.c: New. =3D= --=_6ef0deec497247892e1c6edf=123100c6-f1f7-507f-8e5d-839dd5021d28_= Content-Type: text/x-diff; charset=us-ascii; name=pr70509.patch Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; size=1632; filename=pr70509.patch Content-length: 1934 Index: gcc/tree-ssa-forwprop.c =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- gcc/tree-ssa-forwprop.c (revision 234705) +++ gcc/tree-ssa-forwprop.c (working copy) @@ -1773,7 +1773,7 @@ =20 if (code =3D=3D VEC_PERM_EXPR) { - tree p, m, index, tem; + tree p, m, tem; unsigned nelts; m =3D gimple_assign_rhs3 (def_stmt); if (TREE_CODE (m) !=3D VECTOR_CST) @@ -1790,9 +1790,8 @@ p =3D gimple_assign_rhs2 (def_stmt); idx -=3D nelts; } - index =3D build_int_cst (TREE_TYPE (TREE_TYPE (m)), idx * size); tem =3D build3 (BIT_FIELD_REF, TREE_TYPE (op), - unshare_expr (p), op1, index); + unshare_expr (p), op1, bitsize_int (idx * size)); gimple_assign_set_rhs1 (stmt, tem); fold_stmt (gsi); update_stmt (gsi_stmt (*gsi)); Index: gcc/testsuite/gcc.target/i386/avx512bw-pr70509.c =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- gcc/testsuite/gcc.target/i386/avx512bw-pr70509.c (revision 0) +++ gcc/testsuite/gcc.target/i386/avx512bw-pr70509.c (working copy) @@ -0,0 +1,26 @@ +/* PR tree-optimization/70509 */ +/* { dg-do run } */ +/* { dg-options "-O1 -mavx512bw" } */ +/* { dg-require-effective-target avx512bw } */ + +#define AVX512BW +#include "avx512f-helper.h" + +typedef char V __attribute__ ((vector_size (64))); + +int __attribute__ ((noinline, noclone)) +foo (V u, V v) +{ + u /=3D v[0x20]; + return u[0]; +} + +void +TEST (void) +{ + int x =3D foo ((V) { 9 }, (V) { 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0= , 0, 0, + 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 3 }); + if (x !=3D 3) + abort (); +} --=_6ef0deec497247892e1c6edf=123100c6-f1f7-507f-8e5d-839dd5021d28_=--