From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mx0b-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) by sourceware.org (Postfix) with ESMTPS id E2E873858D38 for ; Tue, 20 Feb 2024 17:57:03 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org E2E873858D38 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=linux.ibm.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=linux.ibm.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org E2E873858D38 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=148.163.158.5 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1708451825; cv=none; b=tMKOBpOuUDdUXTeFoUvteLRxiF26AVzmKIEraAFKvpBghlSnK+dDHttJZaMotUIPTJzPIHpisFRXIhwIgP92NCxFnjDM843dYS35hn2CdZXQgjzaZftjyC7S22WMUoG+5IUyGWtzg/k2z7YB1fDKJzXnasJgcFa57j1hzeWUgaA= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1708451825; c=relaxed/simple; bh=cejCSitW9AV9dMDDbSYJUiRE0tBQMz0n01JzZL4wZQY=; h=DKIM-Signature:Message-ID:Date:MIME-Version:Subject:To:From; b=xwlspKecUSuXleE+ihTsLeNcwExbRWa2QGkELS2JhFlV3JrDl5KkfQhSS11IBkXkO668yOxMCNFMxmqfCiwAy/VJorwI8DFKQZlHZJARaFc4PEcqT9MfkD0ZwgsSwfn0fTHomSDT1sy6QJ0wg5zxD5hzck1OMslG+0MRsisyoQs= ARC-Authentication-Results: i=1; server2.sourceware.org Received: from pps.filterd (m0353725.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 41KGdlgk014016; Tue, 20 Feb 2024 17:57:03 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=message-id : date : mime-version : subject : to : references : from : in-reply-to : content-type : content-transfer-encoding; s=pp1; bh=aE3aE+uhzT9Hwe76lTg9/qOdD5RWMD88/DzjZYC4Bn8=; b=C+/ku8x3EmX/6IqaJLLAQ7gwgyTixGhbFWbmgsGhUbatZgEfzmHEXm8xYMlQWdeB364u GX/T/EPAMzM0biZDd4t7KJS2llZRuMHvYenne+6RuNkJ7eT+HfS25AvpUEs/GMU+aU9a BtWfc7HIHLuvh/yx44in3aZ9dLtWioJJqIWMiVFytUF1ZucugqM60iNtFPdVBMUEueCS pVCnrVsjIZmMY5ACb4kQrXEgYEFRSwzgsxL56+MiCYkbtYE6BcCxwKAWQELs/3fk3aPv P+HrOteRLSikBovGwRs/Oz8zIHjWXTOYb1SoSmecx5IXrtjZ1QQdsOg8frwI2NE9km89 RA== Received: from ppma13.dal12v.mail.ibm.com (dd.9e.1632.ip4.static.sl-reverse.com [50.22.158.221]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3wcyst1sxq-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 20 Feb 2024 17:57:03 +0000 Received: from pps.filterd (ppma13.dal12v.mail.ibm.com [127.0.0.1]) by ppma13.dal12v.mail.ibm.com (8.17.1.19/8.17.1.19) with ESMTP id 41KFvgai031187; Tue, 20 Feb 2024 17:57:02 GMT Received: from smtprelay04.wdc07v.mail.ibm.com ([172.16.1.71]) by ppma13.dal12v.mail.ibm.com (PPS) with ESMTPS id 3wb9bkscm2-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 20 Feb 2024 17:57:02 +0000 Received: from smtpav04.wdc07v.mail.ibm.com (smtpav04.wdc07v.mail.ibm.com [10.39.53.231]) by smtprelay04.wdc07v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 41KHuxee40239544 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 20 Feb 2024 17:57:01 GMT Received: from smtpav04.wdc07v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 12D3658060; Tue, 20 Feb 2024 17:56:59 +0000 (GMT) Received: from smtpav04.wdc07v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 5843B58054; Tue, 20 Feb 2024 17:56:58 +0000 (GMT) Received: from [9.67.96.239] (unknown [9.67.96.239]) by smtpav04.wdc07v.mail.ibm.com (Postfix) with ESMTP; Tue, 20 Feb 2024 17:56:58 +0000 (GMT) Message-ID: Date: Tue, 20 Feb 2024 09:56:58 -0800 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: [PATCH 05/11] rs6000, __builtin_vsx_xvneg[sp,dp] add documentation, and test cases Content-Language: en-US To: gcc-patches@gcc.gnu.org, "bergner@linux.ibm.com" , Segher Boessenkool , "Kewen.Lin" References: <41290fb1-e2e8-4779-b76f-2208c2dadedd@linux.ibm.com> From: Carl Love In-Reply-To: <41290fb1-e2e8-4779-b76f-2208c2dadedd@linux.ibm.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-TM-AS-GCONF: 00 X-Proofpoint-ORIG-GUID: p-16WFGIXnqvQLJ0ClzK4PvzSrhPNtge X-Proofpoint-GUID: p-16WFGIXnqvQLJ0ClzK4PvzSrhPNtge X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.1011,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2024-02-20_06,2024-02-20_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 suspectscore=0 adultscore=0 bulkscore=0 mlxlogscore=999 spamscore=0 priorityscore=1501 phishscore=0 lowpriorityscore=0 impostorscore=0 mlxscore=0 malwarescore=0 clxscore=1015 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2311290000 definitions=main-2402200128 X-Spam-Status: No, score=-9.9 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_EF,GIT_PATCH_0,KAM_SHORT,RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_PASS,TXREP,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: GCC maintainers: The patch adds documentation and test cases for the __builtin_vsx_xvnegsp, __builtin_vsx_xvnegdp built-ins. The patch has been tested on Power 10 with no regressions. Please let me know if this patch is acceptable for mainline. Thanks. Carl ------------------------------------------------------------ rs6000, __builtin_vsx_xvneg[sp,dp] add documentation and test cases Add documentation to the extend.texi file for the two built-ins __builtin_vsx_xvnegsp, __builtin_vsx_xvnegdp. Add test cases for the two built-ins. gcc/ChangeLog: * doc/extend.texi (__builtin_vsx_xvnegsp, __builtin_vsx_xvnegdp): Add documentation. gcc/testsuite/ChangeLog: * gcc.target/powerpc/vsx-builtin-runnable-2.c: New test case. --- gcc/doc/extend.texi | 13 +++++ .../powerpc/vsx-builtin-runnable-2.c | 51 +++++++++++++++++++ 2 files changed, 64 insertions(+) create mode 100644 gcc/testsuite/gcc.target/powerpc/vsx-builtin-runnable-2.c diff --git a/gcc/doc/extend.texi b/gcc/doc/extend.texi index 583b1d890bf..83eed9e334b 100644 --- a/gcc/doc/extend.texi +++ b/gcc/doc/extend.texi @@ -21495,6 +21495,19 @@ The @code{__builtin_vsx_xvcvuxwdp} converts single precision unsigned integer value to a double precision floating point value. Input element at index 2*i is stored in the destination element i. +@smallexample +vector float __builtin_vsx_xvnegsp (vector float); +vector double __builtin_vsx_xvnegdp (vector double); +@end smallexample + +The @code{__builtin_vsx_xvnegsp} and @code{__builtin_vsx_xvnegdp} negate each +vector element. + +@smallexample +vector __int128 __builtin_vsx_xxpermdi_1ti (vector __int128, vector __int128, +const int); + +@end smallexample @node Basic PowerPC Built-in Functions Available on ISA 2.07 @subsubsection Basic PowerPC Built-in Functions Available on ISA 2.07 diff --git a/gcc/testsuite/gcc.target/powerpc/vsx-builtin-runnable-2.c b/gcc/testsuite/gcc.target/powerpc/vsx-builtin-runnable-2.c new file mode 100644 index 00000000000..7906a8e01d7 --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/vsx-builtin-runnable-2.c @@ -0,0 +1,51 @@ +/* { dg-do run { target { lp64 } } } */ +/* { dg-require-effective-target powerpc_vsx_ok } */ +/* { dg-options "-O2 -mdejagnu-cpu=power7" } */ + +#define DEBUG 0 + +#if DEBUG +#include +#include +#endif + +void abort (void); + +int main () +{ + int i; + vector double vd_arg1, vd_result, vd_expected_result; + vector float vf_arg1, vf_result, vf_expected_result; + + /* VSX Vector Negate Single-Precision. */ + + vf_arg1 = (vector float) {-1.0, 12345.98, -2.1234, 238.9}; + vf_result = __builtin_vsx_xvnegsp (vf_arg1); + vf_expected_result = (vector float) {1.0, -12345.98, 2.1234, -238.9}; + + for (i = 0; i < 4; i++) + if (vf_result[i] != vf_expected_result[i]) +#if DEBUG + printf("ERROR, __builtin_vsx_xvnegsp: vf_result[%d] = %f, vf_expected_result[%d] = %f\n", + i, vf_result[i], i, vf_expected_result[i]); +#else + abort(); +#endif + + /* VSX Vector Negate Double-Precision. */ + + vd_arg1 = (vector double) {12345.98, -2.1234}; + vd_result = __builtin_vsx_xvnegdp (vd_arg1); + vd_expected_result = (vector double) {-12345.98, 2.1234}; + + for (i = 0; i < 2; i++) + if (vd_result[i] != vd_expected_result[i]) +#if DEBUG + printf("ERROR, __builtin_vsx_xvnegdp: vd_result[%d] = %f, vd_expected_result[%d] = %f\n", + i, vd_result[i], i, vd_expected_result[i]); +#else + abort(); +#endif + + return 0; +} -- 2.43.0