Skip to content

Commit 86f4cb9

Browse files
committed
arm: refactor test92 to avoid possibly conflicting writes
The specification allow up to a maximum exclusive granule of 512 words to be reserved by `ldxr`, so writes close enough to the address that was loaded could result on the reservation being invalidated and `stxr` failing. Instead of writing back the values, do a second normal read to validate the first one and compare them internally. While at it make the test logic slightly easier to read. Fixes: #160
1 parent a0e16b1 commit 86f4cb9

1 file changed

Lines changed: 105 additions & 136 deletions

File tree

test_src/sljitTest.c

Lines changed: 105 additions & 136 deletions
Original file line numberDiff line numberDiff line change
@@ -11395,7 +11395,7 @@ static void test91(void)
1139511395
sljit_s32 i;
1139611396

1139711397
if (verbose)
11398-
printf("Run test13\n");
11398+
printf("Run test91\n");
1139911399

1140011400
if (!sljit_has_cpu_feature(SLJIT_HAS_FPU)) {
1140111401
if (verbose)
@@ -11520,6 +11520,15 @@ static void test91(void)
1152011520
successful_tests++;
1152111521
}
1152211522

11523+
#define M (sljit_uw)(~0ul)
11524+
#ifdef SLJIT_BIG_ENDIAN
11525+
#define O(w,o) (8 * (8 - (sizeof(w) * (o + 1))))
11526+
#else
11527+
#define O(w,o) (8 * sizeof(w) * o)
11528+
#endif /* BIG_ENDIAN */
11529+
#define H(w,o) (((sljit_uw)(w)(~0) << O(w,o)) ^ M)
11530+
#define HV(w,o,v) (sljit_sw)(((sljit_uw)v << O(w,o)) | H(w,o))
11531+
1152311532
static void test92(void)
1152411533
{
1152511534
#if (defined SLJIT_CONFIG_X86 && SLJIT_CONFIG_X86) \
@@ -11529,245 +11538,205 @@ static void test92(void)
1152911538
executable_code code;
1153011539
struct sljit_compiler *compiler = sljit_create_compiler(NULL, NULL);
1153111540
struct sljit_label *label;
11532-
struct sljit_jump *jump;
11533-
sljit_sw buf[32];
11534-
sljit_s32 i;
11541+
struct sljit_jump *jump, *skip;
11542+
sljit_sw buf[12];
1153511543

1153611544
if (verbose)
1153711545
printf("Run test92\n");
1153811546

1153911547
FAILED(!compiler, "cannot create compiler\n");
1154011548

11541-
for (i = 0; i < 32; i++)
11542-
buf[i] = -1;
11543-
1154411549
buf[0] = -4678;
11545-
*(sljit_u8*)(buf + 2) = 178;
11546-
*(sljit_u8*)(buf + 5) = 211;
11547-
*(sljit_u16*)(buf + 9) = 17897;
11548-
*(sljit_u16*)(buf + 12) = 57812;
11549-
*(sljit_u32*)(buf + 15) = 1234567890;
11550-
*(sljit_u32*)(buf + 17) = 987609876;
11551-
*(sljit_u8*)(buf + 20) = 192;
11552-
buf[23] = 6359;
11553-
((sljit_u8*)(buf + 26))[1] = 105;
11554-
((sljit_u8*)(buf + 28))[2] = 13;
11555-
((sljit_u16*)(buf + 30))[1] = 14876;
11550+
buf[1] = HV(sljit_u8, 0, 178);
11551+
buf[2] = HV(sljit_u8, 0, 211);
11552+
buf[3] = HV(sljit_u16, 0, 17897);
11553+
buf[4] = HV(sljit_u16, 0, 57812);
11554+
buf[5] = HV(sljit_u32, 0, 1234567890);
11555+
buf[6] = HV(sljit_u32, 0, 987609876);
11556+
buf[7] = HV(sljit_u8, 0,192);
11557+
buf[8] = 6359;
11558+
buf[9] = HV(sljit_u8, 1, 105);
11559+
buf[10] = HV(sljit_u8, 2, 13);
11560+
buf[11] = HV(sljit_u16, 1, 14876);
1155611561

1155711562
sljit_emit_enter(compiler, 0, SLJIT_ARGS1(VOID, P), 5, 5, 0, 0, 2 * sizeof(sljit_sw));
1155811563

1155911564
label = sljit_emit_label(compiler);
1156011565
sljit_emit_atomic_load(compiler, SLJIT_MOV, SLJIT_R1, SLJIT_S0);
11561-
/* buf[1] */
11562-
sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_MEM1(SLJIT_S0), sizeof(sljit_sw), SLJIT_R1, 0);
11563-
sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_R0, 0, SLJIT_R1, 0);
11566+
jump = sljit_emit_cmp(compiler, SLJIT_NOT_EQUAL, SLJIT_R1, 0, SLJIT_MEM1(SLJIT_S0), 0);
1156411567
sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_R1, 0, SLJIT_IMM, -9856);
1156511568
/* buf[0] */
1156611569
sljit_emit_atomic_store(compiler, SLJIT_MOV | SLJIT_SET_ATOMIC_STORED, SLJIT_R1, SLJIT_S0, SLJIT_R0);
1156711570
sljit_set_label(sljit_emit_jump(compiler, SLJIT_ATOMIC_NOT_STORED), label);
11571+
sljit_set_label(jump, sljit_emit_label(compiler));
1156811572

