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-cpu.c
diff options
context:
space:
mode:
authorpcpa <paulo.cesar.pereira.de.andrade@gmail.com>2023年03月20日 17:52:16 -0300
committerpcpa <paulo.cesar.pereira.de.andrade@gmail.com>2023年03月20日 17:52:16 -0300
commit5041f8326b49b88aa1f982787de96c154ccf4da3 (patch)
treeee08a4c9a9fcb481fbb879825f64c57394f6bd74 /lib/jit_mips-cpu.c
parentd3d2c1a43245c6829593f4055eda1a54dfd040f5 (diff)
downloadlightning-5041f8326b49b88aa1f982787de96c154ccf4da3.tar.gz
Minor optimization to jit_extr.
Most backends do not check for a 0 (or wordsize) shift. Make sure to test it to avoid a nop, or possibly undefined behavior.
Diffstat (limited to 'lib/jit_mips-cpu.c')
-rw-r--r--lib/jit_mips-cpu.c 8
1 files changed, 6 insertions, 2 deletions
diff --git a/lib/jit_mips-cpu.c b/lib/jit_mips-cpu.c
index 569a009..ce364f2 100644
--- a/lib/jit_mips-cpu.c
+++ b/lib/jit_mips-cpu.c
@@ -2954,8 +2954,12 @@ _extr(jit_state_t *_jit,
# if __BYTE_ORDER == __BIG_ENDIAN
i0 = __WORDSIZE - (i0 + i1);
# endif
- lshi(r0, r1, __WORDSIZE - (i0 + i1));
- rshi(r0, r0, __WORDSIZE - i1);
+ if (__WORDSIZE - (i0 + i1)) {
+ lshi(r0, r1, __WORDSIZE - (i0 + i1));
+ rshi(r0, r0, __WORDSIZE - i1);
+ }
+ else
+ rshi(r0, r1, __WORDSIZE - i1);
}
}
generated by cgit v1.2.3 (git 2.25.1) at 2025年09月10日 23:50:46 +0000

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