From 089b7b564b9121aa2e2938d77948bc90a5e44a46 Mon Sep 17 00:00:00 2001 From: Guojin He Date: Thu, 3 Oct 2024 16:04:40 -0400 Subject: [PATCH] just use one version of getExtendedElementVectorType --- clang/lib/CIR/CodeGen/CIRGenBuilder.h | 23 +++---------------- .../lib/CIR/CodeGen/CIRGenBuiltinAArch64.cpp | 3 ++- 2 files changed, 5 insertions(+), 21 deletions(-) diff --git a/clang/lib/CIR/CodeGen/CIRGenBuilder.h b/clang/lib/CIR/CodeGen/CIRGenBuilder.h index b7ceeb285f96..4c182bbaa036 100644 --- a/clang/lib/CIR/CodeGen/CIRGenBuilder.h +++ b/clang/lib/CIR/CodeGen/CIRGenBuilder.h @@ -385,30 +385,13 @@ class CIRGenBuilderTy : public CIRBaseBuilderTy { llvm_unreachable("NYI"); } - static mlir::cir::IntType checkAndGetIntEltTy(mlir::cir::VectorType vt) { + mlir::cir::VectorType getExtendedElementVectorType(mlir::cir::VectorType vt, + bool isSigned = false) { auto elementTy = mlir::dyn_cast_or_null(vt.getEltType()); assert(elementTy && "expected int vector"); - return elementTy; - } - - /// This function `getExtendedElementVectorType` is used to - /// get the vector type of extended int element type for a given vector type. - /// The extended element type has the signess specified. - mlir::cir::VectorType getExtendedElementVectorType(mlir::cir::VectorType vt, - bool isSigned) { - return mlir::cir::VectorType::get( - getContext(), getExtendedIntTy(checkAndGetIntEltTy(vt), isSigned), - vt.getSize()); - } - - /// This version of `getExtendedElementVectorType` is used when signess of - /// extended element type is the same as that of the original element type. - mlir::cir::VectorType getExtendedElementVectorType(mlir::cir::VectorType vt) { - mlir::cir::IntType elementTy = checkAndGetIntEltTy(vt); return mlir::cir::VectorType::get( - getContext(), getExtendedIntTy(elementTy, elementTy.isSigned()), - vt.getSize()); + getContext(), getExtendedIntTy(elementTy, isSigned), vt.getSize()); } mlir::cir::LongDoubleType diff --git a/clang/lib/CIR/CodeGen/CIRGenBuiltinAArch64.cpp b/clang/lib/CIR/CodeGen/CIRGenBuiltinAArch64.cpp index d293d4e8c371..bea8f6e32d68 100644 --- a/clang/lib/CIR/CodeGen/CIRGenBuiltinAArch64.cpp +++ b/clang/lib/CIR/CodeGen/CIRGenBuiltinAArch64.cpp @@ -2232,7 +2232,8 @@ mlir::Value CIRGenFunction::buildCommonNeonBuiltinExpr( default: break; case NEON::BI__builtin_neon_vmovn_v: { - mlir::cir::VectorType qTy = builder.getExtendedElementVectorType(vTy); + mlir::cir::VectorType qTy = builder.getExtendedElementVectorType( + vTy, mlir::cast(vTy.getEltType()).isSigned()); ops[0] = builder.createBitcast(ops[0], qTy); // It really is truncation in this context. // In CIR, integral cast op supports vector of int type truncating.