From patchwork Fri Feb 16 16:58: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: 874570 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-473437-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="vvuzfy6m"; 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 3zjfVy5JWVz9s72 for ; Sat, 17 Feb 2018 03:59:05 +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:to:cc:date:content-type:mime-version :content-transfer-encoding:message-id; q=dns; s=default; b=el7Z8 YlPVza5c6BwMgXCI77c8sbn+rgnmi9Po1HeLMyT5jftGNyhd5GmE00qsv/TMJgi+ qdNkJG4MSWAjE7hoYxdSJIBrBoQwGtH6DAXCxEhRxydr4yghZ56a6Pn4ZxieJgJ7 DrVQzPYRslG+ZehOAGcMyvndiavXXJccuncfoU= 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=x1mCqR0VOcd 4Bn0viOTlDV5yJUE=; b=vvuzfy6m4r+50u7kJzla0NawJoKXTbfK5tueQAym4FI WdCiX2AOEgSq4q/D7f002C1eGI8JAxJ1z4p2p0M3m7O0zblJw1o5oOwlwDl+VYU8 lQL4SHQrG1OpB9EZ6VqxW1CzblM0SgyGVrJWE+Tbn3J30ou4vrpC66gmoXw6o0dM = Received: (qmail 48173 invoked by alias); 16 Feb 2018 16:58:58 -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 48160 invoked by uid 89); 16 Feb 2018 16:58:58 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-25.5 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, KAM_ASCII_DIVIDERS, KAM_LAZY_DOMAIN_SECURITY, RCVD_IN_DNSWL_LOW autolearn=ham version=3.3.2 spammy=bills, Bills, (unknown) X-HELO: mx0a-001b2d01.pphosted.com Received: from mx0b-001b2d01.pphosted.com (HELO mx0a-001b2d01.pphosted.com) (148.163.158.5) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 16 Feb 2018 16:58:56 +0000 Received: from pps.filterd (m0098420.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id w1GGs9bf080673 for ; Fri, 16 Feb 2018 11:58:54 -0500 Received: from e15.ny.us.ibm.com (e15.ny.us.ibm.com [129.33.205.205]) by mx0b-001b2d01.pphosted.com with ESMTP id 2g5yuc9g1v-1 (version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT) for ; Fri, 16 Feb 2018 11:58:54 -0500 Received: from localhost by e15.ny.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Fri, 16 Feb 2018 11:58:53 -0500 Received: from b01cxnp23034.gho.pok.ibm.com (9.57.198.29) by e15.ny.us.ibm.com (146.89.104.202) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Fri, 16 Feb 2018 11:58:50 -0500 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 w1GGwoZf45351154; Fri, 16 Feb 2018 16:58:50 GMT Received: from b01ledav001.gho.pok.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id E663B2803A; Fri, 16 Feb 2018 11:58:13 -0500 (EST) Received: from oc3304648336.ibm.com (unknown [9.70.82.121]) by b01ledav001.gho.pok.ibm.com (Postfix) with ESMTP id 5D5082803E; Fri, 16 Feb 2018 11:58:13 -0500 (EST) Subject: [Patch, rs6000] Require Power 8 for vec_float2 builtin From: Carl Love To: gcc-patches@gcc.gnu.org, David Edelsohn , Segher Boessenkool Cc: Bill Schmidt , cel@us.ibm.com Date: Fri, 16 Feb 2018 08:58:49 -0800 Mime-Version: 1.0 X-TM-AS-GCONF: 00 x-cbid: 18021616-0036-0000-0000-000002C19FEF X-IBM-SpamModules-Scores: X-IBM-SpamModules-Versions: BY=3.00008543; HX=3.00000241; KW=3.00000007; PH=3.00000004; SC=3.00000254; SDB=6.00990638; UDB=6.00503117; IPR=6.00769984; MB=3.00019590; MTD=3.00000008; XFM=3.00000015; UTC=2018-02-16 16:58:51 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 18021616-0037-0000-0000-0000435D1A92 Message-Id: <1518800329.7508.37.camel@us.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:, , definitions=2018-02-16_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=1011 lowpriorityscore=0 impostorscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1709140000 definitions=main-1802160202 X-IsSubscribed: yes GCC maintainers: The following patch fixes a GCC internal compiler error. Several of the builtins use the wrong enable conditions as mentioned in Bill's issue data base (https://github.ibm.com/wschmidt/power-gcc/issue s/282). The implementation for the vec_float2() builtin, as implemented, uses the pre Power 8 macro expansions BU_VSX_2 and BU_VSX_OVERLOAD_2. The result is GCC generates an internal compiler error when the test file is compiled with -mcpu=power7. The builtin support uses RTL code that is only supported on Power 8 and beyond.   Additionally, the 64-bit ABI document that lists the vec_float2() builtin says the listed builtins are supported on Power 8 or newer platforms. This patch changes the expansion macros to the equivalent Power 8 macros. The test now cleanly exits with the message error: builtin function ‘__builtin_vsx_float2_v2di’ requires the ‘- mpower8-vector’ option rather then giving an internal compiler error when compiled with the cpu=power7 option. The patch was tested by running the full regression suite to ensure no new regressions were introduced. Additionally, the patch was tested by hand compiling with the -mcpu=power7 option to verify the issue is fixed. The testing was don on powerpc64le-unknown-linux-gnu (Power 8 LE) Please let me know if the patch looks OK or not. Thanks. Carl Love --------------------------------------------------------------------------------- gcc/ChangeLog: 2018-02-16 Carl Love * config/rs6000/rs6000-builtin.def: Add BU_P8V_VSX_2 macro definition. Change FLOAT2 expansions from BU_VSX_2 to BU_P8V_VSX_2 and from BU_VSX_OVERLOAD_2 to BU_P8V_OVERLOAD_2. * config/rs6000/rs6000-c.c: Changed macro VSX_BUILTIN_VEC_FLOAT2 expansion to P8V_BUILTIN_VEC_FLOAT2. --- gcc/config/rs6000/rs6000-builtin.def | 20 +++++++++++++++----- gcc/config/rs6000/rs6000-c.c | 6 +++--- 2 files changed, 18 insertions(+), 8 deletions(-) diff --git a/gcc/config/rs6000/rs6000-builtin.def b/gcc/config/rs6000/rs6000-builtin.def index 86604da..05eb356 100644 --- a/gcc/config/rs6000/rs6000-builtin.def +++ b/gcc/config/rs6000/rs6000-builtin.def @@ -403,6 +403,14 @@ | RS6000_BTC_UNARY), \ CODE_FOR_ ## ICODE) /* ICODE */ +#define BU_P8V_VSX_2(ENUM, NAME, ATTR, ICODE) \ + RS6000_BUILTIN_2 (P8V_BUILTIN_ ## ENUM, /* ENUM */ \ + "__builtin_vsx_" NAME, /* NAME */ \ + RS6000_BTM_P8_VECTOR, /* MASK */ \ + (RS6000_BTC_ ## ATTR /* ATTR */ \ + | RS6000_BTC_BINARY), \ + CODE_FOR_ ## ICODE) /* ICODE */ + #define BU_P8V_OVERLOAD_1(ENUM, NAME) \ RS6000_BUILTIN_1 (P8V_BUILTIN_VEC_ ## ENUM, /* ENUM */ \ "__builtin_vec_" NAME, /* NAME */ \ @@ -1659,9 +1667,6 @@ BU_VSX_2 (CMPLE_U16QI, "cmple_u16qi", CONST, vector_ngtuv16qi) BU_VSX_2 (CMPLE_U8HI, "cmple_u8hi", CONST, vector_ngtuv8hi) BU_VSX_2 (CMPLE_U4SI, "cmple_u4si", CONST, vector_ngtuv4si) BU_VSX_2 (CMPLE_U2DI, "cmple_u2di", CONST, vector_ngtuv2di) -BU_VSX_2 (FLOAT2_V2DF, "float2_v2df", CONST, float2_v2df) -BU_VSX_2 (FLOAT2_V2DI, "float2_v2di", CONST, float2_v2di) -BU_VSX_2 (UNS_FLOAT2_V2DI, "uns_float2_v2di", CONST, uns_float2_v2di) BU_VSX_2 (VEC_VSIGNED2_V2DF, "vsigned2_v2df", CONST, vsigned2_v2df) BU_VSX_2 (VEC_VUNSIGNED2_V2DF, "vunsigned2_v2df", CONST, vunsigned2_v2df) @@ -1856,8 +1861,6 @@ BU_VSX_OVERLOAD_2 (XXMRGHW, "xxmrghw") BU_VSX_OVERLOAD_2 (XXMRGLW, "xxmrglw") BU_VSX_OVERLOAD_2 (XXSPLTD, "xxspltd") BU_VSX_OVERLOAD_2 (XXSPLTW, "xxspltw") -BU_VSX_OVERLOAD_2 (FLOAT2, "float2") -BU_VSX_OVERLOAD_2 (UNS_FLOAT2, "uns_float2") BU_VSX_OVERLOAD_2 (VSIGNED2, "vsigned2") BU_VSX_OVERLOAD_2 (VUNSIGNED2, "vunsigned2") @@ -1910,6 +1913,11 @@ BU_P8V_VSX_1 (REVB_V16QI, "revb_v16qi", CONST, revb_v16qi) BU_P8V_VSX_1 (REVB_V2DF, "revb_v2df", CONST, revb_v2df) BU_P8V_VSX_1 (REVB_V4SF, "revb_v4sf", CONST, revb_v4sf) +/* 2 argument VSX instructions added in ISA 2.07. */ +BU_P8V_VSX_2 (FLOAT2_V2DF, "float2_v2df", CONST, float2_v2df) +BU_P8V_VSX_2 (FLOAT2_V2DI, "float2_v2di", CONST, float2_v2di) +BU_P8V_VSX_2 (UNS_FLOAT2_V2DI, "uns_float2_v2di", CONST, uns_float2_v2di) + /* 1 argument altivec instructions added in ISA 2.07. */ BU_P8V_AV_1 (ABS_V2DI, "abs_v2di", CONST, absv2di2) BU_P8V_AV_1 (VUPKHSW, "vupkhsw", CONST, altivec_vupkhsw) @@ -2052,6 +2060,8 @@ BU_P8V_OVERLOAD_2 (VSRD, "vsrd") BU_P8V_OVERLOAD_2 (VSUBCUQ, "vsubcuq") BU_P8V_OVERLOAD_2 (VSUBUDM, "vsubudm") BU_P8V_OVERLOAD_2 (VSUBUQM, "vsubuqm") +BU_P8V_OVERLOAD_2 (FLOAT2, "float2") +BU_P8V_OVERLOAD_2 (UNS_FLOAT2, "uns_float2") /* ISA 2.07 vector overloaded 3 argument functions. */ BU_P8V_OVERLOAD_3 (VADDECUQ, "vaddecuq") diff --git a/gcc/config/rs6000/rs6000-c.c b/gcc/config/rs6000/rs6000-c.c index a68be51..236003f 100644 --- a/gcc/config/rs6000/rs6000-c.c +++ b/gcc/config/rs6000/rs6000-c.c @@ -1542,11 +1542,11 @@ const struct altivec_builtin_types altivec_overloaded_builtins[] = { RS6000_BTI_V4SF, RS6000_BTI_V4SI, 0, 0 }, { VSX_BUILTIN_VEC_FLOAT, VSX_BUILTIN_XVCVUXWSP_V4SF, RS6000_BTI_V4SF, RS6000_BTI_unsigned_V4SI, 0, 0 }, - { VSX_BUILTIN_VEC_FLOAT2, VSX_BUILTIN_FLOAT2_V2DF, + { P8V_BUILTIN_VEC_FLOAT2, P8V_BUILTIN_FLOAT2_V2DF, RS6000_BTI_V4SF, RS6000_BTI_V2DF, RS6000_BTI_V2DF, 0 }, - { VSX_BUILTIN_VEC_FLOAT2, VSX_BUILTIN_FLOAT2_V2DI, + { P8V_BUILTIN_VEC_FLOAT2, P8V_BUILTIN_FLOAT2_V2DI, RS6000_BTI_V4SF, RS6000_BTI_V2DI, RS6000_BTI_V2DI, 0 }, - { VSX_BUILTIN_VEC_FLOAT2, VSX_BUILTIN_UNS_FLOAT2_V2DI, + { P8V_BUILTIN_VEC_FLOAT2, P8V_BUILTIN_UNS_FLOAT2_V2DI, RS6000_BTI_V4SF, RS6000_BTI_unsigned_V2DI, RS6000_BTI_unsigned_V2DI, 0 }, { VSX_BUILTIN_VEC_FLOATE, VSX_BUILTIN_FLOATE_V2DF,