xref: /freebsd-src/contrib/llvm-project/llvm/lib/Target/AMDGPU/SIModeRegisterDefaults.cpp (revision 06c3fb2749bda94cb5201f81ffdb8fa6c3161b2e)
1*06c3fb27SDimitry Andric //===-- SIModeRegisterDefaults.cpp ------------------------------*- C++ -*-===//
2*06c3fb27SDimitry Andric //
3*06c3fb27SDimitry Andric // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4*06c3fb27SDimitry Andric // See https://llvm.org/LICENSE.txt for license information.
5*06c3fb27SDimitry Andric // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6*06c3fb27SDimitry Andric //
7*06c3fb27SDimitry Andric //===----------------------------------------------------------------------===//
8*06c3fb27SDimitry Andric 
9*06c3fb27SDimitry Andric #include "SIModeRegisterDefaults.h"
10*06c3fb27SDimitry Andric 
11*06c3fb27SDimitry Andric using namespace llvm;
12*06c3fb27SDimitry Andric 
13*06c3fb27SDimitry Andric SIModeRegisterDefaults::SIModeRegisterDefaults(const Function &F) {
14*06c3fb27SDimitry Andric   *this = getDefaultForCallingConv(F.getCallingConv());
15*06c3fb27SDimitry Andric 
16*06c3fb27SDimitry Andric   StringRef IEEEAttr = F.getFnAttribute("amdgpu-ieee").getValueAsString();
17*06c3fb27SDimitry Andric   if (!IEEEAttr.empty())
18*06c3fb27SDimitry Andric     IEEE = IEEEAttr == "true";
19*06c3fb27SDimitry Andric 
20*06c3fb27SDimitry Andric   StringRef DX10ClampAttr =
21*06c3fb27SDimitry Andric       F.getFnAttribute("amdgpu-dx10-clamp").getValueAsString();
22*06c3fb27SDimitry Andric   if (!DX10ClampAttr.empty())
23*06c3fb27SDimitry Andric     DX10Clamp = DX10ClampAttr == "true";
24*06c3fb27SDimitry Andric 
25*06c3fb27SDimitry Andric   StringRef DenormF32Attr =
26*06c3fb27SDimitry Andric       F.getFnAttribute("denormal-fp-math-f32").getValueAsString();
27*06c3fb27SDimitry Andric   if (!DenormF32Attr.empty())
28*06c3fb27SDimitry Andric     FP32Denormals = parseDenormalFPAttribute(DenormF32Attr);
29*06c3fb27SDimitry Andric 
30*06c3fb27SDimitry Andric   StringRef DenormAttr =
31*06c3fb27SDimitry Andric       F.getFnAttribute("denormal-fp-math").getValueAsString();
32*06c3fb27SDimitry Andric   if (!DenormAttr.empty()) {
33*06c3fb27SDimitry Andric     DenormalMode DenormMode = parseDenormalFPAttribute(DenormAttr);
34*06c3fb27SDimitry Andric     if (DenormF32Attr.empty())
35*06c3fb27SDimitry Andric       FP32Denormals = DenormMode;
36*06c3fb27SDimitry Andric     FP64FP16Denormals = DenormMode;
37*06c3fb27SDimitry Andric   }
38*06c3fb27SDimitry Andric }
39