From patchwork Wed May 9 16:07:49 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Carl Love X-Patchwork-Id: 910971 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-477445-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="Q1c24VQA"; 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 40h1VK2GdDz9s4v for ; Thu, 10 May 2018 02:08:08 +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:content-type:mime-version :content-transfer-encoding:message-id; q=dns; s=default; b=IiMW9 ikUIuVqIG6DoyLxG0WM/OV2f9zVeZP8sT3WdDTytG572mLhM2aFn2t3/akRwAc88 KDXPs1mTOxgflt7kKHIFQ2arAhFtMUQKxYlFRUaJY0UynCwntPoWKxnohWW53xjN pYQkHlfWD4UAT9j01iCUeFy2NGDAtqnrNr68Jc= 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:content-type:mime-version :content-transfer-encoding:message-id; s=default; bh=A9cB1DJyUNl q7FNV/JKNyzZWIO8=; b=Q1c24VQAiyYNIjHyCNnDtmq+QQ5HngO94E7ztV3L1hW djbou6VtxEtsv33cted9+/oy/szaAV570ii6pgk7ats9427WtEqOGlo2a2w4oXZp Itv6LADsRiSMOL7afGuPer4+Gku1KdBhS8xvSbUBGEjWXlipCtfZ4CWP6rdGmhSw = Received: (qmail 76714 invoked by alias); 9 May 2018 16:08:00 -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 76698 invoked by uid 89); 9 May 2018 16:08:00 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No 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=0.2, 8.0, lp64 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, 09 May 2018 16:07:58 +0000 Received: from pps.filterd (m0098404.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id w49FsxcW001565 for ; Wed, 9 May 2018 12:07:56 -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 2hv1ee9pt9-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Wed, 09 May 2018 12:07:56 -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, 9 May 2018 12:07:55 -0400 Received: from b01cxnp22036.gho.pok.ibm.com (9.57.198.26) by e11.ny.us.ibm.com (146.89.104.198) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Wed, 9 May 2018 12:07:51 -0400 Received: from b01ledav006.gho.pok.ibm.com (b01ledav006.gho.pok.ibm.com [9.57.199.111]) by b01cxnp22036.gho.pok.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id w49G7pim53411980; Wed, 9 May 2018 16:07:51 GMT Received: from b01ledav006.gho.pok.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id ACF83AC046; Wed, 9 May 2018 12:09:22 -0400 (EDT) Received: from oc3304648336.ibm.com (unknown [9.70.82.186]) by b01ledav006.gho.pok.ibm.com (Postfix) with ESMTP id F38C5AC040; Wed, 9 May 2018 12:09:21 -0400 (EDT) Subject: [PATCH, rs6000] Add missing vec_expte, vec_loge, vec_re From: Carl Love To: Segher Boessenkool , gcc-patches@gcc.gnu.org, David Edelsohn Cc: Bill Schmidt , cel@us.ibm.com Date: Wed, 09 May 2018 09:07:49 -0700 Mime-Version: 1.0 X-TM-AS-GCONF: 00 x-cbid: 18050916-2213-0000-0000-000002A1A4CA X-IBM-SpamModules-Scores: X-IBM-SpamModules-Versions: BY=3.00008997; HX=3.00000241; KW=3.00000007; PH=3.00000004; SC=3.00000259; SDB=6.01029835; UDB=6.00526262; IPR=6.00808969; MB=3.00021013; MTD=3.00000008; XFM=3.00000015; UTC=2018-05-09 16:07:53 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 18050916-2214-0000-0000-00005A0E4292 Message-Id: <1525882069.8281.2.camel@us.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:, , definitions=2018-05-09_06:, , signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=0 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 impostorscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1709140000 definitions=main-1805090149 X-IsSubscribed: yes GCC Maintainers: The following patch adds tests for the vec_expte, vec_loge, and vec_re builtins. The patch for the test case was tested on     powerpc64le-unknown-linux-gnu (Power 8 LE)     powerpc64-unknown-linux-gnu (Power 8 BE)     powerpc64le-unknown-linux-gnu (Power 9 LE).  Please let me know if the patch looks OK for GCC mainline.                          Carl Love --------------------------------------------------------- gcc/testsuite/ChangeLog: 2018-05-09 Carl Love * gcc.target/powerpc/builtins-8-runnable.c: New builtin test file. --- .../gcc.target/powerpc/builtins-8-runnable.c | 98 ++++++++++++++++++++++ 1 file changed, 98 insertions(+) create mode 100644 gcc/testsuite/gcc.target/powerpc/builtins-8-runnable.c diff --git a/gcc/testsuite/gcc.target/powerpc/builtins-8-runnable.c b/gcc/testsuite/gcc.target/powerpc/builtins-8-runnable.c new file mode 100644 index 0000000..82b886f --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/builtins-8-runnable.c @@ -0,0 +1,98 @@ +/* { dg-do run { target { powerpc*-*-* && { lp64 && p8vector_hw } } } } */ +/* { dg-skip-if "do not override -mcpu" { powerpc*-*-* } { "-mcpu=*" } { "-mcpu=power8" } } */ +/* { dg-options "-mcpu=power8 -O2" } */ + +#include +#include +#include +#include + +#ifdef DEBUG +#include +#endif + +void abort (void); + +int main() + { + int i; + vector float f_arg1; + vector double d_arg1; + + vector float vec_f_expected1, vec_f_result1, vec_f_error; + vector double vec_d_expected1, vec_d_result1, vec_d_error; + + /* vec_expte: float args, result */ + f_arg1 = (vector float){1.0, 2.0, 3.0, 4.0}; + vec_f_expected1 = (vector float){2.0, 4.0, 8.0, 16.0}; + + vec_f_result1 = vec_expte (f_arg1); + + for (i = 0; i < 4; i++) + { + if (vec_f_expected1[i] != vec_f_result1[i]) +#ifdef DEBUG + printf("ERROR vec_expte (f) result[%d]=%f != expected[%d]=%f\n", + i, vec_f_result1[i], i, vec_f_expected1[i]); +#else + abort(); +#endif + } + + /* vec_loge: float args, result */ + f_arg1 = (vector float){4.0, 8.0, 16.0, 64}; + vec_f_expected1 = (vector float){2.0, 3.0, 4.0, 6.0}; + + vec_f_result1 = vec_loge (f_arg1); + + for (i = 0; i < 4; i++) + { + if (vec_f_expected1[i] != vec_f_result1[i]) +#ifdef DEBUG + printf("ERROR vec_loge (f) result[%d]=%f != expected[%d]=%f\n", + i, vec_f_result1[i], i, vec_f_expected1[i]); +#else + abort(); +#endif + } + + /* vec_re: float args, result (calculate approximate reciprocal) */ + f_arg1 = (vector float){1.0, 5.0, 4.0, 8.0}; + vec_f_expected1 = (vector float){1.0, 0.2, 0.25, 0.125}; + vec_f_error = (vector float){1.0, 0.2, 0.25, 0.125}; + + vec_f_result1 = vec_re (f_arg1); + + for (i = 0; i < 4; i++) + { + vec_f_error[i] = fabs(vec_f_expected1[i] - vec_f_result1[i]); + + if (vec_f_error[i] >= 0.0001) +#ifdef DEBUG + printf("ERROR vec_re (f) result[%d]=%f != expected[%d]=%f\n", + i, vec_f_result1[i], i, vec_f_expected1[i]); +#else + abort(); +#endif + } + + /* vec_re: double args, result (calculate approximate reciprocal) */ + d_arg1 = (vector double){1.0, 8.0}; + vec_d_expected1 = (vector double){1.0, 0.125}; + vec_d_error = (vector double){1.0, 0.125}; + + vec_d_result1 = vec_re (d_arg1); + + for (i = 0; i < 2; i++) + { + vec_d_error[i] = fabs(vec_d_expected1[i] - vec_d_result1[i]); + + if (vec_d_error[i] >= 0.0001) +#ifdef DEBUG + printf("ERROR vec_re (d) result[%d]=%f != expected[%d]=%f\n", + i, vec_d_result1[i], i, vec_d_expected1[i]); +#else + abort(); +#endif + } + }