11569-
sljit_emit_op2(compiler, SLJIT_ADD, SLJIT_R1, 0, SLJIT_S0, 0, SLJIT_IMM, 2 * sizeof(sljit_sw));
11573+
sljit_emit_op2(compiler, SLJIT_ADD, SLJIT_R1, 0, SLJIT_S0, 0, SLJIT_IMM, sizeof(sljit_sw));
1157011574
label = sljit_emit_label(compiler);
1157111575
sljit_emit_atomic_load(compiler, SLJIT_MOV_U8, SLJIT_R2, SLJIT_R1);
11572-
/* buf[3] */
11573-
sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_MEM1(SLJIT_S0), 3 * sizeof(sljit_sw), SLJIT_R2, 0);
11576+
sljit_emit_op1(compiler, SLJIT_MOV_U8, SLJIT_R0, 0, SLJIT_MEM1(SLJIT_S0), sizeof(sljit_sw));
11577+
jump = sljit_emit_cmp(compiler, SLJIT_NOT_EQUAL, SLJIT_R2, 0, SLJIT_R0, 0);
1157411578
sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_R0, 0, SLJIT_IMM, 203);
11575-
/* buf[2] */
11579+
/* buf[1] */
1157611580
sljit_emit_atomic_store(compiler, SLJIT_MOV_U8 | SLJIT_SET_ATOMIC_STORED, SLJIT_R0, SLJIT_R1, SLJIT_R2);
11577-
jump = sljit_emit_jump(compiler, SLJIT_ATOMIC_STORED);
11581+
skip = sljit_emit_jump(compiler, SLJIT_ATOMIC_STORED);
1157811582
sljit_set_label(sljit_emit_jump(compiler, SLJIT_JUMP), label);
11583+
sljit_set_label(skip, sljit_emit_label(compiler));
1157911584
sljit_set_label(jump, sljit_emit_label(compiler));
11580-
/* buf[4] */
11581-
sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_MEM1(SLJIT_S0), 4 * sizeof(sljit_sw), SLJIT_R0, 0);
1158211585

