Skip to contentSkip to conversation

target-tilegx: Finish decoding the first TB block.

PATCH In review Chen Gang S 3 participants 9 messages Feb 21, 2015 – Feb 22, 2015

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 target-tilegx: Finish decoding the first TB block.

At present finish decoding the first TB block: _start. Always let y1 and x1 pipe at the last which may content jump instructions.

The related disassembly code is below which is the same as the objdump:

  y0: 00000000500bfdb4  move r52, r54
  y2: 0208000007600000  ld r1, r54
  y1: 1c06400000000000  fnop
  x0: 0000000051483000  fnop
  x1: 180f86c600000000  addi r12, r54, -16
  x0: 00000000403f8336  andi r54, r12, -8
  x1: 286af00680000000  lnk r13
  y0: 00000000500bf005  move r5, r0
  y2: 03f8000007600000  st r54, r63
  y1: 040046c600000000  addi r12, r54, 8
  y0: 00000000500bfff7  move r55, r63
  y2: 03f8000004c00000  st r12, r63
  y1: 0400468100000000  addi r2, r52, 8
  x0: 0000000040110d86  addi r6, r54, 16
  x1: 07ffffe000000000  moveli r0, -1
  x0: 000000007ffff000  shl16insli r0, r0, -1
  x1: 000007e180000000  moveli r3, 0
  x0: 000000007ffa8000  shl16insli r0, r0, -88
  x1: 3800006180000000  shl16insli r3, r3, 0
  x0: 00000000500cd000  and r0, r0, r13
  x1: 3877406180000000  shl16insli r3, r3, 3816
  x0: 0000000010000fcc  moveli r12, 0
  x1: 2806686180000000  add r3, r3, r13
  x0: 000000007000030c  shl16insli r12, r12, 0
  x1: 000007e200000000  moveli r4, 0
  x0: 000000007039030c  shl16insli r12, r12, 912
  x1: 3800008200000000  shl16insli r4, r4, 0
  x0: 00000000500cd30c  and r12, r12, r13
  x1: 3881808200000000  shl16insli r4, r4, 4144
  x0: 00000000500cd104  and r4, r4, r13
  x1: 286a718000000000  jr r12
---
 target-tilegx/cpu-qom.h   |   2 +
 target-tilegx/cpu.c       |   4 -
 target-tilegx/cpu.h       |   1 +
 target-tilegx/translate.c | 437 +++++++++++++++++++++++++++++++++++++++++++++-
 4 files changed, 433 insertions(+), 11 deletions(-)
target-tilegx/cpu-qom.h +2 -0
index e15a8b8..866a77d 100644
@@ -69,4 +69,6 @@ static inline TilegxCPU *tilegx_env_get_cpu(CPUTLState *env)
 
 #define ENV_GET_CPU(e) CPU(tilegx_env_get_cpu(e))
 
+#define ENV_OFFSET offsetof(TilegxCPU, env)
+
 #endif
target-tilegx/cpu.c +0 -4
index 3dd66b5..a10cc24 100644
@@ -69,10 +69,6 @@ static void tilegx_cpu_realizefn(DeviceState *dev, Error **errp)
     mcc->parent_realize(dev, errp);
 }
 
