From patchwork Thu Jun 20 05:09:20 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: YunQiang Su X-Patchwork-Id: 1949929 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.a=rsa-sha256 header.s=default header.b=BYiOsEHF; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=8.43.85.97; helo=server2.sourceware.org; envelope-from=gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=patchwork.ozlabs.org) Received: from server2.sourceware.org (server2.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4W4T7p0qgPz20X6 for ; Thu, 20 Jun 2024 15:09:57 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id DD3483888C46 for ; Thu, 20 Jun 2024 05:09:55 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org DD3483888C46 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1718860195; bh=WanDGOnSiIN26A9Py25CC9bD2f7c6/8WnFayYPv6HTc=; h=From:To:Cc:Subject:Date:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:List-Subscribe:From; b=BYiOsEHFVCetXyj7wPcpja2UsrewmqrId3/5lJNwXl+5pt7+cPvkcVdMJWk9lKIaQ 1q3PXmSpIRsujt7yLpfd5o1WfI/Kl8UAvBBpMVmXvgRmuspIhC6riaZp+Ptef9keMG S1JMz00L5O5z/y7h11VuChwjooSmfjqfv14SaW68= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-pf1-f180.google.com (mail-pf1-f180.google.com [209.85.210.180]) by sourceware.org (Postfix) with ESMTPS id EDD453858C41; Thu, 20 Jun 2024 05:09:28 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org EDD453858C41 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=gcc.gnu.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org EDD453858C41 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=209.85.210.180 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1718860170; cv=none; b=kAPL6AFMdm5OIrlfZjvXa+E/hg5uDnDA5eDpcVwy5iMIuueG7uEXlgC3kyuQ4b91caBK4Kg0rtWhYEkUVeKiuCgTrKMJM0TIVR/VMPo9YDF/0tpvhFhNrtnCQIBxZu2vYcdJS/tgSQpbj0hRY+5Yf0gU5Sv8Bzx7XJuneGWnY+c= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1718860170; c=relaxed/simple; bh=mFeIjwUgkBYOTNznfe7ivKLuxNu4XDlTNFSm82BrRsw=; h=From:To:Subject:Date:Message-Id:MIME-Version; b=Zg5er3dH8ROkmKHdKN1yDQuy2j2O1LowuflXbcMH7wUMozu9T1onTU7wqbmNqeuL71L6bSum9tkN1s5tp4fWxgRSyM38N98sr6OyZZ5fl+mmmEjfYTz5oAN+FALnuRMdeLl6UO/4oEAmB1x5xUxxnWLDofXm0reNfozwiQWlgv4= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-pf1-f180.google.com with SMTP id d2e1a72fcca58-7041ed475acso513288b3a.2; Wed, 19 Jun 2024 22:09:28 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1718860168; x=1719464968; 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=WanDGOnSiIN26A9Py25CC9bD2f7c6/8WnFayYPv6HTc=; b=T4/YYW+//+GVDGtWslHRXcVEld9uhufGEmFAJxibJ1ejzKVN0x+jpQmWU9tVQ2fzA1 JcsZyaLbfxVDgrKjdvzQpUeMkEUbvNhSQo6g+QU3Va4fziMr4iL/Zy4+XM2e4fZfjVr/ KD6DluI8Jn4TBQzU39xIQ9Y0jCkbfDVR8wxzXbiKA4dsU0zrLlDFliFRIGHPEzBWM39J oAr/fG+KZyLjfjCABJdcP4N/kYUud3GLskQ8lT1LoiHLDQjrLEDQhNHY5mTg8xVPg4sF uvumjCV8PFSwy/VCp/jS9XdbVrbTVNfJxfQGi5lbh+15TlxmCmMUvwalnCaJimzGY5uX vnHw== X-Forwarded-Encrypted: i=1; AJvYcCWAVacbhL0F7DDQfRIgBUUUOw4b6iyZHG25mjXw2PtX2oOtRGIJh2mJZXmELsvOua6BEvlB2udaA+CyzKwtw6c= X-Gm-Message-State: AOJu0Yy713bt+tqeOau7Y8dnsnMlyPrfjQs6M+DkF1+dYd1+u0cF7Xzi WtUL1IL+KEzqbc9rV+hJooXoseidKko8RDNDBgRl2C7Wzx4hJRgBym9cyYyl X-Google-Smtp-Source: AGHT+IEYQE9M69M0AApQX0MLQZe7pupTwyTuH0jAj/wMupE/1Srex+IbZNH3+mVmEhFdl3Uxbd3dVg== X-Received: by 2002:a05:6a00:1493:b0:704:32dc:c4e4 with SMTP id d2e1a72fcca58-7063675708bmr3324872b3a.1.1718860167569; Wed, 19 Jun 2024 22:09:27 -0700 (PDT) Received: from localhost.localdomain ([194.169.55.179]) by smtp.gmail.com with ESMTPSA id 41be03b00d2f7-6fede16a532sm8934973a12.20.2024.06.19.22.09.26 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Wed, 19 Jun 2024 22:09:27 -0700 (PDT) From: YunQiang Su To: gcc-patches@gcc.gnu.org Cc: macro@orcam.me.uk, YunQiang Su Subject: [PATCH v2] MIPS: Output $0 for conditional trap if !ISA_HAS_COND_TRAPI Date: Thu, 20 Jun 2024 13:09:20 +0800 Message-Id: <20240620050920.23333-1-syq@gcc.gnu.org> X-Mailer: git-send-email 2.39.3 (Apple Git-146) MIME-Version: 1.0 X-Spam-Status: No, score=-11.3 required=5.0 tests=BAYES_00, FREEMAIL_FORGED_FROMDOMAIN, FREEMAIL_FROM, GIT_PATCH_0, HEADER_FROM_DIFFERENT_DOMAINS, KAM_DMARC_STATUS, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE 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: , Errors-To: gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org MIPSr6 removes condition trap instructions with imm, so the instruction like `teq $2,imm` will be converted to li $at, imm teq $2, $at The current version of Gas cannot detect if imm is zero, and output teq $2, $0 Let's do it in GCC. gcc * config/mips/mips.md(conditional_trap_reg): Output $0 instead of 0 if !ISA_HAS_COND_TRAPI. --- gcc/config/mips/mips.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/config/mips/mips.md b/gcc/config/mips/mips.md index 9962313602a..fd64d3d001a 100644 --- a/gcc/config/mips/mips.md +++ b/gcc/config/mips/mips.md @@ -1245,7 +1245,7 @@ (define_insn "*conditional_trap_reg" (match_operand:GPR 2 "reg_or_0_operand" "dJ")]) (const_int 0))] "ISA_HAS_COND_TRAP && !ISA_HAS_COND_TRAPI" - "t%C0\t%z1,%2" + "t%C0\t%z1,%z2" [(set_attr "type" "trap")]) (define_insn "*conditional_trap"