Skip to content

Commit a8d667f

Browse files
authored
Improve signed/unsigned comparison of integers larger than a single register (#346)
1 parent c2598a9 commit a8d667f

File tree

3 files changed

+173
-3
lines changed

3 files changed

+173
-3
lines changed

sljit_src/sljitConfigInternal.h

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,14 @@
8989
SLJIT_CONV_NAN_FLOAT : result when a NaN floating point value is converted to integer
9090
(possible values: SLJIT_CONV_RESULT_MAX_INT, SLJIT_CONV_RESULT_MIN_INT,
9191
or SLJIT_CONV_RESULT_ZERO)
92+
SLJIT_SUBC_SETS_SIGNED : SLJIT_SUBC[32] operation always sets the signed result, so setting
93+
the following status flags after a subtract with carry operation is valid:
94+
sljit_set_current_flags(..., SLJIT_CURRENT_FLAGS_SUB | SLJIT_SET_SIG_LESS)
95+
sljit_set_current_flags(..., SLJIT_CURRENT_FLAGS_SUB | SLJIT_SET_SIG_GREATER)
96+
SLJIT_SHARED_COMPARISON_FLAGS: the cpu has different instructions for signed and unsigned
97+
comparisons, which sets the same status flags, so passing SLJIT_LESS
98+
or SLJIT_SIG_LESS as an argument has the same effect, and this is true
99+
for all other signed/unsigned comparison type pairs
92100
93101
Other macros:
94102
SLJIT_TMP_R0 .. R9 : accessing temporary registers
@@ -616,6 +624,7 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_sw sljit_exec_offset(void *code);
616624
#define SLJIT_MASKED_SHIFT32 1
617625
#define SLJIT_UPPER_BITS_IGNORED 1
618626
#define SLJIT_UPPER_BITS_ZERO_EXTENDED 1
627+
#define SLJIT_SUBC_SETS_SIGNED 1
619628

620629
#elif (defined SLJIT_CONFIG_X86_64 && SLJIT_CONFIG_X86_64)
621630

@@ -640,6 +649,7 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_sw sljit_exec_offset(void *code);
640649
#define SLJIT_MASKED_SHIFT32 1
641650
#define SLJIT_UPPER_BITS_IGNORED 1
642651
#define SLJIT_UPPER_BITS_ZERO_EXTENDED 1
652+
#define SLJIT_SUBC_SETS_SIGNED 1
643653

644654
#elif (defined SLJIT_CONFIG_ARM_32 && SLJIT_CONFIG_ARM_32)
645655

@@ -653,6 +663,7 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_sw sljit_exec_offset(void *code);
653663
#define SLJIT_TMP_OPT_REG SLJIT_TMP_R0
654664
#define SLJIT_TMP_DEST_FREG SLJIT_TMP_FR0
655665
#define SLJIT_LOCALS_OFFSET_BASE 0
666+
#define SLJIT_SUBC_SETS_SIGNED 1
656667

657668
#elif (defined SLJIT_CONFIG_ARM_64 && SLJIT_CONFIG_ARM_64)
658669

@@ -670,6 +681,7 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_sw sljit_exec_offset(void *code);
670681
#define SLJIT_MASKED_SHIFT32 1
671682
#define SLJIT_UPPER_BITS_IGNORED 1
672683
#define SLJIT_UPPER_BITS_ZERO_EXTENDED 1
684+
#define SLJIT_SUBC_SETS_SIGNED 1
673685

674686
#elif (defined SLJIT_CONFIG_PPC && SLJIT_CONFIG_PPC)
675687

@@ -691,6 +703,7 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_sw sljit_exec_offset(void *code);
691703
#define SLJIT_LOCALS_OFFSET_BASE (3 * (sljit_s32)sizeof(sljit_sw))
692704
#endif /* SLJIT_CONFIG_PPC_64 || _AIX */
693705
#define SLJIT_UPPER_BITS_IGNORED 1
706+
#define SLJIT_SHARED_COMPARISON_FLAGS 1
694707

695708
#elif (defined SLJIT_CONFIG_MIPS && SLJIT_CONFIG_MIPS)
696709

@@ -713,6 +726,7 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_sw sljit_exec_offset(void *code);
713726
#define SLJIT_MASKED_SHIFT 1
714727
#define SLJIT_MASKED_SHIFT32 1
715728
#define SLJIT_UPPER_BITS_SIGN_EXTENDED 1
729+
#define SLJIT_SHARED_COMPARISON_FLAGS 1
716730

717731
#elif (defined SLJIT_CONFIG_RISCV && SLJIT_CONFIG_RISCV)
718732

@@ -735,6 +749,7 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_sw sljit_exec_offset(void *code);
735749
#define SLJIT_MASKED_SHIFT32 1
736750
#define SLJIT_UPPER_BITS_IGNORED 1
737751
#define SLJIT_UPPER_BITS_SIGN_EXTENDED 1
752+
#define SLJIT_SHARED_COMPARISON_FLAGS 1
738753

739754
#elif (defined SLJIT_CONFIG_S390X && SLJIT_CONFIG_S390X)
740755

@@ -772,6 +787,7 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_sw sljit_exec_offset(void *code);
772787
#define SLJIT_MASKED_SHIFT 1
773788
#define SLJIT_UPPER_BITS_IGNORED 1
774789
#define SLJIT_UPPER_BITS_PRESERVED 1
790+
#define SLJIT_SHARED_COMPARISON_FLAGS 1
775791

776792
#elif (defined SLJIT_CONFIG_LOONGARCH && SLJIT_CONFIG_LOONGARCH)
777793

@@ -788,6 +804,7 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_sw sljit_exec_offset(void *code);
788804
#define SLJIT_MASKED_SHIFT 1
789805
#define SLJIT_MASKED_SHIFT32 1
790806
#define SLJIT_UPPER_BITS_SIGN_EXTENDED 1
807+
#define SLJIT_SHARED_COMPARISON_FLAGS 1
791808

792809
#elif (defined SLJIT_CONFIG_UNSUPPORTED && SLJIT_CONFIG_UNSUPPORTED)
793810

sljit_src/sljitLir.h

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1761,7 +1761,10 @@ SLJIT_API_FUNC_ATTRIBUTE struct sljit_label* sljit_emit_aligned_label(struct slj
17611761
#define SLJIT_SET_OVERFLOW SLJIT_SET(SLJIT_OVERFLOW)
17621762
#define SLJIT_NOT_OVERFLOW 11
17631763

1764-
/* Unlike other flags, sljit_emit_jump may destroy the carry flag. */
1764+
/* Unlike other comparison types, sljit_emit_jump may destroy flags when
1765+
carry flag is specified (powerpc limitation). Furthermore, SLJIT_CARRY
1766+
represents that the first operand is unsigned less than the second
1767+
operand after an SLJIT_SUB / SLJIT_SUBC operation. */
17651768
#define SLJIT_CARRY 12
17661769
#define SLJIT_SET_CARRY SLJIT_SET(SLJIT_CARRY)
17671770
#define SLJIT_NOT_CARRY 13

test_src/sljitTest.c

Lines changed: 152 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6102,18 +6102,22 @@ static void test58(void)
61026102
successful_tests++;
61036103
}
61046104

6105+
#if (defined SLJIT_SUBC_SETS_SIGNED + defined SLJIT_SHARED_COMPARISON_FLAGS) != 1
6106+
#error "Currently all cpus supports exactly one of these features"
6107+
#endif
6108+
61056109
static void test59(void)
61066110
{
61076111
/* Test carry flag. */
61086112
executable_code code;
61096113
struct sljit_compiler* compiler = sljit_create_compiler(NULL);
6110-
sljit_sw wbuf[15];
6114+
sljit_sw wbuf[31];
61116115
sljit_s32 i;
61126116

61136117
if (verbose)
61146118
printf("Run test59\n");
61156119

6116-
for (i = 0; i < 15; i++)
6120+
for (i = 0; i < 31; i++)
61176121
wbuf[i] = -1;
61186122

61196123
FAILED(!compiler, "cannot create compiler\n");
@@ -6215,6 +6219,132 @@ static void test59(void)
62156219
/* wbuf[14] */
62166220
sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_MEM1(SLJIT_S0), 14 * sizeof(sljit_sw), SLJIT_R1, 0);
62176221

6222+
sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_R0, 0, SLJIT_IMM, 0);
6223+
sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_S1, 0, SLJIT_IMM, 1);
6224+
sljit_emit_op2(compiler, SLJIT_SUB | SLJIT_SET_CARRY, SLJIT_R0, 0, SLJIT_R0, 0, SLJIT_S1, 0);
6225+
cond_set(compiler, SLJIT_R0, 0, SLJIT_CARRY);
6226+
/* wbuf[15] */
6227+
sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_MEM1(SLJIT_S0), 15 * sizeof(sljit_sw), SLJIT_R0, 0);
6228+
6229+
sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_R2, 0, SLJIT_IMM, 0);
6230+
sljit_emit_op2u(compiler, SLJIT_SUB | SLJIT_SET_CARRY, SLJIT_R2, 0, SLJIT_IMM, 1);
6231+
sljit_emit_op2u(compiler, SLJIT_SUBC | SLJIT_SET_CARRY, SLJIT_IMM, 1, SLJIT_R2, 0);
6232+
cond_set(compiler, SLJIT_R0, 0, SLJIT_CARRY);
6233+
/* wbuf[16] */
6234+
sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_MEM1(SLJIT_S0), 16 * sizeof(sljit_sw), SLJIT_R0, 0);
6235+
6236+
sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_S1, 0, SLJIT_IMM, 3);
6237+
sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_R0, 0, SLJIT_IMM, 3);
6238+
sljit_emit_op2(compiler, SLJIT_SUB | SLJIT_SET_CARRY, SLJIT_R0, 0, SLJIT_S1, 0, SLJIT_R0, 0);
6239+
/* wbuf[17] */
6240+
sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_MEM1(SLJIT_S0), 17 * sizeof(sljit_sw), SLJIT_R0, 0);
6241+
cond_set(compiler, SLJIT_R0, 0, SLJIT_NOT_CARRY);
6242+
/* wbuf[18] */
6243+
sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_MEM1(SLJIT_S0), 18 * sizeof(sljit_sw), SLJIT_R0, 0);
6244+
6245+
sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_R1, 0, SLJIT_IMM, 1);
6246+
sljit_emit_op2u(compiler, SLJIT_SUB | SLJIT_SET_CARRY, SLJIT_R1, 0, SLJIT_IMM, 1);
6247+
sljit_emit_op2(compiler, SLJIT_SUBC | SLJIT_SET_CARRY, SLJIT_R2, 0, SLJIT_R1, 0, SLJIT_IMM, 2);
6248+
/* wbuf[19] */
6249+
sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_MEM1(SLJIT_S0), 19 * sizeof(sljit_sw), SLJIT_R2, 0);
6250+
cond_set(compiler, SLJIT_R0, 0, SLJIT_NOT_CARRY);
6251+
/* wbuf[20] */
6252+
sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_MEM1(SLJIT_S0), 20 * sizeof(sljit_sw), SLJIT_R0, 0);
6253+
6254+
#ifdef SLJIT_SUBC_SETS_SIGNED
6255+
sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_R0, 0, SLJIT_IMM, 0);
6256+
sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_R1, 0, SLJIT_IMM, (sljit_sw)((sljit_uw)1 << ((sizeof(sljit_sw) * 8) - 1)));
6257+
sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_R2, 0, SLJIT_R1, 0);
6258+
sljit_emit_op2(compiler, SLJIT_SUB | SLJIT_SET_CARRY, SLJIT_R0, 0, SLJIT_R0, 0, SLJIT_IMM, 1);
6259+
sljit_emit_op2(compiler, SLJIT_SUBC | SLJIT_SET_CARRY, SLJIT_R2, 0, SLJIT_R2, 0, SLJIT_R1, 0);
6260+
sljit_set_current_flags(compiler, SLJIT_CURRENT_FLAGS_SUB | SLJIT_SET_SIG_LESS);
6261+
cond_set(compiler, SLJIT_R0, 0, SLJIT_SIG_LESS);
6262+
/* wbuf[21] */
6263+
sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_MEM1(SLJIT_S0), 21 * sizeof(sljit_sw), SLJIT_R0, 0);
6264+
6265+
sljit_emit_op1(compiler, SLJIT_MOV32, SLJIT_R0, 0, SLJIT_IMM, 0);
6266+
sljit_emit_op1(compiler, SLJIT_MOV32, SLJIT_S1, 0, SLJIT_IMM, 0x7fffffff);
6267+
sljit_emit_op2(compiler, SLJIT_SUB32 | SLJIT_SET_CARRY, SLJIT_R0, 0, SLJIT_R0, 0, SLJIT_IMM, -1);
6268+
sljit_emit_op2(compiler, SLJIT_SUBC32 | SLJIT_SET_CARRY, SLJIT_S1, 0, SLJIT_S1, 0, SLJIT_IMM, (sljit_sw)0x80000000);
6269+
sljit_set_current_flags(compiler, SLJIT_CURRENT_FLAGS_SUB | SLJIT_CURRENT_FLAGS_32 | SLJIT_SET_SIG_LESS);
6270+
cond_set(compiler, SLJIT_R0, 0, SLJIT_SIG_LESS);
6271+
/* wbuf[22] */
6272+
sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_MEM1(SLJIT_S0), 22 * sizeof(sljit_sw), SLJIT_R0, 0);
6273+
6274+
sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_R0, 0, SLJIT_IMM, 879);
6275+
sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_R1, 0, SLJIT_IMM, (sljit_sw)((sljit_uw)1 << ((sizeof(sljit_sw) * 8) - 1)));
6276+
sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_R2, 0, SLJIT_IMM, (sljit_sw)(~(sljit_uw)0 >> 1));
6277+
sljit_emit_op2(compiler, SLJIT_SUB | SLJIT_SET_CARRY, SLJIT_R0, 0, SLJIT_R0, 0, SLJIT_IMM, 300);
6278+
sljit_emit_op2(compiler, SLJIT_SUBC | SLJIT_SET_CARRY, SLJIT_R2, 0, SLJIT_R2, 0, SLJIT_R1, 0);
6279+
sljit_set_current_flags(compiler, SLJIT_CURRENT_FLAGS_SUB | SLJIT_SET_SIG_GREATER);
6280+
cond_set(compiler, SLJIT_R0, 0, SLJIT_SIG_GREATER);
6281+
/* wbuf[23] */
6282+
sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_MEM1(SLJIT_S0), 23 * sizeof(sljit_sw), SLJIT_R0, 0);
6283+
6284+
sljit_emit_op1(compiler, SLJIT_MOV32, SLJIT_R0, 0, SLJIT_IMM, -1);
6285+
sljit_emit_op1(compiler, SLJIT_MOV32, SLJIT_S1, 0, SLJIT_IMM, -1);
6286+
sljit_emit_op2(compiler, SLJIT_SUB32 | SLJIT_SET_CARRY, SLJIT_R0, 0, SLJIT_R0, 0, SLJIT_IMM, 0);
6287+
sljit_emit_op2(compiler, SLJIT_SUBC32 | SLJIT_SET_CARRY, SLJIT_S1, 0, SLJIT_S1, 0, SLJIT_IMM, 0);
6288+
sljit_set_current_flags(compiler, SLJIT_CURRENT_FLAGS_SUB | SLJIT_CURRENT_FLAGS_32 | SLJIT_SET_SIG_GREATER);
6289+
cond_set(compiler, SLJIT_S1, 0, SLJIT_SIG_GREATER);
6290+
/* wbuf[24] */
6291+
sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_MEM1(SLJIT_S0), 24 * sizeof(sljit_sw), SLJIT_S1, 0);
6292+
6293+
sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_R0, 0, SLJIT_IMM, 678934);
6294+
sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_R1, 0, SLJIT_IMM, -589123);
6295+
sljit_emit_op2(compiler, SLJIT_SUB | SLJIT_SET_CARRY, SLJIT_R0, 0, SLJIT_R0, 0, SLJIT_IMM, 678934);
6296+
sljit_emit_op2(compiler, SLJIT_SUBC | SLJIT_SET_CARRY, SLJIT_R2, 0, SLJIT_R2, 0, SLJIT_IMM, -589123);
6297+
sljit_set_current_flags(compiler, SLJIT_CURRENT_FLAGS_SUB | SLJIT_SET_SIG_LESS);
6298+
cond_set(compiler, SLJIT_R0, 0, SLJIT_SIG_GREATER_EQUAL);
6299+
/* wbuf[25] */
6300+
sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_MEM1(SLJIT_S0), 25 * sizeof(sljit_sw), SLJIT_R0, 0);
6301+
6302+
sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_R0, 0, SLJIT_IMM, -1);
6303+
sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_R1, 0, SLJIT_IMM, (sljit_sw)(~(sljit_uw)0 >> 1));
6304+
sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_R2, 0, SLJIT_IMM, 0);
6305+
sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_S1, 0, SLJIT_IMM, (sljit_sw)((sljit_uw)1 << ((sizeof(sljit_sw) * 8) - 1)));
6306+
sljit_emit_op2(compiler, SLJIT_SUB | SLJIT_SET_CARRY, SLJIT_R0, 0, SLJIT_R0, 0, SLJIT_R2, 0);
6307+
sljit_emit_op2(compiler, SLJIT_SUBC | SLJIT_SET_CARRY, SLJIT_R1, 0, SLJIT_R1, 0, SLJIT_S1, 0);
6308+
sljit_set_current_flags(compiler, SLJIT_CURRENT_FLAGS_SUB | SLJIT_SET_SIG_LESS);
6309+
cond_set(compiler, SLJIT_R0, 0, SLJIT_SIG_LESS);
6310+
/* wbuf[26] */
6311+
sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_MEM1(SLJIT_S0), 26 * sizeof(sljit_sw), SLJIT_R0, 0);
6312+
#endif /* SLJIT_SUBC_SETS_SIGNED */
6313+
6314+
#ifdef SLJIT_SHARED_COMPARISON_FLAGS
6315+
sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_R0, 0, SLJIT_IMM, 32);
6316+
sljit_emit_op2u(compiler, SLJIT_SUB | SLJIT_SET_LESS, SLJIT_R0, 0, SLJIT_IMM, -5);
6317+
sljit_emit_op2u(compiler, SLJIT_SUB | SLJIT_SET_SIG_LESS, SLJIT_R0, 0, SLJIT_IMM, -5);
6318+
sljit_set_current_flags(compiler, SLJIT_CURRENT_FLAGS_SUB | SLJIT_CURRENT_FLAGS_COMPARE | SLJIT_SET_LESS);
6319+
cond_set(compiler, SLJIT_R0, 0, SLJIT_LESS);
6320+
/* wbuf[27] */
6321+
sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_MEM1(SLJIT_S0), 27 * sizeof(sljit_sw), SLJIT_R0, 0);
6322+
6323+
sljit_emit_op1(compiler, SLJIT_MOV32, SLJIT_R0, 0, SLJIT_IMM, -434);
6324+
sljit_emit_op2u(compiler, SLJIT_SUB32 | SLJIT_SET_SIG_GREATER, SLJIT_R0, 0, SLJIT_IMM, 819);
6325+
sljit_emit_op2u(compiler, SLJIT_SUB32 | SLJIT_SET_GREATER, SLJIT_R0, 0, SLJIT_IMM, 819);
6326+
sljit_set_current_flags(compiler, SLJIT_CURRENT_FLAGS_SUB | SLJIT_CURRENT_FLAGS_COMPARE | SLJIT_CURRENT_FLAGS_32 | SLJIT_SET_SIG_GREATER);
6327+
cond_set(compiler, SLJIT_R1, 0, SLJIT_SIG_GREATER);
6328+
/* wbuf[28] */
6329+
sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_MEM1(SLJIT_S0), 28 * sizeof(sljit_sw), SLJIT_R1, 0);
6330+
6331+
sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_R0, 0, SLJIT_IMM, 55);
6332+
sljit_emit_op2u(compiler, SLJIT_SUB | SLJIT_SET_GREATER, SLJIT_R0, 0, SLJIT_IMM, -234);
6333+
sljit_emit_op2u(compiler, SLJIT_SUB | SLJIT_SET_SIG_GREATER, SLJIT_R0, 0, SLJIT_IMM, -234);
6334+
sljit_set_current_flags(compiler, SLJIT_CURRENT_FLAGS_SUB | SLJIT_CURRENT_FLAGS_COMPARE | SLJIT_SET_GREATER);
6335+
cond_set(compiler, SLJIT_R0, 0, SLJIT_GREATER);
6336+
/* wbuf[29] */
6337+
sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_MEM1(SLJIT_S0), 29 * sizeof(sljit_sw), SLJIT_R0, 0);
6338+
6339+
sljit_emit_op1(compiler, SLJIT_MOV32, SLJIT_R0, 0, SLJIT_IMM, 576);
6340+
sljit_emit_op2u(compiler, SLJIT_SUB32 | SLJIT_SET_SIG_GREATER_EQUAL, SLJIT_R0, 0, SLJIT_IMM, -645);
6341+
sljit_emit_op2u(compiler, SLJIT_SUB32 | SLJIT_SET_GREATER_EQUAL, SLJIT_R0, 0, SLJIT_IMM, -645);
6342+
sljit_set_current_flags(compiler, SLJIT_CURRENT_FLAGS_SUB | SLJIT_CURRENT_FLAGS_COMPARE | SLJIT_CURRENT_FLAGS_32 | SLJIT_SET_SIG_GREATER_EQUAL);
6343+
cond_set(compiler, SLJIT_S1, 0, SLJIT_SIG_GREATER_EQUAL);
6344+
/* wbuf[30] */
6345+
sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_MEM1(SLJIT_S0), 30 * sizeof(sljit_sw), SLJIT_S1, 0);
6346+
#endif /* SLJIT_SHARED_COMPARISON_FLAGS */
6347+
62186348
sljit_emit_return_void(compiler);
62196349

