From patchwork Thu May 4 21:35:10 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bill Schmidt X-Patchwork-Id: 758795 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org 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 3wJpGp0VxBz9s84 for ; Fri, 5 May 2017 07:35:28 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="aUxO2RgT"; dkim-atps=neutral DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:to:cc :from:subject:date:mime-version:content-type :content-transfer-encoding:message-id; q=dns; s=default; b=MGFCO dm7/TMqjff67BO/xC/4YVXq5gpw7rtGmb5mhLcGH2WgeSKk/7uIFpB7c0ltTLelM FFxk6g+jmg2+jcHn/bXYXO2w2Np6YLoheDMkXn07JYQ4WXlqHVOhGCV+MJ1L8vxd i/RjI9jLUBBunram6b6wp+EraH5doXz/QRdoe4= 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:to:cc :from:subject:date:mime-version:content-type :content-transfer-encoding:message-id; s=default; bh=apgkHi+5w9R OBj7wb5/plOIt8zQ=; b=aUxO2RgT4GZSDRc9daVHt3VL9U9eqLpZ6BNSp2t85Cg 7HcdkivrdI80rBDTDhhXu3hd2GORLI+5nCGOohwnDyiMUZ5GNj0LsOk6Sr21Xs6w NtrLDtL5r/QZ5f+Qy0fDPkTKjyyj/DqBVzJGWCPHiYQn0D/HFpv/kcGZEb4eCsDk = Received: (qmail 94743 invoked by alias); 4 May 2017 21:35:17 -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 94733 invoked by uid 89); 4 May 2017 21:35:17 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-10.2 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_2, GIT_PATCH_3, KAM_ASCII_DIVIDERS, KAM_LAZY_DOMAIN_SECURITY, RCVD_IN_DNSWL_LOW autolearn=ham version=3.3.2 spammy=foot, fool 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; Thu, 04 May 2017 21:35:15 +0000 Received: from pps.filterd (m0098409.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.20/8.16.0.20) with SMTP id v44LYGqM125551 for ; Thu, 4 May 2017 17:35:16 -0400 Received: from e32.co.us.ibm.com (e32.co.us.ibm.com [32.97.110.150]) by mx0a-001b2d01.pphosted.com with ESMTP id 2a89t4xr5m-1 (version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT) for ; Thu, 04 May 2017 17:35:16 -0400 Received: from localhost by e32.co.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Thu, 4 May 2017 15:35:15 -0600 Received: from b03cxnp07028.gho.boulder.ibm.com (9.17.130.15) by e32.co.us.ibm.com (192.168.1.132) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Thu, 4 May 2017 15:35:11 -0600 Received: from b03ledav005.gho.boulder.ibm.com (b03ledav005.gho.boulder.ibm.com [9.17.130.236]) by b03cxnp07028.gho.boulder.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id v44LZB9K16187744; Thu, 4 May 2017 14:35:11 -0700 Received: from b03ledav005.gho.boulder.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 451C7BE047; Thu, 4 May 2017 15:35:11 -0600 (MDT) Received: from bigmac.rchland.ibm.com (unknown [9.10.86.41]) by b03ledav005.gho.boulder.ibm.com (Postfix) with ESMTP id 17BC6BE03E; Thu, 4 May 2017 15:35:11 -0600 (MDT) To: GCC Patches Cc: Segher Boessenkool , David Edelsohn From: Bill Schmidt Subject: [PATCH, rs6000] Fix vec_xl and vec_xst intrinsics for P8 Date: Thu, 4 May 2017 16:35:10 -0500 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:45.0) Gecko/20100101 Thunderbird/45.8.0 MIME-Version: 1.0 X-TM-AS-GCONF: 00 x-cbid: 17050421-0004-0000-0000-000012155AC6 X-IBM-SpamModules-Scores: X-IBM-SpamModules-Versions: BY=3.00007022; HX=3.00000240; KW=3.00000007; PH=3.00000004; SC=3.00000209; SDB=6.00856260; UDB=6.00423891; IPR=6.00635470; BA=6.00005326; NDR=6.00000001; ZLA=6.00000005; ZF=6.00000009; ZB=6.00000000; ZP=6.00000000; ZH=6.00000000; ZU=6.00000002; MB=3.00015308; XFM=3.00000014; UTC=2017-05-04 21:35:13 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 17050421-0005-0000-0000-00007F22971F Message-Id: X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:, , definitions=2017-05-04_14:, , 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-1703280000 definitions=main-1705040306 X-IsSubscribed: yes Hi, In an earlier patch, I changed vec_xl and vec_xst to make use of new POWER9 instructions when loading or storing vector short/char values. In so doing, I failed to enable the existing instruction use for -mcpu=power8, so these were no longer considered valid by the compiler. Not good. This patch fixes the problem by using other existing built-in definitions when the POWER9 instructions are not available. I've added a test case to improve coverage and demonstrate that the problem is fixed. Bootstrapped and tested on powerpc64le-unknown-linux-gnu with no regressions. Is this ok for trunk? Thanks, Bill [gcc] 2017-05-04 Bill Schmidt * config/rs6000/rs6000.c: Define POWER8 built-ins for vec_xl and vec_xst with short and char pointer arguments. [gcc/testsuite] 2017-05-04 Bill Schmidt * gcc.target/powerpc/p8-vec-xl-xst.c: New file. Index: gcc/config/rs6000/rs6000.c =================================================================== --- gcc/config/rs6000/rs6000.c (revision 247560) +++ gcc/config/rs6000/rs6000.c (working copy) @@ -18183,6 +18183,17 @@ altivec_init_builtins (void) def_builtin ("__builtin_vsx_st_elemrev_v16qi", void_ftype_v16qi_long_pvoid, VSX_BUILTIN_ST_ELEMREV_V16QI); } + else + { + rs6000_builtin_decls[(int)VSX_BUILTIN_LD_ELEMREV_V8HI] + = rs6000_builtin_decls[(int)VSX_BUILTIN_LXVW4X_V8HI]; + rs6000_builtin_decls[(int)VSX_BUILTIN_LD_ELEMREV_V16QI] + = rs6000_builtin_decls[(int)VSX_BUILTIN_LXVW4X_V16QI]; + rs6000_builtin_decls[(int)VSX_BUILTIN_ST_ELEMREV_V8HI] + = rs6000_builtin_decls[(int)VSX_BUILTIN_STXVW4X_V8HI]; + rs6000_builtin_decls[(int)VSX_BUILTIN_ST_ELEMREV_V16QI] + = rs6000_builtin_decls[(int)VSX_BUILTIN_STXVW4X_V16QI]; + } def_builtin ("__builtin_vec_vsx_ld", opaque_ftype_long_pcvoid, VSX_BUILTIN_VEC_LD); Index: gcc/testsuite/gcc.target/powerpc/p8-vec-xl-xst.c =================================================================== --- gcc/testsuite/gcc.target/powerpc/p8-vec-xl-xst.c (nonexistent) +++ gcc/testsuite/gcc.target/powerpc/p8-vec-xl-xst.c (working copy) @@ -0,0 +1,62 @@ +/* { dg-do compile { target { powerpc*-*-* } } } */ +/* { dg-skip-if "" { powerpc*-*-darwin* } { "*" } { "" } } */ +/* { dg-require-effective-target powerpc_p8vector_ok } */ +/* { dg-skip-if "do not override -mcpu" { powerpc*-*-* } { "-mcpu=*" } { "-mcpu=power8" } } */ +/* { dg-options "-mcpu=power8 -O2" } */ + +/* Verify fix for problem where vec_xl and vec_xst are not recognized + for the vector char and vector short cases on P8 only. */ + +#include + +vector unsigned char +foo (unsigned char * address) +{ + return __builtin_vec_xl (0, address); +} + +void +bar (vector unsigned char x, unsigned char * address) +{ + __builtin_vec_xst (x, 0, address); +} + +vector unsigned short +foot (unsigned short * address) +{ + return __builtin_vec_xl (0, address); +} + +void +bart (vector unsigned short x, unsigned short * address) +{ + __builtin_vec_xst (x, 0, address); +} + +vector unsigned char +fool (unsigned char * address) +{ + return vec_xl (0, address); +} + +void +barl (vector unsigned char x, unsigned char * address) +{ + vec_xst (x, 0, address); +} + +vector unsigned short +footle (unsigned short * address) +{ + return vec_xl (0, address); +} + +void +bartle (vector unsigned short x, unsigned short * address) +{ + vec_xst (x, 0, address); +} + +/* { dg-final { scan-assembler-times "lxvd2x" 4 } } */ +/* { dg-final { scan-assembler-times "stxvd2x" 4 } } */ +/* { dg-final { scan-assembler-times "xxpermdi" 8 } } */