RISC-V: Adjust stdint.h to stdint-gcc.h for rvv tests

Message ID 20230516065201.751821-1-pan2.li@intel.com
State Accepted
Headers
Series RISC-V: Adjust stdint.h to stdint-gcc.h for rvv tests |

Checks

Context Check Description
snail/gcc-patch-check success Github commit url

Commit Message

Li, Pan2 via Gcc-patches May 16, 2023, 6:52 a.m. UTC
  From: Pan Li <pan2.li@intel.com>

This patch would like to align the stdint.h to the stdint-gcc.h for all
the RVV test files. Aka:

stdint.h => stdint-gcc.h

Signed-off-by: Pan Li <pan2.li@intel.com>

gcc/testsuite/ChangeLog:

	* gcc.target/riscv/rvv/autovec/binop/shift-scalar-template.h:
	Replace stdint.h with stdint-gcc.h.
	* gcc.target/riscv/rvv/autovec/binop/shift-template.h: Ditto.
	* gcc.target/riscv/rvv/autovec/binop/vadd-template.h: Ditto.
	* gcc.target/riscv/rvv/autovec/binop/vand-template.h: Ditto.
	* gcc.target/riscv/rvv/autovec/binop/vdiv-template.h: Ditto.
	* gcc.target/riscv/rvv/autovec/binop/vmax-template.h: Ditto.
	* gcc.target/riscv/rvv/autovec/binop/vmin-template.h: Ditto.
	* gcc.target/riscv/rvv/autovec/binop/vmul-template.h: Ditto.
	* gcc.target/riscv/rvv/autovec/binop/vor-template.h: Ditto.
	* gcc.target/riscv/rvv/autovec/binop/vrem-template.h: Ditto.
	* gcc.target/riscv/rvv/autovec/binop/vsub-template.h: Ditto.
	* gcc.target/riscv/rvv/autovec/binop/vxor-template.h: Ditto.
	* gcc.target/riscv/rvv/autovec/series-1.c: Ditto.
	* gcc.target/riscv/rvv/autovec/vmv-imm-run.c: Ditto.
	* gcc.target/riscv/rvv/autovec/vmv-imm-template.h: Ditto.
---
 .../gcc.target/riscv/rvv/autovec/binop/shift-scalar-template.h  | 2 +-
 .../gcc.target/riscv/rvv/autovec/binop/shift-template.h         | 2 +-
 .../gcc.target/riscv/rvv/autovec/binop/vadd-template.h          | 2 +-
 .../gcc.target/riscv/rvv/autovec/binop/vand-template.h          | 2 +-
 .../gcc.target/riscv/rvv/autovec/binop/vdiv-template.h          | 2 +-
 .../gcc.target/riscv/rvv/autovec/binop/vmax-template.h          | 2 +-
 .../gcc.target/riscv/rvv/autovec/binop/vmin-template.h          | 2 +-
 .../gcc.target/riscv/rvv/autovec/binop/vmul-template.h          | 2 +-
 gcc/testsuite/gcc.target/riscv/rvv/autovec/binop/vor-template.h | 2 +-
 .../gcc.target/riscv/rvv/autovec/binop/vrem-template.h          | 2 +-
 .../gcc.target/riscv/rvv/autovec/binop/vsub-template.h          | 2 +-
 .../gcc.target/riscv/rvv/autovec/binop/vxor-template.h          | 2 +-
 gcc/testsuite/gcc.target/riscv/rvv/autovec/series-1.c           | 2 +-
 gcc/testsuite/gcc.target/riscv/rvv/autovec/vmv-imm-run.c        | 2 +-
 gcc/testsuite/gcc.target/riscv/rvv/autovec/vmv-imm-template.h   | 2 +-
 15 files changed, 15 insertions(+), 15 deletions(-)
  

Comments

Robin Dapp May 16, 2023, 7:10 a.m. UTC | #1
> This patch would like to align the stdint.h to the stdint-gcc.h for all
> the RVV test files. Aka:
> 
> stdint.h => stdint-gcc.h

Looks good.  Jeff already pre-approved so you can go ahead and install
this on the trunk.

Regards
 Robin
  
Li, Pan2 via Gcc-patches May 16, 2023, 7:16 a.m. UTC | #2
Got it, thanks, will commit to trunk after pass the rvv test.

Pan

