diff --git a/llvm/include/llvm/ADT/Triple.h b/llvm/include/llvm/ADT/Triple.h --- a/llvm/include/llvm/ADT/Triple.h +++ b/llvm/include/llvm/ADT/Triple.h @@ -230,6 +230,9 @@ GNUABI64, GNUEABI, GNUEABIHF, + GNUF32, + GNUF64, + GNUSF, GNUX32, GNUILP32, CODE16, @@ -239,6 +242,9 @@ Musl, MuslEABI, MuslEABIHF, + MuslF32, + MuslF64, + MuslSF, MuslX32, MSVC, @@ -556,7 +562,9 @@ EnvironmentType Env = getEnvironment(); return Env == Triple::GNU || Env == Triple::GNUABIN32 || Env == Triple::GNUABI64 || Env == Triple::GNUEABI || - Env == Triple::GNUEABIHF || Env == Triple::GNUX32; + Env == Triple::GNUEABIHF || Env == Triple::GNUF32 || + Env == Triple::GNUF64 || Env == Triple::GNUSF || + Env == Triple::GNUX32; } bool isOSContiki() const { @@ -729,6 +737,9 @@ return getEnvironment() == Triple::Musl || getEnvironment() == Triple::MuslEABI || getEnvironment() == Triple::MuslEABIHF || + getEnvironment() == Triple::MuslF32 || + getEnvironment() == Triple::MuslF64 || + getEnvironment() == Triple::MuslSF || getEnvironment() == Triple::MuslX32; } diff --git a/llvm/lib/Support/Triple.cpp b/llvm/lib/Support/Triple.cpp --- a/llvm/lib/Support/Triple.cpp +++ b/llvm/lib/Support/Triple.cpp @@ -258,6 +258,9 @@ case GNUABIN32: return "gnuabin32"; case GNUEABI: return "gnueabi"; case GNUEABIHF: return "gnueabihf"; + case GNUF32: return "gnuf32"; + case GNUF64: return "gnuf64"; + case GNUSF: return "gnusf"; case GNUX32: return "gnux32"; case GNUILP32: return "gnu_ilp32"; case Itanium: return "itanium"; @@ -266,6 +269,9 @@ case Musl: return "musl"; case MuslEABI: return "musleabi"; case MuslEABIHF: return "musleabihf"; + case MuslF32: return "muslf32"; + case MuslF64: return "muslf64"; + case MuslSF: return "muslsf"; case MuslX32: return "muslx32"; case Simulator: return "simulator"; case Pixel: return "pixel"; @@ -598,6 +604,9 @@ .StartsWith("gnuabi64", Triple::GNUABI64) .StartsWith("gnueabihf", Triple::GNUEABIHF) .StartsWith("gnueabi", Triple::GNUEABI) + .StartsWith("gnuf32", Triple::GNUF32) + .StartsWith("gnuf64", Triple::GNUF64) + .StartsWith("gnusf", Triple::GNUSF) .StartsWith("gnux32", Triple::GNUX32) .StartsWith("gnu_ilp32", Triple::GNUILP32) .StartsWith("code16", Triple::CODE16) @@ -605,6 +614,9 @@ .StartsWith("android", Triple::Android) .StartsWith("musleabihf", Triple::MuslEABIHF) .StartsWith("musleabi", Triple::MuslEABI) + .StartsWith("muslf32", Triple::MuslF32) + .StartsWith("muslf64", Triple::MuslF64) + .StartsWith("muslsf", Triple::MuslSF) .StartsWith("muslx32", Triple::MuslX32) .StartsWith("musl", Triple::Musl) .StartsWith("msvc", Triple::MSVC) diff --git a/llvm/unittests/ADT/TripleTest.cpp b/llvm/unittests/ADT/TripleTest.cpp --- a/llvm/unittests/ADT/TripleTest.cpp +++ b/llvm/unittests/ADT/TripleTest.cpp @@ -439,12 +439,108 @@ EXPECT_EQ(Triple::UnknownOS, T.getOS()); EXPECT_EQ(Triple::UnknownEnvironment, T.getEnvironment()); + T = Triple("loongarch32-unknown-linux-gnu"); + EXPECT_EQ(Triple::loongarch32, T.getArch()); + EXPECT_EQ(Triple::UnknownVendor, T.getVendor()); + EXPECT_EQ(Triple::Linux, T.getOS()); + EXPECT_EQ(Triple::GNU, T.getEnvironment()); + + T = Triple("loongarch32-unknown-linux-gnuf32"); + EXPECT_EQ(Triple::loongarch32, T.getArch()); + EXPECT_EQ(Triple::UnknownVendor, T.getVendor()); + EXPECT_EQ(Triple::Linux, T.getOS()); + EXPECT_EQ(Triple::GNUF32, T.getEnvironment()); + + T = Triple("loongarch32-unknown-linux-gnuf64"); + EXPECT_EQ(Triple::loongarch32, T.getArch()); + EXPECT_EQ(Triple::UnknownVendor, T.getVendor()); + EXPECT_EQ(Triple::Linux, T.getOS()); + EXPECT_EQ(Triple::GNUF64, T.getEnvironment()); + + T = Triple("loongarch32-unknown-linux-gnusf"); + EXPECT_EQ(Triple::loongarch32, T.getArch()); + EXPECT_EQ(Triple::UnknownVendor, T.getVendor()); + EXPECT_EQ(Triple::Linux, T.getOS()); + EXPECT_EQ(Triple::GNUSF, T.getEnvironment()); + + T = Triple("loongarch32-unknown-linux-musl"); + EXPECT_EQ(Triple::loongarch32, T.getArch()); + EXPECT_EQ(Triple::UnknownVendor, T.getVendor()); + EXPECT_EQ(Triple::Linux, T.getOS()); + EXPECT_EQ(Triple::Musl, T.getEnvironment()); + + T = Triple("loongarch32-unknown-linux-muslf32"); + EXPECT_EQ(Triple::loongarch32, T.getArch()); + EXPECT_EQ(Triple::UnknownVendor, T.getVendor()); + EXPECT_EQ(Triple::Linux, T.getOS()); + EXPECT_EQ(Triple::MuslF32, T.getEnvironment()); + + T = Triple("loongarch32-unknown-linux-muslf64"); + EXPECT_EQ(Triple::loongarch32, T.getArch()); + EXPECT_EQ(Triple::UnknownVendor, T.getVendor()); + EXPECT_EQ(Triple::Linux, T.getOS()); + EXPECT_EQ(Triple::MuslF64, T.getEnvironment()); + + T = Triple("loongarch32-unknown-linux-muslsf"); + EXPECT_EQ(Triple::loongarch32, T.getArch()); + EXPECT_EQ(Triple::UnknownVendor, T.getVendor()); + EXPECT_EQ(Triple::Linux, T.getOS()); + EXPECT_EQ(Triple::MuslSF, T.getEnvironment()); + T = Triple("loongarch64-unknown-linux"); EXPECT_EQ(Triple::loongarch64, T.getArch()); EXPECT_EQ(Triple::UnknownVendor, T.getVendor()); EXPECT_EQ(Triple::Linux, T.getOS()); EXPECT_EQ(Triple::UnknownEnvironment, T.getEnvironment()); + T = Triple("loongarch64-unknown-linux-gnu"); + EXPECT_EQ(Triple::loongarch64, T.getArch()); + EXPECT_EQ(Triple::UnknownVendor, T.getVendor()); + EXPECT_EQ(Triple::Linux, T.getOS()); + EXPECT_EQ(Triple::GNU, T.getEnvironment()); + + T = Triple("loongarch64-unknown-linux-gnuf32"); + EXPECT_EQ(Triple::loongarch64, T.getArch()); + EXPECT_EQ(Triple::UnknownVendor, T.getVendor()); + EXPECT_EQ(Triple::Linux, T.getOS()); + EXPECT_EQ(Triple::GNUF32, T.getEnvironment()); + + T = Triple("loongarch64-unknown-linux-gnuf64"); + EXPECT_EQ(Triple::loongarch64, T.getArch()); + EXPECT_EQ(Triple::UnknownVendor, T.getVendor()); + EXPECT_EQ(Triple::Linux, T.getOS()); + EXPECT_EQ(Triple::GNUF64, T.getEnvironment()); + + T = Triple("loongarch64-unknown-linux-gnusf"); + EXPECT_EQ(Triple::loongarch64, T.getArch()); + EXPECT_EQ(Triple::UnknownVendor, T.getVendor()); + EXPECT_EQ(Triple::Linux, T.getOS()); + EXPECT_EQ(Triple::GNUSF, T.getEnvironment()); + + T = Triple("loongarch64-unknown-linux-musl"); + EXPECT_EQ(Triple::loongarch64, T.getArch()); + EXPECT_EQ(Triple::UnknownVendor, T.getVendor()); + EXPECT_EQ(Triple::Linux, T.getOS()); + EXPECT_EQ(Triple::Musl, T.getEnvironment()); + + T = Triple("loongarch64-unknown-linux-muslf32"); + EXPECT_EQ(Triple::loongarch64, T.getArch()); + EXPECT_EQ(Triple::UnknownVendor, T.getVendor()); + EXPECT_EQ(Triple::Linux, T.getOS()); + EXPECT_EQ(Triple::MuslF32, T.getEnvironment()); + + T = Triple("loongarch64-unknown-linux-muslf64"); + EXPECT_EQ(Triple::loongarch64, T.getArch()); + EXPECT_EQ(Triple::UnknownVendor, T.getVendor()); + EXPECT_EQ(Triple::Linux, T.getOS()); + EXPECT_EQ(Triple::MuslF64, T.getEnvironment()); + + T = Triple("loongarch64-unknown-linux-muslsf"); + EXPECT_EQ(Triple::loongarch64, T.getArch()); + EXPECT_EQ(Triple::UnknownVendor, T.getVendor()); + EXPECT_EQ(Triple::Linux, T.getOS()); + EXPECT_EQ(Triple::MuslSF, T.getEnvironment()); + T = Triple("riscv32-unknown-unknown"); EXPECT_EQ(Triple::riscv32, T.getArch()); EXPECT_EQ(Triple::UnknownVendor, T.getVendor());