V850 BranchLessThen incorrect behavior #7190
Labels
Feature: Processor/v850
Status: Triage
Information is being gathered
Type: Bug
Something isn't working
Describe the bug
Decompiler produces a weird code for sequence
SXB CMP BLT
(sign extend byte, compare, branch if less than).Perhaps it was a simple loop with a
int8_t
counter.To Reproduce
Expected behavior
The inner loop is just a
do { .... } while (iVar6 < 8);
if I'm reading assembler correctly.Assembler:
Actual decompiled code:
I tried to find the bug, but it looks like both
CMP
andBLT
instructions written as described in the spec.Also I have checked other combinations, and sometimes it works a bit better:
ADDI loopLength, loopCounter, 0; BLT
makesdo { ... } while (iVar1 < 0 != SCARRY(iVar3, loopLength)
(see the second .hex sample)Environment (please complete the following information):
Additional context
original code, save it as .hex file
And this one decompiled bit better
The text was updated successfully, but these errors were encountered: