GlobalISel: Prepare to allow other target unit tests

Currently all GlobalISel unittests use a hardcoded AArch64 target
machine. Factor this so I can write some for AMDGPU specific known
bits unittests.
This commit is contained in:
Matt Arsenault 2020-03-22 18:12:25 -04:00 committed by Matt Arsenault
parent 6131ef5241
commit 1c52107130
9 changed files with 160 additions and 140 deletions

View File

@ -11,7 +11,7 @@
namespace {
TEST_F(GISelMITest, TestCSE) {
TEST_F(AArch64GISelMITest, TestCSE) {
setUp();
if (!TM)
return;
@ -79,7 +79,7 @@ TEST_F(GISelMITest, TestCSE) {
EXPECT_EQ(&*Undef0, &*Undef1);
}
TEST_F(GISelMITest, TestCSEConstantConfig) {
TEST_F(AArch64GISelMITest, TestCSEConstantConfig) {
setUp();
if (!TM)
return;

View File

@ -17,7 +17,7 @@ using namespace llvm;
namespace {
TEST_F(GISelMITest, FoldWithBuilder) {
TEST_F(AArch64GISelMITest, FoldWithBuilder) {
setUp();
if (!TM)
return;
@ -68,7 +68,7 @@ TEST_F(GISelMITest, FoldWithBuilder) {
EXPECT_EQ(-0x80, Cst);
}
TEST_F(GISelMITest, FoldBinOp) {
TEST_F(AArch64GISelMITest, FoldBinOp) {
setUp();
if (!TM)
return;

View File

@ -28,3 +28,41 @@ operator<<(std::ostream &OS, const MachineFunction &MF) {
}
}
std::unique_ptr<LLVMTargetMachine>
AArch64GISelMITest::createTargetMachine() const {
Triple TargetTriple("aarch64--");
std::string Error;
const Target *T = TargetRegistry::lookupTarget("", TargetTriple, Error);
if (!T)
return nullptr;
TargetOptions Options;
return std::unique_ptr<LLVMTargetMachine>(
static_cast<LLVMTargetMachine *>(T->createTargetMachine(
"AArch64", "", "", Options, None, None, CodeGenOpt::Aggressive)));
}
void AArch64GISelMITest::getTargetTestModuleString(SmallString<512> &S,
StringRef MIRFunc) const {
(Twine(R"MIR(
---
...
name: func
tracksRegLiveness: true
registers:
- { id: 0, class: _ }
- { id: 1, class: _ }
- { id: 2, class: _ }
- { id: 3, class: _ }
body: |
bb.1:
liveins: $x0, $x1, $x2, $x4
%0(s64) = COPY $x0
%1(s64) = COPY $x1
%2(s64) = COPY $x2
)MIR") +
Twine(MIRFunc) + Twine("...\n"))
.toNullTerminatedStringRef(S);
}

View File

@ -53,21 +53,6 @@ std::ostream &
operator<<(std::ostream &OS, const MachineFunction &MF);
}
/// Create a TargetMachine. As we lack a dedicated always available target for
/// unittests, we go for "AArch64".
static std::unique_ptr<LLVMTargetMachine> createTargetMachine() {
Triple TargetTriple("aarch64--");
std::string Error;
const Target *T = TargetRegistry::lookupTarget("", TargetTriple, Error);
if (!T)
return nullptr;
TargetOptions Options;
return std::unique_ptr<LLVMTargetMachine>(
static_cast<LLVMTargetMachine *>(T->createTargetMachine(
"AArch64", "", "", Options, None, None, CodeGenOpt::Aggressive)));
}
static std::unique_ptr<Module> parseMIR(LLVMContext &Context,
std::unique_ptr<MIRParser> &MIR,
const TargetMachine &TM,
@ -90,34 +75,13 @@ static std::unique_ptr<Module> parseMIR(LLVMContext &Context,
return M;
}
static std::pair<std::unique_ptr<Module>, std::unique_ptr<MachineModuleInfo>>
createDummyModule(LLVMContext &Context, const LLVMTargetMachine &TM,
StringRef MIRFunc) {
SmallString<512> S;
StringRef MIRString = (Twine(R"MIR(
---
...
name: func
tracksRegLiveness: true
registers:
- { id: 0, class: _ }
- { id: 1, class: _ }
- { id: 2, class: _ }
- { id: 3, class: _ }
body: |
bb.1:
liveins: $x0, $x1, $x2, $x4
%0(s64) = COPY $x0
%1(s64) = COPY $x1
%2(s64) = COPY $x2
)MIR") + Twine(MIRFunc) + Twine("...\n"))
.toNullTerminatedStringRef(S);
StringRef MIRString, const char *FuncName) {
std::unique_ptr<MIRParser> MIR;
auto MMI = std::make_unique<MachineModuleInfo>(&TM);
std::unique_ptr<Module> M =
parseMIR(Context, MIR, TM, MIRString, "func", *MMI);
parseMIR(Context, MIR, TM, MIRString, FuncName, *MMI);
return make_pair(std::move(M), std::move(MMI));
}
@ -140,11 +104,23 @@ static void collectCopies(SmallVectorImpl<Register> &Copies,
class GISelMITest : public ::testing::Test {
protected:
GISelMITest() : ::testing::Test() {}
/// Prepare a target specific LLVMTargetMachine.
virtual std::unique_ptr<LLVMTargetMachine> createTargetMachine() const = 0;
/// Get the stub sample MIR test function.
virtual void getTargetTestModuleString(SmallString<512> &S,
StringRef MIRFunc) const = 0;
void setUp(StringRef ExtraAssembly = "") {
TM = createTargetMachine();
if (!TM)
return;
ModuleMMIPair = createDummyModule(Context, *TM, ExtraAssembly);
SmallString<512> MIRString;
getTargetTestModuleString(MIRString, ExtraAssembly);
ModuleMMIPair = createDummyModule(Context, *TM, MIRString, "func");
MF = getMFFromMMI(ModuleMMIPair.first.get(), ModuleMMIPair.second.get());
collectCopies(Copies, MF);
EntryMBB = &*MF->begin();
@ -152,6 +128,7 @@ protected:
MRI = &MF->getRegInfo();
B.setInsertPt(*EntryMBB, EntryMBB->end());
}
LLVMContext Context;
std::unique_ptr<LLVMTargetMachine> TM;
MachineFunction *MF;
@ -163,6 +140,12 @@ protected:
MachineRegisterInfo *MRI;
};
class AArch64GISelMITest : public GISelMITest {
std::unique_ptr<LLVMTargetMachine> createTargetMachine() const override;
void getTargetTestModuleString(SmallString<512> &S,
StringRef MIRFunc) const override;
};
#define DefineLegalizerInfo(Name, SettingUpActionsBlock) \
class Name##Info : public LegalizerInfo { \
public: \

View File

@ -10,7 +10,7 @@
#include "llvm/CodeGen/GlobalISel/GISelKnownBits.h"
#include "llvm/CodeGen/GlobalISel/MachineIRBuilder.h"
TEST_F(GISelMITest, TestKnownBitsCst) {
TEST_F(AArch64GISelMITest, TestKnownBitsCst) {
StringRef MIRString = " %3:_(s8) = G_CONSTANT i8 1\n"
" %4:_(s8) = COPY %3\n";
setUp(MIRString);
@ -30,7 +30,7 @@ TEST_F(GISelMITest, TestKnownBitsCst) {
EXPECT_EQ(Res.Zero.getZExtValue(), Res2.Zero.getZExtValue());
}
TEST_F(GISelMITest, TestKnownBitsCstWithClass) {
TEST_F(AArch64GISelMITest, TestKnownBitsCstWithClass) {
StringRef MIRString = " %10:gpr32 = MOVi32imm 1\n"
" %4:_(s32) = COPY %10\n";
setUp(MIRString);
@ -58,7 +58,7 @@ TEST_F(GISelMITest, TestKnownBitsCstWithClass) {
// Check that we are able to track bits through PHIs
// and get the intersections of everything we know on each operand.
TEST_F(GISelMITest, TestKnownBitsCstPHI) {
TEST_F(AArch64GISelMITest, TestKnownBitsCstPHI) {
StringRef MIRString = " bb.10:\n"
" %10:_(s8) = G_CONSTANT i8 3\n"
" %11:_(s1) = G_IMPLICIT_DEF\n"
@ -92,7 +92,7 @@ TEST_F(GISelMITest, TestKnownBitsCstPHI) {
// Check that we report we know nothing when we hit a
// non-generic register.
// Note: this could be improved though!
TEST_F(GISelMITest, TestKnownBitsCstPHIToNonGenericReg) {
TEST_F(AArch64GISelMITest, TestKnownBitsCstPHIToNonGenericReg) {
StringRef MIRString = " bb.10:\n"
" %10:gpr32 = MOVi32imm 3\n"
" %11:_(s1) = G_IMPLICIT_DEF\n"
@ -129,7 +129,7 @@ TEST_F(GISelMITest, TestKnownBitsCstPHIToNonGenericReg) {
// here to cover the code that stops the analysis of PHIs
// earlier. In that case, we would not even look at the
// second incoming value.
TEST_F(GISelMITest, TestKnownBitsUnknownPHI) {
TEST_F(AArch64GISelMITest, TestKnownBitsUnknownPHI) {
StringRef MIRString =
" bb.10:\n"
" %10:_(s64) = COPY %0\n"
@ -165,7 +165,7 @@ TEST_F(GISelMITest, TestKnownBitsUnknownPHI) {
// For now, the analysis just stops and assumes it knows nothing,
// eventually we could teach it how to properly track phis that
// loop back.
TEST_F(GISelMITest, TestKnownBitsCstPHIWithLoop) {
TEST_F(AArch64GISelMITest, TestKnownBitsCstPHIWithLoop) {
StringRef MIRString =
" bb.10:\n"
" %10:_(s8) = G_CONSTANT i8 3\n"
@ -210,7 +210,7 @@ TEST_F(GISelMITest, TestKnownBitsCstPHIWithLoop) {
// on PHIs, but eventually we could teach it how to properly track
// phis that loop back without relying on the luck effect of max
// depth.
TEST_F(GISelMITest, TestKnownBitsDecreasingCstPHIWithLoop) {
TEST_F(AArch64GISelMITest, TestKnownBitsDecreasingCstPHIWithLoop) {
StringRef MIRString = " bb.10:\n"
" %10:_(s8) = G_CONSTANT i8 5\n"
" %11:_(s8) = G_CONSTANT i8 1\n"
@ -243,7 +243,7 @@ TEST_F(GISelMITest, TestKnownBitsDecreasingCstPHIWithLoop) {
EXPECT_EQ(Res.Zero.getZExtValue(), Res2.Zero.getZExtValue());
}
TEST_F(GISelMITest, TestKnownBitsPtrToIntViceVersa) {
TEST_F(AArch64GISelMITest, TestKnownBitsPtrToIntViceVersa) {
StringRef MIRString = " %3:_(s16) = G_CONSTANT i16 256\n"
" %4:_(p0) = G_INTTOPTR %3\n"
" %5:_(s32) = G_PTRTOINT %4\n"
@ -259,7 +259,7 @@ TEST_F(GISelMITest, TestKnownBitsPtrToIntViceVersa) {
EXPECT_EQ(256u, Res.One.getZExtValue());
EXPECT_EQ(0xfffffeffu, Res.Zero.getZExtValue());
}
TEST_F(GISelMITest, TestKnownBitsXOR) {
TEST_F(AArch64GISelMITest, TestKnownBitsXOR) {
StringRef MIRString = " %3:_(s8) = G_CONSTANT i8 4\n"
" %4:_(s8) = G_CONSTANT i8 7\n"
" %5:_(s8) = G_XOR %3, %4\n"
@ -276,7 +276,7 @@ TEST_F(GISelMITest, TestKnownBitsXOR) {
EXPECT_EQ(252u, Res.Zero.getZExtValue());
}
TEST_F(GISelMITest, TestKnownBits) {
TEST_F(AArch64GISelMITest, TestKnownBits) {
StringRef MIR = " %3:_(s32) = G_TRUNC %0\n"
" %4:_(s32) = G_TRUNC %1\n"
@ -306,7 +306,7 @@ TEST_F(GISelMITest, TestKnownBits) {
EXPECT_EQ(Known.Zero, Zeroes);
}
TEST_F(GISelMITest, TestSignBitIsZero) {
TEST_F(AArch64GISelMITest, TestSignBitIsZero) {
setUp();
if (!TM)
return;
@ -321,7 +321,7 @@ TEST_F(GISelMITest, TestSignBitIsZero) {
EXPECT_FALSE(KnownBits.signBitIsZero(SignBit.getReg(0)));
}
TEST_F(GISelMITest, TestNumSignBitsConstant) {
TEST_F(AArch64GISelMITest, TestNumSignBitsConstant) {
StringRef MIRString = " %3:_(s8) = G_CONSTANT i8 1\n"
" %4:_(s8) = COPY %3\n"
@ -353,7 +353,7 @@ TEST_F(GISelMITest, TestNumSignBitsConstant) {
EXPECT_EQ(3u, Info.computeNumSignBits(CopyRegNeg32));
}
TEST_F(GISelMITest, TestNumSignBitsSext) {
TEST_F(AArch64GISelMITest, TestNumSignBitsSext) {
StringRef MIRString = " %3:_(p0) = G_IMPLICIT_DEF\n"
" %4:_(s8) = G_LOAD %3 :: (load 1)\n"
" %5:_(s32) = G_SEXT %4\n"
@ -373,7 +373,7 @@ TEST_F(GISelMITest, TestNumSignBitsSext) {
EXPECT_EQ(32u, Info.computeNumSignBits(CopySextNeg1));
}
TEST_F(GISelMITest, TestNumSignBitsTrunc) {
TEST_F(AArch64GISelMITest, TestNumSignBitsTrunc) {
StringRef MIRString = " %3:_(p0) = G_IMPLICIT_DEF\n"
" %4:_(s32) = G_LOAD %3 :: (load 4)\n"
" %5:_(s8) = G_TRUNC %4\n"

View File

@ -25,7 +25,7 @@ public:
// Test CTTZ expansion when CTTZ_ZERO_UNDEF is legal or custom,
// in which case it becomes CTTZ_ZERO_UNDEF with select.
TEST_F(GISelMITest, LowerBitCountingCTTZ0) {
TEST_F(AArch64GISelMITest, LowerBitCountingCTTZ0) {
setUp();
if (!TM)
return;
@ -57,7 +57,7 @@ TEST_F(GISelMITest, LowerBitCountingCTTZ0) {
}
// CTTZ expansion in terms of CTLZ
TEST_F(GISelMITest, LowerBitCountingCTTZ1) {
TEST_F(AArch64GISelMITest, LowerBitCountingCTTZ1) {
setUp();
if (!TM)
return;
@ -91,7 +91,7 @@ TEST_F(GISelMITest, LowerBitCountingCTTZ1) {
}
// CTLZ scalar narrowing
TEST_F(GISelMITest, NarrowScalarCTLZ) {
TEST_F(AArch64GISelMITest, NarrowScalarCTLZ) {
setUp();
if (!TM)
return;
@ -126,7 +126,7 @@ TEST_F(GISelMITest, NarrowScalarCTLZ) {
}
// CTTZ scalar narrowing
TEST_F(GISelMITest, NarrowScalarCTTZ) {
TEST_F(AArch64GISelMITest, NarrowScalarCTTZ) {
setUp();
if (!TM)
return;
@ -161,7 +161,7 @@ TEST_F(GISelMITest, NarrowScalarCTTZ) {
}
// CTTZ expansion in terms of CTPOP
TEST_F(GISelMITest, LowerBitCountingCTTZ2) {
TEST_F(AArch64GISelMITest, LowerBitCountingCTTZ2) {
setUp();
if (!TM)
return;
@ -192,7 +192,7 @@ TEST_F(GISelMITest, LowerBitCountingCTTZ2) {
}
// CTPOP widening.
TEST_F(GISelMITest, WidenBitCountingCTPOP1) {
TEST_F(AArch64GISelMITest, WidenBitCountingCTPOP1) {
if (!TM)
return;
@ -224,7 +224,7 @@ TEST_F(GISelMITest, WidenBitCountingCTPOP1) {
}
// Test a strange case where the result is wider than the source
TEST_F(GISelMITest, WidenBitCountingCTPOP2) {
TEST_F(AArch64GISelMITest, WidenBitCountingCTPOP2) {
if (!TM)
return;
@ -257,7 +257,7 @@ TEST_F(GISelMITest, WidenBitCountingCTPOP2) {
}
// CTTZ_ZERO_UNDEF expansion in terms of CTTZ
TEST_F(GISelMITest, LowerBitCountingCTTZ3) {
TEST_F(AArch64GISelMITest, LowerBitCountingCTTZ3) {
setUp();
if (!TM)
return;
@ -284,7 +284,7 @@ TEST_F(GISelMITest, LowerBitCountingCTTZ3) {
}
// CTLZ expansion in terms of CTLZ_ZERO_UNDEF
TEST_F(GISelMITest, LowerBitCountingCTLZ0) {
TEST_F(AArch64GISelMITest, LowerBitCountingCTLZ0) {
setUp();
if (!TM)
return;
@ -315,7 +315,7 @@ TEST_F(GISelMITest, LowerBitCountingCTLZ0) {
}
// CTLZ expansion in terms of CTLZ_ZERO_UNDEF if the latter is a libcall
TEST_F(GISelMITest, LowerBitCountingCTLZLibcall) {
TEST_F(AArch64GISelMITest, LowerBitCountingCTLZLibcall) {
setUp();
if (!TM)
return;
@ -346,7 +346,7 @@ TEST_F(GISelMITest, LowerBitCountingCTLZLibcall) {
}
// CTLZ expansion
TEST_F(GISelMITest, LowerBitCountingCTLZ1) {
TEST_F(AArch64GISelMITest, LowerBitCountingCTLZ1) {
setUp();
if (!TM)
return;
@ -387,7 +387,7 @@ TEST_F(GISelMITest, LowerBitCountingCTLZ1) {
}
// CTLZ widening.
TEST_F(GISelMITest, WidenBitCountingCTLZ) {
TEST_F(AArch64GISelMITest, WidenBitCountingCTLZ) {
setUp();
if (!TM)
return;
@ -422,7 +422,7 @@ TEST_F(GISelMITest, WidenBitCountingCTLZ) {
}
// CTLZ_ZERO_UNDEF widening.
TEST_F(GISelMITest, WidenBitCountingCTLZZeroUndef) {
TEST_F(AArch64GISelMITest, WidenBitCountingCTLZZeroUndef) {
setUp();
if (!TM)
return;
@ -458,7 +458,7 @@ TEST_F(GISelMITest, WidenBitCountingCTLZZeroUndef) {
}
// CTPOP widening.
TEST_F(GISelMITest, WidenBitCountingCTPOP) {
TEST_F(AArch64GISelMITest, WidenBitCountingCTPOP) {
setUp();
if (!TM)
return;
@ -491,7 +491,7 @@ TEST_F(GISelMITest, WidenBitCountingCTPOP) {
}
// CTTZ_ZERO_UNDEF widening.
TEST_F(GISelMITest, WidenBitCountingCTTZ_ZERO_UNDEF) {
TEST_F(AArch64GISelMITest, WidenBitCountingCTTZ_ZERO_UNDEF) {
setUp();
if (!TM)
return;
@ -525,7 +525,7 @@ TEST_F(GISelMITest, WidenBitCountingCTTZ_ZERO_UNDEF) {
}
// CTTZ widening.
TEST_F(GISelMITest, WidenBitCountingCTTZ) {
TEST_F(AArch64GISelMITest, WidenBitCountingCTTZ) {
setUp();
if (!TM)
return;
@ -559,7 +559,7 @@ TEST_F(GISelMITest, WidenBitCountingCTTZ) {
EXPECT_TRUE(CheckMachineFunction(*MF, CheckStr)) << *MF;
}
// UADDO widening.
TEST_F(GISelMITest, WidenUADDO) {
TEST_F(AArch64GISelMITest, WidenUADDO) {
setUp();
if (!TM)
return;
@ -598,7 +598,7 @@ TEST_F(GISelMITest, WidenUADDO) {
}
// USUBO widening.
TEST_F(GISelMITest, WidenUSUBO) {
TEST_F(AArch64GISelMITest, WidenUSUBO) {
setUp();
if (!TM)
return;
@ -636,7 +636,7 @@ TEST_F(GISelMITest, WidenUSUBO) {
EXPECT_TRUE(CheckMachineFunction(*MF, CheckStr)) << *MF;
}
TEST_F(GISelMITest, FewerElementsAnd) {
TEST_F(AArch64GISelMITest, FewerElementsAnd) {
if (!TM)
return;
@ -683,7 +683,7 @@ TEST_F(GISelMITest, FewerElementsAnd) {
EXPECT_TRUE(CheckMachineFunction(*MF, CheckStr)) << *MF;
}
TEST_F(GISelMITest, MoreElementsAnd) {
TEST_F(AArch64GISelMITest, MoreElementsAnd) {
if (!TM)
return;
@ -724,7 +724,7 @@ TEST_F(GISelMITest, MoreElementsAnd) {
EXPECT_TRUE(CheckMachineFunction(*MF, CheckStr)) << *MF;
}
TEST_F(GISelMITest, FewerElementsPhi) {
TEST_F(AArch64GISelMITest, FewerElementsPhi) {
if (!TM)
return;
@ -819,7 +819,7 @@ TEST_F(GISelMITest, FewerElementsPhi) {
}
// FNEG expansion in terms of FSUB
TEST_F(GISelMITest, LowerFNEG) {
TEST_F(AArch64GISelMITest, LowerFNEG) {
if (!TM)
return;
@ -864,7 +864,7 @@ TEST_F(GISelMITest, LowerFNEG) {
EXPECT_TRUE(CheckMachineFunction(*MF, CheckStr)) << *MF;
}
TEST_F(GISelMITest, LowerMinMax) {
TEST_F(AArch64GISelMITest, LowerMinMax) {
if (!TM)
return;
@ -942,7 +942,7 @@ TEST_F(GISelMITest, LowerMinMax) {
EXPECT_TRUE(CheckMachineFunction(*MF, CheckStr)) << *MF;
}
TEST_F(GISelMITest, WidenScalarBuildVector) {
TEST_F(AArch64GISelMITest, WidenScalarBuildVector) {
if (!TM)
return;
@ -988,7 +988,7 @@ TEST_F(GISelMITest, WidenScalarBuildVector) {
EXPECT_TRUE(CheckMachineFunction(*MF, CheckStr)) << *MF;
}
TEST_F(GISelMITest, LowerMergeValues) {
TEST_F(AArch64GISelMITest, LowerMergeValues) {
if (!TM)
return;
@ -1089,7 +1089,7 @@ TEST_F(GISelMITest, LowerMergeValues) {
EXPECT_TRUE(CheckMachineFunction(*MF, CheckStr)) << *MF;
}
TEST_F(GISelMITest, WidenScalarMergeValuesPointer) {
TEST_F(AArch64GISelMITest, WidenScalarMergeValuesPointer) {
if (!TM)
return;
@ -1126,7 +1126,7 @@ TEST_F(GISelMITest, WidenScalarMergeValuesPointer) {
EXPECT_TRUE(CheckMachineFunction(*MF, CheckStr)) << *MF;
}
TEST_F(GISelMITest, WidenSEXTINREG) {
TEST_F(AArch64GISelMITest, WidenSEXTINREG) {
if (!TM)
return;
@ -1157,7 +1157,7 @@ TEST_F(GISelMITest, WidenSEXTINREG) {
ASSERT_TRUE(CheckMachineFunction(*MF, CheckStr));
}
TEST_F(GISelMITest, NarrowSEXTINREG) {
TEST_F(AArch64GISelMITest, NarrowSEXTINREG) {
if (!TM)
return;
@ -1188,7 +1188,7 @@ TEST_F(GISelMITest, NarrowSEXTINREG) {
ASSERT_TRUE(CheckMachineFunction(*MF, CheckStr));
}
TEST_F(GISelMITest, NarrowSEXTINREG2) {
TEST_F(AArch64GISelMITest, NarrowSEXTINREG2) {
if (!TM)
return;
@ -1220,7 +1220,7 @@ TEST_F(GISelMITest, NarrowSEXTINREG2) {
ASSERT_TRUE(CheckMachineFunction(*MF, CheckStr));
}
TEST_F(GISelMITest, LowerSEXTINREG) {
TEST_F(AArch64GISelMITest, LowerSEXTINREG) {
if (!TM)
return;
@ -1250,7 +1250,7 @@ TEST_F(GISelMITest, LowerSEXTINREG) {
ASSERT_TRUE(CheckMachineFunction(*MF, CheckStr));
}
TEST_F(GISelMITest, LibcallFPExt) {
TEST_F(AArch64GISelMITest, LibcallFPExt) {
setUp();
if (!TM)
return;
@ -1289,7 +1289,7 @@ TEST_F(GISelMITest, LibcallFPExt) {
EXPECT_TRUE(CheckMachineFunction(*MF, CheckStr)) << *MF;
}
TEST_F(GISelMITest, LibcallFPTrunc) {
TEST_F(AArch64GISelMITest, LibcallFPTrunc) {
setUp();
if (!TM)
return;
@ -1331,7 +1331,7 @@ TEST_F(GISelMITest, LibcallFPTrunc) {
EXPECT_TRUE(CheckMachineFunction(*MF, CheckStr)) << *MF;
}
TEST_F(GISelMITest, LibcallSimple) {
TEST_F(AArch64GISelMITest, LibcallSimple) {
setUp();
if (!TM)
return;
@ -1354,7 +1354,7 @@ TEST_F(GISelMITest, LibcallSimple) {
Helper.libcall(*MIBFADD));
}
TEST_F(GISelMITest, LibcallSRem) {
TEST_F(AArch64GISelMITest, LibcallSRem) {
setUp();
if (!TM)
return;
@ -1411,7 +1411,7 @@ TEST_F(GISelMITest, LibcallSRem) {
EXPECT_TRUE(CheckMachineFunction(*MF, CheckStr)) << *MF;
}
TEST_F(GISelMITest, LibcallURem) {
TEST_F(AArch64GISelMITest, LibcallURem) {
setUp();
if (!TM)
return;
@ -1468,7 +1468,7 @@ TEST_F(GISelMITest, LibcallURem) {
EXPECT_TRUE(CheckMachineFunction(*MF, CheckStr)) << *MF;
}
TEST_F(GISelMITest, LibcallCtlzZeroUndef) {
TEST_F(AArch64GISelMITest, LibcallCtlzZeroUndef) {
setUp();
if (!TM)
return;
@ -1521,7 +1521,7 @@ TEST_F(GISelMITest, LibcallCtlzZeroUndef) {
EXPECT_TRUE(CheckMachineFunction(*MF, CheckStr)) << *MF;
}
TEST_F(GISelMITest, LibcallFAdd) {
TEST_F(AArch64GISelMITest, LibcallFAdd) {
setUp();
if (!TM)
return;
@ -1573,7 +1573,7 @@ TEST_F(GISelMITest, LibcallFAdd) {
EXPECT_TRUE(CheckMachineFunction(*MF, CheckStr)) << *MF;
}
TEST_F(GISelMITest, LibcallFSub) {
TEST_F(AArch64GISelMITest, LibcallFSub) {
setUp();
if (!TM)
return;
@ -1625,7 +1625,7 @@ TEST_F(GISelMITest, LibcallFSub) {
EXPECT_TRUE(CheckMachineFunction(*MF, CheckStr)) << *MF;
}
TEST_F(GISelMITest, LibcallFMul) {
TEST_F(AArch64GISelMITest, LibcallFMul) {
setUp();
if (!TM)
return;
@ -1677,7 +1677,7 @@ TEST_F(GISelMITest, LibcallFMul) {
EXPECT_TRUE(CheckMachineFunction(*MF, CheckStr)) << *MF;
}
TEST_F(GISelMITest, LibcallFDiv) {
TEST_F(AArch64GISelMITest, LibcallFDiv) {
setUp();
if (!TM)
return;
@ -1729,7 +1729,7 @@ TEST_F(GISelMITest, LibcallFDiv) {
EXPECT_TRUE(CheckMachineFunction(*MF, CheckStr)) << *MF;
}
TEST_F(GISelMITest, LibcallFExp) {
TEST_F(AArch64GISelMITest, LibcallFExp) {
setUp();
if (!TM)
return;
@ -1776,7 +1776,7 @@ TEST_F(GISelMITest, LibcallFExp) {
EXPECT_TRUE(CheckMachineFunction(*MF, CheckStr)) << *MF;
}
TEST_F(GISelMITest, LibcallFExp2) {
TEST_F(AArch64GISelMITest, LibcallFExp2) {
setUp();
if (!TM)
return;
@ -1823,7 +1823,7 @@ TEST_F(GISelMITest, LibcallFExp2) {
EXPECT_TRUE(CheckMachineFunction(*MF, CheckStr)) << *MF;
}
TEST_F(GISelMITest, LibcallFRem) {
TEST_F(AArch64GISelMITest, LibcallFRem) {
setUp();
if (!TM)
return;
@ -1870,7 +1870,7 @@ TEST_F(GISelMITest, LibcallFRem) {
EXPECT_TRUE(CheckMachineFunction(*MF, CheckStr)) << *MF;
}
TEST_F(GISelMITest, LibcallFPow) {
TEST_F(AArch64GISelMITest, LibcallFPow) {
setUp();
if (!TM)
return;
@ -1917,7 +1917,7 @@ TEST_F(GISelMITest, LibcallFPow) {
EXPECT_TRUE(CheckMachineFunction(*MF, CheckStr)) << *MF;
}
TEST_F(GISelMITest, LibcallFMa) {
TEST_F(AArch64GISelMITest, LibcallFMa) {
setUp();
if (!TM)
return;
@ -1965,7 +1965,7 @@ TEST_F(GISelMITest, LibcallFMa) {
EXPECT_TRUE(CheckMachineFunction(*MF, CheckStr)) << *MF;
}
TEST_F(GISelMITest, LibcallFCeil) {
TEST_F(AArch64GISelMITest, LibcallFCeil) {
setUp();
if (!TM)
return;
@ -2012,7 +2012,7 @@ TEST_F(GISelMITest, LibcallFCeil) {
EXPECT_TRUE(CheckMachineFunction(*MF, CheckStr)) << *MF;
}
TEST_F(GISelMITest, LibcallFFloor) {
TEST_F(AArch64GISelMITest, LibcallFFloor) {
setUp();
if (!TM)
return;
@ -2059,7 +2059,7 @@ TEST_F(GISelMITest, LibcallFFloor) {
EXPECT_TRUE(CheckMachineFunction(*MF, CheckStr)) << *MF;
}
TEST_F(GISelMITest, LibcallFMinNum) {
TEST_F(AArch64GISelMITest, LibcallFMinNum) {
setUp();
if (!TM)
return;
@ -2109,7 +2109,7 @@ TEST_F(GISelMITest, LibcallFMinNum) {
EXPECT_TRUE(CheckMachineFunction(*MF, CheckStr)) << *MF;
}
TEST_F(GISelMITest, LibcallFMaxNum) {
TEST_F(AArch64GISelMITest, LibcallFMaxNum) {
setUp();
if (!TM)
return;
@ -2159,7 +2159,7 @@ TEST_F(GISelMITest, LibcallFMaxNum) {
EXPECT_TRUE(CheckMachineFunction(*MF, CheckStr)) << *MF;
}
TEST_F(GISelMITest, LibcallFSqrt) {
TEST_F(AArch64GISelMITest, LibcallFSqrt) {
setUp();
if (!TM)
return;
@ -2206,7 +2206,7 @@ TEST_F(GISelMITest, LibcallFSqrt) {
EXPECT_TRUE(CheckMachineFunction(*MF, CheckStr)) << *MF;
}
TEST_F(GISelMITest, LibcallFRint) {
TEST_F(AArch64GISelMITest, LibcallFRint) {
setUp();
if (!TM)
return;
@ -2253,7 +2253,7 @@ TEST_F(GISelMITest, LibcallFRint) {
EXPECT_TRUE(CheckMachineFunction(*MF, CheckStr)) << *MF;
}
TEST_F(GISelMITest, LibcallFNearbyInt) {
TEST_F(AArch64GISelMITest, LibcallFNearbyInt) {
setUp();
if (!TM)
return;
@ -2303,7 +2303,7 @@ TEST_F(GISelMITest, LibcallFNearbyInt) {
EXPECT_TRUE(CheckMachineFunction(*MF, CheckStr)) << *MF;
}
TEST_F(GISelMITest, NarrowScalarExtract) {
TEST_F(AArch64GISelMITest, NarrowScalarExtract) {
setUp();
if (!TM)
return;
@ -2342,7 +2342,7 @@ TEST_F(GISelMITest, NarrowScalarExtract) {
EXPECT_TRUE(CheckMachineFunction(*MF, CheckStr)) << *MF;
}
TEST_F(GISelMITest, LowerInsert) {
TEST_F(AArch64GISelMITest, LowerInsert) {
setUp();
if (!TM)
return;
@ -2443,7 +2443,7 @@ TEST_F(GISelMITest, LowerInsert) {
}
// Test lowering of G_FFLOOR
TEST_F(GISelMITest, LowerFFloor) {
TEST_F(AArch64GISelMITest, LowerFFloor) {
setUp();
if (!TM)
return;
@ -2475,7 +2475,7 @@ TEST_F(GISelMITest, LowerFFloor) {
}
// Test lowering of G_BSWAP
TEST_F(GISelMITest, LowerBSWAP) {
TEST_F(AArch64GISelMITest, LowerBSWAP) {
setUp();
if (!TM)
return;
@ -2517,7 +2517,7 @@ TEST_F(GISelMITest, LowerBSWAP) {
}
// Test widening of G_UNMERGE_VALUES
TEST_F(GISelMITest, WidenUnmerge) {
TEST_F(AArch64GISelMITest, WidenUnmerge) {
setUp();
if (!TM)
return;

View File

@ -49,7 +49,7 @@ DefineLegalizerInfo(ALegalizer, {
getActionDefinitionsBuilder(G_SHL).legalFor({{s32, s32}});
})
TEST_F(GISelMITest, BasicLegalizerTest) {
TEST_F(AArch64GISelMITest, BasicLegalizerTest) {
StringRef MIRString = R"(
%vptr:_(p0) = COPY $x4
%v:_(<2 x s8>) = G_LOAD %vptr:_(p0) :: (load 2, align 1)
@ -85,7 +85,7 @@ TEST_F(GISelMITest, BasicLegalizerTest) {
// Making sure the legalization finishes successfully w/o failure to combine
// away all the legalization artifacts regardless of the order of their
// creation.
TEST_F(GISelMITest, UnorderedArtifactCombiningTest) {
TEST_F(AArch64GISelMITest, UnorderedArtifactCombiningTest) {
StringRef MIRString = R"(
%vptr:_(p0) = COPY $x4
%v:_(<2 x s8>) = G_LOAD %vptr:_(p0) :: (load 2, align 1)
@ -169,7 +169,7 @@ TEST_F(GISelMITest, UnorderedArtifactCombiningTest) {
EXPECT_TRUE(CheckMachineFunction(*MF, CheckString)) << *MF;
}
TEST_F(GISelMITest, UnorderedArtifactCombiningManyCopiesTest) {
TEST_F(AArch64GISelMITest, UnorderedArtifactCombiningManyCopiesTest) {
StringRef MIRString = R"(
%vptr:_(p0) = COPY $x4
%v:_(<2 x s8>) = G_LOAD %vptr:_(p0) :: (load 2, align 1)

View File

@ -9,7 +9,7 @@
#include "GISelMITest.h"
#include "llvm/CodeGen/GlobalISel/MachineIRBuilder.h"
TEST_F(GISelMITest, TestBuildConstantFConstant) {
TEST_F(AArch64GISelMITest, TestBuildConstantFConstant) {
setUp();
if (!TM)
return;
@ -37,11 +37,10 @@ TEST_F(GISelMITest, TestBuildConstantFConstant) {
EXPECT_TRUE(CheckMachineFunction(*MF, CheckStr)) << *MF;
}
#ifdef GTEST_HAS_DEATH_TEST
#ifndef NDEBUG
TEST_F(GISelMITest, TestBuildConstantFConstantDeath) {
TEST_F(AArch64GISelMITest, TestBuildConstantFConstantDeath) {
setUp();
if (!TM)
return;
@ -73,7 +72,7 @@ TEST_F(GISelMITest, TestBuildConstantFConstantDeath) {
#endif
#endif
TEST_F(GISelMITest, DstOpSrcOp) {
TEST_F(AArch64GISelMITest, DstOpSrcOp) {
setUp();
if (!TM)
return;
@ -99,7 +98,7 @@ TEST_F(GISelMITest, DstOpSrcOp) {
EXPECT_TRUE(CheckMachineFunction(*MF, CheckStr)) << *MF;
}
TEST_F(GISelMITest, BuildUnmerge) {
TEST_F(AArch64GISelMITest, BuildUnmerge) {
setUp();
if (!TM)
return;
@ -120,7 +119,7 @@ TEST_F(GISelMITest, BuildUnmerge) {
EXPECT_TRUE(CheckMachineFunction(*MF, CheckStr)) << *MF;
}
TEST_F(GISelMITest, TestBuildFPInsts) {
TEST_F(AArch64GISelMITest, TestBuildFPInsts) {
setUp();
if (!TM)
return;
@ -156,7 +155,7 @@ TEST_F(GISelMITest, TestBuildFPInsts) {
EXPECT_TRUE(CheckMachineFunction(*MF, CheckStr)) << *MF;
}
TEST_F(GISelMITest, BuildIntrinsic) {
TEST_F(AArch64GISelMITest, BuildIntrinsic) {
setUp();
if (!TM)
return;
@ -185,7 +184,7 @@ TEST_F(GISelMITest, BuildIntrinsic) {
EXPECT_TRUE(CheckMachineFunction(*MF, CheckStr)) << *MF;
}
TEST_F(GISelMITest, BuildXor) {
TEST_F(AArch64GISelMITest, BuildXor) {
setUp();
if (!TM)
return;
@ -214,7 +213,7 @@ TEST_F(GISelMITest, BuildXor) {
EXPECT_TRUE(CheckMachineFunction(*MF, CheckStr)) << *MF;
}
TEST_F(GISelMITest, BuildBitCounts) {
TEST_F(AArch64GISelMITest, BuildBitCounts) {
setUp();
if (!TM)
return;
@ -242,7 +241,7 @@ TEST_F(GISelMITest, BuildBitCounts) {
EXPECT_TRUE(CheckMachineFunction(*MF, CheckStr)) << *MF;
}
TEST_F(GISelMITest, BuildCasts) {
TEST_F(AArch64GISelMITest, BuildCasts) {
setUp();
if (!TM)
return;
@ -267,7 +266,7 @@ TEST_F(GISelMITest, BuildCasts) {
EXPECT_TRUE(CheckMachineFunction(*MF, CheckStr)) << *MF;
}
TEST_F(GISelMITest, BuildMinMax) {
TEST_F(AArch64GISelMITest, BuildMinMax) {
setUp();
if (!TM)
return;
@ -293,7 +292,7 @@ TEST_F(GISelMITest, BuildMinMax) {
EXPECT_TRUE(CheckMachineFunction(*MF, CheckStr)) << *MF;
}
TEST_F(GISelMITest, BuildAtomicRMW) {
TEST_F(AArch64GISelMITest, BuildAtomicRMW) {
setUp();
if (!TM)
return;
@ -324,7 +323,7 @@ TEST_F(GISelMITest, BuildAtomicRMW) {
EXPECT_TRUE(CheckMachineFunction(*MF, CheckStr)) << *MF;
}
TEST_F(GISelMITest, BuildMerge) {
TEST_F(AArch64GISelMITest, BuildMerge) {
setUp();
if (!TM)
return;
@ -363,7 +362,7 @@ TEST_F(GISelMITest, BuildMerge) {
EXPECT_TRUE(CheckMachineFunction(*MF, CheckStr)) << *MF;
}
TEST_F(GISelMITest, BuildAddoSubo) {
TEST_F(AArch64GISelMITest, BuildAddoSubo) {
setUp();
if (!TM)
return;

View File

@ -30,7 +30,7 @@ using namespace MIPatternMatch;
namespace {
TEST_F(GISelMITest, MatchIntConstant) {
TEST_F(AArch64GISelMITest, MatchIntConstant) {
setUp();
if (!TM)
return;
@ -41,7 +41,7 @@ TEST_F(GISelMITest, MatchIntConstant) {
EXPECT_EQ(Cst, 42);
}
TEST_F(GISelMITest, MatchBinaryOp) {
TEST_F(AArch64GISelMITest, MatchBinaryOp) {
setUp();
if (!TM)
return;
@ -139,7 +139,7 @@ TEST_F(GISelMITest, MatchBinaryOp) {
EXPECT_EQ(Src1, TruncCopy1.getReg(0));
}
TEST_F(GISelMITest, MatchICmp) {
TEST_F(AArch64GISelMITest, MatchICmp) {
setUp();
if (!TM)
return;
@ -164,7 +164,7 @@ TEST_F(GISelMITest, MatchICmp) {
EXPECT_EQ(Copies[1], Reg1);
}
TEST_F(GISelMITest, MatchFCmp) {
TEST_F(AArch64GISelMITest, MatchFCmp) {
setUp();
if (!TM)
return;
@ -189,7 +189,7 @@ TEST_F(GISelMITest, MatchFCmp) {
EXPECT_EQ(Copies[1], Reg1);
}
TEST_F(GISelMITest, MatchFPUnaryOp) {
TEST_F(AArch64GISelMITest, MatchFPUnaryOp) {
setUp();
if (!TM)
return;
@ -251,7 +251,7 @@ TEST_F(GISelMITest, MatchFPUnaryOp) {
EXPECT_NE(TmpFP16, TmpFP);
}
TEST_F(GISelMITest, MatchExtendsTrunc) {
TEST_F(AArch64GISelMITest, MatchExtendsTrunc) {
setUp();
if (!TM)
return;
@ -298,7 +298,7 @@ TEST_F(GISelMITest, MatchExtendsTrunc) {
EXPECT_EQ(Src0, Copies[0]);
}
TEST_F(GISelMITest, MatchSpecificType) {
TEST_F(AArch64GISelMITest, MatchSpecificType) {
setUp();
if (!TM)
return;
@ -335,7 +335,7 @@ TEST_F(GISelMITest, MatchSpecificType) {
EXPECT_EQ(Src0, Copies[0]);
}
TEST_F(GISelMITest, MatchCombinators) {
TEST_F(AArch64GISelMITest, MatchCombinators) {
setUp();
if (!TM)
return;
@ -369,7 +369,7 @@ TEST_F(GISelMITest, MatchCombinators) {
EXPECT_FALSE(match);
}
TEST_F(GISelMITest, MatchMiscellaneous) {
TEST_F(AArch64GISelMITest, MatchMiscellaneous) {
setUp();
if (!TM)
return;