diff --git a/clang/include/clang/Basic/riscv_vector.td b/clang/include/clang/Basic/riscv_vector.td --- a/clang/include/clang/Basic/riscv_vector.td +++ b/clang/include/clang/Basic/riscv_vector.td @@ -844,6 +844,23 @@ } } +multiclass RVVPseudoMaskBuiltin { + let Name = NAME, + IRName = IR, + HasMask = false, + ManualCodegen = [{ + { + // op1, vl + IntrinsicTypes = {ResultType, + Ops[1]->getType()}; + Ops.insert(Ops.begin() + 1, Ops[0]); + break; + } + }] in { + def : RVVBuiltin<"m", "mm", type_range>; + } +} + // 6. Configuration-Setting Instructions // 6.1. vsetvli/vsetvl instructions let HasVL = false, @@ -1300,6 +1317,8 @@ // pseudoinstructions def vmclr : RVVMaskNullaryBuiltin; def vmset : RVVMaskNullaryBuiltin; +defm vmmv_m : RVVPseudoMaskBuiltin<"vmand", "c">; +defm vmnot_m : RVVPseudoMaskBuiltin<"vmnand", "c">; // 16.2. Vector mask population count vpopc def vpopc : RVVMaskOp0Builtin<"um">; diff --git a/clang/test/CodeGen/RISCV/rvv-intrinsics-overloaded/vmmv.c b/clang/test/CodeGen/RISCV/rvv-intrinsics-overloaded/vmmv.c new file mode 100644 --- /dev/null +++ b/clang/test/CodeGen/RISCV/rvv-intrinsics-overloaded/vmmv.c @@ -0,0 +1,107 @@ +// NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py +// RUN: %clang_cc1 -triple riscv32 -target-feature +experimental-v -disable-O0-optnone -emit-llvm %s -o - | opt -S -mem2reg | FileCheck --check-prefix=CHECK-RV32 %s +// RUN: %clang_cc1 -triple riscv64 -target-feature +experimental-v -disable-O0-optnone -emit-llvm %s -o - | opt -S -mem2reg | FileCheck --check-prefix=CHECK-RV64 %s +// RUN: %clang_cc1 -triple riscv64 -target-feature +experimental-v -target-feature +m -Werror -Wall -S -o - %s >/dev/null 2>%t +// RUN: FileCheck --check-prefix=ASM --allow-empty %s <%t + +// ASM-NOT: warning +#include + +// CHECK-RV32-LABEL: @test_vmmv_m_b1( +// CHECK-RV32-NEXT: entry: +// CHECK-RV32-NEXT: [[TMP0:%.*]] = call @llvm.riscv.vmand.nxv64i1.i32( [[OP1:%.*]], [[OP1]], i32 [[VL:%.*]]) #[[ATTR8:[0-9]+]] +// CHECK-RV32-NEXT: ret [[TMP0]] +// +// CHECK-RV64-LABEL: @test_vmmv_m_b1( +// CHECK-RV64-NEXT: entry: +// CHECK-RV64-NEXT: [[TMP0:%.*]] = call @llvm.riscv.vmand.nxv64i1.i64( [[OP1:%.*]], [[OP1]], i64 [[VL:%.*]]) #[[ATTR8:[0-9]+]] +// CHECK-RV64-NEXT: ret [[TMP0]] +// +vbool1_t test_vmmv_m_b1 (vbool1_t op1, size_t vl) { + return vmmv(op1, vl); +} + +// CHECK-RV32-LABEL: @test_vmmv_m_b2( +// CHECK-RV32-NEXT: entry: +// CHECK-RV32-NEXT: [[TMP0:%.*]] = call @llvm.riscv.vmand.nxv32i1.i32( [[OP1:%.*]], [[OP1]], i32 [[VL:%.*]]) #[[ATTR8]] +// CHECK-RV32-NEXT: ret [[TMP0]] +// +// CHECK-RV64-LABEL: @test_vmmv_m_b2( +// CHECK-RV64-NEXT: entry: +// CHECK-RV64-NEXT: [[TMP0:%.*]] = call @llvm.riscv.vmand.nxv32i1.i64( [[OP1:%.*]], [[OP1]], i64 [[VL:%.*]]) #[[ATTR8]] +// CHECK-RV64-NEXT: ret [[TMP0]] +// +vbool2_t test_vmmv_m_b2 (vbool2_t op1, size_t vl) { + return vmmv(op1, vl); +} + +// CHECK-RV32-LABEL: @test_vmmv_m_b4( +// CHECK-RV32-NEXT: entry: +// CHECK-RV32-NEXT: [[TMP0:%.*]] = call @llvm.riscv.vmand.nxv16i1.i32( [[OP1:%.*]], [[OP1]], i32 [[VL:%.*]]) #[[ATTR8]] +// CHECK-RV32-NEXT: ret [[TMP0]] +// +// CHECK-RV64-LABEL: @test_vmmv_m_b4( +// CHECK-RV64-NEXT: entry: +// CHECK-RV64-NEXT: [[TMP0:%.*]] = call @llvm.riscv.vmand.nxv16i1.i64( [[OP1:%.*]], [[OP1]], i64 [[VL:%.*]]) #[[ATTR8]] +// CHECK-RV64-NEXT: ret [[TMP0]] +// +vbool4_t test_vmmv_m_b4 (vbool4_t op1, size_t vl) { + return vmmv(op1, vl); +} + +// CHECK-RV32-LABEL: @test_vmmv_m_b8( +// CHECK-RV32-NEXT: entry: +// CHECK-RV32-NEXT: [[TMP0:%.*]] = call @llvm.riscv.vmand.nxv8i1.i32( [[OP1:%.*]], [[OP1]], i32 [[VL:%.*]]) #[[ATTR8]] +// CHECK-RV32-NEXT: ret [[TMP0]] +// +// CHECK-RV64-LABEL: @test_vmmv_m_b8( +// CHECK-RV64-NEXT: entry: +// CHECK-RV64-NEXT: [[TMP0:%.*]] = call @llvm.riscv.vmand.nxv8i1.i64( [[OP1:%.*]], [[OP1]], i64 [[VL:%.*]]) #[[ATTR8]] +// CHECK-RV64-NEXT: ret [[TMP0]] +// +vbool8_t test_vmmv_m_b8 (vbool8_t op1, size_t vl) { + return vmmv(op1, vl); +} + +// CHECK-RV32-LABEL: @test_vmmv_m_b16( +// CHECK-RV32-NEXT: entry: +// CHECK-RV32-NEXT: [[TMP0:%.*]] = call @llvm.riscv.vmand.nxv4i1.i32( [[OP1:%.*]], [[OP1]], i32 [[VL:%.*]]) #[[ATTR8]] +// CHECK-RV32-NEXT: ret [[TMP0]] +// +// CHECK-RV64-LABEL: @test_vmmv_m_b16( +// CHECK-RV64-NEXT: entry: +// CHECK-RV64-NEXT: [[TMP0:%.*]] = call @llvm.riscv.vmand.nxv4i1.i64( [[OP1:%.*]], [[OP1]], i64 [[VL:%.*]]) #[[ATTR8]] +// CHECK-RV64-NEXT: ret [[TMP0]] +// +vbool16_t test_vmmv_m_b16 (vbool16_t op1, size_t vl) { + return vmmv(op1, vl); +} + +// CHECK-RV32-LABEL: @test_vmmv_m_b32( +// CHECK-RV32-NEXT: entry: +// CHECK-RV32-NEXT: [[TMP0:%.*]] = call @llvm.riscv.vmand.nxv2i1.i32( [[OP1:%.*]], [[OP1]], i32 [[VL:%.*]]) #[[ATTR8]] +// CHECK-RV32-NEXT: ret [[TMP0]] +// +// CHECK-RV64-LABEL: @test_vmmv_m_b32( +// CHECK-RV64-NEXT: entry: +// CHECK-RV64-NEXT: [[TMP0:%.*]] = call @llvm.riscv.vmand.nxv2i1.i64( [[OP1:%.*]], [[OP1]], i64 [[VL:%.*]]) #[[ATTR8]] +// CHECK-RV64-NEXT: ret [[TMP0]] +// +vbool32_t test_vmmv_m_b32 (vbool32_t op1, size_t vl) { + return vmmv(op1, vl); +} + +// CHECK-RV32-LABEL: @test_vmmv_m_b64( +// CHECK-RV32-NEXT: entry: +// CHECK-RV32-NEXT: [[TMP0:%.*]] = call @llvm.riscv.vmand.nxv1i1.i32( [[OP1:%.*]], [[OP1]], i32 [[VL:%.*]]) #[[ATTR8]] +// CHECK-RV32-NEXT: ret [[TMP0]] +// +// CHECK-RV64-LABEL: @test_vmmv_m_b64( +// CHECK-RV64-NEXT: entry: +// CHECK-RV64-NEXT: [[TMP0:%.*]] = call @llvm.riscv.vmand.nxv1i1.i64( [[OP1:%.*]], [[OP1]], i64 [[VL:%.*]]) #[[ATTR8]] +// CHECK-RV64-NEXT: ret [[TMP0]] +// +vbool64_t test_vmmv_m_b64 (vbool64_t op1, size_t vl) { + return vmmv(op1, vl); +} + diff --git a/clang/test/CodeGen/RISCV/rvv-intrinsics-overloaded/vmnot.c b/clang/test/CodeGen/RISCV/rvv-intrinsics-overloaded/vmnot.c new file mode 100644 --- /dev/null +++ b/clang/test/CodeGen/RISCV/rvv-intrinsics-overloaded/vmnot.c @@ -0,0 +1,107 @@ +// NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py +// RUN: %clang_cc1 -triple riscv32 -target-feature +experimental-v -disable-O0-optnone -emit-llvm %s -o - | opt -S -mem2reg | FileCheck --check-prefix=CHECK-RV32 %s +// RUN: %clang_cc1 -triple riscv64 -target-feature +experimental-v -disable-O0-optnone -emit-llvm %s -o - | opt -S -mem2reg | FileCheck --check-prefix=CHECK-RV64 %s +// RUN: %clang_cc1 -triple riscv64 -target-feature +experimental-v -target-feature +m -Werror -Wall -S -o - %s >/dev/null 2>%t +// RUN: FileCheck --check-prefix=ASM --allow-empty %s <%t + +// ASM-NOT: warning +#include + +// CHECK-RV32-LABEL: @test_vmnot_m_b1( +// CHECK-RV32-NEXT: entry: +// CHECK-RV32-NEXT: [[TMP0:%.*]] = call @llvm.riscv.vmnand.nxv64i1.i32( [[OP1:%.*]], [[OP1]], i32 [[VL:%.*]]) #[[ATTR8:[0-9]+]] +// CHECK-RV32-NEXT: ret [[TMP0]] +// +// CHECK-RV64-LABEL: @test_vmnot_m_b1( +// CHECK-RV64-NEXT: entry: +// CHECK-RV64-NEXT: [[TMP0:%.*]] = call @llvm.riscv.vmnand.nxv64i1.i64( [[OP1:%.*]], [[OP1]], i64 [[VL:%.*]]) #[[ATTR8:[0-9]+]] +// CHECK-RV64-NEXT: ret [[TMP0]] +// +vbool1_t test_vmnot_m_b1 (vbool1_t op1, size_t vl) { + return vmnot(op1, vl); +} + +// CHECK-RV32-LABEL: @test_vmnot_m_b2( +// CHECK-RV32-NEXT: entry: +// CHECK-RV32-NEXT: [[TMP0:%.*]] = call @llvm.riscv.vmnand.nxv32i1.i32( [[OP1:%.*]], [[OP1]], i32 [[VL:%.*]]) #[[ATTR8]] +// CHECK-RV32-NEXT: ret [[TMP0]] +// +// CHECK-RV64-LABEL: @test_vmnot_m_b2( +// CHECK-RV64-NEXT: entry: +// CHECK-RV64-NEXT: [[TMP0:%.*]] = call @llvm.riscv.vmnand.nxv32i1.i64( [[OP1:%.*]], [[OP1]], i64 [[VL:%.*]]) #[[ATTR8]] +// CHECK-RV64-NEXT: ret [[TMP0]] +// +vbool2_t test_vmnot_m_b2 (vbool2_t op1, size_t vl) { + return vmnot(op1, vl); +} + +// CHECK-RV32-LABEL: @test_vmnot_m_b4( +// CHECK-RV32-NEXT: entry: +// CHECK-RV32-NEXT: [[TMP0:%.*]] = call @llvm.riscv.vmnand.nxv16i1.i32( [[OP1:%.*]], [[OP1]], i32 [[VL:%.*]]) #[[ATTR8]] +// CHECK-RV32-NEXT: ret [[TMP0]] +// +// CHECK-RV64-LABEL: @test_vmnot_m_b4( +// CHECK-RV64-NEXT: entry: +// CHECK-RV64-NEXT: [[TMP0:%.*]] = call @llvm.riscv.vmnand.nxv16i1.i64( [[OP1:%.*]], [[OP1]], i64 [[VL:%.*]]) #[[ATTR8]] +// CHECK-RV64-NEXT: ret [[TMP0]] +// +vbool4_t test_vmnot_m_b4 (vbool4_t op1, size_t vl) { + return vmnot(op1, vl); +} + +// CHECK-RV32-LABEL: @test_vmnot_m_b8( +// CHECK-RV32-NEXT: entry: +// CHECK-RV32-NEXT: [[TMP0:%.*]] = call @llvm.riscv.vmnand.nxv8i1.i32( [[OP1:%.*]], [[OP1]], i32 [[VL:%.*]]) #[[ATTR8]] +// CHECK-RV32-NEXT: ret [[TMP0]] +// +// CHECK-RV64-LABEL: @test_vmnot_m_b8( +// CHECK-RV64-NEXT: entry: +// CHECK-RV64-NEXT: [[TMP0:%.*]] = call @llvm.riscv.vmnand.nxv8i1.i64( [[OP1:%.*]], [[OP1]], i64 [[VL:%.*]]) #[[ATTR8]] +// CHECK-RV64-NEXT: ret [[TMP0]] +// +vbool8_t test_vmnot_m_b8 (vbool8_t op1, size_t vl) { + return vmnot(op1, vl); +} + +// CHECK-RV32-LABEL: @test_vmnot_m_b16( +// CHECK-RV32-NEXT: entry: +// CHECK-RV32-NEXT: [[TMP0:%.*]] = call @llvm.riscv.vmnand.nxv4i1.i32( [[OP1:%.*]], [[OP1]], i32 [[VL:%.*]]) #[[ATTR8]] +// CHECK-RV32-NEXT: ret [[TMP0]] +// +// CHECK-RV64-LABEL: @test_vmnot_m_b16( +// CHECK-RV64-NEXT: entry: +// CHECK-RV64-NEXT: [[TMP0:%.*]] = call @llvm.riscv.vmnand.nxv4i1.i64( [[OP1:%.*]], [[OP1]], i64 [[VL:%.*]]) #[[ATTR8]] +// CHECK-RV64-NEXT: ret [[TMP0]] +// +vbool16_t test_vmnot_m_b16 (vbool16_t op1, size_t vl) { + return vmnot(op1, vl); +} + +// CHECK-RV32-LABEL: @test_vmnot_m_b32( +// CHECK-RV32-NEXT: entry: +// CHECK-RV32-NEXT: [[TMP0:%.*]] = call @llvm.riscv.vmnand.nxv2i1.i32( [[OP1:%.*]], [[OP1]], i32 [[VL:%.*]]) #[[ATTR8]] +// CHECK-RV32-NEXT: ret [[TMP0]] +// +// CHECK-RV64-LABEL: @test_vmnot_m_b32( +// CHECK-RV64-NEXT: entry: +// CHECK-RV64-NEXT: [[TMP0:%.*]] = call @llvm.riscv.vmnand.nxv2i1.i64( [[OP1:%.*]], [[OP1]], i64 [[VL:%.*]]) #[[ATTR8]] +// CHECK-RV64-NEXT: ret [[TMP0]] +// +vbool32_t test_vmnot_m_b32 (vbool32_t op1, size_t vl) { + return vmnot(op1, vl); +} + +// CHECK-RV32-LABEL: @test_vmnot_m_b64( +// CHECK-RV32-NEXT: entry: +// CHECK-RV32-NEXT: [[TMP0:%.*]] = call @llvm.riscv.vmnand.nxv1i1.i32( [[OP1:%.*]], [[OP1]], i32 [[VL:%.*]]) #[[ATTR8]] +// CHECK-RV32-NEXT: ret [[TMP0]] +// +// CHECK-RV64-LABEL: @test_vmnot_m_b64( +// CHECK-RV64-NEXT: entry: +// CHECK-RV64-NEXT: [[TMP0:%.*]] = call @llvm.riscv.vmnand.nxv1i1.i64( [[OP1:%.*]], [[OP1]], i64 [[VL:%.*]]) #[[ATTR8]] +// CHECK-RV64-NEXT: ret [[TMP0]] +// +vbool64_t test_vmnot_m_b64 (vbool64_t op1, size_t vl) { + return vmnot(op1, vl); +} + diff --git a/clang/test/CodeGen/RISCV/rvv-intrinsics/vmmv.c b/clang/test/CodeGen/RISCV/rvv-intrinsics/vmmv.c new file mode 100644 --- /dev/null +++ b/clang/test/CodeGen/RISCV/rvv-intrinsics/vmmv.c @@ -0,0 +1,107 @@ +// NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py +// RUN: %clang_cc1 -triple riscv32 -target-feature +experimental-v -disable-O0-optnone -emit-llvm %s -o - | opt -S -mem2reg | FileCheck --check-prefix=CHECK-RV32 %s +// RUN: %clang_cc1 -triple riscv64 -target-feature +experimental-v -disable-O0-optnone -emit-llvm %s -o - | opt -S -mem2reg | FileCheck --check-prefix=CHECK-RV64 %s +// RUN: %clang_cc1 -triple riscv64 -target-feature +experimental-v -target-feature +m -Werror -Wall -S -o - %s >/dev/null 2>%t +// RUN: FileCheck --check-prefix=ASM --allow-empty %s <%t + +// ASM-NOT: warning +#include + +// CHECK-RV32-LABEL: @test_vmmv_m_b1( +// CHECK-RV32-NEXT: entry: +// CHECK-RV32-NEXT: [[TMP0:%.*]] = call @llvm.riscv.vmand.nxv64i1.i32( [[OP1:%.*]], [[OP1]], i32 [[VL:%.*]]) +// CHECK-RV32-NEXT: ret [[TMP0]] +// +// CHECK-RV64-LABEL: @test_vmmv_m_b1( +// CHECK-RV64-NEXT: entry: +// CHECK-RV64-NEXT: [[TMP0:%.*]] = call @llvm.riscv.vmand.nxv64i1.i64( [[OP1:%.*]], [[OP1]], i64 [[VL:%.*]]) +// CHECK-RV64-NEXT: ret [[TMP0]] +// +vbool1_t test_vmmv_m_b1 (vbool1_t op1, size_t vl) { + return vmmv_m_b1(op1, vl); +} + +// CHECK-RV32-LABEL: @test_vmmv_m_b2( +// CHECK-RV32-NEXT: entry: +// CHECK-RV32-NEXT: [[TMP0:%.*]] = call @llvm.riscv.vmand.nxv32i1.i32( [[OP1:%.*]], [[OP1]], i32 [[VL:%.*]]) +// CHECK-RV32-NEXT: ret [[TMP0]] +// +// CHECK-RV64-LABEL: @test_vmmv_m_b2( +// CHECK-RV64-NEXT: entry: +// CHECK-RV64-NEXT: [[TMP0:%.*]] = call @llvm.riscv.vmand.nxv32i1.i64( [[OP1:%.*]], [[OP1]], i64 [[VL:%.*]]) +// CHECK-RV64-NEXT: ret [[TMP0]] +// +vbool2_t test_vmmv_m_b2 (vbool2_t op1, size_t vl) { + return vmmv_m_b2(op1, vl); +} + +// CHECK-RV32-LABEL: @test_vmmv_m_b4( +// CHECK-RV32-NEXT: entry: +// CHECK-RV32-NEXT: [[TMP0:%.*]] = call @llvm.riscv.vmand.nxv16i1.i32( [[OP1:%.*]], [[OP1]], i32 [[VL:%.*]]) +// CHECK-RV32-NEXT: ret [[TMP0]] +// +// CHECK-RV64-LABEL: @test_vmmv_m_b4( +// CHECK-RV64-NEXT: entry: +// CHECK-RV64-NEXT: [[TMP0:%.*]] = call @llvm.riscv.vmand.nxv16i1.i64( [[OP1:%.*]], [[OP1]], i64 [[VL:%.*]]) +// CHECK-RV64-NEXT: ret [[TMP0]] +// +vbool4_t test_vmmv_m_b4 (vbool4_t op1, size_t vl) { + return vmmv_m_b4(op1, vl); +} + +// CHECK-RV32-LABEL: @test_vmmv_m_b8( +// CHECK-RV32-NEXT: entry: +// CHECK-RV32-NEXT: [[TMP0:%.*]] = call @llvm.riscv.vmand.nxv8i1.i32( [[OP1:%.*]], [[OP1]], i32 [[VL:%.*]]) +// CHECK-RV32-NEXT: ret [[TMP0]] +// +// CHECK-RV64-LABEL: @test_vmmv_m_b8( +// CHECK-RV64-NEXT: entry: +// CHECK-RV64-NEXT: [[TMP0:%.*]] = call @llvm.riscv.vmand.nxv8i1.i64( [[OP1:%.*]], [[OP1]], i64 [[VL:%.*]]) +// CHECK-RV64-NEXT: ret [[TMP0]] +// +vbool8_t test_vmmv_m_b8 (vbool8_t op1, size_t vl) { + return vmmv_m_b8(op1, vl); +} + +// CHECK-RV32-LABEL: @test_vmmv_m_b16( +// CHECK-RV32-NEXT: entry: +// CHECK-RV32-NEXT: [[TMP0:%.*]] = call @llvm.riscv.vmand.nxv4i1.i32( [[OP1:%.*]], [[OP1]], i32 [[VL:%.*]]) +// CHECK-RV32-NEXT: ret [[TMP0]] +// +// CHECK-RV64-LABEL: @test_vmmv_m_b16( +// CHECK-RV64-NEXT: entry: +// CHECK-RV64-NEXT: [[TMP0:%.*]] = call @llvm.riscv.vmand.nxv4i1.i64( [[OP1:%.*]], [[OP1]], i64 [[VL:%.*]]) +// CHECK-RV64-NEXT: ret [[TMP0]] +// +vbool16_t test_vmmv_m_b16 (vbool16_t op1, size_t vl) { + return vmmv_m_b16(op1, vl); +} + +// CHECK-RV32-LABEL: @test_vmmv_m_b32( +// CHECK-RV32-NEXT: entry: +// CHECK-RV32-NEXT: [[TMP0:%.*]] = call @llvm.riscv.vmand.nxv2i1.i32( [[OP1:%.*]], [[OP1]], i32 [[VL:%.*]]) +// CHECK-RV32-NEXT: ret [[TMP0]] +// +// CHECK-RV64-LABEL: @test_vmmv_m_b32( +// CHECK-RV64-NEXT: entry: +// CHECK-RV64-NEXT: [[TMP0:%.*]] = call @llvm.riscv.vmand.nxv2i1.i64( [[OP1:%.*]], [[OP1]], i64 [[VL:%.*]]) +// CHECK-RV64-NEXT: ret [[TMP0]] +// +vbool32_t test_vmmv_m_b32 (vbool32_t op1, size_t vl) { + return vmmv_m_b32(op1, vl); +} + +// CHECK-RV32-LABEL: @test_vmmv_m_b64( +// CHECK-RV32-NEXT: entry: +// CHECK-RV32-NEXT: [[TMP0:%.*]] = call @llvm.riscv.vmand.nxv1i1.i32( [[OP1:%.*]], [[OP1]], i32 [[VL:%.*]]) +// CHECK-RV32-NEXT: ret [[TMP0]] +// +// CHECK-RV64-LABEL: @test_vmmv_m_b64( +// CHECK-RV64-NEXT: entry: +// CHECK-RV64-NEXT: [[TMP0:%.*]] = call @llvm.riscv.vmand.nxv1i1.i64( [[OP1:%.*]], [[OP1]], i64 [[VL:%.*]]) +// CHECK-RV64-NEXT: ret [[TMP0]] +// +vbool64_t test_vmmv_m_b64 (vbool64_t op1, size_t vl) { + return vmmv_m_b64(op1, vl); +} + diff --git a/clang/test/CodeGen/RISCV/rvv-intrinsics/vmnot.c b/clang/test/CodeGen/RISCV/rvv-intrinsics/vmnot.c new file mode 100644 --- /dev/null +++ b/clang/test/CodeGen/RISCV/rvv-intrinsics/vmnot.c @@ -0,0 +1,107 @@ +// NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py +// RUN: %clang_cc1 -triple riscv32 -target-feature +experimental-v -disable-O0-optnone -emit-llvm %s -o - | opt -S -mem2reg | FileCheck --check-prefix=CHECK-RV32 %s +// RUN: %clang_cc1 -triple riscv64 -target-feature +experimental-v -disable-O0-optnone -emit-llvm %s -o - | opt -S -mem2reg | FileCheck --check-prefix=CHECK-RV64 %s +// RUN: %clang_cc1 -triple riscv64 -target-feature +experimental-v -target-feature +m -Werror -Wall -S -o - %s >/dev/null 2>%t +// RUN: FileCheck --check-prefix=ASM --allow-empty %s <%t + +// ASM-NOT: warning +#include + +// CHECK-RV32-LABEL: @test_vmnot_m_b1( +// CHECK-RV32-NEXT: entry: +// CHECK-RV32-NEXT: [[TMP0:%.*]] = call @llvm.riscv.vmnand.nxv64i1.i32( [[OP1:%.*]], [[OP1]], i32 [[VL:%.*]]) +// CHECK-RV32-NEXT: ret [[TMP0]] +// +// CHECK-RV64-LABEL: @test_vmnot_m_b1( +// CHECK-RV64-NEXT: entry: +// CHECK-RV64-NEXT: [[TMP0:%.*]] = call @llvm.riscv.vmnand.nxv64i1.i64( [[OP1:%.*]], [[OP1]], i64 [[VL:%.*]]) +// CHECK-RV64-NEXT: ret [[TMP0]] +// +vbool1_t test_vmnot_m_b1 (vbool1_t op1, size_t vl) { + return vmnot_m_b1(op1, vl); +} + +// CHECK-RV32-LABEL: @test_vmnot_m_b2( +// CHECK-RV32-NEXT: entry: +// CHECK-RV32-NEXT: [[TMP0:%.*]] = call @llvm.riscv.vmnand.nxv32i1.i32( [[OP1:%.*]], [[OP1]], i32 [[VL:%.*]]) +// CHECK-RV32-NEXT: ret [[TMP0]] +// +// CHECK-RV64-LABEL: @test_vmnot_m_b2( +// CHECK-RV64-NEXT: entry: +// CHECK-RV64-NEXT: [[TMP0:%.*]] = call @llvm.riscv.vmnand.nxv32i1.i64( [[OP1:%.*]], [[OP1]], i64 [[VL:%.*]]) +// CHECK-RV64-NEXT: ret [[TMP0]] +// +vbool2_t test_vmnot_m_b2 (vbool2_t op1, size_t vl) { + return vmnot_m_b2(op1, vl); +} + +// CHECK-RV32-LABEL: @test_vmnot_m_b4( +// CHECK-RV32-NEXT: entry: +// CHECK-RV32-NEXT: [[TMP0:%.*]] = call @llvm.riscv.vmnand.nxv16i1.i32( [[OP1:%.*]], [[OP1]], i32 [[VL:%.*]]) +// CHECK-RV32-NEXT: ret [[TMP0]] +// +// CHECK-RV64-LABEL: @test_vmnot_m_b4( +// CHECK-RV64-NEXT: entry: +// CHECK-RV64-NEXT: [[TMP0:%.*]] = call @llvm.riscv.vmnand.nxv16i1.i64( [[OP1:%.*]], [[OP1]], i64 [[VL:%.*]]) +// CHECK-RV64-NEXT: ret [[TMP0]] +// +vbool4_t test_vmnot_m_b4 (vbool4_t op1, size_t vl) { + return vmnot_m_b4(op1, vl); +} + +// CHECK-RV32-LABEL: @test_vmnot_m_b8( +// CHECK-RV32-NEXT: entry: +// CHECK-RV32-NEXT: [[TMP0:%.*]] = call @llvm.riscv.vmnand.nxv8i1.i32( [[OP1:%.*]], [[OP1]], i32 [[VL:%.*]]) +// CHECK-RV32-NEXT: ret [[TMP0]] +// +// CHECK-RV64-LABEL: @test_vmnot_m_b8( +// CHECK-RV64-NEXT: entry: +// CHECK-RV64-NEXT: [[TMP0:%.*]] = call @llvm.riscv.vmnand.nxv8i1.i64( [[OP1:%.*]], [[OP1]], i64 [[VL:%.*]]) +// CHECK-RV64-NEXT: ret [[TMP0]] +// +vbool8_t test_vmnot_m_b8 (vbool8_t op1, size_t vl) { + return vmnot_m_b8(op1, vl); +} + +// CHECK-RV32-LABEL: @test_vmnot_m_b16( +// CHECK-RV32-NEXT: entry: +// CHECK-RV32-NEXT: [[TMP0:%.*]] = call @llvm.riscv.vmnand.nxv4i1.i32( [[OP1:%.*]], [[OP1]], i32 [[VL:%.*]]) +// CHECK-RV32-NEXT: ret [[TMP0]] +// +// CHECK-RV64-LABEL: @test_vmnot_m_b16( +// CHECK-RV64-NEXT: entry: +// CHECK-RV64-NEXT: [[TMP0:%.*]] = call @llvm.riscv.vmnand.nxv4i1.i64( [[OP1:%.*]], [[OP1]], i64 [[VL:%.*]]) +// CHECK-RV64-NEXT: ret [[TMP0]] +// +vbool16_t test_vmnot_m_b16 (vbool16_t op1, size_t vl) { + return vmnot_m_b16(op1, vl); +} + +// CHECK-RV32-LABEL: @test_vmnot_m_b32( +// CHECK-RV32-NEXT: entry: +// CHECK-RV32-NEXT: [[TMP0:%.*]] = call @llvm.riscv.vmnand.nxv2i1.i32( [[OP1:%.*]], [[OP1]], i32 [[VL:%.*]]) +// CHECK-RV32-NEXT: ret [[TMP0]] +// +// CHECK-RV64-LABEL: @test_vmnot_m_b32( +// CHECK-RV64-NEXT: entry: +// CHECK-RV64-NEXT: [[TMP0:%.*]] = call @llvm.riscv.vmnand.nxv2i1.i64( [[OP1:%.*]], [[OP1]], i64 [[VL:%.*]]) +// CHECK-RV64-NEXT: ret [[TMP0]] +// +vbool32_t test_vmnot_m_b32 (vbool32_t op1, size_t vl) { + return vmnot_m_b32(op1, vl); +} + +// CHECK-RV32-LABEL: @test_vmnot_m_b64( +// CHECK-RV32-NEXT: entry: +// CHECK-RV32-NEXT: [[TMP0:%.*]] = call @llvm.riscv.vmnand.nxv1i1.i32( [[OP1:%.*]], [[OP1]], i32 [[VL:%.*]]) +// CHECK-RV32-NEXT: ret [[TMP0]] +// +// CHECK-RV64-LABEL: @test_vmnot_m_b64( +// CHECK-RV64-NEXT: entry: +// CHECK-RV64-NEXT: [[TMP0:%.*]] = call @llvm.riscv.vmnand.nxv1i1.i64( [[OP1:%.*]], [[OP1]], i64 [[VL:%.*]]) +// CHECK-RV64-NEXT: ret [[TMP0]] +// +vbool64_t test_vmnot_m_b64 (vbool64_t op1, size_t vl) { + return vmnot_m_b64(op1, vl); +} +