@samitouri / QOSamiQemu / commits / a8687b8632

tcg/aarch64: Implement revbit{32,64}

Signed-off-by: Richard Henderson <richard.henderson@linaro.org>

Richard Henderson committed Jul 30, 2026 at 22:59 UTC a8687b8632a9dfe6dff094615e030480a950ffd0
1 file changed +18 -2
tcg/aarch64/tcg-target.c.inc
+18 -2
@@ -2656,12 +2656,28 @@ static const TCGOutOpUnary outop_revbit8 = {
2656 .base.static_constraint = C_NotImplemented,
2657 };
2658
2659 +static void tgen_revbit32(TCGContext *s, TCGType type,
2660 + TCGReg a0, TCGReg a1, unsigned flags)
2661 +{
2662 + tcg_out_insn(s, rr_sf, RBIT, TCG_TYPE_I32, a0, a1);
2663 + if (flags & TCG_BSWAP_OS) {
2664 + tcg_out_ext32s(s, a0, a0);
2665 + }
2666 +}
2667 +
2668 static const TCGOutOpBswap outop_revbit32 = {
2660 - .base.static_constraint = C_NotImplemented,
2669 + .base.static_constraint = C_O1_I1(r, r),
2670 + .out_rr = tgen_revbit32,
2671 };
2672
2673 +static void tgen_revbit64(TCGContext *s, TCGType type, TCGReg a0, TCGReg a1)
2674 +{
2675 + tcg_out_insn(s, rr_sf, RBIT, TCG_TYPE_I64, a0, a1);
2676 +}
2677 +
2678 static const TCGOutOpUnary outop_revbit64 = {
2664 - .base.static_constraint = C_NotImplemented,
2679 + .base.static_constraint = C_O1_I1(r, r),
2680 + .out_rr = tgen_revbit64,
2681 };
2682
2683 static void tgen_neg(TCGContext *s, TCGType type, TCGReg a0, TCGReg a1)