openresty / luajit2

OpenResty's Branch of LuaJIT 2
https://luajit.org/luajit.html
Other
1.2k stars 193 forks source link

PPC/e500 with SPE enabled: use soft float instead of failing #180

Closed autobakterie closed 1 year ago

autobakterie commented 1 year ago

This allows building LuaJit for systems with Power ISA SPE extension^1 support by using soft float on LuaJit side.

While e500 CPU cores support SPE instruction set extension allowing them to perform floating point arithmetic natively, this isn't required. They can function with software floating point to integer arithmetic translation as well, just like FPU-less PowerPC CPUs without SPE support.

Therefore I see no need to prevent them from running LuaJit explicitly.

Signed-off-by: Pali Rohár pali@kernel.org Signed-off-by: Šimon Bořek simon.borek@nic.cz

BKPepe commented 1 year ago

@zhuizhuhaomeng and also @agentzh would it be possible to look at this pull request, please?

BKPepe commented 1 year ago

Kind reminder here, please.

zhuizhuhaomeng commented 1 year ago

@BKPepe I think you need to commit this PR to https://github.com/LuaJIT/LuaJIT.

zhuizhuhaomeng commented 1 year ago

We will merge from the Luajit upstream.

BKPepe commented 1 year ago

I am afraid that in that case, it is no go, because similar PRs were closed by Mike Pall with the reason that PPC32 is going to be removed - https://github.com/LuaJIT/LuaJIT/pull/486#issuecomment-1100890249 and https://github.com/LuaJIT/LuaJIT/issues/481. That's why it was not sent there, or am I mistaken @pali / @autobakterie?

Too sad that this does not get through because in the OpenWrt, we are using luajit 2.1.0-beta3 as you can see here https://github.com/openwrt/packages/blob/78cbb0153b12c5630eb5c92967a8cadf134a67df/lang/luajit/Makefile and there was accepted this PR (https://github.com/openwrt/packages/pull/19118), which allows us using Knot Resolver on Turris 1.x routers.

Without this patch, we can not use OpenResty's LuaJit2 on Turris 1.x routers. :-(

agentzh commented 1 year ago

It seems to me that this patch is small enough and safe enough to merge. @zhuizhuhaomeng

@autobakterie @BKPepe Will you make sure this patch won't affect other architectures?

autobakterie commented 1 year ago

I am afraid that in that case, it is no go, because similar PRs were closed by Mike Pall with the reason that PPC32 is going to be removed - LuaJIT/LuaJIT#486 (comment) and LuaJIT/LuaJIT#481. That's why it was not sent there, or am I mistaken @pali / @autobakterie?

You're right, PCC32 still being supported by OpenResty's LuaJIT2, but not by upstream LuaJIT, was exactly the reason why I made the PR only here.

pali commented 1 year ago

Yes, upstream LuaJIT is going to remove 32-bit PowerPC support. And if OpenResty's LuaJIT2 is still going to support 32-bit PowerPC then there should not be artificial reason to not support software floating point support on some special 32-bit PowerPC processors without real floating point. Software floating point must work on any 32-bit PowerPC processor (just on processors with floating point support, it is less effective).

zhuizhuhaomeng commented 1 year ago

@pali I will merge this PR.

But If the upstream removes the PPC32 code, I don't think we have time to maintain the code.

zhuizhuhaomeng commented 1 year ago

@pali I have merged this PR. But If the upstream removes the PPC32 code, I don't think we have time to maintain the code.