11586+
sljit_emit_op2(compiler, SLJIT_ADD, SLJIT_R0, 0, SLJIT_S0, 0, SLJIT_IMM, 2 * sizeof(sljit_sw));
11587+
sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_R2, 0, SLJIT_R0, 0);
1158311588
label = sljit_emit_label(compiler);
11584-
sljit_emit_op2(compiler, SLJIT_ADD, SLJIT_R0, 0, SLJIT_S0, 0, SLJIT_IMM, 5 * sizeof(sljit_sw));
1158511589
sljit_emit_atomic_load(compiler, SLJIT_MOV32_U8, SLJIT_R0, SLJIT_R0);
11586-
/* buf[6] */
11587-
sljit_emit_op1(compiler, SLJIT_MOV32, SLJIT_MEM1(SLJIT_S0), 6 * sizeof(sljit_sw), SLJIT_R0, 0);
11588-
sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_S2, 0, SLJIT_R0, 0);
11589-
sljit_emit_op2(compiler, SLJIT_ADD, SLJIT_R0, 0, SLJIT_S0, 0, SLJIT_IMM, 5 * sizeof(sljit_sw));
11590+
skip = sljit_emit_cmp(compiler, SLJIT_NOT_EQUAL | SLJIT_32, SLJIT_R0, 0, SLJIT_IMM, 211);
11591+
sljit_emit_op1(compiler, SLJIT_MOV32_U8, SLJIT_S2, 0, SLJIT_MEM1(SLJIT_S0), 2 * sizeof(sljit_sw));
11592+
jump = sljit_emit_cmp(compiler, SLJIT_NOT_EQUAL | SLJIT_32, SLJIT_S2, 0, SLJIT_R0, 0);
1159011593
sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_S1, 0, SLJIT_IMM, 97);
11591-
/* buf[5] */
11594+
sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_R0, 0, SLJIT_R2, 0);
11595+
/* buf[2] */
1159211596
sljit_emit_atomic_store(compiler, SLJIT_MOV_U8 | SLJIT_SET_ATOMIC_STORED, SLJIT_S1, SLJIT_R0, SLJIT_S2);
1159311597
sljit_set_label(sljit_emit_jump(compiler, SLJIT_ATOMIC_NOT_STORED), label);
11594-
/* buf[7] */
11595-
sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_MEM1(SLJIT_S0), 7 * sizeof(sljit_sw), SLJIT_R0, 0);
11596-
/* buf[8] */
11597-
sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_MEM1(SLJIT_S0), 8 * sizeof(sljit_sw), SLJIT_S1, 0);
11598+
sljit_set_label(jump, sljit_emit_label(compiler));
11599+
sljit_set_label(skip, sljit_emit_label(compiler));
1159811600

1159911601
label = sljit_emit_label(compiler);
11600-
sljit_emit_op2(compiler, SLJIT_ADD, SLJIT_R1, 0, SLJIT_S0, 0, SLJIT_IMM, 9 * sizeof(sljit_sw));
11602+
sljit_emit_op2(compiler, SLJIT_ADD, SLJIT_R1, 0, SLJIT_S0, 0, SLJIT_IMM, 3 * sizeof(sljit_sw));
11603+
sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_R0, 0, SLJIT_R1, 0);
1160111604
sljit_emit_atomic_load(compiler, SLJIT_MOV_U16, SLJIT_S2, SLJIT_R1);
11602-
/* buf[10] */
11603-
sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_MEM1(SLJIT_S0), 10 * sizeof(sljit_sw), SLJIT_S2, 0);
11604-
sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_R1, 0, SLJIT_S2, 0);
11605-
sljit_emit_op2(compiler, SLJIT_ADD, SLJIT_R0, 0, SLJIT_S0, 0, SLJIT_IMM, 9 * sizeof(sljit_sw));
11606-
/* buf[9] */
11605+
sljit_emit_op1(compiler, SLJIT_MOV_U16, SLJIT_R1, 0, SLJIT_MEM1(SLJIT_S0), 3 * sizeof(sljit_sw));
11606+
jump = sljit_emit_cmp(compiler, SLJIT_NOT_EQUAL, SLJIT_S2, 0, SLJIT_R1, 0);
11607+
/* buf[3] */
1160711608
sljit_emit_atomic_store(compiler, SLJIT_MOV_U16 | SLJIT_SET_ATOMIC_STORED, SLJIT_R0, SLJIT_R0, SLJIT_R1);
1160811609
sljit_set_label(sljit_emit_jump(compiler, SLJIT_ATOMIC_NOT_STORED), label);
11609-
/* buf[11] */
11610-
sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_MEM1(SLJIT_S0), 11 * sizeof(sljit_sw), SLJIT_R0, 0);
11610+
sljit_set_label(jump, sljit_emit_label(compiler));
1161111611

