qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH 07/28] tcg/ppc: Split out tcg_out_bswap16


From: Richard Henderson
Subject: Re: [PATCH 07/28] tcg/ppc: Split out tcg_out_bswap16
Date: Mon, 21 Jun 2021 07:41:39 -0700
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.8.1

On 6/21/21 7:29 AM, Peter Maydell wrote:
+static void tcg_out_bswap16(TCGContext *s, TCGReg dst, TCGReg src)
+{
+    TCGReg tmp = dst == src ? TCG_REG_R0 : dst;
+
+                                                   /* src = abcd */
+    tcg_out_rlw(s, RLWINM, tmp, src, 24, 24, 31);  /* tmp = 000c */
+    tcg_out_rlw(s, RLWIMI, tmp, src, 8, 16, 23);   /* tmp = 00dc */
+    tcg_out_mov(s, TCG_TYPE_REG, dst, tmp);
+}

TCG_REG_R0 is implicitly available as a temp because it's not
listed in tcg_target_reg_alloc_order[], right?

Slightly better than that:

    tcg_regset_set_reg(s->reserved_regs, TCG_REG_R0); /* tcg temp */


(There's a comment
in the definition of that array that says V0 and V1 are reserved
as temporaries, but not a comment about R0.)

Yeah, tcg/ppc/ is due for a bit of cleanup.

Would be nice to keep these comments about what operations we think
the insns are doing, given that RLWINM and RLWIMI are pretty confusing.

Hmm, I guess.  I found them intrusive.


r~



reply via email to

[Prev in Thread] Current Thread [Next in Thread]