Skip to content

Commit

Permalink
Improve vector reg support on s390x
Browse files Browse the repository at this point in the history
  • Loading branch information
Zoltan Herczeg committed Nov 26, 2024
1 parent dcd3b10 commit 500dd44
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 3 deletions.
2 changes: 1 addition & 1 deletion sljit_src/sljitNativeARM_32.c
Original file line number Diff line number Diff line change
Expand Up @@ -2676,7 +2676,7 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_get_register_index(sljit_s32 type, slji
if (type == SLJIT_FLOAT_REGISTER || type == SLJIT_SIMD_REG_64)
return freg_map[reg];

if (type != SLJIT_SIMD_REG_128)
if (type == SLJIT_SIMD_REG_128)
return freg_map[reg] & ~0x1;

return -1;
Expand Down
2 changes: 1 addition & 1 deletion sljit_src/sljitNativeARM_T2_32.c
Original file line number Diff line number Diff line change
Expand Up @@ -2244,7 +2244,7 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_get_register_index(sljit_s32 type, slji
if (type == SLJIT_FLOAT_REGISTER || type == SLJIT_SIMD_REG_64)
return freg_map[reg];

if (type != SLJIT_SIMD_REG_128)
if (type == SLJIT_SIMD_REG_128)
return freg_map[reg] & ~0x1;

return -1;
Expand Down
2 changes: 1 addition & 1 deletion sljit_src/sljitNativeS390X.c
Original file line number Diff line number Diff line change
Expand Up @@ -3187,7 +3187,7 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_get_register_index(sljit_s32 type, slji
if (type == SLJIT_GP_REGISTER)
return (sljit_s32)gpr(reg);

if (type != SLJIT_FLOAT_REGISTER)
if (type != SLJIT_FLOAT_REGISTER && type != SLJIT_SIMD_REG_128)
return -1;

return (sljit_s32)freg_map[reg];
Expand Down
10 changes: 10 additions & 0 deletions test_src/sljitTestSimd.h
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,12 @@ static void test_simd1(void)
sljit_u8 data[63 + 880];
sljit_s32 vs0 = SLJIT_NUMBER_OF_SAVED_VECTOR_REGISTERS > 0 ? SLJIT_VS0 : SLJIT_VR5;

SLJIT_ASSERT(sljit_get_register_index(SLJIT_SIMD_REG_128, SLJIT_VR0) != -1
&& sljit_get_register_index(SLJIT_SIMD_REG_128, SLJIT_TMP_DEST_VREG) != -1);

SLJIT_ASSERT(SLJIT_NUMBER_OF_SAVED_VECTOR_REGISTERS == 0
|| sljit_get_register_index(SLJIT_SIMD_REG_128, SLJIT_VS0) != -1);

if (verbose)
printf("Run test_simd1\n");

Expand Down Expand Up @@ -235,6 +241,8 @@ static void test_simd1(void)
FAILED(!check_simd_mov(buf + 288, 239, 16), "test_simd1 case 6 failed\n");
FAILED(!check_simd_mov(buf + 344, 176, 16), "test_simd1 case 7 failed\n");
#if IS_ARM
SLJIT_ASSERT(sljit_get_register_index(SLJIT_SIMD_REG_64, SLJIT_VR0) != -1
&& sljit_get_register_index(SLJIT_SIMD_REG_64, SLJIT_TMP_DEST_VREG) != -1);
FAILED(!check_simd_mov(buf + 384, 88, 8), "test_simd1 case 8 failed\n");
FAILED(!check_simd_mov(buf + 402, 197, 8), "test_simd1 case 9 failed\n");
#endif /* IS_ARM */
Expand All @@ -247,6 +255,8 @@ static void test_simd1(void)
#endif /* IS_ARM */

if (supported[0]) {
SLJIT_ASSERT(sljit_get_register_index(SLJIT_SIMD_REG_256, SLJIT_VR0) != -1
&& sljit_get_register_index(SLJIT_SIMD_REG_256, SLJIT_TMP_DEST_VREG) != -1);
FAILED(!check_simd_mov(buf + 768, 85, 32), "test_simd1 case 15 failed\n");
FAILED(!check_simd_mov(buf + 834, 215, 32), "test_simd1 case 16 failed\n");
}
Expand Down

0 comments on commit 500dd44

Please sign in to comment.