From patchwork Sun Nov 19 05:36:41 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Maciej W. Rozycki" X-Patchwork-Id: 166679 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:9910:0:b0:403:3b70:6f57 with SMTP id i16csp1505035vqn; Sat, 18 Nov 2023 21:37:16 -0800 (PST) X-Google-Smtp-Source: AGHT+IGrMLjDazk0/xriBNZjhzLJEXo+/c+o1xWndK6T3X6bArOav3EzMIBucOGmTa+zkNEXlk6J X-Received: by 2002:a05:620a:298f:b0:778:1c6e:a6f1 with SMTP id r15-20020a05620a298f00b007781c6ea6f1mr4691304qkp.57.1700372236531; Sat, 18 Nov 2023 21:37:16 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1700372236; cv=pass; d=google.com; s=arc-20160816; b=q8hiaoo/wGeRImMcwvLeJsmFw/4ABTlsZC6z5lHDYNNdShPQ2L8uay+qH24l2gIYRS Qm7sUGo3Zz+RSFyzjOYAFHE3UVwootvZGe1dBnkN7JSPxjtSTdCeSL/jEzz+4JJZLbbi JNr04Y2sa3s5ky1/R6Fapa7YnSLrkpe1COMsoW9FrSkZVy+VsESdqV9cpOz1IvoXjQ5D NzKTyY6RdZ9NjpSFBAN+8kDMCfGkGaQOKLCRtunHpbKwdkPm61iMRWIdEzFBGNymxJOv cWN69Cc2IR/7KfXFSEOWUO4VaUBcD42rwJbH7z6VSQERktdaSDBfX+M2pLoP9jsTYx6C tNiw== 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:mime-version:user-agent :references:message-id:in-reply-to:subject:cc:to:from:date :dkim-signature:arc-filter:dmarc-filter:delivered-to; bh=t+f7eXhOKfyoKIWuejRcfDM+XKBGxuyvqwv0/TMklCM=; fh=dp1z4I3tVhinwswv7IAFxpunWK+Ws/fGQfmox9vHv3I=; b=b1302qHW1RWmHSSHa79AQrCF6O2s9pdUeP45mPRLJzbbjS3qxG24JY2ceaF7pbWUNB 300eLYunsrJVpJwaq+T6HHrLynTvZpwuaDCXWd+d/iXUgp/lbwITv+2ANNqMv09um7oz SogQOya1nEqZcK2IsuYZJR5mAkb3NKVbTpzaLef2Yt2vKhGwc0bmaNOSZL3MwtNk23qq V/d7YQ6xh1ig++wOfLgzjdZCY3UurcxXz5F3WouyhsJuP+Eh0RH/aW+mhrFAzLXMMjdD lQ+5RMVgRVbAIz6M/ZyAuHLA4hTzrRIaGhJiE6lr6Chvr1uFXvT0gpD3/72mkwyDUxfV g86Q== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@embecosm.com header.s=google header.b="IF2N/eLI"; 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" Received: from server2.sourceware.org (server2.sourceware.org. [8.43.85.97]) by mx.google.com with ESMTPS id bj42-20020a05620a192a00b0076cc34b44c1si5226435qkb.292.2023.11.18.21.37.16 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 18 Nov 2023 21:37:16 -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=@embecosm.com header.s=google header.b="IF2N/eLI"; 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" Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id B2D3D3857C42 for ; Sun, 19 Nov 2023 05:37:08 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-ed1-x535.google.com (mail-ed1-x535.google.com [IPv6:2a00:1450:4864:20::535]) by sourceware.org (Postfix) with ESMTPS id 38B113857B94 for ; Sun, 19 Nov 2023 05:36:45 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 38B113857B94 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=embecosm.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=embecosm.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 38B113857B94 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2a00:1450:4864:20::535 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1700372206; cv=none; b=waWz9mzDPGVcy5pMV8nabjm9/lRm7EGDlJGExoWPbs3PbzVJ6VaBruDf4d58sX5obYDzhjhku3B5vSiwMDp3PPLpojjRgvM8AfrvId99NhIyYgBoRa0qtPSyOiAARAEyEjI+9RAcmhW2DrUagAvnUds2h/bP0IYa+/E4hnbo7tI= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1700372206; c=relaxed/simple; bh=ISN9526dPjG9jgjllxx3KqPFeNfVGX8IXquqoZnQyZg=; h=DKIM-Signature:Date:From:To:Subject:Message-ID:MIME-Version; b=SN2WXp6q9YyA0cSQsH6vInCTns5rxpHPkN9tGKo9kxk27taKrzqK0JuDCApCKytqCEFCIrq1Xw3KjnWiZOtwUKM45hE8QwEjmZhS+mwQD3mO8oecQJke3cH1Ti06bLPn7NkAmOx6rJLRNkZz65wHtp1PJibbsogxmLJR0mp74AU= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-ed1-x535.google.com with SMTP id 4fb4d7f45d1cf-5431614d90eso4702697a12.1 for ; Sat, 18 Nov 2023 21:36:45 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=embecosm.com; s=google; t=1700372204; x=1700977004; darn=gcc.gnu.org; h=mime-version:user-agent:references:message-id:in-reply-to:subject :cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=t+f7eXhOKfyoKIWuejRcfDM+XKBGxuyvqwv0/TMklCM=; b=IF2N/eLIorodtOFTT7Piql0Y73kRMMC9q0IwvghNyBoiGnHgU/ZYLQ2hw05Lw3LkSv wNLFYg5ok7ulD0YC628n/h29PWGIzwSCECB5EX4Eq0uGlgdbyKjBFBKxWmqNfQL+XF94 BdNsznZKNagK5BQ/XzMNtyU6NS4gmpkcX46ZIfD0mXGx1yNV4pSS+jqnHpv8urwRD7Gs gfLfF+ANJFZy2mGwnS3QI4DldU/XGQrQwZiXrX0JOLHhA/b6SD9DtOKlUkOsWUfBKoFK OzxcR2VH5W18vWEV8HMI9AJYz6q98dkkWqrfaFsF3bv3gR1vhIz9+SrF5q+qDHMOB7qJ yQWg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1700372204; x=1700977004; h=mime-version:user-agent:references:message-id:in-reply-to:subject :cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=t+f7eXhOKfyoKIWuejRcfDM+XKBGxuyvqwv0/TMklCM=; b=Due0AIx/iU46d6VnutvowPRDuXjvWKj4Ro1M7KpRBD/uG6dDxMrzZwcjsixzqePZh+ ZhLUHq3i7djmHWwEGPancYoflCw0vNxIFcJ5WVxWUWtHiH9A0Sbd+JxQzmVHy0qh49+v G+nveonGb3+4P5X2oClu8imVBBujM6LM+R5qrK3xuaTsYjq89j2GB/R/rMm5g3hc2pbf WfgGV6cQoa+6I1MX7njUiaeYoVTor2V94TDq80OpeD3s6tbMhuqBjSqFTd41F6CD5mJN Lp1ceTLTpDWkbgrSnDnNVkyw6d4UdAMY+0gTjqrwHMj1l5sMJ4IPCbUVneb4gGcdoYUE sPAw== X-Gm-Message-State: AOJu0YwnpYTgjNINIAThPiKQ/4etSkxe9uUSnO0WetXBJN0UsS1v4KTW 7TZV6jO78eyq4fOu4qHVkJwWgENr3EEEoT+RHqJp+g== X-Received: by 2002:a17:906:51d4:b0:9fc:1078:2615 with SMTP id v20-20020a17090651d400b009fc10782615mr1242645ejk.76.1700372203998; Sat, 18 Nov 2023 21:36:43 -0800 (PST) Received: from [192.168.219.3] ([78.8.192.131]) by smtp.gmail.com with ESMTPSA id lh10-20020a170906f8ca00b009fd2028e62csm231582ejb.71.2023.11.18.21.36.42 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Sat, 18 Nov 2023 21:36:43 -0800 (PST) Date: Sun, 19 Nov 2023 05:36:41 +0000 (GMT) From: "Maciej W. Rozycki" To: gcc-patches@gcc.gnu.org cc: Andrew Waterman , Jim Wilson , Kito Cheng , Palmer Dabbelt Subject: [PATCH 08/44] RISC-V: Simplify EQ vs NE selection in `riscv_expand_conditional_move' In-Reply-To: Message-ID: References: User-Agent: Alpine 2.20 (DEB 67 2015-01-07) MIME-Version: 1.0 X-Spam-Status: No, score=-1.8 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE, URIBL_BLACK autolearn=no 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: 1782969518394434766 X-GMAIL-MSGID: 1782969518394434766 Just choose between EQ and NE at `gen_rtx_fmt_ee' invocation, removing an extraneous variable only referred once and improving code clarity. gcc/ * config/riscv/riscv.cc (riscv_expand_conditional_move): Remove extraneous variable for EQ vs NE operation selection. --- FWIW I have no idea what "We need to know where so that we can adjust it for our needs." refers to, but that would have to be for another change. --- gcc/config/riscv/riscv.cc | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) gcc-riscv-expand-conditional-move-new-code.diff Index: gcc/gcc/config/riscv/riscv.cc =================================================================== --- gcc.orig/gcc/config/riscv/riscv.cc +++ gcc/gcc/config/riscv/riscv.cc @@ -4023,10 +4023,12 @@ riscv_expand_conditional_move (rtx dest, we can then use an equality comparison against zero. */ if (!equality_operator (op, VOIDmode) || op1 != CONST0_RTX (mode)) { - enum rtx_code new_code = NE; bool *invert_ptr = nullptr; bool invert = false; + /* If riscv_expand_int_scc inverts the condition, then it will + flip the value of INVERT. We need to know where so that + we can adjust it for our needs. */ if (code == LE || code == GE) invert_ptr = &invert; @@ -4043,13 +4045,7 @@ riscv_expand_conditional_move (rtx dest, else return false; - /* If riscv_expand_int_scc inverts the condition, then it will - flip the value of INVERT. We need to know where so that - we can adjust it for our needs. */ - if (invert) - new_code = EQ; - - op = gen_rtx_fmt_ee (new_code, mode, tmp, const0_rtx); + op = gen_rtx_fmt_ee (invert ? EQ : NE, mode, tmp, const0_rtx); /* We've generated a new comparison. Update the local variables. */ code = GET_CODE (op);