blob: f78dadd447ff5d257ed3085f980f57f36bfc7312 [file] [log] [blame]
Eugene Zelenkod96089b2017-02-14 00:33:36 +00001//===- AMDGPUBaseInfo.h - Top level definitions for AMDGPU ------*- C++ -*-===//
Tom Stellard347ac792015-06-26 21:15:07 +00002//
Chandler Carruth2946cd72019-01-19 08:50:56 +00003// 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
Tom Stellard347ac792015-06-26 21:15:07 +00006//
7//===----------------------------------------------------------------------===//
8
9#ifndef LLVM_LIB_TARGET_AMDGPU_UTILS_AMDGPUBASEINFO_H
10#define LLVM_LIB_TARGET_AMDGPU_UTILS_AMDGPUBASEINFO_H
11
Yaxun Liu1a14bfa2017-03-27 14:04:01 +000012#include "AMDGPU.h"
Tom Stellard347ac792015-06-26 21:15:07 +000013#include "AMDKernelCodeT.h"
Matt Arsenault4bd72362016-12-10 00:39:12 +000014#include "SIDefines.h"
Eugene Zelenkod96089b2017-02-14 00:33:36 +000015#include "llvm/ADT/StringRef.h"
16#include "llvm/IR/CallingConv.h"
17#include "llvm/MC/MCInstrDesc.h"
Scott Linder1e8c2c72018-06-21 19:38:56 +000018#include "llvm/Support/AMDHSAKernelDescriptor.h"
Eugene Zelenkod96089b2017-02-14 00:33:36 +000019#include "llvm/Support/Compiler.h"
20#include "llvm/Support/ErrorHandling.h"
Konstantin Zhuravlyov71e43ee2018-09-12 18:50:47 +000021#include "llvm/Support/TargetParser.h"
Eugene Zelenkod96089b2017-02-14 00:33:36 +000022#include <cstdint>
Konstantin Zhuravlyov9c05b2b2017-10-14 15:40:33 +000023#include <string>
Eugene Zelenkod96089b2017-02-14 00:33:36 +000024#include <utility>
Matt Arsenault4bd72362016-12-10 00:39:12 +000025
Tom Stellard347ac792015-06-26 21:15:07 +000026namespace llvm {
27
Matt Arsenault894e53d2017-07-26 20:39:42 +000028class Argument;
Tim Renouf4f703f52018-08-21 11:07:10 +000029class AMDGPUSubtarget;
Tom Stellard347ac792015-06-26 21:15:07 +000030class FeatureBitset;
Tom Stellardac00eb52015-12-15 16:26:16 +000031class Function;
Tim Renouf4f703f52018-08-21 11:07:10 +000032class GCNSubtarget;
Tom Stellarde3b5aea2015-12-02 17:00:42 +000033class GlobalValue;
Tom Stellarde135ffd2015-09-25 21:41:28 +000034class MCContext;
Krzysztof Parzyszekc8715502016-10-19 17:40:36 +000035class MCRegisterClass;
Sam Kolton1eeb11b2016-09-09 14:44:04 +000036class MCRegisterInfo;
Tom Stellarde135ffd2015-09-25 21:41:28 +000037class MCSection;
Tom Stellard2b65ed32015-12-21 18:44:27 +000038class MCSubtargetInfo;
Scott Linder1e8c2c72018-06-21 19:38:56 +000039class MachineMemOperand;
Eugene Zelenkod96089b2017-02-14 00:33:36 +000040class Triple;
Tom Stellard347ac792015-06-26 21:15:07 +000041
42namespace AMDGPU {
Nicolai Haehnle0ab200b2018-06-21 13:36:44 +000043
44#define GET_MIMGBaseOpcode_DECL
Nicolai Haehnle7a9c03f2018-06-21 13:36:57 +000045#define GET_MIMGDim_DECL
Nicolai Haehnle0ab200b2018-06-21 13:36:44 +000046#define GET_MIMGEncoding_DECL
Ryan Taylor894c8fd2018-08-01 12:12:01 +000047#define GET_MIMGLZMapping_DECL
Piotr Sobczak9b11e932019-06-10 15:58:51 +000048#define GET_MIMGMIPMapping_DECL
Nicolai Haehnle0ab200b2018-06-21 13:36:44 +000049#include "AMDGPUGenSearchableTables.inc"
50
Konstantin Zhuravlyov9f89ede2017-02-08 14:05:23 +000051namespace IsaInfo {
Sam Koltona3ec5c12016-10-07 14:46:06 +000052
Konstantin Zhuravlyov9f89ede2017-02-08 14:05:23 +000053enum {
54 // The closed Vulkan driver sets 96, which limits the wave count to 8 but
55 // doesn't spill SGPRs as much as when 80 is set.
Konstantin Zhuravlyovc72ece62018-05-16 20:47:48 +000056 FIXED_NUM_SGPRS_FOR_INIT_BUG = 96,
57 TRAP_NUM_SGPRS = 16
Konstantin Zhuravlyov9f89ede2017-02-08 14:05:23 +000058};
59
Adrian Prantl5f8f34e42018-05-01 15:54:18 +000060/// Streams isa version string for given subtarget \p STI into \p Stream.
Konstantin Zhuravlyov9c05b2b2017-10-14 15:40:33 +000061void streamIsaVersion(const MCSubtargetInfo *STI, raw_ostream &Stream);
62
Konstantin Zhuravlyov00f2cb12018-06-12 18:02:46 +000063/// \returns True if given subtarget \p STI supports code object version 3,
Konstantin Zhuravlyoveda425e2017-10-14 15:59:07 +000064/// false otherwise.
Konstantin Zhuravlyov00f2cb12018-06-12 18:02:46 +000065bool hasCodeObjectV3(const MCSubtargetInfo *STI);
Konstantin Zhuravlyoveda425e2017-10-14 15:59:07 +000066
Konstantin Zhuravlyov71e43ee2018-09-12 18:50:47 +000067/// \returns Wavefront size for given subtarget \p STI.
68unsigned getWavefrontSize(const MCSubtargetInfo *STI);
Konstantin Zhuravlyov9f89ede2017-02-08 14:05:23 +000069
Konstantin Zhuravlyov71e43ee2018-09-12 18:50:47 +000070/// \returns Local memory size in bytes for given subtarget \p STI.
71unsigned getLocalMemorySize(const MCSubtargetInfo *STI);
Konstantin Zhuravlyov9f89ede2017-02-08 14:05:23 +000072
73/// \returns Number of execution units per compute unit for given subtarget \p
Konstantin Zhuravlyov71e43ee2018-09-12 18:50:47 +000074/// STI.
75unsigned getEUsPerCU(const MCSubtargetInfo *STI);
Konstantin Zhuravlyov9f89ede2017-02-08 14:05:23 +000076
77/// \returns Maximum number of work groups per compute unit for given subtarget
Konstantin Zhuravlyov71e43ee2018-09-12 18:50:47 +000078/// \p STI and limited by given \p FlatWorkGroupSize.
79unsigned getMaxWorkGroupsPerCU(const MCSubtargetInfo *STI,
Konstantin Zhuravlyov9f89ede2017-02-08 14:05:23 +000080 unsigned FlatWorkGroupSize);
81
82/// \returns Maximum number of waves per compute unit for given subtarget \p
Konstantin Zhuravlyov71e43ee2018-09-12 18:50:47 +000083/// STI without any kind of limitation.
84unsigned getMaxWavesPerCU(const MCSubtargetInfo *STI);
Konstantin Zhuravlyov9f89ede2017-02-08 14:05:23 +000085
86/// \returns Maximum number of waves per compute unit for given subtarget \p
Konstantin Zhuravlyov71e43ee2018-09-12 18:50:47 +000087/// STI and limited by given \p FlatWorkGroupSize.
88unsigned getMaxWavesPerCU(const MCSubtargetInfo *STI,
Konstantin Zhuravlyov9f89ede2017-02-08 14:05:23 +000089 unsigned FlatWorkGroupSize);
90
91/// \returns Minimum number of waves per execution unit for given subtarget \p
Konstantin Zhuravlyov71e43ee2018-09-12 18:50:47 +000092/// STI.
93unsigned getMinWavesPerEU(const MCSubtargetInfo *STI);
Konstantin Zhuravlyov9f89ede2017-02-08 14:05:23 +000094
95/// \returns Maximum number of waves per execution unit for given subtarget \p
Konstantin Zhuravlyov71e43ee2018-09-12 18:50:47 +000096/// STI without any kind of limitation.
Stanislav Mekhanoshin7b5a54e2019-07-19 21:29:51 +000097unsigned getMaxWavesPerEU(const MCSubtargetInfo *STI);
Konstantin Zhuravlyov9f89ede2017-02-08 14:05:23 +000098
99/// \returns Maximum number of waves per execution unit for given subtarget \p
Konstantin Zhuravlyov71e43ee2018-09-12 18:50:47 +0000100/// STI and limited by given \p FlatWorkGroupSize.
101unsigned getMaxWavesPerEU(const MCSubtargetInfo *STI,
Konstantin Zhuravlyov9f89ede2017-02-08 14:05:23 +0000102 unsigned FlatWorkGroupSize);
103
Konstantin Zhuravlyov71e43ee2018-09-12 18:50:47 +0000104/// \returns Minimum flat work group size for given subtarget \p STI.
105unsigned getMinFlatWorkGroupSize(const MCSubtargetInfo *STI);
Konstantin Zhuravlyov9f89ede2017-02-08 14:05:23 +0000106
Konstantin Zhuravlyov71e43ee2018-09-12 18:50:47 +0000107/// \returns Maximum flat work group size for given subtarget \p STI.
108unsigned getMaxFlatWorkGroupSize(const MCSubtargetInfo *STI);
Konstantin Zhuravlyov9f89ede2017-02-08 14:05:23 +0000109
Konstantin Zhuravlyov71e43ee2018-09-12 18:50:47 +0000110/// \returns Number of waves per work group for given subtarget \p STI and
Konstantin Zhuravlyov9f89ede2017-02-08 14:05:23 +0000111/// limited by given \p FlatWorkGroupSize.
Konstantin Zhuravlyov71e43ee2018-09-12 18:50:47 +0000112unsigned getWavesPerWorkGroup(const MCSubtargetInfo *STI,
Konstantin Zhuravlyov9f89ede2017-02-08 14:05:23 +0000113 unsigned FlatWorkGroupSize);
114
Konstantin Zhuravlyov71e43ee2018-09-12 18:50:47 +0000115/// \returns SGPR allocation granularity for given subtarget \p STI.
116unsigned getSGPRAllocGranule(const MCSubtargetInfo *STI);
Konstantin Zhuravlyov9f89ede2017-02-08 14:05:23 +0000117
Konstantin Zhuravlyov71e43ee2018-09-12 18:50:47 +0000118/// \returns SGPR encoding granularity for given subtarget \p STI.
119unsigned getSGPREncodingGranule(const MCSubtargetInfo *STI);
Konstantin Zhuravlyov9f89ede2017-02-08 14:05:23 +0000120
Konstantin Zhuravlyov71e43ee2018-09-12 18:50:47 +0000121/// \returns Total number of SGPRs for given subtarget \p STI.
122unsigned getTotalNumSGPRs(const MCSubtargetInfo *STI);
Konstantin Zhuravlyov9f89ede2017-02-08 14:05:23 +0000123
Konstantin Zhuravlyov71e43ee2018-09-12 18:50:47 +0000124/// \returns Addressable number of SGPRs for given subtarget \p STI.
125unsigned getAddressableNumSGPRs(const MCSubtargetInfo *STI);
Konstantin Zhuravlyov9f89ede2017-02-08 14:05:23 +0000126
127/// \returns Minimum number of SGPRs that meets the given number of waves per
Konstantin Zhuravlyov71e43ee2018-09-12 18:50:47 +0000128/// execution unit requirement for given subtarget \p STI.
129unsigned getMinNumSGPRs(const MCSubtargetInfo *STI, unsigned WavesPerEU);
Konstantin Zhuravlyov9f89ede2017-02-08 14:05:23 +0000130
131/// \returns Maximum number of SGPRs that meets the given number of waves per
Konstantin Zhuravlyov71e43ee2018-09-12 18:50:47 +0000132/// execution unit requirement for given subtarget \p STI.
133unsigned getMaxNumSGPRs(const MCSubtargetInfo *STI, unsigned WavesPerEU,
Konstantin Zhuravlyov9f89ede2017-02-08 14:05:23 +0000134 bool Addressable);
135
Scott Linder1e8c2c72018-06-21 19:38:56 +0000136/// \returns Number of extra SGPRs implicitly required by given subtarget \p
Konstantin Zhuravlyov71e43ee2018-09-12 18:50:47 +0000137/// STI when the given special registers are used.
138unsigned getNumExtraSGPRs(const MCSubtargetInfo *STI, bool VCCUsed,
Scott Linder1e8c2c72018-06-21 19:38:56 +0000139 bool FlatScrUsed, bool XNACKUsed);
140
141/// \returns Number of extra SGPRs implicitly required by given subtarget \p
Konstantin Zhuravlyov71e43ee2018-09-12 18:50:47 +0000142/// STI when the given special registers are used. XNACK is inferred from
143/// \p STI.
144unsigned getNumExtraSGPRs(const MCSubtargetInfo *STI, bool VCCUsed,
Scott Linder1e8c2c72018-06-21 19:38:56 +0000145 bool FlatScrUsed);
146
Konstantin Zhuravlyov71e43ee2018-09-12 18:50:47 +0000147/// \returns Number of SGPR blocks needed for given subtarget \p STI when
Scott Linder1e8c2c72018-06-21 19:38:56 +0000148/// \p NumSGPRs are used. \p NumSGPRs should already include any special
149/// register counts.
Konstantin Zhuravlyov71e43ee2018-09-12 18:50:47 +0000150unsigned getNumSGPRBlocks(const MCSubtargetInfo *STI, unsigned NumSGPRs);
Scott Linder1e8c2c72018-06-21 19:38:56 +0000151
Konstantin Zhuravlyov71e43ee2018-09-12 18:50:47 +0000152/// \returns VGPR allocation granularity for given subtarget \p STI.
Stanislav Mekhanoshin8bcc9bb2019-06-13 19:18:29 +0000153///
154/// For subtargets which support it, \p EnableWavefrontSize32 should match
155/// the ENABLE_WAVEFRONT_SIZE32 kernel descriptor field.
156unsigned getVGPRAllocGranule(const MCSubtargetInfo *STI,
157 Optional<bool> EnableWavefrontSize32 = None);
Konstantin Zhuravlyov9f89ede2017-02-08 14:05:23 +0000158
Konstantin Zhuravlyov71e43ee2018-09-12 18:50:47 +0000159/// \returns VGPR encoding granularity for given subtarget \p STI.
Stanislav Mekhanoshin8bcc9bb2019-06-13 19:18:29 +0000160///
161/// For subtargets which support it, \p EnableWavefrontSize32 should match
162/// the ENABLE_WAVEFRONT_SIZE32 kernel descriptor field.
163unsigned getVGPREncodingGranule(const MCSubtargetInfo *STI,
164 Optional<bool> EnableWavefrontSize32 = None);
Konstantin Zhuravlyov9f89ede2017-02-08 14:05:23 +0000165
Konstantin Zhuravlyov71e43ee2018-09-12 18:50:47 +0000166/// \returns Total number of VGPRs for given subtarget \p STI.
167unsigned getTotalNumVGPRs(const MCSubtargetInfo *STI);
Konstantin Zhuravlyov9f89ede2017-02-08 14:05:23 +0000168
Konstantin Zhuravlyov71e43ee2018-09-12 18:50:47 +0000169/// \returns Addressable number of VGPRs for given subtarget \p STI.
170unsigned getAddressableNumVGPRs(const MCSubtargetInfo *STI);
Konstantin Zhuravlyov9f89ede2017-02-08 14:05:23 +0000171
172/// \returns Minimum number of VGPRs that meets given number of waves per
Konstantin Zhuravlyov71e43ee2018-09-12 18:50:47 +0000173/// execution unit requirement for given subtarget \p STI.
174unsigned getMinNumVGPRs(const MCSubtargetInfo *STI, unsigned WavesPerEU);
Konstantin Zhuravlyov9f89ede2017-02-08 14:05:23 +0000175
176/// \returns Maximum number of VGPRs that meets given number of waves per
Konstantin Zhuravlyov71e43ee2018-09-12 18:50:47 +0000177/// execution unit requirement for given subtarget \p STI.
178unsigned getMaxNumVGPRs(const MCSubtargetInfo *STI, unsigned WavesPerEU);
Konstantin Zhuravlyov9f89ede2017-02-08 14:05:23 +0000179
Konstantin Zhuravlyov71e43ee2018-09-12 18:50:47 +0000180/// \returns Number of VGPR blocks needed for given subtarget \p STI when
Scott Linder1e8c2c72018-06-21 19:38:56 +0000181/// \p NumVGPRs are used.
Stanislav Mekhanoshin8bcc9bb2019-06-13 19:18:29 +0000182///
183/// For subtargets which support it, \p EnableWavefrontSize32 should match the
184/// ENABLE_WAVEFRONT_SIZE32 kernel descriptor field.
185unsigned getNumVGPRBlocks(const MCSubtargetInfo *STI, unsigned NumSGPRs,
186 Optional<bool> EnableWavefrontSize32 = None);
Scott Linder1e8c2c72018-06-21 19:38:56 +0000187
Eugene Zelenkod96089b2017-02-14 00:33:36 +0000188} // end namespace IsaInfo
Konstantin Zhuravlyov9f89ede2017-02-08 14:05:23 +0000189
190LLVM_READONLY
191int16_t getNamedOperandIdx(uint16_t Opcode, uint16_t NamedIdx);
192
Ryan Taylor9ab812d2019-06-26 17:34:57 +0000193LLVM_READONLY
194int getSOPPWithRelaxation(uint16_t Opcode);
195
Nicolai Haehnle7a9c03f2018-06-21 13:36:57 +0000196struct MIMGBaseOpcodeInfo {
197 MIMGBaseOpcode BaseOpcode;
198 bool Store;
199 bool Atomic;
200 bool AtomicX2;
201 bool Sampler;
David Stuttardf77079f2019-01-14 11:55:24 +0000202 bool Gather4;
Nicolai Haehnle7a9c03f2018-06-21 13:36:57 +0000203
204 uint8_t NumExtraArgs;
205 bool Gradients;
206 bool Coordinates;
207 bool LodOrClampOrMip;
208 bool HasD16;
209};
210
211LLVM_READONLY
212const MIMGBaseOpcodeInfo *getMIMGBaseOpcodeInfo(unsigned BaseOpcode);
213
214struct MIMGDimInfo {
215 MIMGDim Dim;
216 uint8_t NumCoords;
217 uint8_t NumGradients;
218 bool DA;
Stanislav Mekhanoshin692560d2019-05-01 16:32:58 +0000219 uint8_t Encoding;
220 const char *AsmSuffix;
Nicolai Haehnle7a9c03f2018-06-21 13:36:57 +0000221};
222
223LLVM_READONLY
Stanislav Mekhanoshin956b0be2019-04-25 18:53:41 +0000224const MIMGDimInfo *getMIMGDimInfo(unsigned DimEnum);
225
226LLVM_READONLY
227const MIMGDimInfo *getMIMGDimInfoByEncoding(uint8_t DimEnc);
228
229LLVM_READONLY
230const MIMGDimInfo *getMIMGDimInfoByAsmSuffix(StringRef AsmSuffix);
Nicolai Haehnle7a9c03f2018-06-21 13:36:57 +0000231
Ryan Taylor894c8fd2018-08-01 12:12:01 +0000232struct MIMGLZMappingInfo {
233 MIMGBaseOpcode L;
234 MIMGBaseOpcode LZ;
235};
236
Piotr Sobczak9b11e932019-06-10 15:58:51 +0000237struct MIMGMIPMappingInfo {
238 MIMGBaseOpcode MIP;
239 MIMGBaseOpcode NONMIP;
240};
241
Ryan Taylor894c8fd2018-08-01 12:12:01 +0000242LLVM_READONLY
243const MIMGLZMappingInfo *getMIMGLZMappingInfo(unsigned L);
244
Nicolai Haehnle7a9c03f2018-06-21 13:36:57 +0000245LLVM_READONLY
Piotr Sobczak9b11e932019-06-10 15:58:51 +0000246const MIMGMIPMappingInfo *getMIMGMIPMappingInfo(unsigned L);
247
248LLVM_READONLY
Nicolai Haehnle7a9c03f2018-06-21 13:36:57 +0000249int getMIMGOpcode(unsigned BaseOpcode, unsigned MIMGEncoding,
250 unsigned VDataDwords, unsigned VAddrDwords);
251
Matt Arsenaultcad7fa82017-12-13 21:07:51 +0000252LLVM_READONLY
Nicolai Haehnle0ab200b2018-06-21 13:36:44 +0000253int getMaskedMIMGOp(unsigned Opc, unsigned NewChannels);
Nicolai Haehnlef2674312018-06-21 13:36:01 +0000254
Stanislav Mekhanoshin956b0be2019-04-25 18:53:41 +0000255struct MIMGInfo {
256 uint16_t Opcode;
257 uint16_t BaseOpcode;
258 uint8_t MIMGEncoding;
259 uint8_t VDataDwords;
260 uint8_t VAddrDwords;
261};
262
263LLVM_READONLY
264const MIMGInfo *getMIMGInfo(unsigned Opc);
265
Nicolai Haehnlef2674312018-06-21 13:36:01 +0000266LLVM_READONLY
Piotr Sobczak265e94e2019-10-02 17:22:36 +0000267int getMTBUFBaseOpcode(unsigned Opc);
268
269LLVM_READONLY
270int getMTBUFOpcode(unsigned BaseOpc, unsigned Elements);
271
272LLVM_READONLY
273int getMTBUFElements(unsigned Opc);
274
275LLVM_READONLY
276bool getMTBUFHasVAddr(unsigned Opc);
277
278LLVM_READONLY
279bool getMTBUFHasSrsrc(unsigned Opc);
280
281LLVM_READONLY
282bool getMTBUFHasSoffset(unsigned Opc);
283
284LLVM_READONLY
Neil Henning76504a42018-12-12 16:15:21 +0000285int getMUBUFBaseOpcode(unsigned Opc);
286
287LLVM_READONLY
Matt Arsenaultcfdc2b92019-08-18 00:20:43 +0000288int getMUBUFOpcode(unsigned BaseOpc, unsigned Elements);
Neil Henning76504a42018-12-12 16:15:21 +0000289
290LLVM_READONLY
Matt Arsenaultcfdc2b92019-08-18 00:20:43 +0000291int getMUBUFElements(unsigned Opc);
Neil Henning76504a42018-12-12 16:15:21 +0000292
293LLVM_READONLY
294bool getMUBUFHasVAddr(unsigned Opc);
295
296LLVM_READONLY
297bool getMUBUFHasSrsrc(unsigned Opc);
298
299LLVM_READONLY
300bool getMUBUFHasSoffset(unsigned Opc);
301
302LLVM_READONLY
Matt Arsenaultcad7fa82017-12-13 21:07:51 +0000303int getMCOpcode(uint16_t Opcode, unsigned Gen);
304
Tom Stellardff7416b2015-06-26 21:58:31 +0000305void initDefaultAMDKernelCodeT(amd_kernel_code_t &Header,
Konstantin Zhuravlyov71e43ee2018-09-12 18:50:47 +0000306 const MCSubtargetInfo *STI);
Tom Stellard9760f032015-12-03 03:34:32 +0000307
Stanislav Mekhanoshincee607e2019-04-24 17:03:15 +0000308amdhsa::kernel_descriptor_t getDefaultAmdhsaKernelDescriptor(
309 const MCSubtargetInfo *STI);
Scott Linder1e8c2c72018-06-21 19:38:56 +0000310
Konstantin Zhuravlyov435151a2017-11-01 19:12:38 +0000311bool isGroupSegment(const GlobalValue *GV);
312bool isGlobalSegment(const GlobalValue *GV);
313bool isReadOnlySegment(const GlobalValue *GV);
Tom Stellarde3b5aea2015-12-02 17:00:42 +0000314
Konstantin Zhuravlyov08326b62016-10-20 18:12:38 +0000315/// \returns True if constants should be emitted to .text section for given
316/// target triple \p TT, false otherwise.
317bool shouldEmitConstantsToTextSection(const Triple &TT);
318
Konstantin Zhuravlyov1d650262016-09-06 20:22:28 +0000319/// \returns Integer value requested using \p F's \p Name attribute.
320///
321/// \returns \p Default if attribute is not present.
322///
323/// \returns \p Default and emits error if requested value cannot be converted
324/// to integer.
Matt Arsenault83002722016-05-12 02:45:18 +0000325int getIntegerAttribute(const Function &F, StringRef Name, int Default);
326
Konstantin Zhuravlyov1d650262016-09-06 20:22:28 +0000327/// \returns A pair of integer values requested using \p F's \p Name attribute
328/// in "first[,second]" format ("second" is optional unless \p OnlyFirstRequired
329/// is false).
330///
331/// \returns \p Default if attribute is not present.
332///
333/// \returns \p Default and emits error if one of the requested values cannot be
334/// converted to integer, or \p OnlyFirstRequired is false and "second" value is
335/// not present.
336std::pair<int, int> getIntegerPairAttribute(const Function &F,
337 StringRef Name,
338 std::pair<int, int> Default,
339 bool OnlyFirstRequired = false);
340
Nicolai Haehnle1a94cbb2018-11-29 11:06:06 +0000341/// Represents the counter values to wait for in an s_waitcnt instruction.
342///
343/// Large values (including the maximum possible integer) can be used to
344/// represent "don't care" waits.
345struct Waitcnt {
346 unsigned VmCnt = ~0u;
347 unsigned ExpCnt = ~0u;
348 unsigned LgkmCnt = ~0u;
Stanislav Mekhanoshin956b0be2019-04-25 18:53:41 +0000349 unsigned VsCnt = ~0u;
Nicolai Haehnle1a94cbb2018-11-29 11:06:06 +0000350
351 Waitcnt() {}
Stanislav Mekhanoshin956b0be2019-04-25 18:53:41 +0000352 Waitcnt(unsigned VmCnt, unsigned ExpCnt, unsigned LgkmCnt, unsigned VsCnt)
353 : VmCnt(VmCnt), ExpCnt(ExpCnt), LgkmCnt(LgkmCnt), VsCnt(VsCnt) {}
Nicolai Haehnle1a94cbb2018-11-29 11:06:06 +0000354
Stanislav Mekhanoshin956b0be2019-04-25 18:53:41 +0000355 static Waitcnt allZero(const IsaVersion &Version) {
356 return Waitcnt(0, 0, 0, Version.Major >= 10 ? 0 : ~0u);
357 }
358 static Waitcnt allZeroExceptVsCnt() { return Waitcnt(0, 0, 0, ~0u); }
359
360 bool hasWait() const {
361 return VmCnt != ~0u || ExpCnt != ~0u || LgkmCnt != ~0u || VsCnt != ~0u;
362 }
Nicolai Haehnle1a94cbb2018-11-29 11:06:06 +0000363
364 bool dominates(const Waitcnt &Other) const {
365 return VmCnt <= Other.VmCnt && ExpCnt <= Other.ExpCnt &&
Stanislav Mekhanoshin956b0be2019-04-25 18:53:41 +0000366 LgkmCnt <= Other.LgkmCnt && VsCnt <= Other.VsCnt;
Nicolai Haehnle1a94cbb2018-11-29 11:06:06 +0000367 }
368
369 Waitcnt combined(const Waitcnt &Other) const {
370 return Waitcnt(std::min(VmCnt, Other.VmCnt), std::min(ExpCnt, Other.ExpCnt),
Stanislav Mekhanoshin956b0be2019-04-25 18:53:41 +0000371 std::min(LgkmCnt, Other.LgkmCnt),
372 std::min(VsCnt, Other.VsCnt));
Nicolai Haehnle1a94cbb2018-11-29 11:06:06 +0000373 }
374};
375
Konstantin Zhuravlyovcdd45472016-10-11 18:58:22 +0000376/// \returns Vmcnt bit mask for given isa \p Version.
Konstantin Zhuravlyov71e43ee2018-09-12 18:50:47 +0000377unsigned getVmcntBitMask(const IsaVersion &Version);
Konstantin Zhuravlyov836cbff2016-09-30 17:01:40 +0000378
Konstantin Zhuravlyovcdd45472016-10-11 18:58:22 +0000379/// \returns Expcnt bit mask for given isa \p Version.
Konstantin Zhuravlyov71e43ee2018-09-12 18:50:47 +0000380unsigned getExpcntBitMask(const IsaVersion &Version);
Konstantin Zhuravlyov836cbff2016-09-30 17:01:40 +0000381
Konstantin Zhuravlyovcdd45472016-10-11 18:58:22 +0000382/// \returns Lgkmcnt bit mask for given isa \p Version.
Konstantin Zhuravlyov71e43ee2018-09-12 18:50:47 +0000383unsigned getLgkmcntBitMask(const IsaVersion &Version);
Konstantin Zhuravlyov9f89ede2017-02-08 14:05:23 +0000384
385/// \returns Waitcnt bit mask for given isa \p Version.
Konstantin Zhuravlyov71e43ee2018-09-12 18:50:47 +0000386unsigned getWaitcntBitMask(const IsaVersion &Version);
Konstantin Zhuravlyov836cbff2016-09-30 17:01:40 +0000387
Konstantin Zhuravlyovcdd45472016-10-11 18:58:22 +0000388/// \returns Decoded Vmcnt from given \p Waitcnt for given isa \p Version.
Konstantin Zhuravlyov71e43ee2018-09-12 18:50:47 +0000389unsigned decodeVmcnt(const IsaVersion &Version, unsigned Waitcnt);
Konstantin Zhuravlyov836cbff2016-09-30 17:01:40 +0000390
Konstantin Zhuravlyovcdd45472016-10-11 18:58:22 +0000391/// \returns Decoded Expcnt from given \p Waitcnt for given isa \p Version.
Konstantin Zhuravlyov71e43ee2018-09-12 18:50:47 +0000392unsigned decodeExpcnt(const IsaVersion &Version, unsigned Waitcnt);
Konstantin Zhuravlyovcdd45472016-10-11 18:58:22 +0000393
394/// \returns Decoded Lgkmcnt from given \p Waitcnt for given isa \p Version.
Konstantin Zhuravlyov71e43ee2018-09-12 18:50:47 +0000395unsigned decodeLgkmcnt(const IsaVersion &Version, unsigned Waitcnt);
Konstantin Zhuravlyovcdd45472016-10-11 18:58:22 +0000396
Adrian Prantl5f8f34e42018-05-01 15:54:18 +0000397/// Decodes Vmcnt, Expcnt and Lgkmcnt from given \p Waitcnt for given isa
Konstantin Zhuravlyovcdd45472016-10-11 18:58:22 +0000398/// \p Version, and writes decoded values into \p Vmcnt, \p Expcnt and
399/// \p Lgkmcnt respectively.
400///
401/// \details \p Vmcnt, \p Expcnt and \p Lgkmcnt are decoded as follows:
Matt Arsenaulte823d922017-02-18 18:29:53 +0000402/// \p Vmcnt = \p Waitcnt[3:0] (pre-gfx9 only)
403/// \p Vmcnt = \p Waitcnt[3:0] | \p Waitcnt[15:14] (gfx9+ only)
Konstantin Zhuravlyovcdd45472016-10-11 18:58:22 +0000404/// \p Expcnt = \p Waitcnt[6:4]
Stanislav Mekhanoshin956b0be2019-04-25 18:53:41 +0000405/// \p Lgkmcnt = \p Waitcnt[11:8] (pre-gfx10 only)
406/// \p Lgkmcnt = \p Waitcnt[13:8] (gfx10+ only)
Konstantin Zhuravlyov71e43ee2018-09-12 18:50:47 +0000407void decodeWaitcnt(const IsaVersion &Version, unsigned Waitcnt,
Konstantin Zhuravlyovcdd45472016-10-11 18:58:22 +0000408 unsigned &Vmcnt, unsigned &Expcnt, unsigned &Lgkmcnt);
409
Nicolai Haehnle1a94cbb2018-11-29 11:06:06 +0000410Waitcnt decodeWaitcnt(const IsaVersion &Version, unsigned Encoded);
411
Konstantin Zhuravlyovcdd45472016-10-11 18:58:22 +0000412/// \returns \p Waitcnt with encoded \p Vmcnt for given isa \p Version.
Konstantin Zhuravlyov71e43ee2018-09-12 18:50:47 +0000413unsigned encodeVmcnt(const IsaVersion &Version, unsigned Waitcnt,
Konstantin Zhuravlyov9f89ede2017-02-08 14:05:23 +0000414 unsigned Vmcnt);
Konstantin Zhuravlyovcdd45472016-10-11 18:58:22 +0000415
416/// \returns \p Waitcnt with encoded \p Expcnt for given isa \p Version.
Konstantin Zhuravlyov71e43ee2018-09-12 18:50:47 +0000417unsigned encodeExpcnt(const IsaVersion &Version, unsigned Waitcnt,
Konstantin Zhuravlyov9f89ede2017-02-08 14:05:23 +0000418 unsigned Expcnt);
Konstantin Zhuravlyovcdd45472016-10-11 18:58:22 +0000419
420/// \returns \p Waitcnt with encoded \p Lgkmcnt for given isa \p Version.
Konstantin Zhuravlyov71e43ee2018-09-12 18:50:47 +0000421unsigned encodeLgkmcnt(const IsaVersion &Version, unsigned Waitcnt,
Konstantin Zhuravlyov9f89ede2017-02-08 14:05:23 +0000422 unsigned Lgkmcnt);
Konstantin Zhuravlyovcdd45472016-10-11 18:58:22 +0000423
Adrian Prantl5f8f34e42018-05-01 15:54:18 +0000424/// Encodes \p Vmcnt, \p Expcnt and \p Lgkmcnt into Waitcnt for given isa
Konstantin Zhuravlyovcdd45472016-10-11 18:58:22 +0000425/// \p Version.
426///
427/// \details \p Vmcnt, \p Expcnt and \p Lgkmcnt are encoded as follows:
Matt Arsenaulte823d922017-02-18 18:29:53 +0000428/// Waitcnt[3:0] = \p Vmcnt (pre-gfx9 only)
429/// Waitcnt[3:0] = \p Vmcnt[3:0] (gfx9+ only)
430/// Waitcnt[6:4] = \p Expcnt
Stanislav Mekhanoshin956b0be2019-04-25 18:53:41 +0000431/// Waitcnt[11:8] = \p Lgkmcnt (pre-gfx10 only)
432/// Waitcnt[13:8] = \p Lgkmcnt (gfx10+ only)
Matt Arsenaulte823d922017-02-18 18:29:53 +0000433/// Waitcnt[15:14] = \p Vmcnt[5:4] (gfx9+ only)
Konstantin Zhuravlyovcdd45472016-10-11 18:58:22 +0000434///
435/// \returns Waitcnt with encoded \p Vmcnt, \p Expcnt and \p Lgkmcnt for given
436/// isa \p Version.
Konstantin Zhuravlyov71e43ee2018-09-12 18:50:47 +0000437unsigned encodeWaitcnt(const IsaVersion &Version,
Konstantin Zhuravlyovcdd45472016-10-11 18:58:22 +0000438 unsigned Vmcnt, unsigned Expcnt, unsigned Lgkmcnt);
Konstantin Zhuravlyov836cbff2016-09-30 17:01:40 +0000439
Nicolai Haehnle1a94cbb2018-11-29 11:06:06 +0000440unsigned encodeWaitcnt(const IsaVersion &Version, const Waitcnt &Decoded);
441
Dmitry Preobrazhensky1fca3b12019-06-13 12:46:37 +0000442namespace Hwreg {
443
444LLVM_READONLY
445int64_t getHwregId(const StringRef Name);
446
447LLVM_READNONE
448bool isValidHwreg(int64_t Id, const MCSubtargetInfo &STI);
449
450LLVM_READNONE
451bool isValidHwreg(int64_t Id);
452
453LLVM_READNONE
454bool isValidHwregOffset(int64_t Offset);
455
456LLVM_READNONE
457bool isValidHwregWidth(int64_t Width);
458
459LLVM_READNONE
Dmitry Preobrazhensky2eff0312019-07-08 14:27:37 +0000460uint64_t encodeHwreg(uint64_t Id, uint64_t Offset, uint64_t Width);
Dmitry Preobrazhensky1fca3b12019-06-13 12:46:37 +0000461
462LLVM_READNONE
463StringRef getHwreg(unsigned Id, const MCSubtargetInfo &STI);
464
465void decodeHwreg(unsigned Val, unsigned &Id, unsigned &Offset, unsigned &Width);
466
467} // namespace Hwreg
468
Dmitry Preobrazhensky1d572ce2019-06-28 14:14:02 +0000469namespace SendMsg {
470
471LLVM_READONLY
472int64_t getMsgId(const StringRef Name);
473
474LLVM_READONLY
475int64_t getMsgOpId(int64_t MsgId, const StringRef Name);
476
477LLVM_READNONE
478StringRef getMsgName(int64_t MsgId);
479
480LLVM_READNONE
481StringRef getMsgOpName(int64_t MsgId, int64_t OpId);
482
483LLVM_READNONE
484bool isValidMsgId(int64_t MsgId, const MCSubtargetInfo &STI, bool Strict = true);
485
486LLVM_READNONE
487bool isValidMsgOp(int64_t MsgId, int64_t OpId, bool Strict = true);
488
489LLVM_READNONE
490bool isValidMsgStream(int64_t MsgId, int64_t OpId, int64_t StreamId, bool Strict = true);
491
492LLVM_READNONE
493bool msgRequiresOp(int64_t MsgId);
494
495LLVM_READNONE
496bool msgSupportsStream(int64_t MsgId, int64_t OpId);
497
498void decodeMsg(unsigned Val,
499 uint16_t &MsgId,
500 uint16_t &OpId,
501 uint16_t &StreamId);
502
503LLVM_READNONE
Dmitry Preobrazhenskye1eb25f2019-06-28 16:28:46 +0000504uint64_t encodeMsg(uint64_t MsgId,
505 uint64_t OpId,
506 uint64_t StreamId);
Dmitry Preobrazhensky1d572ce2019-06-28 14:14:02 +0000507
508} // namespace SendMsg
509
510
Marek Olsakfccabaf2016-01-13 11:45:36 +0000511unsigned getInitialPSInputAddr(const Function &F);
512
Matt Arsenaulte622dc32017-04-11 22:29:24 +0000513LLVM_READNONE
514bool isShader(CallingConv::ID CC);
515
516LLVM_READNONE
517bool isCompute(CallingConv::ID CC);
518
519LLVM_READNONE
520bool isEntryFunctionCC(CallingConv::ID CC);
521
Matt Arsenaultefa9f4b2017-04-11 22:29:28 +0000522// FIXME: Remove this when calling conventions cleaned up
523LLVM_READNONE
524inline bool isKernel(CallingConv::ID CC) {
525 switch (CC) {
Matt Arsenaultefa9f4b2017-04-11 22:29:28 +0000526 case CallingConv::AMDGPU_KERNEL:
527 case CallingConv::SPIR_KERNEL:
528 return true;
529 default:
530 return false;
531 }
532}
Tom Stellardac00eb52015-12-15 16:26:16 +0000533
Dmitry Preobrazhensky3afbd822018-01-10 14:22:19 +0000534bool hasXNACK(const MCSubtargetInfo &STI);
Konstantin Zhuravlyov108927b2018-11-05 22:44:19 +0000535bool hasSRAMECC(const MCSubtargetInfo &STI);
Dmitry Preobrazhenskye3271ae2018-02-05 12:45:43 +0000536bool hasMIMG_R128(const MCSubtargetInfo &STI);
Dmitry Preobrazhensky0a1ff462018-02-05 14:18:53 +0000537bool hasPackedD16(const MCSubtargetInfo &STI);
Dmitry Preobrazhenskye3271ae2018-02-05 12:45:43 +0000538
Tom Stellard2b65ed32015-12-21 18:44:27 +0000539bool isSI(const MCSubtargetInfo &STI);
540bool isCI(const MCSubtargetInfo &STI);
541bool isVI(const MCSubtargetInfo &STI);
Sam Koltonf7659d712017-05-23 10:08:55 +0000542bool isGFX9(const MCSubtargetInfo &STI);
Stanislav Mekhanoshincee607e2019-04-24 17:03:15 +0000543bool isGFX10(const MCSubtargetInfo &STI);
Sam Koltonf7659d712017-05-23 10:08:55 +0000544
Adrian Prantl5f8f34e42018-05-01 15:54:18 +0000545/// Is Reg - scalar register
Sam Koltonf7659d712017-05-23 10:08:55 +0000546bool isSGPR(unsigned Reg, const MCRegisterInfo* TRI);
Tom Stellard2b65ed32015-12-21 18:44:27 +0000547
Adrian Prantl5f8f34e42018-05-01 15:54:18 +0000548/// Is there any intersection between registers
Dmitry Preobrazhenskydc4ac822017-06-21 14:41:34 +0000549bool isRegIntersect(unsigned Reg0, unsigned Reg1, const MCRegisterInfo* TRI);
550
Tom Stellard2b65ed32015-12-21 18:44:27 +0000551/// If \p Reg is a pseudo reg, return the correct hardware register given
552/// \p STI otherwise return \p Reg.
553unsigned getMCReg(unsigned Reg, const MCSubtargetInfo &STI);
554
Adrian Prantl5f8f34e42018-05-01 15:54:18 +0000555/// Convert hardware register \p Reg to a pseudo register
Dmitry Preobrazhensky03880f82017-03-03 14:31:06 +0000556LLVM_READNONE
557unsigned mc2PseudoReg(unsigned Reg);
558
Adrian Prantl5f8f34e42018-05-01 15:54:18 +0000559/// Can this operand also contain immediate values?
Sam Kolton1eeb11b2016-09-09 14:44:04 +0000560bool isSISrcOperand(const MCInstrDesc &Desc, unsigned OpNo);
561
Adrian Prantl5f8f34e42018-05-01 15:54:18 +0000562/// Is this floating-point operand?
Sam Kolton1eeb11b2016-09-09 14:44:04 +0000563bool isSISrcFPOperand(const MCInstrDesc &Desc, unsigned OpNo);
564
Adrian Prantl5f8f34e42018-05-01 15:54:18 +0000565/// Does this opearnd support only inlinable literals?
Sam Kolton1eeb11b2016-09-09 14:44:04 +0000566bool isSISrcInlinableOperand(const MCInstrDesc &Desc, unsigned OpNo);
567
Adrian Prantl5f8f34e42018-05-01 15:54:18 +0000568/// Get the size in bits of a register from the register class \p RC.
Tom Stellardb133fbb2016-10-27 23:05:31 +0000569unsigned getRegBitWidth(unsigned RCID);
570
Adrian Prantl5f8f34e42018-05-01 15:54:18 +0000571/// Get the size in bits of a register from the register class \p RC.
Krzysztof Parzyszekc8715502016-10-19 17:40:36 +0000572unsigned getRegBitWidth(const MCRegisterClass &RC);
573
Adrian Prantl5f8f34e42018-05-01 15:54:18 +0000574/// Get size of register operand
Sam Kolton1eeb11b2016-09-09 14:44:04 +0000575unsigned getRegOperandSize(const MCRegisterInfo *MRI, const MCInstrDesc &Desc,
576 unsigned OpNo);
577
Matt Arsenault4bd72362016-12-10 00:39:12 +0000578LLVM_READNONE
579inline unsigned getOperandSize(const MCOperandInfo &OpInfo) {
580 switch (OpInfo.OperandType) {
581 case AMDGPU::OPERAND_REG_IMM_INT32:
582 case AMDGPU::OPERAND_REG_IMM_FP32:
583 case AMDGPU::OPERAND_REG_INLINE_C_INT32:
584 case AMDGPU::OPERAND_REG_INLINE_C_FP32:
Stanislav Mekhanoshin50d7f4642019-07-09 21:43:09 +0000585 case AMDGPU::OPERAND_REG_INLINE_AC_INT32:
586 case AMDGPU::OPERAND_REG_INLINE_AC_FP32:
Matt Arsenault4bd72362016-12-10 00:39:12 +0000587 return 4;
588
589 case AMDGPU::OPERAND_REG_IMM_INT64:
590 case AMDGPU::OPERAND_REG_IMM_FP64:
591 case AMDGPU::OPERAND_REG_INLINE_C_INT64:
592 case AMDGPU::OPERAND_REG_INLINE_C_FP64:
593 return 8;
594
595 case AMDGPU::OPERAND_REG_IMM_INT16:
596 case AMDGPU::OPERAND_REG_IMM_FP16:
597 case AMDGPU::OPERAND_REG_INLINE_C_INT16:
598 case AMDGPU::OPERAND_REG_INLINE_C_FP16:
Matt Arsenault9be7b0d2017-02-27 18:49:11 +0000599 case AMDGPU::OPERAND_REG_INLINE_C_V2INT16:
600 case AMDGPU::OPERAND_REG_INLINE_C_V2FP16:
Stanislav Mekhanoshin50d7f4642019-07-09 21:43:09 +0000601 case AMDGPU::OPERAND_REG_INLINE_AC_INT16:
602 case AMDGPU::OPERAND_REG_INLINE_AC_FP16:
603 case AMDGPU::OPERAND_REG_INLINE_AC_V2INT16:
604 case AMDGPU::OPERAND_REG_INLINE_AC_V2FP16:
Stanislav Mekhanoshin956b0be2019-04-25 18:53:41 +0000605 case AMDGPU::OPERAND_REG_IMM_V2INT16:
606 case AMDGPU::OPERAND_REG_IMM_V2FP16:
Matt Arsenault4bd72362016-12-10 00:39:12 +0000607 return 2;
608
609 default:
610 llvm_unreachable("unhandled operand type");
611 }
612}
613
614LLVM_READNONE
615inline unsigned getOperandSize(const MCInstrDesc &Desc, unsigned OpNo) {
616 return getOperandSize(Desc.OpInfo[OpNo]);
617}
618
Adrian Prantl5f8f34e42018-05-01 15:54:18 +0000619/// Is this literal inlinable
Matt Arsenault26faed32016-12-05 22:26:17 +0000620LLVM_READNONE
621bool isInlinableLiteral64(int64_t Literal, bool HasInv2Pi);
622
623LLVM_READNONE
624bool isInlinableLiteral32(int32_t Literal, bool HasInv2Pi);
625
Matt Arsenault4bd72362016-12-10 00:39:12 +0000626LLVM_READNONE
627bool isInlinableLiteral16(int16_t Literal, bool HasInv2Pi);
Sam Kolton1eeb11b2016-09-09 14:44:04 +0000628
Matt Arsenault9be7b0d2017-02-27 18:49:11 +0000629LLVM_READNONE
630bool isInlinableLiteralV216(int32_t Literal, bool HasInv2Pi);
631
Matt Arsenault894e53d2017-07-26 20:39:42 +0000632bool isArgPassedInSGPR(const Argument *Arg);
Tom Stellard08efb7e2017-01-27 18:41:14 +0000633
634/// \returns The encoding that will be used for \p ByteOffset in the SMRD
635/// offset field.
636int64_t getSMRDEncodedOffset(const MCSubtargetInfo &ST, int64_t ByteOffset);
637
638/// \returns true if this offset is small enough to fit in the SMRD
639/// offset field. \p ByteOffset should be the offset in bytes and
640/// not the encoded offset.
641bool isLegalSMRDImmOffset(const MCSubtargetInfo &ST, int64_t ByteOffset);
642
Tim Renouf4f703f52018-08-21 11:07:10 +0000643bool splitMUBUFOffset(uint32_t Imm, uint32_t &SOffset, uint32_t &ImmOffset,
Nicolai Haehnlea7b00052018-11-30 22:55:38 +0000644 const GCNSubtarget *Subtarget, uint32_t Align = 4);
Tim Renouf4f703f52018-08-21 11:07:10 +0000645
Alexander Timofeev2e5eece2018-03-05 15:12:21 +0000646/// \returns true if the intrinsic is divergent
647bool isIntrinsicSourceOfDivergence(unsigned IntrID);
648
Matt Arsenault055e4dc2019-03-29 19:14:54 +0000649
650// Track defaults for fields in the MODE registser.
651struct SIModeRegisterDefaults {
652 /// Floating point opcodes that support exception flag gathering quiet and
653 /// propagate signaling NaN inputs per IEEE 754-2008. Min_dx10 and max_dx10
654 /// become IEEE 754- 2008 compliant due to signaling NaN propagation and
655 /// quieting.
656 bool IEEE : 1;
657
658 /// Used by the vector ALU to force DX10-style treatment of NaNs: when set,
659 /// clamp NaN to zero; otherwise, pass NaN through.
660 bool DX10Clamp : 1;
661
662 // TODO: FP mode fields
663
664 SIModeRegisterDefaults() :
665 IEEE(true),
666 DX10Clamp(true) {}
667
668 SIModeRegisterDefaults(const Function &F);
669
670 static SIModeRegisterDefaults getDefaultForCallingConv(CallingConv::ID CC) {
671 SIModeRegisterDefaults Mode;
672 Mode.DX10Clamp = true;
673 Mode.IEEE = AMDGPU::isCompute(CC);
674 return Mode;
675 }
676
677 bool operator ==(const SIModeRegisterDefaults Other) const {
678 return IEEE == Other.IEEE && DX10Clamp == Other.DX10Clamp;
679 }
680
681 // FIXME: Inlining should be OK for dx10-clamp, since the caller's mode should
682 // be able to override.
683 bool isInlineCompatible(SIModeRegisterDefaults CalleeMode) const {
684 return *this == CalleeMode;
685 }
686};
687
Tom Stellard347ac792015-06-26 21:15:07 +0000688} // end namespace AMDGPU
689} // end namespace llvm
690
Eugene Zelenkod96089b2017-02-14 00:33:36 +0000691#endif // LLVM_LIB_TARGET_AMDGPU_UTILS_AMDGPUBASEINFO_H