From patchwork Thu Nov 9 08:24:09 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Schulze Frielinghaus X-Patchwork-Id: 1861881 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=ibm.com header.i=@ibm.com header.a=rsa-sha256 header.s=pp1 header.b=tQR8OpVQ; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=2620:52:3:1:0:246e:9693:128c; helo=server2.sourceware.org; envelope-from=gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=patchwork.ozlabs.org) Received: from server2.sourceware.org (server2.sourceware.org [IPv6:2620:52:3:1:0:246e:9693:128c]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4SQw3j6tfdz1yQK for ; Thu, 9 Nov 2023 19:24:33 +1100 (AEDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 3B6953861809 for ; Thu, 9 Nov 2023 08:24:31 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mx0b-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) by sourceware.org (Postfix) with ESMTPS id 65490385773A for ; Thu, 9 Nov 2023 08:24:16 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 65490385773A Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=linux.ibm.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=linux.ibm.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 65490385773A Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=148.163.158.5 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1699518258; cv=none; b=ZNHb92AoPn3I+jRB8i7+SKQAt6ua76Fx1WNADaKKPCKTOBLX59z0DzEmR3EYOhZjjKb9zl/3rWCU/oTLVXkD6ek06jecRnZcN4tV9kwMo9nmjq98bNsGfahWIo6ogUf9IDG8aACv8hVxRV5xLGZDYMHKB6lcP7H/7G9eHoTdYPU= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1699518258; c=relaxed/simple; bh=gDuEWwBNLkcp8PCVsCTM4cUUlXH7hJtuRdEWfgWnrh4=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=KdxE2O546dTIIy0qGBJ6jA7VpfjuIPWXh08HUnDJIg84VZLs7NP1brfa0SCiUlACDic+FnSWcZUZSUobWX1Jk5IBRYRGDYsr1IHq1NnLol2kQSzsS0kHB5b0O7H534LMfpvXVQCrvMGU6mlbOjDSZvSZWmxqAZzSulutiXMIhsU= ARC-Authentication-Results: i=1; server2.sourceware.org Received: from pps.filterd (m0353724.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 3A98FG9v027089 for ; Thu, 9 Nov 2023 08:24:16 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=from : to : cc : subject : date : message-id : mime-version : content-transfer-encoding; s=pp1; bh=zztx6/u7QjlUecbkP8IfULZaZ73T/zGKDybpMfWYqDw=; b=tQR8OpVQt7xenfInCv+e1xEONRxI2jj8N/sFy6bHnIBzLljNmm2MiYpGJ3A/HzMxsspd SwePJ/55+l772+H+/3mE6To93WqqfP0mVyEBcSn7oH8gMZmbG/2AZ6xZH4H7ejW3Z2Kf eO7HI3/brplOimq4I3rcr/xg2F5Fie+FlX5xQ6xeqcUAO7ClQY/ae5f8k8j+lwMdw0jy W4g+e8cJSNP9bd4Tst5mNE9vbjexsRxnMQmYVg5VZ2DCEU9AYcdHV3FWut4/QW+ZBx6D g1l3L9bQ0+uCsgoOqJYTHzffYuXG+hHRqIxBH5Ihe0UqtWqNdSKNTH5A2YCaC5kIJUAX 6A== Received: from ppma11.dal12v.mail.ibm.com (db.9e.1632.ip4.static.sl-reverse.com [50.22.158.219]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3u8ure8bjs-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Thu, 09 Nov 2023 08:24:15 +0000 Received: from pps.filterd (ppma11.dal12v.mail.ibm.com [127.0.0.1]) by ppma11.dal12v.mail.ibm.com (8.17.1.19/8.17.1.19) with ESMTP id 3A981ULK004183 for ; Thu, 9 Nov 2023 08:24:14 GMT Received: from smtprelay03.fra02v.mail.ibm.com ([9.218.2.224]) by ppma11.dal12v.mail.ibm.com (PPS) with ESMTPS id 3u7w212j73-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Thu, 09 Nov 2023 08:24:14 +0000 Received: from smtpav03.fra02v.mail.ibm.com (smtpav03.fra02v.mail.ibm.com [10.20.54.102]) by smtprelay03.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 3A98OCVj17367564 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 9 Nov 2023 08:24:12 GMT Received: from smtpav03.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id E392820043; Thu, 9 Nov 2023 08:24:11 +0000 (GMT) Received: from smtpav03.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id BD55420040; Thu, 9 Nov 2023 08:24:11 +0000 (GMT) Received: from a8345010.lnxne.boe (unknown [9.152.108.100]) by smtpav03.fra02v.mail.ibm.com (Postfix) with ESMTPS; Thu, 9 Nov 2023 08:24:11 +0000 (GMT) From: Stefan Schulze Frielinghaus To: krebbel@linux.ibm.com, gcc-patches@gcc.gnu.org Cc: Stefan Schulze Frielinghaus Subject: [PATCH] s390: Reduce number of patterns where the condition is false anyway Date: Thu, 9 Nov 2023 09:24:09 +0100 Message-ID: <20231109082409.2890-1-stefansf@linux.ibm.com> X-Mailer: git-send-email 2.41.0 MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-ORIG-GUID: oGbTAZXWhJZ7IsSXacIy8BEAr1wZFad9 X-Proofpoint-GUID: oGbTAZXWhJZ7IsSXacIy8BEAr1wZFad9 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.987,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2023-11-09_07,2023-11-08_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 impostorscore=0 mlxlogscore=946 suspectscore=0 priorityscore=1501 bulkscore=0 adultscore=0 malwarescore=0 mlxscore=0 spamscore=0 phishscore=0 clxscore=1015 lowpriorityscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2311060000 definitions=main-2311090068 X-Spam-Status: No, score=-8.3 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_MSPIKE_H4, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org For patterns which make use of two modes, do not build the cross product and then exclude illegal combinations via conditions but rather do not create those in the first place. Here we are following the idea of the attribute TOINTVEC/tointvec and introduce TOINT/toint. Bootstrapped and regtested on s390. Ok for mainline? gcc/ChangeLog: * config/s390/s390.md (VX_CONV_INT): Remove iterator. (gf): Add float mappings. (TOINT, toint): New attribute. (*fixuns_trunc2_z13): Remove. (*fixuns_trunc2_z13): Add. (*fix_trunc2_bfp_z13): Remove. (*fix_trunc2_bfp_z13): Add. (*floatuns2_z13): Remove. (*floatuns2_z13): Add. * config/s390/vector.md (VX_VEC_CONV_INT): Remove iterator. (float2): Remove. (float2): Add. (floatuns2): Remove. (floatuns2): Add. (fix_trunc2): Remove. (fix_trunc2): Add. (fixuns_trunc2): Remove. (fixuns_trunc2): Add. --- gcc/config/s390/s390.md | 52 +++++++++++++++++++-------------------- gcc/config/s390/vector.md | 45 +++++++++++++++------------------ 2 files changed, 46 insertions(+), 51 deletions(-) diff --git a/gcc/config/s390/s390.md b/gcc/config/s390/s390.md index 3f29ba21442..0ea2aaf7627 100644 --- a/gcc/config/s390/s390.md +++ b/gcc/config/s390/s390.md @@ -668,7 +668,6 @@ ; 32 bit int<->fp conversion instructions are available since VXE2 (z15). (define_mode_iterator VX_CONV_BFP [DF (SF "TARGET_VXE2")]) -(define_mode_iterator VX_CONV_INT [DI (SI "TARGET_VXE2")]) ;; These mode iterators allow 31-bit and 64-bit GPR patterns to be generated ;; from the same template. @@ -838,7 +837,7 @@ ;; In GPR templates, a string like "cdbr" will expand to "cgdbr" in DImode ;; and "cfdbr" in SImode. -(define_mode_attr gf [(DI "g") (SI "f")]) +(define_mode_attr gf [(DI "g") (SI "f") (DF "g") (SF "f")]) ;; In GPR templates, a string like sll will expand to sllg for DI ;; and sllk for SI. This way it is possible to merge the new z196 SI @@ -897,6 +896,10 @@ (define_mode_attr asm_fcmp [(CCVEQ "e") (CCVFH "h") (CCVFHE "he")]) (define_mode_attr insn_cmp [(CCVEQ "eq") (CCVIH "h") (CCVIHU "hl") (CCVFH "h") (CCVFHE "he")]) +; Analogue to TOINTVEC / tointvec +(define_mode_attr TOINT [(TF "TI") (DF "DI") (SF "SI")]) +(define_mode_attr toint [(TF "ti") (DF "di") (SF "si")]) + ;; Subst pattern definitions (include "subst.md") @@ -5266,16 +5269,15 @@ ; df -> unsigned di, vxe2: sf -> unsigned si ; clgdbr, clfebr, wclgdb, wclfeb -(define_insn "*fixuns_trunc2_z13" - [(set (match_operand:VX_CONV_INT 0 "register_operand" "=d,v") - (unsigned_fix:VX_CONV_INT (match_operand:VX_CONV_BFP 1 "register_operand" "f,v"))) - (unspec:DI [(match_operand:DI 2 "immediate_operand" "K,K")] UNSPEC_ROUND) +(define_insn "*fixuns_trunc2_z13" + [(set (match_operand: 0 "register_operand" "=d,v") + (unsigned_fix: (match_operand:VX_CONV_BFP 1 "register_operand" "f,v"))) + (unspec:DI [(match_operand:DI 2 "immediate_operand" "K,K")] UNSPEC_ROUND) (clobber (reg:CC CC_REGNUM))] - "TARGET_VX && TARGET_HARD_FLOAT - && GET_MODE_SIZE (mode) == GET_MODE_SIZE (mode)" + "TARGET_VX && TARGET_HARD_FLOAT" "@ - clbr\t%0,%h2,%1,0 - wclb\t%v0,%v1,0,%h2" + clbr\t%0,%h2,%1,0 + wclb\t%v0,%v1,0,%h2" [(set_attr "op_type" "RRF,VRR") (set_attr "type" "ftoi")]) @@ -5305,16 +5307,15 @@ ; df -> signed di, vxe2: sf -> signed si ; cgdbr, cfebr, wcgdb, wcfeb -(define_insn "*fix_trunc2_bfp_z13" - [(set (match_operand:VX_CONV_INT 0 "register_operand" "=d,v") - (fix:VX_CONV_INT (match_operand:VX_CONV_BFP 1 "register_operand" "f,v"))) - (unspec:VX_CONV_INT [(match_operand:VX_CONV_INT 2 "immediate_operand" "K,K")] UNSPEC_ROUND) +(define_insn "*fix_trunc2_bfp_z13" + [(set (match_operand: 0 "register_operand" "=d,v") + (fix: (match_operand:VX_CONV_BFP 1 "register_operand" "f,v"))) + (unspec: [(match_operand: 2 "immediate_operand" "K,K")] UNSPEC_ROUND) (clobber (reg:CC CC_REGNUM))] - "TARGET_VX && TARGET_HARD_FLOAT - && GET_MODE_SIZE (mode) == GET_MODE_SIZE (mode)" + "TARGET_VX && TARGET_HARD_FLOAT" "@ - cbr\t%0,%h2,%1 - wcb\t%v0,%v1,0,%h2" + cbr\t%0,%h2,%1 + wcb\t%v0,%v1,0,%h2" [(set_attr "op_type" "RRE,VRR") (set_attr "type" "ftoi")]) @@ -5420,14 +5421,13 @@ ; floatuns(si|di)(tf|df|sf|td|dd)2 instruction pattern(s). ; -(define_insn "*floatuns2_z13" - [(set (match_operand:VX_CONV_BFP 0 "register_operand" "=f,v") - (unsigned_float:VX_CONV_BFP (match_operand:VX_CONV_INT 1 "register_operand" "d,v")))] - "TARGET_VX && TARGET_HARD_FLOAT - && GET_MODE_SIZE (mode) == GET_MODE_SIZE (mode)" +(define_insn "*floatuns2_z13" + [(set (match_operand:VX_CONV_BFP 0 "register_operand" "=f,v") + (unsigned_float:VX_CONV_BFP (match_operand: 1 "register_operand" "d,v")))] + "TARGET_VX && TARGET_HARD_FLOAT" "@ - clbr\t%0,0,%1,0 - wclb\t%v0,%v1,0,0" + clbr\t%0,0,%1,0 + wclb\t%v0,%v1,0,0" [(set_attr "op_type" "RRE,VRR") (set_attr "type" "itofdf")]) @@ -7568,7 +7568,7 @@ ; div(df|sf)3 instruction pattern(s). ; -; dxbr, ddbr, debr, dxb, ddb, deb, ddtr, dxtr +; dxbr, ddbr, debr, ddb, deb, ddtr, dxtr (define_insn "div3" [(set (match_operand:FP 0 "register_operand" "=f,f,f,v,v") (div:FP (match_operand:FP 1 "register_operand" "f,0,0,v,v") diff --git a/gcc/config/s390/vector.md b/gcc/config/s390/vector.md index 7d1eb36e844..0f91b590d0d 100644 --- a/gcc/config/s390/vector.md +++ b/gcc/config/s390/vector.md @@ -86,7 +86,6 @@ ; 32 bit int<->fp vector conversion instructions are available since VXE2 (z15). (define_mode_iterator VX_VEC_CONV_BFP [V2DF (V4SF "TARGET_VXE2")]) -(define_mode_iterator VX_VEC_CONV_INT [V2DI (V4SI "TARGET_VXE2")]) ; Empty string for all but TImode. This is used to hide the TImode ; expander name in case it is defined already. See addti3 for an @@ -2508,12 +2507,11 @@ ; op2: inexact exception not suppressed (IEEE 754 2008) ; op3: according to current rounding mode ; vcdgb, vcefb -(define_insn "float2" - [(set (match_operand:VX_VEC_CONV_BFP 0 "register_operand" "=v") - (float:VX_VEC_CONV_BFP (match_operand:VX_VEC_CONV_INT 1 "register_operand" "v")))] - "TARGET_VX - && GET_MODE_UNIT_SIZE (mode) == GET_MODE_UNIT_SIZE (mode)" - "vcb\t%v0,%v1,0,0" +(define_insn "float2" + [(set (match_operand:VX_VEC_CONV_BFP 0 "register_operand" "=v") + (float:VX_VEC_CONV_BFP (match_operand: 1 "register_operand" "v")))] + "TARGET_VX" + "vcb\t%v0,%v1,0,0" [(set_attr "op_type" "VRR")]) ; There is no instruction for loading a signed integer into an extended BFP @@ -2539,12 +2537,11 @@ ; op2: inexact exception not suppressed (IEEE 754 2008) ; op3: according to current rounding mode ; vcdlgb, vcelfb -(define_insn "floatuns2" - [(set (match_operand:VX_VEC_CONV_BFP 0 "register_operand" "=v") - (unsigned_float:VX_VEC_CONV_BFP (match_operand:VX_VEC_CONV_INT 1 "register_operand" "v")))] - "TARGET_VX - && GET_MODE_UNIT_SIZE (mode) == GET_MODE_UNIT_SIZE (mode)" - "vclb\t%v0,%v1,0,0" +(define_insn "floatuns2" + [(set (match_operand:VX_VEC_CONV_BFP 0 "register_operand" "=v") + (unsigned_float:VX_VEC_CONV_BFP (match_operand: 1 "register_operand" "v")))] + "TARGET_VX" + "vclb\t%v0,%v1,0,0" [(set_attr "op_type" "VRR")]) ; There is no instruction for loading an unsigned integer into an extended BFP @@ -2570,12 +2567,11 @@ ; op2: inexact exception not suppressed (IEEE 754 2008) ; op3: rounding mode 5 (round towards 0 C11 6.3.1.4) ; vcgdb, vcfeb -(define_insn "fix_trunc2" - [(set (match_operand:VX_VEC_CONV_INT 0 "register_operand" "=v") - (fix:VX_VEC_CONV_INT (match_operand:VX_VEC_CONV_BFP 1 "register_operand" "v")))] - "TARGET_VX - && GET_MODE_UNIT_SIZE (mode) == GET_MODE_UNIT_SIZE (mode)" - "vcb\t%v0,%v1,0,5" +(define_insn "fix_trunc2" + [(set (match_operand: 0 "register_operand" "=v") + (fix: (match_operand:VX_VEC_CONV_BFP 1 "register_operand" "v")))] + "TARGET_VX" + "vcb\t%v0,%v1,0,5" [(set_attr "op_type" "VRR")]) ; There is no instruction for rounding an extended BFP operand in a VR into @@ -2604,12 +2600,11 @@ ; op2: inexact exception not suppressed (IEEE 754 2008) ; op3: rounding mode 5 (round towards 0 C11 6.3.1.4) ; vclgdb, vclfeb -(define_insn "fixuns_trunc2" - [(set (match_operand:VX_VEC_CONV_INT 0 "register_operand" "=v") - (unsigned_fix:VX_VEC_CONV_INT (match_operand:VX_VEC_CONV_BFP 1 "register_operand" "v")))] - "TARGET_VX - && GET_MODE_UNIT_SIZE (mode) == GET_MODE_UNIT_SIZE (mode)" - "vclb\t%v0,%v1,0,5" +(define_insn "fixuns_trunc2" + [(set (match_operand: 0 "register_operand" "=v") + (unsigned_fix: (match_operand:VX_VEC_CONV_BFP 1 "register_operand" "v")))] + "TARGET_VX" + "vclb\t%v0,%v1,0,5" [(set_attr "op_type" "VRR")]) ; There is no instruction for rounding an extended BFP operand in a VR into