11612-
sljit_emit_op2(compiler, SLJIT_ADD, SLJIT_R1, 0, SLJIT_S0, 0, SLJIT_IMM, 12 * sizeof(sljit_sw));
11612+
sljit_emit_op2(compiler, SLJIT_ADD, SLJIT_R1, 0, SLJIT_S0, 0, SLJIT_IMM, 4 * sizeof(sljit_sw));
1161311613
label = sljit_emit_label(compiler);
1161411614
sljit_emit_atomic_load(compiler, SLJIT_MOV32_U16, SLJIT_R0, SLJIT_R1);
11615-
/* buf[13] */
11616-
sljit_emit_op1(compiler, SLJIT_MOV32, SLJIT_MEM1(SLJIT_S0), 13 * sizeof(sljit_sw), SLJIT_R0, 0);
11615+
sljit_emit_op1(compiler, SLJIT_MOV32_U16, SLJIT_S1, 0, SLJIT_MEM1(SLJIT_S0), 4 * sizeof(sljit_sw));
11616+
jump = sljit_emit_cmp(compiler, SLJIT_NOT_EQUAL | SLJIT_32, SLJIT_R0, 0, SLJIT_S1, 0);
1161711617
sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_R3, 0, SLJIT_R0, 0);
1161811618
sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_R0, 0, SLJIT_IMM, 41306);
11619-
/* buf[12] */
11619+
/* buf[4] */
1162011620
sljit_emit_atomic_store(compiler, SLJIT_MOV32_U16 | SLJIT_SET_ATOMIC_STORED, SLJIT_R0, SLJIT_R1, SLJIT_R3);
1162111621
sljit_set_label(sljit_emit_jump(compiler, SLJIT_ATOMIC_NOT_STORED), label);
11622-
/* buf[14] */
11623-
sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_MEM1(SLJIT_S0), 14 * sizeof(sljit_sw), SLJIT_R0, 0);
11622+
sljit_set_label(jump, sljit_emit_label(compiler));
1162411623

11625-
sljit_emit_op2(compiler, SLJIT_ADD, SLJIT_S2, 0, SLJIT_S0, 0, SLJIT_IMM, 15 * sizeof(sljit_sw));
11624+
sljit_emit_op2(compiler, SLJIT_ADD, SLJIT_S2, 0, SLJIT_S0, 0, SLJIT_IMM, 5 * sizeof(sljit_sw));
1162611625
label = sljit_emit_label(compiler);
1162711626
sljit_emit_atomic_load(compiler, SLJIT_MOV_U32, SLJIT_R2, SLJIT_S2);
11628-
/* buf[16] */
11629-
sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_MEM1(SLJIT_S0), 16 * sizeof(sljit_sw), SLJIT_R2, 0);
11627+
sljit_emit_op1(compiler, SLJIT_MOV32, SLJIT_S1, 0, SLJIT_MEM1(SLJIT_S0), 5 * sizeof(sljit_sw));
11628+
jump = sljit_emit_cmp(compiler, SLJIT_NOT_EQUAL, SLJIT_R2, 0, SLJIT_S1, 0);
1163011629
sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_S3, 0, SLJIT_R2, 0);
1163111630
sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_R1, 0, SLJIT_IMM, 987654321);
11632-
sljit_emit_op2(compiler, SLJIT_ADD, SLJIT_S1, 0, SLJIT_S0, 0, SLJIT_IMM, 15 * sizeof(sljit_sw));
11633-
/* buf[15] */
11631+
sljit_emit_op2(compiler, SLJIT_ADD, SLJIT_S1, 0, SLJIT_S0, 0, SLJIT_IMM, 5 * sizeof(sljit_sw));
11632+
/* buf[5] */
1163411633
sljit_emit_atomic_store(compiler, SLJIT_MOV_U32 | SLJIT_SET_ATOMIC_STORED, SLJIT_R1, SLJIT_S1, SLJIT_S3);
1163511634
sljit_set_label(sljit_emit_jump(compiler, SLJIT_ATOMIC_NOT_STORED), label);
11635+
sljit_set_label(jump, sljit_emit_label(compiler));
1163611636

