Add bswapr_us, bswapr_ui, and bswapr_ul API functions - lightning.git - Portable just-in-time compiler library

index : lightning.git
Portable just-in-time compiler library
summary refs log tree commit diff
path: root/lib/jit_mips-sz.c
diff options
context:
space:
mode:
authorPaul Cercueil <paul@crapouillou.net>2022年05月25日 19:18:20 +0100
committerpcpa <paulo.cesar.pereira.de.andrade@gmail.com>2022年05月25日 16:23:11 -0300
commitc44a80ca20ed534f4cf49e656bd9b7989633f4ea (patch)
treee7370910582f58cde22629f0a3ac68d09c337905 /lib/jit_mips-sz.c
parent44e8674a3aa32547b6161e2fb4212b7de2c0f707 (diff)
downloadlightning-c44a80ca20ed534f4cf49e656bd9b7989633f4ea.tar.gz
Add bswapr_us, bswapr_ui, and bswapr_ul API functions
The difference between bswapr and htonr/ntohr, is that the operation performed by bswap does not depend on the endianness of the host CPU. On little-endian however, the new bswapr functions are functionally equal to the htonr/ntohr ones. The implementations of the latter ones have then be removed, and will resolve to the corresponding bswapr function on little-endian, or to movr/extr functions on big-endian. Optional generic bswapr implementations are provided in lightning.c, which can be used (or not) by the arch cpu.c files when there's nothing better to do. The bswapr implementations are generally following the previous htonr implementations on little-endian systems, with the exception of the IA-64 architecture, where the htonr implementation seemed sub-par, and a better (yet untested) implementation has been added. This change has been tested on MIPS, x86 and PowerPC. Signed-off-by: Paul Cercueil <paul@crapouillou.net>
Diffstat (limited to 'lib/jit_mips-sz.c')
-rw-r--r--lib/jit_mips-sz.c 13
1 files changed, 11 insertions, 2 deletions
diff --git a/lib/jit_mips-sz.c b/lib/jit_mips-sz.c
index da37848..b4642fa 100644
--- a/lib/jit_mips-sz.c
+++ b/lib/jit_mips-sz.c
@@ -1,7 +1,7 @@
#if __WORDSIZE == 32
#if NEW_ABI
-#define JIT_INSTR_MAX 44
+#define JIT_INSTR_MAX 52
0, /* data */
0, /* live */
0, /* align */
@@ -402,6 +402,9 @@
0, /* movi_d_ww */
4, /* movr_d_w */
12, /* movi_d_w */
+ 20, /* bswapr_us */
+ 52, /* bswapr_ui */
+ 0, /* bswapr_ul */
#endif /* NEW_ABI */
#endif /* __WORDSIZE */
@@ -808,11 +811,14 @@
8, /* movi_d_ww */
0, /* movr_d_w */
0, /* movi_d_w */
+ 20, /* bswapr_us */
+ 52, /* bswapr_ui */
+ 0, /* bswapr_ul */
#endif /* NEW_ABI */
#endif /* __WORDSIZE */
#if __WORDSIZE == 64
-#define JIT_INSTR_MAX 44
+#define JIT_INSTR_MAX 116
0, /* data */
0, /* live */
4, /* align */
@@ -1213,4 +1219,7 @@
0, /* movi_d_ww */
4, /* movr_d_w */
12, /* movi_d_w */
+ 20, /* bswapr_us */
+ 52, /* bswapr_ui */
+ 116, /* bswapr_ul */
#endif /* __WORDSIZE */
generated by cgit v1.2.3 (git 2.39.1) at 2025年09月14日 13:49:50 +0000

AltStyle によって変換されたページ (->オリジナル) /