-
Notifications
You must be signed in to change notification settings - Fork 13.7k
release/20.x: [LoongArch] Fix '-mno-lsx' option not disabling LASX feature (#143821) #143882
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
@SixWeining What do you think about merging this PR to the release branch? |
@llvm/pr-subscribers-clang-driver @llvm/pr-subscribers-backend-loongarch Author: None (llvmbot) ChangesBackport 2ecbfc0 Requested by: @Ami-zhang Full diff: https://github.com/llvm/llvm-project/pull/143882.diff 2 Files Affected:
diff --git a/clang/lib/Driver/ToolChains/Arch/LoongArch.cpp b/clang/lib/Driver/ToolChains/Arch/LoongArch.cpp
index 0575a1ebef3a6..1666253db54cb 100644
--- a/clang/lib/Driver/ToolChains/Arch/LoongArch.cpp
+++ b/clang/lib/Driver/ToolChains/Arch/LoongArch.cpp
@@ -253,6 +253,7 @@ void loongarch::getLoongArchTargetFeatures(const Driver &D,
Features.push_back("+lsx");
} else /*-mno-lsx*/ {
Features.push_back("-lsx");
+ Features.push_back("-lasx");
}
}
diff --git a/clang/test/Preprocessor/init-loongarch.c b/clang/test/Preprocessor/init-loongarch.c
index ac461b371162f..71a266b8a9157 100644
--- a/clang/test/Preprocessor/init-loongarch.c
+++ b/clang/test/Preprocessor/init-loongarch.c
@@ -946,6 +946,10 @@
// RUN: | FileCheck --match-full-lines --check-prefix=MNO-LSX %s
// RUN: %clang --target=loongarch64 -mno-lasx -mno-lsx -x c -E -dM %s -o - \
// RUN: | FileCheck --match-full-lines --check-prefix=MNO-LSX %s
+// RUN: %clang --target=loongarch64 -march=la464 -mno-lsx -x c -E -dM %s -o - \
+// RUN: | FileCheck --match-full-lines --check-prefix=MNO-LSX %s
+// RUN: %clang --target=loongarch64 -mno-lsx -march=la464 -x c -E -dM %s -o - \
+// RUN: | FileCheck --match-full-lines --check-prefix=MNO-LSX %s
// MNO-LSX-NOT: #define __loongarch_asx
// MNO-LSX-NOT: #define __loongarch_simd_width
// MNO-LSX-NOT: #define __loongarch_sx
|
@llvm/pr-subscribers-clang Author: None (llvmbot) ChangesBackport 2ecbfc0 Requested by: @Ami-zhang Full diff: https://github.com/llvm/llvm-project/pull/143882.diff 2 Files Affected:
diff --git a/clang/lib/Driver/ToolChains/Arch/LoongArch.cpp b/clang/lib/Driver/ToolChains/Arch/LoongArch.cpp
index 0575a1ebef3a6..1666253db54cb 100644
--- a/clang/lib/Driver/ToolChains/Arch/LoongArch.cpp
+++ b/clang/lib/Driver/ToolChains/Arch/LoongArch.cpp
@@ -253,6 +253,7 @@ void loongarch::getLoongArchTargetFeatures(const Driver &D,
Features.push_back("+lsx");
} else /*-mno-lsx*/ {
Features.push_back("-lsx");
+ Features.push_back("-lasx");
}
}
diff --git a/clang/test/Preprocessor/init-loongarch.c b/clang/test/Preprocessor/init-loongarch.c
index ac461b371162f..71a266b8a9157 100644
--- a/clang/test/Preprocessor/init-loongarch.c
+++ b/clang/test/Preprocessor/init-loongarch.c
@@ -946,6 +946,10 @@
// RUN: | FileCheck --match-full-lines --check-prefix=MNO-LSX %s
// RUN: %clang --target=loongarch64 -mno-lasx -mno-lsx -x c -E -dM %s -o - \
// RUN: | FileCheck --match-full-lines --check-prefix=MNO-LSX %s
+// RUN: %clang --target=loongarch64 -march=la464 -mno-lsx -x c -E -dM %s -o - \
+// RUN: | FileCheck --match-full-lines --check-prefix=MNO-LSX %s
+// RUN: %clang --target=loongarch64 -mno-lsx -march=la464 -x c -E -dM %s -o - \
+// RUN: | FileCheck --match-full-lines --check-prefix=MNO-LSX %s
// MNO-LSX-NOT: #define __loongarch_asx
// MNO-LSX-NOT: #define __loongarch_simd_width
// MNO-LSX-NOT: #define __loongarch_sx
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
…3821) When '-march' with LASX feature and '-mno-lsx' options are used together, '-mno-lsx' fails to disable LASX, leaving 'HasFeatureLASX=true' and causing incorrect '__loongarch_sx/asx=1' macro definition. Fixes loongson-community/discussions#95 (cherry picked from commit 2ecbfc0)
@Ami-zhang (or anyone else). If you would like to add a note about this fix in the release notes (completely optional). Please reply to this comment with a one or two sentence description of the fix. When you are done, please add the release:note label to this PR. |
Backport 2ecbfc0
Requested by: @Ami-zhang