]> git.ipfire.org Git - thirdparty/gcc.git/commit
RISC-V: Add testcases for form 1 of scalar signed SAT_SUB
authorPan Li <pan2.li@intel.com>
Wed, 25 Sep 2024 01:42:31 +0000 (09:42 +0800)
committerPan Li <pan2.li@intel.com>
Sun, 29 Sep 2024 23:24:36 +0000 (07:24 +0800)
commita2a78c0639dbebdab19d71f54edca99e7f9094fd
treed9de69728fedc5a655efd5692fc73041a584059d
parentb6ea98bcaf1dad506fa643df8df50187feeb7e35
RISC-V: Add testcases for form 1 of scalar signed SAT_SUB

Form 1:
  #define DEF_SAT_S_SUB_FMT_1(T, UT, MIN, MAX) \
  T __attribute__((noinline))                  \
  sat_s_sub_##T##_fmt_1 (T x, T y)             \
  {                                            \
    T minus = (UT)x - (UT)y;                   \
    return (x ^ y) >= 0                        \
      ? minus                                  \
      : (minus ^ x) >= 0                       \
        ? minus                                \
        : x < 0 ? MIN : MAX;                   \
  }

DEF_SAT_S_SUB_FMT_1(int8_t, uint8_t, INT8_MIN, INT8_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_arith_data.h: Add test data for SAT_SUB.
* gcc.target/riscv/sat_s_sub-1-i16.c: New test.
* gcc.target/riscv/sat_s_sub-1-i32.c: New test.
* gcc.target/riscv/sat_s_sub-1-i64.c: New test.
* gcc.target/riscv/sat_s_sub-1-i8.c: New test.
* gcc.target/riscv/sat_s_sub-run-1-i16.c: New test.
* gcc.target/riscv/sat_s_sub-run-1-i32.c: New test.
* gcc.target/riscv/sat_s_sub-run-1-i64.c: New test.
* gcc.target/riscv/sat_s_sub-run-1-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_arith_data.h
gcc/testsuite/gcc.target/riscv/sat_s_sub-1-i16.c [new file with mode: 0644]
gcc/testsuite/gcc.target/riscv/sat_s_sub-1-i32.c [new file with mode: 0644]
gcc/testsuite/gcc.target/riscv/sat_s_sub-1-i64.c [new file with mode: 0644]
gcc/testsuite/gcc.target/riscv/sat_s_sub-1-i8.c [new file with mode: 0644]
gcc/testsuite/gcc.target/riscv/sat_s_sub-run-1-i16.c [new file with mode: 0644]
gcc/testsuite/gcc.target/riscv/sat_s_sub-run-1-i32.c [new file with mode: 0644]
gcc/testsuite/gcc.target/riscv/sat_s_sub-run-1-i64.c [new file with mode: 0644]
gcc/testsuite/gcc.target/riscv/sat_s_sub-run-1-i8.c [new file with mode: 0644]