From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 2063) id B68D43858424; Wed, 19 Oct 2022 09:05:16 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org B68D43858424 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1666170316; bh=JrNpzmWfsu+R6A8VCH1omcPAALYBfX3UWQlEl9qjCc0=; h=From:To:Subject:Date:From; b=kjlIljELTh/KXL+mytrOyPzQ7oyaUjC8d10p2OldLozNWCFBtxDwkWnQqT2OHZzN4 ueATS4yZTDN/zR30uyJzc2BkObNHcGQICxda63nJ29bqc95U//X1upWYXG35or4QtS h0Zl287vWUyFPuDwrqzKdOw5VRc8FIhWvxT3uTQc= MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="utf-8" From: Kewen Lin To: gcc-cvs@gcc.gnu.org Subject: [gcc r12-8845] rs6000: Fix condition of define_expand vec_shr_ [PR100645] X-Act-Checkin: gcc X-Git-Author: Kewen Lin X-Git-Refname: refs/heads/releases/gcc-12 X-Git-Oldrev: a028a2d6be37b4e3f1ede0988f7c506ba2dff18d X-Git-Newrev: 6db4ba9750ffd65c80995425db0d5f1020a04b28 Message-Id: <20221019090516.B68D43858424@sourceware.org> Date: Wed, 19 Oct 2022 09:05:16 +0000 (GMT) List-Id: https://gcc.gnu.org/g:6db4ba9750ffd65c80995425db0d5f1020a04b28 commit r12-8845-g6db4ba9750ffd65c80995425db0d5f1020a04b28 Author: Kewen Lin Date: Sun Sep 25 22:01:50 2022 -0500 rs6000: Fix condition of define_expand vec_shr_ [PR100645] PR100645 exposes one latent bug in define_expand vec_shr_ that the current condition TARGET_ALTIVEC is too loose. The mode iterator VEC_L contains a few modes, they are not always supported as vector mode, VECTOR_UNIT_ALTIVEC_OR_VSX_P should be used like some other VEC_L usages. PR target/100645 gcc/ChangeLog: * config/rs6000/vector.md (vec_shr_): Replace condition TARGET_ALTIVEC with VECTOR_UNIT_ALTIVEC_OR_VSX_P. gcc/testsuite/ChangeLog: * gcc.target/powerpc/pr100645.c: New test. (cherry picked from commit bfad7069b74c97000b698191c1945f07a6192db5) Diff: --- gcc/config/rs6000/vector.md | 2 +- gcc/testsuite/gcc.target/powerpc/pr100645.c | 13 +++++++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/gcc/config/rs6000/vector.md b/gcc/config/rs6000/vector.md index 4d0797c48f8..9436f002f08 100644 --- a/gcc/config/rs6000/vector.md +++ b/gcc/config/rs6000/vector.md @@ -1535,7 +1535,7 @@ [(match_operand:VEC_L 0 "vlogical_operand") (match_operand:VEC_L 1 "vlogical_operand") (match_operand:QI 2 "reg_or_short_operand")] - "TARGET_ALTIVEC" + "VECTOR_UNIT_ALTIVEC_OR_VSX_P (mode)" { rtx bitshift = operands[2]; rtx shift; diff --git a/gcc/testsuite/gcc.target/powerpc/pr100645.c b/gcc/testsuite/gcc.target/powerpc/pr100645.c new file mode 100644 index 00000000000..c4e92cc8052 --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/pr100645.c @@ -0,0 +1,13 @@ +/* { dg-require-effective-target powerpc_altivec_ok } */ +/* { dg-options "-mdejagnu-cpu=power6 -maltivec" } */ + +/* This used to ICE. */ + +typedef long long v2di __attribute__ ((vector_size (16))); + +v2di +foo_v2di_l (v2di x) +{ + return __builtin_shuffle ((v2di){0, 0}, x, (v2di){3, 0}); +} +