@@ -68,8 +68,59 @@ version(LDC)
6868 alias fastmath = ldc.attributes.fastmath;
6969}
7070else
71+ enum
7172{
72- enum { fmamath, optmath, fastmath };
73+ /+ +
74+ Functions attribute, an alias for `AliasSeq!(llvmFastMathFlag("contract"));`.
75+
76+ $(UL
77+ $(LI Allow floating-point contraction (e.g. fusing a multiply followed by an addition into a fused multiply-and-add). )
78+ )
79+
80+ Note: Can be used with all compilers.
81+ +/
82+ fmamath,
83+
84+ /+ +
85+ Functions attribute, an alias for `AliasSeq!(llvmAttr("unsafe-fp-math", "false"), llvmFastMathFlag("fast"))`.
86+
87+ It is similar to $(LREF fastmath), but does not allow unsafe-fp-math.
88+ This flag does NOT force LDC to use the reciprocal of an argument rather than perform division.
89+
90+ This flag is default for string lambdas.
91+
92+ Note: Can be used with all compilers.
93+ +/
94+ optmath,
95+
96+ /+ +
97+ Functions attribute, an alias for `ldc.attributes.fastmath = AliasSeq!(llvmAttr("unsafe-fp-math", "true"), llvmFastMathFlag("fast"))` .
98+
99+ $(UL
100+
101+ $(LI Enable optimizations that make unsafe assumptions about IEEE math (e.g. that addition is associative) or may not work for all input ranges.
102+ These optimizations allow the code generator to make use of some instructions which would otherwise not be usable (such as fsin on X86). )
103+
104+ $(LI Allow optimizations to assume the arguments and result are not NaN.
105+ Such optimizations are required to retain defined behavior over NaNs,
106+ but the value of the result is undefined. )
107+
108+ $(LI Allow optimizations to assume the arguments and result are not +$(BACKTICK)-inf.
109+ Such optimizations are required to retain defined behavior over +$(BACKTICK)-Inf,
110+ but the value of the result is undefined. )
111+
112+ $(LI Allow optimizations to treat the sign of a zero argument or result as insignificant. )
113+
114+ $(LI Allow optimizations to use the reciprocal of an argument rather than perform division. )
115+
116+ $(LI Allow floating-point contraction (e.g. fusing a multiply followed by an addition into a fused multiply-and-add). )
117+
118+ $(LI Allow algebraically equivalent transformations that may dramatically change results in floating point (e.g. reassociate). )
119+ )
120+
121+ Note: Can be used with all compilers.
122+ +/
123+ fastmath
73124}
74125
75126version (LDC )
0 commit comments