mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-23 19:23:23 +01:00
29e7e13b1b
Summary: Add function to AutoUpgrade to change the datalayout of old X86 datalayout strings. This adds "-p270:32:32-p271:32:32-p272:64:64" to X86 datalayouts that are otherwise valid and don't already contain it. This also removes the compatibility changes in https://reviews.llvm.org/D66843. Datalayout change in https://reviews.llvm.org/D64931. Reviewers: rnk, echristo Subscribers: hiraditya, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D67631 llvm-svn: 372267
60 lines
2.5 KiB
C++
60 lines
2.5 KiB
C++
//===- DataLayoutUpgradeTest.cpp - Tests for DataLayout upgrades ----------===//
|
|
//
|
|
// 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/IR/AutoUpgrade.h"
|
|
#include "gtest/gtest.h"
|
|
|
|
using namespace llvm;
|
|
|
|
namespace {
|
|
|
|
TEST(DataLayoutUpgradeTest, ValidDataLayoutUpgrade) {
|
|
std::string DL1 =
|
|
UpgradeDataLayoutString("e-m:e-p:32:32-i64:64-f80:128-n8:16:32:64-S128",
|
|
"x86_64-unknown-linux-gnu");
|
|
std::string DL2 = UpgradeDataLayoutString(
|
|
"e-m:w-p:32:32-i64:64-f80:32-n8:16:32-S32", "i686-pc-windows-msvc");
|
|
std::string DL3 = UpgradeDataLayoutString("e-m:o-i64:64-i128:128-n32:64-S128",
|
|
"x86_64-apple-macosx");
|
|
EXPECT_EQ(DL1, "e-m:e-p:32:32-p270:32:32-p271:32:32-p272:64:64-i64:64"
|
|
"-f80:128-n8:16:32:64-S128");
|
|
EXPECT_EQ(DL2, "e-m:w-p:32:32-p270:32:32-p271:32:32-p272:64:64-i64:64"
|
|
"-f80:32-n8:16:32-S32");
|
|
EXPECT_EQ(DL3, "e-m:o-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128"
|
|
"-n32:64-S128");
|
|
}
|
|
|
|
TEST(DataLayoutUpgradeTest, NoDataLayoutUpgrade) {
|
|
std::string DL1 = UpgradeDataLayoutString(
|
|
"e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32"
|
|
"-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128"
|
|
"-n8:16:32:64-S128",
|
|
"x86_64-unknown-linux-gnu");
|
|
std::string DL2 = UpgradeDataLayoutString("e-p:32:32", "i686-apple-darwin9");
|
|
std::string DL3 = UpgradeDataLayoutString("e-m:e-i64:64-n32:64",
|
|
"powerpc64le-unknown-linux-gnu");
|
|
std::string DL4 =
|
|
UpgradeDataLayoutString("e-m:o-i64:64-i128:128-n32:64-S128", "aarch64--");
|
|
EXPECT_EQ(DL1, "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64"
|
|
"-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64"
|
|
"-f80:128:128-n8:16:32:64-S128");
|
|
EXPECT_EQ(DL2, "e-p:32:32");
|
|
EXPECT_EQ(DL3, "e-m:e-i64:64-n32:64");
|
|
EXPECT_EQ(DL4, "e-m:o-i64:64-i128:128-n32:64-S128");
|
|
}
|
|
|
|
TEST(DataLayoutUpgradeTest, EmptyDataLayout) {
|
|
std::string DL1 = UpgradeDataLayoutString("", "x86_64-unknown-linux-gnu");
|
|
std::string DL2 = UpgradeDataLayoutString(
|
|
"e-m:e-p:32:32-i64:64-f80:128-n8:16:32:64-S128", "");
|
|
EXPECT_EQ(DL1, "");
|
|
EXPECT_EQ(DL2, "e-m:e-p:32:32-i64:64-f80:128-n8:16:32:64-S128");
|
|
}
|
|
|
|
} // end namespace
|