On 5/19/25 2:41 AM, Li Xu wrote:
From: xuli <xu...@eswincomputing.com>

This patch adds testcase for form1, as shown below:

T __attribute__((noinline))                  \
sat_s_add_imm_##T##_fmt_1##_##INDEX (T x)             \
{                                            \
   T sum = (UT)x + (UT)IMM;                     \
   return (x ^ IMM) < 0                         \
     ? sum                                    \
     : (sum ^ x) >= 0                         \
       ? sum                                  \
       : x < 0 ? MIN : MAX;                   \
}

Passed the rv64gcv regression test.

Signed-off-by: Li Xu <xu...@eswincomputing.com>

gcc/testsuite/ChangeLog:

        * gcc.target/riscv/sat/sat_s_add_imm-2.c: Move to...
        * gcc.target/riscv/sat/sat_s_add_imm-1-i16.c: ...here.
        * gcc.target/riscv/sat/sat_s_add_imm-3.c: Move to...
        * gcc.target/riscv/sat/sat_s_add_imm-1-i32.c: ...
        * gcc.target/riscv/sat/sat_s_add_imm-4.c: Move to...
        * gcc.target/riscv/sat/sat_s_add_imm-1-i64.c: ...here.
        * gcc.target/riscv/sat/sat_s_add_imm-1.c: Move to...
        * gcc.target/riscv/sat/sat_s_add_imm-1-i8.c: ...here.
        * gcc.target/riscv/sat/sat_s_add_imm-run-2.c: Move to...
        * gcc.target/riscv/sat/sat_s_add_imm-run-1-i16.c: ...here.
        * gcc.target/riscv/sat/sat_s_add_imm-run-3.c: Move to...
        * gcc.target/riscv/sat/sat_s_add_imm-run-1-i32.c: ...here.
        * gcc.target/riscv/sat/sat_s_add_imm-run-4.c: Move to...
        * gcc.target/riscv/sat/sat_s_add_imm-run-1-i64.c: ...here.
        * gcc.target/riscv/sat/sat_s_add_imm-run-1.c: Move to...
        * gcc.target/riscv/sat/sat_s_add_imm-run-1-i8.c: ...here.
        * gcc.target/riscv/sat/sat_s_add_imm-2-1.c: Move to...
        * gcc.target/riscv/sat/sat_s_add_imm_type_check-1-i16.c: ...here.
        * gcc.target/riscv/sat/sat_s_add_imm-3-1.c: Move to...
        * gcc.target/riscv/sat/sat_s_add_imm_type_check-1-i32.c: ...here.
        * gcc.target/riscv/sat/sat_s_add_imm-1-1.c: Move to...
        * gcc.target/riscv/sat/sat_s_add_imm_type_check-1-i8.c: ...here.
So for the tests, why are we forcing matching of the assembly code for the entire function? That must makes for a fragile test as we may change various aspects of code generation over time.

If the point of the patch is to detect SAT_ADD in more cases, then the better and more stable test is to verify the existence of SAT_ADD the appropriate number of times in the .optimized dump.

IMHO we really don't want this kind of whole function assembly matching.

Pan, do you have any further comments here? Do you have strong opinions on whether or not we want to be doing this kind of assembly output testing or not?


Jeff


Reply via email to