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 |
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
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 --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>