-----Original Message-----
From: Robin Dapp <rdapp.gcc@gmail.com> 
Sent: Tuesday, May 16, 2023 3:11 PM
To: Li, Pan2 <pan2.li@intel.com>; gcc-patches@gcc.gnu.org
Cc: rdapp.gcc@gmail.com; juzhe.zhong@rivai.ai; kito.cheng@sifive.com; Wang, Yanzhang <yanzhang.wang@intel.com>; jeffreyalaw@gmail.com
Subject: Re: [PATCH] RISC-V: Adjust stdint.h to stdint-gcc.h for rvv tests

> This patch would like to align the stdint.h to the stdint-gcc.h for 
> all the RVV test files. Aka:
> 
> stdint.h => stdint-gcc.h

Looks good.  Jeff already pre-approved so you can go ahead and install this on the trunk.

Regards
 Robin
  
Li, Pan2 via Gcc-patches May 16, 2023, 7:29 a.m. UTC | #3
Committed, thanks all.

Pan

-----Original Message-----
From: Li, Pan2 
Sent: Tuesday, May 16, 2023 3:17 PM
To: Robin Dapp <rdapp.gcc@gmail.com>; gcc-patches@gcc.gnu.org
Cc: juzhe.zhong@rivai.ai; kito.cheng@sifive.com; Wang, Yanzhang <yanzhang.wang@intel.com>; jeffreyalaw@gmail.com
Subject: RE: [PATCH] RISC-V: Adjust stdint.h to stdint-gcc.h for rvv tests

Got it, thanks, will commit to trunk after pass the rvv test.

Pan

-----Original Message-----
From: Robin Dapp <rdapp.gcc@gmail.com>
Sent: Tuesday, May 16, 2023 3:11 PM
To: Li, Pan2 <pan2.li@intel.com>; gcc-patches@gcc.gnu.org
Cc: rdapp.gcc@gmail.com; juzhe.zhong@rivai.ai; kito.cheng@sifive.com; Wang, Yanzhang <yanzhang.wang@intel.com>; jeffreyalaw@gmail.com
Subject: Re: [PATCH] RISC-V: Adjust stdint.h to stdint-gcc.h for rvv tests

> This patch would like to align the stdint.h to the stdint-gcc.h for 
> all the RVV test files. Aka:
> 
> stdint.h => stdint-gcc.h

Looks good.  Jeff already pre-approved so you can go ahead and install this on the trunk.

Regards
 Robin
  
Richard Biener May 17, 2023, 6:15 a.m. UTC | #4
On Tue, May 16, 2023 at 9:11 AM Robin Dapp via Gcc-patches
<gcc-patches@gcc.gnu.org> wrote:
>
> > This patch would like to align the stdint.h to the stdint-gcc.h for all
> > the RVV test files. Aka:
> >
> > stdint.h => stdint-gcc.h
>
> Looks good.  Jeff already pre-approved so you can go ahead and install
> this on the trunk.

Huh, including stdint-gcc.h looks completely wrong.  What's the issue you are
trying to solve?

> Regards
>  Robin
  
Robin Dapp May 17, 2023, 6:25 a.m. UTC | #5
> Huh, including stdint-gcc.h looks completely wrong.  What's the issue you are
> trying to solve?

The way I understood it is that that's a temporary workaround until
all multilib et al. (+testsuite) configurations are in place but I
haven't checked the details myself.  Eventually this should be done
properly so we can include the regular headers.  Kito might want to
comment as he dealt with it before.

I used #include <stdlib.h> for all those tests and Andreas Schwab reported:
 
  /usr/include/gnu/stubs.h:11:11: fatal error: gnu/stubs-ilp32d.h: No such file or directory

Regards
 Robin
  
Kito Cheng May 17, 2023, 6:55 a.m. UTC | #6
RISC-V glibc will require corresponding muilti-lib has built there,
otherwise will report something like:

  /usr/include/gnu/stubs.h:11:11: fatal error: gnu/stubs-ilp32d.h: No
such file or directory

But actually we only require those fixed length types to compile and
scan assembly or dump,
So we don't really have those multilib built, that's the reason we
workaround this way.

This way could work even if the multilib build is disabled, and seems
ARM has same issue around that and just disable those tests:

---
# Return 1 if this is an ARM target supporting -mfloat-abi=soft.  Some
# multilibs may be incompatible with this option.

