Skip to contentSkip to conversation

target-tricore: Added new JNE instruction variant

PATCH In review [email protected] 2 participants 2 messages May 31, 2016

lore
Share & tools
lore
#0 lore raw

PATCH v2 4/4 target-tricore: Added new JNE instruction variant

From: Peer Adelt <[email protected]>

If D[15] is != sign_ext(const4) then PC will be set to (PC + zero_ext(disp4 + 16)).

---
 target-tricore/translate.c       | 11 +++++++++++
 target-tricore/tricore-opcodes.h |  1 +
 2 files changed, 12 insertions(+)
target-tricore/translate.c +11 -0
index 960ee33..21732f8 100644
@@ -3363,6 +3363,7 @@ static void gen_compute_branch(DisasContext *ctx, uint32_t opc, int r1,
         gen_branch_condi(ctx, TCG_COND_EQ, cpu_gpr_d[15], constant, offset);
         break;
     case OPC1_16_SBC_JNE:
+    case OPC1_16_SBC_JNE16:
         gen_branch_condi(ctx, TCG_COND_NE, cpu_gpr_d[15], constant, offset);
         break;
 /* SBRN-format jumps */
@@ -4097,6 +4098,16 @@ static void decode_16Bit_opc(CPUTriCoreState *env, DisasContext *ctx)
         const16 = MASK_OP_SBC_CONST4_SEXT(ctx->opcode);
         gen_compute_branch(ctx, op1, 0, 0, const16, address);
         break;
+    case OPC1_16_SBC_JEQ16:
+    case OPC1_16_SBC_JNE16:
+        if (tricore_feature(env, TRICORE_FEATURE_16)) {
+            address = MASK_OP_SBC_DISP4(ctx->opcode);
+            const16 = MASK_OP_SBC_CONST4_SEXT(ctx->opcode);
+            gen_compute_branch(ctx, op1, 0, 0, const16, address + 16);
+        } else {
+            generate_trap(ctx, TRAPC_INSN_ERR, TIN2_IOPC);
+        }
+        break;
 /* SBRN-format */
     case OPC1_16_SBRN_JNZ_T:
     case OPC1_16_SBRN_JZ_T:
target-tricore/tricore-opcodes.h +1 -0
index 2f25613..7925354 100644
@@ -318,6 +318,7 @@ enum {
     OPC1_16_SBR_JLEZ                                 = 0x8e,
     OPC1_16_SBR_JLTZ                                 = 0x0e,
     OPC1_16_SBC_JNE                                  = 0x5e,
+    OPC1_16_SBC_JNE16                                = 0xde,
     OPC1_16_SBR_JNE                                  = 0x7e,
     OPC1_16_SB_JNZ                                   = 0xee,
     OPC1_16_SBR_JNZ                                  = 0xf6,
Signature · 1 line
2.7.4
#1 lore raw
Quoted 24 lines · On 05/31/2016 07:49 AM, [email protected] wrote:

From: Peer Adelt <[email protected]>

If D[15] is != sign_ext(const4) then PC will be set to (PC + zero_ext(disp4 + 16)).

---
 target-tricore/translate.c       | 11 +++++++++++
 target-tricore/tricore-opcodes.h |  1 +
 2 files changed, 12 insertions(+)
target-tricore/translate.c +1 -0
index 960ee33..21732f8 100644
@@ -3363,6 +3363,7 @@ static void gen_compute_branch(DisasContext *ctx, uint32_t opc, int r1,
         gen_branch_condi(ctx, TCG_COND_EQ, cpu_gpr_d[15], constant, offset);
         break;
     case OPC1_16_SBC_JNE:
+    case OPC1_16_SBC_JNE16:
         gen_branch_condi(ctx, TCG_COND_NE, cpu_gpr_d[15], constant, offset);
         break;
 /* SBRN-format jumps */

target-tricore/translate.c static void decode_16Bit_opc(CPUTriCoreState *env, DisasContext *ctx) · line 4101

Quoted 4 lines
target-tricore/translate.c +1 -0
@@ -4097,6 +4098,16 @@ static void decode_16Bit_opc(CPUTriCoreState *env, DisasContext *ctx)
         const16 = MASK_OP_SBC_CONST4_SEXT(ctx->opcode);
         gen_compute_branch(ctx, op1, 0, 0, const16, address);
         break;
+    case OPC1_16_SBC_JEQ16:

This doesn't compile since OPC1_16_SBC_JEQ16 is not defined. Remove this or better implement JEQ16 as well since both insn are similar.

Also, if you resend a patches always resend the whole series and add the reviewed-by tags to the commit messages of already reviewed patches.

Cheers,
Bastian