106c3fb27SDimitry Andric //===-- SIModeRegisterDefaults.cpp ------------------------------*- C++ -*-===//
206c3fb27SDimitry Andric //
306c3fb27SDimitry Andric // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
406c3fb27SDimitry Andric // See https://llvm.org/LICENSE.txt for license information.
506c3fb27SDimitry Andric // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
606c3fb27SDimitry Andric //
706c3fb27SDimitry Andric //===----------------------------------------------------------------------===//
806c3fb27SDimitry Andric
906c3fb27SDimitry Andric #include "SIModeRegisterDefaults.h"
105f757f3fSDimitry Andric #include "GCNSubtarget.h"
1106c3fb27SDimitry Andric
1206c3fb27SDimitry Andric using namespace llvm;
1306c3fb27SDimitry Andric
SIModeRegisterDefaults(const Function & F,const GCNSubtarget & ST)145f757f3fSDimitry Andric SIModeRegisterDefaults::SIModeRegisterDefaults(const Function &F,
155f757f3fSDimitry Andric const GCNSubtarget &ST) {
1606c3fb27SDimitry Andric *this = getDefaultForCallingConv(F.getCallingConv());
1706c3fb27SDimitry Andric
185f757f3fSDimitry Andric if (ST.hasIEEEMode()) {
1906c3fb27SDimitry Andric StringRef IEEEAttr = F.getFnAttribute("amdgpu-ieee").getValueAsString();
2006c3fb27SDimitry Andric if (!IEEEAttr.empty())
2106c3fb27SDimitry Andric IEEE = IEEEAttr == "true";
225f757f3fSDimitry Andric }
2306c3fb27SDimitry Andric
245f757f3fSDimitry Andric if (ST.hasDX10ClampMode()) {
2506c3fb27SDimitry Andric StringRef DX10ClampAttr =
2606c3fb27SDimitry Andric F.getFnAttribute("amdgpu-dx10-clamp").getValueAsString();
2706c3fb27SDimitry Andric if (!DX10ClampAttr.empty())
2806c3fb27SDimitry Andric DX10Clamp = DX10ClampAttr == "true";
295f757f3fSDimitry Andric }
3006c3fb27SDimitry Andric
3106c3fb27SDimitry Andric StringRef DenormF32Attr =
3206c3fb27SDimitry Andric F.getFnAttribute("denormal-fp-math-f32").getValueAsString();
3306c3fb27SDimitry Andric if (!DenormF32Attr.empty())
3406c3fb27SDimitry Andric FP32Denormals = parseDenormalFPAttribute(DenormF32Attr);
3506c3fb27SDimitry Andric
3606c3fb27SDimitry Andric StringRef DenormAttr =
3706c3fb27SDimitry Andric F.getFnAttribute("denormal-fp-math").getValueAsString();
3806c3fb27SDimitry Andric if (!DenormAttr.empty()) {
3906c3fb27SDimitry Andric DenormalMode DenormMode = parseDenormalFPAttribute(DenormAttr);
4006c3fb27SDimitry Andric if (DenormF32Attr.empty())
4106c3fb27SDimitry Andric FP32Denormals = DenormMode;
4206c3fb27SDimitry Andric FP64FP16Denormals = DenormMode;
4306c3fb27SDimitry Andric }
4406c3fb27SDimitry Andric }
455f757f3fSDimitry Andric
465f757f3fSDimitry Andric using namespace AMDGPU;
475f757f3fSDimitry Andric
485f757f3fSDimitry Andric /// Combine f32 and f64 rounding modes into a combined rounding mode value.
getModeRegisterRoundMode(uint32_t HWFP32Val,uint32_t HWFP64Val)495f757f3fSDimitry Andric static constexpr uint32_t getModeRegisterRoundMode(uint32_t HWFP32Val,
505f757f3fSDimitry Andric uint32_t HWFP64Val) {
515f757f3fSDimitry Andric return HWFP32Val << F32FltRoundOffset | HWFP64Val << F64FltRoundOffset;
525f757f3fSDimitry Andric }
535f757f3fSDimitry Andric
encodeFltRoundsTable(uint32_t FltRoundsVal,uint32_t HWF32Val,uint32_t HWF64Val)545f757f3fSDimitry Andric static constexpr uint64_t encodeFltRoundsTable(uint32_t FltRoundsVal,
555f757f3fSDimitry Andric uint32_t HWF32Val,
565f757f3fSDimitry Andric uint32_t HWF64Val) {
575f757f3fSDimitry Andric uint32_t ModeVal = getModeRegisterRoundMode(HWF32Val, HWF64Val);
585f757f3fSDimitry Andric if (FltRoundsVal > TowardNegative)
595f757f3fSDimitry Andric FltRoundsVal -= ExtendedFltRoundOffset;
605f757f3fSDimitry Andric
615f757f3fSDimitry Andric uint32_t BitIndex = ModeVal << 2;
625f757f3fSDimitry Andric return static_cast<uint64_t>(FltRoundsVal) << BitIndex;
635f757f3fSDimitry Andric }
645f757f3fSDimitry Andric
655f757f3fSDimitry Andric // Encode FLT_ROUNDS value where the two rounding modes are the same and use a
665f757f3fSDimitry Andric // standard value
675f757f3fSDimitry Andric static constexpr uint64_t
encodeFltRoundsTableSame(AMDGPUFltRounds FltRoundsMode,uint32_t HWVal)685f757f3fSDimitry Andric encodeFltRoundsTableSame(AMDGPUFltRounds FltRoundsMode, uint32_t HWVal) {
695f757f3fSDimitry Andric return encodeFltRoundsTable(FltRoundsMode, HWVal, HWVal);
705f757f3fSDimitry Andric }
715f757f3fSDimitry Andric
725f757f3fSDimitry Andric // Convert mode register encoded rounding mode to AMDGPUFltRounds
735f757f3fSDimitry Andric static constexpr AMDGPUFltRounds
decodeIndexFltRoundConversionTable(uint32_t HWMode)745f757f3fSDimitry Andric decodeIndexFltRoundConversionTable(uint32_t HWMode) {
755f757f3fSDimitry Andric uint32_t TableRead = (FltRoundConversionTable >> (HWMode << 2)) & 0xf;
765f757f3fSDimitry Andric if (TableRead > TowardNegative)
775f757f3fSDimitry Andric TableRead += ExtendedFltRoundOffset;
785f757f3fSDimitry Andric return static_cast<AMDGPUFltRounds>(TableRead);
795f757f3fSDimitry Andric }
805f757f3fSDimitry Andric
815f757f3fSDimitry Andric static constexpr uint32_t HWTowardZero = FP_ROUND_ROUND_TO_ZERO;
825f757f3fSDimitry Andric static constexpr uint32_t HWNearestTiesToEven = FP_ROUND_ROUND_TO_NEAREST;
835f757f3fSDimitry Andric static constexpr uint32_t HWTowardPositive = FP_ROUND_ROUND_TO_INF;
845f757f3fSDimitry Andric static constexpr uint32_t HWTowardNegative = FP_ROUND_ROUND_TO_NEGINF;
855f757f3fSDimitry Andric
865f757f3fSDimitry Andric const uint64_t AMDGPU::FltRoundConversionTable =
875f757f3fSDimitry Andric encodeFltRoundsTableSame(TowardZeroF32_TowardZeroF64, HWTowardZero) |
885f757f3fSDimitry Andric encodeFltRoundsTableSame(NearestTiesToEvenF32_NearestTiesToEvenF64,
895f757f3fSDimitry Andric HWNearestTiesToEven) |
905f757f3fSDimitry Andric encodeFltRoundsTableSame(TowardPositiveF32_TowardPositiveF64,
915f757f3fSDimitry Andric HWTowardPositive) |
925f757f3fSDimitry Andric encodeFltRoundsTableSame(TowardNegativeF32_TowardNegativeF64,
935f757f3fSDimitry Andric HWTowardNegative) |
945f757f3fSDimitry Andric
955f757f3fSDimitry Andric encodeFltRoundsTable(TowardZeroF32_NearestTiesToEvenF64, HWTowardZero,
965f757f3fSDimitry Andric HWNearestTiesToEven) |
975f757f3fSDimitry Andric encodeFltRoundsTable(TowardZeroF32_TowardPositiveF64, HWTowardZero,
985f757f3fSDimitry Andric HWTowardPositive) |
995f757f3fSDimitry Andric encodeFltRoundsTable(TowardZeroF32_TowardNegativeF64, HWTowardZero,
1005f757f3fSDimitry Andric HWTowardNegative) |
1015f757f3fSDimitry Andric
1025f757f3fSDimitry Andric encodeFltRoundsTable(NearestTiesToEvenF32_TowardZeroF64,
1035f757f3fSDimitry Andric HWNearestTiesToEven, HWTowardZero) |
1045f757f3fSDimitry Andric encodeFltRoundsTable(NearestTiesToEvenF32_TowardPositiveF64,
1055f757f3fSDimitry Andric HWNearestTiesToEven, HWTowardPositive) |
1065f757f3fSDimitry Andric encodeFltRoundsTable(NearestTiesToEvenF32_TowardNegativeF64,
1075f757f3fSDimitry Andric HWNearestTiesToEven, HWTowardNegative) |
1085f757f3fSDimitry Andric
1095f757f3fSDimitry Andric encodeFltRoundsTable(TowardPositiveF32_TowardZeroF64, HWTowardPositive,
1105f757f3fSDimitry Andric HWTowardZero) |
1115f757f3fSDimitry Andric encodeFltRoundsTable(TowardPositiveF32_NearestTiesToEvenF64,
1125f757f3fSDimitry Andric HWTowardPositive, HWNearestTiesToEven) |
1135f757f3fSDimitry Andric encodeFltRoundsTable(TowardPositiveF32_TowardNegativeF64, HWTowardPositive,
1145f757f3fSDimitry Andric HWTowardNegative) |
1155f757f3fSDimitry Andric
1165f757f3fSDimitry Andric encodeFltRoundsTable(TowardNegativeF32_TowardZeroF64, HWTowardNegative,
1175f757f3fSDimitry Andric HWTowardZero) |
1185f757f3fSDimitry Andric encodeFltRoundsTable(TowardNegativeF32_NearestTiesToEvenF64,
1195f757f3fSDimitry Andric HWTowardNegative, HWNearestTiesToEven) |
1205f757f3fSDimitry Andric encodeFltRoundsTable(TowardNegativeF32_TowardPositiveF64, HWTowardNegative,
1215f757f3fSDimitry Andric HWTowardPositive);
1225f757f3fSDimitry Andric
1235f757f3fSDimitry Andric // Verify evaluation of FltRoundConversionTable
1245f757f3fSDimitry Andric
1255f757f3fSDimitry Andric // If both modes are the same, should return the standard values.
1265f757f3fSDimitry Andric static_assert(decodeIndexFltRoundConversionTable(getModeRegisterRoundMode(
1275f757f3fSDimitry Andric HWTowardZero, HWTowardZero)) == AMDGPUFltRounds::TowardZero);
1285f757f3fSDimitry Andric static_assert(decodeIndexFltRoundConversionTable(getModeRegisterRoundMode(
1295f757f3fSDimitry Andric HWNearestTiesToEven, HWNearestTiesToEven)) ==
1305f757f3fSDimitry Andric AMDGPUFltRounds::NearestTiesToEven);
1315f757f3fSDimitry Andric static_assert(decodeIndexFltRoundConversionTable(getModeRegisterRoundMode(
1325f757f3fSDimitry Andric HWTowardPositive, HWTowardPositive)) ==
1335f757f3fSDimitry Andric AMDGPUFltRounds::TowardPositive);
1345f757f3fSDimitry Andric static_assert(decodeIndexFltRoundConversionTable(getModeRegisterRoundMode(
1355f757f3fSDimitry Andric HWTowardNegative, HWTowardNegative)) ==
1365f757f3fSDimitry Andric AMDGPUFltRounds::TowardNegative);
1375f757f3fSDimitry Andric
1385f757f3fSDimitry Andric static_assert(decodeIndexFltRoundConversionTable(getModeRegisterRoundMode(
1395f757f3fSDimitry Andric HWTowardZero, HWNearestTiesToEven)) ==
1405f757f3fSDimitry Andric TowardZeroF32_NearestTiesToEvenF64);
1415f757f3fSDimitry Andric static_assert(decodeIndexFltRoundConversionTable(
1425f757f3fSDimitry Andric getModeRegisterRoundMode(HWTowardZero, HWTowardPositive)) ==
1435f757f3fSDimitry Andric TowardZeroF32_TowardPositiveF64);
1445f757f3fSDimitry Andric static_assert(decodeIndexFltRoundConversionTable(
1455f757f3fSDimitry Andric getModeRegisterRoundMode(HWTowardZero, HWTowardNegative)) ==
1465f757f3fSDimitry Andric TowardZeroF32_TowardNegativeF64);
1475f757f3fSDimitry Andric
1485f757f3fSDimitry Andric static_assert(decodeIndexFltRoundConversionTable(getModeRegisterRoundMode(
1495f757f3fSDimitry Andric HWNearestTiesToEven, HWTowardZero)) ==
1505f757f3fSDimitry Andric NearestTiesToEvenF32_TowardZeroF64);
1515f757f3fSDimitry Andric static_assert(decodeIndexFltRoundConversionTable(getModeRegisterRoundMode(
1525f757f3fSDimitry Andric HWNearestTiesToEven, HWTowardPositive)) ==
1535f757f3fSDimitry Andric NearestTiesToEvenF32_TowardPositiveF64);
1545f757f3fSDimitry Andric static_assert(decodeIndexFltRoundConversionTable(getModeRegisterRoundMode(
1555f757f3fSDimitry Andric HWNearestTiesToEven, HWTowardNegative)) ==
1565f757f3fSDimitry Andric NearestTiesToEvenF32_TowardNegativeF64);
1575f757f3fSDimitry Andric
1585f757f3fSDimitry Andric static_assert(decodeIndexFltRoundConversionTable(
1595f757f3fSDimitry Andric getModeRegisterRoundMode(HWTowardPositive, HWTowardZero)) ==
1605f757f3fSDimitry Andric TowardPositiveF32_TowardZeroF64);
1615f757f3fSDimitry Andric static_assert(decodeIndexFltRoundConversionTable(getModeRegisterRoundMode(
1625f757f3fSDimitry Andric HWTowardPositive, HWNearestTiesToEven)) ==
1635f757f3fSDimitry Andric TowardPositiveF32_NearestTiesToEvenF64);
1645f757f3fSDimitry Andric static_assert(decodeIndexFltRoundConversionTable(getModeRegisterRoundMode(
1655f757f3fSDimitry Andric HWTowardPositive, HWTowardNegative)) ==
1665f757f3fSDimitry Andric TowardPositiveF32_TowardNegativeF64);
1675f757f3fSDimitry Andric
1685f757f3fSDimitry Andric static_assert(decodeIndexFltRoundConversionTable(
1695f757f3fSDimitry Andric getModeRegisterRoundMode(HWTowardNegative, HWTowardZero)) ==
1705f757f3fSDimitry Andric TowardNegativeF32_TowardZeroF64);
1715f757f3fSDimitry Andric static_assert(decodeIndexFltRoundConversionTable(getModeRegisterRoundMode(
1725f757f3fSDimitry Andric HWTowardNegative, HWNearestTiesToEven)) ==
1735f757f3fSDimitry Andric TowardNegativeF32_NearestTiesToEvenF64);
1745f757f3fSDimitry Andric static_assert(decodeIndexFltRoundConversionTable(getModeRegisterRoundMode(
1755f757f3fSDimitry Andric HWTowardNegative, HWTowardPositive)) ==
1765f757f3fSDimitry Andric TowardNegativeF32_TowardPositiveF64);
177*0fca6ea1SDimitry Andric
178*0fca6ea1SDimitry Andric // Decode FLT_ROUNDS into the hardware value where the two rounding modes are
179*0fca6ea1SDimitry Andric // the same and use a standard value
encodeFltRoundsToHWTableSame(uint32_t HWVal,uint32_t FltRoundsVal)180*0fca6ea1SDimitry Andric static constexpr uint64_t encodeFltRoundsToHWTableSame(uint32_t HWVal,
181*0fca6ea1SDimitry Andric uint32_t FltRoundsVal) {
182*0fca6ea1SDimitry Andric if (FltRoundsVal > TowardNegative)
183*0fca6ea1SDimitry Andric FltRoundsVal -= ExtendedFltRoundOffset;
184*0fca6ea1SDimitry Andric
185*0fca6ea1SDimitry Andric return static_cast<uint64_t>(getModeRegisterRoundMode(HWVal, HWVal))
186*0fca6ea1SDimitry Andric << (FltRoundsVal << 2);
187*0fca6ea1SDimitry Andric }
188*0fca6ea1SDimitry Andric
189*0fca6ea1SDimitry Andric /// Decode FLT_ROUNDS into the hardware value where the two rounding modes
190*0fca6ea1SDimitry Andric /// different and use an extended value.
encodeFltRoundsToHWTable(uint32_t HWF32Val,uint32_t HWF64Val,uint32_t FltRoundsVal)191*0fca6ea1SDimitry Andric static constexpr uint64_t encodeFltRoundsToHWTable(uint32_t HWF32Val,
192*0fca6ea1SDimitry Andric uint32_t HWF64Val,
193*0fca6ea1SDimitry Andric uint32_t FltRoundsVal) {
194*0fca6ea1SDimitry Andric if (FltRoundsVal > TowardNegative)
195*0fca6ea1SDimitry Andric FltRoundsVal -= ExtendedFltRoundOffset;
196*0fca6ea1SDimitry Andric return static_cast<uint64_t>(getModeRegisterRoundMode(HWF32Val, HWF64Val))
197*0fca6ea1SDimitry Andric << (FltRoundsVal << 2);
198*0fca6ea1SDimitry Andric }
199*0fca6ea1SDimitry Andric
200*0fca6ea1SDimitry Andric const uint64_t AMDGPU::FltRoundToHWConversionTable =
201*0fca6ea1SDimitry Andric encodeFltRoundsToHWTableSame(HWTowardZero, TowardZeroF32_TowardZeroF64) |
202*0fca6ea1SDimitry Andric encodeFltRoundsToHWTableSame(HWNearestTiesToEven,
203*0fca6ea1SDimitry Andric NearestTiesToEvenF32_NearestTiesToEvenF64) |
204*0fca6ea1SDimitry Andric encodeFltRoundsToHWTableSame(HWTowardPositive,
205*0fca6ea1SDimitry Andric TowardPositiveF32_TowardPositiveF64) |
206*0fca6ea1SDimitry Andric encodeFltRoundsToHWTableSame(HWTowardNegative,
207*0fca6ea1SDimitry Andric TowardNegativeF32_TowardNegativeF64) |
208*0fca6ea1SDimitry Andric
209*0fca6ea1SDimitry Andric encodeFltRoundsToHWTable(HWTowardZero, HWNearestTiesToEven,
210*0fca6ea1SDimitry Andric TowardZeroF32_NearestTiesToEvenF64) |
211*0fca6ea1SDimitry Andric encodeFltRoundsToHWTable(HWTowardZero, HWTowardPositive,
212*0fca6ea1SDimitry Andric TowardZeroF32_TowardPositiveF64) |
213*0fca6ea1SDimitry Andric encodeFltRoundsToHWTable(HWTowardZero, HWTowardNegative,
214*0fca6ea1SDimitry Andric TowardZeroF32_TowardNegativeF64) |
215*0fca6ea1SDimitry Andric
216*0fca6ea1SDimitry Andric encodeFltRoundsToHWTable(HWNearestTiesToEven, HWTowardZero,
217*0fca6ea1SDimitry Andric NearestTiesToEvenF32_TowardZeroF64) |
218*0fca6ea1SDimitry Andric encodeFltRoundsToHWTable(HWNearestTiesToEven, HWTowardPositive,
219*0fca6ea1SDimitry Andric NearestTiesToEvenF32_TowardPositiveF64) |
220*0fca6ea1SDimitry Andric encodeFltRoundsToHWTable(HWNearestTiesToEven, HWTowardNegative,
221*0fca6ea1SDimitry Andric NearestTiesToEvenF32_TowardNegativeF64) |
222*0fca6ea1SDimitry Andric
223*0fca6ea1SDimitry Andric encodeFltRoundsToHWTable(HWTowardPositive, HWTowardZero,
224*0fca6ea1SDimitry Andric TowardPositiveF32_TowardZeroF64) |
225*0fca6ea1SDimitry Andric encodeFltRoundsToHWTable(HWTowardPositive, HWNearestTiesToEven,
226*0fca6ea1SDimitry Andric TowardPositiveF32_NearestTiesToEvenF64) |
227*0fca6ea1SDimitry Andric encodeFltRoundsToHWTable(HWTowardPositive, HWTowardNegative,
228*0fca6ea1SDimitry Andric TowardPositiveF32_TowardNegativeF64) |
229*0fca6ea1SDimitry Andric
230*0fca6ea1SDimitry Andric encodeFltRoundsToHWTable(HWTowardNegative, HWTowardZero,
231*0fca6ea1SDimitry Andric TowardNegativeF32_TowardZeroF64) |
232*0fca6ea1SDimitry Andric encodeFltRoundsToHWTable(HWTowardNegative, HWNearestTiesToEven,
233*0fca6ea1SDimitry Andric TowardNegativeF32_NearestTiesToEvenF64) |
234*0fca6ea1SDimitry Andric encodeFltRoundsToHWTable(HWTowardNegative, HWTowardPositive,
235*0fca6ea1SDimitry Andric TowardNegativeF32_TowardPositiveF64);
236*0fca6ea1SDimitry Andric
237*0fca6ea1SDimitry Andric /// Read the hardware rounding mode equivalent of a AMDGPUFltRounds value.
238*0fca6ea1SDimitry Andric static constexpr uint32_t
decodeFltRoundToHWConversionTable(uint64_t FltRoundToHWConversionTable,uint32_t FltRounds)239*0fca6ea1SDimitry Andric decodeFltRoundToHWConversionTable(uint64_t FltRoundToHWConversionTable,
240*0fca6ea1SDimitry Andric uint32_t FltRounds) {
241*0fca6ea1SDimitry Andric uint32_t IndexVal = FltRounds;
242*0fca6ea1SDimitry Andric if (IndexVal > TowardNegative)
243*0fca6ea1SDimitry Andric IndexVal -= ExtendedFltRoundOffset;
244*0fca6ea1SDimitry Andric return (FltRoundToHWConversionTable >> (IndexVal << 2)) & 0xf;
245*0fca6ea1SDimitry Andric }
246*0fca6ea1SDimitry Andric
decodeFltRoundToHWConversionTable(uint32_t FltRounds)247*0fca6ea1SDimitry Andric uint32_t AMDGPU::decodeFltRoundToHWConversionTable(uint32_t FltRounds) {
248*0fca6ea1SDimitry Andric return ::decodeFltRoundToHWConversionTable(FltRoundToHWConversionTable,
249*0fca6ea1SDimitry Andric FltRounds);
250*0fca6ea1SDimitry Andric }
251*0fca6ea1SDimitry Andric
decodeFltRoundToHW(uint32_t FltRounds)252*0fca6ea1SDimitry Andric static constexpr uint32_t decodeFltRoundToHW(uint32_t FltRounds) {
253*0fca6ea1SDimitry Andric return ::decodeFltRoundToHWConversionTable(FltRoundToHWConversionTable,
254*0fca6ea1SDimitry Andric FltRounds);
255*0fca6ea1SDimitry Andric }
256*0fca6ea1SDimitry Andric
257*0fca6ea1SDimitry Andric // Verify evaluation of FltRoundToHWConversionTable
258*0fca6ea1SDimitry Andric
259*0fca6ea1SDimitry Andric static_assert(decodeFltRoundToHW(AMDGPUFltRounds::TowardZero) ==
260*0fca6ea1SDimitry Andric getModeRegisterRoundMode(HWTowardZero, HWTowardZero));
261*0fca6ea1SDimitry Andric static_assert(decodeFltRoundToHW(AMDGPUFltRounds::NearestTiesToEven) ==
262*0fca6ea1SDimitry Andric getModeRegisterRoundMode(HWNearestTiesToEven,
263*0fca6ea1SDimitry Andric HWNearestTiesToEven));
264*0fca6ea1SDimitry Andric static_assert(decodeFltRoundToHW(AMDGPUFltRounds::TowardPositive) ==
265*0fca6ea1SDimitry Andric getModeRegisterRoundMode(HWTowardPositive, HWTowardPositive));
266*0fca6ea1SDimitry Andric static_assert(decodeFltRoundToHW(AMDGPUFltRounds::TowardNegative) ==
267*0fca6ea1SDimitry Andric getModeRegisterRoundMode(HWTowardNegative, HWTowardNegative));
268*0fca6ea1SDimitry Andric
269*0fca6ea1SDimitry Andric static_assert(decodeFltRoundToHW(NearestTiesToEvenF32_TowardPositiveF64) ==
270*0fca6ea1SDimitry Andric getModeRegisterRoundMode(HWNearestTiesToEven, HWTowardPositive));
271*0fca6ea1SDimitry Andric static_assert(decodeFltRoundToHW(NearestTiesToEvenF32_TowardNegativeF64) ==
272*0fca6ea1SDimitry Andric getModeRegisterRoundMode(HWNearestTiesToEven, HWTowardNegative));
273*0fca6ea1SDimitry Andric static_assert(decodeFltRoundToHW(NearestTiesToEvenF32_TowardZeroF64) ==
274*0fca6ea1SDimitry Andric getModeRegisterRoundMode(HWNearestTiesToEven, HWTowardZero));
275*0fca6ea1SDimitry Andric
276*0fca6ea1SDimitry Andric static_assert(decodeFltRoundToHW(TowardPositiveF32_NearestTiesToEvenF64) ==
277*0fca6ea1SDimitry Andric getModeRegisterRoundMode(HWTowardPositive, HWNearestTiesToEven));
278*0fca6ea1SDimitry Andric static_assert(decodeFltRoundToHW(TowardPositiveF32_TowardNegativeF64) ==
279*0fca6ea1SDimitry Andric getModeRegisterRoundMode(HWTowardPositive, HWTowardNegative));
280*0fca6ea1SDimitry Andric static_assert(decodeFltRoundToHW(TowardPositiveF32_TowardZeroF64) ==
281*0fca6ea1SDimitry Andric getModeRegisterRoundMode(HWTowardPositive, HWTowardZero));
282*0fca6ea1SDimitry Andric
283*0fca6ea1SDimitry Andric static_assert(decodeFltRoundToHW(TowardNegativeF32_NearestTiesToEvenF64) ==
284*0fca6ea1SDimitry Andric getModeRegisterRoundMode(HWTowardNegative, HWNearestTiesToEven));
285*0fca6ea1SDimitry Andric static_assert(decodeFltRoundToHW(TowardNegativeF32_TowardPositiveF64) ==
286*0fca6ea1SDimitry Andric getModeRegisterRoundMode(HWTowardNegative, HWTowardPositive));
287*0fca6ea1SDimitry Andric static_assert(decodeFltRoundToHW(TowardNegativeF32_TowardZeroF64) ==
288*0fca6ea1SDimitry Andric getModeRegisterRoundMode(HWTowardNegative, HWTowardZero));
289*0fca6ea1SDimitry Andric
290*0fca6ea1SDimitry Andric static_assert(decodeFltRoundToHW(TowardZeroF32_NearestTiesToEvenF64) ==
291*0fca6ea1SDimitry Andric getModeRegisterRoundMode(HWTowardZero, HWNearestTiesToEven));
292*0fca6ea1SDimitry Andric static_assert(decodeFltRoundToHW(TowardZeroF32_TowardPositiveF64) ==
293*0fca6ea1SDimitry Andric getModeRegisterRoundMode(HWTowardZero, HWTowardPositive));
294*0fca6ea1SDimitry Andric static_assert(decodeFltRoundToHW(TowardZeroF32_TowardNegativeF64) ==
295*0fca6ea1SDimitry Andric getModeRegisterRoundMode(HWTowardZero, HWTowardNegative));
296