proc check_effective_target_arm_soft_ok { } {
   return [check_no_compiler_messages arm_soft_ok object {
       #include <stdint.h>
       int dummy;
       int main (void) { return 0; }
       } "-mfloat-abi=soft"]
}

# Return 1 if this is an ARM target supporting -mfloat-abi=soft even
# for linking.  Some multilibs may be incompatible with this option,
# and some linkers may reject incompatible options.

proc check_effective_target_arm_soft_ok_link { } {
   return [check_no_compiler_messages arm_soft_ok_link executable {
       #include <stdint.h>
       int dummy;
       int main (void) { return 0; }
       } "-mfloat-abi=soft"]
}
---


On Wed, May 17, 2023 at 2:25 PM Robin Dapp <rdapp.gcc@gmail.com> wrote:
>
> > Huh, including stdint-gcc.h looks completely wrong.  What's the issue you are
> > trying to solve?
>
> The way I understood it is that that's a temporary workaround until
> all multilib et al. (+testsuite) configurations are in place but I
> haven't checked the details myself.  Eventually this should be done
> properly so we can include the regular headers.  Kito might want to
> comment as he dealt with it before.
>
> I used #include <stdlib.h> for all those tests and Andreas Schwab reported:
>
>   /usr/include/gnu/stubs.h:11:11: fatal error: gnu/stubs-ilp32d.h: No such file or directory
>
> Regards
>  Robin
  
Richard Biener May 17, 2023, 12:22 p.m. UTC | #7
> Am 17.05.2023 um 08:55 schrieb Kito Cheng <kito.cheng@sifive.com>:
> 
> RISC-V glibc will require corresponding muilti-lib has built there,
> otherwise will report something like:
> 
>  /usr/include/gnu/stubs.h:11:11: fatal error: gnu/stubs-ilp32d.h: No
> such file or directory
> 
> But actually we only require those fixed length types to compile and
> scan assembly or dump,
> So we don't really have those multilib built, that's the reason we
> workaround this way.
> 
> This way could work even if the multilib build is disabled, and seems
> ARM has same issue around that and just disable those tests:

Then just mimic that or avoid using stdint.h and instead use things like __INT32_TYPE__?

> ---
> # Return 1 if this is an ARM target supporting -mfloat-abi=soft.  Some
> # multilibs may be incompatible with this option.
> 
> proc check_effective_target_arm_soft_ok { } {
>   return [check_no_compiler_messages arm_soft_ok object {
>       #include <stdint.h>
>       int dummy;
>       int main (void) { return 0; }
>       } "-mfloat-abi=soft"]
> }
> 
> # Return 1 if this is an ARM target supporting -mfloat-abi=soft even
> # for linking.  Some multilibs may be incompatible with this option,
> # and some linkers may reject incompatible options.
> 
> proc check_effective_target_arm_soft_ok_link { } {
>   return [check_no_compiler_messages arm_soft_ok_link executable {
>       #include <stdint.h>
>       int dummy;
>       int main (void) { return 0; }
>       } "-mfloat-abi=soft"]
> }
> ---
> 
> 
>> On Wed, May 17, 2023 at 2:25 PM Robin Dapp <rdapp.gcc@gmail.com> wrote:
>> 
>>> Huh, including stdint-gcc.h looks completely wrong.  What's the issue you are
>>> trying to solve?
>> 
>> The way I understood it is that that's a temporary workaround until
>> all multilib et al. (+testsuite) configurations are in place but I
>> haven't checked the details myself.  Eventually this should be done
>> properly so we can include the regular headers.  Kito might want to
>> comment as he dealt with it before.
>> 
>> I used #include <stdlib.h> for all those tests and Andreas Schwab reported:
>> 
>>  /usr/include/gnu/stubs.h:11:11: fatal error: gnu/stubs-ilp32d.h: No such file or directory
>> 
>> Regards
>> Robin
  
Kito Cheng May 17, 2023, 1:07 p.m. UTC | #8
> > RISC-V glibc will require corresponding muilti-lib has built there,
> > otherwise will report something like:
> >
> >  /usr/include/gnu/stubs.h:11:11: fatal error: gnu/stubs-ilp32d.h: No
> > such file or directory
> >
> > But actually we only require those fixed length types to compile and
> > scan assembly or dump,
> > So we don't really have those multilib built, that's the reason we
> > workaround this way.
> >
> > This way could work even if the multilib build is disabled, and seems
> > ARM has same issue around that and just disable those tests:
>
> Then just mimic that or avoid using stdint.h and instead use things like __INT32_TYPE__?