-static void tilegx_tcg_init(void)
-{
-}
-
 static void tilegx_cpu_initfn(Object *obj)
 {
     CPUState *cs = CPU(obj);
target-tilegx/cpu.h +1 -0
index 09a2b26..439c14f 100644
@@ -54,6 +54,7 @@ typedef struct CPUTLState {
 
 #include "exec/cpu-all.h"
 
+void tilegx_tcg_init(void);
 int cpu_tilegx_exec(CPUTLState *s);
 int cpu_tilegx_signal_handler(int host_signum, void *pinfo, void *puc);
 
target-tilegx/translate.c +430 -7

447 lines not on this page · raw message

Signature · 1 line
1.9.3
#1 lore raw
Quoted 28 lines · Chen Gang S

At present finish decoding the first TB block: _start. Always let y1 and x1 pipe at the last which may content jump instructions.

The related disassembly code is below which is the same as the objdump:

  y0: 00000000500bfdb4  move r52, r54
  y2: 0208000007600000  ld r1, r54
  y1: 1c06400000000000  fnop
  x0: 0000000051483000  fnop
  x1: 180f86c600000000  addi r12, r54, -16
  x0: 00000000403f8336  andi r54, r12, -8
  x1: 286af00680000000  lnk r13
  y0: 00000000500bf005  move r5, r0
  y2: 03f8000007600000  st r54, r63
  y1: 040046c600000000  addi r12, r54, 8
  y0: 00000000500bfff7  move r55, r63
  y2: 03f8000004c00000  st r12, r63
  y1: 0400468100000000  addi r2, r52, 8
  x0: 0000000040110d86  addi r6, r54, 16
  x1: 07ffffe000000000  moveli r0, -1
  x0: 000000007ffff000  shl16insli r0, r0, -1
  x1: 000007e180000000  moveli r3, 0
  x0: 000000007ffa8000  shl16insli r0, r0, -88
  x1: 3800006180000000  shl16insli r3, r3, 0
  x0: 00000000500cd000  and r0, r0, r13
  x1: 3877406180000000  shl16insli r3, r3, 3816
  x0: 0000000010000fcc  moveli r12, 0
  x1: 2806686180000000  add r3, r3, r13
Quoted 9 lines
  x0: 000000007000030c  shl16insli r12, r12, 0
  x1: 000007e200000000  moveli r4, 0
  x0: 000000007039030c  shl16insli r12, r12, 912
  x1: 3800008200000000  shl16insli r4, r4, 0
  x0: 00000000500cd30c  and r12, r12, r13
  x1: 3881808200000000  shl16insli r4, r4, 4144
  x0: 00000000500cd104  and r4, r4, r13
  x1: 286a718000000000  jr r12

Oh, sorry, it has no 'and' operation, it should be 'add' (3 places need be modified). It is a printing typo issue.

[...]

target-tilegx/translate.c line 154

Quoted 8 lines
target-tilegx/translate.c +8 -0
+    case 0x0000000050000000ULL:
+        switch (TILEGX_CODE_X0_18(bundle)) {
+        /* add Dest, SrcA, SrcB */
+        case 0x00000000000c0000ULL:
+            rdest = (unsigned char)(bundle & TILEGX_DATA_REGISTER);
+            rsrc = (unsigned char)((bundle >> 6) & TILEGX_DATA_REGISTER);
+            rsrcb = (unsigned char)((bundle >> 12) & TILEGX_DATA_REGISTER);
+            qemu_log("and r%d, r%d, r%d", rdest, rsrc, rsrcb);

It should be print "add", not "and".

Thanks.

Signature · 3 lines
Chen Gang

Open, share, and attitude like air, water, and life which God blessed
#2 lore raw

Oh, we can not only assume y1 and x1 is the last execution in a bundle, e.g. in __libc_start_main:

   11330:       c6f106c685928d8a        { addi r10, sp, 40 ; addi r13, sp, 32 ; st r25, r30 }
   11338:       2862014010000fca        { moveli r10, 0 ; st r10, r0 }

In this case, r10 will be over written. I have to use tcg temporary variables for it in each bundle:

- We can still use the original pipes order: "y0, y2, y1" and "x0, x1".

- y0, y2, and x0 need to use tcg temporary variables, but y1 and x1 can still use real variables.

- y1 and x1 need to flush the temporary variables, they also need to consider about jump cases for tcg code (flush tcg temporary variables after comparing and before jump).

Welcome any ideas, suggestions or completions.

Thanks.

Quoted 56 lines · Chen Gang S
Quoted 28 lines · Chen Gang S

At present finish decoding the first TB block: _start. Always let y1 and x1 pipe at the last which may content jump instructions.

The related disassembly code is below which is the same as the objdump:

  y0: 00000000500bfdb4  move r52, r54
  y2: 0208000007600000  ld r1, r54
  y1: 1c06400000000000  fnop
  x0: 0000000051483000  fnop
  x1: 180f86c600000000  addi r12, r54, -16
  x0: 00000000403f8336  andi r54, r12, -8
  x1: 286af00680000000  lnk r13
  y0: 00000000500bf005  move r5, r0
  y2: 03f8000007600000  st r54, r63
  y1: 040046c600000000  addi r12, r54, 8
  y0: 00000000500bfff7  move r55, r63
  y2: 03f8000004c00000  st r12, r63
  y1: 0400468100000000  addi r2, r52, 8
  x0: 0000000040110d86  addi r6, r54, 16
  x1: 07ffffe000000000  moveli r0, -1
  x0: 000000007ffff000  shl16insli r0, r0, -1
  x1: 000007e180000000  moveli r3, 0
  x0: 000000007ffa8000  shl16insli r0, r0, -88
  x1: 3800006180000000  shl16insli r3, r3, 0
  x0: 00000000500cd000  and r0, r0, r13
  x1: 3877406180000000  shl16insli r3, r3, 3816
  x0: 0000000010000fcc  moveli r12, 0
  x1: 2806686180000000  add r3, r3, r13
Quoted 9 lines
  x0: 000000007000030c  shl16insli r12, r12, 0
  x1: 000007e200000000  moveli r4, 0
  x0: 000000007039030c  shl16insli r12, r12, 912
  x1: 3800008200000000  shl16insli r4, r4, 0
  x0: 00000000500cd30c  and r12, r12, r13
  x1: 3881808200000000  shl16insli r4, r4, 4144
  x0: 00000000500cd104  and r4, r4, r13
  x1: 286a718000000000  jr r12

Oh, sorry, it has no 'and' operation, it should be 'add' (3 places need be modified). It is a printing typo issue.

[...]

target-tilegx/translate.c line 154

Quoted 8 lines
target-tilegx/translate.c +8 -0
+    case 0x0000000050000000ULL:
+        switch (TILEGX_CODE_X0_18(bundle)) {
+        /* add Dest, SrcA, SrcB */
+        case 0x00000000000c0000ULL:
+            rdest = (unsigned char)(bundle & TILEGX_DATA_REGISTER);
+            rsrc = (unsigned char)((bundle >> 6) & TILEGX_DATA_REGISTER);
+            rsrcb = (unsigned char)((bundle >> 12) & TILEGX_DATA_REGISTER);
+            qemu_log("and r%d, r%d, r%d", rdest, rsrc, rsrcb);

It should be print "add", not "and".

Thanks.

Signature · 3 lines
Chen Gang

Open, share, and attitude like air, water, and life which God blessed
#3 lore raw

I guess, y2 does not need tcg temporary variables either, since it is only for ld/st operation (all memory operations must be only processed by y2 or x1).

At present, I can generate the tcg code for _start TB block, and can execute to 2nd TB block __libc_start_main (although I don't know whether the execution is correct or not).

But I guess, I have to fix current issue firstly, before continue.

Thanks.

Quoted 82 lines · Chen Gang S

Oh, we can not only assume y1 and x1 is the last execution in a bundle, e.g. in __libc_start_main:

   11330:       c6f106c685928d8a        { addi r10, sp, 40 ; addi r13, sp, 32 ; st r25, r30 }
   11338:       2862014010000fca        { moveli r10, 0 ; st r10, r0 }

In this case, r10 will be over written. I have to use tcg temporary variables for it in each bundle:

- We can still use the original pipes order: "y0, y2, y1" and "x0, x1".

- y0, y2, and x0 need to use tcg temporary variables, but y1 and x1 can still use real variables.

- y1 and x1 need to flush the temporary variables, they also need to consider about jump cases for tcg code (flush tcg temporary variables after comparing and before jump).

Welcome any ideas, suggestions or completions.

Thanks.

Quoted 56 lines · Chen Gang S
Quoted 28 lines · Chen Gang S

At present finish decoding the first TB block: _start. Always let y1 and x1 pipe at the last which may content jump instructions.

The related disassembly code is below which is the same as the objdump:

  y0: 00000000500bfdb4  move r52, r54
  y2: 0208000007600000  ld r1, r54
  y1: 1c06400000000000  fnop
  x0: 0000000051483000  fnop
  x1: 180f86c600000000  addi r12, r54, -16
  x0: 00000000403f8336  andi r54, r12, -8
  x1: 286af00680000000  lnk r13
  y0: 00000000500bf005  move r5, r0
  y2: 03f8000007600000  st r54, r63
  y1: 040046c600000000  addi r12, r54, 8
  y0: 00000000500bfff7  move r55, r63
  y2: 03f8000004c00000  st r12, r63
  y1: 0400468100000000  addi r2, r52, 8
  x0: 0000000040110d86  addi r6, r54, 16
  x1: 07ffffe000000000  moveli r0, -1
  x0: 000000007ffff000  shl16insli r0, r0, -1
  x1: 000007e180000000  moveli r3, 0
  x0: 000000007ffa8000  shl16insli r0, r0, -88
  x1: 3800006180000000  shl16insli r3, r3, 0
  x0: 00000000500cd000  and r0, r0, r13
  x1: 3877406180000000  shl16insli r3, r3, 3816
  x0: 0000000010000fcc  moveli r12, 0
  x1: 2806686180000000  add r3, r3, r13
Quoted 9 lines
  x0: 000000007000030c  shl16insli r12, r12, 0
  x1: 000007e200000000  moveli r4, 0
  x0: 000000007039030c  shl16insli r12, r12, 912
  x1: 3800008200000000  shl16insli r4, r4, 0
  x0: 00000000500cd30c  and r12, r12, r13
  x1: 3881808200000000  shl16insli r4, r4, 4144
  x0: 00000000500cd104  and r4, r4, r13
  x1: 286a718000000000  jr r12

Oh, sorry, it has no 'and' operation, it should be 'add' (3 places need be modified). It is a printing typo issue.

[...]

target-tilegx/translate.c line 154

Quoted 8 lines
target-tilegx/translate.c +8 -0
+    case 0x0000000050000000ULL:
+        switch (TILEGX_CODE_X0_18(bundle)) {
+        /* add Dest, SrcA, SrcB */
+        case 0x00000000000c0000ULL:
+            rdest = (unsigned char)(bundle & TILEGX_DATA_REGISTER);
+            rsrc = (unsigned char)((bundle >> 6) & TILEGX_DATA_REGISTER);
+            rsrcb = (unsigned char)((bundle >> 12) & TILEGX_DATA_REGISTER);
+            qemu_log("and r%d, r%d, r%d", rdest, rsrc, rsrcb);

It should be print "add", not "and".

Thanks.

Signature · 3 lines
Chen Gang

Open, share, and attitude like air, water, and life which God blessed
#4 lore raw
In reply to Chen Gang S
Quoted 9 lines · Chen Gang S

Oh, we can not only assume y1 and x1 is the last execution in a bundle, e.g. in __libc_start_main:

   11330:       c6f106c685928d8a        { addi r10, sp, 40 ; addi r13, sp, 32 ; st r25, r30 }
   11338:       2862014010000fca        { moveli r10, 0 ; st r10, r0 }

In this case, r10 will be over written. I have to use tcg temporary variables for it in each bundle:

Yes.

Quoted 1 line

- We can still use the original pipes order: "y0, y2, y1" and "x0, x1".

I guess, sure, though I don't think that'll help as much as you imagine.

Quoted 2 lines

- y0, y2, and x0 need to use tcg temporary variables, but y1 and x1 can still use real variables.

Possibly, but I wouldn't structure it that way. I'd have all of the pipes write to temporaries.

Quoted 3 lines

- y1 and x1 need to flush the temporary variables, they also need to consider about jump cases for tcg code (flush tcg temporary variables after comparing and before jump).

I wouldn't do that either. I'd have y1/x1 record that a branch occurred, and the condition, but delay the flushing and branching to common code.

For instance:

typedef enum ExitStatus {

    NO_EXIT,         /* Fall through to next bundle */
    EXIT_JUMP,       /* Normal branch exit */
    EXIT_NORETURN    /* Exception taken (e.g. syscall) */

} ExitStatus;

typedef struct DisasContext {
    struct TranslationBlock *tb;
    int mem_idx;

    uint64_t pc;
    ExitStatus exit;

    int result_regs[3];
    TCGv result_vals[3];

    TCGCond branch_cond;
    TCGv branch_dest;
    TCGv branch_val1;
    TCGv branch_val2;
} DisasContext;

static void translate_one_bundle(DisasContext *dc, uint64_t bundle)

{
    int i;

    /* Initialize the per-bundle state of DC.  */
    dc->exit = NO_EXIT;
    for (i = 0; i < 3; ++i) {
        dc->result_regs[i] = -1;
        TCGV_UNUSED_I64(dc->result_vals[i]);
    }
    dc->branch_cond = TCG_COND_NEVER;
    dc->branch_desti = -1;
    TCGV_UNUSED_I64(dc->branch_dest);
    TCGV_UNUSED_I64(dc->branch_val1);
    TCGV_UNUSED_I64(dc->branch_val2);

    /* Decode all pipes, writing results into DC.  */

    /* If some pipe raises an exception, nothing left to do.  */
    if (dc->exit == EXIT_NORETURN) {
        return;
    }

    /* Write back register results from all pipes.  */
    for (i = 0; i < 3; ++i) {
        int r = dc->result_regs[i];
        if (r >= 0)
            tcg_gen_mov_i64(cpu_regs[r], dc->result_vals[i]);
            tcg_temp_free_i64(dc->result_vals[i]);
        }
    }

    /* Write back branch results, i.e. take the branch now.  */
    if (dc->branch_cond != TCG_COND_NEVER) {
        if (dc->branch_cond == TCG_COND_ALWAYS) {
            /* Unconditional branch */
            tcg_gen_mov_i64(cpu_pc, dc->branch_dest);
        } else {
            /* Conditional branch */
            TCGv next_pc = tcg_const_i64(dc->pc + 8);
            tcg_gen_movcond_i64(dc->branch_cond, cpu_pc,
                                dc->branch_val1, dc->branch_val2,
                                dc->branch_dest, next_pc);
            tcg_temp_free_i64(dc->branch_val1);
            tcg_temp_free_i64(dc->branch_val2);
            tcg_temp_free_i64(next_pc);
        }
        tcg_temp_free_i64(dc->branch_dest);
        dc->exit = EXIT_JUMP;
    }
}

This mostly ignores the use of tcg_gen_goto_tb for now. It's slightly more complicated to use, and it makes debugging execution traces a bit harder. Neither of which do you really want while bringing up the decoder. However, the eventual use of goto_tb is why we want to delay performing the branch until after writing back the registers, rather than simply writing to cpu_pc right away.

I hope this is enough to get started properly.

r~

#5 lore raw
Quoted 12 lines · Richard Henderson
Quoted 2 lines · Chen Gang S

- We can still use the original pipes order: "y0, y2, y1" and "x0, x1".

I guess, sure, though I don't think that'll help as much as you imagine.

Quoted 2 lines

- y0, y2, and x0 need to use tcg temporary variables, but y1 and x1 can still use real variables.

Possibly, but I wouldn't structure it that way. I'd have all of the pipes write to temporaries.

Quoted 7 lines
Quoted 3 lines

- y1 and x1 need to flush the temporary variables, they also need to consider about jump cases for tcg code (flush tcg temporary variables after comparing and before jump).

I wouldn't do that either. I'd have y1/x1 record that a branch occurred, and the condition, but delay the flushing and branching to common code.

OK, thanks. For me, your idea is OK, it is more simpler (although with more tcg temporary variables).

At present, the performance is not quite important, so I shall implement the translation with the way which you provide below, thanks.

Quoted 2 lines

For instance:

The demo code below is much valuable to me, but I guess, it can be improved too (the related reply is below):

Quoted 24 lines

typedef enum ExitStatus {

    NO_EXIT,         /* Fall through to next bundle */
    EXIT_JUMP,       /* Normal branch exit */
    EXIT_NORETURN    /* Exception taken (e.g. syscall) */

} ExitStatus;

typedef struct DisasContext {
    struct TranslationBlock *tb;
    int mem_idx;

    uint64_t pc;
    ExitStatus exit;

    int result_regs[3];
    TCGv result_vals[3];

    TCGCond branch_cond;
    TCGv branch_dest;
    TCGv branch_val1;
    TCGv branch_val2;
} DisasContext;

static void translate_one_bundle(DisasContext *dc, uint64_t bundle)

Quoted 11 lines
{
    int i;

    /* Initialize the per-bundle state of DC.  */
    dc->exit = NO_EXIT;
    for (i = 0; i < 3; ++i) {
        dc->result_regs[i] = -1;
        TCGV_UNUSED_I64(dc->result_vals[i]);
    }
    dc->branch_cond = TCG_COND_NEVER;
    dc->branch_desti = -1;

It is branch_dest, not branch_desti.

Quoted 29 lines
    TCGV_UNUSED_I64(dc->branch_dest);
    TCGV_UNUSED_I64(dc->branch_val1);
    TCGV_UNUSED_I64(dc->branch_val2);

    /* Decode all pipes, writing results into DC.  */

    /* If some pipe raises an exception, nothing left to do.  */
    if (dc->exit == EXIT_NORETURN) {
        return;
    }

    /* Write back register results from all pipes.  */
    for (i = 0; i < 3; ++i) {
        int r = dc->result_regs[i];
        if (r >= 0)
            tcg_gen_mov_i64(cpu_regs[r], dc->result_vals[i]);
            tcg_temp_free_i64(dc->result_vals[i]);
        }
    }

    /* Write back branch results, i.e. take the branch now.  */
    if (dc->branch_cond != TCG_COND_NEVER) {
        if (dc->branch_cond == TCG_COND_ALWAYS) {
            /* Unconditional branch */
            tcg_gen_mov_i64(cpu_pc, dc->branch_dest);
        } else {
            /* Conditional branch */
            TCGv next_pc = tcg_const_i64(dc->pc + 8);
            tcg_gen_movcond_i64(dc->branch_cond, cpu_pc,
Quoted 8 lines
                                dc->branch_val1, dc->branch_val2,
                                dc->branch_dest, next_pc);
            tcg_temp_free_i64(dc->branch_val1);
            tcg_temp_free_i64(dc->branch_val2);
            tcg_temp_free_i64(next_pc);
        }
        tcg_temp_free_i64(dc->branch_dest);
        dc->exit = EXIT_JUMP;

Do we need tcg_gen_exit_tb(0)? At present for simplify thinking, I always use tcg_gen_exit_tb(0) for the end of one TB block.

Quoted 9 lines
    }
}

This mostly ignores the use of tcg_gen_goto_tb for now. It's slightly more complicated to use, and it makes debugging execution traces a bit harder. Neither of which do you really want while bringing up the decoder. However, the eventual use of goto_tb is why we want to delay performing the branch until after writing back the registers, rather than simply writing to cpu_pc right away.

Excuse me, I am not quite familiar with tcg_gen_goto/exit_tb(), at present, I still don't understand their parameters.

I guess, they are for performance (tb chaining), so I simply only use tcg_gen_exit_tb(0), at present.

Welcome more information about tcg_gen_goto_tb() and tcg_gen_exit_tb().

Quoted 2 lines

I hope this is enough to get started properly.

Yeah, it is really enough.

Thanks.

Signature · 3 lines
Chen Gang

Open, share, and attitude like air, water, and life which God blessed
#6 lore raw
Quoted 10 lines · Chen Gang S
Quoted 7 lines · Richard Henderson
Quoted 6 lines · Chen Gang S
Quoted 2 lines
Quoted 2 lines

- We can still use the original pipes order: "y0, y2, y1" and "x0, x1".

I guess, sure, though I don't think that'll help as much as you imagine.

OK, thanks. For me, your idea is OK, it is more simpler (although with more tcg temporary variables).

Richard pretty much said all I wanted to say, but I just wanted to reinforce that the semantics of the multiple pipes is always "all together". So if you have { move r1, r2; move r2, r1 } then that swaps r1 and r2. Or if you have { ld r1, sp; jrp r1 } then you are restoring r1 but jumping to wherever its previous value said you needed to go. Etc.

Similarly, if any pipeline takes an exception (a TLB fault from a memory op, a GPV fault from an illegal mfspr, etc) then no pipeline completes its action.

Signature · 2 lines
Chris Metcalf, EZChip Semiconductor
http://www.ezchip.com
#7 lore raw
Quoted 6 lines · Chris Metcalf
Quoted 5 lines · Chen Gang S
Quoted 4 lines · Richard Henderson
Quoted 4 lines · Chen Gang S
Quoted 2 lines
Quoted 2 lines

- We can still use the original pipes order: "y0, y2, y1" and "x0, x1".

Quoted 8 lines
Quoted 5 lines
Quoted 3 lines
Quoted 2 lines

I guess, sure, though I don't think that'll help as much as you imagine.

OK, thanks. For me, your idea is OK, it is more simpler (although with more tcg temporary variables).

Richard pretty much said all I wanted to say, but I just wanted to reinforce that the semantics of the multiple pipes is always "all together".

OK, thanks.

Quoted 2 lines

So if you have
{ move r1, r2; move r2, r1 } then that swaps r1 and r2.

So the first pipe must have temporary variable.

Quoted 3 lines

Or if you have
{ ld r1, sp; jrp r1 } then you are restoring r1 but jumping to wherever its previous value said you needed to go. Etc.

Excuse me, I am not quite sure whether ld/st can be in pipe x0, y0, or y1.

But I guess your meaning is that y2 must have temporary variable, or it will cause issue.

Quoted 3 lines

Similarly, if any pipeline takes an exception (a TLB fault from a memory op, a GPV fault from an illegal mfspr, etc) then no pipeline completes its action.

Oh, really !! And I guess, Richard's code can not be sure of it: memory write operand (e.g st) is not buffered. If what I guess is correct, for me, it is not quite easy to fix this issue.

I also guess, at present, we need think of more before continue.

Thanks.

Signature · 3 lines
Chen Gang

Open, share, and attitude like air, water, and life which God blessed
#8 lore raw
Quoted 1 line · Chen Gang S

On 2/22/15 08:25, Chris Metcalf wrote:

[...]

Quoted 10 lines
Quoted 3 lines

Similarly, if any pipeline takes an exception (a TLB fault from a memory op, a GPV fault from an illegal mfspr, etc) then no pipeline completes its action.

Oh, really !! And I guess, Richard's code can not be sure of it: memory write operand (e.g st) is not buffered. If what I guess is correct, for me, it is not quite easy to fix this issue.

I also guess, at present, we need think of more before continue.

Oh, Richard's code is still OK, but always be sure that y2 and x1 must be the last pipe execution of the bundle:

- Execute y0/y1/x0 which will save temporary changing: they are only have effect with registers, have no effect with others (e.g. memory value). Temporary variable can also be for SPR, so y1 is also OK.

- Execute y2/x1, if they fail, just generate exception, then as the result, we can say "the whole bundle is not executed".

- After finish y2/x1, we write back register temporary variables, then write back branch temporary variables.

Thanks.

Signature · 3 lines
Chen Gang

Open, share, and attitude like air, water, and life which God blessed