summaryrefslogtreecommitdiff
path: root/yjit/src/backend
diff options
context:
space:
mode:
authorMaxime Chevalier-Boisvert <[email protected]>2023-07-27 17:47:29 -0400
committerGitHub <[email protected]>2023-07-27 17:47:29 -0400
commit5669a28fde3b767953b5a7d6e63cd8e53f0185eb (patch)
tree9c848ce29d379a94facf3356d16c7113d6f86704 /yjit/src/backend
parent83f9d80c0b0b7752e490abb45145073d8d0e656d (diff)
YJIT: implement missing `asm.jg` instruction in backend (#8130)
YJIT: implement missing jg instruction in backend While trying to implement a specialize integer left shift, I ran into a problem where we have no way to do a greater-than comparison at the moment. Surprising we went this far without ever needing it.
Notes
Notes: Merged-By: maximecb <[email protected]>
Diffstat (limited to 'yjit/src/backend')
-rw-r--r--yjit/src/backend/arm64/mod.rs3
-rw-r--r--yjit/src/backend/ir.rs6
-rw-r--r--yjit/src/backend/x86_64/mod.rs8
3 files changed, 17 insertions, 0 deletions
diff --git a/yjit/src/backend/arm64/mod.rs b/yjit/src/backend/arm64/mod.rs
index 9787b1a4e9..a74e5cf0ff 100644
--- a/yjit/src/backend/arm64/mod.rs
+++ b/yjit/src/backend/arm64/mod.rs
@@ -1079,6 +1079,9 @@ impl Assembler
Insn::Jl(target) => {
emit_conditional_jump::<{Condition::LT}>(cb, compile_side_exit(*target, self, ocb));
},
+ Insn::Jg(target) => {
+ emit_conditional_jump::<{Condition::GT}>(cb, compile_side_exit(*target, self, ocb));
+ },
Insn::Jbe(target) => {
emit_conditional_jump::<{Condition::LS}>(cb, compile_side_exit(*target, self, ocb));
},
diff --git a/yjit/src/backend/ir.rs b/yjit/src/backend/ir.rs
index a28c833e89..72a4bc711b 100644
--- a/yjit/src/backend/ir.rs
+++ b/yjit/src/backend/ir.rs
@@ -432,6 +432,9 @@ pub enum Insn {
/// Jump if lower
Jl(Target),
+ /// Jump if greater
+ Jg(Target),
+
// Unconditional jump to a branch target
Jmp(Target),
@@ -578,6 +581,7 @@ impl Insn {
Insn::Jbe(_) => "Jbe",
Insn::Je(_) => "Je",
Insn::Jl(_) => "Jl",
+ Insn::Jg(_) => "Jg",
Insn::Jmp(_) => "Jmp",
Insn::JmpOpnd(_) => "JmpOpnd",
Insn::Jne(_) => "Jne",
@@ -725,6 +729,7 @@ impl<'a> Iterator for InsnOpndIterator<'a> {
Insn::Jbe(_) |
Insn::Je(_) |
Insn::Jl(_) |
+ Insn::Jg(_) |
Insn::Jmp(_) |
Insn::Jne(_) |
Insn::Jnz(_) |
@@ -822,6 +827,7 @@ impl<'a> InsnOpndMutIterator<'a> {
Insn::Jbe(_) |
Insn::Je(_) |
Insn::Jl(_) |
+ Insn::Jg(_) |
Insn::Jmp(_) |
Insn::Jne(_) |
Insn::Jnz(_) |
diff --git a/yjit/src/backend/x86_64/mod.rs b/yjit/src/backend/x86_64/mod.rs
index b40d8b2382..0cc276fca1 100644
--- a/yjit/src/backend/x86_64/mod.rs
+++ b/yjit/src/backend/x86_64/mod.rs
@@ -673,6 +673,14 @@ impl Assembler
}
},
+ Insn::Jg(target) => {
+ match compile_side_exit(*target, self, ocb) {
+ Target::CodePtr(code_ptr) | Target::SideExitPtr(code_ptr) => jg_ptr(cb, code_ptr),
+ Target::Label(label_idx) => jg_label(cb, label_idx),
+ Target::SideExit { .. } => unreachable!("Target::SideExit should have been compiled by compile_side_exit"),
+ }
+ },
+
Insn::Jbe(target) => {
match compile_side_exit(*target, self, ocb) {
Target::CodePtr(code_ptr) | Target::SideExitPtr(code_ptr) => jbe_ptr(cb, code_ptr),