Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion llvm/include/llvm/TargetParser/Triple.h
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,9 @@ class Triple {
SUSE,
OpenEmbedded,
Intel,
LastVendorType = Intel
// Downstream issue: #533 (Amazon Linux still not recognized correctly)
Amazon,
LastVendorType = Amazon
};
enum OSType {
UnknownOS,
Expand Down
13 changes: 13 additions & 0 deletions llvm/lib/TargetParser/Triple.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -271,6 +271,9 @@ StringRef Triple::getVendorTypeName(VendorType Kind) {
case PC: return "pc";
case SCEI: return "scei";
case SUSE: return "suse";
// Downstream issue: #533 (Amazon Linux still not recognized correctly)
case Amazon:
return "amazon";
}

llvm_unreachable("Invalid VendorType!");
Expand Down Expand Up @@ -669,6 +672,8 @@ static Triple::VendorType parseVendor(StringRef VendorName) {
.Case("suse", Triple::SUSE)
.Case("oe", Triple::OpenEmbedded)
.Case("intel", Triple::Intel)
// Downstream issue: #533 (Amazon Linux still not recognized correctly)
.Case("amazon", Triple::Amazon)
.Default(Triple::UnknownVendor);
}

Expand Down Expand Up @@ -1301,6 +1306,14 @@ std::string Triple::normalize(StringRef Str, CanonicalForm Form) {
if (Vendor == Triple::SUSE && Environment == llvm::Triple::GNUEABI)
Components[3] = "gnueabihf";

// Downstream issue: #533 (Amazon Linux still not recognized correctly)
// Amazon Linux uses a "gnu" environment by default.
if (Environment == Triple::UnknownEnvironment && Vendor == Triple::Amazon &&
OS == Triple::Linux) {
Components.resize(4);
Components[3] = "gnu";
}

if (OS == Triple::Win32) {
Components.resize(4);
Components[2] = "windows";
Expand Down
4 changes: 4 additions & 0 deletions llvm/test/CodeGen/AArch64/veclib-llvm.sincos.ll
Original file line number Diff line number Diff line change
@@ -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:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,13 @@
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --filter "(:|sincos|modf|extractvalue|store)" --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
Expand Down
12 changes: 12 additions & 0 deletions llvm/unittests/TargetParser/TripleTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,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());
Expand Down Expand Up @@ -1436,6 +1442,12 @@ TEST(TripleTest, Normalization) {

EXPECT_EQ("x86_64-unknown-linux-gnu", Triple::normalize("x86_64-gnu-linux"));

// Downstream issue: #533 (Amazon Linux still not recognized correctly)
EXPECT_EQ("aarch64-amazon-linux-gnu",
Triple::normalize("aarch64-amazon-linux"));
EXPECT_EQ("x86_64-amazon-linux-gnu",
Triple::normalize("x86_64-amazon-linux"));

EXPECT_EQ("a-unknown-unknown",
Triple::normalize("a", Triple::CanonicalForm::THREE_IDENT));
EXPECT_EQ("a-b-unknown",
Expand Down