Hmmm, then that seems like we are inline those types definition from
stdint-gcc.h?

I mean what stdint-gcc.h did is just same as that:

#ifdef __INT8_TYPE__
typedef __INT8_TYPE__ int8_t;
#endif
...
#ifdef __UINT64_TYPE__
typedef __UINT64_TYPE__ uint64_t;
#endif
  

Patch

diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/binop/shift-scalar-template.h b/gcc/testsuite/gcc.target/riscv/rvv/autovec/binop/shift-scalar-template.h
index a0ddc00849d..8d1cefdca85 100644
--- a/gcc/testsuite/gcc.target/riscv/rvv/autovec/binop/shift-scalar-template.h
+++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/binop/shift-scalar-template.h
@@ -2,7 +2,7 @@ 
 /* { dg-do run } */
 /* { dg-additional-options "-std=c99 --param=riscv-autovec-preference=scalable -fno-vect-cost-model --save-temps" } */
 
-#include <stdint.h>
+#include <stdint-gcc.h>
 #include <assert.h>
 
 #define SHIFTL(TYPE,VAL)				\
diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/binop/shift-template.h b/gcc/testsuite/gcc.target/riscv/rvv/autovec/binop/shift-template.h
index 64e0a386b06..16ae48c8ede 100644
--- a/gcc/testsuite/gcc.target/riscv/rvv/autovec/binop/shift-template.h
+++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/binop/shift-template.h
@@ -1,4 +1,4 @@ 
-#include <stdint.h>
+#include <stdint-gcc.h>
 
 #define TEST1_TYPE(TYPE)					\
   __attribute__((noipa))					\
diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/binop/vadd-template.h b/gcc/testsuite/gcc.target/riscv/rvv/autovec/binop/vadd-template.h
index 5ed79329138..cd945d471d2 100644
--- a/gcc/testsuite/gcc.target/riscv/rvv/autovec/binop/vadd-template.h
+++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/binop/vadd-template.h
@@ -1,4 +1,4 @@ 
-#include <stdint.h>
+#include <stdint-gcc.h>
 
 #define TEST_TYPE(TYPE) 				\
   __attribute__((noipa))				\
diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/binop/vand-template.h b/gcc/testsuite/gcc.target/riscv/rvv/autovec/binop/vand-template.h
index 7d02c83d164..5cabe073097 100644
--- a/gcc/testsuite/gcc.target/riscv/rvv/autovec/binop/vand-template.h
+++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/binop/vand-template.h
@@ -1,4 +1,4 @@ 
-#include <stdint.h>
+#include <stdint-gcc.h>
 
 #define TEST_TYPE(TYPE) 				\
   __attribute__((noipa))				\
diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/binop/vdiv-template.h b/gcc/testsuite/gcc.target/riscv/rvv/autovec/binop/vdiv-template.h
index 7fbba7b4133..12a1de32874 100644
--- a/gcc/testsuite/gcc.target/riscv/rvv/autovec/binop/vdiv-template.h
+++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/binop/vdiv-template.h
@@ -1,4 +1,4 @@ 
-#include <stdint.h>
+#include <stdint-gcc.h>
 
 #define TEST_TYPE(TYPE) 				\
   __attribute__((noipa))				\
diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/binop/vmax-template.h b/gcc/testsuite/gcc.target/riscv/rvv/autovec/binop/vmax-template.h
index df0f9f2aeeb..fc6a07e3ce9 100644
--- a/gcc/testsuite/gcc.target/riscv/rvv/autovec/binop/vmax-template.h
+++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/binop/vmax-template.h
@@ -1,4 +1,4 @@ 
-#include <stdint.h>
+#include <stdint-gcc.h>
 
 #define TEST_TYPE(TYPE) 				\
   __attribute__((noipa))				\
diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/binop/vmin-template.h b/gcc/testsuite/gcc.target/riscv/rvv/autovec/binop/vmin-template.h
index 459f58ddec1..06f6b95461e 100644
--- a/gcc/testsuite/gcc.target/riscv/rvv/autovec/binop/vmin-template.h
+++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/binop/vmin-template.h
@@ -1,4 +1,4 @@ 
-#include <stdint.h>
+#include <stdint-gcc.h>
 
 #define TEST_TYPE(TYPE) 				\
   __attribute__((noipa))				\
diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/binop/vmul-template.h b/gcc/testsuite/gcc.target/riscv/rvv/autovec/binop/vmul-template.h
index b029c06efd6..37f77972101 100644
--- a/gcc/testsuite/gcc.target/riscv/rvv/autovec/binop/vmul-template.h
+++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/binop/vmul-template.h
@@ -1,4 +1,4 @@ 
-#include <stdint.h>
+#include <stdint-gcc.h>
 
 #define TEST_TYPE(TYPE) 				\
   __attribute__((noipa))				\
diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/binop/vor-template.h b/gcc/testsuite/gcc.target/riscv/rvv/autovec/binop/vor-template.h
index 859ae67c5ee..e60146cc232 100644
--- a/gcc/testsuite/gcc.target/riscv/rvv/autovec/binop/vor-template.h
+++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/binop/vor-template.h
@@ -1,4 +1,4 @@ 
-#include <stdint.h>
+#include <stdint-gcc.h>
 
 #define TEST_TYPE(TYPE) 				\
   __attribute__((noipa))				\
diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/binop/vrem-template.h b/gcc/testsuite/gcc.target/riscv/rvv/autovec/binop/vrem-template.h
index 71eebc8b645..d5ef40667ff 100644
--- a/gcc/testsuite/gcc.target/riscv/rvv/autovec/binop/vrem-template.h
+++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/binop/vrem-template.h
@@ -1,4 +1,4 @@ 
-#include <stdint.h>
+#include <stdint-gcc.h>
 
 #define TEST_TYPE(TYPE) 				\
   __attribute__((noipa))				\
diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/binop/vsub-template.h b/gcc/testsuite/gcc.target/riscv/rvv/autovec/binop/vsub-template.h
index 0566f3dcbfb..8c0a9c99217 100644
--- a/gcc/testsuite/gcc.target/riscv/rvv/autovec/binop/vsub-template.h
+++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/binop/vsub-template.h
@@ -1,4 +1,4 @@ 
-#include <stdint.h>
+#include <stdint-gcc.h>
 
 #define TEST_TYPE(TYPE) 				\
   __attribute__((noipa))				\
diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/binop/vxor-template.h b/gcc/testsuite/gcc.target/riscv/rvv/autovec/binop/vxor-template.h
index 954a247f539..370b242f197 100644
--- a/gcc/testsuite/gcc.target/riscv/rvv/autovec/binop/vxor-template.h
+++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/binop/vxor-template.h
@@ -1,4 +1,4 @@ 
-#include <stdint.h>
+#include <stdint-gcc.h>
 
 #define TEST_TYPE(TYPE) 				\
   __attribute__((noipa))				\
diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/series-1.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/series-1.c
index a01f6ce7411..1c697228e9b 100644
--- a/gcc/testsuite/gcc.target/riscv/rvv/autovec/series-1.c
+++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/series-1.c
@@ -1,7 +1,7 @@ 
 /* { dg-do compile } */
 /* { dg-options "-march=rv32gcv -mabi=ilp32d --param riscv-autovec-preference=fixed-vlmax --param riscv-autovec-lmul=m4" } */
 
-#include <stdint.h>
+#include <stdint-gcc.h>
 
 #define NUM_ELEMS(TYPE) (64 / sizeof (TYPE))
 
diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/vmv-imm-run.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vmv-imm-run.c
index 309a296b686..6764110d461 100644
--- a/gcc/testsuite/gcc.target/riscv/rvv/autovec/vmv-imm-run.c
+++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vmv-imm-run.c
@@ -3,7 +3,7 @@ 
 
 #include "vmv-imm-template.h"
 
-#include <stdint.h>
+#include <stdint-gcc.h>
 #include <assert.h>
 
 #define SZ 512
diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/vmv-imm-template.h b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vmv-imm-template.h
index 93ba5204c2e..855343d7e3e 100644
--- a/gcc/testsuite/gcc.target/riscv/rvv/autovec/vmv-imm-template.h
+++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vmv-imm-template.h
@@ -1,4 +1,4 @@ 
-#include <stdint.h>
+#include <stdint-gcc.h>
 #include <assert.h>
 
 #define VMV_POS(TYPE,VAL)				\