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

[CIR][CIRGen][Builtin][Neon] Lower vaddh_f16, vsubh_f16, vmulh_f16 and vdivh_f16 #1258

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions clang/lib/CIR/CodeGen/CIRGenBuilder.h
Original file line number Diff line number Diff line change
Expand Up @@ -675,6 +675,14 @@ class CIRGenBuilderTy : public cir::CIRBaseBuilderTy {
assert(!cir::MissingFeatures::foldBinOpFMF());
return create<cir::BinOp>(lhs.getLoc(), cir::BinOpKind::Mul, lhs, rhs);
}
mlir::Value createFDiv(mlir::Value lhs, mlir::Value rhs) {
assert(!cir::MissingFeatures::metaDataNode());
if (IsFPConstrained)
llvm_unreachable("Constrained FP NYI");

assert(!cir::MissingFeatures::foldBinOpFMF());
return create<cir::BinOp>(lhs.getLoc(), cir::BinOpKind::Div, lhs, rhs);
}

mlir::Value createDynCast(mlir::Location loc, mlir::Value src,
cir::PointerType destType, bool isRefCast,
Expand Down
24 changes: 16 additions & 8 deletions clang/lib/CIR/CodeGen/CIRGenBuiltinAArch64.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3766,14 +3766,22 @@ CIRGenFunction::emitAArch64BuiltinExpr(unsigned BuiltinID, const CallExpr *E,
Ops[0], cir::VectorType::get(&getMLIRContext(), DoubleTy, 2));
return builder.create<cir::VecExtractOp>(getLoc(E->getExprLoc()), Ops[0],
emitScalarExpr(E->getArg(1)));
case NEON::BI__builtin_neon_vaddh_f16:
llvm_unreachable("NEON::BI__builtin_neon_vaddh_f16 NYI");
case NEON::BI__builtin_neon_vsubh_f16:
llvm_unreachable("NEON::BI__builtin_neon_vsubh_f16 NYI");
case NEON::BI__builtin_neon_vmulh_f16:
llvm_unreachable("NEON::BI__builtin_neon_vmulh_f16 NYI");
case NEON::BI__builtin_neon_vdivh_f16:
llvm_unreachable("NEON::BI__builtin_neon_vdivh_f16 NYI");
case NEON::BI__builtin_neon_vaddh_f16: {
Ops.push_back(emitScalarExpr(E->getArg(1)));
return builder.createFAdd(Ops[0], Ops[1]);
}
case NEON::BI__builtin_neon_vsubh_f16: {
Ops.push_back(emitScalarExpr(E->getArg(1)));
return builder.createFSub(Ops[0], Ops[1]);
}
case NEON::BI__builtin_neon_vmulh_f16: {
Ops.push_back(emitScalarExpr(E->getArg(1)));
return builder.createFMul(Ops[0], Ops[1]);
}
case NEON::BI__builtin_neon_vdivh_f16: {
Ops.push_back(emitScalarExpr(E->getArg(1)));
return builder.createFDiv(Ops[0], Ops[1]);
}
case NEON::BI__builtin_neon_vfmah_f16:
// NEON intrinsic puts accumulator first, unlike the LLVM fma.
llvm_unreachable("NEON::BI__builtin_neon_vfmah_f16 NYI");
Expand Down
Loading
Loading