Skip to content
This repository has been archived by the owner on May 7, 2024. It is now read-only.

Commit

Permalink
[testcases] add testcases
Browse files Browse the repository at this point in the history
  • Loading branch information
linsinan1995 authored and sinan-lin committed Nov 1, 2021
1 parent f3ff3d5 commit 5fc9529
Show file tree
Hide file tree
Showing 370 changed files with 7,679 additions and 0 deletions.
27 changes: 27 additions & 0 deletions gcc/testsuite/gcc.target/riscv/rvp32_scan/builtin-rvp-add16.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
/* add16 also appears on filename, so scan-assembler-times plus 1 */
/* This is a test program for add16 instruction. */
/* { dg-do compile { target riscv32*-*-* } } */
/* { dg-options "-march=rv32gc_zpn -mabi=ilp32d -O0" } */

#include <rvp_intrinsic.h>
#include <stdlib.h>

static __attribute__ ((noinline))
uint32_t dda (uint32_t ra, uint32_t rb)
{
return __rv_add16 (ra, rb);
}

static __attribute__ ((noinline))
uint16x2_t ddau_v (uint16x2_t ra, uint16x2_t rb)
{
return __rv_v_uadd16 (ra, rb);
}

static __attribute__ ((noinline))
int16x2_t ddas_v (int16x2_t ra, int16x2_t rb)
{
return __rv_v_sadd16 (ra, rb);
}
/* { dg-final { scan-assembler-times "add16" 4 } } */
/* { dg-final { scan-assembler-times "builtin_riscv" 0 } } */
21 changes: 21 additions & 0 deletions gcc/testsuite/gcc.target/riscv/rvp32_scan/builtin-rvp-add64.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
/* add64 also appears on filename, so scan-assembler-times plus 1 */
/* This is a test program for add64 instruction. */
/* { dg-do compile { target riscv32*-*-* } } */
/* { dg-options "-march=rv32gc_zpn_zpsf -mabi=ilp32d -O0" } */

#include <rvp_intrinsic.h>
#include <stdlib.h>

static __attribute__ ((noinline))
int64_t ddas (int64_t ra, int64_t rb)
{
return __rv_sadd64 (ra, rb);
}

static __attribute__ ((noinline))
uint64_t ddau (uint64_t ra, uint64_t rb)
{
return __rv_uadd64 (ra, rb);
}
/* { dg-final { scan-assembler-times "add64" 3 } } */
/* { dg-final { scan-assembler-times "builtin_riscv" 0 } } */
27 changes: 27 additions & 0 deletions gcc/testsuite/gcc.target/riscv/rvp32_scan/builtin-rvp-add8.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
/* add8 also appears on filename, so scan-assembler-times plus 1 */
/* This is a test program for add8 instruction. */
/* { dg-do compile { target riscv32*-*-* } } */
/* { dg-options "-march=rv32gc_zpn -mabi=ilp32d -O0" } */

#include <rvp_intrinsic.h>
#include <stdlib.h>

static __attribute__ ((noinline))
uint32_t dda (uint32_t ra, uint32_t rb)
{
return __rv_add8 (ra, rb);
}

static __attribute__ ((noinline))
uint8x4_t ddau_v (uint8x4_t ra, uint8x4_t rb)
{
return __rv_v_uadd8 (ra, rb);
}

static __attribute__ ((noinline))
int8x4_t ddas_v (int8x4_t ra, int8x4_t rb)
{
return __rv_v_sadd8 (ra, rb);
}
/* { dg-final { scan-assembler-times "add8" 4 } } */
/* { dg-final { scan-assembler-times "builtin_riscv" 0 } } */
16 changes: 16 additions & 0 deletions gcc/testsuite/gcc.target/riscv/rvp32_scan/builtin-rvp-ave.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
/* ave also appears on filename, so scan-assembler-times plus 1 */
/* This is a test program for ave instruction. */
/* { dg-do compile { target riscv32*-*-* } } */
/* { dg-options "-march=rv32gc_zpn -mabi=ilp32d -O0" } */

#include <rvp_intrinsic.h>
#include <stdlib.h>

static __attribute__ ((noinline))
int32_t eva (int32_t ra, int32_t rb)
{
return __rv_ave (ra, rb);
}

