RISC-V: Add test for vec_duplicate + vminu.vv combine case 0 with GR2VR cost 0, 2 and 15

Add asm dump check and run test for vec_duplicate + vminu.vv
combine to vminu.vx, with the GR2VR cost is 0, 2 and 15.

gcc/testsuite/ChangeLog:

	* gcc.target/riscv/rvv/autovec/vx_vf/vx-1-u16.c: Add asm check.
	* gcc.target/riscv/rvv/autovec/vx_vf/vx-1-u32.c: Ditto.
	* gcc.target/riscv/rvv/autovec/vx_vf/vx-1-u64.c: Ditto.
	* gcc.target/riscv/rvv/autovec/vx_vf/vx-1-u8.c: Ditto.
	* gcc.target/riscv/rvv/autovec/vx_vf/vx-2-u16.c: Ditto.
	* gcc.target/riscv/rvv/autovec/vx_vf/vx-2-u32.c: Ditto.
	* gcc.target/riscv/rvv/autovec/vx_vf/vx-2-u64.c: Ditto.
	* gcc.target/riscv/rvv/autovec/vx_vf/vx-2-u8.c: Ditto.
	* gcc.target/riscv/rvv/autovec/vx_vf/vx-3-u16.c: Ditto.
	* gcc.target/riscv/rvv/autovec/vx_vf/vx-3-u32.c: Ditto.
	* gcc.target/riscv/rvv/autovec/vx_vf/vx-3-u64.c: Ditto.
	* gcc.target/riscv/rvv/autovec/vx_vf/vx-3-u8.c: Ditto.
	* gcc.target/riscv/rvv/autovec/vx_vf/vx_binary.h: Add test
	helper macors.
	* gcc.target/riscv/rvv/autovec/vx_vf/vx_binary_data.h: Add
	test data for run test.
	* gcc.target/riscv/rvv/autovec/vx_vf/vx_vmin-run-1-u16.c: New test.
	* gcc.target/riscv/rvv/autovec/vx_vf/vx_vmin-run-1-u32.c: New test.
	* gcc.target/riscv/rvv/autovec/vx_vf/vx_vmin-run-1-u64.c: New test.
	* gcc.target/riscv/rvv/autovec/vx_vf/vx_vmin-run-1-u8.c: New test.
	* gcc.target/riscv/rvv/autovec/vx_vf/vx_vmin-run-2-u16.c: New test.
	* gcc.target/riscv/rvv/autovec/vx_vf/vx_vmin-run-2-u32.c: New test.
	* gcc.target/riscv/rvv/autovec/vx_vf/vx_vmin-run-2-u64.c: New test.
	* gcc.target/riscv/rvv/autovec/vx_vf/vx_vmin-run-2-u8.c: New test.

Signed-off-by: Pan Li <pan2.li@intel.com>
This commit is contained in:
Pan Li
2025-06-19 10:47:33 +08:00
parent 7ea9105f26
commit 289220af97
22 changed files with 357 additions and 1 deletions

View File

@@ -16,3 +16,4 @@ TEST_BINARY_VX_UNSIGNED_0(T)
/* { dg-final { scan-assembler-times {vdivu.vx} 1 } } */
/* { dg-final { scan-assembler-times {vremu.vx} 1 } } */
/* { dg-final { scan-assembler-times {vmaxu.vx} 2 } } */
/* { dg-final { scan-assembler-times {vminu.vx} 2 } } */

View File

@@ -16,3 +16,4 @@ TEST_BINARY_VX_UNSIGNED_0(T)
/* { dg-final { scan-assembler-times {vdivu.vx} 1 } } */
/* { dg-final { scan-assembler-times {vremu.vx} 1 } } */
/* { dg-final { scan-assembler-times {vmaxu.vx} 2 } } */
/* { dg-final { scan-assembler-times {vminu.vx} 2 } } */

View File

@@ -16,3 +16,4 @@ TEST_BINARY_VX_UNSIGNED_0(T)
/* { dg-final { scan-assembler-times {vdivu.vx} 1 } } */
/* { dg-final { scan-assembler-times {vremu.vx} 1 } } */
/* { dg-final { scan-assembler-times {vmaxu.vx} 2 } } */
/* { dg-final { scan-assembler-times {vminu.vx} 2 } } */

