]> git.ipfire.org Git - thirdparty/gcc.git/commit
RISC-V: Add testcases for form 4 of scalar signed SAT_SUB
authorPan Li <pan2.li@intel.com>
Thu, 3 Oct 2024 08:47:52 +0000 (16:47 +0800)
committerPan Li <pan2.li@intel.com>
Tue, 8 Oct 2024 11:05:13 +0000 (19:05 +0800)
commit9252fc398c86ec0eac2c56283e2ded8ea6cfb70c
treea22e9c6bf7d5ef450154a213dcaac223630116d8
parentaac2bc48014dd418a5c9dc3a7c962c0f0bb48312
RISC-V: Add testcases for form 4 of scalar signed SAT_SUB

Form 4:
  #define DEF_SAT_S_SUB_FMT_4(T, UT, MIN, MAX)           \
  T __attribute__((noinline))                            \
  sat_s_sub_##T##_fmt_4 (T x, T y)                       \
  {                                                      \
    T minus;                                               \
    bool overflow = __builtin_sub_overflow (x, y, &minus); \
    return !overflow ? minus : x < 0 ? MIN : MAX;          \
  }

The below test are passed for this patch.
* The rv64gcv fully regression test.

It is test only patch and obvious up to a point, will commit it
directly if no comments in next 48H.

gcc/testsuite/ChangeLog:

* gcc.target/riscv/sat_arith.h: Add test helper macros.
* gcc.target/riscv/sat_s_sub-4-i16.c: New test.
* gcc.target/riscv/sat_s_sub-4-i32.c: New test.
* gcc.target/riscv/sat_s_sub-4-i64.c: New test.
* gcc.target/riscv/sat_s_sub-4-i8.c: New test.
* gcc.target/riscv/sat_s_sub-run-4-i16.c: New test.
* gcc.target/riscv/sat_s_sub-run-4-i32.c: New test.
* gcc.target/riscv/sat_s_sub-run-4-i64.c: New test.
* gcc.target/riscv/sat_s_sub-run-4-i8.c: New test.

Signed-off-by: Pan Li <pan2.li@intel.com>
gcc/testsuite/gcc.target/riscv/sat_arith.h
gcc/testsuite/gcc.target/riscv/sat_s_sub-4-i16.c [new file with mode: 0644]
gcc/testsuite/gcc.target/riscv/sat_s_sub-4-i32.c [new file with mode: 0644]
gcc/testsuite/gcc.target/riscv/sat_s_sub-4-i64.c [new file with mode: 0644]
gcc/testsuite/gcc.target/riscv/sat_s_sub-4-i8.c [new file with mode: 0644]
gcc/testsuite/gcc.target/riscv/sat_s_sub-run-4-i16.c [new file with mode: 0644]
gcc/testsuite/gcc.target/riscv/sat_s_sub-run-4-i32.c [new file with mode: 0644]
gcc/testsuite/gcc.target/riscv/sat_s_sub-run-4-i64.c [new file with mode: 0644]
gcc/testsuite/gcc.target/riscv/sat_s_sub-run-4-i8.c [new file with mode: 0644]