Add conditional move opcodes - 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_x86.c
diff options
context:
space:
mode:
authorPaul Cercueil <paul@crapouillou.net>2022年02月07日 13:13:38 +0000
committerpcpa <paulo.cesar.pereira.de.andrade@gmail.com>2022年05月12日 23:30:10 -0300
commit82fa69dc1d227e04c1241c2b4990e92b892a5613 (patch)
treef601c598c10ae62dc3def45b27caeb23a400753b /lib/jit_x86.c
parent1f34acbd216a2775c46f2c46c38d657c4d9d0d79 (diff)
downloadlightning-82fa69dc1d227e04c1241c2b4990e92b892a5613.tar.gz
Add conditional move opcodes
Add jit_movnr(r0, r1, r2) and jit_movzr(r0, r1, r2). jit_movnr() corresponds to the following operation: r0 = r2 ? r1 : r0 jit_movzr() corresponds to the following operation: r0 = r2 ? r0 : r1 Add implementations for x86/x86_64, MIPS, PowerPC, ARM and Aarch64. The x86 implementation uses the CMOV feature, which was added in i686. I don't think anybody will try to run Lightning on anything more ancient, so this should be fine. Otherwise, a simple implementation based on branches can be added later. This could be used as well for architectures that lack conditional moves, like it's currently done on PowerPC for instance. Signed-off-by: Paul Cercueil <paul@crapouillou.net>
Diffstat (limited to 'lib/jit_x86.c')
-rw-r--r--lib/jit_x86.c 2
1 files changed, 2 insertions, 0 deletions
diff --git a/lib/jit_x86.c b/lib/jit_x86.c
index 7dd900e..133ee39 100644
--- a/lib/jit_x86.c
+++ b/lib/jit_x86.c
@@ -1674,6 +1674,8 @@ _emit_code(jit_state_t *_jit)
case_rrw(gt, _u);
case_rrr(ne,);
case_rrw(ne,);
+ case_rrr(movn,);
+ case_rrr(movz,);
case_rr(mov,);
case jit_code_movi:
if (node->flag & jit_flag_node) {
generated by cgit v1.2.3 (git 2.39.1) at 2025年09月25日 15:06:40 +0000

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