diff --git a/gas/testsuite/gas/esp32ulp/esp32/compare/esp32ulp_all.bin b/gas/testsuite/gas/esp32ulp/esp32/compare/esp32ulp_all.bin index 6842dd8233..534d875bd1 100755 Binary files a/gas/testsuite/gas/esp32ulp/esp32/compare/esp32ulp_all.bin and b/gas/testsuite/gas/esp32ulp/esp32/compare/esp32ulp_all.bin differ diff --git a/gas/testsuite/gas/esp32ulp/esp32/compare/esp32ulp_all.lst b/gas/testsuite/gas/esp32ulp/esp32/compare/esp32ulp_all.lst index 6f3ba2a79e..20efd646cd 100644 --- a/gas/testsuite/gas/esp32ulp/esp32/compare/esp32ulp_all.lst +++ b/gas/testsuite/gas/esp32ulp/esp32/compare/esp32ulp_all.lst @@ -193,3 +193,10 @@ ESP32ULP GAS ./gas/testsuite/gas/esp32ulp/esp32/esp32ulp_all.s page 1 179 0154 20408810 REG_WR 0x20, 1, 2,0x10 // REG[0x120] = 0x10[1:2] 180 181 0158 000000B0 HALT // Move chip to powerdown + 182 + 183 // JUMPR negative offset + 184 015c 14000983 JUMPR -16, 20, GE //Jump to address "position - 16" if value in R0 >= + 185 + 186 // JUMPS negative offset + 187 0160 14000484 JUMPS -16, 20, EQ //Jump to address “position - 16” if value in S + 187 14000B85 diff --git a/gas/testsuite/gas/esp32ulp/esp32/compare/esp32ulp_jumpr.bin b/gas/testsuite/gas/esp32ulp/esp32/compare/esp32ulp_jumpr.bin index 197b044a46..0a7d208ce4 100755 Binary files a/gas/testsuite/gas/esp32ulp/esp32/compare/esp32ulp_jumpr.bin and b/gas/testsuite/gas/esp32ulp/esp32/compare/esp32ulp_jumpr.bin differ diff --git a/gas/testsuite/gas/esp32ulp/esp32/compare/esp32ulp_jumpr.lst b/gas/testsuite/gas/esp32ulp/esp32/compare/esp32ulp_jumpr.lst index 53959c74bd..9c84f1ee84 100644 --- a/gas/testsuite/gas/esp32ulp/esp32/compare/esp32ulp_jumpr.lst +++ b/gas/testsuite/gas/esp32ulp/esp32/compare/esp32ulp_jumpr.lst @@ -64,3 +64,9 @@ ESP32ULP GAS ./gas/testsuite/gas/esp32ulp/esp32/esp32ulp_jumpr.s page 1 54 55 56 + 57 007c 04000283 JUMPR -0x04, 0x4, LT + 58 0080 05000283 JUMPR -0x04, 0x4, LE + 59 0084 05000582 JUMPR -0x04, 0x4, EQ + 59 04000583 + 60 008c 05000383 JUMPR -0x04, 0x4, GT + 61 0090 04000383 JUMPR -0x04, 0x4, GE diff --git a/gas/testsuite/gas/esp32ulp/esp32/esp32ulp_all.s b/gas/testsuite/gas/esp32ulp/esp32/esp32ulp_all.s index 12b97d34de..f0579dc020 100644 --- a/gas/testsuite/gas/esp32ulp/esp32/esp32ulp_all.s +++ b/gas/testsuite/gas/esp32ulp/esp32/esp32ulp_all.s @@ -179,3 +179,9 @@ labelsd: STAGE_DEC 1 // stage_cnt--; REG_WR 0x20, 1, 2,0x10 // REG[0x120] = 0x10[1:2] HALT // Move chip to powerdown + +// JUMPR negative offset + JUMPR -16, 20, GE //Jump to address "position - 16" if value in R0 >= 20 + +// JUMPS negative offset + JUMPS -16, 20, EQ //Jump to address “position - 16” if value in Stage_Cnt == 20 diff --git a/gas/testsuite/gas/esp32ulp/esp32/esp32ulp_jumpr.s b/gas/testsuite/gas/esp32ulp/esp32/esp32ulp_jumpr.s index 5ea2b4393c..8790313e1b 100644 --- a/gas/testsuite/gas/esp32ulp/esp32/esp32ulp_jumpr.s +++ b/gas/testsuite/gas/esp32ulp/esp32/esp32ulp_jumpr.s @@ -54,3 +54,8 @@ Check2: + JUMPR -0x04, 0x4, LT + JUMPR -0x04, 0x4, LE + JUMPR -0x04, 0x4, EQ + JUMPR -0x04, 0x4, GT + JUMPR -0x04, 0x4, GE diff --git a/gas/testsuite/gas/esp32ulp/esp32s2/compare/esp32s2ulp_jump.bin b/gas/testsuite/gas/esp32ulp/esp32s2/compare/esp32s2ulp_jump.bin index cc2275e62c..6a51da73f3 100755 Binary files a/gas/testsuite/gas/esp32ulp/esp32s2/compare/esp32s2ulp_jump.bin and b/gas/testsuite/gas/esp32ulp/esp32s2/compare/esp32s2ulp_jump.bin differ diff --git a/gas/testsuite/gas/esp32ulp/esp32s2/compare/esp32s2ulp_jump.lst b/gas/testsuite/gas/esp32ulp/esp32s2/compare/esp32s2ulp_jump.lst index 57dab6d461..d3cb015600 100644 --- a/gas/testsuite/gas/esp32ulp/esp32s2/compare/esp32s2ulp_jump.lst +++ b/gas/testsuite/gas/esp32ulp/esp32s2/compare/esp32s2ulp_jump.lst @@ -101,3 +101,18 @@ ESP32ULP GAS ./gas/testsuite/gas/esp32ulp/esp32s2/esp32s2ulp_jump.s page 1 83 0118 00800388 jumps 0x0, 0x00, GE 84 85 + 86 //jumpr with negative offset + 87 011c 00000682 jumpr -0x4, 0x00, EQ + 88 0120 00000482 jumpr -0x4, 0x00, LT + 89 0124 00000582 jumpr -0x4, 0x00, GT + 90 0128 00000482 jumpr -0x4, 0x00, LE + 90 00000A82 + 91 0130 00000582 jumpr -0x4, 0x00, GE + 91 00000A82 + 92 + 93 //jumps with negative offset + 94 0138 0000128A jumps -0x4, 0x00, EQ + 95 013c 0080108A jumps -0x4, 0x00, LT + 96 0140 0080118A jumps -0x4, 0x00, GT + 97 0144 0080128A jumps -0x4, 0x00, LE + 98 0148 0080138A jumps -0x4, 0x00, GE diff --git a/gas/testsuite/gas/esp32ulp/esp32s2/esp32s2ulp_jump.s b/gas/testsuite/gas/esp32ulp/esp32s2/esp32s2ulp_jump.s index 5d2f1ddd9c..62ef414d43 100644 --- a/gas/testsuite/gas/esp32ulp/esp32s2/esp32s2ulp_jump.s +++ b/gas/testsuite/gas/esp32ulp/esp32s2/esp32s2ulp_jump.s @@ -83,3 +83,16 @@ jmp2: nop jumps 0x0, 0x00, GE + //jumpr with negative offset + jumpr -0x4, 0x00, EQ + jumpr -0x4, 0x00, LT + jumpr -0x4, 0x00, GT + jumpr -0x4, 0x00, LE + jumpr -0x4, 0x00, GE + + //jumps with negative offset + jumps -0x4, 0x00, EQ + jumps -0x4, 0x00, LT + jumps -0x4, 0x00, GT + jumps -0x4, 0x00, LE + jumps -0x4, 0x00, GE diff --git a/include/opcode/esp32ulp_esp32.h b/include/opcode/esp32ulp_esp32.h index 7975948e55..2ebf9a67fc 100644 --- a/include/opcode/esp32ulp_esp32.h +++ b/include/opcode/esp32ulp_esp32.h @@ -110,7 +110,7 @@ typedef struct { #define I_JUMP_RELR(thresh, jud, stp) { *(unsigned int*)&(jump_alu_relr ){ \ .threshold = thresh, \ .judge = jud, \ - .step = stp, \ + .step = ((stp < 0) ? ((-stp) | (1 << 7)) : stp) , \ .sub_opcode = SUB_OPCODE_BR, \ .opcode = OPCODE_BRANCH } } @@ -129,7 +129,7 @@ typedef struct { #define I_JUMP_RELS(thresh, jud, stp) { *(unsigned int*)&(jump_alu_rels ){ \ .threshold = thresh, \ .judge = jud, \ - .step = stp, \ + .step = ((stp < 0) ? ((-stp) | (1 << 7)) : stp) , \ .sub_opcode = SUB_OPCODE_BS, \ .opcode = OPCODE_BRANCH } } diff --git a/include/opcode/esp32ulp_esp32s2.h b/include/opcode/esp32ulp_esp32s2.h index d7b453ee9b..3a17524f25 100644 --- a/include/opcode/esp32ulp_esp32s2.h +++ b/include/opcode/esp32ulp_esp32s2.h @@ -135,7 +135,7 @@ typedef struct { #define I_JUMP_RELR(thresh, jud, stp) { *(unsigned int*)&(jump_alu_relr ){ \ .threshold = thresh, \ .judge = jud, \ - .step = stp, \ + .step = ((stp < 0) ? ((-stp) | (1 << 7)) : stp) , \ .sub_opcode = SUB_OPCODE_BR, \ .opcode = OPCODE_BRANCH } } @@ -155,7 +155,7 @@ typedef struct { .threshold = thresh, \ .unused = 0, \ .judge = jud, \ - .step = stp, \ + .step = ((stp < 0) ? ((-stp) | (1 << 7)) : stp) , \ .sub_opcode = SUB_OPCODE_BS, \ .opcode = OPCODE_BRANCH } }