Skip to content

Commit

Permalink
Make clang-format happy
Browse files Browse the repository at this point in the history
Macro IIF sometime confuses clang-format, so that we have to insert
semicolon manually.
  • Loading branch information
jserv committed Mar 2, 2024
1 parent acb06dc commit dfdadc8
Showing 1 changed file with 40 additions and 40 deletions.
80 changes: 40 additions & 40 deletions src/rv32_template.c
Original file line number Diff line number Diff line change
Expand Up @@ -292,46 +292,46 @@ RVOP(
(type) x cond (type) y
/* clang-format on */

#define BRANCH_FUNC(type, cond) \
IIF(RV32_HAS(EXT_C))(, const uint32_t pc = PC;); \
if (BRANCH_COND(type, rv->X[ir->rs1], rv->X[ir->rs2], cond)) { \
is_branch_taken = false; \
struct rv_insn *untaken = ir->branch_untaken; \
if (!untaken) \
goto nextop; \
IIF(RV32_HAS(JIT)) \
({ \
cache_get(rv->block_cache, PC + 4, true); \
if (!set_add(&pc_set, PC + 4)) \
has_loops = true; \
if (cache_hot(rv->block_cache, PC + 4)) \
goto nextop; \
}, ); \
PC += 4; \
last_pc = PC; \
MUST_TAIL return untaken->impl(rv, untaken, cycle, PC); \
} \
is_branch_taken = true; \
PC += ir->imm; \
/* check instruction misaligned */ \
IIF(RV32_HAS(EXT_C)) \
(, RV_EXC_MISALIGN_HANDLER(pc, insn, false, 0);) struct rv_insn *taken = \
ir->branch_taken; \
if (taken) { \
IIF(RV32_HAS(JIT)) \
({ \
cache_get(rv->block_cache, PC, true); \
if (!set_add(&pc_set, PC)) \
has_loops = true; \
if (cache_hot(rv->block_cache, PC)) \
goto end_insn; \
}, ); \
last_pc = PC; \
MUST_TAIL return taken->impl(rv, taken, cycle, PC); \
} \
end_insn: \
rv->csr_cycle = cycle; \
rv->PC = PC; \
#define BRANCH_FUNC(type, cond) \
IIF(RV32_HAS(EXT_C))(, const uint32_t pc = PC;); \
if (BRANCH_COND(type, rv->X[ir->rs1], rv->X[ir->rs2], cond)) { \
is_branch_taken = false; \
struct rv_insn *untaken = ir->branch_untaken; \
if (!untaken) \
goto nextop; \
IIF(RV32_HAS(JIT)) \
({ \
cache_get(rv->block_cache, PC + 4, true); \
if (!set_add(&pc_set, PC + 4)) \
has_loops = true; \
if (cache_hot(rv->block_cache, PC + 4)) \
goto nextop; \
}, ); \
PC += 4; \
last_pc = PC; \
MUST_TAIL return untaken->impl(rv, untaken, cycle, PC); \
} \
is_branch_taken = true; \
PC += ir->imm; \
/* check instruction misaligned */ \
IIF(RV32_HAS(EXT_C)) \
(, RV_EXC_MISALIGN_HANDLER(pc, insn, false, 0);); \
struct rv_insn *taken = ir->branch_taken; \
if (taken) { \
IIF(RV32_HAS(JIT)) \
({ \
cache_get(rv->block_cache, PC, true); \
if (!set_add(&pc_set, PC)) \
has_loops = true; \
if (cache_hot(rv->block_cache, PC)) \
goto end_insn; \
}, ); \
last_pc = PC; \
MUST_TAIL return taken->impl(rv, taken, cycle, PC); \
} \
end_insn: \
rv->csr_cycle = cycle; \
rv->PC = PC; \
return true;

/* In RV32I and RV64I, if the branch is taken, set pc = pc + offset, where
Expand Down

1 comment on commit dfdadc8

@jserv
Copy link
Contributor Author

@jserv jserv commented on dfdadc8 Mar 2, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Benchmarks

Benchmark suite Current: dfdadc8 Previous: acb06dc Ratio
Dhrystone 1572 Average DMIPS over 10 runs 1596 Average DMIPS over 10 runs 1.02
Coremark 1500.847 Average iterations/sec over 10 runs 1486.308 Average iterations/sec over 10 runs 0.99

This comment was automatically generated by workflow using github-action-benchmark.

Please sign in to comment.