[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v3 47/90] target/sparc: Use tcg_gen_qemu_{ld, st}_i128 for GET_AS
|
From: |
Richard Henderson |
|
Subject: |
[PATCH v3 47/90] target/sparc: Use tcg_gen_qemu_{ld, st}_i128 for GET_ASI_DTWINX |
|
Date: |
Fri, 20 Oct 2023 22:31:15 -0700 |
Perform one atomic 16-byte operation.
The atomicity is required for the LDTXA instructions.
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
---
target/sparc/translate.c | 48 +++++++++++++++++++++++++++++++++-------
1 file changed, 40 insertions(+), 8 deletions(-)
diff --git a/target/sparc/translate.c b/target/sparc/translate.c
index 7d834ae8a0..6f8f279508 100644
--- a/target/sparc/translate.c
+++ b/target/sparc/translate.c
@@ -2579,11 +2579,27 @@ static void gen_ldda_asi0(DisasContext *dc, DisasASI
*da, TCGv addr, int rd)
return;
case GET_ASI_DTWINX:
- assert(TARGET_LONG_BITS == 64);
- tcg_gen_qemu_ld_tl(hi, addr, da->mem_idx, da->memop | MO_ALIGN_16);
- tcg_gen_addi_tl(addr, addr, 8);
- tcg_gen_qemu_ld_tl(lo, addr, da->mem_idx, da->memop);
+#ifdef TARGET_SPARC64
+ {
+ MemOp mop = (da->memop & MO_BSWAP) | MO_128 | MO_ALIGN_16;
+ TCGv_i128 t = tcg_temp_new_i128();
+
+ tcg_gen_qemu_ld_i128(t, addr, da->mem_idx, mop);
+ /*
+ * Note that LE twinx acts as if each 64-bit register result is
+ * byte swapped. We perform one 128-bit LE load, so must swap
+ * the order of the writebacks.
+ */
+ if ((mop & MO_BSWAP) == MO_TE) {
+ tcg_gen_extr_i128_i64(lo, hi, t);
+ } else {
+ tcg_gen_extr_i128_i64(hi, lo, t);
+ }
+ }
break;
+#else
+ g_assert_not_reached();
+#endif
case GET_ASI_DIRECT:
{
@@ -2648,11 +2664,27 @@ static void gen_stda_asi0(DisasContext *dc, DisasASI
*da, TCGv addr, int rd)
break;
case GET_ASI_DTWINX:
- assert(TARGET_LONG_BITS == 64);
- tcg_gen_qemu_st_tl(hi, addr, da->mem_idx, da->memop | MO_ALIGN_16);
- tcg_gen_addi_tl(addr, addr, 8);
- tcg_gen_qemu_st_tl(lo, addr, da->mem_idx, da->memop);
+#ifdef TARGET_SPARC64
+ {
+ MemOp mop = (da->memop & MO_BSWAP) | MO_128 | MO_ALIGN_16;
+ TCGv_i128 t = tcg_temp_new_i128();
+
+ /*
+ * Note that LE twinx acts as if each 64-bit register result is
+ * byte swapped. We perform one 128-bit LE store, so must swap
+ * the order of the construction.
+ */
+ if ((mop & MO_BSWAP) == MO_TE) {
+ tcg_gen_concat_i64_i128(t, lo, hi);
+ } else {
+ tcg_gen_concat_i64_i128(t, hi, lo);
+ }
+ tcg_gen_qemu_st_i128(t, addr, da->mem_idx, mop);
+ }
break;
+#else
+ g_assert_not_reached();
+#endif
case GET_ASI_DIRECT:
{
--
2.34.1
- [PATCH v3 46/90] target/sparc: Split out ldst functions with asi pre-computed, (continued)
- [PATCH v3 46/90] target/sparc: Split out ldst functions with asi pre-computed, Richard Henderson, 2023/10/21
- [PATCH v3 43/90] target/sparc: Move DONE, RETRY to decodetree, Richard Henderson, 2023/10/21
- [PATCH v3 48/90] target/sparc: Move simple integer load/store to decodetree, Richard Henderson, 2023/10/21
- [PATCH v3 59/90] target/sparc: Move EDGE* to decodetree, Richard Henderson, 2023/10/21
- [PATCH v3 60/90] target/sparc: Move ARRAY* to decodetree, Richard Henderson, 2023/10/21
- [PATCH v3 52/90] target/sparc: Move CASA, CASXA to decodetree, Richard Henderson, 2023/10/21
- [PATCH v3 56/90] target/sparc: Move asi fp load/store to decodetree, Richard Henderson, 2023/10/21
- [PATCH v3 64/90] target/sparc: Move FMOVD, FNEGD, FABSD, FSRC*D, FNOT*D to decodetree, Richard Henderson, 2023/10/21
- [PATCH v3 44/90] target/sparc: Split out resolve_asi, Richard Henderson, 2023/10/21
- [PATCH v3 45/90] target/sparc: Drop ifdef around get_asi and friends, Richard Henderson, 2023/10/21
- [PATCH v3 47/90] target/sparc: Use tcg_gen_qemu_{ld, st}_i128 for GET_ASI_DTWINX,
Richard Henderson <=
- [PATCH v3 49/90] target/sparc: Move asi integer load/store to decodetree, Richard Henderson, 2023/10/21
- [PATCH v3 50/90] target/sparc: Move LDSTUB, LDSTUBA to decodetree, Richard Henderson, 2023/10/21
- [PATCH v3 53/90] target/sparc: Move PREFETCH, PREFETCHA to decodetree, Richard Henderson, 2023/10/21
- [PATCH v3 55/90] target/sparc: Move simple fp load/store to decodetree, Richard Henderson, 2023/10/21
- [PATCH v3 57/90] target/sparc: Move LDFSR, STFSR to decodetree, Richard Henderson, 2023/10/21
- [PATCH v3 58/90] target/sparc: Merge LDFSR, LDXFSR implementations, Richard Henderson, 2023/10/21
- [PATCH v3 61/90] target/sparc: Move ADDRALIGN* to decodetree, Richard Henderson, 2023/10/21
- [PATCH v3 65/90] target/sparc: Use tcg_gen_vec_{add,sub}*, Richard Henderson, 2023/10/21
- [PATCH v3 62/90] target/sparc: Move BMASK to decodetree, Richard Henderson, 2023/10/21
- [PATCH v3 71/90] target/sparc: Move gen_fop_DD insns to decodetree, Richard Henderson, 2023/10/21