11637-
sljit_emit_op2(compiler, SLJIT_ADD, SLJIT_R2, 0, SLJIT_S0, 0, SLJIT_IMM, 17 * sizeof(sljit_sw));
11637+
sljit_emit_op2(compiler, SLJIT_ADD, SLJIT_R2, 0, SLJIT_S0, 0, SLJIT_IMM, 6 * sizeof(sljit_sw));
1163811638
label = sljit_emit_label(compiler);
1163911639
sljit_emit_atomic_load(compiler, SLJIT_MOV32, SLJIT_R0, SLJIT_R2);
11640-
/* buf[18] */
11641-
sljit_emit_op1(compiler, SLJIT_MOV32, SLJIT_MEM1(SLJIT_S0), 18 * sizeof(sljit_sw), SLJIT_R0, 0);
11640+
sljit_emit_op1(compiler, SLJIT_MOV32, SLJIT_S1, 0, SLJIT_MEM1(SLJIT_S0), 6 * sizeof(sljit_sw));
11641+
jump = sljit_emit_cmp(compiler, SLJIT_NOT_EQUAL | SLJIT_32, SLJIT_R0, 0, SLJIT_S1, 0);
1164211642
sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_S2, 0, SLJIT_R0, 0);
11643-
sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_R0, 0, SLJIT_IMM, -573621);
1164411643
sljit_emit_op1(compiler, SLJIT_MOV32, SLJIT_R1, 0, SLJIT_IMM, 678906789);
11645-
/* buf[17] */
11644+
/* buf[6] */
1164611645
sljit_emit_atomic_store(compiler, SLJIT_MOV32 | SLJIT_SET_ATOMIC_STORED, SLJIT_R1, SLJIT_R2, SLJIT_S2);
1164711646
sljit_set_label(sljit_emit_jump(compiler, SLJIT_ATOMIC_NOT_STORED), label);
11648-
/* buf[19] */
11649-
sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_MEM1(SLJIT_S0), 19 * sizeof(sljit_sw), SLJIT_R0, 0);
11647+
sljit_set_label(jump, sljit_emit_label(compiler));
1165011648

11651-
sljit_emit_op2(compiler, SLJIT_ADD, SLJIT_R1, 0, SLJIT_S0, 0, SLJIT_IMM, 20 * sizeof(sljit_sw));
11649+
sljit_emit_op2(compiler, SLJIT_ADD, SLJIT_R1, 0, SLJIT_S0, 0, SLJIT_IMM, 7 * sizeof(sljit_sw));
1165211650
label = sljit_emit_label(compiler);
1165311651
sljit_emit_atomic_load(compiler, SLJIT_MOV_U8, SLJIT_R3, SLJIT_R1);
11654-
/* buf[21] */
11655-
sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_MEM1(SLJIT_S0), 21 * sizeof(sljit_sw), SLJIT_R3, 0);
11652+
sljit_emit_op1(compiler, SLJIT_MOV_U8, SLJIT_S1, 0, SLJIT_MEM1(SLJIT_S0), 7 * sizeof(sljit_sw));
11653+
jump = sljit_emit_cmp(compiler, SLJIT_NOT_EQUAL, SLJIT_R3, 0, SLJIT_S1, 0);
1165611654
sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_R4, 0, SLJIT_R3, 0);
1165711655
sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_R3, 0, SLJIT_IMM, 240);
1165811656
sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_R0, 0, SLJIT_IMM, -5893);
11659-
/* buf[20] */
11657+
/* buf[7] */
1166011658
sljit_emit_atomic_store(compiler, SLJIT_MOV_U8 | SLJIT_SET_ATOMIC_STORED, SLJIT_R3, SLJIT_R1, SLJIT_R4);
1166111659
sljit_set_label(sljit_emit_jump(compiler, SLJIT_ATOMIC_NOT_STORED), label);
11662-
/* buf[22] */
11663-
sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_MEM1(SLJIT_S0), 22 * sizeof(sljit_sw), SLJIT_R0, 0);
11660+
sljit_set_label(jump, sljit_emit_label(compiler));
1166411661

11665-
sljit_emit_op2(compiler, SLJIT_ADD, SLJIT_R0, 0, SLJIT_S0, 0, SLJIT_IMM, 23 * sizeof(sljit_sw));
11662+
sljit_emit_op2(compiler, SLJIT_ADD, SLJIT_R0, 0, SLJIT_S0, 0, SLJIT_IMM, 8 * sizeof(sljit_sw));
1166611663
label = sljit_emit_label(compiler);
1166711664
sljit_emit_atomic_load(compiler, SLJIT_MOV, SLJIT_S3, SLJIT_R0);
11668-
/* buf[24] */
11669-
sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_MEM1(SLJIT_S0), 24 * sizeof(sljit_sw), SLJIT_S3, 0);
11665+
sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_S1, 0, SLJIT_MEM1(SLJIT_S0), 8 * sizeof(sljit_sw));
11666+
jump = sljit_emit_cmp(compiler, SLJIT_NOT_EQUAL, SLJIT_S3, 0, SLJIT_S1, 0);
1167011667
sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_S4, 0, SLJIT_S3, 0);
1167111668
sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_S3, 0, SLJIT_IMM, 4059);
11672-
/* buf[23] */
11669+
/* buf[8] */
1167311670
sljit_emit_atomic_store(compiler, SLJIT_MOV | SLJIT_SET_ATOMIC_STORED, SLJIT_S3, SLJIT_R0, SLJIT_S4);
1167411671
sljit_set_label(sljit_emit_jump(compiler, SLJIT_ATOMIC_NOT_STORED), label);
11675-
/* buf[25] */
11676-
sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_MEM1(SLJIT_S0), 25 * sizeof(sljit_sw), SLJIT_R0, 0);
11672+
sljit_set_label(jump, sljit_emit_label(compiler));
1167711673

