From 894d0805372369a8b9d42a596c7115068e5fd4bb Mon Sep 17 00:00:00 2001 From: Philipp van Kempen Date: Fri, 1 Mar 2024 12:54:03 +0100 Subject: [PATCH] add missing test file --- examples/tests/cv_nand/cv_nand.c | 16 ++++++++++++++++ examples/tests/cv_nand/cv_nand.s | 9 +++++++++ examples/tests/cv_nand/cv_nand_invalid.s | 3 +++ 3 files changed, 28 insertions(+) create mode 100644 examples/tests/cv_nand/cv_nand.c create mode 100644 examples/tests/cv_nand/cv_nand.s create mode 100644 examples/tests/cv_nand/cv_nand_invalid.s diff --git a/examples/tests/cv_nand/cv_nand.c b/examples/tests/cv_nand/cv_nand.c new file mode 100644 index 00000000..91c3d9ed --- /dev/null +++ b/examples/tests/cv_nand/cv_nand.c @@ -0,0 +1,16 @@ +// RUN: clang -cc1 -triple riscv32 -target-feature +m -target-feature +xcvnand -S -O3 %s -o - \ +// RUN: | FileCheck %s -check-prefix=CHECK + +// CHECK-LABEL: nand_bitwise_s32: +// CHECK-COUNT-1: cv.nand_bitwise {{.*}} +signed int nand_bitwise_s32(signed int a, signed int b) +{ + return ~(a & b); +} + +// CHECK-LABEL: nand_bitwise_u32: +// CHECK-COUNT-1: cv.nand_bitwise {{.*}} +unsigned int nand_bitwise_u32(unsigned int a, unsigned int b) +{ + return ~(a & b); +} diff --git a/examples/tests/cv_nand/cv_nand.s b/examples/tests/cv_nand/cv_nand.s new file mode 100644 index 00000000..79aa2500 --- /dev/null +++ b/examples/tests/cv_nand/cv_nand.s @@ -0,0 +1,9 @@ +# RUN: llvm-mc %s -triple=riscv32 -mattr=+xcvnand -riscv-no-aliases -show-encoding \ +# RUN: | FileCheck -check-prefixes=CHECK-ASM,CHECK-ASM-AND-OBJ %s +# RUN: llvm-mc -filetype=obj -triple=riscv32 -mattr=+xcvnand < %s \ +# RUN: | llvm-objdump --mattr=+xcvnand -M no-aliases -d -r - \ +# RUN: | FileCheck --check-prefix=CHECK-ASM-AND-OBJ %s + +# CHECK-ASM-AND-OBJ: cv.nand_bitwise a4, ra, s0 +# CHECK-ASM: encoding: [0x2b,0xe7,0x80,0x92] +cv.nand_bitwise a4, ra, s0 diff --git a/examples/tests/cv_nand/cv_nand_invalid.s b/examples/tests/cv_nand/cv_nand_invalid.s new file mode 100644 index 00000000..30f5a0fd --- /dev/null +++ b/examples/tests/cv_nand/cv_nand_invalid.s @@ -0,0 +1,3 @@ +# RUN: not llvm-mc -triple riscv32 -mattr=+m < %s 2>&1 | FileCheck %s + +cv.nand_bitwise a4, ra, s0 # CHECK: :[[@LINE]]:1: error: instruction requires the following: 'Xcvnand' (None)