Skip to content

Commit 82e2765

Browse files
committed
add GT condition for JUMPS
1 parent a3b84c3 commit 82e2765

File tree

2 files changed

+10
-4
lines changed

2 files changed

+10
-4
lines changed

esp32_ulp/opcodes.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -698,9 +698,13 @@ def i_jumps(offset, threshold, condition):
698698
cmp_op = BRCOND_LE
699699
elif condition == 'ge':
700700
cmp_op = BRCOND_GE
701-
elif condition == 'eq': # eq == le but not lt
702-
skip_cond = BRCOND_LT
703-
jump_cond = BRCOND_LE
701+
elif condition in ('eq', 'gt'):
702+
if condition == 'eq': # eq == le but not lt
703+
skip_cond = BRCOND_LT
704+
jump_cond = BRCOND_LE
705+
elif condition == 'gt': # gt == ge but not le
706+
skip_cond = BRCOND_LE
707+
jump_cond = BRCOND_GE
704708

705709
# jump over next JUMPS
706710
skip_ins = _jump_rels(threshold, skip_cond, 2)
@@ -718,7 +722,7 @@ def no_of_instr(opcode, args):
718722
if opcode == 'jumpr' and get_cond(args[2]) == 'eq':
719723
return 2
720724

721-
if opcode == 'jumps' and get_cond(args[2]) == 'eq':
725+
if opcode == 'jumps' and get_cond(args[2]) in ('eq', 'gt'):
722726
return 2
723727

724728
return 1

tests/compat/jumps.S

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ entry:
1212
jumps later, 42, ge
1313
jumps entry, 42, eq
1414
jumps later, 42, eq
15+
jumps entry, 42, gt
16+
jumps later, 42, gt
1517

1618
jumpr entry, 42, lt
1719
jumpr later, 42, lt

0 commit comments

Comments
 (0)