t-crest / patmos

Patmos is a time-predictable VLIW processor, and the processor for the T-CREST project
http://patmos.compute.dtu.dk
BSD 2-Clause "Simplified" License
133 stars 72 forks source link

`brcf`, `brcfnd` documentation doesn't match LLVM implementation #77

Open Emoun opened 3 years ago

Emoun commented 3 years ago

The handbook documentation around the brcf and brcfnd says that these instructions use the formats CFLi (immediate operand) and CFLrt (two register operands). However, for inline assembly giving them two registers will throw an error:

<inline asm>:35:16: error: invalid operand for instruction or syntax mismatch
        brcfnd  $r1,  $r10
<inline asm>:36:16: error: invalid operand for instruction or syntax mismatch
        brcf    $r12, $r12

while giving them only 1 register operand (matching CFLrs format) will compile with no issue and even be accepted by patmos-llvm-objdump as a valid instruction.

So, is the documentation wrong, or is it the implementation? If the documentation is wrong, is the CFLrt format used by any instructions (no other instructions are in the handbook.) If the implementation is wrong, what would the semantics of the CFLrt formats be?

Emoun commented 3 years ago

@schoeberl can you look into this?

Emoun commented 1 year ago

@schoeberl what is your opinion on this one? Should I just correct the handbook to fit?

Emoun commented 1 year ago

Looking into the compiler's code, I can see that there is a format specified as CFLrt and used by 8 branch types: BRCFR(ND)u, BRCFR(ND), BRCFT(ND)u, BRCFT(ND).