@@ -17,14 +17,9 @@ You should have received a copy of the GNU General Public License
17
17
along with RandomX. If not, see<http://www.gnu.org/licenses/>.
18
18
*/
19
19
20
- // #define DEBUG
21
-
22
20
#pragma STDC FENV_ACCESS ON
23
21
#include < cfenv>
24
22
#include < cmath>
25
- #ifdef DEBUG
26
- #include < iostream>
27
- #endif
28
23
#include " common.hpp"
29
24
#include " intrin_portable.h"
30
25
#include " blake2/endian.h"
@@ -128,41 +123,6 @@ along with RandomX. If not, see<http://www.gnu.org/licenses/>.
128
123
#define HAVE_SMULH
129
124
#endif
130
125
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
-
166
126
void setRoundMode (uint32_t rcflag) {
167
127
switch (rcflag & 3 ) {
168
128
case RoundDown:
@@ -182,30 +142,6 @@ void setRoundMode(uint32_t rcflag) {
182
142
}
183
143
}
184
144
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
-
209
145
void initFpu () {
210
146
#ifdef __SSE2__
211
147
_mm_setcsr (0x9FC0 ); // Flush to zero, denormals are zero, default rounding mode, all exceptions disabled
0 commit comments