[ARM] MVE big endian bitcasts
[llvm-complete.git] / unittests / IR / DataLayoutTest.cpp
blobe7ed70b7de5d54acc03057383f66e0082758db24
1 //===- ConstantRangeTest.cpp - ConstantRange tests ------------------------===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
9 #include "llvm/IR/DataLayout.h"
10 #include "gtest/gtest.h"
12 using namespace llvm;
14 namespace {
16 TEST(DataLayoutTest, FunctionPtrAlign) {
17 EXPECT_EQ(0U, DataLayout("").getFunctionPtrAlign());
18 EXPECT_EQ(1U, DataLayout("Fi8").getFunctionPtrAlign());
19 EXPECT_EQ(2U, DataLayout("Fi16").getFunctionPtrAlign());
20 EXPECT_EQ(4U, DataLayout("Fi32").getFunctionPtrAlign());
21 EXPECT_EQ(8U, DataLayout("Fi64").getFunctionPtrAlign());
22 EXPECT_EQ(1U, DataLayout("Fn8").getFunctionPtrAlign());
23 EXPECT_EQ(2U, DataLayout("Fn16").getFunctionPtrAlign());
24 EXPECT_EQ(4U, DataLayout("Fn32").getFunctionPtrAlign());
25 EXPECT_EQ(8U, DataLayout("Fn64").getFunctionPtrAlign());
26 EXPECT_EQ(DataLayout::FunctionPtrAlignType::Independent, \
27 DataLayout("").getFunctionPtrAlignType());
28 EXPECT_EQ(DataLayout::FunctionPtrAlignType::Independent, \
29 DataLayout("Fi8").getFunctionPtrAlignType());
30 EXPECT_EQ(DataLayout::FunctionPtrAlignType::MultipleOfFunctionAlign, \
31 DataLayout("Fn8").getFunctionPtrAlignType());
32 EXPECT_EQ(DataLayout("Fi8"), DataLayout("Fi8"));
33 EXPECT_NE(DataLayout("Fi8"), DataLayout("Fi16"));
34 EXPECT_NE(DataLayout("Fi8"), DataLayout("Fn8"));
36 DataLayout a(""), b("Fi8"), c("Fn8");
37 EXPECT_NE(a, b);
38 EXPECT_NE(a, c);
39 EXPECT_NE(b, c);
41 a = b;
42 EXPECT_EQ(a, b);
43 a = c;
44 EXPECT_EQ(a, c);
47 } // anonymous namespace