================
@@ -2226,7 +2230,19 @@ CIRGenFunction::emitAArch64BuiltinExpr(unsigned
builtinID, const CallExpr *expr,
default:
return std::nullopt;
case NEON::BI__builtin_neon_vbsl_v:
- case NEON::BI__builtin_neon_vbslq_v:
+ case NEON::BI__builtin_neon_vbslq_v: {
+ cir::VectorType bitTy = ty;
+ if (cir::isAnyFloatingPointType(bitTy.getElementType()))
+ bitTy = castVecOfFPTypeToVecOfIntWithSameWidth(builder, bitTy);
----------------
banach-space wrote:
I know that this has been extracted from the incubator (as in, according to
suggestions in https://github.com/llvm/llvm-project/issues/185382), but in this
case I suggest aligning with the original code-gen instead:
https://github.com/llvm/llvm-project/blob/ed76cbccbb40da23f443ee147d697917c5101e9a/clang/lib/CodeGen/TargetBuiltins/ARM.cpp?plain=1#L6703
Also, note that no casting takes place in
`castVecOfFPTypeToVecOfIntWithSameWidth`, so I suggest renaming it as
`getIntVecFromVecTy`.
```suggestion
cir::VectorType bitTy = getIntVecFromVecTy(ty);
```
`getIntVecFromVecTy` could look like this:
```cpp
static cir::VectorType
getIntVecFromVecTy(CIRGenBuilderTy &builder,
cir::VectorType vecTy) {
if (!cir::isAnyFloatingPointType(bitTy.getElementType()))
return vecTy;
if (mlir::isa<cir::SingleType>(vecTy.getElementType()))
return cir::VectorType::get(builder.getSInt32Ty(), vecTy.getSize());
if (mlir::isa<cir::DoubleType>(vecTy.getElementType()))
return cir::VectorType::get(builder.getSInt64Ty(), vecTy.getSize());
llvm_unreachable(
"Unsupported element type in getVecOfIntTypeWithSameEltWidth");
}
```
WDYT?
https://github.com/llvm/llvm-project/pull/188449
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits