9#ifndef FORTRAN_LOWER_PPCINTRINSICCALL_H
10#define FORTRAN_LOWER_PPCINTRINSICCALL_H
12#include "flang/Common/static-multimap-view.h"
13#include "flang/Optimizer/Builder/IntrinsicCall.h"
14#include "mlir/Dialect/Math/IR/Math.h"
146enum class MMAHandlerOp {
149 SubToFuncReverseArgOnLE,
160 mlir::Type toFirVectorType() {
return fir::VectorType::get(len, eleTy); }
163 mlir::Type toMlirVectorType(mlir::MLIRContext *context) {
165 auto convEleTy{getConvertedElementType(context, eleTy)};
166 return mlir::VectorType::get(len, convEleTy);
169 bool isFloat32() {
return mlir::isa<mlir::Float32Type>(eleTy); }
171 bool isFloat64() {
return mlir::isa<mlir::Float64Type>(eleTy); }
173 bool isFloat() {
return isFloat32() || isFloat64(); }
182static inline VecTypeInfo getVecTypeFromFirType(mlir::Type firTy) {
183 assert(mlir::isa<fir::VectorType>(firTy));
185 vecTyInfo.eleTy = mlir::dyn_cast<fir::VectorType>(firTy).getElementType();
186 vecTyInfo.len = mlir::dyn_cast<fir::VectorType>(firTy).getLen();
190static inline VecTypeInfo getVecTypeFromFir(mlir::Value firVec) {
191 return getVecTypeFromFirType(firVec.getType());
196static inline VecTypeInfo getVecTypeFromEle(mlir::Value ele) {
197 VecTypeInfo vecTyInfo;
198 vecTyInfo.eleTy = ele.getType();
199 vecTyInfo.len = 16 / (vecTyInfo.eleTy.getIntOrFloatBitWidth() / 8);
208 auto ty{vecTyInfo.toMlirVectorType(builder.getContext())};
209 assert(ty &&
"unknown mlir vector type");
210 for (
size_t i = 0; i < args.size(); i++)
218 llvm::SmallVectorImpl<VecTypeInfo> &vecTyInfo,
221 for (
size_t i = 0; i < args.size(); i++) {
222 mlir::Type ty{vecTyInfo[i].toMlirVectorType(builder.getContext())};
223 assert(ty &&
"unknown mlir vector type");
238 bool isBEVecElemOrderOnLE();
239 bool isNativeVecElemOrderOnLE();
240 bool changeVecElemOrder();
243 template <MMAOp IntrId, MMAHandlerOp HandlerOp>
247 template <
bool isImm>
254 genVecAddAndMulSubXor(mlir::Type resultType,
325std::pair<const MathOperation *, const MathOperation *>
326checkPPCMathOperationsRange(llvm::StringRef name);
Definition: BoxValue.h:478
Definition: FIRBuilder.h:55
mlir::Value createConvert(mlir::Location loc, mlir::Type toTy, mlir::Value val)
Lazy creation of fir.convert op.
Definition: FIRBuilder.cpp:511
Definition: AbstractConverter.h:31
MMAOp
Enums used to templatize and share lowering of PowerPC MMA intrinsics.
Definition: PPCIntrinsicCall.h:75
VecOp
Definition: PPCIntrinsicCall.h:20
Definition: IntrinsicCall.h:537
Definition: IntrinsicCall.h:136
Definition: PPCIntrinsicCall.h:229
Definition: PPCIntrinsicCall.h:156