From patchwork Sun May 26 19:20:03 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 799076 Delivered-To: patch@linaro.org Received: by 2002:a5d:6a47:0:b0:354:fb4b:99cd with SMTP id t7csp1591197wrw; Sun, 26 May 2024 12:20:19 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXts5BzcvIEqmvvmp3Ac6xGJhCqx3Xkniuy8Zmz0WizQFO/ldTBhlRFXROmatf7kInpn/pf07jRoyYG/xBKHf+b X-Google-Smtp-Source: AGHT+IFZET5YIMnbsnYF4HoADHdcTWn9xXLXCa9CMmDrqa4Xdzp7+SbubKiSww4BIWWrtbeVbexX X-Received: by 2002:a37:e30c:0:b0:793:82c:69a7 with SMTP id af79cd13be357-794ab0d40d6mr792938285a.42.1716751218703; Sun, 26 May 2024 12:20:18 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1716751218; cv=pass; d=google.com; s=arc-20160816; b=PT83I2rYBNIiceUcG2df36jyBRZoYvCFEsxL2yJiK5Qe6U4zeiTnzesQM5ZjAmuOyl UAd5rNybOpmo6ONJPIElcNYinwEq/wVuCXmOLqJVF5MRgdKNLfTlhDb2QC2kZhYR7rX4 Y1RXUPwNX3RgV2TSZ4MiU3eGf6DZSNy/uQUUFU2VNUKkbyKOnciPWWhcxVCO04vCAqjU 18VFVZF+UAGWIMt7w2fAXbrpSBVhWa90N26clB2n/oXYKzudbVF3AP/3a7T9ga+jLA7b 1CuxkfGxeDWuz7hKN0EEbvzkzve3zzfwmoqm3DR6aq6oHfkCfsPCGVStM6oybh8yHy1p TOAg== 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:to:from:dkim-signature :arc-filter:dmarc-filter:delivered-to; bh=QL6siFo3GQ9Slh0Pi9KrK/CxVR8bq2IcCpyuFha0mlI=; fh=NLxAvL/bDfPg4AGOtxqvQlND8vazkZrNzKLY8+LAbBY=; b=acK8VWdZm20WxjEwMlgD2DJe4w8S+EUM216JDIh2GkZ8DuveDr9jkkDFI99KUx83kK 21S+ph3MhoErSk9gqEyAdlTLVCvfbmcJyf5T6V8d5FQO1lYEqhXHpp1XsV1OL3dq/O5i 5YupFisrez5GOh951TjXFnR7e1/9Ncmvbf/SsHLf01bp0qAqteAcMFKa/j5hkiqucoqm k/p4vBEKi5VE2Qg+//zlth55ZeC0mMGXO/6kGYs7juyVz11nFh0jGegqdMAgpHCMZnko gGUMqxuR0PNLIG8UkrkqES99buVsg87UxuWWyTr671QTz1d/rENu/khcHM9s5OAKFmFw MBpQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=kaxIdhao; arc=pass (i=1); spf=pass (google.com: domain of binutils-bounces+patch=linaro.org@sourceware.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="binutils-bounces+patch=linaro.org@sourceware.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from server2.sourceware.org (server2.sourceware.org. [2620:52:3:1:0:246e:9693:128c]) by mx.google.com with ESMTPS id af79cd13be357-794abd3d7f1si621772585a.494.2024.05.26.12.20.18 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 26 May 2024 12:20:18 -0700 (PDT) Received-SPF: pass (google.com: domain of binutils-bounces+patch=linaro.org@sourceware.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=@linaro.org header.s=google header.b=kaxIdhao; arc=pass (i=1); spf=pass (google.com: domain of binutils-bounces+patch=linaro.org@sourceware.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="binutils-bounces+patch=linaro.org@sourceware.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 2B1B63858C32 for ; Sun, 26 May 2024 19:20:18 +0000 (GMT) X-Original-To: binutils@sourceware.org Delivered-To: binutils@sourceware.org Received: from mail-pf1-x435.google.com (mail-pf1-x435.google.com [IPv6:2607:f8b0:4864:20::435]) by sourceware.org (Postfix) with ESMTPS id 9C7FD3858D28 for ; Sun, 26 May 2024 19:20:06 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 9C7FD3858D28 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=linaro.org ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 9C7FD3858D28 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2607:f8b0:4864:20::435 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1716751208; cv=none; b=Em1F0jlvsz4DG3sEmTpR0e+T+EKDRvTtlR6eKHsIxlOY5jOju4ZkydhjUrMWGCwHJgrEUVmy3k8kw9+MICq8flJRs2Gachl8OGqKkYjHFNpqk3uwOZ4U3ermlQBFMLRXwr5sK+c7ZafynWe7xDTkWlKUZrFlokahCo6Oa/EhJhM= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1716751208; c=relaxed/simple; bh=nhcfNoFOlvCkakfwZ+qDMCsyVbMAnc40RfESOUT9uo0=; h=DKIM-Signature:From:To:Subject:Date:Message-Id:MIME-Version; b=JOcwLzI/qTXp0I064JnA7vAoVYYyPVA/Z21jZ3XaekjrqxM0BC407JMGNiNZwWoOl4uf5ykU/BKEPOzKkuiCIlonO3bDLkfm4HOUF6ACLIjjERpMFI/G+4QHjDjEMOz7webFNhVkG3DKUFUnjcqitKDhFX4LTkc+EOaGlZsyBGY= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-pf1-x435.google.com with SMTP id d2e1a72fcca58-6f8e819cf60so2215155b3a.0 for ; Sun, 26 May 2024 12:20:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1716751205; x=1717356005; darn=sourceware.org; h=content-transfer-encoding:mime-version:message-id:date:subject:to :from:from:to:cc:subject:date:message-id:reply-to; bh=QL6siFo3GQ9Slh0Pi9KrK/CxVR8bq2IcCpyuFha0mlI=; b=kaxIdhaorGUW+/stXcKBH8dF7fgyYlZwEd0MuQ7zCCndyqDjhwXa+jKmWOMmu47Vn1 fvIC90C6XTqj2XqDg7wjUhc2Jz7HYUhTjfQeizMTfZ2jabLEOIQEpjquWKYUXmwLf8hs bye9jGpFV3AUVErIUnfp7FOgRtmz1C8U/1aA4UUlFfQycCJyHU5mWx8sbEsWwXPqxMLv hwlMrWhWu15Cq03h227OOkeJxPavQLS5fIns1cJieK/B5CbLT/se1WYCl2Aysf2cj1XQ Q6ym1xHP/Vsg6/12UXXT1II5NMarKGr1vnXLOT53mhVaJQ5co1wB136PaK16O0Z7Oe38 pycg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1716751205; x=1717356005; h=content-transfer-encoding:mime-version:message-id:date:subject:to :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=QL6siFo3GQ9Slh0Pi9KrK/CxVR8bq2IcCpyuFha0mlI=; b=EIh8DM4qjP6jDzM3XRW7biVWP9j1PuO9uBjVkyYlwnB49rQ0qxTBwc6+Vxurk6tT0F HKnX2fBqTuuVlxGit2MV5J6DYIevZAvL1NNcRcbO1fdGeHL3cwM1wSbTm6xQc8m8qITH 7EuAh0APUWb3RDYwnne1eD8MIkQyYIipjXnKB/fB4Hqv02O4ez06fp2G4z76DcyyiMvG lThV6Z56YVVTq2KsV9t196XJQJFBu/K7jc4QOiYCOAW9lg7RuFN81lnV0WYJ/dELr6JY b0UA0zRbcNmn+rXfTu9MZpKj2UAkcqJkBKIouQNWRgdMA6sL6ag6LKflXHFf33ZVpMq3 Kf8w== X-Gm-Message-State: AOJu0Yyiif73nzzKJGzVg2okoBIJ6nIfsMDdIiouTS98LGMQTNIRt9Hl REpXSncPh3A+VjbXsGxhfQXo4+Kxh9NR0t2NOJRzT+gVBHKYKifcBTlHRcB4UQl/x5NH5ZzIWk5 h X-Received: by 2002:a05:6a00:9090:b0:6eb:3c2d:76e0 with SMTP id d2e1a72fcca58-6f8f2e7fb0fmr12064766b3a.11.1716751205472; Sun, 26 May 2024 12:20:05 -0700 (PDT) Received: from stoup.. (174-21-72-5.tukw.qwest.net. [174.21.72.5]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-6f8fbd3e5e0sm3887041b3a.12.2024.05.26.12.20.04 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 26 May 2024 12:20:04 -0700 (PDT) From: Richard Henderson To: binutils@sourceware.org Subject: [PATCH] sparc: Fix faligndatai assembly and disassembly Date: Sun, 26 May 2024 12:20:03 -0700 Message-Id: <20240526192003.458580-1-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 X-Spam-Status: No, score=-11.7 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, 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+patch=linaro.org@sourceware.org The first operand is a general register, not an fp register; the third operand is encoded into RS2, not RS3; the second operand must match the destination operand. Signed-off-by: Richard Henderson --- gas/config/tc-sparc.c | 17 +++++++++-------- opcodes/sparc-opc.c | 2 +- gas/testsuite/gas/sparc/sparc5vis4.d | 2 +- gas/testsuite/gas/sparc/sparc5vis4.s | 2 +- 4 files changed, 12 insertions(+), 11 deletions(-) diff --git a/gas/config/tc-sparc.c b/gas/config/tc-sparc.c index aca60e6c4f5..e37189e7c5e 100644 --- a/gas/config/tc-sparc.c +++ b/gas/config/tc-sparc.c @@ -2593,13 +2593,6 @@ sparc_ip (char *str, const struct sparc_opcode **pinsn) break; } /* if not an 'f' register. */ - if (*args == '}' && mask != RS2 (opcode)) - { - error_message - = _(": Instruction requires frs2 and frsd must be the same register"); - goto error; - } - switch (*args) { case 'v': @@ -2628,10 +2621,18 @@ sparc_ip (char *str, const struct sparc_opcode **pinsn) case 'g': case 'H': case 'J': - case '}': case '^': opcode |= RD (mask); continue; + + case '}': + if (RD (mask) != (opcode & RD (0x1f))) + { + error_message = _(": Instruction requires frs2 and " + "frsd must be the same register"); + goto error; + } + continue; } /* Pack it in. */ know (0); diff --git a/opcodes/sparc-opc.c b/opcodes/sparc-opc.c index fb7ebe38d46..19f7f62f1a3 100644 --- a/opcodes/sparc-opc.c +++ b/opcodes/sparc-opc.c @@ -2016,7 +2016,7 @@ SLCBCC("cbnefr", 15), { "alignaddr", F3F(2, 0x36, 0x018), F3F(~2, ~0x36, ~0x018), "1,2,d", 0, HWCAP_VIS, 0, v9a }, { "alignaddrl", F3F(2, 0x36, 0x01a), F3F(~2, ~0x36, ~0x01a), "1,2,d", 0, HWCAP_VIS, 0, v9a }, { "faligndata", F3F(2, 0x36, 0x048), F3F(~2, ~0x36, ~0x048), "v,B,H", 0, HWCAP_VIS, 0, v9a }, /* faligndatag */ -{ "faligndata", F3F(2, 0x36, 0x049), F3F(~2, ~0x36, ~0x049), "v,B,5,}", 0, 0, HWCAP2_SPARC5, v9m }, /* faligndatai */ +{ "faligndata", F3F(2, 0x36, 0x049), F3F(~2, ~0x36, ~0x049), "1,H,B,}", 0, 0, HWCAP2_SPARC5, v9m }, /* faligndatai */ { "fzerod", F3F(2, 0x36, 0x060), F3F(~2, ~0x36, ~0x060), "H", 0, HWCAP_VIS, 0, v9a }, { "fzero", F3F(2, 0x36, 0x060), F3F(~2, ~0x36, ~0x060), "H", F_ALIAS, HWCAP_VIS, 0, v9a }, diff --git a/gas/testsuite/gas/sparc/sparc5vis4.d b/gas/testsuite/gas/sparc/sparc5vis4.d index bf5c90bbcf3..7820c2a5672 100644 --- a/gas/testsuite/gas/sparc/sparc5vis4.d +++ b/gas/testsuite/gas/sparc/sparc5vis4.d @@ -35,4 +35,4 @@ Disassembly of section .text: 64: 95 b1 aa c8 fpsubs8 %f6, %f8, %f10 68: 9d b2 aa ec fpsubus8 %f10, %f12, %f14 6c: a5 b3 aa 70 fpsubus16 %f14, %f16, %f18 - 70: bf b0 09 3f faligndata %f0, %f62, %f4, %f62 + 70: bf b0 09 24 faligndata %g0, %f62, %f4, %f62 diff --git a/gas/testsuite/gas/sparc/sparc5vis4.s b/gas/testsuite/gas/sparc/sparc5vis4.s index 0a0155f3376..58ca2b5f368 100644 --- a/gas/testsuite/gas/sparc/sparc5vis4.s +++ b/gas/testsuite/gas/sparc/sparc5vis4.s @@ -28,4 +28,4 @@ fpsubs8 %f6, %f8, %f10 fpsubus8 %f10, %f12, %f14 fpsubus16 %f14, %f16, %f18 - faligndata %f0, %f62, %f4, %f62 + faligndata %g0, %f62, %f4, %f62