LLVM 17.0.0git
SIModeRegisterDefaults.h
Go to the documentation of this file.
1//===-- SIModeRegisterDefaults.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_LIB_TARGET_AMDGPU_SIMODEREGISTERDEFAULTS_H
10#define LLVM_LIB_TARGET_AMDGPU_SIMODEREGISTERDEFAULTS_H
11
14
15namespace llvm {
16
17// Track defaults for fields in the MODE register.
19 /// Floating point opcodes that support exception flag gathering quiet and
20 /// propagate signaling NaN inputs per IEEE 754-2008. Min_dx10 and max_dx10
21 /// become IEEE 754- 2008 compliant due to signaling NaN propagation and
22 /// quieting.
23 bool IEEE : 1;
24
25 /// Used by the vector ALU to force DX10-style treatment of NaNs: when set,
26 /// clamp NaN to zero; otherwise, pass NaN through.
27 bool DX10Clamp : 1;
28
29 /// If this is set, neither input or output denormals are flushed for most f32
30 /// instructions.
32
33 /// If this is set, neither input or output denormals are flushed for both f64
34 /// and f16/v2f16 instructions.
36
38 IEEE(true),
40 FP32Denormals(DenormalMode::getIEEE()),
41 FP64FP16Denormals(DenormalMode::getIEEE()) {}
42
44
47 Mode.IEEE = !AMDGPU::isShader(CC);
48 return Mode;
49 }
50
52 return IEEE == Other.IEEE && DX10Clamp == Other.DX10Clamp &&
53 FP32Denormals == Other.FP32Denormals &&
54 FP64FP16Denormals == Other.FP64FP16Denormals;
55 }
56
57 bool allFP32Denormals() const {
59 }
60
61 bool allFP64FP16Denormals() const {
63 }
64
65 /// Get the encoding value for the FP_DENORM bits of the mode register for the
66 /// FP32 denormal mode.
73 return FP_DENORM_FLUSH_IN;
75 }
76
77 /// Get the encoding value for the FP_DENORM bits of the mode register for the
78 /// FP64/FP16 denormal mode.
85 return FP_DENORM_FLUSH_IN;
87 }
88
89 // FIXME: Inlining should be OK for dx10-clamp, since the caller's mode should
90 // be able to override.
92 return DX10Clamp == CalleeMode.DX10Clamp && IEEE == CalleeMode.IEEE;
93 }
94};
95
96} // end namespace llvm
97
98#endif // LLVM_LIB_TARGET_AMDGPU_SIMODEREGISTERDEFAULTS_H
basic Basic Alias true
Utilities for dealing with flags related to floating point properties and mode controls.
#define F(x, y, z)
Definition: MD5.cpp:55
static cl::opt< RegAllocEvictionAdvisorAnalysis::AdvisorMode > Mode("regalloc-enable-advisor", cl::Hidden, cl::init(RegAllocEvictionAdvisorAnalysis::AdvisorMode::Default), cl::desc("Enable regalloc advisor mode"), cl::values(clEnumValN(RegAllocEvictionAdvisorAnalysis::AdvisorMode::Default, "default", "Default"), clEnumValN(RegAllocEvictionAdvisorAnalysis::AdvisorMode::Release, "release", "precompiled"), clEnumValN(RegAllocEvictionAdvisorAnalysis::AdvisorMode::Development, "development", "for training")))
#define FP_DENORM_FLUSH_OUT
Definition: SIDefines.h:1052
#define FP_DENORM_FLUSH_NONE
Definition: SIDefines.h:1054
#define FP_DENORM_FLUSH_IN_FLUSH_OUT
Definition: SIDefines.h:1051
#define FP_DENORM_FLUSH_IN
Definition: SIDefines.h:1053
bool isShader(CallingConv::ID cc)
This is an optimization pass for GlobalISel generic memory operations.
Definition: AddressRanges.h:18
Represent subnormal handling kind for floating point instruction inputs and outputs.
DenormalModeKind Input
Denormal treatment kind for floating point instruction inputs in the default floating-point environme...
@ PreserveSign
The sign of a flushed-to-zero number is preserved in the sign of 0.
static constexpr DenormalMode getPreserveSign()
DenormalModeKind Output
Denormal flushing mode for floating point instruction results in the default floating point environme...
static constexpr DenormalMode getIEEE()
bool DX10Clamp
Used by the vector ALU to force DX10-style treatment of NaNs: when set, clamp NaN to zero; otherwise,...
uint32_t fpDenormModeSPValue() const
Get the encoding value for the FP_DENORM bits of the mode register for the FP32 denormal mode.
DenormalMode FP64FP16Denormals
If this is set, neither input or output denormals are flushed for both f64 and f16/v2f16 instructions...
bool IEEE
Floating point opcodes that support exception flag gathering quiet and propagate signaling NaN inputs...
static SIModeRegisterDefaults getDefaultForCallingConv(CallingConv::ID CC)
uint32_t fpDenormModeDPValue() const
Get the encoding value for the FP_DENORM bits of the mode register for the FP64/FP16 denormal mode.
bool isInlineCompatible(SIModeRegisterDefaults CalleeMode) const
bool operator==(const SIModeRegisterDefaults Other) const
DenormalMode FP32Denormals
If this is set, neither input or output denormals are flushed for most f32 instructions.