Skip to content

Conversation

@Ami-zhang
Copy link
Contributor

No description provided.

@llvmbot llvmbot added the clang Clang issues not falling into any other category label Aug 14, 2025
@llvmbot
Copy link
Member

llvmbot commented Aug 14, 2025

@llvm/pr-subscribers-clang

Author: None (Ami-zhang)

Changes

Full diff: https://github.com/llvm/llvm-project/pull/153541.diff

1 Files Affected:

  • (added) clang/test/CodeGen/LoongArch/targetattr-lasx.c (+16)
diff --git a/clang/test/CodeGen/LoongArch/targetattr-lasx.c b/clang/test/CodeGen/LoongArch/targetattr-lasx.c
new file mode 100644
index 0000000000000..826180c73120f
--- /dev/null
+++ b/clang/test/CodeGen/LoongArch/targetattr-lasx.c
@@ -0,0 +1,16 @@
+// NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py UTC_ARGS: --check-globals all --version 5
+// RUN: %clang_cc1 -triple loongarch64 -target-feature -lsx -emit-llvm %s -o - | FileCheck %s
+
+__attribute__((target("lasx")))
+// CHECK-LABEL: define dso_local void @testlasx(
+// CHECK-SAME: ) #[[ATTR0:[0-9]+]] {
+// CHECK-NEXT:  [[ENTRY:.*:]]
+// CHECK-NEXT:    ret void
+//
+void testlasx() {}
+//.
+// CHECK: attributes #[[ATTR0]] = { noinline nounwind optnone "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-features"="+64bit,+lasx,-lsx" }
+//.
+// CHECK: [[META0:![0-9]+]] = !{i32 1, !"wchar_size", i32 4}
+// CHECK: [[META1:![0-9]+]] = !{!"{{.*}}clang version {{.*}}"}
+//.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To avoid frequent test updates due to unrelated compiler changes in the future, I tend to only check function attributes: "target-features"="+64bit,+lasx,-lsx".

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Simplify the test.

@Ami-zhang Ami-zhang merged commit 793a6b4 into llvm:main Aug 15, 2025
9 checks passed
Ami-zhang added a commit that referenced this pull request Aug 15, 2025
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
tru pushed a commit to llvmbot/llvm-project that referenced this pull request Aug 18, 2025
tru pushed a commit to llvmbot/llvm-project that referenced this pull request Aug 18, 2025
…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 llvm#149512.

Depends on llvm#153541

(cherry picked from commit a1b6e7f)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

clang Clang issues not falling into any other category

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants