qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH] ppc: Convert op_405_check_{sat,satu} to TCG


From: Andreas Färber
Subject: Re: [Qemu-devel] [PATCH] ppc: Convert op_405_check_{sat,satu} to TCG
Date: Sat, 25 Oct 2008 22:25:49 +0200


Am 25.10.2008 um 22:09 schrieb Paul Brook:

On Saturday 25 October 2008, Andreas Färber wrote:
+            tcg_gen_shri_tl(tmp, tmp, 31);
+            tcg_gen_brcondi_tl(TCG_COND_EQ, tmp, 0, endLabel);

Is this really right for ppc64?

http://en.wikipedia.org/wiki/PowerPC_400
says the embedded 400 family is 32-bit.

You can easily test the high bit using TCG_COND_LT.

+            tcg_gen_shri_tl(tmp, cpu_T[2], 31);
+            tcg_gen_brcondi_tl(TCG_COND_EQ, tmp, 0, innerLabel);
+
+            tcg_gen_movi_tl(cpu_T[0], INT32_MIN);
+            tcg_gen_br(endLabel);
+
+            gen_set_label(innerLabel);
+            tcg_gen_movi_tl(cpu_T[0], INT32_MAX);

((signed)x >> 31) ^ 0x7fffffff)
is a much more efficient way of implementing this.

I just translated the original code that's being removed in the patch. ;)

On second thoughts I am wondering whether we should use a new helper here instead of TCG instructions? (The Readme mentions 20 instructions as limit.) Unfortunately I wouldn't know how to yet, it doesn't work simply calling the old helper, e.g., tcg_gen_helper_0_0(do_40x_rfci); because the function name is unknown there.

Andreas





reply via email to

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