MLIR 24.0.0git
LLVMFloatIntrinsicOps.cpp
Go to the documentation of this file.
1//===- LLVMFloatIntrinsicOps.cpp - LLVM floating-point intrinsics ---------===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8//
9// This file defines the ops of op partition `FloatIntrinsic` of the LLVM
10// dialect.
11//
12//===----------------------------------------------------------------------===//
13
15
16#include "IR/LLVMOps.h"
18
19using namespace mlir;
20using namespace mlir::LLVM;
21
22//===----------------------------------------------------------------------===//
23// SincosOp and ModfOp (intrinsics)
24//===----------------------------------------------------------------------===//
25
27 Type operandType,
28 Type resultType) {
29 auto resultStructType =
30 mlir::dyn_cast<mlir::LLVM::LLVMStructType>(resultType);
31 if (!resultStructType || resultStructType.getBody().size() != 2 ||
32 resultStructType.getBody()[0] != operandType ||
33 resultStructType.getBody()[1] != operandType) {
34 return op->emitOpError(
35 "expected result type to be a homogeneous struct with "
36 "two elements matching the operand type, but got ")
37 << resultType;
38 }
39 return success();
40}
41
42LogicalResult LLVM::SincosOp::verify() {
43 return verifyHomogeneousStructResult(getOperation(), getVal().getType(),
44 getResult().getType());
45}
46
47LogicalResult LLVM::ModfOp::verify() {
48 return verifyHomogeneousStructResult(getOperation(), getVal().getType(),
49 getResult().getType());
50}
51
52#define GET_OP_CLASSES
53#include "mlir/Dialect/LLVMIR/LLVMFloatIntrinsicOps.cpp.inc"
return success()
static LogicalResult verifyHomogeneousStructResult(Operation *op, Type operandType, Type resultType)
Operation is the basic unit of execution within MLIR.
Definition Operation.h:87
InFlightDiagnostic emitOpError(const Twine &message={})
Emit an error with the op name prefixed, like "'dim' op " which is convenient for verifiers.
Instances of the Type class are uniqued, have an immutable identifier and an optional mutable compone...
Definition Types.h:74
Include the generated interface declarations.
Type getType(OpFoldResult ofr)
Returns the int type of the integer in ofr.
Definition Utils.cpp:311