11678-
sljit_emit_op2(compiler, SLJIT_ADD, SLJIT_R1, 0, SLJIT_S0, 0, SLJIT_IMM, 26 * sizeof(sljit_sw) + 1);
11674+
sljit_emit_op2(compiler, SLJIT_ADD, SLJIT_R1, 0, SLJIT_S0, 0, SLJIT_IMM, 9 * sizeof(sljit_sw) + 1);
1167911675
label = sljit_emit_label(compiler);
1168011676
sljit_emit_atomic_load(compiler, SLJIT_MOV_U8, SLJIT_R0, SLJIT_R1);
11681-
/* buf[27] */
11682-
sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_MEM1(SLJIT_S0), 27 * sizeof(sljit_sw), SLJIT_R0, 0);
11677+
sljit_emit_op1(compiler, SLJIT_MOV_U8, SLJIT_S1, 0, SLJIT_MEM1(SLJIT_R1), 0);
11678+
skip = sljit_emit_cmp(compiler, SLJIT_NOT_EQUAL, SLJIT_R0, 0, SLJIT_S1, 0);
1168311679
sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_R2, 0, SLJIT_IMM, 204);
11684-
/* buf[26] */
11680+
/* buf[9] */
1168511681
sljit_emit_atomic_store(compiler, SLJIT_MOV_U8 | SLJIT_SET_ATOMIC_STORED, SLJIT_R2, SLJIT_R1, SLJIT_R0);
1168611682
jump = sljit_emit_jump(compiler, SLJIT_ATOMIC_STORED);
1168711683
sljit_set_label(sljit_emit_jump(compiler, SLJIT_JUMP), label);
1168811684
sljit_set_label(jump, sljit_emit_label(compiler));
11685+
sljit_set_label(skip, sljit_emit_label(compiler));
1168911686

11690-
sljit_emit_op2(compiler, SLJIT_ADD, SLJIT_R1, 0, SLJIT_S0, 0, SLJIT_IMM, 28 * sizeof(sljit_sw) + 2);
11687+
sljit_emit_op2(compiler, SLJIT_ADD, SLJIT_R1, 0, SLJIT_S0, 0, SLJIT_IMM, 10 * sizeof(sljit_sw) + 2);
1169111688
label = sljit_emit_label(compiler);
1169211689
sljit_emit_atomic_load(compiler, SLJIT_MOV_U8, SLJIT_R0, SLJIT_R1);
11693-
/* buf[29] */
11694-
sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_MEM1(SLJIT_S0), 29 * sizeof(sljit_sw), SLJIT_R0, 0);
11690+
sljit_emit_op1(compiler, SLJIT_MOV_U8, SLJIT_S1, 0, SLJIT_MEM1(SLJIT_R1), 0);
11691+
jump = sljit_emit_cmp(compiler, SLJIT_NOT_EQUAL, SLJIT_R0, 0, SLJIT_S1, 0);
1169511692
sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_R2, 0, SLJIT_IMM, 240);
11696-
/* buf[28] */
11693+
/* buf[10] */
1169711694
sljit_emit_atomic_store(compiler, SLJIT_MOV_U8 | SLJIT_SET_ATOMIC_STORED, SLJIT_R2, SLJIT_R1, SLJIT_R0);
1169811695
sljit_set_label(sljit_emit_jump(compiler, SLJIT_ATOMIC_NOT_STORED), label);
11696+
sljit_set_label(jump, sljit_emit_label(compiler));
1169911697

