Skip to content

[Clang][AArch64] Use 'uint64_t*' for _arm_get_sme_state builtin. #95982

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

Merged
merged 2 commits into from
Jun 19, 2024

Conversation

sdesmalen-arm
Copy link
Collaborator

Depending on the platform, the parameter for __arm_get_sme_state requires a unsigned long long* instead of a unsigned long*.

From ASTContext.cpp:

case 'W':
// This modifier represents int64 type.

Depending on the platform, the parameter for __arm_get_sme_state
requires a `unsigned long long*` instead of a `unsigned long*`.

From ASTContext.cpp:

  case 'W':
    // This modifier represents int64 type.
@llvmbot llvmbot added clang Clang issues not falling into any other category backend:AArch64 clang:frontend Language frontend issues, e.g. anything involving "Sema" labels Jun 18, 2024
@llvmbot
Copy link
Member

llvmbot commented Jun 18, 2024

@llvm/pr-subscribers-backend-aarch64

Author: Sander de Smalen (sdesmalen-arm)

Changes

Depending on the platform, the parameter for __arm_get_sme_state requires a unsigned long long* instead of a unsigned long*.

From ASTContext.cpp:

case 'W':
// This modifier represents int64 type.


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

1 Files Affected:

  • (modified) clang/include/clang/Basic/BuiltinsAArch64.def (+1-1)
diff --git a/clang/include/clang/Basic/BuiltinsAArch64.def b/clang/include/clang/Basic/BuiltinsAArch64.def
index 5f53c98167dfb..5fb199b1b2b03 100644
--- a/clang/include/clang/Basic/BuiltinsAArch64.def
+++ b/clang/include/clang/Basic/BuiltinsAArch64.def
@@ -72,7 +72,7 @@ TARGET_BUILTIN(__builtin_arm_stg, "vv*", "t", "mte")
 TARGET_BUILTIN(__builtin_arm_subp, "Uiv*v*", "t", "mte")
 
 // SME state function
-BUILTIN(__builtin_arm_get_sme_state, "vULi*ULi*", "n")
+BUILTIN(__builtin_arm_get_sme_state, "vWUi*WUi*", "n")
 
 // Memory Operations
 TARGET_BUILTIN(__builtin_arm_mops_memset_tag, "v*v*iz", "", "mte,mops")

@llvmbot
Copy link
Member

llvmbot commented Jun 18, 2024

@llvm/pr-subscribers-clang

Author: Sander de Smalen (sdesmalen-arm)

Changes

Depending on the platform, the parameter for __arm_get_sme_state requires a unsigned long long* instead of a unsigned long*.

From ASTContext.cpp:

case 'W':
// This modifier represents int64 type.


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

1 Files Affected:

  • (modified) clang/include/clang/Basic/BuiltinsAArch64.def (+1-1)
diff --git a/clang/include/clang/Basic/BuiltinsAArch64.def b/clang/include/clang/Basic/BuiltinsAArch64.def
index 5f53c98167dfb..5fb199b1b2b03 100644
--- a/clang/include/clang/Basic/BuiltinsAArch64.def
+++ b/clang/include/clang/Basic/BuiltinsAArch64.def
@@ -72,7 +72,7 @@ TARGET_BUILTIN(__builtin_arm_stg, "vv*", "t", "mte")
 TARGET_BUILTIN(__builtin_arm_subp, "Uiv*v*", "t", "mte")
 
 // SME state function
-BUILTIN(__builtin_arm_get_sme_state, "vULi*ULi*", "n")
+BUILTIN(__builtin_arm_get_sme_state, "vWUi*WUi*", "n")
 
 // Memory Operations
 TARGET_BUILTIN(__builtin_arm_mops_memset_tag, "v*v*iz", "", "mte,mops")

@sdesmalen-arm
Copy link
Collaborator Author

I've tested this change locally, but wasn't sure how to write a test for it.

@jroelofs
Copy link
Contributor

I've tested this change locally, but wasn't sure how to write a test for it.

how about:

void check(uint64_t *a, uint64_t *b) {
    __builtin_arm_get_sme_state(a, b);
}

with a couple of run lines for various platforms? if a and b were unsigned long * you'd get an error about the type mismatch on an LLP64 system like:

error: cannot initialize a parameter of type 'unsigned long long *' with an lvalue of type 'unsigned long *'

Likewise, if they were unsigned long long *, you'd get the error on an LP64 system.

@sdesmalen-arm sdesmalen-arm merged commit 1003f5b into llvm:main Jun 19, 2024
7 checks passed
AlexisPerry pushed a commit to llvm-project-tlp/llvm-project that referenced this pull request Jul 9, 2024
…m#95982)

Depending on the platform, the parameter for __arm_get_sme_state
requires a `unsigned long long*` instead of a `unsigned long*`.

From ASTContext.cpp:

  case 'W':
    // This modifier represents int64 type.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backend:AArch64 clang:frontend Language frontend issues, e.g. anything involving "Sema" clang Clang issues not falling into any other category
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants