Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add more buffer tests #304

Merged
merged 1 commit into from
Feb 12, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion GNUmakefile
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ $(BINDIR)/regexMain.o : $(REGEXDIR)/regexMain.c $(BINDIR)/.keep $(SLJIT_HEADERS)
$(BINDIR)/regexJIT.o : $(REGEXDIR)/regexJIT.c $(BINDIR)/.keep $(SLJIT_HEADERS) $(REGEXDIR)/regexJIT.h
$(CC) $(CPPFLAGS) $(REGEX_CFLAGS) -c -o $@ $(REGEXDIR)/regexJIT.c

$(BINDIR)/sljit_test: $(BINDIR)/.keep $(BINDIR)/sljitMain.o $(TESTDIR)/sljitTest.c $(SRCDIR)/sljitLir.c $(SLJIT_LIR_FILES) $(SLJIT_HEADERS) $(TESTDIR)/sljitConfigPre.h $(TESTDIR)/sljitConfigPost.h $(TESTDIR)/sljitTestCall.h $(TESTDIR)/sljitTestFloat.h $(TESTDIR)/sljitTestSimd.h
$(BINDIR)/sljit_test: $(BINDIR)/.keep $(BINDIR)/sljitMain.o $(TESTDIR)/sljitTest.c $(SRCDIR)/sljitLir.c $(SLJIT_LIR_FILES) $(SLJIT_HEADERS) $(TESTDIR)/sljitConfigPre.h $(TESTDIR)/sljitConfigPost.h $(TESTDIR)/sljitTestBuffers.h $(TESTDIR)/sljitTestCall.h $(TESTDIR)/sljitTestFloat.h $(TESTDIR)/sljitTestSimd.h
$(CC) $(CPPFLAGS) -DSLJIT_HAVE_CONFIG_PRE=1 -I$(TESTDIR) $(CFLAGS) $(LDFLAGS) $(BINDIR)/sljitMain.o $(TESTDIR)/sljitTest.c $(SRCDIR)/sljitLir.c -o $@ -lm -lpthread $(EXTRA_LIBS)

