[Mono-dev] Mono.Simd AltiVec port
qyron.private at gmail.com
Tue Feb 9 08:57:02 EST 2010
Now I'm stuck with another problem on PPC. For multiplication of floats
Altivec has only a fuse-add instruction which does a*b+c. So in order to
implement OP_MULPS I need to assure c==0. The only solution which comes to
MULADD D <= S1, S2, D
Where MULADD is the instruction and D, S1, S2 are ins->dreg, sreg1, sreg2.
But this solution won't work with cases in which S1=D or S2=D since D would
be zeroed before use. So 2 possibilities remain:
1) Make sure that D <> S1 and D <> S2 and then previously-mentioned solution
2) Allocate and additional (vector) register for MULPS and somehow store it
inside MonoInst structure.
What is the traditional way to do such things? I really need to solve this
problem, any help will be greatly appreciated!
On Thu, Feb 4, 2010 at 02:59, Rodrigo Kumpera <kumpera at gmail.com> wrote:
> Hi Sergei,
> On Tue, Feb 2, 2010 at 6:59 AM, Sergei Dyshel <qyron.private at gmail.com>wrote:
>> Hello all,
>> I'm currently working on PowerPC port of Mono which utilizes AltiVec SIMD
>> instructions. During the development I've encountered an alignment
>> As far as I understood from running Mono's JIT, stack-allocated
>> Mono.Simd.Vector* types are always aligned by 16 byte bound, but global
>> ones aren't (such as static class members). This is not a problem for SSE
>> which has unaligned load/stores but AltiVec doesn't have them. Instead of
>> implementing misaligned loads/stores for AltiVec I think it's better to
>> force alignment in global variables, as it done in the case of stack.
> No, the JIT doesn't align all Vector types to 16 bytes. There are places,
> like spill, code that
> still doesn't do it correctly. Not a lot of work to get there, but still
> not done.
> If by global variables you mean statics, then making them properly aligned
> is possible with some trickery.
> The only issue alignment issue we can't currently fix are heap objects due
> to how our GC works.
> Our new GC might eventually gain the ability to properly align such
> objects, but this is something
> for the far future.
>> Can somebody help me with that (e.g. point at relevant places in
> To fix the alignment of stack variables you need to mess with a bunch of
> -The spill code from mini-codegen.c
> -The var allocation code in mono_allocate_stack_slots (mini.c)
> To fix the static storage alignment you need to change the code that
> allocate the statics area
> to use the proper alignment.
> This is the same problem as with objects as it uses a gc routine to
> allocate the memory blob.
> Fixing this requires boing deep into the GC, which is not something simple.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Mono-devel-list