From patchwork Fri Oct 13 21:28:25 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 733293 Delivered-To: patch@linaro.org Received: by 2002:a5d:54d1:0:b0:31d:da82:a3b4 with SMTP id x17csp1679176wrv; Fri, 13 Oct 2023 14:34:23 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGaTMRfAdixA/b6rVoO0GItXw+FgXA2CWgVOqmRa0Kp85KzDnUGNRVay520wf3S9ZDq3W85 X-Received: by 2002:a05:620a:134d:b0:774:111b:7fb8 with SMTP id c13-20020a05620a134d00b00774111b7fb8mr26186149qkl.73.1697232863660; Fri, 13 Oct 2023 14:34:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697232863; cv=none; d=google.com; s=arc-20160816; b=CQX416T5BHZ1O/iZHe7h91Igw+kmPGV+5Xf4XGzEB5GqO9C7exLmOMSuv8nhUWOK5B 6pvrlr5oIjKEk8et9dX+6r/WVC0HI9JeSuX9aPDKDffwR6IBYvdy5xn/P71ZgJTGb75b yog3YJMc82sBxRpUfCIUt2rgiNaZ34Rn0/+HdkTrDv8w/iUEhVCQQ80RbQ5VJRqHNGxJ hlH90yHjsVbhX/0lLcsHjeRK6AO3PTFeHp0wCjKPxnQNdPrKgCvSYtlDWKcvkBdpvReM cU3fuks8XsS+XJjt321RZ9C81jUabC4fiBos8DJ4Zao8ruOIOuV+BtB3qtloDFycsepp kg7Q== 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=no+j+aOfCu7U1CN6BMLPKphfGA1mvhpsnYY9YQJOeo4=; fh=OY/jf0qYEhT53LcIJp8d/e39mN3vEzshkseI36O8N8s=; b=ZLL11G6R5d98WEeeMYR0DYd6OrIFfK1aIKRl84joRyRcfTQwJgSGMSpz6RPglNHMKA +OoW8Fam1/VSlg3j01RNxZv4IyAqDI/D/1wWULuLcpS8vuT3agEqnFaz4Q13Om2dQWpn mjCGEFKTjGlazptthOiVlF9/WPMbrFHViCe1hJayvXYWiVQAPHWElFQnbQP7NfEJn9Wv 6UhuRsEv/klBrgSOuqJub/xNFj0fWEEmC+uad+LrJlTaJNoLkoFsFxRZyBT8mUA6wFvb TJ6JxonjE8nmCcmJOLOvjhPaiJ3NkjicHQwQg8MCdM8yovUtJHX3Q2/EArRfFOeBbxgS +5PA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=dh7QCQr1; 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 s4-20020a05620a254400b00773cb326234si1923304qko.413.2023.10.13.14.34.23 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 13 Oct 2023 14:34:23 -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=dh7QCQr1; 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 1qrPmI-0002eS-4N; Fri, 13 Oct 2023 17:33:02 -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 1qrPm6-0001Gm-Hn for qemu-devel@nongnu.org; Fri, 13 Oct 2023 17:32:50 -0400 Received: from mail-ot1-x333.google.com ([2607:f8b0:4864:20::333]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qrPm4-0001X0-Eb for qemu-devel@nongnu.org; Fri, 13 Oct 2023 17:32:50 -0400 Received: by mail-ot1-x333.google.com with SMTP id 46e09a7af769-6c665b2469dso1600685a34.0 for ; Fri, 13 Oct 2023 14:32:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1697232767; x=1697837567; 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=no+j+aOfCu7U1CN6BMLPKphfGA1mvhpsnYY9YQJOeo4=; b=dh7QCQr1HSaFMnxh/JxOHzi3fYqw5g8bR1vw3goEomcoaJJaEngkYvzGfrD8G2TVs/ xfgHz9yZiVVoWq8zZKuYv148a7laqw/7jOU/3PXkUzpHT5Y7uk/pu+pRBErYB8JRU72R fhpFgUOshi0YN9hY+DxB5a7kFkiW0K9HVpRj4n9b37s6eoHEjvy8Y392LqHh8RANPDBq euWPNTEI4KJj6Cq5PvEsmbrT17PgVpZX9i8ylQyhsD35jY5JOTK3q01hCS34CoZGyNZS exMhlGYLAfFyA3003p+F0qCiFZlhhnpnR6G+XToSXMrcLQuvV8cPulhKmRodrWEF+jCL StdQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697232767; x=1697837567; 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=no+j+aOfCu7U1CN6BMLPKphfGA1mvhpsnYY9YQJOeo4=; b=RrzKmnMSTr0lAWjaTsREMqonr9e4XzVaK0dKp2ohcV7gpSt9TwhhXlIEmfF2yJ30ot CcN/rivyBm/Ad5zTR3H9NlsEEasA9bLlY00qUAhYyWN/rOwas37OrdYuNOJui9d0pDzW zmRQsslr8oQ21/XwUrTxqVFsI19pgY+UwXmDsfeSAjBFe1b0NHmdKe2q/7Wlhi5qhIqt W6ZoMAxBY0ICjdqsHEV1BvkiX6w5NC/vRvTU4koyoouDfQrI3g1yGTPLNYen02xALG5m 00ft6IeUWkizZy6WKaz1p1+ZtPY+wSIPPQxvtOrU9gMQV6DFyDqV+CHEme5EoDA1368C igjA== X-Gm-Message-State: AOJu0Ywybbi2QIN7HZC2wo7dzJbrUj8xfW56m40J9nrSmzj14ylp3UwE liw1zzgVsG4Fi2l5/5m84oq+DuDY09mWFBQhP4E= X-Received: by 2002:a9d:74d9:0:b0:6b8:7eef:a236 with SMTP id a25-20020a9d74d9000000b006b87eefa236mr29336086otl.30.1697232767220; Fri, 13 Oct 2023 14:32:47 -0700 (PDT) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id j5-20020aa78d05000000b0068842ebfd10sm13977191pfe.160.2023.10.13.14.32.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 13 Oct 2023 14:32:46 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: mark.cave-ayland@ilande.co.uk, atar4qemu@gmail.com Subject: [PATCH 64/85] target/sparc: Move gen_gsr_fop_DDD insns to decodetree Date: Fri, 13 Oct 2023 14:28:25 -0700 Message-Id: <20231013212846.165724-65-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231013212846.165724-1-richard.henderson@linaro.org> References: <20231013212846.165724-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::333; envelope-from=richard.henderson@linaro.org; helo=mail-ot1-x333.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 Move FPACK32, FALIGNDATA, BSHUFFLE. Signed-off-by: Richard Henderson --- target/sparc/insns.decode | 3 ++ target/sparc/translate.c | 101 ++++++++++++++++++++------------------ 2 files changed, 55 insertions(+), 49 deletions(-) diff --git a/target/sparc/insns.decode b/target/sparc/insns.decode index 12db108a31..541b95c2dd 100644 --- a/target/sparc/insns.decode +++ b/target/sparc/insns.decode @@ -271,9 +271,12 @@ FABSd 10 ..... 110100 00000 0 0000 1010 ..... @r_r2 FMUL8ULx16 10 ..... 110110 ..... 0 0011 0111 ..... @r_r_r FMULD8SUx16 10 ..... 110110 ..... 0 0011 1000 ..... @r_r_r FMULD8ULx16 10 ..... 110110 ..... 0 0011 1001 ..... @r_r_r + FPACK32 10 ..... 110110 ..... 0 0011 1010 ..... @r_r_r PDIST 10 ..... 110110 ..... 0 0011 1110 ..... @r_r_r + 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 FSRCd 10 ..... 110110 ..... 0 0111 0100 00000 @r_r1 # FSRC1d diff --git a/target/sparc/translate.c b/target/sparc/translate.c index 5da3170978..605a218255 100644 --- a/target/sparc/translate.c +++ b/target/sparc/translate.c @@ -686,6 +686,51 @@ static void gen_op_array32(TCGv dst, TCGv src1, TCGv src2) tcg_gen_shli_tl(dst, dst, 2); } +static void gen_op_fpack32(TCGv_i64 dst, TCGv_i64 src1, TCGv_i64 src2) +{ +#ifdef TARGET_SPARC64 + gen_helper_fpack32(dst, cpu_gsr, src1, src2); +#else + g_assert_not_reached(); +#endif +} + +static void gen_op_faligndata(TCGv_i64 dst, TCGv_i64 s1, TCGv_i64 s2) +{ +#ifdef TARGET_SPARC64 + TCGv t1, t2, shift; + + t1 = tcg_temp_new(); + t2 = tcg_temp_new(); + shift = tcg_temp_new(); + + tcg_gen_andi_tl(shift, cpu_gsr, 7); + tcg_gen_shli_tl(shift, shift, 3); + tcg_gen_shl_tl(t1, s1, shift); + + /* + * A shift of 64 does not produce 0 in TCG. Divide this into a + * shift of (up to 63) followed by a constant shift of 1. + */ + tcg_gen_xori_tl(shift, shift, 63); + tcg_gen_shr_tl(t2, s2, shift); + tcg_gen_shri_tl(t2, t2, 1); + + tcg_gen_or_tl(dst, t1, t2); +#else + g_assert_not_reached(); +#endif +} + +static void gen_op_bshuffle(TCGv_i64 dst, TCGv_i64 src1, TCGv_i64 src2) +{ +#ifdef TARGET_SPARC64 + gen_helper_bshuffle(dst, cpu_gsr, src1, src2); +#else + g_assert_not_reached(); +#endif +} + // 1 static void gen_op_eval_ba(TCGv dst) { @@ -1536,22 +1581,6 @@ static void gen_fop_DDD(DisasContext *dc, int rd, int rs1, int rs2, gen_store_fpr_D(dc, rd, dst); } -#ifdef TARGET_SPARC64 -static void gen_gsr_fop_DDD(DisasContext *dc, int rd, int rs1, int rs2, - void (*gen)(TCGv_i64, TCGv_i64, TCGv_i64, TCGv_i64)) -{ - TCGv_i64 dst, src1, src2; - - src1 = gen_load_fpr_D(dc, rs1); - src2 = gen_load_fpr_D(dc, rs2); - dst = gen_dest_fpr_D(dc, rd); - - gen(dst, cpu_gsr, src1, src2); - - gen_store_fpr_D(dc, rd, dst); -} -#endif - static void gen_fop_QQ(DisasContext *dc, int rd, int rs, void (*gen)(TCGv_ptr)) { @@ -2573,27 +2602,6 @@ static void gen_load_trap_state_at_tl(TCGv_ptr r_tsptr) tcg_gen_add_ptr(r_tsptr, r_tsptr, r_tl_tmp); } } - -static void gen_faligndata(TCGv dst, TCGv gsr, TCGv s1, TCGv s2) -{ - TCGv t1, t2, shift; - - t1 = tcg_temp_new(); - t2 = tcg_temp_new(); - shift = tcg_temp_new(); - - tcg_gen_andi_tl(shift, gsr, 7); - tcg_gen_shli_tl(shift, shift, 3); - tcg_gen_shl_tl(t1, s1, shift); - - /* A shift of 64 does not produce 0 in TCG. Divide this into a - shift of (up to 63) followed by a constant shift of 1. */ - tcg_gen_xori_tl(shift, shift, 63); - tcg_gen_shr_tl(t2, s2, shift); - tcg_gen_shri_tl(t2, t2, 1); - - tcg_gen_or_tl(dst, t1, t2); -} #endif static int extract_dfpreg(DisasContext *dc, int x) @@ -4873,6 +4881,10 @@ TRANS(FXNORd, VIS1, do_ddd, a, tcg_gen_eqv_i64) TRANS(FORNOTd, VIS1, do_ddd, a, tcg_gen_orc_i64) TRANS(FORd, VIS1, do_ddd, a, tcg_gen_or_i64) +TRANS(FPACK32, VIS1, do_ddd, a, gen_op_fpack32) +TRANS(FALIGNDATAg, VIS1, do_ddd, a, gen_op_faligndata) +TRANS(BSHUFFLE, VIS2, do_ddd, a, gen_op_bshuffle) + static bool do_dddd(DisasContext *dc, arg_r_r_r *a, void (*func)(TCGv_i64, TCGv_i64, TCGv_i64, TCGv_i64)) { @@ -5303,6 +5315,9 @@ static void disas_sparc_legacy(DisasContext *dc, unsigned int insn) case 0x04b: /* VIS I fpmerge */ case 0x04d: /* VIS I fexpand */ case 0x03e: /* VIS I pdist */ + case 0x03a: /* VIS I fpack32 */ + case 0x048: /* VIS I faligndata */ + case 0x04c: /* VIS II bshuffle */ g_assert_not_reached(); /* in decodetree */ case 0x020: /* VIS I fcmple16 */ CHECK_FPU_FEATURE(dc, VIS1); @@ -5360,10 +5375,6 @@ static void disas_sparc_legacy(DisasContext *dc, unsigned int insn) gen_helper_fcmpeq32(cpu_dst, cpu_src1_64, cpu_src2_64); gen_store_gpr(dc, rd, cpu_dst); break; - case 0x03a: /* VIS I fpack32 */ - CHECK_FPU_FEATURE(dc, VIS1); - gen_gsr_fop_DDD(dc, rd, rs1, rs2, gen_helper_fpack32); - break; case 0x03b: /* VIS I fpack16 */ CHECK_FPU_FEATURE(dc, VIS1); cpu_src1_64 = gen_load_fpr_D(dc, rs2); @@ -5378,14 +5389,6 @@ static void disas_sparc_legacy(DisasContext *dc, unsigned int insn) gen_helper_fpackfix(cpu_dst_32, cpu_gsr, cpu_src1_64); gen_store_fpr_F(dc, rd, cpu_dst_32); break; - case 0x048: /* VIS I faligndata */ - CHECK_FPU_FEATURE(dc, VIS1); - gen_gsr_fop_DDD(dc, rd, rs1, rs2, gen_faligndata); - break; - case 0x04c: /* VIS II bshuffle */ - CHECK_FPU_FEATURE(dc, VIS2); - gen_gsr_fop_DDD(dc, rd, rs1, rs2, gen_helper_bshuffle); - break; case 0x060: /* VIS I fzero */ CHECK_FPU_FEATURE(dc, VIS1); cpu_dst_64 = gen_dest_fpr_D(dc, rd);