JuliaMath / openlibm

High quality system independent, portable, open source libm implementation
https://openlibm.org
Other
507 stars 139 forks source link

Support for ppc32 BE? #270

Closed barracuda156 closed 2 months ago

barracuda156 commented 1 year ago

@simonbyrne Is it possible to add support for PowerPC BE, in particular ppc32? Primarily interested in macOS PPC, but also considering FreeBSD.

UPD. It seems that BE should be supported, despite not being mentioned in README (the code below has both little- and big-endian cases): https://github.com/JuliaMath/openlibm/blob/1d2c5e3bf52e050c994510ede91e0d2f0717173a/include/openlibm_fenv_powerpc.h#L100

kargl commented 1 year ago

You don't need to use openlibm on FreeBSD. FreeBSD's libm is already BE aware. In addition, most of openlibm is derived from FreeBSD's libm.

barracuda156 commented 1 year ago

You don't need to use openlibm on FreeBSD. FreeBSD's libm is already BE aware. In addition, most of openlibm is derived from FreeBSD's libm.

@kargl Thank you. Do you think that implementation of feenableexcept and fedisableexcept from openlibm can be borrowed to be used on Darwin PPC? fenv.h on MacOS does not have those, but they are needed for support of IEEE arithmetic in Fortran. (That is how I ended up here, looking for a suitable implementation.)

kargl commented 1 year ago

I've never used Darwin, so don't know. Looking at /usr/src/lib/msun/powerpc/fenv.h on FreeBSD shows the functions are declared as inline function and there is a lot of assembly. I suspect this a case of just grab the file and try it.

Edited: I just looked at openlibm_fenv_powerpc.h. It is identical to FreeBSD's header above.

afxgroup commented 1 year ago

I can confirm it is working since I'm using it in amigaos4 clib2 that is fully powerpc BE

ViralBShah commented 1 year ago

Presumably #276 addresses this?

barracuda156 commented 1 year ago

Presumably #276 addresses this?

@ViralBShah Allow me until this weekend. I will return to that likely missed __ppc64__ define and also this issue. Need to sort some other stuff first.

afxgroup commented 1 year ago

Anyone has tried to compile it on e500v1 with SPE?

barracuda156 commented 2 months ago

I can confirm it is working since I'm using it in amigaos4 clib2 that is fully powerpc BE

@afxgroup Somewhat on a side note, could you say in Amiga target supports ieee_arithmetic in gfortran and if yes, then how specifically?

afxgroup commented 2 months ago

Unforunately we don't have a working gfortran and I can't test it

barracuda156 commented 2 months ago

Unforunately we don't have a working gfortran and I can't test it

@afxgroup Oh. What’s wrong with it though? Have you filed a bug report with GCC Bugzilla?

afxgroup commented 2 months ago

I don't think there is something wrong. I our toolchain is disabled. I could try to compile it. But then what do you need to be tested?