11700-
sljit_emit_op2(compiler, SLJIT_ADD, SLJIT_R1, 0, SLJIT_S0, 0, SLJIT_IMM, 30 * sizeof(sljit_sw) + 2);
11698+
sljit_emit_op2(compiler, SLJIT_ADD, SLJIT_R1, 0, SLJIT_S0, 0, SLJIT_IMM, 11 * sizeof(sljit_sw) + 2);
1170111699
label = sljit_emit_label(compiler);
1170211700
sljit_emit_atomic_load(compiler, SLJIT_MOV_U16, SLJIT_R0, SLJIT_R1);
11703-
/* buf[31] */
11704-
sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_MEM1(SLJIT_S0), 31 * sizeof(sljit_sw), SLJIT_R0, 0);
11701+
sljit_emit_op1(compiler, SLJIT_MOV_U16, SLJIT_S1, 0, SLJIT_MEM1(SLJIT_R1), 0);
11702+
jump = sljit_emit_cmp(compiler, SLJIT_NOT_EQUAL, SLJIT_R0, 0, SLJIT_S1, 0);
1170511703
sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_R2, 0, SLJIT_IMM, 51403);
11706-
/* buf[30] */
11704+
/* buf[11] */
1170711705
sljit_emit_atomic_store(compiler, SLJIT_MOV_U16 | SLJIT_SET_ATOMIC_STORED, SLJIT_R2, SLJIT_R1, SLJIT_R0);
1170811706
sljit_set_label(sljit_emit_jump(compiler, SLJIT_ATOMIC_NOT_STORED), label);
11707+
sljit_set_label(jump, sljit_emit_label(compiler));
1170911708

1171011709
sljit_emit_return_void(compiler);
11711-
1171211710
code.code = sljit_generate_code(compiler);
1171311711
CHECK(compiler);
1171411712
sljit_free_compiler(compiler);
1171511713

