release/22.x: [Hexagon] Define __HVX_IEEE_FP__ when -mhvx-ieee-fp is enabled (#183829)#183978
release/22.x: [Hexagon] Define __HVX_IEEE_FP__ when -mhvx-ieee-fp is enabled (#183829)#183978llvmbot wants to merge 1 commit intollvm:release/22.xfrom
Conversation
|
@androm3da What do you think about merging this PR to the release branch? |
|
@llvm/pr-subscribers-backend-x86 @llvm/pr-subscribers-clang Author: None (llvmbot) ChangesBackport 136ba6e Requested by: @androm3da Full diff: https://github.com/llvm/llvm-project/pull/183978.diff 3 Files Affected:
diff --git a/clang/lib/Basic/Targets/Hexagon.cpp b/clang/lib/Basic/Targets/Hexagon.cpp
index bd70bfe4fef51..9bf34e67a03fd 100644
--- a/clang/lib/Basic/Targets/Hexagon.cpp
+++ b/clang/lib/Basic/Targets/Hexagon.cpp
@@ -102,6 +102,9 @@ void HexagonTargetInfo::getTargetDefines(const LangOptions &Opts,
Builder.defineMacro("__HVXDBL__");
}
+ if (HasHVXIeeeFp)
+ Builder.defineMacro("__HVX_IEEE_FP__");
+
if (hasFeature("audio")) {
Builder.defineMacro("__HEXAGON_AUDIO__");
}
@@ -148,6 +151,8 @@ bool HexagonTargetInfo::handleTargetFeatures(std::vector<std::string> &Features,
UseLongCalls = true;
else if (F == "-long-calls")
UseLongCalls = false;
+ else if (F == "+hvx-ieee-fp")
+ HasHVXIeeeFp = true;
else if (F == "+audio")
HasAudio = true;
}
@@ -242,6 +247,7 @@ bool HexagonTargetInfo::hasFeature(StringRef Feature) const {
.Case("hvx", HasHVX)
.Case("hvx-length64b", HasHVX64B)
.Case("hvx-length128b", HasHVX128B)
+ .Case("hvx-ieee-fp", HasHVXIeeeFp)
.Case("long-calls", UseLongCalls)
.Case("audio", HasAudio)
.Default(false);
diff --git a/clang/lib/Basic/Targets/Hexagon.h b/clang/lib/Basic/Targets/Hexagon.h
index 21da0fc4cbdd0..f034911d77b92 100644
--- a/clang/lib/Basic/Targets/Hexagon.h
+++ b/clang/lib/Basic/Targets/Hexagon.h
@@ -32,6 +32,7 @@ class LLVM_LIBRARY_VISIBILITY HexagonTargetInfo : public TargetInfo {
bool HasHVX = false;
bool HasHVX64B = false;
bool HasHVX128B = false;
+ bool HasHVXIeeeFp = false;
bool HasAudio = false;
bool UseLongCalls = false;
diff --git a/clang/test/Preprocessor/hexagon-predefines.c b/clang/test/Preprocessor/hexagon-predefines.c
index bdedcf45ab118..4079f521580a8 100644
--- a/clang/test/Preprocessor/hexagon-predefines.c
+++ b/clang/test/Preprocessor/hexagon-predefines.c
@@ -105,8 +105,21 @@
// CHECK-V68HVX-128B: #define __HVX_ARCH__ 68
// CHECK-V68HVX-128B: #define __HVX_LENGTH__ 128
// CHECK-V68HVX-128B: #define __HVX__ 1
+// CHECK-V68HVX-128B-NOT: #define __HVX_IEEE_FP__ 1
// CHECK-V68HVX-128B: #define __hexagon__ 1
+// RUN: %clang_cc1 -E -dM -triple hexagon-unknown-elf -target-cpu hexagonv68 \
+// RUN: -target-feature +hvxv68 -target-feature +hvx-length128b \
+// RUN: -target-feature +hvx-ieee-fp %s | FileCheck \
+// RUN: %s -check-prefix CHECK-V68HVX-IEEE-FP
+// CHECK-V68HVX-IEEE-FP: #define __HEXAGON_ARCH__ 68
+// CHECK-V68HVX-IEEE-FP: #define __HEXAGON_V68__ 1
+// CHECK-V68HVX-IEEE-FP: #define __HVX_ARCH__ 68
+// CHECK-V68HVX-IEEE-FP: #define __HVX_IEEE_FP__ 1
+// CHECK-V68HVX-IEEE-FP: #define __HVX_LENGTH__ 128
+// CHECK-V68HVX-IEEE-FP: #define __HVX__ 1
+// CHECK-V68HVX-IEEE-FP: #define __hexagon__ 1
+
// RUN: %clang_cc1 -E -dM -triple hexagon-unknown-elf -target-cpu hexagonv69 \
// RUN: -target-feature +hvxv69 -target-feature +hvx-length128b %s | FileCheck \
// RUN: %s -check-prefix CHECK-V69HVX-128B
|
🐧 Linux x64 Test Results
Failed Tests(click on a test name to see its output) ClangClang.Headers/hexagon-hvx-ieee-headers.cIf these failures are unrelated to your changes (for example tests are broken or flaky at HEAD), please open an issue at https://github.com/llvm/llvm-project/issues and add the |
🪟 Windows x64 Test Results
Failed Tests(click on a test name to see its output) ClangClang.Headers/hexagon-hvx-ieee-headers.cIf these failures are unrelated to your changes (for example tests are broken or flaky at HEAD), please open an issue at https://github.com/llvm/llvm-project/issues and add the |
|
@androm3da, the test failures do appear to be related to this change, can you take a look? |
…llvm#184422) Hexagon clang recently started to define __HVX_IEEE_FP__ when the -mhvx-ieee-fp option is specified. Guard the intrinsic macros for instructions that should only be available with -mhvx-ieee-fp with __HVX_IEEE_FP__. Additionally, the following NFC changes are included: - NFC: Remove guards around HVX v60 intrinsic macros Hexagon v60 is the oldest Hexagon version that supports HVX so these guards were redundant. Presence of HVX is guarded separately, once per the whole file. - Remove comments from closing guards (HVX protos) These comments served very limited function as they only guard one macro. Also, they were incorrect. Instead of fixing remove them. This will also reduce by the factor of two the amount of changes when guarding conditions change. (cherry picked from commit e8e8d30)
Sorry, @dyung somehow I must have gotten these two commits misconfigured by doing Issue #183746 requires two cherry-picks: 136ba6e must land on |
|
Failed to cherry-pick: `s https://github.com/llvm/llvm-project/actions/runs/22765934935 Please manually backport the fix and push it to your github fork. Once this is done, please create a pull request |
I'll close this in favor of #185014 |
Backport 136ba6e
Requested by: @androm3da