LLVM 22.0.0git
MachineFloatingPointPredicateUtils.h
Go to the documentation of this file.
1//===-- MachineFloatingPointModeUtils.h -----*- C++ ---------------------*-===//
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#ifndef LLVM_CODEGEN_MACHINEFLOATINGPOINTPREDICATEUTILS_H
10#define LLVM_CODEGEN_MACHINEFLOATINGPOINTPREDICATEUTILS_H
11
14
15namespace llvm {
16
19
20template <>
22MachineFloatingPointPredicateUtils::queryDenormalMode(const MachineFunction &MF,
23 Register Val);
24
25template <>
26bool MachineFloatingPointPredicateUtils::lookThroughFAbs(
27 const MachineFunction &MF, Register LHS, Register &Src);
28
29template <>
30std::optional<APFloat> MachineFloatingPointPredicateUtils::matchConstantFloat(
31 const MachineFunction &MF, Register Val);
32
33/// Compute the possible floating-point classes that \p LHS could be based on
34/// fcmp \Pred \p LHS, \p RHS.
35///
36/// \returns { TestedValue, ClassesIfTrue, ClassesIfFalse }
37///
38/// If the compare returns an exact class test, ClassesIfTrue ==
39/// ~ClassesIfFalse
40///
41/// This is a less exact version of fcmpToClassTest (e.g. fcmpToClassTest will
42/// only succeed for a test of x > 0 implies positive, but not x > 1).
43///
44/// If \p LookThroughSrc is true, consider the input value when computing the
45/// mask. This may look through sign bit operations.
46///
47/// If \p LookThroughSrc is false, ignore the source value (i.e. the first
48/// pair element will always be LHS.
49///
50inline std::tuple<Register, FPClassTest, FPClassTest>
52 Register LHS, Register RHS, bool LookThroughSrc = true) {
54 Pred, MF, LHS, RHS, LookThroughSrc);
55}
56
57} // namespace llvm
58
59#endif // LLVM_CODEGEN_MACHINEFLOATINGPOINTPREDICATEUTILS_H
Utilities for dealing with flags related to floating point properties and mode controls.
This file declares a specialization of the GenericSSAContext<X> template class for Machine IR.
Value * RHS
Value * LHS
Predicate
This enumeration lists the possible predicates for CmpInst subclasses.
Definition: InstrTypes.h:678
static std::tuple< ValueRefT, FPClassTest, FPClassTest > fcmpImpliesClass(CmpInst::Predicate Pred, const FunctionT &F, ValueRefT LHS, FPClassTest RHSClass, bool LookThroughSrc)
Compute the possible floating-point classes that LHS could be based on fcmp \Pred LHS,...
Wrapper class representing virtual and physical registers.
Definition: Register.h:19
This is an optimization pass for GlobalISel generic memory operations.
Definition: AddressRanges.h:18
std::tuple< Value *, FPClassTest, FPClassTest > fcmpImpliesClass(CmpInst::Predicate Pred, const Function &F, Value *LHS, FPClassTest RHSClass, bool LookThroughSrc=true)
Represent subnormal handling kind for floating point instruction inputs and outputs.