From: Pan Li Date: Fri, 19 Sep 2025 06:54:48 +0000 (+0800) Subject: RISC-V: Add test case of unsigned scalar SAT_MUL form 5 for mul X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=1617b9e1bbd967959d1f0cfd428137cf1da1e34c;p=thirdparty%2Fgcc.git RISC-V: Add test case of unsigned scalar SAT_MUL form 5 for mul Add test case for both the run and asm check of mul based SAT_MUL. gcc/testsuite/ChangeLog: * gcc.target/riscv/sat/sat_u_mul-6-u16-from-u32.c: New test. * gcc.target/riscv/sat/sat_u_mul-6-u16-from-u64.rv32.c: New test. * gcc.target/riscv/sat/sat_u_mul-6-u16-from-u64.rv64.c: New test. * gcc.target/riscv/sat/sat_u_mul-6-u32-from-u64.rv32.c: New test. * gcc.target/riscv/sat/sat_u_mul-6-u32-from-u64.rv64.c: New test. * gcc.target/riscv/sat/sat_u_mul-6-u8-from-u16.c: New test. * gcc.target/riscv/sat/sat_u_mul-6-u8-from-u32.c: New test. * gcc.target/riscv/sat/sat_u_mul-6-u8-from-u64.rv32.c: New test. * gcc.target/riscv/sat/sat_u_mul-6-u8-from-u64.rv64.c: New test. * gcc.target/riscv/sat/sat_u_mul-run-6-u16-from-u32.c: New test. * gcc.target/riscv/sat/sat_u_mul-run-6-u16-from-u64.c: New test. * gcc.target/riscv/sat/sat_u_mul-run-6-u32-from-u64.c: New test. * gcc.target/riscv/sat/sat_u_mul-run-6-u8-from-u16.c: New test. * gcc.target/riscv/sat/sat_u_mul-run-6-u8-from-u32.c: New test. * gcc.target/riscv/sat/sat_u_mul-run-6-u8-from-u64.c: New test. Signed-off-by: Pan Li --- diff --git a/gcc/testsuite/gcc.target/riscv/sat/sat_u_mul-6-u16-from-u32.c b/gcc/testsuite/gcc.target/riscv/sat/sat_u_mul-6-u16-from-u32.c new file mode 100644 index 00000000000..6e186a02d57 --- /dev/null +++ b/gcc/testsuite/gcc.target/riscv/sat/sat_u_mul-6-u16-from-u32.c @@ -0,0 +1,11 @@ +/* { dg-do compile } */ +/* { dg-options "-march=rv64gc -mabi=lp64d -fdump-tree-optimized" } */ + +#include "sat_arith.h" + +#define NT uint16_t +#define WT uint32_t + +DEF_SAT_U_MUL_FMT_5_WRAP(NT, WT) + +/* { dg-final { scan-tree-dump-times ".SAT_MUL" 1 "optimized" } } */ diff --git a/gcc/testsuite/gcc.target/riscv/sat/sat_u_mul-6-u16-from-u64.rv32.c b/gcc/testsuite/gcc.target/riscv/sat/sat_u_mul-6-u16-from-u64.rv32.c new file mode 100644 index 00000000000..8c3ec20df5d --- /dev/null +++ b/gcc/testsuite/gcc.target/riscv/sat/sat_u_mul-6-u16-from-u64.rv32.c @@ -0,0 +1,11 @@ +/* { dg-do compile } */ +/* { dg-options "-march=rv32gc -mabi=ilp32 -fdump-tree-optimized" } */ + +#include "sat_arith.h" + +#define NT uint16_t +#define WT uint64_t + +DEF_SAT_U_MUL_FMT_5_WRAP(NT, WT) + +/* { dg-final { scan-tree-dump-times ".SAT_MUL" 1 "optimized" } } */ diff --git a/gcc/testsuite/gcc.target/riscv/sat/sat_u_mul-6-u16-from-u64.rv64.c b/gcc/testsuite/gcc.target/riscv/sat/sat_u_mul-6-u16-from-u64.rv64.c new file mode 100644 index 00000000000..5233bde4d7e --- /dev/null +++ b/gcc/testsuite/gcc.target/riscv/sat/sat_u_mul-6-u16-from-u64.rv64.c @@ -0,0 +1,11 @@ +/* { dg-do compile } */ +/* { dg-options "-march=rv64gc -mabi=lp64d -fdump-tree-optimized" } */ + +#include "sat_arith.h" + +#define NT uint16_t +#define WT uint64_t + +DEF_SAT_U_MUL_FMT_5_WRAP(NT, WT) + +/* { dg-final { scan-tree-dump-times ".SAT_MUL" 1 "optimized" } } */ diff --git a/gcc/testsuite/gcc.target/riscv/sat/sat_u_mul-6-u32-from-u64.rv32.c b/gcc/testsuite/gcc.target/riscv/sat/sat_u_mul-6-u32-from-u64.rv32.c new file mode 100644 index 00000000000..b5ed463db08 --- /dev/null +++ b/gcc/testsuite/gcc.target/riscv/sat/sat_u_mul-6-u32-from-u64.rv32.c @@ -0,0 +1,11 @@ +/* { dg-do compile } */ +/* { dg-options "-march=rv32gc -mabi=ilp32 -fdump-tree-optimized" } */ + +#include "sat_arith.h" + +#define NT uint32_t +#define WT uint64_t + +DEF_SAT_U_MUL_FMT_5_WRAP(NT, WT) + +/* { dg-final { scan-tree-dump-times ".SAT_MUL" 1 "optimized" } } */ diff --git a/gcc/testsuite/gcc.target/riscv/sat/sat_u_mul-6-u32-from-u64.rv64.c b/gcc/testsuite/gcc.target/riscv/sat/sat_u_mul-6-u32-from-u64.rv64.c new file mode 100644 index 00000000000..2cd4db505a1 --- /dev/null +++ b/gcc/testsuite/gcc.target/riscv/sat/sat_u_mul-6-u32-from-u64.rv64.c @@ -0,0 +1,11 @@ +/* { dg-do compile } */ +/* { dg-options "-march=rv64gc -mabi=lp64d -fdump-tree-optimized" } */ + +#include "sat_arith.h" + +#define NT uint32_t +#define WT uint64_t + +DEF_SAT_U_MUL_FMT_5_WRAP(NT, WT) + +/* { dg-final { scan-tree-dump-times ".SAT_MUL" 1 "optimized" } } */ diff --git a/gcc/testsuite/gcc.target/riscv/sat/sat_u_mul-6-u8-from-u16.c b/gcc/testsuite/gcc.target/riscv/sat/sat_u_mul-6-u8-from-u16.c new file mode 100644 index 00000000000..daf16498318 --- /dev/null +++ b/gcc/testsuite/gcc.target/riscv/sat/sat_u_mul-6-u8-from-u16.c @@ -0,0 +1,11 @@ +/* { dg-do compile } */ +/* { dg-options "-march=rv64gc -mabi=lp64d -fdump-tree-optimized" } */ + +#include "sat_arith.h" + +#define NT uint8_t +#define WT uint16_t + +DEF_SAT_U_MUL_FMT_5_WRAP(NT, WT) + +/* { dg-final { scan-tree-dump-times ".SAT_MUL" 1 "optimized" } } */ diff --git a/gcc/testsuite/gcc.target/riscv/sat/sat_u_mul-6-u8-from-u32.c b/gcc/testsuite/gcc.target/riscv/sat/sat_u_mul-6-u8-from-u32.c new file mode 100644 index 00000000000..48f5d3eb22b --- /dev/null +++ b/gcc/testsuite/gcc.target/riscv/sat/sat_u_mul-6-u8-from-u32.c @@ -0,0 +1,11 @@ +/* { dg-do compile } */ +/* { dg-options "-march=rv64gc -mabi=lp64d -fdump-tree-optimized" } */ + +#include "sat_arith.h" + +#define NT uint8_t +#define WT uint32_t + +DEF_SAT_U_MUL_FMT_5_WRAP(NT, WT) + +/* { dg-final { scan-tree-dump-times ".SAT_MUL" 1 "optimized" } } */ diff --git a/gcc/testsuite/gcc.target/riscv/sat/sat_u_mul-6-u8-from-u64.rv32.c b/gcc/testsuite/gcc.target/riscv/sat/sat_u_mul-6-u8-from-u64.rv32.c new file mode 100644 index 00000000000..5b8af339f9c --- /dev/null +++ b/gcc/testsuite/gcc.target/riscv/sat/sat_u_mul-6-u8-from-u64.rv32.c @@ -0,0 +1,11 @@ +/* { dg-do compile } */ +/* { dg-options "-march=rv32gc -mabi=ilp32 -fdump-tree-optimized" } */ + +#include "sat_arith.h" + +#define NT uint8_t +#define WT uint64_t + +DEF_SAT_U_MUL_FMT_5_WRAP(NT, WT) + +/* { dg-final { scan-tree-dump-times ".SAT_MUL" 1 "optimized" } } */ diff --git a/gcc/testsuite/gcc.target/riscv/sat/sat_u_mul-6-u8-from-u64.rv64.c b/gcc/testsuite/gcc.target/riscv/sat/sat_u_mul-6-u8-from-u64.rv64.c new file mode 100644 index 00000000000..3a5e7cc43fb --- /dev/null +++ b/gcc/testsuite/gcc.target/riscv/sat/sat_u_mul-6-u8-from-u64.rv64.c @@ -0,0 +1,11 @@ +/* { dg-do compile } */ +/* { dg-options "-march=rv64gc -mabi=lp64d -fdump-tree-optimized" } */ + +#include "sat_arith.h" + +#define NT uint8_t +#define WT uint64_t + +DEF_SAT_U_MUL_FMT_5_WRAP(NT, WT) + +/* { dg-final { scan-tree-dump-times ".SAT_MUL" 1 "optimized" } } */ diff --git a/gcc/testsuite/gcc.target/riscv/sat/sat_u_mul-run-6-u16-from-u32.c b/gcc/testsuite/gcc.target/riscv/sat/sat_u_mul-run-6-u16-from-u32.c new file mode 100644 index 00000000000..d495ce53736 --- /dev/null +++ b/gcc/testsuite/gcc.target/riscv/sat/sat_u_mul-run-6-u16-from-u32.c @@ -0,0 +1,16 @@ +/* { dg-do run { target { rv32 || rv64 } } } */ +/* { dg-additional-options "-std=c99" } */ + +#include "sat_arith.h" +#include "sat_arith_data.h" + +#define NT uint16_t +#define WT uint32_t +#define NAME usmul +#define DATA TEST_BINARY_DATA_WRAP(NT, NAME) +#define T TEST_BINARY_STRUCT_DECL_WRAP(NT, NAME) +#define RUN_BINARY(x, y) RUN_SAT_U_MUL_FMT_5_WRAP(NT, WT, x, y) + +DEF_SAT_U_MUL_FMT_5_WRAP(NT, WT) + +#include "scalar_sat_binary_run_xxx.h" diff --git a/gcc/testsuite/gcc.target/riscv/sat/sat_u_mul-run-6-u16-from-u64.c b/gcc/testsuite/gcc.target/riscv/sat/sat_u_mul-run-6-u16-from-u64.c new file mode 100644 index 00000000000..d663953f089 --- /dev/null +++ b/gcc/testsuite/gcc.target/riscv/sat/sat_u_mul-run-6-u16-from-u64.c @@ -0,0 +1,16 @@ +/* { dg-do run { target { rv32 || rv64 } } } */ +/* { dg-additional-options "-std=c99" } */ + +#include "sat_arith.h" +#include "sat_arith_data.h" + +#define NT uint16_t +#define WT uint64_t +#define NAME usmul +#define DATA TEST_BINARY_DATA_WRAP(NT, NAME) +#define T TEST_BINARY_STRUCT_DECL_WRAP(NT, NAME) +#define RUN_BINARY(x, y) RUN_SAT_U_MUL_FMT_5_WRAP(NT, WT, x, y) + +DEF_SAT_U_MUL_FMT_5_WRAP(NT, WT) + +#include "scalar_sat_binary_run_xxx.h" diff --git a/gcc/testsuite/gcc.target/riscv/sat/sat_u_mul-run-6-u32-from-u64.c b/gcc/testsuite/gcc.target/riscv/sat/sat_u_mul-run-6-u32-from-u64.c new file mode 100644 index 00000000000..5b47a3992a0 --- /dev/null +++ b/gcc/testsuite/gcc.target/riscv/sat/sat_u_mul-run-6-u32-from-u64.c @@ -0,0 +1,16 @@ +/* { dg-do run { target { rv32 || rv64 } } } */ +/* { dg-additional-options "-std=c99" } */ + +#include "sat_arith.h" +#include "sat_arith_data.h" + +#define NT uint32_t +#define WT uint64_t +#define NAME usmul +#define DATA TEST_BINARY_DATA_WRAP(NT, NAME) +#define T TEST_BINARY_STRUCT_DECL_WRAP(NT, NAME) +#define RUN_BINARY(x, y) RUN_SAT_U_MUL_FMT_5_WRAP(NT, WT, x, y) + +DEF_SAT_U_MUL_FMT_5_WRAP(NT, WT) + +#include "scalar_sat_binary_run_xxx.h" diff --git a/gcc/testsuite/gcc.target/riscv/sat/sat_u_mul-run-6-u8-from-u16.c b/gcc/testsuite/gcc.target/riscv/sat/sat_u_mul-run-6-u8-from-u16.c new file mode 100644 index 00000000000..536a2222ad4 --- /dev/null +++ b/gcc/testsuite/gcc.target/riscv/sat/sat_u_mul-run-6-u8-from-u16.c @@ -0,0 +1,16 @@ +/* { dg-do run { target { rv32 || rv64 } } } */ +/* { dg-additional-options "-std=c99" } */ + +#include "sat_arith.h" +#include "sat_arith_data.h" + +#define NT uint8_t +#define WT uint16_t +#define NAME usmul +#define DATA TEST_BINARY_DATA_WRAP(NT, NAME) +#define T TEST_BINARY_STRUCT_DECL_WRAP(NT, NAME) +#define RUN_BINARY(x, y) RUN_SAT_U_MUL_FMT_5_WRAP(NT, WT, x, y) + +DEF_SAT_U_MUL_FMT_5_WRAP(NT, WT) + +#include "scalar_sat_binary_run_xxx.h" diff --git a/gcc/testsuite/gcc.target/riscv/sat/sat_u_mul-run-6-u8-from-u32.c b/gcc/testsuite/gcc.target/riscv/sat/sat_u_mul-run-6-u8-from-u32.c new file mode 100644 index 00000000000..1e778a8d5b2 --- /dev/null +++ b/gcc/testsuite/gcc.target/riscv/sat/sat_u_mul-run-6-u8-from-u32.c @@ -0,0 +1,16 @@ +/* { dg-do run { target { rv32 || rv64 } } } */ +/* { dg-additional-options "-std=c99" } */ + +#include "sat_arith.h" +#include "sat_arith_data.h" + +#define NT uint8_t +#define WT uint32_t +#define NAME usmul +#define DATA TEST_BINARY_DATA_WRAP(NT, NAME) +#define T TEST_BINARY_STRUCT_DECL_WRAP(NT, NAME) +#define RUN_BINARY(x, y) RUN_SAT_U_MUL_FMT_5_WRAP(NT, WT, x, y) + +DEF_SAT_U_MUL_FMT_5_WRAP(NT, WT) + +#include "scalar_sat_binary_run_xxx.h" diff --git a/gcc/testsuite/gcc.target/riscv/sat/sat_u_mul-run-6-u8-from-u64.c b/gcc/testsuite/gcc.target/riscv/sat/sat_u_mul-run-6-u8-from-u64.c new file mode 100644 index 00000000000..98fda198637 --- /dev/null +++ b/gcc/testsuite/gcc.target/riscv/sat/sat_u_mul-run-6-u8-from-u64.c @@ -0,0 +1,16 @@ +/* { dg-do run { target { rv32 || rv64 } } } */ +/* { dg-additional-options "-std=c99" } */ + +#include "sat_arith.h" +#include "sat_arith_data.h" + +#define NT uint8_t +#define WT uint64_t +#define NAME usmul +#define DATA TEST_BINARY_DATA_WRAP(NT, NAME) +#define T TEST_BINARY_STRUCT_DECL_WRAP(NT, NAME) +#define RUN_BINARY(x, y) RUN_SAT_U_MUL_FMT_5_WRAP(NT, WT, x, y) + +DEF_SAT_U_MUL_FMT_5_WRAP(NT, WT) + +#include "scalar_sat_binary_run_xxx.h"