From patchwork Thu Feb 29 11:40:45 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lulu Cai X-Patchwork-Id: 208316 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:2097:b0:108:e6aa:91d0 with SMTP id gs23csp331431dyb; Thu, 29 Feb 2024 03:41:01 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCXukOlbXf8ECCnn7dyopT03vg+a6KPvT1gOj40A0CthJ4Z9qtwuROIeolIgbH/j3ydFUZ+AwamghHFI23+/JFbtlo9d1A== X-Google-Smtp-Source: AGHT+IEcgPxqI8k6ENJl1TuRbj/sSmScLrVSnMrI9NNq2IEAtjF21cdv7qBqly+QB3igkZqRSOMr X-Received: by 2002:ae9:e90c:0:b0:787:a853:607e with SMTP id x12-20020ae9e90c000000b00787a853607emr1492444qkf.58.1709206861152; Thu, 29 Feb 2024 03:41:01 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709206861; cv=pass; d=google.com; s=arc-20160816; b=Ei7ZvvSfhvQJh49VrgsnBIPE3HsJSUn8isJTXNVRkRMvNo1mt6eqTsR6XHGpdEMGKK iM+6Yqkiv1KYWGCwF4nau8MtGVoXypJlxm4WWe95MeCuWasFB08KNy5uLutKB9Kyl6CU bftcFlEkH7CKyIK4Eri49NE/jT21w0KqDnhIsbspJxHkzoAvLZySenc+k9tD7SEx95g3 CjGlwhGxTZ7VyMqqh4gFZ5ty7eORZ3jj5apxLKzXdZ2HFY3OlVVNFwjp4Ud2uU9XI8eF Jfr3x9GFHQI4dImPUFCGBBeLVi3q7X2zpgt38d7wEh+VQfMdkFo4NnUuQzKEYOZuOWky mmVQ== 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:content-transfer-encoding :mime-version:message-id:date:subject:cc:to:from:arc-filter :dmarc-filter:delivered-to; bh=PN8UcoxJYNRfya/5XvuOijMIP9BJYfiZaOdubfxjhYM=; fh=FvlVQEmCpm5H8oBXQswexzCupeeQXnbssobXN+3R2Wg=; b=Ygie4gBNN4Lw7xy9HiRkgPIReNJNVTZ1L7KSVUi8XD6UofNUdHu3/b5ypdSjr1GUxH ynPr1gPFv5rhjA1xjjBbJUKQWdyD0pE5/Nkltay8q5CMHEocOd3dlPQ+JRpkfAD+Glgr nCy8iOPLD3dymCDFJOcc4ozQvkk/+M/I4fpGpvT4leeCAGvrTaFQfbma9x6ozjGcGmgd j0lNLSxFKYlJbaC5fObyJ9gD+cY8RSuHF0ArRJzMS2KF5zVPkPwtCAV4iwMPwsiyj3Y7 AQRFnxBL+bCslwsRoofi3UA2GVSrLmZDIpk/ZTgN7w/65n8OJLJ18kLRN3zUUS6hfjzY SrQQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1); spf=pass (google.com: domain of binutils-bounces+ouuuleilei=gmail.com@sourceware.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="binutils-bounces+ouuuleilei=gmail.com@sourceware.org" Received: from server2.sourceware.org (server2.sourceware.org. [8.43.85.97]) by mx.google.com with ESMTPS id ya18-20020a05620a5e5200b00787a032905csi1184053qkn.524.2024.02.29.03.41.01 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 29 Feb 2024 03:41:01 -0800 (PST) Received-SPF: pass (google.com: domain of binutils-bounces+ouuuleilei=gmail.com@sourceware.org designates 8.43.85.97 as permitted sender) client-ip=8.43.85.97; Authentication-Results: mx.google.com; arc=pass (i=1); spf=pass (google.com: domain of binutils-bounces+ouuuleilei=gmail.com@sourceware.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="binutils-bounces+ouuuleilei=gmail.com@sourceware.org" Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id BEEAA385840C for ; Thu, 29 Feb 2024 11:41:00 +0000 (GMT) X-Original-To: binutils@sourceware.org Delivered-To: binutils@sourceware.org Received: from mail.loongson.cn (mail.loongson.cn [114.242.206.163]) by sourceware.org (Postfix) with ESMTP id 57C6F3858C52 for ; Thu, 29 Feb 2024 11:40:49 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 57C6F3858C52 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=loongson.cn Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=loongson.cn ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 57C6F3858C52 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=114.242.206.163 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1709206852; cv=none; b=mGvFj0bI5SiZ3afre4WhTeqxp/MMnIcuHQh1BBY6BjNp/ZYDCS5cu4ex2b/LYG33THKwh6XoQ1aGnvtyFw+k0ekvWg1dqw8ZcnloNeEth4JRLEOj0FgF5KgQwbKLBpSjARAHkZxbO85V/gX8d74MAmUD+KYEtypidirwJJ7ghV4= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1709206852; c=relaxed/simple; bh=1e2l1TwX2HLha2BSaL1HquKgO9+R2StGlUs41O1HaUg=; h=From:To:Subject:Date:Message-Id:MIME-Version; b=ouux3dD3n7aqomRpA10ms9fTeGKq/ckUNEfPTqVj2cZDQgoR7Fir6lC/VSJ2gXXvXvEi8ZQF+T2fe0zp5UZs9RLT2TzxQ1hrzOk3T1bG2P964eYJY7dCtXLrgxNPrqFLXXl/fh4NiXH410Ce40zbUGMFg5IyUKvIhiBg6QQWNoA= ARC-Authentication-Results: i=1; server2.sourceware.org Received: from loongson.cn (unknown [10.2.6.5]) by gateway (Coremail) with SMTP id _____8CxifA_beBl_eESAA--.48372S3; Thu, 29 Feb 2024 19:40:47 +0800 (CST) Received: from 5.5.5 (unknown [10.2.6.5]) by localhost.localdomain (Coremail) with SMTP id AQAAf8AxDBM_beBlVr1KAA--.2623S4; Thu, 29 Feb 2024 19:40:47 +0800 (CST) From: Lulu Cai To: binutils@sourceware.org Cc: xuchenghua@loongson.cn, chenglulu@loongson.cn, liuzhensong@loongson.cn, mengqinggang@loongson.cn, xry111@xry111.site, i.swmail@xen0n.name, maskray@google.com, luweining@loongson.cn, wanglei@loongson.cn, hejinyang@loongson.cn, Lulu Cai Subject: [PATCH v1] LoongArch: gcsrxchg cannot use r0 and r1 as rj registers Date: Thu, 29 Feb 2024 19:40:45 +0800 Message-Id: <20240229114045.1407397-1-cailulu@loongson.cn> X-Mailer: git-send-email 2.39.3 MIME-Version: 1.0 X-CM-TRANSID: AQAAf8AxDBM_beBlVr1KAA--.2623S4 X-CM-SenderInfo: xfdlz3tox6z05rqj20fqof0/1tbiAQACB2XgQGUDRQAKso X-Coremail-Antispam: 1Uk129KBj93XoWxCFy8GF4Uuw4kJrWkXFy3WrX_yoW5uw1rpF yUuF10krZ7GF1qka1DK3y5Xwn7t3yIkFWa9FyftFWI9r1xXry8u34kJryDZFWDX3yDKa1S vr4rAw1rZFn8JagCm3ZEXasCq-sJn29KB7ZKAUJUUUUr529EdanIXcx71UUUUU7KY7ZEXa sCq-sGcSsGvfJ3Ic02F40EFcxC0VAKzVAqx4xG6I80ebIjqfuFe4nvWSU5nxnvy29KBjDU 0xBIdaVrnRJUUU9Yb4IE77IF4wAFF20E14v26r1j6r4UM7CY07I20VC2zVCF04k26cxKx2 IYs7xG6rWj6s0DM7CIcVAFz4kK6r1Y6r17M28lY4IEw2IIxxk0rwA2F7IY1VAKz4vEj48v e4kI8wA2z4x0Y4vE2Ix0cI8IcVAFwI0_JFI_Gr1l84ACjcxK6xIIjxv20xvEc7CjxVAFwI 0_Jr0_Gr1l84ACjcxK6I8E87Iv67AKxVW8Jr0_Cr1UM28EF7xvwVC2z280aVCY1x0267AK xVW8Jr0_Cr1UM2kKe7AKxVWUXVWUAwAS0I0E0xvYzxvE52x082IY62kv0487Mc804VCY07 AIYIkI8VC2zVCFFI0UMc02F40EFcxC0VAKzVAqx4xG6I80ewAv7VC0I7IYx2IY67AKxVWU AVWUtwAv7VC2z280aVAFwI0_Gr0_Cr1lOx8S6xCaFVCjc4AY6r1j6r4UM4x0Y48IcxkI7V AKI48JMxAIw28IcxkI7VAKI48JMxC20s026xCaFVCjc4AY6r1j6r4UMxCIbckI1I0E14v2 6r1Y6r17MI8I3I0E5I8CrVAFwI0_Jr0_Jr4lx2IqxVCjr7xvwVAFwI0_JrI_JrWlx4CE17 CEb7AF67AKxVWUtVW8ZwCIc40Y0x0EwIxGrwCI42IY6xIIjxv20xvE14v26r1j6r1xMIIF 0xvE2Ix0cI8IcVCY1x0267AKxVWUJVW8JwCI42IY6xAIw20EY4v20xvaj40_Jr0_JF4lIx AIcVC2z280aVAFwI0_Jr0_Gr1lIxAIcVC2z280aVCY1x0267AKxVWUJVW8JbIYCTnIWIev Ja73UjIFyTuYvjxU466zUUUUU X-Spam-Status: No, score=-13.1 required=5.0 tests=BAYES_00, GIT_PATCH_0, KAM_DMARC_STATUS, 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: binutils@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Binutils mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: binutils-bounces+ouuuleilei=gmail.com@sourceware.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1792233293411791967 X-GMAIL-MSGID: 1792233293411791967 --- gas/config/tc-loongarch.c | 5 +++-- gas/testsuite/gas/loongarch/check_gcsrxchg_regs.d | 3 +++ gas/testsuite/gas/loongarch/check_gcsrxchg_regs.l | 2 ++ gas/testsuite/gas/loongarch/check_gcsrxchg_regs.s | 1 + gas/testsuite/gas/loongarch/lvz-lbt.d | 2 +- gas/testsuite/gas/loongarch/lvz-lbt.s | 2 +- 6 files changed, 11 insertions(+), 4 deletions(-) create mode 100644 gas/testsuite/gas/loongarch/check_gcsrxchg_regs.d create mode 100644 gas/testsuite/gas/loongarch/check_gcsrxchg_regs.l create mode 100644 gas/testsuite/gas/loongarch/check_gcsrxchg_regs.s diff --git a/gas/config/tc-loongarch.c b/gas/config/tc-loongarch.c index de92366eda4..3a661e76967 100644 --- a/gas/config/tc-loongarch.c +++ b/gas/config/tc-loongarch.c @@ -962,8 +962,9 @@ check_this_insn_before_appending (struct loongarch_cl_insn *ip) } else if (ip->insn->mask != 0 && (ip->insn_bin & 0xfe0003c0) == 0x04000000 /* csrxchg rd, rj, csr_num */ - && (strcmp ("csrxchg", ip->name) == 0)) - as_fatal (_("csrxchg require rj != $r0 && rj != $r1")); + && (strcmp ("csrxchg", ip->name) == 0 + || strcmp ("gcsrxchg", ip->name) == 0)) + as_fatal (_("g?csrxchg require rj != $r0 && rj != $r1")); return ret; } diff --git a/gas/testsuite/gas/loongarch/check_gcsrxchg_regs.d b/gas/testsuite/gas/loongarch/check_gcsrxchg_regs.d new file mode 100644 index 00000000000..f8ff34e2473 --- /dev/null +++ b/gas/testsuite/gas/loongarch/check_gcsrxchg_regs.d @@ -0,0 +1,3 @@ +#as: +#source: check_gcsrxchg_regs.s +#error_output: check_gcsrxchg_regs.l diff --git a/gas/testsuite/gas/loongarch/check_gcsrxchg_regs.l b/gas/testsuite/gas/loongarch/check_gcsrxchg_regs.l new file mode 100644 index 00000000000..54cbdaf657b --- /dev/null +++ b/gas/testsuite/gas/loongarch/check_gcsrxchg_regs.l @@ -0,0 +1,2 @@ +.*: Assembler messages: +.*error: g\?csrxchg require rj != \$r0 && rj != \$r1 diff --git a/gas/testsuite/gas/loongarch/check_gcsrxchg_regs.s b/gas/testsuite/gas/loongarch/check_gcsrxchg_regs.s new file mode 100644 index 00000000000..acc2f51fbc3 --- /dev/null +++ b/gas/testsuite/gas/loongarch/check_gcsrxchg_regs.s @@ -0,0 +1 @@ +gcsrxchg $r0, $r1, 1 diff --git a/gas/testsuite/gas/loongarch/lvz-lbt.d b/gas/testsuite/gas/loongarch/lvz-lbt.d index f89707762dc..557f3ac1a6d 100644 --- a/gas/testsuite/gas/loongarch/lvz-lbt.d +++ b/gas/testsuite/gas/loongarch/lvz-lbt.d @@ -10,7 +10,7 @@ Disassembly of section .text: 00000000.* <.text>: [ ]*0:[ ]*05000400[ ]*gcsrrd[ ]*\$zero,[ ]*0x1[ ]* [ ]*4:[ ]*05000420[ ]*gcsrwr[ ]*\$zero,[ ]*0x1[ ]* -[ ]*8:[ ]*05000420[ ]*gcsrwr[ ]*\$zero,[ ]*0x1[ ]* +[ ]*8:[ ]*05000483[ ]*gcsrxchg[ ]*\$sp, \$a0, 0x1 [ ]*c:[ ]*06482401[ ]*gtlbflush[ ]* [ ]*10:[ ]*002b8001[ ]*hvcl[ ]*0x1[ ]* [ ]*14:[ ]*00000820[ ]*movgr2scr[ ]*\$scr0,[ ]*\$ra[ ]* diff --git a/gas/testsuite/gas/loongarch/lvz-lbt.s b/gas/testsuite/gas/loongarch/lvz-lbt.s index 64469a4362d..850f77ff3a7 100644 --- a/gas/testsuite/gas/loongarch/lvz-lbt.s +++ b/gas/testsuite/gas/loongarch/lvz-lbt.s @@ -1,6 +1,6 @@ gcsrrd $r0, 1 gcsrwr $r0, 1 -gcsrxchg $r0, $r1, 1 +gcsrxchg $r3, $r4, 1 gtlbflush hvcl 1 movgr2scr $scr0, $r1