From patchwork Sun Nov 19 05:40:38 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: 166696 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:9910:0:b0:403:3b70:6f57 with SMTP id i16csp1505876vqn; Sat, 18 Nov 2023 21:41:10 -0800 (PST) X-Google-Smtp-Source: AGHT+IHUF3qaEqPF2LDl4SC/BcwWpL6EdgujoLXJ1tdmpRTQDdIO8vCa7UcpkEdITsNHzYFH6jBr X-Received: by 2002:a05:620a:170b:b0:76e:f3a3:4ac6 with SMTP id az11-20020a05620a170b00b0076ef3a34ac6mr4565096qkb.35.1700372469840; Sat, 18 Nov 2023 21:41:09 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1700372469; cv=pass; d=google.com; s=arc-20160816; b=BvKz2qjKSGoJga0MBS5FlFHpLexqQcPdV8uYq5kVKCTbxD4XMV8UvmjRvEHcHeRU52 SdgJrWgBfZbiVtycDg7ySbhoERUMEq+LVDdu0T0Bj2WAlg9g6ooVmhNQO55jtXDlKa/G cEyRdsJEUhoPqGf1GnKMVvzNm5LcjXA9synhoaHrO+LJiHQntcZ4l93LAMP449ti0Rua pK8+YDlYtVpqOoiEfUvhr8OTUR3+2S0k6m1yaXCIGleFTvWB13Gwecoh0pYCydkQGMkH IWTnvE05q80nkSbhPcAI6nzrDRJ7QlQBEKaouDMJa0Mz47Gl4iP2voJsvqV2tvz3ynPV 91pQ== 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=fq1snlkJ7HKvncs6p7IE4ISoXcX/56VK7CKbDpqrX8I=; fh=dp1z4I3tVhinwswv7IAFxpunWK+Ws/fGQfmox9vHv3I=; b=Ivr8QMoVcXyaPI3UdRs7ARt3FSqiVKpu1JfBZnW9/mHOACpkjMQz03bd5hv5MSkU0J lWCEEL53/j85pG2LK78phcmEJ1gNn2LAa0jlZIem2o8fMFvYItgGHWU8RXpGkoCc9cnq rzYJVvEt72KTclIZ/5eXV1tCfAY0n73Ik4fgNkE7tPEtRq2XNRPUJF0w8OxSdTxGcmI7 n7iZeqvKd0f9lnxdO+eOvs/z8rQAHWkfN04wJmjuuvKap4z99QYrC+GvId+fNpQob9sw KtJP/uO16X1M6TKGFuqKBJ9sIzwntPQaoUJGEbkcvxaNzNK8kg6jeexx0fM4899JsmCx 2FMA== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@embecosm.com header.s=google header.b=E0hvlkTC; arc=pass (i=1); spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org" Received: from server2.sourceware.org (server2.sourceware.org. [2620:52:3:1:0:246e:9693:128c]) by mx.google.com with ESMTPS id bk17-20020a05620a1a1100b00778b173f525si4995279qkb.397.2023.11.18.21.41.09 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 18 Nov 2023 21:41:09 -0800 (PST) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) client-ip=2620:52:3:1:0:246e:9693:128c; Authentication-Results: mx.google.com; dkim=pass header.i=@embecosm.com header.s=google header.b=E0hvlkTC; arc=pass (i=1); spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c 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 9B84D385801C for ; Sun, 19 Nov 2023 05:41:09 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-lf1-x12f.google.com (mail-lf1-x12f.google.com [IPv6:2a00:1450:4864:20::12f]) by sourceware.org (Postfix) with ESMTPS id BDC03385842C for ; Sun, 19 Nov 2023 05:40:42 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org BDC03385842C 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 BDC03385842C Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2a00:1450:4864:20::12f ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1700372444; cv=none; b=fTeAmKEOBHoZisKVq+tn5R90e/nJkkwcvfi0Lplo+nHt40mFvjo8jXDcDSqXJajzYav1TY7zAEeoU6YEm42T7bm3YpQjji2WpVQMLmKFBl1YKMarYyE9HPPYi1C6eqnD9GPi/YPDKTOFV6iyAhcqt90lkk1vCKWYi6NAPN3xUAY= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1700372444; c=relaxed/simple; bh=v+EyRWWJgoJJfFcYu3XlU/CsMM59D/sun1OuWNO1xJ8=; h=DKIM-Signature:Date:From:To:Subject:Message-ID:MIME-Version; b=kHnYthEExhwS7yf4o2jw9S0w7Fr4SCnDYRbprbs5m0F8OflbQhXny9fG/U4JfOZl1eWSSCYc/3Mjcl+L+gtL7t2xjCufLFxez8vNNLC8aEYtwFeyxxKCm8nJkmnN3vgbRJnr6Hn00UXMwLbasxtbNEiHmeVaZHMp1rj+Jay0wbo= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-lf1-x12f.google.com with SMTP id 2adb3069b0e04-50aaaf6e58fso411484e87.2 for ; Sat, 18 Nov 2023 21:40:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=embecosm.com; s=google; t=1700372441; x=1700977241; 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=fq1snlkJ7HKvncs6p7IE4ISoXcX/56VK7CKbDpqrX8I=; b=E0hvlkTC5lH5aPorFkhLhCWKFiltxQWVQsYatr3j3tKFvs/iPZghpjusyQk/XgO3ew lkemJRKIGGkSR9cxvVa9pjK59aiTzxFdUTEasiBSV4qrOyd2qHIkdhNijOGKXECQUOSs iCXiSvOOWiPZ4lLvq2pAc9soF+UZuorInh07j4kW4dNXRCmzYwGOpCM3gNmdsES0dr4T p3dgoek/5MP6k5heP5D7CUVpbY5SAjJRgZ1F3a7O/Hi/UaC0YE7FY1mu3THy8yebJbAF o/VPyuHbWi2yI4O6+5MhgyvQH3PHDO2NqbKgr1X4kUpGtTbkvICqDOABF9muhvhL2ZjH XZyA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1700372441; x=1700977241; 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=fq1snlkJ7HKvncs6p7IE4ISoXcX/56VK7CKbDpqrX8I=; b=DJ+Q/Pjj5XyW0/lsTjpFmcpVoCwK9uLz8RM1PCkCQvCyhn7d8Ec+O3o3fIY8chvIBP ijnqVW2bivePB+MZzsfwck2/hUvZuRK558Ivpq4Y+0j0VD2ZFN62OUx5p6mq50UDyST6 ZHmv0N4EBhS2bUuzYZTR0kdTOgUEGelGw294pvi6L9sxo7ZOWJavLiLA0IwbXZ4T664w hDldvYzMEsHGkN0evFbLqlA8SNFJw/yyd9Tkp2BeEdQLf2KA2pB9dxF9dE6D78qTfCtD ZtKFO4c66LlmcDdeoDsieFNvNvt1UKPt18+ce0cChRZfRTraj1iZrxsauZiy0/4RJXqj mjLQ== X-Gm-Message-State: AOJu0YwKR//wIebVAVX32YV/Kv5s8InWbxh5PhslRC7/ajHZYNDeTzac qykT5gVf2FVi++GYVrYkDbUgL1q7WrA/aBiNAqby5w== X-Received: by 2002:ac2:5159:0:b0:509:38df:1e77 with SMTP id q25-20020ac25159000000b0050938df1e77mr2810210lfd.10.1700372441269; Sat, 18 Nov 2023 21:40:41 -0800 (PST) Received: from [192.168.219.3] ([78.8.192.131]) by smtp.gmail.com with ESMTPSA id hh10-20020a170906a94a00b009b2ca104988sm2545757ejb.98.2023.11.18.21.40.40 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Sat, 18 Nov 2023 21:40:40 -0800 (PST) Date: Sun, 19 Nov 2023 05:40:38 +0000 (GMT) From: "Maciej W. Rozycki" To: gcc-patches@gcc.gnu.org cc: Andrew Waterman , Jim Wilson , Kito Cheng , Palmer Dabbelt Subject: [PATCH 25/44] RISC-V: Implement `riscv_emit_unary' helper 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=0.2 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, KAM_ASCII_DIVIDERS, 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: 1782969762883208270 X-GMAIL-MSGID: 1782969762883208270 Add a `riscv_emit_unary' helper for unary operations, complementing `riscv_emit_binary'. gcc/ * config/riscv/riscv-protos.h (riscv_emit_unary): New prototype. * config/riscv/riscv.cc (riscv_emit_unary): New function. --- gcc/config/riscv/riscv-protos.h | 1 + gcc/config/riscv/riscv.cc | 8 ++++++++ 2 files changed, 9 insertions(+) gcc-riscv-emit-unary.diff Index: gcc/gcc/config/riscv/riscv-protos.h =================================================================== --- gcc.orig/gcc/config/riscv/riscv-protos.h +++ gcc/gcc/config/riscv/riscv-protos.h @@ -134,6 +134,7 @@ riscv_zcmp_valid_stack_adj_bytes_p (HOST extern void riscv_expand_int_scc (rtx, enum rtx_code, rtx, rtx, bool *invert_ptr = 0); extern void riscv_expand_float_scc (rtx, enum rtx_code, rtx, rtx); extern void riscv_expand_conditional_branch (rtx, enum rtx_code, rtx, rtx); +extern rtx riscv_emit_unary (enum rtx_code code, rtx dest, rtx x); extern rtx riscv_emit_binary (enum rtx_code code, rtx dest, rtx x, rtx y); #endif extern bool riscv_expand_conditional_move (rtx, rtx, rtx, rtx); Index: gcc/gcc/config/riscv/riscv.cc =================================================================== --- gcc.orig/gcc/config/riscv/riscv.cc +++ gcc/gcc/config/riscv/riscv.cc @@ -1703,6 +1703,14 @@ riscv_emit_set (rtx target, rtx src) return target; } +/* Emit an instruction of the form (set DEST (CODE X)). */ + +rtx +riscv_emit_unary (enum rtx_code code, rtx dest, rtx x) +{ + return riscv_emit_set (dest, gen_rtx_fmt_e (code, GET_MODE (dest), x)); +} + /* Emit an instruction of the form (set DEST (CODE X Y)). */ rtx