From patchwork Fri Jun 8 19:50:41 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Carl Love X-Patchwork-Id: 927003 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-479376-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="lZw5PL58"; 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 412Y1b6rmvz9rxs for ; Sat, 9 Jun 2018 05:50:58 +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=mV5uiQTpzi2OGVVm Ud6lY79kpazzqLl/OsGMOji54JEqGCd4/WM4hMTJVvUWG3V7yRdGGud8+GCkKJeR qVD9g4RzSIU4xL1gy4trd23kT57O2L6BLHn+fqzOER28WwUZ/k3H+ZPqHY00u+Fx JdQI73SDSKZ72jtCPAG6XYWl0fU= 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=triwSzK9lDbQhOI76fzzel 02TX8=; b=lZw5PL58or+4UmIZO6/lMFuGELznh3TZPS/WqWWyrRdJ58MrUcDdAw U14ZPdyXmO1WkhTu2m6tB1/cfBZbHtCa3X5TMjNVLhNql6t/G3AfRQjxFzvPTvoC 0iZIhtZcFYUxzzXKvZ6woPt7hY99s/0iTm1AKDGKCrB9h//mS50/A= Received: (qmail 112147 invoked by alias); 8 Jun 2018 19:50:50 -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 112129 invoked by uid 89); 8 Jun 2018 19:50:49 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-26.6 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, KAM_NUMSUBJECT, RCVD_IN_DNSWL_LOW, SPF_PASS autolearn=ham version=3.3.2 spammy=SURE 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; Fri, 08 Jun 2018 19:50:47 +0000 Received: from pps.filterd (m0098410.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id w58Jd6W3133297 for ; Fri, 8 Jun 2018 15:50:46 -0400 Received: from e16.ny.us.ibm.com (e16.ny.us.ibm.com [129.33.205.206]) by mx0a-001b2d01.pphosted.com with ESMTP id 2jfuf94fur-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Fri, 08 Jun 2018 15:50:45 -0400 Received: from localhost by e16.ny.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Fri, 8 Jun 2018 15:50:44 -0400 Received: from b01cxnp23032.gho.pok.ibm.com (9.57.198.27) by e16.ny.us.ibm.com (146.89.104.203) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; (version=TLSv1/SSLv3 cipher=AES256-GCM-SHA384 bits=256/256) Fri, 8 Jun 2018 15:50:43 -0400 Received: from b01ledav005.gho.pok.ibm.com (b01ledav005.gho.pok.ibm.com [9.57.199.110]) by b01cxnp23032.gho.pok.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id w58Jog5K17891672 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Fri, 8 Jun 2018 19:50:42 GMT Received: from b01ledav005.gho.pok.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id A55BAAE060; Fri, 8 Jun 2018 15:50:56 -0400 (EDT) Received: from b01ledav005.gho.pok.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 20B60AE05C; Fri, 8 Jun 2018 15:50:56 -0400 (EDT) Received: from oc3304648336.ibm.com (unknown [9.70.82.186]) by b01ledav005.gho.pok.ibm.com (Postfix) with ESMTP; Fri, 8 Jun 2018 15:50:55 -0400 (EDT) Subject: [PATCH] Fix altivec-7 issues on Power 6 From: Carl Love To: Segher Boessenkool , gcc-patches@gcc.gnu.org, David Edelsohn Cc: Bill Schmidt , cel@us.ibm.com Date: Fri, 08 Jun 2018 12:50:41 -0700 Mime-Version: 1.0 X-TM-AS-GCONF: 00 x-cbid: 18060819-0072-0000-0000-0000036A90CC X-IBM-SpamModules-Scores: X-IBM-SpamModules-Versions: BY=3.00009153; HX=3.00000241; KW=3.00000007; PH=3.00000004; SC=3.00000265; SDB=6.01044111; UDB=6.00534609; IPR=6.00823149; MB=3.00021538; MTD=3.00000008; XFM=3.00000015; UTC=2018-06-08 19:50:44 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 18060819-0073-0000-0000-0000484AD7F1 Message-Id: <1528487441.4981.42.camel@us.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:, , definitions=2018-06-08_09:, , signatures=0 X-IsSubscribed: yes GCC Maintainers: Test file gcc/testsuite/gcc.target/powerpc/altivec-7.c has issues when compiling for Power 6. Specifically, the new tests that were added for vec_unpackh and vec_unpackl that return a long long bool. The long long type is not compatible on Power 6 with just the "-maltivec" command line option. This patch removes the tests for vec_unpackh and vec_unpackl that return a long long bool from altivec-7.c and puts them in a new file altivec-37.c using the "=mvsx" option. Additionally, tests for the two builtins returning long long int are added to altivec-37. The patch was tested on:     powerpc64le-unknown-linux-gnu (Power 8 LE)        powerpc64le-unknown-linux-gnu (Power 9 LE)     powerpc64-unknown-linux-gnu (Power 8 BE) With no regressions. Additionally, hand testing with the commands make -k check-gcc RUNTESTFLAGS="-mcpu=power6 --target_board=unix'{-m64,-m32}' powerpc.exp=altivec-7.c"   make -k check-gcc RUNTESTFLAGS="-mcpu=power6 --target_board=unix'{-m64,-m32}' powerpc.exp=altivec-37.c"  were run on all three configurations to ensure compiling for Power 6 works everywhere. Please let me know if the patch looks OK for GCC mainline.                           Carl Love --------------------------------------------------------------------- gcc/testsuite/ChangeLog: 2018-06-08 Carl Love * gcc.target/powerpc/altivec-7.c (main): Remove tests vec_unpackh(vecubi[0]) and vec_unpackl(vecubi[0]). Remove duplicate dg-final for xxlxor. Update dg-final instruction counts. * gcc.target/powerpc/altivec-37.c (main): New file for tests vec_unpackh(vecubi[0]) and vec_unpackl(vecubi[0]). --- gcc/testsuite/gcc.target/powerpc/altivec-37.c | 32 +++++++++++++++++++++++++++ gcc/testsuite/gcc.target/powerpc/altivec-7.c | 9 +------- 2 files changed, 33 insertions(+), 8 deletions(-) create mode 100644 gcc/testsuite/gcc.target/powerpc/altivec-37.c diff --git a/gcc/testsuite/gcc.target/powerpc/altivec-37.c b/gcc/testsuite/gcc.target/powerpc/altivec-37.c new file mode 100644 index 0000000..a77bcd3 --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/altivec-37.c @@ -0,0 +1,32 @@ +/* { dg-do compile { target powerpc*-*-* } } */ +/* { dg-require-effective-target powerpc_vsx_ok } */ +/* { dg-options "-mpower8-vector -mvsx" } */ + +#include + +vector bool int *vecubi; +vector bool long long *vecublli; +vector signed int *vecsi; +vector signed long long int *vecslli; + +int main () +{ + + /* use of ‘long long’ in AltiVec types requires -mvsx */ + /* __builtin_altivec_vupkhsw and __builtin_altivec_vupklsw + requires the -mpower8-vector option */ + *vecublli++ = vec_unpackh(vecubi[0]); + *vecslli++ = vec_unpackl(vecsi[0]); + + return 0; +} + +//MAKE SURE INSTRUCTIONS ARE CORRECT + +/* Expected results: + vec_unpackh vupklsw + vec_unpackl vupkhsw +*/ + +/* { dg-final { scan-assembler-times "vupklsw" 1 } } */ +/* { dg-final { scan-assembler-times "vupkhsw" 1 } } */ diff --git a/gcc/testsuite/gcc.target/powerpc/altivec-7.c b/gcc/testsuite/gcc.target/powerpc/altivec-7.c index 6aad9a9..b61092c 100644 --- a/gcc/testsuite/gcc.target/powerpc/altivec-7.c +++ b/gcc/testsuite/gcc.target/powerpc/altivec-7.c @@ -18,7 +18,6 @@ vector unsigned int *vecuint; vector bool int *vecubi; vector bool char *vecubci; vector bool short int *vecubsi; -vector bool long long int *vecublli; vector unsigned short *vecushort; vector bool int *vecbint; vector float *vecfloat; @@ -50,13 +49,11 @@ int main () *vecubi++ = vec_unpackh(vecubsi[0]); *vecuint++ = vec_unpackh(varpixel[0]); - *vecublli++ = vec_unpackh(vecubi[0]); *vecubsi++ = vec_unpackh(vecubci[0]); *vecshort++ = vec_unpackh(vecchar[0]); *vecubi++ = vec_unpackl(vecubsi[0]); *vecuint++ = vec_unpackl(varpixel[0]); - *vecublli++ = vec_unpackl(vecubi[0]); *vecubsi++ = vec_unpackl(vecubci[0]); *vecshort++ = vec_unpackl(vecchar[0]); @@ -72,11 +69,9 @@ int main () vec_lvewx lvewx vec_unpackh vupklsh vec_unpackh vupklpx - vec_unpackh vupklsw vec_unpackh vupklsb vec_unpackl vupkhsh vec_unpackl vupkhpx - vec_unpackl vupkhsw vec_unpackl vupkhsb vec_andc xxnor xxland @@ -90,7 +85,7 @@ int main () /* { dg-final { scan-assembler-times "vpkpx" 2 } } */ /* { dg-final { scan-assembler-times "vmulesb" 1 } } */ /* { dg-final { scan-assembler-times "vmulosb" 1 } } */ -/* { dg-final { scan-assembler-times {\mlxvd2x\M|\mlxv\M} 44 { target le } } } */ +/* { dg-final { scan-assembler-times {\mlxvd2x\M|\mlxv\M} 42 { target le } } } */ /* { dg-final { scan-assembler-times {\mlxvd2x\M|\mlxv\M} 4 { target be } } } */ /* { dg-final { scan-assembler-times "lvewx" 2 } } */ /* { dg-final { scan-assembler-times "lvxl" 1 } } */ @@ -100,12 +95,10 @@ int main () /* { dg-final { scan-assembler-times "xxland" 4 } } */ /* { dg-final { scan-assembler-times "xxlxor" 5 } } */ /* { dg-final { scan-assembler-times "xxlandc" 0 } } */ -/* { dg-final { scan-assembler-times "xxlxor" 5 } } */ /* { dg-final { scan-assembler-times "lvx" 1 } } */ /* { dg-final { scan-assembler-times "vmsumubm" 1 } } */ /* { dg-final { scan-assembler-times "vupklpx" 1 } } */ /* { dg-final { scan-assembler-times "vupklsx" 0 } } */ /* { dg-final { scan-assembler-times "vupklsb" 2 } } */ /* { dg-final { scan-assembler-times "vupkhpx" 1 } } */ -/* { dg-final { scan-assembler-times "vupkhsw" 1 } } */ /* { dg-final { scan-assembler-times "vupkhsb" 2 } } */