diff mbox

[13/16] target/xtensa: implement salt/saltu

Message ID 1509767121-26925-14-git-send-email-jcmvbkbc@gmail.com (mailing list archive)
State New, archived
Headers show

Commit Message

Max Filippov Nov. 4, 2017, 3:45 a.m. UTC
SALT/SALTU are recent additions to the core Xtensa ISA that do
signed/unsigned setcond.

Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
---
 target/xtensa/translate.c | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)
diff mbox

Patch

diff --git a/target/xtensa/translate.c b/target/xtensa/translate.c
index f644d9fed22a..da1f712badc7 100644
--- a/target/xtensa/translate.c
+++ b/target/xtensa/translate.c
@@ -2199,6 +2199,16 @@  static void translate_s32e(DisasContext *dc, const uint32_t arg[],
     }
 }
 
+static void translate_salt(DisasContext *dc, const uint32_t arg[],
+                           const uint32_t par[])
+{
+    if (gen_window_check3(dc, arg[0], arg[1], arg[2])) {
+        tcg_gen_setcond_i32(par[0],
+                            cpu_R[arg[0]],
+                            cpu_R[arg[1]], cpu_R[arg[2]]);
+    }
+}
+
 static void translate_sext(DisasContext *dc, const uint32_t arg[],
                            const uint32_t par[])
 {
@@ -3667,6 +3677,14 @@  static const XtensaOpcodeOps core_ops[] = {
         .translate = translate_ldst,
         .par = (const uint32_t[]){MO_UB, false, true},
     }, {
+        .name = "salt",
+        .translate = translate_salt,
+        .par = (const uint32_t[]){TCG_COND_LT},
+    }, {
+        .name = "saltu",
+        .translate = translate_salt,
+        .par = (const uint32_t[]){TCG_COND_LTU},
+    }, {
         .name = "sext",
         .translate = translate_sext,
     }, {