@@ -17,14 +17,9 @@ You should have received a copy of the GNU General Public License
1717along with RandomX. If not, see<http://www.gnu.org/licenses/>.
1818*/
1919
20- // #define DEBUG
21-
2220#pragma STDC FENV_ACCESS ON
2321#include < cfenv>
2422#include < cmath>
25- #ifdef DEBUG
26- #include < iostream>
27- #endif
2823#include " common.hpp"
2924#include " intrin_portable.h"
3025#include " blake2/endian.h"
@@ -128,41 +123,6 @@ along with RandomX. If not, see<http://www.gnu.org/licenses/>.
128123 #define HAVE_SMULH
129124#endif
130125
131- #if __GNUC__ >= 5
132- #undef __has_builtin
133- #define __has_builtin (x ) 1
134- #endif
135-
136- #if defined(__has_builtin)
137- #if __has_builtin(__builtin_sub_overflow)
138- static inline bool subOverflow_ (uint32_t a, uint32_t b) {
139- int32_t temp;
140- return __builtin_sub_overflow (unsigned32ToSigned2sCompl (a), unsigned32ToSigned2sCompl (b), &temp);
141- }
142- #define HAVE_SUB_OVERFLOW
143- #endif
144- #endif
145-
146- #ifndef HAVE_SUB_OVERFLOW
147- static inline bool subOverflow_ (uint32_t a, uint32_t b) {
148- auto c = unsigned32ToSigned2sCompl (a - b);
149- return (c < unsigned32ToSigned2sCompl (a)) != (unsigned32ToSigned2sCompl (b) > 0 );
150- }
151- #define HAVE_SUB_OVERFLOW
152- #endif
153-
154- static inline double FlushDenormalNaN (double x) {
155- int fpc = std::fpclassify (x);
156- if (fpc == FP_SUBNORMAL || fpc == FP_NAN ) {
157- return 0.0 ;
158- }
159- return x;
160- }
161-
162- static inline double FlushNaN (double x) {
163- return x != x ? 0.0 : x;
164- }
165-
166126void setRoundMode (uint32_t rcflag) {
167127 switch (rcflag & 3 ) {
168128 case RoundDown:
@@ -182,30 +142,6 @@ void setRoundMode(uint32_t rcflag) {
182142 }
183143}
184144
185- bool condition (uint32_t type, uint32_t value, uint32_t imm32) {
186- switch (type & 7 )
187- {
188- case 0 :
189- return value <= imm32;
190- case 1 :
191- return value > imm32;
192- case 2 :
193- return unsigned32ToSigned2sCompl (value - imm32) < 0 ;
194- case 3 :
195- return unsigned32ToSigned2sCompl (value - imm32) >= 0 ;
196- case 4 :
197- return subOverflow_ (value, imm32);
198- case 5 :
199- return !subOverflow_ (value, imm32);
200- case 6 :
201- return unsigned32ToSigned2sCompl (value) < unsigned32ToSigned2sCompl (imm32);
202- case 7 :
203- return unsigned32ToSigned2sCompl (value) >= unsigned32ToSigned2sCompl (imm32);
204- default :
205- UNREACHABLE ;
206- }
207- }
208-
209145void initFpu () {
210146#ifdef __SSE2__
211147 _mm_setcsr (0x9FC0 ); // Flush to zero, denormals are zero, default rounding mode, all exceptions disabled
0 commit comments