thomasokken / free42

Free42 : An HP-42S Calculator Simulator
https://thomasokken.com/free42/
GNU General Public License v2.0
280 stars 54 forks source link

A separated repository for IntelRDFPMathLib with ARM support? #31

Closed wdhwg001 closed 3 years ago

wdhwg001 commented 3 years ago

Hi,

I've been searching for a working patch to make IntelRDFPMathLib support ARM architectures for a long time, and thanks a lot for the hard work on these patches!

As there might be others looking for a working IntelRDFPMathLib on ARM architectures, it would be really great if we could have a self-maintained IntelRDFPMathLib repository so that it could support arm architectures on Linux, Android, macOS and iOS without applying patches for each of them.

thomasokken commented 3 years ago

I agree that it would be good to have ARM support in the Intel library, but the patches that I have created are only part of the job.

If you run the test suite in my ARM builds, you will find that it logs a large number of failures. These failures are all in functions that Free42 does not use, neither directly nor indirectly, which I verified by checking the symbols on the executables. But for a general purpose ARM port, these errors should be fixed so that the test suite runs cleanly.

Fixing the errors is probably not too difficult, but diagnosing them is; the test suite code uses lots of complex macros and that makes it a major pain to debug... and since this isn't necessary for Free42, I haven't taken the time to tackle this issue yet.

thomasokken commented 3 years ago

The test suite errors are all in various format conversion functions. The exact set of functions that fails is slightly different between the Android, iOS, and MacOS ARM builds. The fact that it's all in conversion functions suggests that the issues are all related to struct alignment differences and things like that.

(You can run the test suite in Free42 by creating a debug build of Free42 itself and then executing the FPTEST function. The test output is written to the console.)

thomasokken commented 3 years ago

I'm putting this on my long-term to-do list. I won't be working on this any time soon, and closing the issue for now.

thomasokken commented 1 year ago

I looked into the test failures on ARM, and found that they can be fixed by adding

-fsigned-char -DBID_SIZE_LONG=8

to the C compiler flags for 64-bit ARM, and

-fsigned-char -DBID_SIZE_LONG=4

for 32-bit ARM.

The only remaining issues after applying these fixes is that the conversion functions to and from binary80 still don't work on MacOS and iOS; this is due to missing support for 'long double' in Apple's ARM compiler. The Linux and Android builds don't have this problem.

I haven't tried building the library and Free42/Plus42 for Windows on ARM yet, but once I have that sorted out, I'll try to create a proper patch for the library and contribute that to Intel and/or Netlib.