Jlm
Loading...
Searching...
No Matches
SpecializedArithmeticIntrinsicOperations.cpp
Go to the documentation of this file.
1/*
2 * Copyright 2025 Nico Reißmann <nico.reissmann@gmail.com>
3 * See COPYING for terms of redistribution.
4 */
5
7#include <jlm/util/strfmt.hpp>
8
9namespace jlm::llvm
10{
11
13
14bool
15FMulAddIntrinsicOperation::operator==(const Operation & other) const noexcept
16{
17 const auto operation = dynamic_cast<const FMulAddIntrinsicOperation *>(&other);
18 return operation && operation->result(0) == result(0);
19}
20
21std::string
23{
24 return util::strfmt("FMulAddIntrinsic[", result(0)->debug_string(), "]");
25}
26
27std::unique_ptr<rvsdg::Operation>
29{
30 return std::make_unique<FMulAddIntrinsicOperation>(*this);
31}
32
33void
34FMulAddIntrinsicOperation::CheckType(const std::shared_ptr<const rvsdg::Type> & type)
35{
36 std::shared_ptr<const rvsdg::Type> scalarType = type;
37
38 if (const auto vectorType = std::dynamic_pointer_cast<const VectorType>(type))
39 {
40 scalarType = std::static_pointer_cast<const rvsdg::Type>(vectorType->Type());
41 }
42
43 const auto fpType = std::dynamic_pointer_cast<const FloatingPointType>(scalarType);
44 if (!fpType)
45 {
46 throw std::runtime_error(
47 "FMulAddIntrinsicOperation::CheckAndExtractType: Expected floating point type.");
48 }
49}
50
51}
std::unique_ptr< Operation > copy() const override
static void CheckType(const std::shared_ptr< const rvsdg::Type > &type)
~FMulAddIntrinsicOperation() noexcept override
const std::shared_ptr< const rvsdg::Type > & result(size_t index) const noexcept
Definition operation.cpp:36
Global memory state passed between functions.
static std::string strfmt(Args... args)
Definition strfmt.hpp:35