From patchwork Mon Aug 21 16:37:40 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Edwin Lu X-Patchwork-Id: 136410 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b82d:0:b0:3f2:4152:657d with SMTP id z13csp3127059vqi; Mon, 21 Aug 2023 09:39:54 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGwVK40uC5W2/teW2MuwoVFV07OZd5/qDB6hyVTeu/9+he24zS01V410Q4zVgoum8qwr20W X-Received: by 2002:a2e:918a:0:b0:2b9:bd23:947e with SMTP id f10-20020a2e918a000000b002b9bd23947emr5224369ljg.27.1692635993915; Mon, 21 Aug 2023 09:39:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1692635993; cv=none; d=google.com; s=arc-20160816; b=cl6sJe8TsDmpU+481U2w0thzOMy+CeHETGTPaSFOh5hvH8trMtX8zZnc77yhQpt29r KV+yyAUcu0CXmAwUjA4cEhmNK+XyL8NmpZNp9HwtUTmLv6ZS1/A2Sdpc9RH+YZFxNA1d 5bjNHALczw8uoOSJ4yBtTAv9NH3MWZuoei/gFRU9TQ4mbcIIZGUaYvfv0fYPvaJ01o8o jFaCxzOI51xTOXvjAOh3nC8g2T8QudRzM8JEVBIn1YuPH9fo9p1KeuV/p2tfK05z6rGn V6fcEIopy6jiDtJN1lAOiKi1ZIdsuY5fwtwQ7KJUyVrQpi72QJu2wwV/omNWx1lBWYhW oZUw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:message-id:date:subject:cc:to:from:dkim-signature :dmarc-filter:delivered-to; bh=M1OwVLwTdAsjNj6caGH6ZnfC7lWS7Ylzp77IIXTbgkY=; fh=1VinZcuMCmEXG2bRzAooUy3y8MFG9zebG20+mRPh53U=; b=ocxF51A1yVMiQrf1kG4hbL69U1o4OVWFF+ZN2bv0pW5lAc/Pjfk1AgLIvHq2W8hhfY THlr8XQ3NzFdf2ROQLQTyPnWWgGz38/9dVe4HswtF0Umtb+Kf+WybkMbh1Bdendl1Vrv ckQPSfzZo/V03MT4CaPaT4XT7RDgQnhzU1M/TXX8ZyH203znUNOt5Q3lgnCJ/bbBN4Jo ENSflw04aDJnyR54B9Nh+gUpek8TCzObFhTxEg7BTmWey0tqQe/4zt0qfZCFxeAR8uyz D68d/mIQz+94c1V5pM4rjaA+1L0+U9ES9BBufxrAr7L1xu2POFRQGR3pFoC3zRqGLVYA 005Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@rivosinc-com.20221208.gappssmtp.com header.s=20221208 header.b=hGXlb8B5; 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 z1-20020a170906240100b00992e14a3655si5800726eja.354.2023.08.21.09.39.53 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 21 Aug 2023 09:39:53 -0700 (PDT) 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=@rivosinc-com.20221208.gappssmtp.com header.s=20221208 header.b=hGXlb8B5; 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 5682538555A1 for ; Mon, 21 Aug 2023 16:39:48 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-pl1-x62d.google.com (mail-pl1-x62d.google.com [IPv6:2607:f8b0:4864:20::62d]) by sourceware.org (Postfix) with ESMTPS id DC8BD3858C41 for ; Mon, 21 Aug 2023 16:39:23 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org DC8BD3858C41 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=rivosinc.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=rivosinc.com Received: by mail-pl1-x62d.google.com with SMTP id d9443c01a7336-1bc63ef9959so27487425ad.2 for ; Mon, 21 Aug 2023 09:39:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rivosinc-com.20221208.gappssmtp.com; s=20221208; t=1692635962; x=1693240762; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=M1OwVLwTdAsjNj6caGH6ZnfC7lWS7Ylzp77IIXTbgkY=; b=hGXlb8B5rGzCC5oXgmo39iEel/omcP73jOYHZ/UljphC2mpJAz1MxQvk8OBvJJm+cJ C7Heym4N+Vfs7f4fmQOUh7lMVqXpINV6dgw0g7zFLjjG1ij14pgw18iOfO48gwvspQ16 vrYpl4Kt+ozq/ptKkQNzhndnAsfQXvq28TG70SlRt9LG6oPisl9MLHTjQjwDz6dNbJA1 GvwnqAFr/nFyjjiBjLbLVVYjRYhO//UyB8lubwJPmJj8JRW27WElwSs1KiciDf4xVo7e /LmT4MRRXdKJ6l7Jpqc4XR0Uh9oADOU5Ccmdovo1I/AS6D+HcVsN7TP979sNR9btuCJi Yuxg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1692635962; x=1693240762; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=M1OwVLwTdAsjNj6caGH6ZnfC7lWS7Ylzp77IIXTbgkY=; b=cMfkQmIbdO5NTnIpO9k8T0ySN3E5CY2v50BG0ZltyO6CQ9rxu+QGQjzqY1vs++puVw rZ0816fLoLfufQfMDl/X0K2mDA8P8ojYJb32qjNw5TXyAcD7j080Yk5BGjeg6O1WEaEJ qfgrhoMqDbZ08bitDoUbAR10rJDC/IoK9gbY9FlT/pZ4px4kj2Nu5U9PK+ST1VL6/ZT+ JCOalyXTllOIr54XSYXBcuk+rxb9qbapJt9Z4FlYD1oyA3JzSGtkm0edA38hfPDFVND4 E3sAZ/YonwpcR5wwl5WPm4sTEPq8tjT0Ise66E+1SJma04LZPRc+P0BsD8QCea7k/Gc7 YUfw== X-Gm-Message-State: AOJu0Yzc7+Yt4lnvaQpV7CtW/Xz7lvwW0AyO+7Y0WtGsutrUqY7ZndBC ++jKtJHndSQX/wr9GRJsN2j46NO62tFanNasFRO+ew== X-Received: by 2002:a17:902:f80e:b0:1bc:9651:57c6 with SMTP id ix14-20020a170902f80e00b001bc965157c6mr6187040plb.57.1692635962493; Mon, 21 Aug 2023 09:39:22 -0700 (PDT) Received: from ewlu.ba.rivosinc.com ([66.220.2.162]) by smtp.gmail.com with ESMTPSA id j10-20020a170902da8a00b001a5fccab02dsm7250843plx.177.2023.08.21.09.39.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 21 Aug 2023 09:39:22 -0700 (PDT) From: Edwin Lu To: gcc-patches@gcc.gnu.org Cc: gnu-toolchain@rivosinc.com, Edwin Lu Subject: [PATCH] RISC-V: Add Types to Missing Bitmanip Instructions: Date: Mon, 21 Aug 2023 09:37:40 -0700 Message-ID: <20230821163852.988058-1-ewlu@rivosinc.com> X-Mailer: git-send-email 2.41.0 MIME-Version: 1.0 X-Spam-Status: No, score=-11.4 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP 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.29 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 Sender: "Gcc-patches" X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1774857479825526019 X-GMAIL-MSGID: 1774857479825526019 Related Discussion: https://inbox.sourceware.org/gcc-patches/12fb5088-3f28-0a69-de1e-f387371a5eb2@gmail.com/ This patch updates the bitmanip instructions to ensure that no insn is left without a type attribute. Updates a total of 8 insns to have type "bitmanip" Tested for regressions using rv32/64 multilib with newlib/linux. gcc/Changelog: * config/riscv/bitmanip.md: Added bitmanip type to insns that are missing types Signed-off-by: Edwin Lu --- gcc/config/riscv/bitmanip.md | 26 ++++++++++++++++++-------- 1 file changed, 18 insertions(+), 8 deletions(-) diff --git a/gcc/config/riscv/bitmanip.md b/gcc/config/riscv/bitmanip.md index c42e7b890db..0c99152ffc8 100644 --- a/gcc/config/riscv/bitmanip.md +++ b/gcc/config/riscv/bitmanip.md @@ -103,7 +103,8 @@ (define_insn_and_split "*andi_add.uw" (match_dup 4)))] { operands[3] = GEN_INT (INTVAL (operands[3]) >> INTVAL (operands[2])); -}) +} +[(set_attr "type" "bitmanip")]) (define_insn "*shNadduw" [(set (match_operand:DI 0 "register_operand" "=r") @@ -533,7 +534,9 @@ (define_insn_and_split "*minmax" "&& reload_completed" [(set (match_dup 3) (sign_extend:DI (match_dup 1))) (set (match_dup 4) (match_dup 2)) - (set (match_dup 0) (:DI (match_dup 3) (match_dup 4)))]) + (set (match_dup 0) (:DI (match_dup 3) (match_dup 4)))] + "" + [(set_attr "type" "bitmanip")]) ;; ZBS extension. @@ -628,7 +631,8 @@ (define_insn_and_split "*bclri_nottwobits" operands[3] = GEN_INT (~bits | topbit); operands[4] = GEN_INT (~topbit); -}) +} +[(set_attr "type" "bitmanip")]) ;; In case of a paradoxical subreg, the sign bit and the high bits are ;; not allowed to be changed @@ -648,7 +652,8 @@ (define_insn_and_split "*bclridisi_nottwobits" operands[3] = GEN_INT (~bits | topbit); operands[4] = GEN_INT (~topbit); -}) +} +[(set_attr "type" "bitmanip")]) (define_insn "*binv" [(set (match_operand:X 0 "register_operand" "=r") @@ -743,7 +748,8 @@ (define_insn_and_split "*i_extrabit" operands[3] = GEN_INT (bits &~ topbit); operands[4] = GEN_INT (topbit); -}) +} +[(set_attr "type" "bitmanip")]) ;; Same to use blcri + andi and blcri + bclri (define_insn_and_split "*andi_extrabit" @@ -761,7 +767,8 @@ (define_insn_and_split "*andi_extrabit" operands[3] = GEN_INT (bits | topbit); operands[4] = GEN_INT (~topbit); -}) +} +[(set_attr "type" "bitmanip")]) ;; IF_THEN_ELSE: test for 2 bits of opposite polarity (define_insn_and_split "*branch_mask_twobits_equals_singlebit" @@ -803,7 +810,8 @@ (define_insn_and_split "*branch_mask_twobits_equals_singlebit" operands[8] = GEN_INT (setbit); operands[9] = GEN_INT (clearbit); -}) +} +[(set_attr "type" "bitmanip")]) ;; IF_THEN_ELSE: test for (a & (1 << BIT_NO)) (define_insn_and_split "*branch_bext" @@ -826,7 +834,9 @@ (define_insn_and_split "*branch_bext" (zero_extend:X (match_dup 3)))) (set (pc) (if_then_else (match_op_dup 1 [(match_dup 4) (const_int 0)]) (label_ref (match_dup 0)) - (pc)))]) + (pc)))] + "" + [(set_attr "type" "bitmanip")]) ;; ZBKC or ZBC extension (define_insn "riscv_clmul_"