From patchwork Sun Oct 22 23:29:31 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 737223 Delivered-To: patch@linaro.org Received: by 2002:adf:dd81:0:b0:32d:baff:b0ca with SMTP id x1csp1284733wrl; Sun, 22 Oct 2023 16:41:54 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHcw4uA+piy/awqskf3rk2E3rWwrz78wTuDNCEGXCFyiCP196mjIuqi819IxOZ6SpfaRY3E X-Received: by 2002:a05:622a:9:b0:41e:2037:72b6 with SMTP id x9-20020a05622a000900b0041e203772b6mr976316qtw.40.1698018114624; Sun, 22 Oct 2023 16:41:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698018114; cv=none; d=google.com; s=arc-20160816; b=B57/Jex7328b4geBfxRtKTkpTV5vdQjdqcV9k0EGiGxigLBAhcjuk/hS4HwoL+ryZ8 Sn1gPJFD+WDUnSV/bJt753o8l2YbO64T0Q3cWRmngjFiH2mwgfu0rDEZ3mwYM4tcnu2O WITsTZxiAo75PwzZgI60CHuFADvDtq0dAV5upWDAl4lbzSyd9aCEI1bzQhh33/JQrZwJ i00rF7qzNyiu+uApb0E6zFCee27KsBQcXNHmmU77MAuL1uD9bq7yjWE/KBHJuC5+BT+T Yq4V9yiBN5kfL0KlFav6gqZJZW+L4+V1JhkLbiqadldtsRT7k9fHiIWSuMIitUaMo2Dw q7bg== 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=cNCtKdo0ulB6B2kS0U+1UewG/kp1MoWOVuf1jUF2IzE=; fh=TYrED6TOMxGX0VC4GtjviASLbYyJe19+7/tKWjN44KQ=; b=aQ5rLWP2VIorLdMQI948M8/YtX4b3Eve6IIQz+Pwq6aHq6af8YKZn/NPeepk0/Kl3j VJe+FpCWULUL4kR9nEZRFPAY+HU6AMJfXa6ts5A9wX7JlSixKAWZsQYDVAjSwa38vDaS tn+QNsgmGpmQsF1xgykLczs4U4R9PLpvmeMpfrDBdvWY0waQ0/zoCPd8bTHIL0sgYADJ gaAaeLnM09v9irMWgiPYRb1lUhDYpZ58swfD/1eEZu+pTwGT004IPsKNY6JViDQFUPNI 47RveEMnKeU7Sad7r45AYZo6gxqvUuawNR9jYOt6F8h8551UK1WrIoIF460KFtfKoEm+ lsYw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="xirPbkK/"; 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 h14-20020ac85e0e000000b00419661ee8efsi4661971qtx.86.2023.10.22.16.41.54 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sun, 22 Oct 2023 16:41:54 -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="xirPbkK/"; 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 1qui0B-0007mM-Bj; Sun, 22 Oct 2023 19:36:59 -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 1qui08-0007eg-Nq for qemu-devel@nongnu.org; Sun, 22 Oct 2023 19:36:56 -0400 Received: from mail-oi1-x232.google.com ([2607:f8b0:4864:20::232]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qui06-0008TE-9Q for qemu-devel@nongnu.org; Sun, 22 Oct 2023 19:36:56 -0400 Received: by mail-oi1-x232.google.com with SMTP id 5614622812f47-3b3f6dd612cso1451572b6e.3 for ; Sun, 22 Oct 2023 16:36:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1698017813; x=1698622613; 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=cNCtKdo0ulB6B2kS0U+1UewG/kp1MoWOVuf1jUF2IzE=; b=xirPbkK/0/Vhy0G/gbuwsdcXWShehjAhJI77taaLRwS93BwuE/J2gCt93zLgzJ86Hy T+eW7TbmZ1uUrKfShDc3PEXmS2+xctENQmwL0XtzcyIF81tqQ3vmgUHtK/v52AfJp0Ls CY1oSzP7sDHbI5GNHU8rmR7xlWsHDyU5eynhEDrLP8uXr/0iPueWZu+Oz4NHQMOvcDpv YyDZZaQ5xEAxXnZsvUlhiY7aurhntXvT9oFBbow+XBIIiNEapasLKq+pttnADnfz5NCL krVc2cBSOzecASyn8ZUkYhVLMLLhH5O8sjn8vc7hJW3OEpUOszOKt2Ef0sOu9HL9QfJN rUbA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698017813; x=1698622613; 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=cNCtKdo0ulB6B2kS0U+1UewG/kp1MoWOVuf1jUF2IzE=; b=BmnCzxBhfx88yTAqImtkJmTlduylxYJnkgpGzTrwFJNwAnC05Q9x8jyQMmRkfnkJen EAxx25OiMLR6s2x5XtrKmhtsyTazHMKeu/L8XYNs+8y1HtAbzphmkcFphHm7Zk4Hemnk sYM3H9a5TKpJSYZtDIdz6+iAeXSBEEl35XQ/4v/xiuiEqQisnrGrGogLEUl4UCfimLIH 3r+9d3/y5GqRPdJ0f8NjQSdM2x9VQXQOMH6hn73xk5st4MeeMuqY1T16HXR4nygC0P/s N0TmstpnbHsXUijBP15l8XYkh8cpqw3uI3ZLeMkmMM3REmuhFOkA+a2AFL850uu/aFKS EIaA== X-Gm-Message-State: AOJu0YzHtv+lkRnijVoGnO31SxW7Bfr21wAs1mu53wgA7Uljz5dr4cdN AgmU2ZFwbhrqPz3K9qovPnZ9XghmpWby+7imkws= X-Received: by 2002:aca:1714:0:b0:3b2:e07e:5062 with SMTP id j20-20020aca1714000000b003b2e07e5062mr8358171oii.52.1698017813196; Sun, 22 Oct 2023 16:36:53 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id k26-20020a63ba1a000000b005b25a04cf8bsm4026861pgf.12.2023.10.22.16.36.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 22 Oct 2023 16:36:52 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: mark.cave-ayland@ilande.co.uk Subject: [PATCH v5 93/94] target/sparc: Convert FZERO, FONE to decodetree Date: Sun, 22 Oct 2023 16:29:31 -0700 Message-Id: <20231022232932.80507-94-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231022232932.80507-1-richard.henderson@linaro.org> References: <20231022232932.80507-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::232; envelope-from=richard.henderson@linaro.org; helo=mail-oi1-x232.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 Tested-by: Mark Cave-Ayland Acked-by: Mark Cave-Ayland Signed-off-by: Richard Henderson --- target/sparc/insns.decode | 5 +++ target/sparc/translate.c | 69 +++++++++++++++++++++++---------------- 2 files changed, 45 insertions(+), 29 deletions(-) diff --git a/target/sparc/insns.decode b/target/sparc/insns.decode index 18a840709f..0552f1447d 100644 --- a/target/sparc/insns.decode +++ b/target/sparc/insns.decode @@ -391,6 +391,11 @@ FCMPEq 10 000 cc:2 110101 rs1:5 0 0101 0111 rs2:5 FORNOTs 10 ..... 110110 ..... 0 0111 1011 ..... @r_r_r_swap # ... 1s FORd 10 ..... 110110 ..... 0 0111 1100 ..... @r_r_r FORs 10 ..... 110110 ..... 0 0111 1101 ..... @r_r_r + + FZEROd 10 rd:5 110110 00000 0 0110 0000 00000 + FZEROs 10 rd:5 110110 00000 0 0110 0001 00000 + FONEd 10 rd:5 110110 00000 0 0111 1110 00000 + FONEs 10 rd:5 110110 00000 0 0111 1111 00000 ] NCP 10 ----- 110110 ----- --------- ----- # v8 CPop1 } diff --git a/target/sparc/translate.c b/target/sparc/translate.c index 36d916943d..58576c0047 100644 --- a/target/sparc/translate.c +++ b/target/sparc/translate.c @@ -4583,6 +4583,45 @@ static bool do_stfsr(DisasContext *dc, arg_r_r_ri *a, MemOp mop) TRANS(STFSR, ALL, do_stfsr, a, MO_TEUL) TRANS(STXFSR, 64, do_stfsr, a, MO_TEUQ) +static bool do_fc(DisasContext *dc, int rd, bool c) +{ + uint64_t mask; + + if (gen_trap_ifnofpu(dc)) { + return true; + } + + if (rd & 1) { + mask = MAKE_64BIT_MASK(0, 32); + } else { + mask = MAKE_64BIT_MASK(32, 32); + } + if (c) { + tcg_gen_ori_i64(cpu_fpr[rd / 2], cpu_fpr[rd / 2], mask); + } else { + tcg_gen_andi_i64(cpu_fpr[rd / 2], cpu_fpr[rd / 2], ~mask); + } + gen_update_fprs_dirty(dc, rd); + return advance_pc(dc); +} + +TRANS(FZEROs, VIS1, do_fc, a->rd, 0) +TRANS(FONEs, VIS1, do_fc, a->rd, 1) + +static bool do_dc(DisasContext *dc, int rd, int64_t c) +{ + if (gen_trap_ifnofpu(dc)) { + return true; + } + + tcg_gen_movi_i64(cpu_fpr[rd / 2], c); + gen_update_fprs_dirty(dc, rd); + return advance_pc(dc); +} + +TRANS(FZEROd, VIS1, do_dc, a->rd, 0) +TRANS(FONEd, VIS1, do_dc, a->rd, -1) + static bool do_ff(DisasContext *dc, arg_r_r *a, void (*func)(TCGv_i32, TCGv_i32)) { @@ -5300,10 +5339,7 @@ static void disas_sparc_legacy(DisasContext *dc, unsigned int insn) } else if (xop == 0x36) { #ifdef TARGET_SPARC64 /* VIS */ - TCGv_i64 cpu_dst_64; - TCGv_i32 cpu_dst_32; int opf = GET_FIELD_SP(insn, 5, 13); - int rd = GET_FIELD(insn, 2, 6); if (gen_trap_ifnofpu(dc)) { goto jmp_insn; @@ -5387,31 +5423,11 @@ static void disas_sparc_legacy(DisasContext *dc, unsigned int insn) case 0x02e: /* VIS I fcmpeq32 */ case 0x03b: /* VIS I fpack16 */ case 0x03d: /* VIS I fpackfix */ - g_assert_not_reached(); /* in decodetree */ case 0x060: /* VIS I fzero */ - CHECK_FPU_FEATURE(dc, VIS1); - cpu_dst_64 = gen_dest_fpr_D(dc, rd); - tcg_gen_movi_i64(cpu_dst_64, 0); - gen_store_fpr_D(dc, rd, cpu_dst_64); - break; case 0x061: /* VIS I fzeros */ - CHECK_FPU_FEATURE(dc, VIS1); - cpu_dst_32 = gen_dest_fpr_F(dc); - tcg_gen_movi_i32(cpu_dst_32, 0); - gen_store_fpr_F(dc, rd, cpu_dst_32); - break; case 0x07e: /* VIS I fone */ - CHECK_FPU_FEATURE(dc, VIS1); - cpu_dst_64 = gen_dest_fpr_D(dc, rd); - tcg_gen_movi_i64(cpu_dst_64, -1); - gen_store_fpr_D(dc, rd, cpu_dst_64); - break; case 0x07f: /* VIS I fones */ - CHECK_FPU_FEATURE(dc, VIS1); - cpu_dst_32 = gen_dest_fpr_F(dc); - tcg_gen_movi_i32(cpu_dst_32, -1); - gen_store_fpr_F(dc, rd, cpu_dst_32); - break; + g_assert_not_reached(); /* in decodetree */ case 0x080: /* VIS I shutdown */ case 0x081: /* VIS II siam */ // XXX @@ -5436,11 +5452,6 @@ static void disas_sparc_legacy(DisasContext *dc, unsigned int insn) illegal_insn: gen_exception(dc, TT_ILL_INSN); return; -#ifdef TARGET_SPARC64 - nfpu_insn: - gen_op_fpexception_im(dc, FSR_FTT_UNIMPFPOP); - return; -#endif } static void sparc_tr_init_disas_context(DisasContextBase *dcbase, CPUState *cs)