Hello,
we are developing a diagnostic module for this processor in which we are testing all the core instructions. These tests are coded directly in assembly language in C functions using HIL. The problem is that the compiler optimizes some instructions by replacing them with others. For example:
449: cpuBHS:
450: ; BHS: Branch if Higher or Same
451: ; A = 0x55
452: cmp #0x56
007c a156 [2] CMP #86
453: bhs cpuEr ; Should never branch
007e 247f [3] BCC LFF ;abs = 00ff
454: cmp #CORETESTCFG_LOGIC_VAL1
0080 a155 [2] CMP #85
455: bhs cpuBHS2 ; Should branch
0082 2402 [3] BCC L86 ;abs = 0086
0084 L84:
456: bra cpuEr ; Go fail
0084 2079 [3] BRA LFF ;abs = 00ff
0086 L86:
457: cpuBHS2:
458: cmp #0x54
0086 a154 [2] CMP #84
459: bhs cpuBLE ; Should branch
0088 2402 [3] BCC L8C ;abs = 008c
008a L8A:
460: bra cpuEr ; Go fail
008a 2073 [3] BRA LFF ;abs = 00ff
008c L8C:
We want to test the BHS instruction but the compiler uses BCC instead. The only relevant compiler options that we use are -Onf and -OnB=b.
Is there a way to solve this problem ?
Thanks in advance for any help,
Matteo
BCC is the same as BHS
BCS is the same as BLO
You can check the actual opcodes in the manual.
Thank you very much, I will check the opcodes on the manual.
Matteo
Brash when higher or same and branch if carry is clear have identical opcodes, no optimization takes place.
Not only BHS = BCC, but also BLO = BCS.