From patchwork Thu May 2 16:55:23 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 794118 Delivered-To: patch@linaro.org Received: by 2002:adf:a153:0:b0:34d:5089:5a9e with SMTP id r19csp353572wrr; Thu, 2 May 2024 09:56:29 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCU5tRwT4q397Xk+vDq2I2hV92Dl+B24ZlBhaN26ag9YGRMesZOWZfZwrvJkGt+xxKZPFUKGEyQoJgCNp2Et6K3Q X-Google-Smtp-Source: AGHT+IEiO8YxplDxmqFmGDMUPqXikBm8JxFvYXpMkV3f4ML8YS0LqVSVGLa98/BPBScZzbwUvILQ X-Received: by 2002:a05:620a:2042:b0:790:f2b2:ed2e with SMTP id d2-20020a05620a204200b00790f2b2ed2emr159049qka.64.1714668988856; Thu, 02 May 2024 09:56:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1714668988; cv=none; d=google.com; s=arc-20160816; b=hmNC3bZUVYCWUbTqHSkd/As1V63ZPq9459uhj/wmU267EJWWrEaXhRDbC/L1/AMF0a +HGpKPiStTGNI/TU4RPvLQ7v9pYypti7mOTmcv8f13x1N5TYXcqBZdFUqlDiJn+aquke FMaHYa1retdZWUe6Rd7+EwjYmyoQ7t6+UKuNK8hAsK348nqCbaMadlmyzF3BA1uhA2rR +SNxsGFpvYHjdkQm44UIXTH1K/GFPgpiyQDqFJnsk4mczMvI2VRCs6h119ao49++uF44 tQmsleZ5gb93EmohWNtAGEGy/5llcCpCQCfyIfjUsd680T7vJxJR8V3znv3Jc3HnHTvf 1RyQ== 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:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=8A5wkA/c/fe0SRhmGznAw+eONAU2pb4TUE7cdCXudPo=; fh=TYrED6TOMxGX0VC4GtjviASLbYyJe19+7/tKWjN44KQ=; b=vF3zkULFPsLUa2fgYR9zb+2eKTyD/4HOVpnS+hTUcj7z1wWm3blGQsD0iScNjTMlNV bdWBs7F+e9eDj6xkgLwEgUZm3tX/3ur2qnn4JjmyXDiKdHqjg3WqPzwOVU5X3G3eEKVT 0uB8VPUyzUQ5gDQsRLmgHuMnUlByC0FMRxWQUNB+ChjI4sEd7kldZ7V60Ez2f6h1ftIQ imuh6gb+PwaTiYaaWJhRi3NkRkbVgpAKX2WBS3pOTdqmjcu2B6U2R7oS5ZdAmp2vUvfz 1MmtMRq+hzoeQ7eiGXSQ9+9dY6Vky/7noXpTJAQEd1bQFKC5USA+Qo+sYrNl673iyawa QBBA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="v3+ZK/54"; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id wx7-20020a05620a5a4700b0078d5075fd8bsi1250363qkn.365.2024.05.02.09.56.28 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 02 May 2024 09:56:28 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="v3+ZK/54"; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1s2Zit-0001I7-Nn; Thu, 02 May 2024 12:55:55 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1s2Zic-0000vm-CV for qemu-devel@nongnu.org; Thu, 02 May 2024 12:55:43 -0400 Received: from mail-pf1-x42f.google.com ([2607:f8b0:4864:20::42f]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1s2ZiZ-0005vP-29 for qemu-devel@nongnu.org; Thu, 02 May 2024 12:55:38 -0400 Received: by mail-pf1-x42f.google.com with SMTP id d2e1a72fcca58-6f44390e328so498976b3a.2 for ; Thu, 02 May 2024 09:55:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1714668931; x=1715273731; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=8A5wkA/c/fe0SRhmGznAw+eONAU2pb4TUE7cdCXudPo=; b=v3+ZK/54YG6Jd5vJrBduSHUysIFBOk5xhJ/K+gchCqmbxsFOzxAnw296WazM72Qnkw pNhGYwFtj/fF/r+/O9IjHsKs6/3xsPqLdoye23Z0mzBORkP8hufaHu4S4UVu7y+DhRLl LLgXzRHQqY6cyZULTK6XZ6TdyFL7gWFIHzh92gmI0D1XgXworMOCB/U1OSYJKZDYTdd3 KyoVFJhzStyVlFV0Z+xEKC+JugUvAihaeilCrnCsH5u1tp7wxwnZ3JxXTQkyAf8pyHYz 8lNq5yZC62YqI0KHLE7gFeQ4aXsiOZ9wImHyLnN6KqwtXRRdEy0NEf2WTVDpGLAq/SuH 8cdA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714668931; x=1715273731; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=8A5wkA/c/fe0SRhmGznAw+eONAU2pb4TUE7cdCXudPo=; b=Gbnp+/bTiloy2aJF3wPLDIhZjhRF4KPojkwbsRylsByPBCfWEtcfCWc1wxyGa6p5IZ prZIWgXlV0+RXLgr9nnnd82seF/4jwaSDzuuMYDTQyfx42op5rFgMoRN8rjddB58Ak8I B4iSHQyAyxfkmclZOnOmvEBuyS9tL/gBSnEONZpkzrYqaeKeeg95oF5gzioy2JsAx+ol Ifdt2IpNTu7U2vuBO3anJl1LKr/xv0f3L4Frgue90hFmMUAgKFAVKsJuB9gFj9YFGrUo nGMDXmcKIrfuLe656pwV8Bv2Ou4v/d0q0ab6/6MP5n1+NEFikfYI6YLleHE7/04N1knD Uy6g== X-Gm-Message-State: AOJu0Yx5COxFPVhvrM2QpCXTU4KqHQyFT10o2JCrEV0+A00AMHtXP7yq 3DJElghrZYjhrwLph65bq++iOO0kbBXgWJaAhzuvWdJvGiTdXHZLi/GsVMdyHIG4eOvg0O5s40j s X-Received: by 2002:a05:6a00:9a5:b0:6ed:cd4c:cc1a with SMTP id u37-20020a056a0009a500b006edcd4ccc1amr134583pfg.8.1714668931460; Thu, 02 May 2024 09:55:31 -0700 (PDT) Received: from stoup.. (174-21-72-5.tukw.qwest.net. [174.21.72.5]) by smtp.gmail.com with ESMTPSA id j13-20020aa783cd000000b006eb058b2703sm1464598pfn.187.2024.05.02.09.55.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 02 May 2024 09:55:31 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: mark.cave-ayland@ilande.co.uk Subject: [PATCH v2 2/7] target/sparc: Fix FEXPAND Date: Thu, 2 May 2024 09:55:23 -0700 Message-Id: <20240502165528.244004-3-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240502165528.244004-1-richard.henderson@linaro.org> References: <20240502165528.244004-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::42f; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x42f.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org This is a 2-operand instruction, not 3-operand. Worse, we took the source from the wrong operand. Signed-off-by: Richard Henderson Reviewed-by: Philippe Mathieu-Daudé --- target/sparc/helper.h | 2 +- target/sparc/insns.decode | 2 +- target/sparc/translate.c | 20 +++++++++++++++++++- target/sparc/vis_helper.c | 6 +++--- 4 files changed, 24 insertions(+), 6 deletions(-) diff --git a/target/sparc/helper.h b/target/sparc/helper.h index b8087d0d2b..57ab755ffd 100644 --- a/target/sparc/helper.h +++ b/target/sparc/helper.h @@ -102,7 +102,7 @@ DEF_HELPER_FLAGS_2(fmul8sux16, TCG_CALL_NO_RWG_SE, i64, i64, i64) DEF_HELPER_FLAGS_2(fmul8ulx16, TCG_CALL_NO_RWG_SE, i64, i64, i64) DEF_HELPER_FLAGS_2(fmuld8sux16, TCG_CALL_NO_RWG_SE, i64, i64, i64) DEF_HELPER_FLAGS_2(fmuld8ulx16, TCG_CALL_NO_RWG_SE, i64, i64, i64) -DEF_HELPER_FLAGS_2(fexpand, TCG_CALL_NO_RWG_SE, i64, i64, i64) +DEF_HELPER_FLAGS_1(fexpand, TCG_CALL_NO_RWG_SE, i64, i32) DEF_HELPER_FLAGS_3(pdist, TCG_CALL_NO_RWG_SE, i64, i64, i64, i64) DEF_HELPER_FLAGS_2(fpack16, TCG_CALL_NO_RWG_SE, i32, i64, i64) DEF_HELPER_FLAGS_3(fpack32, TCG_CALL_NO_RWG_SE, i64, i64, i64, i64) diff --git a/target/sparc/insns.decode b/target/sparc/insns.decode index 2d26404cb2..e2d8a07dc4 100644 --- a/target/sparc/insns.decode +++ b/target/sparc/insns.decode @@ -352,7 +352,7 @@ FCMPEq 10 000 cc:2 110101 rs1:5 0 0101 0111 rs2:5 FALIGNDATAg 10 ..... 110110 ..... 0 0100 1000 ..... @r_r_r FPMERGE 10 ..... 110110 ..... 0 0100 1011 ..... @r_r_r BSHUFFLE 10 ..... 110110 ..... 0 0100 1100 ..... @r_r_r - FEXPAND 10 ..... 110110 ..... 0 0100 1101 ..... @r_r_r + FEXPAND 10 ..... 110110 00000 0 0100 1101 ..... @r_r2 FSRCd 10 ..... 110110 ..... 0 0111 0100 00000 @r_r1 # FSRC1d FSRCs 10 ..... 110110 ..... 0 0111 0101 00000 @r_r1 # FSRC1s diff --git a/target/sparc/translate.c b/target/sparc/translate.c index 571b3e3f03..dfcfe855a1 100644 --- a/target/sparc/translate.c +++ b/target/sparc/translate.c @@ -4358,6 +4358,25 @@ TRANS(FSQRTd, ALL, do_env_dd, a, gen_helper_fsqrtd) TRANS(FxTOd, 64, do_env_dd, a, gen_helper_fxtod) TRANS(FdTOx, 64, do_env_dd, a, gen_helper_fdtox) +static bool do_df(DisasContext *dc, arg_r_r *a, + void (*func)(TCGv_i64, TCGv_i32)) +{ + TCGv_i64 dst; + TCGv_i32 src; + + if (gen_trap_ifnofpu(dc)) { + return true; + } + + dst = tcg_temp_new_i64(); + src = gen_load_fpr_F(dc, a->rs); + func(dst, src); + gen_store_fpr_D(dc, a->rd, dst); + return advance_pc(dc); +} + +TRANS(FEXPAND, VIS1, do_df, a, gen_helper_fexpand) + static bool do_env_df(DisasContext *dc, arg_r_r *a, void (*func)(TCGv_i64, TCGv_env, TCGv_i32)) { @@ -4589,7 +4608,6 @@ TRANS(FMUL8ULx16, VIS1, do_ddd, a, gen_helper_fmul8ulx16) TRANS(FMULD8SUx16, VIS1, do_ddd, a, gen_helper_fmuld8sux16) TRANS(FMULD8ULx16, VIS1, do_ddd, a, gen_helper_fmuld8ulx16) TRANS(FPMERGE, VIS1, do_ddd, a, gen_helper_fpmerge) -TRANS(FEXPAND, VIS1, do_ddd, a, gen_helper_fexpand) TRANS(FPADD16, VIS1, do_ddd, a, tcg_gen_vec_add16_i64) TRANS(FPADD32, VIS1, do_ddd, a, tcg_gen_vec_add32_i64) diff --git a/target/sparc/vis_helper.c b/target/sparc/vis_helper.c index 7763b16c24..db2e6dd6c1 100644 --- a/target/sparc/vis_helper.c +++ b/target/sparc/vis_helper.c @@ -260,13 +260,13 @@ uint64_t helper_fmuld8ulx16(uint64_t src1, uint64_t src2) return d.ll; } -uint64_t helper_fexpand(uint64_t src1, uint64_t src2) +uint64_t helper_fexpand(uint32_t src2) { VIS32 s; VIS64 d; - s.l = (uint32_t)src1; - d.ll = src2; + s.l = src2; + d.ll = 0; d.VIS_W64(0) = s.VIS_B32(0) << 4; d.VIS_W64(1) = s.VIS_B32(1) << 4; d.VIS_W64(2) = s.VIS_B32(2) << 4;