View File

@@ -16,3 +16,4 @@ TEST_BINARY_VX_UNSIGNED_0(T)
/* { dg-final { scan-assembler-times {vdivu.vx} 1 } } */
/* { dg-final { scan-assembler-times {vremu.vx} 1 } } */
/* { dg-final { scan-assembler-times {vmaxu.vx} 2 } } */
/* { dg-final { scan-assembler-times {vminu.vx} 2 } } */

View File

@@ -16,3 +16,4 @@ TEST_BINARY_VX_UNSIGNED_0(T)
/* { dg-final { scan-assembler-not {vdivu.vx} } } */
/* { dg-final { scan-assembler-not {vremu.vx} } } */
/* { dg-final { scan-assembler-not {vmaxu.vx} } } */
/* { dg-final { scan-assembler-not {vminu.vx} } } */

View File

@@ -16,3 +16,4 @@ TEST_BINARY_VX_UNSIGNED_0(T)
/* { dg-final { scan-assembler-not {vdivu.vx} } } */
/* { dg-final { scan-assembler-not {vremu.vx} } } */
/* { dg-final { scan-assembler-not {vmaxu.vx} } } */
/* { dg-final { scan-assembler-not {vminu.vx} } } */

View File

@@ -16,3 +16,4 @@ TEST_BINARY_VX_UNSIGNED_0(T)
/* { dg-final { scan-assembler-not {vdivu.vx} } } */
/* { dg-final { scan-assembler-not {vremu.vx} } } */
/* { dg-final { scan-assembler-not {vmaxu.vx} } } */
/* { dg-final { scan-assembler-not {vminu.vx} } } */

View File

@@ -16,3 +16,4 @@ TEST_BINARY_VX_UNSIGNED_0(T)
/* { dg-final { scan-assembler-not {vdivu.vx} } } */
/* { dg-final { scan-assembler-not {vremu.vx} } } */
/* { dg-final { scan-assembler-not {vmaxu.vx} } } */
/* { dg-final { scan-assembler-not {vminu.vx} } } */

View File

@@ -16,3 +16,4 @@ TEST_BINARY_VX_UNSIGNED_0(T)
/* { dg-final { scan-assembler-not {vdivu.vx} } } */
/* { dg-final { scan-assembler-not {vremu.vx} } } */
/* { dg-final { scan-assembler-not {vmaxu.vx} } } */
/* { dg-final { scan-assembler-not {vminu.vx} } } */

View File

@@ -16,3 +16,4 @@ TEST_BINARY_VX_UNSIGNED_0(T)
/* { dg-final { scan-assembler-not {vdivu.vx} } } */
/* { dg-final { scan-assembler-not {vremu.vx} } } */
/* { dg-final { scan-assembler-not {vmaxu.vx} } } */
/* { dg-final { scan-assembler-not {vminu.vx} } } */

View File

@@ -16,3 +16,4 @@ TEST_BINARY_VX_UNSIGNED_0(T)
/* { dg-final { scan-assembler-not {vdivu.vx} } } */
/* { dg-final { scan-assembler-not {vremu.vx} } } */
/* { dg-final { scan-assembler-not {vmaxu.vx} } } */
/* { dg-final { scan-assembler-not {vminu.vx} } } */

View File

@@ -16,3 +16,4 @@ TEST_BINARY_VX_UNSIGNED_0(T)
/* { dg-final { scan-assembler-not {vdivu.vx} } } */
/* { dg-final { scan-assembler-not {vremu.vx} } } */
/* { dg-final { scan-assembler-not {vmaxu.vx} } } */
/* { dg-final { scan-assembler-not {vminu.vx} } } */

View File

