[PATCH v2 4/5] LoongArch: Add support for LA32 in sysdeps/unix/sysv/linux/loongarch
WANG Xuerui
i.swmail@xen0n.name
Thu Dec 18 14:21:26 GMT 2025
On 12/18/25 21:05, Adhemerval Zanella Netto wrote:
>
>
> On 18/12/25 09:30, mengqinggang wrote:
>> [snip]
>>
>> @@ -54,7 +54,7 @@ ENTRY (__clone)
>> syscall 0
>>
>> blt a0, zero ,L (error)
>> - beqz a0,L (thread_start)
>> + beq a0, zero, L (thread_start)
>>
>> /* Successful return from the parent. */
>> ret
>
> Does it meant that loongarch32 does not support all the branch
> instruction from loongarch64? Or that binutils is not recognizing
> beqz as a alias for beq reg, zero ?
It is a bit interesting: b{eq,ne}z are *different* instructions in LA64
and LA32S so that an additional 5 bits becomes free for encoding the
offset. The reduced subset, LA32R, doesn't have them for simplicity reasons.
We may be able to make "b{eq,ne}z x, y" aliases for "b{eq,ne} x, zero,
y" respectively for LA32R, and this won't affect compatibility because
one has to use up-to-date binutils anyway to get any LA32 support at all.
I don't know if doing this would create confusion for someone
deliberately choosing beqz for a big offset that isn't expressible with
beq, but I guess the case is contrived because beq already can reach
+/-128KiB which is more than enough for conditional branches. Maybe
someone from Loongson would prepare a patch for binutils, or I can do it
later (next week or so).
--
Regards,
WANG "xen0n" Xuerui
Linux/LoongArch mailing list: https://lore.kernel.org/loongarch/
Unofficial Loongson OSS community: https://github.com/loongson-community
More information about the Libc-alpha
mailing list