[前][次][番号順一覧][スレッド一覧]

ruby-changes:73218

From: Maxime <ko1@a...>
Date: Tue, 30 Aug 2022 01:03:01 +0900 (JST)
Subject: [ruby-changes:73218] e9f9b8f43b (master): Fix bug with opt_lt, csel on x86

https://git.ruby-lang.org/ruby.git/commit/?id=e9f9b8f43b

From e9f9b8f43b2afdc437ab1b8ab883bab0525a3f43 Mon Sep 17 00:00:00 2001
From: Maxime Chevalier-Boisvert <maxime.chevalierboisvert@s...>
Date: Fri, 22 Jul 2022 12:01:24 -0400
Subject: Fix bug with opt_lt, csel on x86

---
 yjit/src/backend/x86_64/mod.rs | 32 ++++++++++++++++----------------
 yjit/src/codegen.rs            |  2 +-
 2 files changed, 17 insertions(+), 17 deletions(-)

diff --git a/yjit/src/backend/x86_64/mod.rs b/yjit/src/backend/x86_64/mod.rs
index 3140c86b2e..7b84e62134 100644
--- a/yjit/src/backend/x86_64/mod.rs
+++ b/yjit/src/backend/x86_64/mod.rs
@@ -418,36 +418,36 @@ impl Assembler https://github.com/ruby/ruby/blob/trunk/yjit/src/backend/x86_64/mod.rs#L418
                 Op::Breakpoint => int3(cb),
 
                 Op::CSelZ => {
-                    mov(cb, insn.out.into(), insn.opnds[1].into());
-                    cmovz(cb, insn.out.into(), insn.opnds[0].into());
+                    mov(cb, insn.out.into(), insn.opnds[0].into());
+                    cmovnz(cb, insn.out.into(), insn.opnds[1].into());
                 },
                 Op::CSelNZ => {
-                    mov(cb, insn.out.into(), insn.opnds[1].into());
-                    cmovnz(cb, insn.out.into(), insn.opnds[0].into());
+                    mov(cb, insn.out.into(), insn.opnds[0].into());
+                    cmovz(cb, insn.out.into(), insn.opnds[1].into());
                 },
                 Op::CSelE => {
-                    mov(cb, insn.out.into(), insn.opnds[1].into());
-                    cmove(cb, insn.out.into(), insn.opnds[0].into());
+                    mov(cb, insn.out.into(), insn.opnds[0].into());
+                    cmovne(cb, insn.out.into(), insn.opnds[1].into());
                 },
                 Op::CSelNE => {
-                    mov(cb, insn.out.into(), insn.opnds[1].into());
-                    cmovne(cb, insn.out.into(), insn.opnds[0].into());
+                    mov(cb, insn.out.into(), insn.opnds[0].into());
+                    cmove(cb, insn.out.into(), insn.opnds[1].into());
                 },
                 Op::CSelL => {
-                    mov(cb, insn.out.into(), insn.opnds[1].into());
-                    cmovl(cb, insn.out.into(), insn.opnds[0].into());
+                    mov(cb, insn.out.into(), insn.opnds[0].into());
+                    cmovge(cb, insn.out.into(), insn.opnds[1].into());
                 },
                 Op::CSelLE => {
-                    mov(cb, insn.out.into(), insn.opnds[1].into());
-                    cmovle(cb, insn.out.into(), insn.opnds[0].into());
+                    mov(cb, insn.out.into(), insn.opnds[0].into());
+                    cmovg(cb, insn.out.into(), insn.opnds[1].into());
                 },
                 Op::CSelG => {
-                    mov(cb, insn.out.into(), insn.opnds[1].into());
-                    cmovg(cb, insn.out.into(), insn.opnds[0].into());
+                    mov(cb, insn.out.into(), insn.opnds[0].into());
+                    cmovle(cb, insn.out.into(), insn.opnds[1].into());
                 },
                 Op::CSelGE => {
-                    mov(cb, insn.out.into(), insn.opnds[1].into());
-                    cmovge(cb, insn.out.into(), insn.opnds[0].into());
+                    mov(cb, insn.out.into(), insn.opnds[0].into());
+                    cmovl(cb, insn.out.into(), insn.opnds[1].into());
                 },
 
                 // We want to keep the panic here because some instructions that
diff --git a/yjit/src/codegen.rs b/yjit/src/codegen.rs
index a1fd4df35d..9f39c77bb6 100644
--- a/yjit/src/codegen.rs
+++ b/yjit/src/codegen.rs
@@ -5990,7 +5990,7 @@ fn get_gen_fn(opcode: VALUE) -> Option<InsnGenFn> { https://github.com/ruby/ruby/blob/trunk/yjit/src/codegen.rs#L5990
         YARVINSN_newarray => Some(gen_newarray),
         //YARVINSN_duparray => Some(gen_duparray),
         //YARVINSN_checktype => Some(gen_checktype),
-        //YARVINSN_opt_lt => Some(gen_opt_lt),
+        YARVINSN_opt_lt => Some(gen_opt_lt),
         /*
         YARVINSN_opt_le => Some(gen_opt_le),
         YARVINSN_opt_gt => Some(gen_opt_gt),
-- 
cgit v1.2.1


--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]