LLVM: lib/IR/FPEnv.cpp Source File (original) (raw)

1

2

3

4

5

6

7

8

9

10

11

12

13

14

20#include

21

22using namespace llvm;

23

24std::optional

37

38std::optional

40 std::optional RoundingStr;

41 switch (UseRounding) {

43 RoundingStr = "round.dynamic";

44 break;

46 RoundingStr = "round.tonearest";

47 break;

49 RoundingStr = "round.tonearestaway";

50 break;

52 RoundingStr = "round.downward";

53 break;

55 RoundingStr = "round.upward";

56 break;

58 RoundingStr = "round.towardzero";

59 break;

60 default:

61 break;

62 }

63 return RoundingStr;

64}

65

66std::optionalfp::ExceptionBehavior

74

75std::optional

77 std::optional ExceptStr;

78 switch (UseExcept) {

80 ExceptStr = "fpexcept.strict";

81 break;

83 ExceptStr = "fpexcept.ignore";

84 break;

86 ExceptStr = "fpexcept.maytrap";

87 break;

88 }

89 return ExceptStr;

90}

91

94 switch (Instr.getOpcode()) {

95 case Instruction::FCmp:

96

97

98 IID = Intrinsic::experimental_constrained_fcmp;

99 break;

100

101

102#define INSTRUCTION(NAME, NARG, ROUND_MODE, INTRINSIC) \

103 case Instruction::NAME: \

104 IID = Intrinsic::INTRINSIC; \

105 break;

106#define FUNCTION(NAME, NARG, ROUND_MODE, INTRINSIC)

107#define CMP_INSTRUCTION(NAME, NARG, ROUND_MODE, INTRINSIC, DAGN)

108#include "llvm/IR/ConstrainedOps.def"

109

110

111 case Instruction::Call:

113 switch (IntrinCall->getIntrinsicID()) {

114#define FUNCTION(NAME, NARG, ROUND_MODE, INTRINSIC) \

115 case Intrinsic::NAME: \

116 IID = Intrinsic::INTRINSIC; \

117 break;

118#define INSTRUCTION(NAME, NARG, ROUND_MODE, INTRINSIC)

119#define CMP_INSTRUCTION(NAME, NARG, ROUND_MODE, INTRINSIC, DAGN)

120#include "llvm/IR/ConstrainedOps.def"

121 default:

122 break;

123 }

124 }

125 break;

126 default:

127 break;

128 }

129

130 return IID;

131}

This file contains the declarations of entities that describe floating point environment and related ...

This file implements the StringSwitch template, which mimics a switch() statement whose cases are str...

StringRef - Represent a constant reference to a string, i.e.

A switch()-like statement whose cases are string literals.

StringSwitch & Case(StringLiteral S, T Value)

ExceptionBehavior

Exception behavior used for floating point operations.

@ ebStrict

This corresponds to "fpexcept.strict".

@ ebMayTrap

This corresponds to "fpexcept.maytrap".

@ ebIgnore

This corresponds to "fpexcept.ignore".

This is an optimization pass for GlobalISel generic memory operations.

decltype(auto) dyn_cast(const From &Val)

dyn_cast - Return the argument parameter cast to the specified type.

LLVM_ABI std::optional< StringRef > convertRoundingModeToStr(RoundingMode)

For any RoundingMode enumerator, returns a string valid as input in constrained intrinsic rounding mo...

Definition FPEnv.cpp:39

LLVM_ABI std::optional< StringRef > convertExceptionBehaviorToStr(fp::ExceptionBehavior)

For any ExceptionBehavior enumerator, returns a string valid as input in constrained intrinsic except...

Definition FPEnv.cpp:76

LLVM_ABI Intrinsic::ID getConstrainedIntrinsicID(const Instruction &Instr)

Returns constrained intrinsic id to represent the given instruction in strictfp function.

Definition FPEnv.cpp:92

LLVM_ABI std::optional< fp::ExceptionBehavior > convertStrToExceptionBehavior(StringRef)

Returns a valid ExceptionBehavior enumerator when given a string valid as input in constrained intrin...

Definition FPEnv.cpp:67

RoundingMode

Rounding mode.

@ TowardZero

roundTowardZero.

@ NearestTiesToEven

roundTiesToEven.

@ Dynamic

Denotes mode unknown at compile time.

@ TowardPositive

roundTowardPositive.

@ NearestTiesToAway

roundTiesToAway.

@ TowardNegative

roundTowardNegative.

LLVM_ABI std::optional< RoundingMode > convertStrToRoundingMode(StringRef)

Returns a valid RoundingMode enumerator when given a string that is valid as input in constrained int...

Definition FPEnv.cpp:25