From patchwork Tue Jan 16 02:04:38 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: HAO CHEN GUI X-Patchwork-Id: 188357 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:42cf:b0:101:a8e8:374 with SMTP id q15csp1863dye; Mon, 15 Jan 2024 18:05:32 -0800 (PST) X-Google-Smtp-Source: AGHT+IHR0l0ML5fWQ9SAlmHI5opz5/t/h2Km8ahP74w69vDDAfxHsZ+N27qWARQ5Hf93ohgdqkm9 X-Received: by 2002:a05:620a:f81:b0:783:64ea:f37b with SMTP id b1-20020a05620a0f8100b0078364eaf37bmr1385165qkn.10.1705370732433; Mon, 15 Jan 2024 18:05:32 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1705370732; cv=pass; d=google.com; s=arc-20160816; b=i84WumLfgJFCVhMN2G+p3FbDKwXyMGHnoTRX0f8Ds7cBWJlcLwSzhNVp7i9ciEb2oE LcgCOgK+iFsQaGracJhT/2p02uFW0iz5zMewHOx31O9fLJBlssEtY62TXdpXa0+7hJXR OLfTFMfvfm1UNzcKlunc5awAsd7kuFFBAUD1zWvp4H1gOUT6lCQwt1UbHWwJkdoYHaTb OvEpb+3XeOTxZ3faS7rUStdTTfXRf1HtwWvdeC9G6Uby2o/eoEIGpdLmuwtkDEhXIO31 Ft2oth5rWdXZdiBd1QO2ya8oAioYthgTTG8AkjbT6FSc917q7whN+XaHZIlj8RHyxJ7V dPBA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :subject:from:cc:to:content-language:user-agent:mime-version:date :message-id:dkim-signature:arc-filter:dmarc-filter:delivered-to; bh=8LCLCIQtRjhj/NK84opeiHlczBgPZYwMUatqkfANMoY=; fh=lLZP3uHhXiSbgwP2B1KoLJRAVcgP5GU+moaWEakPPkg=; b=C+RheZ/0xa/zBD9UfpRsgLkXhFYie51f/cCMI3G0UK4TgaRldDjyc6rzNNh/lSPyFR pjl7fHgeVvIkXfIMxaTugnLmNvD8TO1xSaZ74yo1bg6LRYEyCC+rwKpIi6GUtfizlWd2 d63/AfryBJL9Ab3a7I4se7uV7MAWEc2WTHXxKI40pxkF2y2QhJJVblcIAeyNyGkPnFzj Y+drd/HqK49HZ7BCaNQY7hGx0Pn4oLArwuWc0jpAG2m92hhp9FZ6V+3jS5z8Q7Vsuz2E LpRghLHEXbU/SmuGpuUI6UCm0LPmnMafB/N60f/zR1SI8Q1T7UIh8+TM8gPeOJygaPEu 9uxQ== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b=R4MJzPMT; arc=pass (i=1); spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=REJECT sp=NONE dis=NONE) header.from=ibm.com Received: from server2.sourceware.org (server2.sourceware.org. [8.43.85.97]) by mx.google.com with ESMTPS id c40-20020a05620a26a800b007835417f902si4964272qkp.335.2024.01.15.18.05.32 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 15 Jan 2024 18:05:32 -0800 (PST) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) client-ip=8.43.85.97; Authentication-Results: mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b=R4MJzPMT; arc=pass (i=1); spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=REJECT sp=NONE dis=NONE) header.from=ibm.com Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 16CEB3858C3A for ; Tue, 16 Jan 2024 02:05:32 +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 2C9583858D32 for ; Tue, 16 Jan 2024 02:04:48 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 2C9583858D32 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 2C9583858D32 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=1705370690; cv=none; b=gNH1W6dOgq/KpLIC9qv6CAlzuuc0fR1BdWwkNUXzip+X3ngBBb5JVuUn6GXgupJccldJbGeTHgY0tmceIseVUYXIxKlSPqps040Ii51c5wxwS5Oj+uISL7AapocbmNgU9YLmxBxTktDPaZsH2FB3tnLwrRVaXkwuZ61RPc3lRvM= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1705370690; c=relaxed/simple; bh=W+MATAlwJhSFCOyumH31of/jGtF/fWw0BTeiTdR5MjA=; h=DKIM-Signature:Message-ID:Date:MIME-Version:To:From:Subject; b=TQvCiaHDCF/vbFfl4EeAIkqz6NEqZ9zliJ7zrwky4BT4zOWvfjCZ1YC08PiSuSwILfVOdSGkIX0vH78zJYW7Ihc3aUbVmC+AYOelGThHltpaC4Dw9SRQTRHy1vagsmBfVjXIWyqidW6/giM0aqRhvJ9Vj65oVGUweERZJ0JuxRY= ARC-Authentication-Results: i=1; server2.sourceware.org Received: from pps.filterd (m0353722.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 40G04u9C016033; Tue, 16 Jan 2024 02:04:45 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=message-id : date : mime-version : to : cc : from : subject : content-type : content-transfer-encoding; s=pp1; bh=8LCLCIQtRjhj/NK84opeiHlczBgPZYwMUatqkfANMoY=; b=R4MJzPMTZATFR6ORAbicqJmx7rmWx1WfFLWlKQQ7lYOU737ucn9yQvnKAYyCJ0jMc1Oj RuwSMlWClaqh/BHiXsk7tx7XufmXuAN4lznQNZPwzp0uXjLINIzegIvDDd62jI/SMwqL 4EqDSB/+fJir5DQvg5P0uOTHZ2lboLlEARttmiw3lY3Yuq7CDe6wQOH54xSr35dOXRN6 DruMOAOlDqJZcbgEdIIXZPwwp8kp7ZV/s2g2X3Kxj7irJiUxnopDFVDi340PPauiuPdy sqjbPPk1Mwyh6gPGVwX4tXKXuRsDPCRRENiOQTbKbmlYZQe3EUEOboVg1fcbHYLvkASm kg== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3vnexf279q-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 16 Jan 2024 02:04:44 +0000 Received: from m0353722.ppops.net (m0353722.ppops.net [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 40G1tb5Y021962; Tue, 16 Jan 2024 02:04:44 GMT Received: from ppma23.wdc07v.mail.ibm.com (5d.69.3da9.ip4.static.sl-reverse.com [169.61.105.93]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3vnexf279j-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 16 Jan 2024 02:04:44 +0000 Received: from pps.filterd (ppma23.wdc07v.mail.ibm.com [127.0.0.1]) by ppma23.wdc07v.mail.ibm.com (8.17.1.19/8.17.1.19) with ESMTP id 40G18aJ1008633; Tue, 16 Jan 2024 02:04:43 GMT Received: from smtprelay04.fra02v.mail.ibm.com ([9.218.2.228]) by ppma23.wdc07v.mail.ibm.com (PPS) with ESMTPS id 3vm6bkbr44-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 16 Jan 2024 02:04:43 +0000 Received: from smtpav06.fra02v.mail.ibm.com (smtpav06.fra02v.mail.ibm.com [10.20.54.105]) by smtprelay04.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 40G24ePH42140184 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 16 Jan 2024 02:04:40 GMT Received: from smtpav06.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id AF58220040; Tue, 16 Jan 2024 02:04:40 +0000 (GMT) Received: from smtpav06.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id E75B62004D; Tue, 16 Jan 2024 02:04:38 +0000 (GMT) Received: from [9.200.103.64] (unknown [9.200.103.64]) by smtpav06.fra02v.mail.ibm.com (Postfix) with ESMTP; Tue, 16 Jan 2024 02:04:38 +0000 (GMT) Message-ID: <4dbb7f96-1ba1-4ab3-88d9-0e82de1b0124@linux.ibm.com> Date: Tue, 16 Jan 2024 10:04:38 +0800 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Content-Language: en-US To: gcc-patches Cc: Segher Boessenkool , David , "Kewen.Lin" , Peter Bergner , Richard Sandiford From: HAO CHEN GUI Subject: [PATCH, expand] Add const0 move checking for CLEAR_BY_PIECES optabs X-TM-AS-GCONF: 00 X-Proofpoint-GUID: x3msduMOWciN0NuLxsMRtE_Dgt-gTkFN X-Proofpoint-ORIG-GUID: TDv0xLjB-nDVVl5Y5Ojepdu5PtGLC73E X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.997,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2024-01-15_17,2024-01-15_03,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 malwarescore=0 spamscore=0 suspectscore=0 bulkscore=0 mlxscore=0 phishscore=0 clxscore=1015 mlxlogscore=999 adultscore=0 priorityscore=1501 impostorscore=0 lowpriorityscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2311290000 definitions=main-2401160014 X-Spam-Status: No, score=-12.5 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+ouuuleilei=gmail.com@gcc.gnu.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1788210820802220139 X-GMAIL-MSGID: 1788210820802220139 Hi, This patch adds const0 move checking for CLEAR_BY_PIECES. The original vec_duplicate handles duplicates of non-constant inputs. But 0 is a constant. So even a platform doesn't support vec_duplicate, it could still do clear by pieces if it supports const0 move by that mode. The test cases will be added in subsequent target specific patch. Bootstrapped and tested on x86 and powerpc64-linux BE and LE with no regressions. Thanks Gui Haochen ChangeLog expand: Add const0 move checking for CLEAR_BY_PIECES optabs vec_duplicate handles duplicates of non-constant inputs. The 0 is a constant. So even a platform doesn't support vec_duplicate, it could still do clear by pieces if it supports const0 move. This patch adds the checking. gcc/ * expr.cc (by_pieces_mode_supported_p): Add const0 move checking for CLEAR_BY_PIECES. patch.diff diff --git a/gcc/expr.cc b/gcc/expr.cc index 34f5ff90a9f..cd960349a53 100644 --- a/gcc/expr.cc +++ b/gcc/expr.cc @@ -1006,14 +1006,21 @@ can_use_qi_vectors (by_pieces_operation op) static bool by_pieces_mode_supported_p (fixed_size_mode mode, by_pieces_operation op) { - if (optab_handler (mov_optab, mode) == CODE_FOR_nothing) + enum insn_code icode = optab_handler (mov_optab, mode); + if (icode == CODE_FOR_nothing) return false; - if ((op == SET_BY_PIECES || op == CLEAR_BY_PIECES) + if (op == SET_BY_PIECES && VECTOR_MODE_P (mode) && optab_handler (vec_duplicate_optab, mode) == CODE_FOR_nothing) return false; + if (op == CLEAR_BY_PIECES + && VECTOR_MODE_P (mode) + && optab_handler (vec_duplicate_optab, mode) == CODE_FOR_nothing + && !insn_operand_matches (icode, 1, CONST0_RTX (mode))) + return false; + if (op == COMPARE_BY_PIECES && !can_compare_p (EQ, mode, ccp_jump)) return false;