diff --git a/llvm/include/llvm/IR/RuntimeLibcalls.h b/llvm/include/llvm/IR/RuntimeLibcalls.h index f43e09ada394..29fe6dd822e5 100644 --- a/llvm/include/llvm/IR/RuntimeLibcalls.h +++ b/llvm/include/llvm/IR/RuntimeLibcalls.h @@ -232,7 +232,9 @@ struct RuntimeLibcallsInfo { /// Return true if the target has sincosf/sincos/sincosl functions static bool hasSinCos(const Triple &TT) { - return TT.isGNUEnvironment() || TT.isOSFuchsia() || TT.isAndroid(); + // Downstream issue: #533 (Amazon Linux still not recognized correctly) + return TT.isGNUEnvironment() || TT.isOSFuchsia() || TT.isAmazonLinux() || + TT.isAndroid(); } static bool hasSinCos_f32_f64(const Triple &TT) { diff --git a/llvm/include/llvm/TargetParser/Triple.h b/llvm/include/llvm/TargetParser/Triple.h index d819c4975b13..3d80111332de 100644 --- a/llvm/include/llvm/TargetParser/Triple.h +++ b/llvm/include/llvm/TargetParser/Triple.h @@ -293,7 +293,9 @@ class Triple { OpenEmbedded, Intel, Meta, - LastVendorType = Meta + // Downstream issue: #533 (Amazon Linux still not recognized correctly) + Amazon, + LastVendorType = Amazon }; enum OSType { UnknownOS, @@ -1008,6 +1010,12 @@ class Triple { getSubArch() == Triple::X86_64SubArch_lfi); } + /// Downstream issue: #533 (Amazon Linux still not recognized correctly) + /// Tests whether the target is Amazon Linux. + bool isAmazonLinux() const { + return getOS() == Triple::Linux && getVendor() == Triple::Amazon; + } + /// Tests whether the target supports the EHABI exception /// handling standard. bool isTargetEHABICompatible() const { diff --git a/llvm/include/llvm/TargetParser/TripleName.def b/llvm/include/llvm/TargetParser/TripleName.def index bbc03b318801..b821080ff2fe 100644 --- a/llvm/include/llvm/TargetParser/TripleName.def +++ b/llvm/include/llvm/TargetParser/TripleName.def @@ -193,6 +193,8 @@ TRIPLE_VENDOR(SCEI, "scei") TRIPLE_VENDOR_ALIAS(SCEI, "sie") TRIPLE_VENDOR(SUSE, "suse") TRIPLE_VENDOR(Meta, "meta") +// Downstream issue: #533 (Amazon Linux still not recognized correctly) +TRIPLE_VENDOR(Amazon, "amazon") #undef TRIPLE_VENDOR #undef TRIPLE_VENDOR_ALIAS diff --git a/llvm/test/CodeGen/AArch64/veclib-llvm.sincos.ll b/llvm/test/CodeGen/AArch64/veclib-llvm.sincos.ll index e18ac46165d2..17342a57217c 100644 --- a/llvm/test/CodeGen/AArch64/veclib-llvm.sincos.ll +++ b/llvm/test/CodeGen/AArch64/veclib-llvm.sincos.ll @@ -1,6 +1,10 @@ ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --filter "(bl|ptrue)" --version 5 ; RUN: llc -mtriple=aarch64-gnu-linux -mattr=+neon,+sve -vector-library=sleefgnuabi < %s | FileCheck %s -check-prefix=SLEEF ; RUN: llc -mtriple=aarch64-gnu-linux -mattr=+neon,+sve -vector-library=ArmPL < %s | FileCheck %s -check-prefix=ARMPL +; NOTE: Downstream issue: #533 (Amazon Linux still not recognized correctly) +; Check we expand to a vector library call on aarch64-amazon-linux: +; RUN: llc -mtriple=aarch64-amazon-linux -mattr=+neon,+sve -vector-library=sleefgnuabi < %s | FileCheck %s -check-prefix=SLEEF +; RUN: llc -mtriple=aarch64-amazon-linux -mattr=+neon,+sve -vector-library=ArmPL < %s | FileCheck %s -check-prefix=ARMPL define void @test_sincos_v4f32(<4 x float> %x, ptr noalias %out_sin, ptr noalias %out_cos) { ; SLEEF-LABEL: test_sincos_v4f32: diff --git a/llvm/test/Transforms/LoopVectorize/AArch64/multiple-result-intrinsics.ll b/llvm/test/Transforms/LoopVectorize/AArch64/multiple-result-intrinsics.ll index 55994ad9a98f..7a9492dff3fa 100644 --- a/llvm/test/Transforms/LoopVectorize/AArch64/multiple-result-intrinsics.ll +++ b/llvm/test/Transforms/LoopVectorize/AArch64/multiple-result-intrinsics.ll @@ -1,8 +1,13 @@ ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --filter "(:|sincos|modf|extractvalue|store|with\.overflow)" --version 5 ; RUN: opt -passes=loop-vectorize -mtriple=aarch64-gnu-linux -mcpu=neoverse-v1 -mattr=+sve < %s -S -o - -debug-only=loop-vectorize 2>%t.1 | FileCheck %s --check-prefix=CHECK ; RUN: opt -passes=loop-vectorize -mtriple=aarch64-gnu-linux -mcpu=neoverse-v1 -mattr=+sve -vector-library=ArmPL < %s -S -o - -debug-only=loop-vectorize 2>%t.2 | FileCheck %s --check-prefix=CHECK-ARMPL +; NOTE: Downstream issue: #533 (Amazon Linux still not recognized correctly) +; RUN: opt -passes=loop-vectorize -mtriple=aarch64-amazon-linux -mcpu=neoverse-v1 -mattr=+sve -vector-library=ArmPL < %s -S -o - -debug-only=loop-vectorize 2>%t.3 | FileCheck %s --check-prefix=CHECK-ARMPL ; RUN: FileCheck --input-file=%t.1 --check-prefix=CHECK-COST %s ; RUN: FileCheck --input-file=%t.2 --check-prefix=CHECK-COST-ARMPL %s +; NOTE: Downstream issue: #533 (Amazon Linux still not recognized correctly) +; Check we vectorize the functions with the vector-library on aarch64-amazon-linux: +; RUN: FileCheck --input-file=%t.3 --check-prefix=CHECK-COST-ARMPL %s ; REQUIRES: asserts ; CHECK-COST-LABEL: sincos_f32 diff --git a/llvm/unittests/TargetParser/TripleTest.cpp b/llvm/unittests/TargetParser/TripleTest.cpp index cfe3bc6abf72..08af4014bc5e 100644 --- a/llvm/unittests/TargetParser/TripleTest.cpp +++ b/llvm/unittests/TargetParser/TripleTest.cpp @@ -127,6 +127,12 @@ TEST(TripleTest, ParsedIDs) { EXPECT_EQ(Triple::Hurd, T.getOS()); EXPECT_EQ(Triple::GNU, T.getEnvironment()); + // Downstream issue: #533 (Amazon Linux still not recognized correctly) + T = Triple("aarch64-amazon-linux"); + EXPECT_EQ(Triple::aarch64, T.getArch()); + EXPECT_EQ(Triple::Amazon, T.getVendor()); + EXPECT_EQ(Triple::Linux, T.getOS()); + T = Triple("arm-unknown-linux-android16"); EXPECT_EQ(Triple::arm, T.getArch()); EXPECT_EQ(Triple::UnknownVendor, T.getVendor());