/* { dg-final { scan-assembler-times "ave" 2 } } */
/* { dg-final { scan-assembler-times "builtin_riscv" 0 } } */
15 changes: 15 additions & 0 deletions gcc/testsuite/gcc.target/riscv/rvp32_scan/builtin-rvp-bitrev.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
/* bitrev also appears on filename, so scan-assembler-times plus 1 */
/* This is a test program for bitrev instruction. */
/* { dg-do compile { target riscv32*-*-* } } */
/* { dg-options "-march=rv32gc_zpn -mabi=ilp32d -O0" } */

#include <rvp_intrinsic.h>
#include <stdlib.h>

static __attribute__ ((noinline))
uint32_t vertib (uint32_t ra, uint32_t rb)
{
return __rv_bitrev (ra, rb);
}
/* { dg-final { scan-assembler-times "bitrev" 2 } } */
/* { dg-final { scan-assembler-times "builtin_riscv" 0 } } */
15 changes: 15 additions & 0 deletions gcc/testsuite/gcc.target/riscv/rvp32_scan/builtin-rvp-bpick.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
/* bpick also appears on filename, so scan-assembler-times plus 1 */
/* This is a test program for bpick instruction. */
/* { dg-do compile { target riscv32*-*-* } } */
/* { dg-options "-march=rv32gc_zpn -mabi=ilp32d -O0" } */

#include <rvp_intrinsic.h>
#include <stdlib.h>

static __attribute__ ((noinline))
uint32_t kcipb (uint32_t ra, uint32_t rb, uint32_t rc)
{
return __rv_bpick (ra, rb, rc);
}
/* { dg-final { scan-assembler-times "bpick" 2 } } */
/* { dg-final { scan-assembler-times "builtin_riscv" 0 } } */
27 changes: 27 additions & 0 deletions gcc/testsuite/gcc.target/riscv/rvp32_scan/builtin-rvp-cmpeq16.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
/* cmpeq16 also appears on filename, so scan-assembler-times plus 1 */
/* This is a test program for cmpeq16 instruction. */
/* { dg-do compile { target riscv32*-*-* } } */
/* { dg-options "-march=rv32gc_zpn -mabi=ilp32d -O0" } */

#include <rvp_intrinsic.h>
#include <stdlib.h>

static __attribute__ ((noinline))
uint32_t qepmc (uint32_t ra, uint32_t rb)
{
return __rv_cmpeq16 (ra, rb);
}

static __attribute__ ((noinline))
uint16x2_t qepmcs_v (int16x2_t ra, int16x2_t rb)
{
return __rv_v_scmpeq16 (ra, rb);
}

static __attribute__ ((noinline))
uint16x2_t qepmcu_v (uint16x2_t ra, uint16x2_t rb)
{
return __rv_v_ucmpeq16 (ra, rb);
}
/* { dg-final { scan-assembler-times "cmpeq16" 4 } } */
/* { dg-final { scan-assembler-times "builtin_riscv" 0 } } */
27 changes: 27 additions & 0 deletions gcc/testsuite/gcc.target/riscv/rvp32_scan/builtin-rvp-cmpeq8.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
/* cmpeq8 also appears on filename, so scan-assembler-times plus 1 */
/* This is a test program for cmpeq8 instruction. */
/* { dg-do compile { target riscv32*-*-* } } */
/* { dg-options "-march=rv32gc_zpn -mabi=ilp32d -O0" } */

#include <rvp_intrinsic.h>
#include <stdlib.h>

static __attribute__ ((noinline))
uint32_t qepmc (uint32_t ra, uint32_t rb)
{
return __rv_cmpeq8 (ra, rb);
}

static __attribute__ ((noinline))
uint8x4_t qepmcs_v (int8x4_t ra, int8x4_t rb)
{
return __rv_v_scmpeq8 (ra, rb);
}

static __attribute__ ((noinline))
uint8x4_t qepmcu_v (uint8x4_t ra, uint8x4_t rb)
{
return __rv_v_ucmpeq8 (ra, rb);
}
/* { dg-final { scan-assembler-times "cmpeq8" 4 } } */
/* { dg-final { scan-assembler-times "builtin_riscv" 0 } } */
64 changes: 64 additions & 0 deletions gcc/testsuite/gcc.target/riscv/rvp32_scan/builtin-rvp-count.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
/* { dg-do compile { target riscv32*-*-* } } */
/* { dg-options "-march=rv32gc_zpn_zpsf -mabi=ilp32d -O0" } */


