From patchwork Thu Aug 31 23:01:43 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Edwin Lu X-Patchwork-Id: 137361 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:c792:0:b0:3f2:4152:657d with SMTP id b18csp573425vqu; Thu, 31 Aug 2023 16:57:54 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHeEhvzNX0r+iUzu43SdkvHO2GGHmgVV1U3B3tF5kwjoXHssVDIpA38H1Fy+v1AZfpgFIPK X-Received: by 2002:a2e:b70d:0:b0:2bd:133c:58ff with SMTP id j13-20020a2eb70d000000b002bd133c58ffmr477858ljo.48.1693526274773; Thu, 31 Aug 2023 16:57:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1693526274; cv=none; d=google.com; s=arc-20160816; b=aA9m9dp6v+sSKnPIJbM5kKwE2B5hynRVSyyAwnA/2vbEK6G0dGUQMoB7zFsdcSNOAQ FPWCowM1o/3rgeNH+rJ28dL2TzwmuBJfJKEKCfgI4Q38T/hPe6Ku+VzpfejAP3eiN7s/ Epw1jjUfus1MGtr7ysgwQ8Arg5miVN1AmdM363QYcbJgqa6g/Q/ef2qNs7iKFbVYE63g tNvbWVPFuK3UX21OGb8ALjmQNXPXvppGjh6kiBZve58DznL/sFbd0V71f0MIkz0AmyqW hSYetc8qgTkaJdwS5ra7qN3kxARKj8VbdDyhCIZ93FPfrGjjN9bYcFyTR/Bo1VhcJinF XPPA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:message-id:date:subject:to:from:dkim-signature :dmarc-filter:delivered-to; bh=PeRgMG2kKlWIQSr9IhCH7gyoecvzVZ2kkGsdhitq0MA=; fh=FJbxQR/u5tD8wyenJM73SKFkIvrOVh63uwew/lx6xYE=; b=DRWvf3FnOpmL7vyOBk84InLS3Rrx3FAlCz+OdYKA97J2S7RDXjb7kmQ8uwx9bTIvaw urE6KomMCFGfkIWz/ylOJ3LKMLTDKc/aOo2Y26rjtWalfcNXra9d8Czl2oPPHoS23a6R 0XlIggSJcDpv5yQltyr7vdV8C0kTXojqn4rsNBwk+rCgvmxzGLfW4P5oWyyof2hv3wnq oG65GsjbrXmNy0giCWTwOQP53VW8PmCaqYJX3J3OVkS36zrnGBIRk3MaNP8vfs2lXWOo 0oQC/2f63h/5lJEnAXB6HGZWn/g++MLAeIXhDdKz3sactsdYHXHhkUBsJzng+JMc8fn5 kj7w== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@rivosinc-com.20230601.gappssmtp.com header.s=20230601 header.b="aif2/Cj0"; 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 gy21-20020a170906f25500b0099367afd642si1557818ejb.66.2023.08.31.16.57.54 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 31 Aug 2023 16:57:54 -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=fail header.i=@rivosinc-com.20230601.gappssmtp.com header.s=20230601 header.b="aif2/Cj0"; 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 3CB8C3858298 for ; Thu, 31 Aug 2023 23:57:50 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-pf1-x42d.google.com (mail-pf1-x42d.google.com [IPv6:2607:f8b0:4864:20::42d]) by sourceware.org (Postfix) with ESMTPS id 766843858D37 for ; Thu, 31 Aug 2023 23:57:22 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 766843858D37 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-pf1-x42d.google.com with SMTP id d2e1a72fcca58-68bedc0c268so1174121b3a.0 for ; Thu, 31 Aug 2023 16:57:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rivosinc-com.20230601.gappssmtp.com; s=20230601; t=1693526241; x=1694131041; darn=gcc.gnu.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=PeRgMG2kKlWIQSr9IhCH7gyoecvzVZ2kkGsdhitq0MA=; b=aif2/Cj0XJpY/0SQ9LPGNf4p0VeJ3nVE1oiw3fkH1cXt8rnHZQ0iXF/VZnIAKCCxI/ 1g+RoPwEKwHo/BUczfyYS8AqiYrQ5dn4tQ5QZ/WwRQ3S+TlFCZmL86r0ROjUm1R4fy6p 5pkNdyxLPQPSsxhmQowe+EqUZvU26jhyetxipq/LeBc4RTRp/9UkMR0905S8WNlBGIaC 24WPh7P2ftDEmBNDp5pNx991qtKuKRB5gS3gLWKpcgt4xKEoJuRNiTAzNisyXVnbqI5h bKVW5gqYKczbNWziSmCH844PKhO31AgyvQpaumAD1vVFdV2DKHnJg+lCXKoeePGs2Iu2 sldw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1693526241; x=1694131041; 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=PeRgMG2kKlWIQSr9IhCH7gyoecvzVZ2kkGsdhitq0MA=; b=aQTf2cfXpTVuJQZHRNkGClZdTYbIUhwmwJpJnHYim3SUqAFuLbk35pfvWF3I9IywQl vkvINlCfO6tdfdRQpQ/aN/ovgMQFDUzHPnTzNelsxi9Cuy/mAxPYWbsP6doAt0Ru1oB8 zM2AJ/MnfGt72UJHZZVUqVq7kj2jJyy6EOmkPHC3ytQ3UOn/2TLzkE6KOALTRsG5Eu4Z QPXx7vXJWRDxE6fOaQRqkLUDXbHQH4RzSAWxLyC1cimjm3nDs78AvVSVQOhXZiV/nQhc tbfn4Rb+Ykd6se/DbfWtM1M0DG4FSSrUiYfz9AGi8thWgcgbpvSiiKY6vvVklUn+71Zl V5ig== X-Gm-Message-State: AOJu0Yx8wg9x8sWwA6IwGyekEg6pIuRmFmd+Is7Arwk1tPQHPx4YHVbs qpQKWTGSLFaNEeAE1B/GxgfJS5QbaykBLfnkNeg= X-Received: by 2002:a05:6a00:2383:b0:68c:3f2:6000 with SMTP id f3-20020a056a00238300b0068c03f26000mr1388367pfc.6.1693526241105; Thu, 31 Aug 2023 16:57:21 -0700 (PDT) Received: from ewlu.ba.rivosinc.com ([66.220.2.162]) by smtp.gmail.com with ESMTPSA id x3-20020aa784c3000000b00687fcb2ba7csm1789879pfn.103.2023.08.31.16.57.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 31 Aug 2023 16:57:20 -0700 (PDT) From: Edwin Lu To: gcc-patches@gcc.gnu.org Subject: [PATCH] Add Types to Un-Typed Pic Instructions: Date: Thu, 31 Aug 2023 16:01:43 -0700 Message-ID: <20230831235713.1673863-1-ewlu@rivosinc.com> X-Mailer: git-send-email 2.41.0 MIME-Version: 1.0 X-Spam-Status: No, score=-13.7 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.30 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: gnu-toolchain@rivosinc.com Errors-To: gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org Sender: "Gcc-patches" X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1775791006877047687 X-GMAIL-MSGID: 1775791006877047687 Related Discussion: https://inbox.sourceware.org/gcc-patches/12fb5088-3f28-0a69-de1e-f387371a5eb2@gmail.com/ This patch updates the pic instructions to ensure that no insn is left without a type attribute. Tested for regressions using rv32/64 multilib with newlib/linux. gcc/Changelog: * config/riscv/pic.md: Update types Signed-off-by: Edwin Lu --- gcc/config/riscv/pic.md | 30 ++++++++++++++++++++---------- 1 file changed, 20 insertions(+), 10 deletions(-) diff --git a/gcc/config/riscv/pic.md b/gcc/config/riscv/pic.md index da636e31619..cfaa670caf0 100644 --- a/gcc/config/riscv/pic.md +++ b/gcc/config/riscv/pic.md @@ -27,21 +27,24 @@ (define_insn "*local_pic_load" (mem:ANYI (match_operand 1 "absolute_symbolic_operand" "")))] "USE_LOAD_ADDRESS_MACRO (operands[1])" "\t%0,%1" - [(set (attr "length") (const_int 8))]) + [(set_attr "type" "load") + (set (attr "length") (const_int 8))]) (define_insn "*local_pic_load_s" [(set (match_operand:SUPERQI 0 "register_operand" "=r") (sign_extend:SUPERQI (mem:SUBX (match_operand 1 "absolute_symbolic_operand" ""))))] "USE_LOAD_ADDRESS_MACRO (operands[1])" "\t%0,%1" - [(set (attr "length") (const_int 8))]) + [(set_attr "type" "load") + (set (attr "length") (const_int 8))]) (define_insn "*local_pic_load_u" [(set (match_operand:SUPERQI 0 "register_operand" "=r") (zero_extend:SUPERQI (mem:SUBX (match_operand 1 "absolute_symbolic_operand" ""))))] "USE_LOAD_ADDRESS_MACRO (operands[1])" "u\t%0,%1" - [(set (attr "length") (const_int 8))]) + [(set_attr "type" "load") + (set (attr "length") (const_int 8))]) ;; We can support ANYLSF loads into X register if there is no double support ;; or if the target is 64-bit. @@ -55,7 +58,8 @@ (define_insn "*local_pic_load" "@ \t%0,%1,%2 \t%0,%1" - [(set (attr "length") (const_int 8))]) + [(set_attr "type" "fpload") + (set (attr "length") (const_int 8))]) ;; ??? For a 32-bit target with double float, a DF load into a X reg isn't ;; supported. ld is not valid in that case. Punt for now. Maybe add a split @@ -68,14 +72,16 @@ (define_insn "*local_pic_load_32d" "TARGET_HARD_FLOAT && USE_LOAD_ADDRESS_MACRO (operands[1]) && (TARGET_DOUBLE_FLOAT && !TARGET_64BIT)" "\t%0,%1,%2" - [(set (attr "length") (const_int 8))]) + [(set_attr "type" "fpload") + (set (attr "length") (const_int 8))]) (define_insn "*local_pic_load_sf" [(set (match_operand:SOFTF 0 "register_operand" "=r") (mem:SOFTF (match_operand 1 "absolute_symbolic_operand" "")))] "!TARGET_HARD_FLOAT && USE_LOAD_ADDRESS_MACRO (operands[1])" "\t%0,%1" - [(set (attr "length") (const_int 8))]) + [(set_attr "type" "fpload") + (set (attr "length") (const_int 8))]) ;; Simplify PIC stores to static variables. ;; These should go away once we figure out how to emit auipc discretely. @@ -86,7 +92,8 @@ (define_insn "*local_pic_store" (clobber (match_scratch:P 2 "=&r"))] "USE_LOAD_ADDRESS_MACRO (operands[0])" "\t%z1,%0,%2" - [(set (attr "length") (const_int 8))]) + [(set_attr "type" "store") + (set (attr "length") (const_int 8))]) (define_insn "*local_pic_store" [(set (mem:ANYLSF (match_operand 0 "absolute_symbolic_operand" "")) @@ -97,7 +104,8 @@ (define_insn "*local_pic_store" "@ \t%1,%0,%2 \t%1,%0,%2" - [(set (attr "length") (const_int 8))]) + [(set_attr "type" "fpstore") + (set (attr "length") (const_int 8))]) ;; ??? For a 32-bit target with double float, a DF store from a X reg isn't ;; supported. sd is not valid in that case. Punt for now. Maybe add a split @@ -110,7 +118,8 @@ (define_insn "*local_pic_store_32d" "TARGET_HARD_FLOAT && USE_LOAD_ADDRESS_MACRO (operands[1]) && (TARGET_DOUBLE_FLOAT && !TARGET_64BIT)" "\t%1,%0,%2" - [(set (attr "length") (const_int 8))]) + [(set_attr "type" "fpstore") + (set (attr "length") (const_int 8))]) (define_insn "*local_pic_store_sf" [(set (mem:SOFTF (match_operand 0 "absolute_symbolic_operand" "")) @@ -118,4 +127,5 @@ (define_insn "*local_pic_store_sf" (clobber (match_scratch:P 2 "=&r"))] "!TARGET_HARD_FLOAT && USE_LOAD_ADDRESS_MACRO (operands[0])" "\t%1,%0,%2" - [(set (attr "length") (const_int 8))]) + [(set_attr "type" "fpstore") + (set (attr "length") (const_int 8))])