62206350
code.code = sljit_generate_code(compiler, 0, NULL);
@@ -6238,6 +6368,26 @@ static void test59(void)
62386368
FAILED(wbuf[12] != 1, "test59 case 13 failed\n");
62396369
FAILED(wbuf[13] != 1, "test59 case 14 failed\n");
62406370
FAILED(wbuf[14] != 1, "test59 case 15 failed\n");
6371+
FAILED(wbuf[15] != 1, "test59 case 16 failed\n");
6372+
FAILED(wbuf[16] != 2, "test59 case 17 failed\n");
6373+
FAILED(wbuf[17] != 0, "test59 case 18 failed\n");
6374+
FAILED(wbuf[18] != 1, "test59 case 19 failed\n");
6375+
FAILED(wbuf[19] != -1, "test59 case 20 failed\n");
6376+
FAILED(wbuf[20] != 2, "test59 case 21 failed\n");
6377+
#ifdef SLJIT_SUBC_SETS_SIGNED
6378+
FAILED(wbuf[21] != 1, "test59 case 22 failed\n");
6379+
FAILED(wbuf[22] != 2, "test59 case 23 failed\n");
6380+
FAILED(wbuf[23] != 1, "test59 case 24 failed\n");
6381+
FAILED(wbuf[24] != 2, "test59 case 25 failed\n");
6382+
FAILED(wbuf[25] != 1, "test59 case 26 failed\n");
6383+
FAILED(wbuf[26] != 2, "test59 case 27 failed\n");
6384+
#endif /* SLJIT_SUBC_SETS_SIGNED */
6385+
#ifdef SLJIT_SHARED_COMPARISON_FLAGS
6386+
FAILED(wbuf[27] != 2, "test59 case 28 failed\n");
6387+
FAILED(wbuf[28] != 1, "test59 case 29 failed\n");
6388+
FAILED(wbuf[29] != 1, "test59 case 30 failed\n");
6389+
FAILED(wbuf[30] != 2, "test59 case 31 failed\n");
6390+
#endif /* SLJIT_SHARED_COMPARISON_FLAGS */
62416391
sljit_free_code(code.code, NULL);
62426392

62436393
successful_tests++;

0 commit comments

Comments
 (0)