From patchwork Mon Oct 9 20:15:56 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: will schmidt X-Patchwork-Id: 823492 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-463815-incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="pytet2F0"; 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 3y9s2T3Nfvz9t2Z for ; Tue, 10 Oct 2017 07:16:16 +1100 (AEDT) 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:reply-to:to:cc:content-type:date:mime-version :content-transfer-encoding:message-id; q=dns; s=default; b=XotIA m7jLUZ48+xBEFvLvRXBvm8VZBp4D/ctsSp3Fi/hIbT0D14ErQjEDfi3gy1d68qSS YqhKiRf8s25w7/NGlk+O9bGAx06eMLG40jzb3tx95hbSjF+COBAxAFInHJqR1ZT1 7ip3eFrRSS+u0fV0B/7H0relC/SmgAErxTCoJ0= 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:reply-to:to:cc:content-type:date:mime-version :content-transfer-encoding:message-id; s=default; bh=ZVZL/ejB+8C 3vkpcrR+Z6EtxdAA=; b=pytet2F0lu3um/NX9/lFMqLUkkcBZ55guInspY41jYz yvs2GzWw4BGvdEb37yoNhk/kiBrazhcSDdQoYIa2FtbPXgM7R4S4fJL+4ymCnYb4 OC/xNYjZAKn1UyDnE2zIfx9LQazlJR4YhJV2unClUyU3iGl67EaU5D498wJZ6zIc = Received: (qmail 73964 invoked by alias); 9 Oct 2017 20:16:09 -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 73953 invoked by uid 89); 9 Oct 2017 20:16:09 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-26.7 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=H*MI:136, Hx-languages-length:4524 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; Mon, 09 Oct 2017 20:16:07 +0000 Received: from pps.filterd (m0098410.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.21/8.16.0.21) with SMTP id v99KF4UB018971 for ; Mon, 9 Oct 2017 16:16:01 -0400 Received: from e19.ny.us.ibm.com (e19.ny.us.ibm.com [129.33.205.209]) by mx0a-001b2d01.pphosted.com with ESMTP id 2dgaud0et6-1 (version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT) for ; Mon, 09 Oct 2017 16:16:01 -0400 Received: from localhost by e19.ny.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Mon, 9 Oct 2017 16:15:59 -0400 Received: from b01cxnp23034.gho.pok.ibm.com (9.57.198.29) by e19.ny.us.ibm.com (146.89.104.206) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Mon, 9 Oct 2017 16:15:58 -0400 Received: from b01ledav001.gho.pok.ibm.com (b01ledav001.gho.pok.ibm.com [9.57.199.106]) by b01cxnp23034.gho.pok.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id v99KFv1b41287770; Mon, 9 Oct 2017 20:15:57 GMT Received: from b01ledav001.gho.pok.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id F07132804C; Mon, 9 Oct 2017 16:15:50 -0400 (EDT) Received: from [9.10.86.107] (unknown [9.10.86.107]) by b01ledav001.gho.pok.ibm.com (Postfix) with ESMTP id B221C2803D; Mon, 9 Oct 2017 16:15:50 -0400 (EDT) Subject: [PATCH, rs6000] Testcase coverage for vec_splats From: Will Schmidt Reply-To: will_schmidt@vnet.ibm.com To: GCC Patches Cc: Segher Boessenkool , Bill Schmidt , David Edelsohn Date: Mon, 09 Oct 2017 15:15:56 -0500 Mime-Version: 1.0 X-TM-AS-GCONF: 00 x-cbid: 17100920-0056-0000-0000-000003D7147A X-IBM-SpamModules-Scores: X-IBM-SpamModules-Versions: BY=3.00007869; HX=3.00000241; KW=3.00000007; PH=3.00000004; SC=3.00000235; SDB=6.00928776; UDB=6.00467444; IPR=6.00709047; BA=6.00005631; NDR=6.00000001; ZLA=6.00000005; ZF=6.00000009; ZB=6.00000000; ZP=6.00000000; ZH=6.00000000; ZU=6.00000002; MB=3.00017463; XFM=3.00000015; UTC=2017-10-09 20:15:59 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 17100920-0057-0000-0000-0000080E1478 Message-Id: <1507580156.26707.136.camel@brimstone.rchland.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:, , definitions=2017-10-09_06:, , signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 suspectscore=0 malwarescore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1707230000 definitions=main-1710090294 X-IsSubscribed: yes [PATCH, rs6000] Testcase coverage for vec_splats Add testcase coverage for bec_splat built-ins. Tested across power6 and newer. OK for trunk? Thanks, -Will [testsuite] * gcc.target/powerpc/fold-vec-splats-char.c: New. * gcc.target/powerpc/fold-vec-splats-floatdouble.c: New. * gcc.target/powerpc/fold-vec-splats-int.c: New. * gcc.target/powerpc/fold-vec-splats-longlong.c: New. * gcc.target/powerpc/fold-vec-splats-short.c: New. diff --git a/gcc/testsuite/gcc.target/powerpc/fold-vec-splats-char.c b/gcc/testsuite/gcc.target/powerpc/fold-vec-splats-char.c new file mode 100644 index 0000000..8f21153 --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/fold-vec-splats-char.c @@ -0,0 +1,22 @@ +/* Verify that overloaded built-ins for vec_splats() with char + inputs produce the right code. */ + +/* { dg-do compile } */ +/* { dg-require-effective-target powerpc_altivec_ok } */ +/* { dg-options "-maltivec -O2 " } */ + +#include + +vector signed char +test1s (signed char x) +{ + return vec_splats (x); +} + +vector unsigned char +test1u (unsigned char x) +{ + return vec_splats (x); +} + +/* { dg-final { scan-assembler-times "vspltb" 2 } } */ diff --git a/gcc/testsuite/gcc.target/powerpc/fold-vec-splats-floatdouble.c b/gcc/testsuite/gcc.target/powerpc/fold-vec-splats-floatdouble.c new file mode 100644 index 0000000..859bb38 --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/fold-vec-splats-floatdouble.c @@ -0,0 +1,27 @@ +/* Verify that overloaded built-ins for vec_splat with float and + double inputs for VSX produce the right code. */ + +/* { dg-do compile } */ +/* { dg-require-effective-target powerpc_vsx_ok } */ +/* { dg-options "-mvsx -O1" } */ + +#include + +vector float +test1d (float x) +{ + return vec_splats (x); +} + +vector double +test1f (double x) +{ + return vec_splats (x); +} + +// float test generates the permute instruction. +/* { dg-final { scan-assembler-times "xxpermdi" 1 } } */ + +// double test generates a convert (double to single non-signalling) followed by a splat. +/* { dg-final { scan-assembler-times "xscvdpspn|xscvdpsp" 1 } } */ +/* { dg-final { scan-assembler-times "vspltw|xxspltw" 1 } } */ diff --git a/gcc/testsuite/gcc.target/powerpc/fold-vec-splats-int.c b/gcc/testsuite/gcc.target/powerpc/fold-vec-splats-int.c new file mode 100644 index 0000000..6671523 --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/fold-vec-splats-int.c @@ -0,0 +1,22 @@ +/* Verify that overloaded built-ins for vec_splat with int + inputs produce the right code. */ + +/* { dg-do compile { target { powerpc*-*-linux* && lp64 } } } */ +/* { dg-require-effective-target powerpc_altivec_ok } */ +/* { dg-options "-maltivec -O2 " } */ + +#include + +vector signed int +test3s (signed int x) +{ + return vec_splats (x); +} + +vector unsigned int +test3u (unsigned int x) +{ + return vec_splats (x); +} + +/* { dg-final { scan-assembler-times {\mvspltw\M|\mxxspltw\M} 2 } } */ diff --git a/gcc/testsuite/gcc.target/powerpc/fold-vec-splats-longlong.c b/gcc/testsuite/gcc.target/powerpc/fold-vec-splats-longlong.c new file mode 100644 index 0000000..c5884ba --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/fold-vec-splats-longlong.c @@ -0,0 +1,22 @@ +/* Verify that overloaded built-ins for vec_splat with long long + inputs produce the right code. */ + +/* { dg-do compile { target { powerpc*-*-linux* && lp64 } } } */ +/* { dg-require-effective-target powerpc_vsx_ok } */ +/* { dg-options "-mvsx -O2" } */ + +#include + +vector signed long long +test3s (signed long long x) +{ + return vec_splats (x); +} + +vector unsigned long long +test3u (unsigned long long x) +{ + return vec_splats (x); +} + +/* { dg-final { scan-assembler-times "xxpermdi" 2 } } */ diff --git a/gcc/testsuite/gcc.target/powerpc/fold-vec-splats-short.c b/gcc/testsuite/gcc.target/powerpc/fold-vec-splats-short.c new file mode 100644 index 0000000..18102ac --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/fold-vec-splats-short.c @@ -0,0 +1,23 @@ +/* Verify that overloaded built-ins for vec_splat with short + inputs produce the right code. */ + +/* { dg-do compile } */ +/* { dg-require-effective-target powerpc_altivec_ok } */ +/* { dg-options "-maltivec -O2" } */ + +#include + +vector signed short +test3s (signed short x) +{ + return vec_splats (x); +} + +vector unsigned short +test3u (unsigned short x) +{ + return vec_splats (x); +} + +/* { dg-final { scan-assembler-times "vsplth" 2 } } */ +