testsuite: Fix some endianness bugs in p9 runnable tests.
This patch fixes some bugs in the powerpc testsuite for runnable tests whose expected values were endian dependent. gcc/testsuite/ChangeLog: 2020-10-15 David Edelsohn <dje.gcc@gmail.com> * gcc.target/powerpc/builtins-1-p9-runnable.c: Adjust for big endian. * gcc.target/powerpc/builtins-7-p9-runnable.c: Same.
This commit is contained in:
parent
7dbf96e2a2
commit
b7beab8282
2 changed files with 39 additions and 4 deletions
|
@ -16,8 +16,13 @@ int main() {
|
|||
vfb = (vector float){10.0, -2.0, 70.0, 999.0 };
|
||||
|
||||
/* Expected results. */
|
||||
#ifdef __BIG_ENDIAN__
|
||||
vexpected = (vector unsigned short) { 0x4900, 0xc000, 0x5460, 0x63ce,
|
||||
0x3666, 0x3e66, 0x4d00, 0x563e };
|
||||
#else
|
||||
vexpected = (vector unsigned short) { 0x3666, 0x3e66, 0x4d00, 0x563e,
|
||||
0x4900, 0xc000, 0x5460, 0x63ce};
|
||||
0x4900, 0xc000, 0x5460, 0x63ce };
|
||||
#endif
|
||||
|
||||
/*
|
||||
vresult = vec_pack_to_short_fp32 (vfa, vfb);
|
||||
|
@ -44,7 +49,7 @@ int main() {
|
|||
for(i = 0; i< 8; i++) {
|
||||
if (vresult[i] != vexpected[i]) {
|
||||
printf("i=[%d] 0x%x != 0x%x \n",i,vresult[i],vexpected[i]);
|
||||
abort();
|
||||
abort();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -93,10 +93,17 @@ int main()
|
|||
|
||||
vsi_arg = (vector signed int){0xA, 0xB, 0xC, 0xD};
|
||||
|
||||
#ifdef __BIG_ENDIAN__
|
||||
vec_uc_expected = (vector unsigned char){0, 0, 0, 0xB,
|
||||
5, 6, 7, 8,
|
||||
9, 10, 11, 12,
|
||||
13, 14, 15, 16};
|
||||
#else
|
||||
vec_uc_expected = (vector unsigned char){0xC, 0, 0, 0,
|
||||
5, 6, 7, 8,
|
||||
9, 10, 11, 12,
|
||||
13, 14, 15, 16};
|
||||
#endif
|
||||
/* Test vec_insert4b() */
|
||||
/* Insert into char 0 location */
|
||||
vec_uc_result = vec_insert4b (vsi_arg, vec_uc_arg, 0);
|
||||
|
@ -112,10 +119,17 @@ int main()
|
|||
}
|
||||
|
||||
/* insert into char 4 location */
|
||||
#ifdef __BIG_ENDIAN__
|
||||
vec_uc_expected = (vector unsigned char){1, 2, 3, 4,
|
||||
0, 0, 0, 3,
|
||||
9, 10, 11, 12,
|
||||
13, 14, 15, 16};
|
||||
#else
|
||||
vec_uc_expected = (vector unsigned char){1, 2, 3, 4,
|
||||
2, 0, 0, 0,
|
||||
9, 10, 11, 12,
|
||||
13, 14, 15, 16};
|
||||
#endif
|
||||
vui_arg = (vector unsigned int){0x4, 0x3, 0x2, 0x1};
|
||||
|
||||
vec_uc_result = vec_insert4b (vui_arg, vec_uc_arg, 4);
|
||||
|
@ -132,12 +146,20 @@ int main()
|
|||
|
||||
/* Test vec_extract4b() */
|
||||
/* Extract 4b, from char 0 location */
|
||||
#ifdef __BIG_ENDIAN__
|
||||
vec_uc_arg = (vector unsigned char){0, 0, 0, 10,
|
||||
0, 0, 0, 20,
|
||||
0, 0, 0, 30,
|
||||
0, 0, 0, 40};
|
||||
vec_ull_expected = (vector unsigned long long){10, 0};
|
||||
#else
|
||||
vec_uc_arg = (vector unsigned char){10, 0, 0, 0,
|
||||
20, 0, 0, 0,
|
||||
30, 0, 0, 0,
|
||||
40, 0, 0, 0};
|
||||
|
||||
vec_ull_expected = (vector unsigned long long){0, 10};
|
||||
#endif
|
||||
|
||||
vec_ull_result = vec_extract4b(vec_uc_arg, 0);
|
||||
|
||||
if (result_wrong_ull(vec_ull_expected, vec_ull_result))
|
||||
|
@ -151,12 +173,20 @@ int main()
|
|||
}
|
||||
|
||||
/* Extract 4b, from char 12 location */
|
||||
#ifdef __BIG_ENDIAN__
|
||||
vec_uc_arg = (vector unsigned char){0, 0, 0, 10,
|
||||
0, 0, 0, 20,
|
||||
0, 0, 0, 30,
|
||||
0, 0, 0, 40};
|
||||
vec_ull_expected = (vector unsigned long long){40, 0};
|
||||
#else
|
||||
vec_uc_arg = (vector unsigned char){10, 0, 0, 0,
|
||||
20, 0, 0, 0,
|
||||
30, 0, 0, 0,
|
||||
40, 0, 0, 0};
|
||||
|
||||
vec_ull_expected = (vector unsigned long long){0, 40};
|
||||
#endif
|
||||
|
||||
vec_ull_result = vec_extract4b(vec_uc_arg, 12);
|
||||
|
||||
if (result_wrong_ull(vec_ull_expected, vec_ull_result))
|
||||
|
|
Loading…
Add table
Reference in a new issue