[GlobalISel] Add LLT::operator!=().

llvm-svn: 277162
This commit is contained in:
Ahmed Bougacha 2016-07-29 16:11:04 +00:00
parent 8292bdf735
commit 9d95557128
2 changed files with 16 additions and 1 deletions

View File

@ -169,11 +169,13 @@ public:
void print(raw_ostream &OS) const;
bool operator ==(const LLT &RHS) const {
bool operator==(const LLT &RHS) const {
return Kind == RHS.Kind && SizeOrAddrSpace == RHS.SizeOrAddrSpace &&
NumElements == RHS.NumElements;
}
bool operator!=(const LLT &RHS) const { return !(*this == RHS); }
friend struct DenseMapInfo<LLT>;
private:
unsigned SizeOrAddrSpace;

View File

@ -60,6 +60,9 @@ TEST(LowLevelTypeTest, Scalar) {
// Test equality operators.
EXPECT_TRUE(Ty == Ty);
EXPECT_FALSE(Ty != Ty);
EXPECT_NE(Ty, DoubleTy);
// Test Type->LLT conversion.
const Type *IRTy = IntegerType::get(C, S);
@ -141,6 +144,15 @@ TEST(LowLevelTypeTest, Vector) {
// Test equality operators.
EXPECT_TRUE(VTy == VTy);
EXPECT_FALSE(VTy != VTy);
// Test inequality operators on..
// ..different kind.
EXPECT_NE(VTy, STy);
// ..different #elts.
EXPECT_NE(VTy, DoubleEltTy);
// ..different scalar size.
EXPECT_NE(VTy, DoubleSzTy);
// Test Type->LLT conversion.
Type *IRSTy = IntegerType::get(C, S);
@ -169,6 +181,7 @@ TEST(LowLevelTypeTest, Pointer) {
// Test equality operators.
EXPECT_TRUE(Ty == Ty);
EXPECT_FALSE(Ty != Ty);
// Test Type->LLT conversion.
const Type *IRTy = PointerType::get(IntegerType::get(C, 8), AS);