Author: Ami-zhang Date: 2025-08-15T09:53:08+08:00 New Revision: a1b6e7ff393533a5c4f3bdfd4efe5da106e2de2b
URL: https://github.com/llvm/llvm-project/commit/a1b6e7ff393533a5c4f3bdfd4efe5da106e2de2b DIFF: https://github.com/llvm/llvm-project/commit/a1b6e7ff393533a5c4f3bdfd4efe5da106e2de2b.diff LOG: [clang][LoongArch] Ensure `target("lasx")` implies LSX support (#153542) Currently, `__attribute__((target("lasx")))` does not automatically enable LSX support, causing Clang to fail with `-mno-lsx`. Since LASX depends on LSX, enabling LASX should implicitly enable LSX to avoid clang error. Fixes #149512. Depends on #153541 Added: Modified: clang/lib/Basic/Targets/LoongArch.cpp clang/test/CodeGen/LoongArch/targetattr-lasx.c Removed: ################################################################################ diff --git a/clang/lib/Basic/Targets/LoongArch.cpp b/clang/lib/Basic/Targets/LoongArch.cpp index f6915df1520b7..8e29bb745734b 100644 --- a/clang/lib/Basic/Targets/LoongArch.cpp +++ b/clang/lib/Basic/Targets/LoongArch.cpp @@ -461,6 +461,8 @@ LoongArchTargetInfo::parseTargetAttr(StringRef Features) const { case AttrFeatureKind::Feature: Ret.Features.push_back("+" + Value.str()); + if (Value == "lasx") + Ret.Features.push_back("+lsx"); break; } } diff --git a/clang/test/CodeGen/LoongArch/targetattr-lasx.c b/clang/test/CodeGen/LoongArch/targetattr-lasx.c index f4857406180a2..56fd6573ed34c 100644 --- a/clang/test/CodeGen/LoongArch/targetattr-lasx.c +++ b/clang/test/CodeGen/LoongArch/targetattr-lasx.c @@ -4,4 +4,4 @@ __attribute__((target("lasx"))) // CHECK: #[[ATTR0:[0-9]+]] { void testlasx() {} -// CHECK: attributes #[[ATTR0]] = { {{.*}}"target-features"="+64bit,+lasx,-lsx"{{.*}} } +// CHECK: attributes #[[ATTR0]] = { {{.*}}"target-features"="+64bit,+lasx,+lsx"{{.*}} } _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits