From patchwork Wed Jun 27 22:14:18 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Carl Love X-Patchwork-Id: 935770 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=gcc.gnu.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=gcc-patches-return-480608-incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=us.ibm.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="urbfScj/"; dkim-atps=neutral Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 41GHLP54Pnz9ry1 for ; Thu, 28 Jun 2018 08:16:11 +1000 (AEST) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender :subject:from:to:cc:date:mime-version:message-id:content-type :content-transfer-encoding; q=dns; s=default; b=fKx+4S7gPe24Rxed qJiYkQSotPYZnM6ygVaRh/S1RDSjCcFIuB9BInUidKDjMvHtZAzxL4vup0xQqhKU iAoKhAILkf0yJn2gSlUPIMHn5BOvXAq93bVpwe9xbrbWguRQzXYM1rIJl3Zs5gQe 60q9wLCbhtuf73lJYBzOwrnW19M= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender :subject:from:to:cc:date:mime-version:message-id:content-type :content-transfer-encoding; s=default; bh=buV1ISsSvPU9QHDLQIoR/I ZHc7Q=; b=urbfScj/cUJhmMZJNWQJ1Yolt2swLwjNoopXOV81hx0RgdmtbcgiKb Bhrh7Z1G20lMtKZOhSn2P6VCdXM2n00VqrSEehTcXN82dp7v0Jptqcw0nlRIOFds Trj4B6RMSGJ+CQAMhr7ZKxSAf0zvF3oH8Ea6gNRLo5tUGgFfBnpJY= Received: (qmail 69439 invoked by alias); 27 Jun 2018 22:16:03 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Received: (qmail 69217 invoked by uid 89); 27 Jun 2018 22:15:38 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-27.0 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_LOW, SPF_PASS autolearn=ham version=3.3.2 spammy=U*cel, cel@us.ibm.com, Maintainers, p9-extract-1.c X-HELO: mx0a-001b2d01.pphosted.com Received: from mx0a-001b2d01.pphosted.com (HELO mx0a-001b2d01.pphosted.com) (148.163.156.1) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 27 Jun 2018 22:15:32 +0000 Received: from pps.filterd (m0098393.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id w5RMFIlf083247 for ; Wed, 27 Jun 2018 18:15:23 -0400 Received: from e11.ny.us.ibm.com (e11.ny.us.ibm.com [129.33.205.201]) by mx0a-001b2d01.pphosted.com with ESMTP id 2jvj6ptd0p-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Wed, 27 Jun 2018 18:15:19 -0400 Received: from localhost by e11.ny.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Wed, 27 Jun 2018 18:14:22 -0400 Received: from b01cxnp22035.gho.pok.ibm.com (9.57.198.25) by e11.ny.us.ibm.com (146.89.104.198) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; (version=TLSv1/SSLv3 cipher=AES256-GCM-SHA384 bits=256/256) Wed, 27 Jun 2018 18:14:20 -0400 Received: from b01ledav004.gho.pok.ibm.com (b01ledav004.gho.pok.ibm.com [9.57.199.109]) by b01cxnp22035.gho.pok.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id w5RMEJvB10551838 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Wed, 27 Jun 2018 22:14:19 GMT Received: from b01ledav004.gho.pok.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 67DEB112064; Wed, 27 Jun 2018 18:14:14 -0400 (EDT) Received: from b01ledav004.gho.pok.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id D2D22112061; Wed, 27 Jun 2018 18:14:13 -0400 (EDT) Received: from oc3304648336.ibm.com (unknown [9.70.82.186]) by b01ledav004.gho.pok.ibm.com (Postfix) with ESMTP; Wed, 27 Jun 2018 18:14:13 -0400 (EDT) Subject: [PATCH, rs6000] Add missing builtin test cases From: Carl Love To: gcc-patches@gcc.gnu.org, David Edelsohn , Segher Boessenkool Cc: Bill Schmidt , cel@us.ibm.com Date: Wed, 27 Jun 2018 15:14:18 -0700 Mime-Version: 1.0 x-cbid: 18062722-2213-0000-0000-000002C0EAED X-IBM-SpamModules-Scores: X-IBM-SpamModules-Versions: BY=3.00009266; HX=3.00000241; KW=3.00000007; PH=3.00000004; SC=3.00000266; SDB=6.01053250; UDB=6.00540018; IPR=6.00831174; MB=3.00021891; MTD=3.00000008; XFM=3.00000015; UTC=2018-06-27 22:14:21 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 18062722-2214-0000-0000-00005AA16A17 Message-Id: <1530137658.6530.21.camel@us.ibm.com> X-IsSubscribed: yes GCC Maintainers: The following patch adds missing test cases for vec_extract_fp32_from_shortl(), vec_extract_fp32_from_shorth(), and vec_extract(). The patch has been run on:   powerpc64le-unknown-linux-gnu (Power 8 LE)   powerpc64le-unknown-linux-gnu (Power 9 LE) without regressions.   Please let me know if the following patch is acceptable.  Thanks.                       Carl Love ------------------------------------------------------------- gcc/testsuite/ChangeLog: 2018-06-27 Carl Love * gcc.target/p9-extract-1.c: Add test case. * gcc.target/builtins-3-p9-runnable.c: Add test case to match name in ABI. --- .../gcc.target/powerpc/builtins-3-p9-runnable.c | 42 ++++++++++++++++++++++ gcc/testsuite/gcc.target/powerpc/p9-extract-1.c | 8 +++++ 2 files changed, 50 insertions(+) diff --git a/gcc/testsuite/gcc.target/powerpc/builtins-3-p9-runnable.c b/gcc/testsuite/gcc.target/powerpc/builtins-3-p9-runnable.c index 3197a50..35a81a7 100644 --- a/gcc/testsuite/gcc.target/powerpc/builtins-3-p9-runnable.c +++ b/gcc/testsuite/gcc.target/powerpc/builtins-3-p9-runnable.c @@ -30,6 +30,48 @@ int main() { printf (" 0B011110100000000, 0B1011010000000000};\n\n"); #endif + /* The ABI lists the builtins as: + + vec_extract_fp32_from_shorth() + vec_extract_fp32_from_shortl() + + GCC will also accept and map the builtin names + + vec_extract_fp_from_shorth() + vec_extract_fp_from_shortl() + + to the same builtins internally. For completeness, + test both builtin function names. */ + + vfexpt = (vector float){1.0, -2.0, 0.0, 8.5}; + vfr = vec_extract_fp32_from_shorth(vusha); + +#ifdef DEBUG + printf ("vec_extract_fp32_from_shorth\n"); + for (i=0; i<4; i++) + printf("result[%d] = %f; expected[%d] = %f\n", + i, vfr[i], i, vfexpt[i]); +#endif + + for (i=0; i<4; i++) { + if (vfr[i] != vfexpt[i]) + abort(); + } + + vfexpt = (vector float){1.5, 0.5, 1.25, -0.25}; + vfr = vec_extract_fp32_from_shortl(vusha); + +#ifdef DEBUG + printf ("\nvec_extract_fp32_from_shortl\n"); + for (i=0; i<4; i++) + printf("result[%d] = %f; expected[%d] = %f\n", + i, vfr[i], i, vfexpt[i]); +#endif + + for (i=0; i<4; i++) { + if (vfr[i] != vfexpt[i]) + abort(); + } vfexpt = (vector float){1.0, -2.0, 0.0, 8.5}; vfr = vec_extract_fp_from_shorth(vusha); diff --git a/gcc/testsuite/gcc.target/powerpc/p9-extract-1.c b/gcc/testsuite/gcc.target/powerpc/p9-extract-1.c index ab9e766..203f5bf 100644 --- a/gcc/testsuite/gcc.target/powerpc/p9-extract-1.c +++ b/gcc/testsuite/gcc.target/powerpc/p9-extract-1.c @@ -122,6 +122,14 @@ extract_bool_int_0 (vector bool int a) return b; } +unsigned short int +extract_bool_short_int_0 (vector bool short int a) +{ + int c = 0; + unsigned short int b = vec_extract (a, c); + return b; +} + /* { dg-final { scan-assembler "vextub\[lr\]x " } } */ /* { dg-final { scan-assembler "vextuh\[lr\]x " } } */ /* { dg-final { scan-assembler "vextuw\[lr\]x " } } */