* [Qemu-devel] mulu2 not implemented for tcg target sparc
@ 2010-01-10 20:20 Palle Lyckegaard
2010-01-10 20:46 ` Blue Swirl
0 siblings, 1 reply; 6+ messages in thread
From: Palle Lyckegaard @ 2010-01-10 20:20 UTC (permalink / raw)
To: qemu-devel
Hi,
The tcg mulu2 operation is apparently missing for the sparc target
(tcg/sparc/tcg-target.c function tcg_out_op())
Is anyone else working on implementing the missing mulu2 operation?
Regards
Palle
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [Qemu-devel] mulu2 not implemented for tcg target sparc
2010-01-10 20:20 [Qemu-devel] mulu2 not implemented for tcg target sparc Palle Lyckegaard
@ 2010-01-10 20:46 ` Blue Swirl
2010-01-10 20:50 ` Laurent Desnogues
0 siblings, 1 reply; 6+ messages in thread
From: Blue Swirl @ 2010-01-10 20:46 UTC (permalink / raw)
To: Palle Lyckegaard; +Cc: qemu-devel
On Sun, Jan 10, 2010 at 8:20 PM, Palle Lyckegaard <palle@lyckegaard.dk> wrote:
> Hi,
>
> The tcg mulu2 operation is apparently missing for the sparc target
> (tcg/sparc/tcg-target.c function tcg_out_op())
>
> Is anyone else working on implementing the missing mulu2 operation?
Is it needed somewhere?
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [Qemu-devel] mulu2 not implemented for tcg target sparc
2010-01-10 20:46 ` Blue Swirl
@ 2010-01-10 20:50 ` Laurent Desnogues
2010-01-10 21:03 ` Blue Swirl
0 siblings, 1 reply; 6+ messages in thread
From: Laurent Desnogues @ 2010-01-10 20:50 UTC (permalink / raw)
To: Blue Swirl; +Cc: Palle Lyckegaard, qemu-devel
On Sun, Jan 10, 2010 at 9:46 PM, Blue Swirl <blauwirbel@gmail.com> wrote:
> On Sun, Jan 10, 2010 at 8:20 PM, Palle Lyckegaard <palle@lyckegaard.dk> wrote:
>> Hi,
>>
>> The tcg mulu2 operation is apparently missing for the sparc target
>> (tcg/sparc/tcg-target.c function tcg_out_op())
>>
>> Is anyone else working on implementing the missing mulu2 operation?
>
> Is it needed somewhere?
It will be generated for instance for some muls when the target
is i386 (not even x86_64) on a 32-bit host.
Laurent
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [Qemu-devel] mulu2 not implemented for tcg target sparc
2010-01-10 20:50 ` Laurent Desnogues
@ 2010-01-10 21:03 ` Blue Swirl
2010-01-10 21:17 ` Palle Lyckegaard
0 siblings, 1 reply; 6+ messages in thread
From: Blue Swirl @ 2010-01-10 21:03 UTC (permalink / raw)
To: Palle Lyckegaard; +Cc: Laurent Desnogues, qemu-devel
On Sun, Jan 10, 2010 at 8:50 PM, Laurent Desnogues
<laurent.desnogues@gmail.com> wrote:
> On Sun, Jan 10, 2010 at 9:46 PM, Blue Swirl <blauwirbel@gmail.com> wrote:
>> On Sun, Jan 10, 2010 at 8:20 PM, Palle Lyckegaard <palle@lyckegaard.dk> wrote:
>>> Hi,
>>>
>>> The tcg mulu2 operation is apparently missing for the sparc target
>>> (tcg/sparc/tcg-target.c function tcg_out_op())
>>>
>>> Is anyone else working on implementing the missing mulu2 operation?
>>
>> Is it needed somewhere?
>
> It will be generated for instance for some muls when the target
> is i386 (not even x86_64) on a 32-bit host.
In that case mulu2 support would be useful for Sparc32 host too.
Palle, are you planning to dig into this?
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [Qemu-devel] mulu2 not implemented for tcg target sparc
2010-01-10 21:03 ` Blue Swirl
@ 2010-01-10 21:17 ` Palle Lyckegaard
2010-01-11 16:48 ` Richard Henderson
0 siblings, 1 reply; 6+ messages in thread
From: Palle Lyckegaard @ 2010-01-10 21:17 UTC (permalink / raw)
To: Blue Swirl; +Cc: Laurent Desnogues, qemu-devel
On Sun, 10 Jan 2010, Blue Swirl wrote:
>>>
>>> Is it needed somewhere?
>>
I was trying to run qemu-system-mips with a NetBSD malta kernel that
generates a MIPS mult operation. Tracing the code through tcg points at a
missing mulu2 opreration for sparc.
>> It will be generated for instance for some muls when the
target >> is i386 (not even x86_64) on a 32-bit host.
>
> In that case mulu2 support would be useful for Sparc32 host too.
> Palle, are you planning to dig into this?
Yes I will try even if my tcg and SPARC assembly skills and very limited
(so far...)
Regards
Palle
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [Qemu-devel] mulu2 not implemented for tcg target sparc
2010-01-10 21:17 ` Palle Lyckegaard
@ 2010-01-11 16:48 ` Richard Henderson
0 siblings, 0 replies; 6+ messages in thread
From: Richard Henderson @ 2010-01-11 16:48 UTC (permalink / raw)
To: Palle Lyckegaard; +Cc: Blue Swirl, Laurent Desnogues, qemu-devel
[-- Attachment #1: Type: text/plain, Size: 719 bytes --]
On 01/10/2010 01:17 PM, Palle Lyckegaard wrote:
> On Sun, 10 Jan 2010, Blue Swirl wrote:
>
>>>>
>>>> Is it needed somewhere?
>>>
>
> I was trying to run qemu-system-mips with a NetBSD malta kernel that
> generates a MIPS mult operation. Tracing the code through tcg points at
> a missing mulu2 opreration for sparc.
>
> >> It will be generated for instance for some muls when the target >>
> is i386 (not even x86_64) on a 32-bit host.
>>
>> In that case mulu2 support would be useful for Sparc32 host too.
>> Palle, are you planning to dig into this?
>
> Yes I will try even if my tcg and SPARC assembly skills and very limited
> (so far...)
Try this. You're also missing double-word addition and subtraction.
r~
[-- Attachment #2: z --]
[-- Type: text/plain, Size: 2785 bytes --]
diff --git a/tcg/sparc/tcg-target.c b/tcg/sparc/tcg-target.c
index 8f094e5..003f084 100644
--- a/tcg/sparc/tcg-target.c
+++ b/tcg/sparc/tcg-target.c
@@ -215,6 +215,7 @@ static inline int tcg_target_const_match(tcg_target_long val,
#define BA (INSN_OP(0) | INSN_COND(COND_A, 0) | INSN_OP2(0x2))
#define ARITH_ADD (INSN_OP(2) | INSN_OP3(0x00))
+#define ARITH_ADDCC (INSN_OP(2) | INSN_OP3(0x10))
#define ARITH_AND (INSN_OP(2) | INSN_OP3(0x01))
#define ARITH_OR (INSN_OP(2) | INSN_OP3(0x02))
#define ARITH_ORCC (INSN_OP(2) | INSN_OP3(0x12))
@@ -238,6 +239,7 @@ static inline int tcg_target_const_match(tcg_target_long val,
#define SHIFT_SRLX (INSN_OP(2) | INSN_OP3(0x26) | (1 << 12))
#define SHIFT_SRAX (INSN_OP(2) | INSN_OP3(0x27) | (1 << 12))
+#define RDY (INSN_OP(2) | INSN_OP3(0x28) | INSN_RS1(0))
#define WRY (INSN_OP(2) | INSN_OP3(0x30))
#define JMPL (INSN_OP(2) | INSN_OP3(0x38))
#define SAVE (INSN_OP(2) | INSN_OP3(0x3c))
@@ -403,6 +405,11 @@ static inline void tcg_out_sety(TCGContext *s, tcg_target_long val)
fprintf(stderr, "unimplemented sety %ld\n", (long)val);
}
+static inline void tcg_out_rdy(TCGContext *s, int rd)
+{
+ tcg_out32(s, RDY | INSN_RD(rd));
+}
+
static inline void tcg_out_addi(TCGContext *s, int reg, tcg_target_long val)
{
if (val != 0) {
@@ -1128,6 +1135,38 @@ static inline void tcg_out_op(TCGContext *s, int opc, const TCGArg *args,
args[2], const_args[2],
args[3], const_args[3], args[5]);
break;
+ case INDEX_op_add2_i32:
+ if (const_args[4]) {
+ tcg_out_arithi(s, args[0], args[2], args[4], ARITH_ADDCC);
+ } else {
+ tcg_out_arith(s, args[0], args[2], args[4], ARITH_ADDCC);
+ }
+ if (const_args[5]) {
+ tcg_out_arithi(s, args[1], args[3], args[5], ARITH_ADDX);
+ } else {
+ tcg_out_arithi(s, args[1], args[3], args[5], ARITH_ADDX);
+ }
+ break;
+ case INDEX_op_sub2_i32:
+ if (const_args[4]) {
+ tcg_out_arithi(s, args[0], args[2], args[4], ARITH_SUBCC);
+ } else {
+ tcg_out_arith(s, args[0], args[2], args[4], ARITH_SUBCC);
+ }
+ if (const_args[5]) {
+ tcg_out_arithi(s, args[1], args[3], args[5], ARITH_SUBX);
+ } else {
+ tcg_out_arithi(s, args[1], args[3], args[5], ARITH_SUBX);
+ }
+ break;
+ case INDEX_op_mulu2_i32:
+ if (const_args[3]) {
+ tcg_out_arithi(s, args[0], args[2], args[3], ARITH_UMUL);
+ } else {
+ tcg_out_arith(s, args[0], args[2], args[3], ARITH_UMUL);
+ }
+ tcg_out_rdy(s, args[1]);
+ break;
#endif
case INDEX_op_qemu_ld8u:
^ permalink raw reply related [flat|nested] 6+ messages in thread
end of thread, other threads:[~2010-01-11 16:48 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-01-10 20:20 [Qemu-devel] mulu2 not implemented for tcg target sparc Palle Lyckegaard
2010-01-10 20:46 ` Blue Swirl
2010-01-10 20:50 ` Laurent Desnogues
2010-01-10 21:03 ` Blue Swirl
2010-01-10 21:17 ` Palle Lyckegaard
2010-01-11 16:48 ` Richard Henderson
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.