[v2] LoongArch: Modify the check type of the vector builtin function.

Message ID 20231213013107.34464-1-chenxiaolong@loongson.cn
State Committed
Commit 555ecd30c1ed49a025c3c86f8bc989ab15f2614b
Headers
Series [v2] LoongArch: Modify the check type of the vector builtin function. |

Checks

Context Check Description
linaro-tcwg-bot/tcwg_gcc_build--master-arm success Testing passed
linaro-tcwg-bot/tcwg_gcc_build--master-aarch64 success Testing passed
linaro-tcwg-bot/tcwg_gcc_check--master-aarch64 success Testing passed

Commit Message

chenxiaolong Dec. 13, 2023, 1:31 a.m. UTC
  On LoongArch architecture, using the latest gcc14 in regression test,
it is found that the vector test cases in vector directory appear FAIL
entries with unmatched pointer types. In order to solve this kind of
problem, the type of the variable in the check result is modified with
the parameter type defined in the vector builtin function.

gcc/testsuite/ChangeLog:

	* gcc.target/loongarch/vector/simd_correctness_check.h:The variable
	types in the check results are modified in conjunction with the
	parameter types defined in the vector builtin function.
---
v1->v2:
If an error occurs, output the data in hexadecimal format, and fill the
high part of the result with 0.
---
 .../loongarch/vector/simd_correctness_check.h       | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)
  

Comments

Lulu Cheng Dec. 21, 2023, 9:22 a.m. UTC | #1
Pushed to r14-6774.

在 2023/12/13 上午9:31, chenxiaolong 写道:
> On LoongArch architecture, using the latest gcc14 in regression test,
> it is found that the vector test cases in vector directory appear FAIL
> entries with unmatched pointer types. In order to solve this kind of
> problem, the type of the variable in the check result is modified with
> the parameter type defined in the vector builtin function.
>
> gcc/testsuite/ChangeLog:
>
> 	* gcc.target/loongarch/vector/simd_correctness_check.h:The variable
> 	types in the check results are modified in conjunction with the
> 	parameter types defined in the vector builtin function.
> ---
> v1->v2:
> If an error occurs, output the data in hexadecimal format, and fill the
> high part of the result with 0.
> ---
>   .../loongarch/vector/simd_correctness_check.h       | 13 +++++++------
>   1 file changed, 7 insertions(+), 6 deletions(-)
>
> diff --git a/gcc/testsuite/gcc.target/loongarch/vector/simd_correctness_check.h b/gcc/testsuite/gcc.target/loongarch/vector/simd_correctness_check.h
> index eb7fbd59cc7..551340bd51f 100644
> --- a/gcc/testsuite/gcc.target/loongarch/vector/simd_correctness_check.h
> +++ b/gcc/testsuite/gcc.target/loongarch/vector/simd_correctness_check.h
> @@ -8,11 +8,12 @@
>         int fail = 0;                                                           \
>         for (size_t i = 0; i < sizeof (res) / sizeof (res[0]); ++i)             \
>           {                                                                     \
> -          long *temp_ref = &ref[i], *temp_res = &res[i];                      \
> +          long long *temp_ref = (long long *)&ref[i],                         \
> +		*temp_res = (long long *)&res[i];			      \
>             if (abs (*temp_ref - *temp_res) > 0)                                \
>               {                                                                 \
>                 printf (" error: %s at line %ld , expected " #ref               \
> -                      "[%ld]:0x%lx, got: 0x%lx\n",                            \
> +                      "[%ld]:0x%016lx, got: 0x%016lx\n",                      \
>                         __FILE__, line, i, *temp_ref, *temp_res);               \
>                 fail = 1;                                                       \
>               }                                                                 \
> @@ -28,11 +29,11 @@
>         int fail = 0;                                                           \
>         for (size_t i = 0; i < sizeof (res) / sizeof (res[0]); ++i)             \
>           {                                                                     \
> -          int *temp_ref = &ref[i], *temp_res = &res[i];                       \
> +          int *temp_ref = (int *)&ref[i], *temp_res = (int *)&res[i];         \
>             if (abs (*temp_ref - *temp_res) > 0)                                \
>               {                                                                 \
>                 printf (" error: %s at line %ld , expected " #ref               \
> -                      "[%ld]:0x%x, got: 0x%x\n",                              \
> +                      "[%ld]:0x%08x, got: 0x%08x\n",                          \
>                         __FILE__, line, i, *temp_ref, *temp_res);               \
>                 fail = 1;                                                       \
>               }                                                                 \
> @@ -47,8 +48,8 @@
>       {                                                                         \
>         if (ref != res)                                                         \
>           {                                                                     \
> -          printf (" error: %s at line %ld , expected %d, got %d\n", __FILE__, \
> -                  line, ref, res);                                            \
> +          printf (" error: %s at line %ld , expected 0x:%016x",               \
> +		  "got 0x:%016x\n", __FILE__, line, ref, res);                \
>           }                                                                     \
>       }                                                                         \
>     while (0)
  

Patch

diff --git a/gcc/testsuite/gcc.target/loongarch/vector/simd_correctness_check.h b/gcc/testsuite/gcc.target/loongarch/vector/simd_correctness_check.h
index eb7fbd59cc7..551340bd51f 100644
--- a/gcc/testsuite/gcc.target/loongarch/vector/simd_correctness_check.h
+++ b/gcc/testsuite/gcc.target/loongarch/vector/simd_correctness_check.h
@@ -8,11 +8,12 @@ 
       int fail = 0;                                                           \
       for (size_t i = 0; i < sizeof (res) / sizeof (res[0]); ++i)             \
         {                                                                     \
-          long *temp_ref = &ref[i], *temp_res = &res[i];                      \
+          long long *temp_ref = (long long *)&ref[i],                         \
+		*temp_res = (long long *)&res[i];			      \
           if (abs (*temp_ref - *temp_res) > 0)                                \
             {                                                                 \
               printf (" error: %s at line %ld , expected " #ref               \
-                      "[%ld]:0x%lx, got: 0x%lx\n",                            \
+                      "[%ld]:0x%016lx, got: 0x%016lx\n",                      \
                       __FILE__, line, i, *temp_ref, *temp_res);               \
               fail = 1;                                                       \
             }                                                                 \
@@ -28,11 +29,11 @@ 
       int fail = 0;                                                           \
       for (size_t i = 0; i < sizeof (res) / sizeof (res[0]); ++i)             \
         {                                                                     \
-          int *temp_ref = &ref[i], *temp_res = &res[i];                       \
+          int *temp_ref = (int *)&ref[i], *temp_res = (int *)&res[i];         \
           if (abs (*temp_ref - *temp_res) > 0)                                \
             {                                                                 \
               printf (" error: %s at line %ld , expected " #ref               \
-                      "[%ld]:0x%x, got: 0x%x\n",                              \
+                      "[%ld]:0x%08x, got: 0x%08x\n",                          \
                       __FILE__, line, i, *temp_ref, *temp_res);               \
               fail = 1;                                                       \
             }                                                                 \
@@ -47,8 +48,8 @@ 
     {                                                                         \
       if (ref != res)                                                         \
         {                                                                     \
-          printf (" error: %s at line %ld , expected %d, got %d\n", __FILE__, \
-                  line, ref, res);                                            \
+          printf (" error: %s at line %ld , expected 0x:%016x",               \
+		  "got 0x:%016x\n", __FILE__, line, ref, res);                \
         }                                                                     \
     }                                                                         \
   while (0)