1171611714
code.func1((sljit_sw)&buf);
11715+
1171711716
FAILED(buf[0] != -9856, "test92 case 1 failed\n");
11718-
FAILED(buf[1] != -4678, "test92 case 2 failed\n");
11719-
FAILED(*(sljit_u8*)(buf + 2) != 203, "test92 case 3 failed\n");
11720-
FAILED(((sljit_u8*)(buf + 2))[1] != 0xff, "test92 case 4 failed\n");
11721-
FAILED(buf[3] != 178, "test92 case 5 failed\n");
11722-
FAILED(buf[4] != 203, "test92 case 6 failed\n");
11723-
FAILED(*(sljit_u8*)(buf + 5) != 97, "test92 case 7 failed\n");
11724-
FAILED(((sljit_u8*)(buf + 5))[1] != 0xff, "test92 case 8 failed\n");
11725-
FAILED(*(sljit_u32*)(buf + 6) != 211, "test92 case 9 failed\n");
11726-
FAILED(buf[7] != (sljit_sw)(buf + 5), "test92 case 10 failed\n");
11727-
FAILED(buf[8] != 97, "test92 case 11 failed\n");
11728-
FAILED(*(sljit_u16*)(buf + 9) != (sljit_u16)(sljit_sw)(buf + 9), "test92 case 12 failed\n");
11729-
FAILED(((sljit_u8*)(buf + 9))[2] != 0xff, "test92 case 13 failed\n");
11730-
FAILED(buf[10] != 17897, "test92 case 14 failed\n");
11731-
FAILED(buf[11] != (sljit_sw)(buf + 9), "test92 case 15 failed\n");
11732-
FAILED(*(sljit_u16*)(buf + 12) != 41306, "test92 case 16 failed\n");
11733-
FAILED(((sljit_u8*)(buf + 12))[2] != 0xff, "test92 case 17 failed\n");
11734-
FAILED(*(sljit_u32*)(buf + 13) != 57812, "test92 case 18 failed\n");
11735-
FAILED(buf[14] != 41306, "test92 case 19 failed\n");
11736-
FAILED(*(sljit_u32*)(buf + 15) != 987654321, "test92 case 20 failed\n");
11737-
#if (defined SLJIT_64BIT_ARCHITECTURE && SLJIT_64BIT_ARCHITECTURE)
11738-
FAILED(((sljit_u8*)(buf + 15))[4] != 0xff, "test92 case 21 failed\n");
11739-
#endif /* SLJIT_64BIT_ARCHITECTURE */
11740-
FAILED(buf[16] != 1234567890, "test92 case 22 failed\n");
11741-
FAILED(*(sljit_u32*)(buf + 17) != 678906789, "test92 case 23 failed\n");
11742-
#if (defined SLJIT_64BIT_ARCHITECTURE && SLJIT_64BIT_ARCHITECTURE)
11743-
FAILED(((sljit_u8*)(buf + 17))[4] != 0xff, "test92 case 24 failed\n");
11744-
#endif /* SLJIT_64BIT_ARCHITECTURE */
11745-
FAILED(*(sljit_u32*)(buf + 18) != 987609876, "test92 case 25 failed\n");
11746-
FAILED(buf[19] != -573621, "test92 case 26 failed\n");
11747-
FAILED(*(sljit_u8*)(buf + 20) != 240, "test92 case 27 failed\n");
11748-
FAILED(((sljit_u8*)(buf + 20))[1] != 0xff, "test92 case 28 failed\n");
11749-
FAILED(buf[21] != 192, "test92 case 29 failed\n");
11750-
FAILED(buf[22] != -5893, "test92 case 30 failed\n");
11751-
FAILED(buf[23] != 4059, "test92 case 31 failed\n");
11752-
FAILED(buf[24] != 6359, "test92 case 32 failed\n");
11753-
FAILED(buf[25] != (sljit_sw)(buf + 23), "test92 case 33 failed\n");
11754-
FAILED(((sljit_u8*)(buf + 26))[0] != 255, "test92 case 34 failed\n");
11755-
FAILED(((sljit_u8*)(buf + 26))[1] != 204, "test92 case 35 failed\n");
11756-
FAILED(((sljit_u8*)(buf + 26))[2] != 255, "test92 case 36 failed\n");
11757-
FAILED(buf[27] != 105, "test92 case 37 failed\n");
11758-
FAILED(((sljit_u8*)(buf + 28))[1] != 255, "test92 case 38 failed\n");
11759-
FAILED(((sljit_u8*)(buf + 28))[2] != 240, "test92 case 39 failed\n");
11760-
FAILED(((sljit_u8*)(buf + 28))[3] != 255, "test92 case 40 failed\n");
11761-
FAILED(buf[29] != 13, "test92 case 41 failed\n");
11762-
FAILED(((sljit_u16*)(buf + 30))[0] != 65535, "test92 case 42 failed\n");
11763-
FAILED(((sljit_u16*)(buf + 30))[1] != 51403, "test92 case 43 failed\n");
11764-
FAILED(buf[31] != 14876, "test92 case 44 failed\n");
11717+
FAILED(buf[1] != HV(sljit_u8, 0, 203), "test92 case 2 failed\n");
11718+
FAILED(buf[2] != HV(sljit_u8, 0, 97), "test92 case 3 failed\n");
11719+
FAILED(buf[3] != HV(sljit_u16, 0, (sljit_u16)(sljit_sw)(buf + 3)),
11720+
"test92 case 4 failed\n");
11721+
FAILED(buf[4] != HV(sljit_u16, 0, 41306), "test92 case 5 failed\n");
11722+
FAILED(buf[5] != HV(sljit_u32, 0, 987654321), "test92 case 6 failed\n");
11723+
FAILED(buf[6] != HV(sljit_u32, 0, 678906789), "test92 case 7 failed\n");
11724+
FAILED(buf[7] != HV(sljit_u8, 0, 240), "test92 case 8 failed\n");
11725+
FAILED(buf[8] != 4059, "test92 case 9 failed\n");
11726+
FAILED(buf[9] != HV(sljit_u8, 1, 204), "test92 case 10 failed\n");
11727+
FAILED(buf[10] != HV(sljit_u8, 2, 240), "test92 case 11 failed\n");
11728+
FAILED(buf[11] != HV(sljit_u16, 1, 51403), "test92 case 12 failed\n");
1176511729

1176611730
sljit_free_code(code.code, NULL);
1176711731
#endif
1176811732
successful_tests++;
1176911733
}
1177011734

11735+
#undef HV
11736+
#undef H
11737+
#undef O
11738+
#undef M
11739+
1177111740
static void test93(void)
1177211741
{
1177311742
/* Floating point set immediate. */

0 commit comments

Comments
 (0)