1 //===-- SIModeRegisterDefaults.cpp ------------------------------*- 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 #include "SIModeRegisterDefaults.h"
10 
11 using namespace llvm;
12 
13 SIModeRegisterDefaults::SIModeRegisterDefaults(const Function &F) {
14   *this = getDefaultForCallingConv(F.getCallingConv());
15 
16   StringRef IEEEAttr = F.getFnAttribute("amdgpu-ieee").getValueAsString();
17   if (!IEEEAttr.empty())
18     IEEE = IEEEAttr == "true";
19 
20   StringRef DX10ClampAttr =
21       F.getFnAttribute("amdgpu-dx10-clamp").getValueAsString();
22   if (!DX10ClampAttr.empty())
23     DX10Clamp = DX10ClampAttr == "true";
24 
25   StringRef DenormF32Attr =
26       F.getFnAttribute("denormal-fp-math-f32").getValueAsString();
27   if (!DenormF32Attr.empty())
28     FP32Denormals = parseDenormalFPAttribute(DenormF32Attr);
29 
30   StringRef DenormAttr =
31       F.getFnAttribute("denormal-fp-math").getValueAsString();
32   if (!DenormAttr.empty()) {
33     DenormalMode DenormMode = parseDenormalFPAttribute(DenormAttr);
34     if (DenormF32Attr.empty())
35       FP32Denormals = DenormMode;
36     FP64FP16Denormals = DenormMode;
37   }
38 }
39