Skip to content

Commit

Permalink
[CIR][CIRGen][Builtin][Neon] Lower vqrshrun_n and add getAArch64SIMDI…
Browse files Browse the repository at this point in the history
…ntrinsicString (llvm#899)

as title.
In addition, this PR has 2 extra changes.

1. change return type of GetNeonType into mlir::cir::VectorType so we
don't have to do cast all the time, this is consistent with
[OG](https://github.com/llvm/clangir/blob/db6b7c07c076cb738d0acae248d7c3c199b2b952/clang/lib/CodeGen/CGBuiltin.cpp#L6234)
as well.
2. add getAArch64SIMDIntrinsicString helper function so we have better
debug info when hitting NYI in buildCommonNeonBuiltinExpr

---------

Co-authored-by: Guojin He <[email protected]>
  • Loading branch information
2 people authored and smeenai committed Oct 9, 2024
1 parent 594e5fc commit 6580a44
Show file tree
Hide file tree
Showing 3 changed files with 660 additions and 8 deletions.
22 changes: 22 additions & 0 deletions clang/lib/CIR/CodeGen/CIRGenBuilder.h
Original file line number Diff line number Diff line change
Expand Up @@ -372,6 +372,28 @@ class CIRGenBuilderTy : public CIRBaseBuilderTy {
}
bool isInt(mlir::Type i) { return mlir::isa<mlir::cir::IntType>(i); }

mlir::cir::IntType getExtendedIntTy(mlir::cir::IntType ty, bool isSigned) {
if (isInt8Ty(ty)) {
return isSigned ? getSInt16Ty() : getUInt16Ty();
}
if (isInt16Ty(ty)) {
return isSigned ? getSInt32Ty() : getUInt32Ty();
}
if (isInt32Ty(ty)) {
return isSigned ? getSInt64Ty() : getUInt64Ty();
}
llvm_unreachable("NYI");
}

mlir::cir::VectorType getExtendedElementVectorType(mlir::cir::VectorType vt,
bool isSigned = false) {
auto elementTy =
mlir::dyn_cast_or_null<mlir::cir::IntType>(vt.getEltType());
assert(elementTy && "expected int vector");
return mlir::cir::VectorType::get(
getContext(), getExtendedIntTy(elementTy, isSigned), vt.getSize());
}

mlir::cir::LongDoubleType
getLongDoubleTy(const llvm::fltSemantics &format) const {
if (&format == &llvm::APFloat::IEEEdouble())
Expand Down
Loading

0 comments on commit 6580a44

Please sign in to comment.