diff --git a/llvm/unittests/Bitcode/DataLayoutUpgradeTest.cpp b/llvm/unittests/Bitcode/DataLayoutUpgradeTest.cpp index 67dccb3849f93cb..7a74a5882286f9b 100644 --- a/llvm/unittests/Bitcode/DataLayoutUpgradeTest.cpp +++ b/llvm/unittests/Bitcode/DataLayoutUpgradeTest.cpp @@ -92,6 +92,16 @@ TEST(DataLayoutUpgradeTest, ValidDataLayoutUpgrade) { "e-m:m-p:32:32-i8:8:32-i16:16:32-i64:64-n32-S64", "mips64el"), "e-m:m-p:32:32-i8:8:32-i16:16:32-i64:64-n32-S64"); + // Check that PowerPC64 targets add -i128:128. + EXPECT_EQ(UpgradeDataLayoutString("e-m:e-i64:64-n32:64", "powerpc64le-linux"), + "e-m:e-i64:64-i128:128-n32:64"); + EXPECT_EQ(UpgradeDataLayoutString( + "E-m:e-Fn32-i64:64-n32:64", "powerpc64-linux"), + "E-m:e-Fn32-i64:64-i128:128-n32:64"); + EXPECT_EQ(UpgradeDataLayoutString( + "E-m:a-Fi64-i64:64-n32:64", "powerpc64-ibm-aix"), + "E-m:a-Fi64-i64:64-i128:128-n32:64"); + // Check that SPIR && SPIRV targets add -G1 if it's not present. EXPECT_EQ(UpgradeDataLayoutString("e-p:32:32", "spir"), "e-p:32:32-G1"); EXPECT_EQ(UpgradeDataLayoutString("e-p:32:32", "spir64"), "e-p:32:32-G1"); @@ -108,8 +118,6 @@ TEST(DataLayoutUpgradeTest, NoDataLayoutUpgrade) { "-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-m:e-i64:64-n32:64", - "powerpc64le-unknown-linux-gnu"); std::string DL3 = UpgradeDataLayoutString( "e-m:o-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-n32:64-S128-Fn32", "aarch64--"); @@ -118,7 +126,6 @@ TEST(DataLayoutUpgradeTest, NoDataLayoutUpgrade) { "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-i128:128:128" "-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-m:e-i64:64-i128:128-n32:64"); EXPECT_EQ(DL3, "e-m:o-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-n32:" "64-S128-Fn32"); @@ -153,6 +160,14 @@ TEST(DataLayoutUpgradeTest, NoDataLayoutUpgrade) { EXPECT_EQ(UpgradeDataLayoutString("G2", "spir64"), "G2"); EXPECT_EQ(UpgradeDataLayoutString("G2", "spirv32"), "G2"); EXPECT_EQ(UpgradeDataLayoutString("G2", "spirv64"), "G2"); + + // Check that PowerPC32 targets don't add -i128:128. + EXPECT_EQ(UpgradeDataLayoutString("e-m:e-i64:64-n32", "powerpcle-linux"), + "e-m:e-i64:64-n32"); + EXPECT_EQ(UpgradeDataLayoutString("E-m:e-Fn32-i64:64-n32", "powerpc-linux"), + "E-m:e-Fn32-i64:64-n32"); + EXPECT_EQ(UpgradeDataLayoutString("E-m:a-Fi64-i64:64-n32", "powerpc-aix"), + "E-m:a-Fi64-i64:64-n32"); } TEST(DataLayoutUpgradeTest, EmptyDataLayout) {