@@ -191,6 +191,16 @@ DEF_MIN_1(int16_t)
DEF_MIN_1(int32_t)
DEF_MIN_1(int64_t)
DEF_MIN_0(uint8_t)
DEF_MIN_0(uint16_t)
DEF_MIN_0(uint32_t)
DEF_MIN_0(uint64_t)
DEF_MIN_1(uint8_t)
DEF_MIN_1(uint16_t)
DEF_MIN_1(uint32_t)
DEF_MIN_1(uint64_t)
#define MIN_FUNC_0(T) test_##T##_min_0
#define MIN_FUNC_0_WARP(T) MIN_FUNC_0(T)
@@ -285,6 +295,8 @@ test_vx_binary_##NAME##_##FUNC##_##T##_case_3 (T * restrict out, \
DEF_VX_BINARY_CASE_0_WRAP(T, /, div) \
DEF_VX_BINARY_CASE_0_WRAP(T, %, rem) \
DEF_VX_BINARY_CASE_2_WRAP(T, MAX_FUNC_0_WARP(T), max) \
DEF_VX_BINARY_CASE_2_WRAP(T, MAX_FUNC_1_WARP(T), max)
DEF_VX_BINARY_CASE_2_WRAP(T, MAX_FUNC_1_WARP(T), max) \
DEF_VX_BINARY_CASE_2_WRAP(T, MIN_FUNC_0_WARP(T), min) \
DEF_VX_BINARY_CASE_2_WRAP(T, MIN_FUNC_1_WARP(T), min)
#endif

View File

@@ -3926,4 +3926,200 @@ int64_t TEST_BINARY_DATA(int64_t, min)[][3][N] =
},
};
uint8_t TEST_BINARY_DATA(uint8_t, min)[][3][N] =
{
{
{ 0 },
{
2, 2, 2, 2,
1, 1, 1, 1,
0, 0, 0, 0,
4, 4, 4, 4,
},
{
0, 0, 0, 0,
0, 0, 0, 0,
0, 0, 0, 0,
0, 0, 0, 0,
},
},
{
{ 127 },
{
127, 127, 127, 127,
128, 128, 128, 128,
255, 255, 255, 255,
1, 1, 1, 1,
},
{
127, 127, 127, 127,
127, 127, 127, 127,
127, 127, 127, 127,
1, 1, 1, 1,
},
},
{
{ 254 },
{
128, 128, 128, 128,
255, 255, 255, 255,
127, 127, 127, 127,
2, 2, 2, 2,
},
{
128, 128, 128, 128,
254, 254, 254, 254,
127, 127, 127, 127,
2, 2, 2, 2,
},
},
};
uint16_t TEST_BINARY_DATA(uint16_t, min)[][3][N] =
{
{
{ 0 },
{
2, 2, 2, 2,
1, 1, 1, 1,
0, 0, 0, 0,
4, 4, 4, 4,
},
{
0, 0, 0, 0,
0, 0, 0, 0,
0, 0, 0, 0,
0, 0, 0, 0,
},
},
{
{ 32767 },
{
32767, 32767, 32767, 32767,
32768, 32768, 32768, 32768,
65535, 65535, 65535, 65535,
1, 1, 1, 1,
},
{
32767, 32767, 32767, 32767,
32767, 32767, 32767, 32767,
32767, 32767, 32767, 32767,
1, 1, 1, 1,
},
},
{
{ 65534 },
{
32768, 32768, 32768, 32768,
65535, 65535, 65535, 65535,
32767, 32767, 32767, 32767,
2, 2, 2, 2,
},
{
32768, 32768, 32768, 32768,
65534, 65534, 65534, 65534,
32767, 32767, 32767, 32767,
2, 2, 2, 2,
},
},
};
uint32_t TEST_BINARY_DATA(uint32_t, min)[][3][N] =
{
{
{ 0 },
{
2, 2, 2, 2,
1, 1, 1, 1,
0, 0, 0, 0,
4, 4, 4, 4,
},
{
0, 0, 0, 0,
0, 0, 0, 0,
0, 0, 0, 0,
0, 0, 0, 0,
},
},
{
{ 2147483647 },
{
2147483647, 2147483647, 2147483647, 2147483647,
2147483648, 2147483648, 2147483648, 2147483648,
4294967295, 4294967295, 4294967295, 4294967295,
1, 1, 1, 1,
},
{
2147483647, 2147483647, 2147483647, 2147483647,
2147483647, 2147483647, 2147483647, 2147483647,
2147483647, 2147483647, 2147483647, 2147483647,
1, 1, 1, 1,
},
},
{
{ 4294967294 },
{
2147483648, 2147483648, 2147483648, 2147483648,
4294967295, 4294967295, 4294967295, 4294967295,
2147483647, 2147483647, 2147483647, 2147483647,
2, 2, 2, 2,
},
{
2147483648, 2147483648, 2147483648, 2147483648,
4294967294, 4294967294, 4294967294, 4294967294,
2147483647, 2147483647, 2147483647, 2147483647,
2, 2, 2, 2,
},
},
};
uint64_t TEST_BINARY_DATA(uint64_t, min)[][3][N] =
{
{
{ 0 },
{
2, 2, 2, 2,
1, 1, 1, 1,
0, 0, 0, 0,
4, 4, 4, 4,
},
{
0, 0, 0, 0,
0, 0, 0, 0,
0, 0, 0, 0,
0, 0, 0, 0,
},
},
{
{ 9223372036854775807ull },
{
9223372036854775807ull, 9223372036854775807ull, 9223372036854775807ull, 9223372036854775807ull,
9223372036854775808ull, 9223372036854775808ull, 9223372036854775808ull, 9223372036854775808ull,
18446744073709551615ull, 18446744073709551615ull, 18446744073709551615ull, 18446744073709551615ull,
1, 1, 1, 1,
},
{
9223372036854775807ull, 9223372036854775807ull, 9223372036854775807ull, 9223372036854775807ull,
9223372036854775807ull, 9223372036854775807ull, 9223372036854775807ull, 9223372036854775807ull,
9223372036854775807ull, 9223372036854775807ull, 9223372036854775807ull, 9223372036854775807ull,
1, 1, 1, 1,
},
},
{
{ 18446744073709551614ull },
{
9223372036854775808ull, 9223372036854775808ull, 9223372036854775808ull, 9223372036854775808ull,
18446744073709551615ull, 18446744073709551615ull, 18446744073709551615ull, 18446744073709551615ull,
9223372036854775807ull, 9223372036854775807ull, 9223372036854775807ull, 9223372036854775807ull,
2, 2, 2, 2,
},
{
9223372036854775808ull, 9223372036854775808ull, 9223372036854775808ull, 9223372036854775808ull,
18446744073709551614ull, 18446744073709551614ull, 18446744073709551614ull, 18446744073709551614ull,
9223372036854775807ull, 9223372036854775807ull, 9223372036854775807ull, 9223372036854775807ull,
2, 2, 2, 2,
},
},
};
#endif

