//===- VPIntrinsicTest.cpp - VPIntrinsic unit tests ---------===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// #include "llvm/ADT/SmallVector.h" #include "llvm/AsmParser/Parser.h" #include "llvm/CodeGen/ISDOpcodes.h" #include "llvm/IR/Constants.h" #include "llvm/IR/IRBuilder.h" #include "llvm/IR/IntrinsicInst.h" #include "llvm/IR/LLVMContext.h" #include "llvm/IR/Module.h" #include "llvm/IR/Verifier.h" #include "llvm/Support/SourceMgr.h" #include "gtest/gtest.h" #include <optional> #include <sstream> usingnamespacellvm; namespace { static const char *ReductionIntOpcodes[] = …; static const char *ReductionFPOpcodes[] = …; class VPIntrinsicTest : public testing::Test { … }; /// Check that the property scopes include/llvm/IR/VPIntrinsics.def are closed. TEST_F(VPIntrinsicTest, VPIntrinsicsDefScopes) { … } /// Check that every VP intrinsic in the test module is recognized as a VP /// intrinsic. TEST_F(VPIntrinsicTest, VPModuleComplete) { … } /// Check that VPIntrinsic:canIgnoreVectorLengthParam() returns true /// if the vector length parameter does not mask off any lanes. TEST_F(VPIntrinsicTest, CanIgnoreVectorLength) { … } /// Check that the argument returned by /// VPIntrinsic::get<X>ParamPos(Intrinsic::ID) has the expected type. TEST_F(VPIntrinsicTest, GetParamPos) { … } /// Check that going from Opcode to VP intrinsic and back results in the same /// Opcode. TEST_F(VPIntrinsicTest, OpcodeRoundTrip) { … } /// Check that going from VP intrinsic to Opcode and back results in the same /// intrinsic id. TEST_F(VPIntrinsicTest, IntrinsicIDRoundTrip) { … } /// Check that going from intrinsic to VP intrinsic and back results in the same /// intrinsic. TEST_F(VPIntrinsicTest, IntrinsicToVPRoundTrip) { … } /// Check that going from VP intrinsic to equivalent non-predicated intrinsic /// and back results in the same intrinsic. TEST_F(VPIntrinsicTest, VPToNonPredIntrinsicRoundTrip) { … } /// Check that VPIntrinsic::getDeclarationForParams works. TEST_F(VPIntrinsicTest, VPIntrinsicDeclarationForParams) { … } } // end anonymous namespace /// Check various properties of VPReductionIntrinsics TEST_F(VPIntrinsicTest, VPReductions) { … }