From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mx0a-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) by sourceware.org (Postfix) with ESMTPS id 8F125385843A for ; Mon, 6 Sep 2021 06:11:08 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 8F125385843A Received: from pps.filterd (m0098419.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.43/8.16.0.43) with SMTP id 18663jl6152026; Mon, 6 Sep 2021 02:11:08 -0400 Received: from ppma03ams.nl.ibm.com (62.31.33a9.ip4.static.sl-reverse.com [169.51.49.98]) by mx0b-001b2d01.pphosted.com with ESMTP id 3awdbeg7hr-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 06 Sep 2021 02:11:07 -0400 Received: from pps.filterd (ppma03ams.nl.ibm.com [127.0.0.1]) by ppma03ams.nl.ibm.com (8.16.1.2/8.16.1.2) with SMTP id 18669QD9000511; Mon, 6 Sep 2021 06:11:06 GMT Received: from b06cxnps4076.portsmouth.uk.ibm.com (d06relay13.portsmouth.uk.ibm.com [9.149.109.198]) by ppma03ams.nl.ibm.com with ESMTP id 3av0e8y2y7-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 06 Sep 2021 06:11:06 +0000 Received: from d06av23.portsmouth.uk.ibm.com (d06av23.portsmouth.uk.ibm.com [9.149.105.59]) by b06cxnps4076.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 1866B27N52953542 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 6 Sep 2021 06:11:02 GMT Received: from d06av23.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 28869A408F; Mon, 6 Sep 2021 06:11:02 +0000 (GMT) Received: from d06av23.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 052F9A406D; Mon, 6 Sep 2021 06:11:01 +0000 (GMT) Received: from [9.200.100.251] (unknown [9.200.100.251]) by d06av23.portsmouth.uk.ibm.com (Postfix) with ESMTP; Mon, 6 Sep 2021 06:11:00 +0000 (GMT) To: gcc-patches Cc: Segher Boessenkool , Bill Schmidt From: HAO CHEN GUI Subject: [PATCH, rs6000] optimization for long long and double vec_reve [PR100868] Message-ID: <8306df2a-775a-6162-bcc8-77e808f8ec1d@linux.ibm.com> Date: Mon, 6 Sep 2021 14:10:58 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.13.0 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Content-Language: en-US X-TM-AS-GCONF: 00 X-Proofpoint-GUID: Vx-sFeAgkxE8meRDxwyL9K1ARJdGtM-- X-Proofpoint-ORIG-GUID: Vx-sFeAgkxE8meRDxwyL9K1ARJdGtM-- X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.391, 18.0.790 definitions=2021-09-06_02:2021-09-03, 2021-09-06 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 impostorscore=0 mlxscore=0 malwarescore=0 phishscore=0 lowpriorityscore=0 adultscore=0 mlxlogscore=999 spamscore=0 clxscore=1015 suspectscore=0 priorityscore=1501 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2108310000 definitions=main-2109060038 X-Spam-Status: No, score=-10.9 required=5.0 tests=BAYES_00, BODY_8BITS, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_EF, GIT_PATCH_0, KAM_SHORT, RCVD_IN_MSPIKE_H4, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 06 Sep 2021 06:11:09 -0000 Hi    The patch optimized expansion for long long or double vec_reve builtin.      Bootstrapped and tested on powerpc64le-linux with no regressions. Is this okay for trunk? Any recommendations? Thanks a lot. ChangeLog 2021-09-06 Haochen Gui gcc/     * config/rs6000/altivec.md (altivec_vreve2):     Modify the expansion when number of elements is 2. gcc/testsuite/     * gcc.target/powerpc/vec_reve.c: New test. patch.diff diff --git a/gcc/config/rs6000/altivec.md b/gcc/config/rs6000/altivec.md index 1351dafbc41..96e71979fbd 100644 --- a/gcc/config/rs6000/altivec.md +++ b/gcc/config/rs6000/altivec.md @@ -4063,6 +4063,13 @@ (define_expand "altivec_vreve2"    size = GET_MODE_UNIT_SIZE (mode);    num_elements = GET_MODE_NUNITS (mode); +  if (num_elements == 2) +    { +      emit_insn (gen_vsx_xxpermdi_ (operands[0], operands[1], +                      operands[1], GEN_INT (2))); +      DONE; +    } +    for (j = 0; j < num_elements; j++)      for (i = 0; i < size; i++)        RTVEC_ELT (v, i + j * size) diff --git a/gcc/testsuite/gcc.target/powerpc/vec_reve.c b/gcc/testsuite/gcc.target/powerpc/vec_reve.c new file mode 100644 index 00000000000..d86ce11ba91 --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/vec_reve.c @@ -0,0 +1,17 @@ +/* { dg-do compile { target { powerpc*-*-* } } } */ +/* { dg-require-effective-target powerpc_altivec_ok } */ +/* { dg-options "-O2 -maltivec" } */ + +#include + +vector double foo1 (vector double a) +{ +   return vec_reve (a); +} + +vector long long foo2 (vector long long a) +{ +   return vec_reve (a); +} + +/* { dg-final { scan-assembler-times {\mxxpermdi\M} 2 } } */