From patchwork Fri Mar 19 02:46:54 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Kewen.Lin" X-Patchwork-Id: 1455535 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=2620:52:3:1:0:246e:9693:128c; helo=sourceware.org; envelope-from=gcc-patches-bounces@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.a=rsa-sha256 header.s=default header.b=ZZNV/Nc3; dkim-atps=neutral Received: from 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 RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4F1pFq3rJcz9sVt for ; Fri, 19 Mar 2021 13:47:10 +1100 (AEDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id D95843844019; Fri, 19 Mar 2021 02:47:06 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org D95843844019 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1616122026; bh=plaM7QDsCaw2kVukKs77KqEr9z+XNa8v+55FMy+lMGk=; h=To:Subject:Date:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:Cc:From; b=ZZNV/Nc3Wsu6iIvaSa9O7hLW6Zs4NgFV+FWQWBM3s8+KyPLnnibIo2lB2FrDING85 2hi99XO59SZmRemIzrL3cq3Tdaqp9tLiq7MFK4IbB33bgPalDQIpimxlunqpxciUMa 5wi1wZiYvtsRKrGxaPc37i98XRFMQQhu+5jdUInY= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mx0a-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) by sourceware.org (Postfix) with ESMTPS id 57855385041C for ; Fri, 19 Mar 2021 02:47:03 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 57855385041C Received: from pps.filterd (m0098414.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.43/8.16.0.43) with SMTP id 12J2XFcl068974; Thu, 18 Mar 2021 22:47:02 -0400 Received: from pps.reinject (localhost [127.0.0.1]) by mx0b-001b2d01.pphosted.com with ESMTP id 37byr417k7-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 18 Mar 2021 22:47:02 -0400 Received: from m0098414.ppops.net (m0098414.ppops.net [127.0.0.1]) by pps.reinject (8.16.0.43/8.16.0.43) with SMTP id 12J2XtKb074756; Thu, 18 Mar 2021 22:47:02 -0400 Received: from ppma04ams.nl.ibm.com (63.31.33a9.ip4.static.sl-reverse.com [169.51.49.99]) by mx0b-001b2d01.pphosted.com with ESMTP id 37byr417jx-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 18 Mar 2021 22:47:02 -0400 Received: from pps.filterd (ppma04ams.nl.ibm.com [127.0.0.1]) by ppma04ams.nl.ibm.com (8.16.0.43/8.16.0.43) with SMTP id 12J2bpI2016543; Fri, 19 Mar 2021 02:47:00 GMT Received: from b06cxnps3074.portsmouth.uk.ibm.com (d06relay09.portsmouth.uk.ibm.com [9.149.109.194]) by ppma04ams.nl.ibm.com with ESMTP id 378n18nb75-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 19 Mar 2021 02:47:00 +0000 Received: from d06av22.portsmouth.uk.ibm.com (d06av22.portsmouth.uk.ibm.com [9.149.105.58]) by b06cxnps3074.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 12J2kwpO27984282 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 19 Mar 2021 02:46:58 GMT Received: from d06av22.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 53D6A4C046; Fri, 19 Mar 2021 02:46:58 +0000 (GMT) Received: from d06av22.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 7C61C4C040; Fri, 19 Mar 2021 02:46:56 +0000 (GMT) Received: from KewenLins-MacBook-Pro.local (unknown [9.200.45.161]) by d06av22.portsmouth.uk.ibm.com (Postfix) with ESMTP; Fri, 19 Mar 2021 02:46:56 +0000 (GMT) To: GCC Patches Subject: [PATCH] rs6000: Fix some unexpected empty split conditions Message-ID: <85ac05d7-c0f7-fbcf-f2fc-ce52a2138cc2@linux.ibm.com> Date: Fri, 19 Mar 2021 10:46:54 +0800 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.16; rv:78.0) Gecko/20100101 Thunderbird/78.5.0 MIME-Version: 1.0 Content-Language: en-US X-TM-AS-GCONF: 00 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.369, 18.0.761 definitions=2021-03-18_19:2021-03-17, 2021-03-18 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 clxscore=1015 suspectscore=0 priorityscore=1501 impostorscore=0 mlxscore=0 phishscore=0 mlxlogscore=999 malwarescore=0 bulkscore=0 adultscore=0 spamscore=0 lowpriorityscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2103190017 X-Spam-Status: No, score=-11.3 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: "Kewen.Lin via Gcc-patches" From: "Kewen.Lin" Reply-To: "Kewen.Lin" Cc: Bill Schmidt , David Edelsohn , Segher Boessenkool Errors-To: gcc-patches-bounces@gcc.gnu.org Sender: "Gcc-patches" Hi, As Segher and Mike pointed out, the define_insn_and_split should avoid to use empty split condition if the condition for define_insn isn't empty, otherwise it can sometimes leads to unexpected consequence. This patch is to fix some places like this. Bootstrapped/regtested on powerpc64le-linux-gnu P9 and powerpc64-linux-gnu P8. Since it's in very low risk and can avoid some unexpected errors, is it ok for trunk? or has to be for GCC12? BR, Kewen ------ gcc/ChangeLog: * config/rs6000/rs6000.md (*rotldi3_insert_sf, *movcc_p9, floatsi2_lfiwax, floatsi2_lfiwax_mem, floatunssi2_lfiwzx, floatunssi2_lfiwzx_mem, *floatsidf2_internal, *floatunssidf2_internal, fix_truncsi2_stfiwx, fix_truncsi2_internal, fixuns_truncsi2_stfiwx, *round322_fprs, *roundu322_fprs, *fix_truncsi2_internal): Fix empty split condition. * config/rs6000/vsx.md (*vsx_le_undo_permute_, vsx_reduc__v2df, vsx_reduc__v4sf, *vsx_reduc__v2df_scalar, *vsx_reduc__v4sf_scalar): Likewise. diff --git a/gcc/config/rs6000/rs6000.md b/gcc/config/rs6000/rs6000.md index 592ac90aa44..6ab71979566 100644 --- a/gcc/config/rs6000/rs6000.md +++ b/gcc/config/rs6000/rs6000.md @@ -4281,7 +4281,7 @@ (clobber (match_scratch:V4SF 4))] "TARGET_POWERPC64 && INTVAL (operands[2]) == " "#" - "" + "&& 1" [(parallel [(set (match_dup 5) (zero_extend:DI (unspec:QHSI [(match_dup 3)] UNSPEC_SI_FROM_SF))) (clobber (match_dup 4))]) @@ -5327,7 +5327,7 @@ (clobber (match_scratch:V2DI 6 "=0,&wa"))] "TARGET_P9_MINMAX" "#" - "" + "&& 1" [(set (match_dup 6) (if_then_else:V2DI (match_dup 1) (match_dup 7) @@ -5436,7 +5436,7 @@ "TARGET_HARD_FLOAT && TARGET_LFIWAX && && can_create_pseudo_p ()" "#" - "" + "&& 1" [(pc)] { rtx dest = operands[0]; @@ -5476,7 +5476,7 @@ (clobber (match_scratch:DI 2 "=d,wa"))] "TARGET_HARD_FLOAT && TARGET_LFIWAX && " "#" - "" + "&& 1" [(pc)] { operands[1] = rs6000_force_indexed_or_indirect_mem (operands[1]); @@ -5533,7 +5533,7 @@ (clobber (match_scratch:DI 2 "=d,wa"))] "TARGET_HARD_FLOAT && TARGET_LFIWZX && " "#" - "" + "&& 1" [(pc)] { rtx dest = operands[0]; @@ -5573,7 +5573,7 @@ (clobber (match_scratch:DI 2 "=d,wa"))] "TARGET_HARD_FLOAT && TARGET_LFIWZX && " "#" - "" + "&& 1" [(pc)] { operands[1] = rs6000_force_indexed_or_indirect_mem (operands[1]); @@ -5638,7 +5638,7 @@ (clobber (match_operand:SI 6 "gpc_reg_operand" "=&r"))] "!TARGET_FCFID && TARGET_HARD_FLOAT" "#" - "" + "&& 1" [(pc)] { rtx lowword, highword; @@ -5728,7 +5728,7 @@ "!TARGET_FCFIDU && TARGET_HARD_FLOAT && !(TARGET_FCFID && TARGET_POWERPC64)" "#" - "" + "&& 1" [(pc)] { rtx lowword, highword; @@ -5884,7 +5884,7 @@ "TARGET_HARD_FLOAT && TARGET_STFIWX && can_create_pseudo_p () && !(TARGET_P8_VECTOR && TARGET_DIRECT_MOVE)" "#" - "" + "&& 1" [(pc)] { rtx dest = operands[0]; @@ -5926,7 +5926,7 @@ "TARGET_HARD_FLOAT && !(TARGET_P8_VECTOR && TARGET_DIRECT_MOVE)" "#" - "" + "&& 1" [(pc)] { rtx lowword; @@ -6032,7 +6032,7 @@ && TARGET_STFIWX && can_create_pseudo_p () && !TARGET_P8_VECTOR" "#" - "" + "&& 1" [(pc)] { rtx dest = operands[0]; @@ -6252,7 +6252,7 @@ && && TARGET_LFIWAX && TARGET_STFIWX && TARGET_FCFID && !TARGET_DIRECT_MOVE && can_create_pseudo_p ()" "#" - "" + "&& 1" [(pc)] { rtx dest = operands[0]; @@ -6285,7 +6285,7 @@ && TARGET_LFIWZX && TARGET_STFIWX && TARGET_FCFIDU && !TARGET_DIRECT_MOVE && can_create_pseudo_p ()" "#" - "" + "&& 1" [(pc)] { rtx dest = operands[0]; @@ -8268,7 +8268,7 @@ (clobber (match_operand:DI 5 "offsettable_mem_operand" "=o"))] "TARGET_HARD_FLOAT && TARGET_LONG_DOUBLE_128" "#" - "" + "&& 1" [(pc)] { rtx lowword; diff --git a/gcc/config/rs6000/vsx.md b/gcc/config/rs6000/vsx.md index ad673968584..d1053ff6746 100644 --- a/gcc/config/rs6000/vsx.md +++ b/gcc/config/rs6000/vsx.md @@ -972,7 +972,7 @@ "@ # xxlor %x0,%x1" - "" + "&& 1" [(set (match_dup 0) (match_dup 1))] { if (reload_completed && REGNO (operands[0]) == REGNO (operands[1])) @@ -4649,7 +4649,7 @@ (clobber (match_scratch:V2DF 2 "=0,&wa"))] "VECTOR_UNIT_VSX_P (V2DFmode)" "#" - "" + "&& 1" [(const_int 0)] { rtx tmp = (GET_CODE (operands[2]) == SCRATCH) @@ -4671,7 +4671,7 @@ (clobber (match_scratch:V4SF 3 "=&wa"))] "VECTOR_UNIT_VSX_P (V4SFmode)" "#" - "" + "&& 1" [(const_int 0)] { rtx op0 = operands[0]; @@ -4719,7 +4719,7 @@ (clobber (match_scratch:DF 2 "=0,&wa"))] "BYTES_BIG_ENDIAN && VECTOR_UNIT_VSX_P (V2DFmode)" "#" - "" + "&& 1" [(const_int 0)] { rtx hi = gen_highpart (DFmode, operands[1]); @@ -4746,7 +4746,7 @@ (clobber (match_scratch:V4SF 4 "=0"))] "BYTES_BIG_ENDIAN && VECTOR_UNIT_VSX_P (V4SFmode)" "#" - "" + "&& 1" [(const_int 0)] { rtx op0 = operands[0];