#include <rvp_intrinsic.h>
#include <stdlib.h>

static __attribute__ ((noinline))
uintXLEN_t foo(uintXLEN_t a) {
return __rv_clrs8 (a);
}

static __attribute__ ((noinline))
uintXLEN_t foo1(uintXLEN_t a) {
return __rv_clrs16 (a);
}

static __attribute__ ((noinline))
uintXLEN_t foo2(uintXLEN_t a) {
return __rv_clrs32 (a);
}

static __attribute__ ((noinline))
uintXLEN_t foo3(uintXLEN_t a) {
return __rv_clz8 (a);
}

static __attribute__ ((noinline))
uintXLEN_t foo4(uintXLEN_t a) {
return __rv_clz16 (a);
}

static __attribute__ ((noinline))
uintXLEN_t foo5(uintXLEN_t a) {
return __rv_clz32 (a);
}

static __attribute__ ((noinline))
uint8xN_t foo6(int8xN_t a) {
return __rv_v_clrs8 (a);
}

static __attribute__ ((noinline))
uint16xN_t foo7(int16xN_t a) {
return __rv_v_clrs16 (a);
}

static __attribute__ ((noinline))
uint8xN_t foo9(uint8xN_t a) {
return __rv_v_clz8 (a);
}

static __attribute__ ((noinline))
uint16xN_t foo10(uint16xN_t a) {
return __rv_v_clz16 (a);
}

/* { dg-final { scan-assembler-times "clrs8" 2 } } */
/* { dg-final { scan-assembler-times "clrs16" 2 } } */
/* { dg-final { scan-assembler-times "clrs32" 1 } } */
/* { dg-final { scan-assembler-times "clz8" 2 } } */
/* { dg-final { scan-assembler-times "clz16" 2 } } */
/* { dg-final { scan-assembler-times "clz32" 1 } } */
/* { dg-final { scan-assembler-times "builtin_riscv" 0 } } */
27 changes: 27 additions & 0 deletions gcc/testsuite/gcc.target/riscv/rvp32_scan/builtin-rvp-cras16.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
/* cras16 also appears on filename, so scan-assembler-times plus 1 */
/* This is a test program for cras16 instruction. */
/* { dg-do compile { target riscv32*-*-* } } */
/* { dg-options "-march=rv32gc_zpn -mabi=ilp32d -O0" } */

#include <rvp_intrinsic.h>
#include <stdlib.h>

static __attribute__ ((noinline))
uint32_t sarc (uint32_t ra, uint32_t rb)
{
return __rv_cras16 (ra, rb);
}

static __attribute__ ((noinline))
uint16x2_t sarcu_v (uint16x2_t ra, uint16x2_t rb)
{
return __rv_v_ucras16 (ra, rb);
}

static __attribute__ ((noinline))
int16x2_t sarcs_v (int16x2_t ra, int16x2_t rb)
{
return __rv_v_scras16 (ra, rb);
}
/* { dg-final { scan-assembler-times "cras16" 4 } } */
/* { dg-final { scan-assembler-times "builtin_riscv" 0 } } */
27 changes: 27 additions & 0 deletions gcc/testsuite/gcc.target/riscv/rvp32_scan/builtin-rvp-crsa16.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
/* crsa16 also appears on filename, so scan-assembler-times plus 1 */
/* This is a test program for crsa16 instruction. */
/* { dg-do compile { target riscv32*-*-* } } */
/* { dg-options "-march=rv32gc_zpn -mabi=ilp32d -O0" } */

#include <rvp_intrinsic.h>
#include <stdlib.h>

static __attribute__ ((noinline))
uint32_t asrc (uint32_t ra, uint32_t rb)
{
return __rv_crsa16 (ra, rb);
}

static __attribute__ ((noinline))
uint16x2_t asrcu_v (uint16x2_t ra, uint16x2_t rb)
{
return __rv_v_ucrsa16 (ra, rb);
}

