[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

(cherry picked from commit a1b6e7ff393533a5c4f3bdfd4efe5da106e2de2b)
This commit is contained in:
Ami-zhang 2025-08-15 09:53:08 +08:00 committed by Tobias Hieta
parent 9bf61a610c
commit 08b5797556
No known key found for this signature in database
GPG Key ID: 44F2485E45D59042
2 changed files with 3 additions and 1 deletions

View File

@ -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;
}
}

View File

@ -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"{{.*}} }