Skip to content
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

[mlir][llvmir] Add SameOperandsAndResultType trait to LLVM_CountZerosIntrOp #131133

Merged
merged 1 commit into from
Mar 23, 2025

Conversation

FantasqueX
Copy link
Contributor

According to https://llvm.org/docs/LangRef.html#llvm-ctlz-intrinsic and https://llvm.org/docs/LangRef.html#llvm-cttz-intrinsic, The return type of llvm.intr.ctlz and llvm.intr.cttz must match the first argument type.

@llvmbot
Copy link
Member

llvmbot commented Mar 13, 2025

@llvm/pr-subscribers-mlir

Author: Letu Ren (FantasqueX)

Changes

According to https://llvm.org/docs/LangRef.html#llvm-ctlz-intrinsic and https://llvm.org/docs/LangRef.html#llvm-cttz-intrinsic, The return type of llvm.intr.ctlz and llvm.intr.cttz must match the first argument type.


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

1 Files Affected:

  • (modified) mlir/include/mlir/Dialect/LLVMIR/LLVMIntrinsicOps.td (+1-1)
diff --git a/mlir/include/mlir/Dialect/LLVMIR/LLVMIntrinsicOps.td b/mlir/include/mlir/Dialect/LLVMIR/LLVMIntrinsicOps.td
index e80745781f566..37193f384174e 100644
--- a/mlir/include/mlir/Dialect/LLVMIR/LLVMIntrinsicOps.td
+++ b/mlir/include/mlir/Dialect/LLVMIR/LLVMIntrinsicOps.td
@@ -86,7 +86,7 @@ class LLVM_TernarySameArgsIntrOpF<string func, list<Trait> traits = []> :
 
 class LLVM_CountZerosIntrOp<string func, list<Trait> traits = []> :
     LLVM_OneResultIntrOp<func, [], [0],
-           !listconcat([Pure], traits),
+           !listconcat([Pure, SameOperandsAndResultType], traits),
             /*requiresFastmath=*/0,
             /*immArgPositions=*/[1], /*immArgAttrNames=*/["is_zero_poison"]> {
   let arguments = (ins LLVM_ScalarOrVectorOf<AnySignlessInteger>:$in,

@llvmbot
Copy link
Member

llvmbot commented Mar 13, 2025

@llvm/pr-subscribers-mlir-llvm

Author: Letu Ren (FantasqueX)

Changes

According to https://llvm.org/docs/LangRef.html#llvm-ctlz-intrinsic and https://llvm.org/docs/LangRef.html#llvm-cttz-intrinsic, The return type of llvm.intr.ctlz and llvm.intr.cttz must match the first argument type.


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

1 Files Affected:

  • (modified) mlir/include/mlir/Dialect/LLVMIR/LLVMIntrinsicOps.td (+1-1)
diff --git a/mlir/include/mlir/Dialect/LLVMIR/LLVMIntrinsicOps.td b/mlir/include/mlir/Dialect/LLVMIR/LLVMIntrinsicOps.td
index e80745781f566..37193f384174e 100644
--- a/mlir/include/mlir/Dialect/LLVMIR/LLVMIntrinsicOps.td
+++ b/mlir/include/mlir/Dialect/LLVMIR/LLVMIntrinsicOps.td
@@ -86,7 +86,7 @@ class LLVM_TernarySameArgsIntrOpF<string func, list<Trait> traits = []> :
 
 class LLVM_CountZerosIntrOp<string func, list<Trait> traits = []> :
     LLVM_OneResultIntrOp<func, [], [0],
-           !listconcat([Pure], traits),
+           !listconcat([Pure, SameOperandsAndResultType], traits),
             /*requiresFastmath=*/0,
             /*immArgPositions=*/[1], /*immArgAttrNames=*/["is_zero_poison"]> {
   let arguments = (ins LLVM_ScalarOrVectorOf<AnySignlessInteger>:$in,

Copy link
Contributor

@gysit gysit left a comment

Choose a reason for hiding this comment

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

Thanks!

LGTM

@Dinistro
Copy link
Contributor

@FantasqueX should this be merged?

@FantasqueX
Copy link
Contributor Author

i think it should. however, i don't have commit access :(

@Dinistro Dinistro merged commit bcd08f4 into llvm:main Mar 23, 2025
14 checks passed
@FantasqueX FantasqueX deleted the same-type-count-zeros-intr-op branch March 23, 2025 11:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants