From patchwork Sun Nov 19 05:39:13 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: 166692 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:9910:0:b0:403:3b70:6f57 with SMTP id i16csp1505598vqn; Sat, 18 Nov 2023 21:39:59 -0800 (PST) X-Google-Smtp-Source: AGHT+IEcZYTiw9ArmJL8p/sXykaChTYqjKKOuwaSSge8PLaM1m5ZjOTLTfz9x0rTj3e57dwPGVGg X-Received: by 2002:a05:622a:8f:b0:41c:c205:f718 with SMTP id o15-20020a05622a008f00b0041cc205f718mr5273251qtw.45.1700372399439; Sat, 18 Nov 2023 21:39:59 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1700372399; cv=pass; d=google.com; s=arc-20160816; b=SiyISqZFeqG/d73qa66wE1taJSN13JNWG31HzVt5yee5rrlhiaE1wdDW7vF+FjavN5 MrvcNAeSRNy+Oj99dMZY17O/EvZkyCqOqf6JggHugoUSz1NHTOGMVMylhT/7UYPYZUd9 Fj0UzdQgVOuPgXF+nWoPsI6UmF0/hgyRWlvY7CntyguwulBJc58HRMapON5/7+9Wpetg nok46KPlgc18H1PtRksiHFQQyJUCuOzbr21V/Fk3Rgb6LzwJdOQt8CV/8zg+1Q2g96Ig dPNp1OfLtedsHNTqJo84uNclkw2M4f+KABGuzBX0bqozaSWBc6AYGEWh3rxrzQzAQcp0 O8qw== 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=EW9xIDlH6PDka8ZcyC8Ol6tO54Vp+hf7uLlun5EjOQs=; fh=dp1z4I3tVhinwswv7IAFxpunWK+Ws/fGQfmox9vHv3I=; b=m6a+FQYO7xeFCzg+u/Vtwi9eO4r3w8pfnDfTgfCOaCB+0irNM5fhouwLcpiCXyAsvD TbT5E+Yc5jVyGk9myMkHnBbje1nkPlJ4kPRM9yIgC4jV5+mrk488i0anhJuN23FQvgBR FyfXQO5TIR0SHmRSC6uYkx8JspjfU5Ho5NLFiOvi6VUxoKyyQ546JDJ6VpKZlIpMDyYz MuMLTjQxVG5qFxfh8W37e0V4/R1g4CRZY7nso+GDXhoiNNbYTmyZKnLaAwRYQnVUzI7y K7b2Rv2qkZWtzag+FMiXaeb1HGDrmkSZNLKqOXr6lS9b0oGIHFWPH09aHnTOja8VJxyI /eyg== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@embecosm.com header.s=google header.b="bJY/TtLc"; 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 c12-20020ac85a8c000000b00418221ab506si4984278qtc.161.2023.11.18.21.39.59 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 18 Nov 2023 21:39:59 -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="bJY/TtLc"; 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 6BE99385DC2E for ; Sun, 19 Nov 2023 05:39:48 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-ej1-x62b.google.com (mail-ej1-x62b.google.com [IPv6:2a00:1450:4864:20::62b]) by sourceware.org (Postfix) with ESMTPS id 8F0D33860002 for ; Sun, 19 Nov 2023 05:39:17 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 8F0D33860002 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 8F0D33860002 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2a00:1450:4864:20::62b ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1700372358; cv=none; b=O3Ldw+e8cAoik8kWpHaaw7JchaHPM5vVMTC3dGeMRfimsrq0CcU2E3nPgpgVONGeyYpVl3kUR2wQAAvaYTN2IQMHpOvE2xiqN/3VQOMELDlFBKoXSGRH8trP5O34EgwREerqJe3cPihBg/9coXNHXlJB5dJdMhLLryprydTNVMU= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1700372358; c=relaxed/simple; bh=ye5FQdPYA6BdoTEThl6Lb/3bFnuYaF+di3ccl1zsXgs=; h=DKIM-Signature:Date:From:To:Subject:Message-ID:MIME-Version; b=vPjwrrETWj8lq26OVVV3SVvQrBzGAsPg1z+K56fvg65ZF+hGQOufZzwYZSZ+k5/IBUnyYy5qWVneWt5pE4BGNkRi2+Dl7dXKPq/cGMF6Kv8JFUaQJfNqQWvwQW2fRKxJq/lEgyPTRqCkD+MR7tPxSISxoVIcc+MSW2pyV/jOXPc= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-ej1-x62b.google.com with SMTP id a640c23a62f3a-9e623356e59so451260666b.0 for ; Sat, 18 Nov 2023 21:39:17 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=embecosm.com; s=google; t=1700372356; x=1700977156; 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=EW9xIDlH6PDka8ZcyC8Ol6tO54Vp+hf7uLlun5EjOQs=; b=bJY/TtLclG+qMVyvjfgfk8lBxYbSfO9FHPtnAp3gLcCcJsgWSbT1iM/zLJrkDGxOqL TLHhCW+4tjn76fP2Oqua6cDlZVVcEEUSAZmRXDLtIFp6kInA6ZNI79oYgEn4mIlmC6mq UjKq/M3A1olMwFqNHpSfgBiHqhcFnKjcs3kTJFXPJD+BT6jF0PE8fCv7cErqejW3b8o8 jrm1yVfe+5/DSJqczGqrLDU91VIOmFeU1VbnTpbcP2+4zyr0GASd5/bCR0/X1gx+jma8 VDHDv93l1eTcSJQjj/oOP5Oel013z2iYMh9YQcoJ9pUVj1eeI8xRV4Oi0BOj92HWS0CK 4oTw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1700372356; x=1700977156; 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=EW9xIDlH6PDka8ZcyC8Ol6tO54Vp+hf7uLlun5EjOQs=; b=hc3n9C/Qc7k1Wo4WjXfLcO1f0H5wVFcOJindRgikciskw+e5tg3S7KA3MDvnGUy76B y6yKQhRa5LlK4rh8b+2n8j4OerrACGkIjqOyhMryzCHmCDZXomr9P/E7jRXJjeOKj9P3 K8QFozI64oXdgXkSA119e0bxvaQ1fuzCNZ2mWOcMdF/gnQAJeZvGEyXq0qMcjLQQ8i/k dX3xYIqJCMapB1CvIzhzKJwpqhAIx9Ql4OihCLj5FI6fYrWDVvGAKlI3FdsjrCTnnJB5 eXH+EhlVCYcKLzNJ8/RPZxmsTghb+f+qdHqPcoK/lS/6W7B+Q1pozzz9hqNr4lYABYm0 SQfw== X-Gm-Message-State: AOJu0YwMbJLgof2EW7qBasRqbuvSltuOytekoUpZNjHf/7WpEQQziwtQ FpZck7cAcx2uPosWMvcUVuBO5lqBfKG9I6n0dz+1gQ== X-Received: by 2002:a17:906:4947:b0:9e4:f7cb:ef18 with SMTP id f7-20020a170906494700b009e4f7cbef18mr3445343ejt.68.1700372356302; Sat, 18 Nov 2023 21:39:16 -0800 (PST) Received: from [192.168.219.3] ([78.8.192.131]) by smtp.gmail.com with ESMTPSA id kk17-20020a170907767100b0099cce6f7d50sm2554573ejc.64.2023.11.18.21.39.14 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Sat, 18 Nov 2023 21:39:15 -0800 (PST) Date: Sun, 19 Nov 2023 05:39:13 +0000 (GMT) From: "Maciej W. Rozycki" To: gcc-patches@gcc.gnu.org cc: Andrew Waterman , Jim Wilson , Kito Cheng , Palmer Dabbelt Subject: [PATCH 20/44] RISC-V: Also accept constants for T-Head cond-move comparison operands 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.7 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: 1782969689165493112 X-GMAIL-MSGID: 1782969689165493112 There is no need for the requirement for conditional-move comparison operands to be stricter for T-Head targets than for other targets and limit them to registers only. Constants will be reloaded if required just as with branches or other-target conditional-move operations and there is no extra overhead specific to the T-Head case. This enables more opportunities for a branchless sequence to be produced. gcc/ * config/riscv/riscv.cc (riscv_expand_conditional_move): Also accept constants for T-Head comparison operands. --- gcc/config/riscv/riscv.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) gcc-riscv-expand-conditional-move-thead-op.diff Index: gcc/gcc/config/riscv/riscv.cc =================================================================== --- gcc.orig/gcc/config/riscv/riscv.cc +++ gcc/gcc/config/riscv/riscv.cc @@ -4097,8 +4097,8 @@ riscv_expand_conditional_move (rtx dest, && reg_or_0_operand (cons, mode) && reg_or_0_operand (alt, mode) && (GET_MODE (op) == mode || GET_MODE (op) == E_VOIDmode) - && GET_MODE (op0) == mode - && GET_MODE (op1) == mode + && (GET_MODE (op0) == mode || CONST_INT_P (op0)) + && (GET_MODE (op1) == mode || CONST_INT_P (op1)) && (code == EQ || code == NE)) need_eq_ne_p = true;