Skip to content

Commit

Permalink
add missing test file
Browse files Browse the repository at this point in the history
  • Loading branch information
PhilippvK committed Mar 1, 2024
1 parent f32c80b commit 894d080
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 0 deletions.
16 changes: 16 additions & 0 deletions examples/tests/cv_nand/cv_nand.c
Original file line number Diff line number Diff line change
@@ -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);
}
9 changes: 9 additions & 0 deletions examples/tests/cv_nand/cv_nand.s
Original file line number Diff line number Diff line change
@@ -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
3 changes: 3 additions & 0 deletions examples/tests/cv_nand/cv_nand_invalid.s
Original file line number Diff line number Diff line change
@@ -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)

0 comments on commit 894d080

Please sign in to comment.