View File

@@ -0,0 +1,17 @@
/* { dg-do run { target { riscv_v } } } */
/* { dg-additional-options "-std=c99 --param=gpr2vr-cost=0" } */
#include "vx_binary.h"
#include "vx_binary_data.h"
#define T uint16_t
#define NAME min
#define FUNC MIN_FUNC_0_WARP(T)
#define TEST_DATA TEST_BINARY_DATA_WRAP(T, NAME)
DEF_VX_BINARY_CASE_2_WRAP(T, FUNC, NAME)
#define TEST_RUN(T, NAME, out, in, x, n) \
RUN_VX_BINARY_CASE_2_WRAP(T, NAME, FUNC, out, in, x, n)
#include "vx_binary_run.h"

View File

@@ -0,0 +1,17 @@
/* { dg-do run { target { riscv_v } } } */
/* { dg-additional-options "-std=c99 --param=gpr2vr-cost=0" } */
#include "vx_binary.h"
#include "vx_binary_data.h"
#define T uint32_t
#define NAME min
#define FUNC MIN_FUNC_0_WARP(T)
#define TEST_DATA TEST_BINARY_DATA_WRAP(T, NAME)
DEF_VX_BINARY_CASE_2_WRAP(T, FUNC, NAME)
#define TEST_RUN(T, NAME, out, in, x, n) \
RUN_VX_BINARY_CASE_2_WRAP(T, NAME, FUNC, out, in, x, n)
#include "vx_binary_run.h"

View File