$(BINDIR)/regex_test: $(BINDIR)/.keep $(BINDIR)/regexMain.o $(BINDIR)/regexJIT.o $(BINDIR)/sljitLir.o
Expand Down
12 changes: 8 additions & 4 deletions sljit_src/sljitNativeARM_32.c
Original file line number Diff line number Diff line change
Expand Up @@ -2644,9 +2644,10 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_op_src(struct sljit_compiler *comp
case SLJIT_FAST_RETURN:
SLJIT_ASSERT(reg_map[TMP_REG2] == 14);

if (FAST_IS_REG(src))
FAIL_IF(push_inst(compiler, MOV | RD(TMP_REG2) | RM(src)));
else
if (FAST_IS_REG(src)) {
if (src != TMP_REG2)
FAIL_IF(push_inst(compiler, MOV | RD(TMP_REG2) | RM(src)));
} else
FAIL_IF(emit_op_mem(compiler, WORD_SIZE | LOAD_DATA, TMP_REG2, src, srcw, TMP_REG1));

return push_inst(compiler, BX | RM(TMP_REG2));
Expand Down Expand Up @@ -2676,8 +2677,11 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_op_dst(struct sljit_compiler *comp
case SLJIT_FAST_ENTER:
SLJIT_ASSERT(reg_map[TMP_REG2] == 14);

if (FAST_IS_REG(dst))
if (FAST_IS_REG(dst)) {
if (dst == TMP_REG2)
return SLJIT_SUCCESS;
return push_inst(compiler, MOV | RD(dst) | RM(TMP_REG2));
}
break;
case SLJIT_GET_RETURN_ADDRESS:
size = GET_SAVED_REGISTERS_SIZE(compiler->scratches, compiler->saveds - SLJIT_KEPT_SAVEDS_COUNT(compiler->options), 0);
Expand Down
12 changes: 8 additions & 4 deletions sljit_src/sljitNativeARM_64.c
Original file line number Diff line number Diff line change
Expand Up @@ -1878,9 +1878,10 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_op_src(struct sljit_compiler *comp

switch (op) {
case SLJIT_FAST_RETURN:
if (FAST_IS_REG(src))
FAIL_IF(push_inst(compiler, MOV | RD(TMP_LR) | RM(src)));
else
if (FAST_IS_REG(src)) {
if (src != TMP_LR)
FAIL_IF(push_inst(compiler, MOV | RD(TMP_LR) | RM(src)));
} else
FAIL_IF(emit_op_mem(compiler, WORD_SIZE, TMP_LR, src, srcw, TMP_REG1));

return push_inst(compiler, RET | RN(TMP_LR));
Expand Down Expand Up @@ -1920,8 +1921,11 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_op_dst(struct sljit_compiler *comp

switch (op) {
case SLJIT_FAST_ENTER:
if (FAST_IS_REG(dst))
if (FAST_IS_REG(dst)) {
if (dst == TMP_LR)
return SLJIT_SUCCESS;
return push_inst(compiler, MOV | RD(dst) | RM(TMP_LR));
}
break;
case SLJIT_GET_RETURN_ADDRESS:
dst_r = FAST_IS_REG(dst) ? dst : TMP_REG1;
Expand Down
12 changes: 8 additions & 4 deletions sljit_src/sljitNativeARM_T2_32.c
Original file line number Diff line number Diff line change
Expand Up @@ -2210,9 +2210,10 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_op_src(struct sljit_compiler *comp
case SLJIT_FAST_RETURN:
SLJIT_ASSERT(reg_map[TMP_REG2] == 14);

if (FAST_IS_REG(src))
FAIL_IF(push_inst16(compiler, MOV | SET_REGS44(TMP_REG2, src)));
else
if (FAST_IS_REG(src)) {
if (src != TMP_REG2)
FAIL_IF(push_inst16(compiler, MOV | SET_REGS44(TMP_REG2, src)));
} else
FAIL_IF(emit_op_mem(compiler, WORD_SIZE, TMP_REG2, src, srcw, TMP_REG2));

return push_inst16(compiler, BX | RN3(TMP_REG2));
Expand Down Expand Up @@ -2241,8 +2242,11 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_op_dst(struct sljit_compiler *comp
case SLJIT_FAST_ENTER:
SLJIT_ASSERT(reg_map[TMP_REG2] == 14);

if (FAST_IS_REG(dst))
if (FAST_IS_REG(dst)) {
if (dst == TMP_REG2)
return SLJIT_SUCCESS;
return push_inst16(compiler, MOV | SET_REGS44(dst, TMP_REG2));
}
break;
case SLJIT_GET_RETURN_ADDRESS:
size = GET_SAVED_REGISTERS_SIZE(compiler->scratches, compiler->saveds - SLJIT_KEPT_SAVEDS_COUNT(compiler->options), 0);
Expand Down
12 changes: 8 additions & 4 deletions sljit_src/sljitNativeMIPS_common.c
Original file line number Diff line number Diff line change
Expand Up @@ -2805,9 +2805,10 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_op_src(struct sljit_compiler *comp

switch (op) {
case SLJIT_FAST_RETURN:
if (FAST_IS_REG(src))
FAIL_IF(push_inst(compiler, ADDU_W | S(src) | TA(0) | DA(RETURN_ADDR_REG), RETURN_ADDR_REG));
else
if (FAST_IS_REG(src)) {
if (DR(src) != RETURN_ADDR_REG)
FAIL_IF(push_inst(compiler, ADDU_W | S(src) | TA(0) | DA(RETURN_ADDR_REG), RETURN_ADDR_REG));
} else
FAIL_IF(emit_op_mem(compiler, WORD_DATA | LOAD_DATA, RETURN_ADDR_REG, src, srcw));

FAIL_IF(push_inst(compiler, JR | SA(RETURN_ADDR_REG), UNMOVABLE_INS));
Expand Down Expand Up @@ -2839,8 +2840,11 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_op_dst(struct sljit_compiler *comp

switch (op) {
case SLJIT_FAST_ENTER:
if (FAST_IS_REG(dst))
if (FAST_IS_REG(dst)) {
if (DR(dst) == RETURN_ADDR_REG)
return SLJIT_SUCCESS;
return push_inst(compiler, ADDU_W | SA(RETURN_ADDR_REG) | TA(0) | D(dst), UNMOVABLE_INS);
}
break;
case SLJIT_GET_RETURN_ADDRESS:
dst_ar = DR(FAST_IS_REG(dst) ? dst : TMP_REG2);
Expand Down
12 changes: 8 additions & 4 deletions sljit_src/sljitNativeRISCV_common.c
Original file line number Diff line number Diff line change
Expand Up @@ -2864,9 +2864,10 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_op_src(struct sljit_compiler *comp

switch (op) {
case SLJIT_FAST_RETURN:
if (FAST_IS_REG(src))
FAIL_IF(push_inst(compiler, ADDI | RD(RETURN_ADDR_REG) | RS1(src) | IMM_I(0)));
else
if (FAST_IS_REG(src)) {
if (src != RETURN_ADDR_REG)
FAIL_IF(push_inst(compiler, ADDI | RD(RETURN_ADDR_REG) | RS1(src) | IMM_I(0)));
} else
FAIL_IF(emit_op_mem(compiler, WORD_DATA | LOAD_DATA, RETURN_ADDR_REG, src, srcw));

return push_inst(compiler, JALR | RD(TMP_ZERO) | RS1(RETURN_ADDR_REG) | IMM_I(0));
Expand All @@ -2893,8 +2894,11 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_op_dst(struct sljit_compiler *comp

switch (op) {
case SLJIT_FAST_ENTER:
if (FAST_IS_REG(dst))
if (FAST_IS_REG(dst)) {
if (dst == RETURN_ADDR_REG)
return SLJIT_SUCCESS;
return push_inst(compiler, ADDI | RD(dst) | RS1(RETURN_ADDR_REG) | IMM_I(0));
}

SLJIT_ASSERT(RETURN_ADDR_REG == TMP_REG2);
break;
Expand Down
Loading
Loading