1 //===- ConstantRangeTest.cpp - ConstantRange tests ------------------------===//
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
7 //===----------------------------------------------------------------------===//
9 #include "llvm/IR/DataLayout.h"
10 #include "gtest/gtest.h"
16 TEST(DataLayoutTest
, FunctionPtrAlign
) {
17 EXPECT_EQ(MaybeAlign(0), DataLayout("").getFunctionPtrAlign());
18 EXPECT_EQ(MaybeAlign(1), DataLayout("Fi8").getFunctionPtrAlign());
19 EXPECT_EQ(MaybeAlign(2), DataLayout("Fi16").getFunctionPtrAlign());
20 EXPECT_EQ(MaybeAlign(4), DataLayout("Fi32").getFunctionPtrAlign());
21 EXPECT_EQ(MaybeAlign(8), DataLayout("Fi64").getFunctionPtrAlign());
22 EXPECT_EQ(MaybeAlign(1), DataLayout("Fn8").getFunctionPtrAlign());
23 EXPECT_EQ(MaybeAlign(2), DataLayout("Fn16").getFunctionPtrAlign());
24 EXPECT_EQ(MaybeAlign(4), DataLayout("Fn32").getFunctionPtrAlign());
25 EXPECT_EQ(MaybeAlign(8), 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");
47 } // anonymous namespace