Path: blob/main/contrib/llvm-project/llvm/lib/Analysis/FloatingPointPredicateUtils.cpp
213764 views
//===- FloatingPointPredicateUtils.cpp ------------------------------------===//1//2// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.3// See https://llvm.org/LICENSE.txt for license information.4// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception5//6//===----------------------------------------------------------------------===//78#include "llvm/Analysis/FloatingPointPredicateUtils.h"9#include "llvm/IR/PatternMatch.h"10#include <optional>1112namespace llvm {1314using namespace PatternMatch;1516template <>17DenormalMode FloatingPointPredicateUtils::queryDenormalMode(const Function &F,18Value *Val) {19Type *Ty = Val->getType()->getScalarType();20return F.getDenormalMode(Ty->getFltSemantics());21}2223template <>24bool FloatingPointPredicateUtils::lookThroughFAbs(const Function &F, Value *LHS,25Value *&Src) {26return match(LHS, m_FAbs(m_Value(Src)));27}2829template <>30std::optional<APFloat>31FloatingPointPredicateUtils::matchConstantFloat(const Function &F, Value *Val) {32const APFloat *ConstVal;3334if (!match(Val, m_APFloatAllowPoison(ConstVal)))35return std::nullopt;3637return *ConstVal;38}3940} // namespace llvm414243