Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ppc: support 32bit AIX and OSX #211

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Conversation

carenas
Copy link
Contributor

@carenas carenas commented Sep 27, 2023

Fixes a problem in 32bit AIX, where functions using doubles will fail to map correctly their function parameters.

$ bin/sljit_test -s
test58 case 4 failed
test59 case 4 failed
test70 case 9 failed
test71 case 9 failed
test73 case 17 failed
SLJIT tests: 5 (4%) tests FAILED on PowerPC 32bit (big endian + unaligned) (with fpu)

Tested in AIX, Linux and OSX (thanks to @sevan)

Using r11 for TMP_REG1 might be controversial, but seem safe in practice, with the caveat that it wouldn't be preserved around inter module calls.

There is also the possibility this change might be needed for other systems (ex: BSD), althought NetBSD/macppc and and older OpenBSD 6.6 seems to work (at least in 32bit) without it.

@carenas carenas marked this pull request as ready for review September 27, 2023 10:43
@carenas carenas changed the title ppc: support 32bit AIX ppc: support 32bit AIX and OSX Oct 3, 2023
@carenas carenas marked this pull request as draft October 3, 2023 03:36
@carenas carenas marked this pull request as ready for review October 3, 2023 16:12
Since c0270dc (Support floating point arguments by more ABIs., 2017-10-21)
tests had been failing in 32bit AIX, because the ABI it uses is slightly
different than the one implemented.

Reuse the 64bit implementation for 32bit AIX, but add the ability to skip
two 32bit general registers for each 64bit floating point argument.

To support a fourth argument when all three previous ones are doubles
r9 had to be make accessible as a scratch register, so add r11 to replace it
as TMP_REG1, with the caveat it might be clobbered by inter module calls.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant