Re: rldicl / rldicr for 32-bit powerpc?

2023-07-16 Thread Sergey Fedorov
While I got no idea if it actually works, but Node does have support for
32-bit archs.

It even had it done at some point for ppc (with NodeJS 12), but things
changed since then, and old patches are not sufficient. (Also, it was done
for Linux, so Darwin still needed some fixes.)

On Mon, Jul 17, 2023 at 3:17 AM Fred Wright  wrote:

>
> On Sun, 16 Jul 2023, Sergey Fedorov wrote:
>
> >> The linked code is for an emulator, and is providing a *C*
> > implementation, not a ppc32 machine-code
> >
> > Whatever provides the needed functionality, gonna be good enough, I
> guess.
>
> I can't imagine any context in which you can freely choose whether to
> supply C code or assembler code, so using the code you linked in this
> context is virtually guaranteed not to "provide the needed functionality".
>
> It also occurs to me that any code using rldicX instructions must be
> assuming 64-bit registers.  But ppc32 doesn't have 64-bit registers, so a
> couple of missing opcodes may be just the tip of the iceberg.
>
> That being said, if the code *knows* it's dealing with 32-bit registers,
> then using rldicX instructions is just a bug.
>
> If it supports both i386 and x86_64, it might be instructive to look at
> how it handles the differences.  If it doesn't support i386, that might be
> a clue that 32-bit support would be significant work.
>
> Fred Wright
>


Re: rldicl / rldicr for 32-bit powerpc?

2023-07-16 Thread Fred Wright



On Sun, 16 Jul 2023, Sergey Fedorov wrote:


The linked code is for an emulator, and is providing a *C*

implementation, not a ppc32 machine-code

Whatever provides the needed functionality, gonna be good enough, I guess.


I can't imagine any context in which you can freely choose whether to 
supply C code or assembler code, so using the code you linked in this 
context is virtually guaranteed not to "provide the needed functionality".


It also occurs to me that any code using rldicX instructions must be 
assuming 64-bit registers.  But ppc32 doesn't have 64-bit registers, so a 
couple of missing opcodes may be just the tip of the iceberg.


That being said, if the code *knows* it's dealing with 32-bit registers, 
then using rldicX instructions is just a bug.


If it supports both i386 and x86_64, it might be instructive to look at 
how it handles the differences.  If it doesn't support i386, that might be 
a clue that 32-bit support would be significant work.


Fred Wright


Re: rldicl / rldicr for 32-bit powerpc?

2023-07-16 Thread Sergey Fedorov
> However, patching it into a source file that needs it on a case-by-case
basis is probably a fairly trivial thing to do.

This is what I meant.

> The linked code is for an emulator, and is providing a *C*
implementation, not a ppc32 machine-code

Whatever provides the needed functionality, gonna be good enough, I guess.

Let me sort out some other stuff, and I will post here the related code
from Node.

On Sun, Jul 16, 2023 at 12:21 PM Fred Wright  wrote:

>
> On Sat, 15 Jul 2023, Ken Cunningham wrote:
>
> > Adding it into cctools for the standard assembler to use whenever it
> > might be needed would be something of a project, to be sure...
>
> I think it would be highly unusual for an assembler to replace
> instructions for one architecture with instructions for another
> architecture, even when the two are related.  Anything generating actual
> machine instructions should know what architecture it's targeting, and
> generate appropriate code.
>
> > However, patching it into a source file that needs it on a case-by-case
> > basis is probably a fairly trivial thing to do.
>
> Probably so, once one works out the appropriate instructions.  That's not
> hard in principle (though trickier for the "dotted" versions), but I'm
> busy with other stuff right now (and don't currently have a working ppc64
> machine for comparison testing).  The linked code is for an emulator, and
> is providing a *C* implementation, not a ppc32 machine-code
> implementation.
>
> Fred Wright
>


Re: rldicl / rldicr for 32-bit powerpc?

2023-07-15 Thread Fred Wright



On Sat, 15 Jul 2023, Ken Cunningham wrote:

Adding it into cctools for the standard assembler to use whenever it 
might be needed would be something of a project, to be sure...


I think it would be highly unusual for an assembler to replace 
instructions for one architecture with instructions for another 
architecture, even when the two are related.  Anything generating actual 
machine instructions should know what architecture it's targeting, and 
generate appropriate code.


However, patching it into a source file that needs it on a case-by-case 
basis is probably a fairly trivial thing to do.


Probably so, once one works out the appropriate instructions.  That's not 
hard in principle (though trickier for the "dotted" versions), but I'm 
busy with other stuff right now (and don't currently have a working ppc64 
machine for comparison testing).  The linked code is for an emulator, and 
is providing a *C* implementation, not a ppc32 machine-code 
implementation.


Fred Wright


Re: rldicl / rldicr for 32-bit powerpc?

2023-07-15 Thread Ken Cunningham
Adding it into cctools for the standard assembler to use whenever it might be 
needed would be something of a project, to be sure...

However, patching it into a source file that needs it on a case-by-case basis 
is probably a fairly trivial thing to do.



> On Jul 15, 2023, at 11:45 AM, Sergio Had  wrote:
> 
> Well, I didn’t mean copy-pasting the patch, of course, it was just the only 
> relevant thing that was found.
> 
> NodeJS uses those instructions in some procedures (either in codebase or 
> PPC-specific patches), and I am looking to fixing it finally for 32-bit.
> On Jul 16, 2023 02:39 +0800, Fred Wright , wrote:
>> 
>> On Sat, 15 Jul 2023, Sergey Fedorov wrote:
>> 
>>> Is there an implementation to replace these on ppc32?
>>> 
>>> There is some Linux version online which I found:
>>> https://patchwork.kernel.org/project/kvm/patch/1403472217-22263-30-git-send-email-ag...@suse.de/
>>> But since it is a magic code, no idea if it is portable or not.
>> 
>> You'd have to be more specific about the intended context. AFAIK,
>> OSX/macOS didn't have anything like KVM until 10.10, so this specific
>> patch wouldn't be relevant.
>> 
>> Fred Wright



Re: rldicl / rldicr for 32-bit powerpc?

2023-07-15 Thread Sergio Had
Well, I didn’t mean copy-pasting the patch, of course, it was just the only 
relevant thing that was found.

NodeJS uses those instructions in some procedures (either in codebase or 
PPC-specific patches), and I am looking to fixing it finally for 32-bit.
On Jul 16, 2023 02:39 +0800, Fred Wright , wrote:
>
> On Sat, 15 Jul 2023, Sergey Fedorov wrote:
>
> > Is there an implementation to replace these on ppc32?
> >
> > There is some Linux version online which I found:
> > https://patchwork.kernel.org/project/kvm/patch/1403472217-22263-30-git-send-email-ag...@suse.de/
> > But since it is a magic code, no idea if it is portable or not.
>
> You'd have to be more specific about the intended context. AFAIK,
> OSX/macOS didn't have anything like KVM until 10.10, so this specific
> patch wouldn't be relevant.
>
> Fred Wright


Re: rldicl / rldicr for 32-bit powerpc?

2023-07-15 Thread Fred Wright



On Sat, 15 Jul 2023, Sergey Fedorov wrote:


Is there an implementation to replace these on ppc32?

There is some Linux version online which I found:
https://patchwork.kernel.org/project/kvm/patch/1403472217-22263-30-git-send-email-ag...@suse.de/
But since it is a magic code, no idea if it is portable or not.


You'd have to be more specific about the intended context.  AFAIK, 
OSX/macOS didn't have anything like KVM until 10.10, so this specific 
patch wouldn't be relevant.


Fred Wright


rldicl / rldicr for 32-bit powerpc?

2023-07-15 Thread Sergey Fedorov
Is there an implementation to replace these on ppc32?

There is some Linux version online which I found:
https://patchwork.kernel.org/project/kvm/patch/1403472217-22263-30-git-send-email-ag...@suse.de/
But since it is a magic code, no idea if it is portable or not.