@@ -0,0 +1,17 @@
/* { dg-do run { target { riscv_v } } } */
/* { dg-additional-options "-std=c99 --param=gpr2vr-cost=0" } */
#include "vx_binary.h"
#include "vx_binary_data.h"
#define T uint64_t
#define NAME min
#define FUNC MIN_FUNC_0_WARP(T)
#define TEST_DATA TEST_BINARY_DATA_WRAP(T, NAME)
DEF_VX_BINARY_CASE_2_WRAP(T, FUNC, NAME)
#define TEST_RUN(T, NAME, out, in, x, n) \
RUN_VX_BINARY_CASE_2_WRAP(T, NAME, FUNC, out, in, x, n)
#include "vx_binary_run.h"

View File

@@ -0,0 +1,17 @@
/* { dg-do run { target { riscv_v } } } */
/* { dg-additional-options "-std=c99 --param=gpr2vr-cost=0" } */
#include "vx_binary.h"
#include "vx_binary_data.h"
#define T uint8_t
#define NAME min
#define FUNC MIN_FUNC_0_WARP(T)
#define TEST_DATA TEST_BINARY_DATA_WRAP(T, NAME)
DEF_VX_BINARY_CASE_2_WRAP(T, FUNC, NAME)
#define TEST_RUN(T, NAME, out, in, x, n) \
RUN_VX_BINARY_CASE_2_WRAP(T, NAME, FUNC, out, in, x, n)
#include "vx_binary_run.h"

View File

@@ -0,0 +1,17 @@
/* { dg-do run { target { riscv_v } } } */
/* { dg-additional-options "-std=c99 --param=gpr2vr-cost=0" } */
#include "vx_binary.h"
#include "vx_binary_data.h"
#define T uint16_t
#define NAME min
#define FUNC MIN_FUNC_1_WARP(T)
#define TEST_DATA TEST_BINARY_DATA_WRAP(T, NAME)
DEF_VX_BINARY_CASE_2_WRAP(T, FUNC, NAME)
#define TEST_RUN(T, NAME, out, in, x, n) \
RUN_VX_BINARY_CASE_2_WRAP(T, NAME, FUNC, out, in, x, n)
#include "vx_binary_run.h"

View File

@@ -0,0 +1,17 @@
/* { dg-do run { target { riscv_v } } } */
/* { dg-additional-options "-std=c99 --param=gpr2vr-cost=0" } */
#include "vx_binary.h"
#include "vx_binary_data.h"
#define T uint32_t
#define NAME min
#define FUNC MIN_FUNC_1_WARP(T)
#define TEST_DATA TEST_BINARY_DATA_WRAP(T, NAME)
DEF_VX_BINARY_CASE_2_WRAP(T, FUNC, NAME)
#define TEST_RUN(T, NAME, out, in, x, n) \
RUN_VX_BINARY_CASE_2_WRAP(T, NAME, FUNC, out, in, x, n)
#include "vx_binary_run.h"

View File

@@ -0,0 +1,17 @@
/* { dg-do run { target { riscv_v } } } */
/* { dg-additional-options "-std=c99 --param=gpr2vr-cost=0" } */
#include "vx_binary.h"
#include "vx_binary_data.h"
#define T uint64_t
#define NAME min
#define FUNC MIN_FUNC_1_WARP(T)
#define TEST_DATA TEST_BINARY_DATA_WRAP(T, NAME)
DEF_VX_BINARY_CASE_2_WRAP(T, FUNC, NAME)
#define TEST_RUN(T, NAME, out, in, x, n) \
RUN_VX_BINARY_CASE_2_WRAP(T, NAME, FUNC, out, in, x, n)
#include "vx_binary_run.h"

View File

@@ -0,0 +1,17 @@
/* { dg-do run { target { riscv_v } } } */
/* { dg-additional-options "-std=c99 --param=gpr2vr-cost=0" } */
#include "vx_binary.h"
#include "vx_binary_data.h"
#define T uint8_t
#define NAME min
#define FUNC MIN_FUNC_1_WARP(T)
#define TEST_DATA TEST_BINARY_DATA_WRAP(T, NAME)
DEF_VX_BINARY_CASE_2_WRAP(T, FUNC, NAME)
#define TEST_RUN(T, NAME, out, in, x, n) \
RUN_VX_BINARY_CASE_2_WRAP(T, NAME, FUNC, out, in, x, n)
#include "vx_binary_run.h"