[clang] [CIR][AArch64] Upstream Neon vget_lane/vgetq_lane builtins (PR #186119)
Andrzej WarzyĆski via cfe-commits
cfe-commits at lists.llvm.org
Mon Mar 23 03:57:15 PDT 2026
================
@@ -2724,33 +2724,111 @@ CIRGenFunction::emitAArch64BuiltinExpr(unsigned builtinID, const CallExpr *expr,
case NEON::BI__builtin_neon_vset_lane_mf8:
case NEON::BI__builtin_neon_vsetq_lane_mf8:
case NEON::BI__builtin_neon_vsetq_lane_f64:
+ cgm.errorNYI(expr->getSourceRange(),
+ std::string("unimplemented AArch64 builtin call: ") +
+ getContext().BuiltinInfo.getName(builtinID));
+ return mlir::Value{};
+
case NEON::BI__builtin_neon_vget_lane_i8:
+ ops[0] = builder.createBitcast(ops[0], cir::VectorType::get(uInt8Ty, 8));
----------------
banach-space wrote:
@andykaylor, could we avoid the cast altogether?
To help understand what is happening here, take this example from the test file:
```c
int8_t test_vget_lane_u8(uint8x8_t a) {
return vget_lane_u8(a, 7);
}
```
Next check the definition of `vget_lane_u8` in `<build-dir>/lib/clang/23/include/arm_neon.h`:
```c
#define vget_lane_u8(__p0, __p1) __extension__ ({ \
iunt8_t __ret; \
uint8x8_t __s0 = __p0; \
__ret = (uint8_t) __builtin_neon_vget_lane_i8((int8x8_t)__s0, __p1); \
__ret; \
})
```
So, this is just casting from unsigned to signed.
**Question:** Do we need to care about the bitcasts? I guess the answer is "yes" if we want CIR to model C++ as accurately as possible?
https://github.com/llvm/llvm-project/pull/186119
More information about the cfe-commits
mailing list