diff mbox series

[v1] Test: Move pr116278 run test to c-torture [NFC]

Message ID 20240818071345.882890-1-pan2.li@intel.com
State New
Headers show
Series [v1] Test: Move pr116278 run test to c-torture [NFC] | expand

Commit Message

Li, Pan2 Aug. 18, 2024, 7:13 a.m. UTC
From: Pan Li <pan2.li@intel.com>

Move the run test of pr116278 to c-torture and leave the risc-v the
asm check under risc-v part.

	PR target/116278

gcc/testsuite/ChangeLog:

	* gcc.target/riscv/pr116278-run-1.c: Take compile instead of
	run test.
	* gcc.target/riscv/pr116278-run-2.c: Ditto.
	* gcc.c-torture/execute/pr116278-run-1.c: New test.
	* gcc.c-torture/execute/pr116278-run-2.c: New test.

Signed-off-by: Pan Li <pan2.li@intel.com>
---
 .../gcc.c-torture/execute/pr116278-run-1.c     | 18 ++++++++++++++++++
 .../gcc.c-torture/execute/pr116278-run-2.c     | 18 ++++++++++++++++++
 .../gcc.target/riscv/pr116278-run-1.c          |  2 +-
 .../gcc.target/riscv/pr116278-run-2.c          |  2 +-
 4 files changed, 38 insertions(+), 2 deletions(-)
 create mode 100644 gcc/testsuite/gcc.c-torture/execute/pr116278-run-1.c
 create mode 100644 gcc/testsuite/gcc.c-torture/execute/pr116278-run-2.c

Comments

Jeff Law Aug. 18, 2024, 3:19 p.m. UTC | #1
On 8/18/24 1:13 AM, pan2.li@intel.com wrote:
> From: Pan Li <pan2.li@intel.com>
> 
> Move the run test of pr116278 to c-torture and leave the risc-v the
> asm check under risc-v part.
> 
> 	PR target/116278
> 
> gcc/testsuite/ChangeLog:
> 
> 	* gcc.target/riscv/pr116278-run-1.c: Take compile instead of
> 	run test.
> 	* gcc.target/riscv/pr116278-run-2.c: Ditto.
> 	* gcc.c-torture/execute/pr116278-run-1.c: New test.
> 	* gcc.c-torture/execute/pr116278-run-2.c: New test.
We should be using the dg-torture framework, so the right directory for 
the test is gcc.dg/torture.

I suspect these tests (just based on the constants that appear) may not 
work on the 16 bit integer targets.  So we may need

/* { dg-require-effective-target int32 } */

But I don't mind faulting that in if/when we see the 16bit int targets 
complain.

So OK in the right directory (gcc.dg/torture).

Jeff
Li, Pan2 Aug. 19, 2024, 1:24 a.m. UTC | #2
Sure, will send v2 for this.

Pan

-----Original Message-----
From: Jeff Law <jeffreyalaw@gmail.com> 
Sent: Sunday, August 18, 2024 11:19 PM
To: Li, Pan2 <pan2.li@intel.com>; gcc-patches@gcc.gnu.org
Cc: richard.guenther@gmail.com; juzhe.zhong@rivai.ai; kito.cheng@gmail.com; rdapp.gcc@gmail.com; sam@gentoo.org
Subject: Re: [PATCH v1] Test: Move pr116278 run test to c-torture [NFC]



On 8/18/24 1:13 AM, pan2.li@intel.com wrote:
> From: Pan Li <pan2.li@intel.com>
> 
> Move the run test of pr116278 to c-torture and leave the risc-v the
> asm check under risc-v part.
> 
> 	PR target/116278
> 
> gcc/testsuite/ChangeLog:
> 
> 	* gcc.target/riscv/pr116278-run-1.c: Take compile instead of
> 	run test.
> 	* gcc.target/riscv/pr116278-run-2.c: Ditto.
> 	* gcc.c-torture/execute/pr116278-run-1.c: New test.
> 	* gcc.c-torture/execute/pr116278-run-2.c: New test.
We should be using the dg-torture framework, so the right directory for 
the test is gcc.dg/torture.

I suspect these tests (just based on the constants that appear) may not 
work on the 16 bit integer targets.  So we may need

/* { dg-require-effective-target int32 } */

But I don't mind faulting that in if/when we see the 16bit int targets 
complain.

So OK in the right directory (gcc.dg/torture).

Jeff
diff mbox series

Patch

diff --git a/gcc/testsuite/gcc.c-torture/execute/pr116278-run-1.c b/gcc/testsuite/gcc.c-torture/execute/pr116278-run-1.c
new file mode 100644
index 00000000000..fa5340c9d58
--- /dev/null
+++ b/gcc/testsuite/gcc.c-torture/execute/pr116278-run-1.c
@@ -0,0 +1,18 @@ 
+/* { dg-do run } */
+/* { dg-options "-O2" } */
+
+#include <stdint-gcc.h>
+
+int8_t b[1];
+int8_t *d = b;
+int32_t c;
+
+int main() {
+  b[0] = -40;
+  uint16_t t = (uint16_t)d[0];
+
+  c = (t < 0xFFF6 ? t : 0xFFF6) + 9;
+
+  if (c != 65505)
+    __builtin_abort ();
+}
diff --git a/gcc/testsuite/gcc.c-torture/execute/pr116278-run-2.c b/gcc/testsuite/gcc.c-torture/execute/pr116278-run-2.c
new file mode 100644
index 00000000000..65439d614a1
--- /dev/null
+++ b/gcc/testsuite/gcc.c-torture/execute/pr116278-run-2.c
@@ -0,0 +1,18 @@ 
+/* { dg-do run } */
+/* { dg-options "-O2" } */
+
+#include <stdint-gcc.h>
+
+int16_t b[1];
+int16_t *d = b;
+int64_t c;
+
+int main() {
+  b[0] = -40;
+  uint32_t t = (uint32_t)d[0];
+
+  c = (t < 0xFFFFFFF6u ? t : 0xFFFFFFF6u) + 9;
+
+  if (c != 4294967265)
+    __builtin_abort ();
+}
diff --git a/gcc/testsuite/gcc.target/riscv/pr116278-run-1.c b/gcc/testsuite/gcc.target/riscv/pr116278-run-1.c
index d3812bdcdfb..c758fca7975 100644
--- a/gcc/testsuite/gcc.target/riscv/pr116278-run-1.c
+++ b/gcc/testsuite/gcc.target/riscv/pr116278-run-1.c
@@ -1,4 +1,4 @@ 
-/* { dg-do run { target { riscv_v } } } */
+/* { dg-do compile } */
 /* { dg-options "-O2 -fdump-rtl-expand-details" } */
 
 #include <stdint-gcc.h>
diff --git a/gcc/testsuite/gcc.target/riscv/pr116278-run-2.c b/gcc/testsuite/gcc.target/riscv/pr116278-run-2.c
index 669cd4f003f..a4da8a323f0 100644
--- a/gcc/testsuite/gcc.target/riscv/pr116278-run-2.c
+++ b/gcc/testsuite/gcc.target/riscv/pr116278-run-2.c
@@ -1,4 +1,4 @@ 
-/* { dg-do run { target { riscv_v } } } */
+/* { dg-do compile } */
 /* { dg-options "-O2 -fdump-rtl-expand-details" } */
 
 #include <stdint-gcc.h>