static __attribute__ ((noinline))
int16x2_t asrcs_v (int16x2_t ra, int16x2_t rb)
{
return __rv_v_scrsa16 (ra, rb);
}
/* { dg-final { scan-assembler-times "crsa16" 4 } } */
/* { dg-final { scan-assembler-times "builtin_riscv" 0 } } */
15 changes: 15 additions & 0 deletions gcc/testsuite/gcc.target/riscv/rvp32_scan/builtin-rvp-insb.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
/* insb also appears on filename, so scan-assembler-times plus 1 */
/* This is a test program for insb instruction. */
/* { dg-do compile { target riscv32*-*-* } } */
/* { dg-options "-march=rv32gc_zpn -mabi=ilp32d -O0" } */

#include <rvp_intrinsic.h>
#include <stdlib.h>

static __attribute__ ((noinline))
uint32_t bsni (uint32_t ra, uint32_t rb)
{
return __rv_insb (ra, rb, 1);
}
/* { dg-final { scan-assembler-times "insb" 2 } } */
/* { dg-final { scan-assembler-times "builtin_riscv" 0 } } */
17 changes: 17 additions & 0 deletions gcc/testsuite/gcc.target/riscv/rvp32_scan/builtin-rvp-kmar64.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
/* kmar64 also appears on filename, so scan-assembler-times plus 1 */
/* This is a test program for kmar64 instruction. */
/* { dg-do compile { target riscv32*-*-* } } */
/* { dg-options "-march=rv32gc_zpn_zpsf -mabi=ilp32d -O0" } */


#include <rvp_intrinsic.h>
#include <stdlib.h>

static __attribute__ ((noinline))
int64_t ramk (int64_t rd, int64_t ra, int64_t rb)
{
return __rv_kmar64 (rd, ra, rb);
}

/* { dg-final { scan-assembler-times "kmar64" 2 } } */
/* { dg-final { scan-assembler-times "builtin_riscv" 0 } } */
41 changes: 41 additions & 0 deletions gcc/testsuite/gcc.target/riscv/rvp32_scan/builtin-rvp-mfb.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
/* { dg-do compile { target riscv32*-*-* } } */
/* { dg-options "-march=rv32gc_zpn_zpsf -mabi=ilp32d -O0" } */


#include <rvp_intrinsic.h>
#include <stdlib.h>

static __attribute__ ((noinline))
intXLEN_t foo(intXLEN_t t, uintXLEN_t a, uintXLEN_t b) {
return __rv_smaqa (t, a, b);
}

static __attribute__ ((noinline))
intXLEN_t foo1(intXLEN_t t, uintXLEN_t a, uintXLEN_t b) {
return __rv_smaqa_su (t, a, b);
}

static __attribute__ ((noinline))
uintXLEN_t foo2(intXLEN_t t, uintXLEN_t a, uintXLEN_t b) {
return __rv_umaqa (t, a, b);
}

static __attribute__ ((noinline))
int32xN_t foo3(int32xN_t t, int8xN_t a, int8xN_t b) {
return __rv_v_smaqa (t, a, b);
}

static __attribute__ ((noinline))
int32xN_t foo4(int32xN_t t, int8xN_t a, uint8xN_t b) {
return __rv_v_smaqa_su (t, a, b);
}

static __attribute__ ((noinline))
uint32xN_t foo5(uint32xN_t t, uint8xN_t a, uint8xN_t b) {
return __rv_v_umaqa (t, a, b);
}

/* { dg-final { scan-assembler-times "smaqa.su" 2 } } */
/* { dg-final { scan-assembler-times "smaqa" 4 } } */
/* { dg-final { scan-assembler-times "umaqa" 2 } } */
/* { dg-final { scan-assembler-times "builtin_riscv" 0 } } */
15 changes: 15 additions & 0 deletions gcc/testsuite/gcc.target/riscv/rvp32_scan/builtin-rvp-pbsad.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
/* pbsad also appears on filename, so scan-assembler-times plus 1 */
/* This is a test program for pbsad instruction. */
/* { dg-do compile { target riscv32*-*-* } } */
/* { dg-options "-march=rv32gc_zpn -mabi=ilp32d -O0" } */

#include <rvp_intrinsic.h>
#include <stdlib.h>

static __attribute__ ((noinline))
uint32_t dasbp (uint32_t ra, uint32_t rb)
{
return __rv_pbsad (ra, rb);
}
/* { dg-final { scan-assembler-times "pbsad" 2 } } */
/* { dg-final { scan-assembler-times "builtin_riscv" 0 } } */
Loading

0 comments on commit 5fc9529

Please sign in to comment.