[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 14/30] tcg/loongarch: Implement bswap32_i32/bswap64_i64
From: |
WANG Xuerui |
Subject: |
[PATCH 14/30] tcg/loongarch: Implement bswap32_i32/bswap64_i64 |
Date: |
Mon, 20 Sep 2021 16:04:35 +0800 |
Signed-off-by: WANG Xuerui <git@xen0n.name>
---
tcg/loongarch/tcg-target.c.inc | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/tcg/loongarch/tcg-target.c.inc b/tcg/loongarch/tcg-target.c.inc
index e5356bdaf8..d617b833e5 100644
--- a/tcg/loongarch/tcg-target.c.inc
+++ b/tcg/loongarch/tcg-target.c.inc
@@ -480,6 +480,14 @@ static void tcg_out_op(TCGContext *s, TCGOpcode opc,
tcg_out_opc_bstrins_d(s, a0, a2, args[3], args[3] + args[4] - 1);
break;
+ case INDEX_op_bswap32_i32:
+ tcg_out_opc_revb_2h(s, a0, a1);
+ tcg_out_opc_rotri_w(s, a0, a0, 16);
+ break;
+ case INDEX_op_bswap64_i64:
+ tcg_out_opc_revb_d(s, a0, a1);
+ break;
+
case INDEX_op_mov_i32: /* Always emitted via tcg_out_mov. */
case INDEX_op_mov_i64:
default:
@@ -511,6 +519,8 @@ static TCGConstraintSetIndex tcg_target_op_def(TCGOpcode op)
case INDEX_op_not_i64:
case INDEX_op_extract_i32:
case INDEX_op_extract_i64:
+ case INDEX_op_bswap32_i32:
+ case INDEX_op_bswap64_i64:
return C_O1_I1(r, r);
case INDEX_op_nor_i32:
--
2.33.0