[clang] [CIR] add pairwise-addition-and-widen support (PR #191845)
Andrzej WarzyĆski via cfe-commits
cfe-commits at lists.llvm.org
Thu Apr 16 10:45:34 PDT 2026
================
@@ -659,8 +656,23 @@ static mlir::Value emitCommonNeonBuiltinExpr(
case NEON::BI__builtin_neon_vmull_v:
case NEON::BI__builtin_neon_vpadal_v:
case NEON::BI__builtin_neon_vpadalq_v:
+ // I'm not sure why we have two vpadal case
+ // Seems not come here forever
----------------
banach-space wrote:
This code is located inside [emitCommonNeonBuiltinExpr](https://github.com/llvm/llvm-project/blob/7aa2b040236bfa8b60ebec69af60f5a334ee160e/clang/lib/CIR/CodeGen/CIRGenBuiltinAArch64.cpp?plain=1#L434), which is **invoked in 1 place**:
* [CIRGenFunction::emitAArch64BuiltinExpr](https://github.com/llvm/llvm-project/blob/7aa2b040236bfa8b60ebec69af60f5a334ee160e/clang/lib/CIR/CodeGen/CIRGenBuiltinAArch64.cpp?plain=1#L1596).
`emitCommonNeonBuiltinExpr` is meant to match [CodeGenFunction::EmitCommonNeonBuiltinExpr](https://github.com/llvm/llvm-project/blob/7aa2b040236bfa8b60ebec69af60f5a334ee160e/clang/lib/CodeGen/TargetBuiltins/ARM.cpp?plain=1#L1177) from ARM.cpp (the original implementation), which is **invoked in 2 places**:
* [CodeGenFunction::EmitAArch64BuiltinExp](https://github.com/llvm/llvm-project/blob/7aa2b040236bfa8b60ebec69af60f5a334ee160e/clang/lib/CodeGen/TargetBuiltins/ARM.cpp?plain=1#L4472), and
* [CodeGenFunction::EmitARMBuiltinExpr](https://github.com/llvm/llvm-project/blob/7aa2b040236bfa8b60ebec69af60f5a334ee160e/clang/lib/CodeGen/TargetBuiltins/ARM.cpp?plain=1#L2141-L2144) (see [here](https://github.com/llvm/llvm-project/blob/7aa2b040236bfa8b60ebec69af60f5a334ee160e/clang/lib/CodeGen/TargetBuiltins/ARM.cpp?plain=1#L2703-L2705)).
Only the 2nd call site uses this case:
```cpp
case NEON::BI__builtin_neon_vpadalq_v:
```
Basically, in the context of this function, `NEON::BI__builtin_neon_vpadalq_v` is treated as an ARM rather than AArch64 builtin - we don't support ARM in CIR ATM.
I suggest updating the error message accordingly and removing the comment:
```cpp
cgf.cgm.errorNYI(expr->getSourceRange(),
std::string("Reached code-path for ARM builtin call ") +
ctx.BuiltinInfo.getName(builtinID) + "(ARM builtins are not supported ATM)");
```
Btw, great catch and thanks for pointing this out!
https://github.com/llvm/llvm-project/pull/191845
More information about the cfe-commits
mailing list