summaryrefslogtreecommitdiff
path: root/src/core
diff options
context:
space:
mode:
authorGravatar Lioncash2015-02-09 09:32:56 -0500
committerGravatar Lioncash2015-02-09 09:32:56 -0500
commitd832c48864f5921218ea964b4eff62fd283849b5 (patch)
tree343e8fba8c0f59afcb326fd5718db40879ede32a /src/core
parentMerge pull request #545 from yuriks/patch-1 (diff)
downloadyuzu-d832c48864f5921218ea964b4eff62fd283849b5.tar.gz
yuzu-d832c48864f5921218ea964b4eff62fd283849b5.tar.xz
yuzu-d832c48864f5921218ea964b4eff62fd283849b5.zip
vfp_helper: Normalize tabs to spaces
Diffstat (limited to 'src/core')
-rw-r--r--src/core/arm/skyeye_common/vfp/vfp_helper.h342
1 files changed, 170 insertions, 172 deletions
diff --git a/src/core/arm/skyeye_common/vfp/vfp_helper.h b/src/core/arm/skyeye_common/vfp/vfp_helper.h
index 581f0358f..4798d523d 100644
--- a/src/core/arm/skyeye_common/vfp/vfp_helper.h
+++ b/src/core/arm/skyeye_common/vfp/vfp_helper.h
@@ -104,125 +104,125 @@
104 104
105static inline u32 vfp_shiftright32jamming(u32 val, unsigned int shift) 105static inline u32 vfp_shiftright32jamming(u32 val, unsigned int shift)
106{ 106{
107 if (shift) { 107 if (shift) {
108 if (shift < 32) 108 if (shift < 32)
109 val = val >> shift | ((val << (32 - shift)) != 0); 109 val = val >> shift | ((val << (32 - shift)) != 0);
110 else 110 else
111 val = val != 0; 111 val = val != 0;
112 } 112 }
113 return val; 113 return val;
114} 114}
115 115
116static inline u64 vfp_shiftright64jamming(u64 val, unsigned int shift) 116static inline u64 vfp_shiftright64jamming(u64 val, unsigned int shift)
117{ 117{
118 if (shift) { 118 if (shift) {
119 if (shift < 64) 119 if (shift < 64)
120 val = val >> shift | ((val << (64 - shift)) != 0); 120 val = val >> shift | ((val << (64 - shift)) != 0);
121 else 121 else
122 val = val != 0; 122 val = val != 0;
123 } 123 }
124 return val; 124 return val;
125} 125}
126 126
127static inline u32 vfp_hi64to32jamming(u64 val) 127static inline u32 vfp_hi64to32jamming(u64 val)
128{ 128{
129 u32 v; 129 u32 v;
130 u32 highval = val >> 32; 130 u32 highval = val >> 32;
131 u32 lowval = val & 0xffffffff; 131 u32 lowval = val & 0xffffffff;
132 132
133 if (lowval >= 1) 133 if (lowval >= 1)
134 v = highval | 1; 134 v = highval | 1;
135 else 135 else
136 v = highval; 136 v = highval;
137 137
138 return v; 138 return v;
139} 139}
140 140
141static inline void add128(u64 *resh, u64 *resl, u64 nh, u64 nl, u64 mh, u64 ml) 141static inline void add128(u64* resh, u64* resl, u64 nh, u64 nl, u64 mh, u64 ml)
142{ 142{
143 *resl = nl + ml; 143 *resl = nl + ml;
144 *resh = nh + mh; 144 *resh = nh + mh;
145 if (*resl < nl) 145 if (*resl < nl)
146 *resh += 1; 146 *resh += 1;
147} 147}
148 148
149static inline void sub128(u64 *resh, u64 *resl, u64 nh, u64 nl, u64 mh, u64 ml) 149static inline void sub128(u64* resh, u64* resl, u64 nh, u64 nl, u64 mh, u64 ml)
150{ 150{
151 *resl = nl - ml; 151 *resl = nl - ml;
152 *resh = nh - mh; 152 *resh = nh - mh;
153 if (*resl > nl) 153 if (*resl > nl)
154 *resh -= 1; 154 *resh -= 1;
155} 155}
156 156
157static inline void mul64to128(u64 *resh, u64 *resl, u64 n, u64 m) 157static inline void mul64to128(u64* resh, u64* resl, u64 n, u64 m)
158{ 158{
159 u32 nh, nl, mh, ml; 159 u32 nh, nl, mh, ml;
160 u64 rh, rma, rmb, rl; 160 u64 rh, rma, rmb, rl;
161 161
162 nl = n; 162 nl = n;
163 ml = m; 163 ml = m;
164 rl = (u64)nl * ml; 164 rl = (u64)nl * ml;
165 165
166 nh = n >> 32; 166 nh = n >> 32;
167 rma = (u64)nh * ml; 167 rma = (u64)nh * ml;
168 168
169 mh = m >> 32; 169 mh = m >> 32;
170 rmb = (u64)nl * mh; 170 rmb = (u64)nl * mh;
171 rma += rmb; 171 rma += rmb;
172 172
173 rh = (u64)nh * mh; 173 rh = (u64)nh * mh;
174 rh += ((u64)(rma < rmb) << 32) + (rma >> 32); 174 rh += ((u64)(rma < rmb) << 32) + (rma >> 32);
175 175
176 rma <<= 32; 176 rma <<= 32;
177 rl += rma; 177 rl += rma;
178 rh += (rl < rma); 178 rh += (rl < rma);
179 179
180 *resl = rl; 180 *resl = rl;
181 *resh = rh; 181 *resh = rh;
182} 182}
183 183
184static inline void shift64left(u64 *resh, u64 *resl, u64 n) 184static inline void shift64left(u64* resh, u64* resl, u64 n)
185{ 185{
186 *resh = n >> 63; 186 *resh = n >> 63;
187 *resl = n << 1; 187 *resl = n << 1;
188} 188}
189 189
190static inline u64 vfp_hi64multiply64(u64 n, u64 m) 190static inline u64 vfp_hi64multiply64(u64 n, u64 m)
191{ 191{
192 u64 rh, rl; 192 u64 rh, rl;
193 mul64to128(&rh, &rl, n, m); 193 mul64to128(&rh, &rl, n, m);
194 return rh | (rl != 0); 194 return rh | (rl != 0);
195} 195}
196 196
197static inline u64 vfp_estimate_div128to64(u64 nh, u64 nl, u64 m) 197static inline u64 vfp_estimate_div128to64(u64 nh, u64 nl, u64 m)
198{ 198{
199 u64 mh, ml, remh, reml, termh, terml, z; 199 u64 mh, ml, remh, reml, termh, terml, z;
200 200
201 if (nh >= m) 201 if (nh >= m)
202 return ~0ULL; 202 return ~0ULL;
203 mh = m >> 32; 203 mh = m >> 32;
204 if (mh << 32 <= nh) { 204 if (mh << 32 <= nh) {
205 z = 0xffffffff00000000ULL; 205 z = 0xffffffff00000000ULL;
206 } else { 206 } else {
207 z = nh; 207 z = nh;
208 do_div(z, mh); 208 do_div(z, mh);
209 z <<= 32; 209 z <<= 32;
210 } 210 }
211 mul64to128(&termh, &terml, m, z); 211 mul64to128(&termh, &terml, m, z);
212 sub128(&remh, &reml, nh, nl, termh, terml); 212 sub128(&remh, &reml, nh, nl, termh, terml);
213 ml = m << 32; 213 ml = m << 32;
214 while ((s64)remh < 0) { 214 while ((s64)remh < 0) {
215 z -= 0x100000000ULL; 215 z -= 0x100000000ULL;
216 add128(&remh, &reml, remh, reml, mh, ml); 216 add128(&remh, &reml, remh, reml, mh, ml);
217 } 217 }
218 remh = (remh << 32) | (reml >> 32); 218 remh = (remh << 32) | (reml >> 32);
219 if (mh << 32 <= remh) { 219 if (mh << 32 <= remh) {
220 z |= 0xffffffff; 220 z |= 0xffffffff;
221 } else { 221 } else {
222 do_div(remh, mh); 222 do_div(remh, mh);
223 z |= remh; 223 z |= remh;
224 } 224 }
225 return z; 225 return z;
226} 226}
227 227
228/* 228/*
@@ -234,9 +234,9 @@ static inline u64 vfp_estimate_div128to64(u64 nh, u64 nl, u64 m)
234 * Single-precision 234 * Single-precision
235 */ 235 */
236struct vfp_single { 236struct vfp_single {
237 s16 exponent; 237 s16 exponent;
238 u16 sign; 238 u16 sign;
239 u32 significand; 239 u32 significand;
240}; 240};
241 241
242/* 242/*
@@ -271,16 +271,16 @@ struct vfp_single {
271 */ 271 */
272static inline void vfp_single_unpack(struct vfp_single *s, s32 val) 272static inline void vfp_single_unpack(struct vfp_single *s, s32 val)
273{ 273{
274 u32 significand; 274 u32 significand;
275 275
276 s->sign = vfp_single_packed_sign(val) >> 16, 276 s->sign = vfp_single_packed_sign(val) >> 16,
277 s->exponent = vfp_single_packed_exponent(val); 277 s->exponent = vfp_single_packed_exponent(val);
278 278
279 significand = (u32) val; 279 significand = (u32) val;
280 significand = (significand << (32 - VFP_SINGLE_MANTISSA_BITS)) >> 2; 280 significand = (significand << (32 - VFP_SINGLE_MANTISSA_BITS)) >> 2;
281 if (s->exponent && s->exponent != 255) 281 if (s->exponent && s->exponent != 255)
282 significand |= 0x40000000; 282 significand |= 0x40000000;
283 s->significand = significand; 283 s->significand = significand;
284} 284}
285 285
286/* 286/*
@@ -289,11 +289,10 @@ static inline void vfp_single_unpack(struct vfp_single *s, s32 val)
289 */ 289 */
290static inline s32 vfp_single_pack(struct vfp_single *s) 290static inline s32 vfp_single_pack(struct vfp_single *s)
291{ 291{
292 u32 val; 292 u32 val = (s->sign << 16) +
293 val = (s->sign << 16) + 293 (s->exponent << VFP_SINGLE_MANTISSA_BITS) +
294 (s->exponent << VFP_SINGLE_MANTISSA_BITS) + 294 (s->significand >> VFP_SINGLE_LOW_BITS);
295 (s->significand >> VFP_SINGLE_LOW_BITS); 295 return (s32)val;
296 return (s32)val;
297} 296}
298 297
299#define VFP_NUMBER (1<<0) 298#define VFP_NUMBER (1<<0)
@@ -308,21 +307,21 @@ static inline s32 vfp_single_pack(struct vfp_single *s)
308 307
309static inline int vfp_single_type(struct vfp_single *s) 308static inline int vfp_single_type(struct vfp_single *s)
310{ 309{
311 int type = VFP_NUMBER; 310 int type = VFP_NUMBER;
312 if (s->exponent == 255) { 311 if (s->exponent == 255) {
313 if (s->significand == 0) 312 if (s->significand == 0)
314 type = VFP_INFINITY; 313 type = VFP_INFINITY;
315 else if (s->significand & VFP_SINGLE_SIGNIFICAND_QNAN) 314 else if (s->significand & VFP_SINGLE_SIGNIFICAND_QNAN)
316 type = VFP_QNAN; 315 type = VFP_QNAN;
317 else 316 else
318 type = VFP_SNAN; 317 type = VFP_SNAN;
319 } else if (s->exponent == 0) { 318 } else if (s->exponent == 0) {
320 if (s->significand == 0) 319 if (s->significand == 0)
321 type |= VFP_ZERO; 320 type |= VFP_ZERO;
322 else 321 else
323 type |= VFP_DENORMAL; 322 type |= VFP_DENORMAL;
324 } 323 }
325 return type; 324 return type;
326} 325}
327 326
328 327
@@ -332,9 +331,9 @@ u32 vfp_single_normaliseround(ARMul_State* state, int sd, struct vfp_single *vs,
332 * Double-precision 331 * Double-precision
333 */ 332 */
334struct vfp_double { 333struct vfp_double {
335 s16 exponent; 334 s16 exponent;
336 u16 sign; 335 u16 sign;
337 u64 significand; 336 u64 significand;
338}; 337};
339 338
340/* 339/*
@@ -374,16 +373,16 @@ struct vfp_double {
374 */ 373 */
375static inline void vfp_double_unpack(struct vfp_double *s, s64 val) 374static inline void vfp_double_unpack(struct vfp_double *s, s64 val)
376{ 375{
377 u64 significand; 376 u64 significand;
378 377
379 s->sign = vfp_double_packed_sign(val) >> 48; 378 s->sign = vfp_double_packed_sign(val) >> 48;
380 s->exponent = vfp_double_packed_exponent(val); 379 s->exponent = vfp_double_packed_exponent(val);
381 380
382 significand = (u64) val; 381 significand = (u64) val;
383 significand = (significand << (64 - VFP_DOUBLE_MANTISSA_BITS)) >> 2; 382 significand = (significand << (64 - VFP_DOUBLE_MANTISSA_BITS)) >> 2;
384 if (s->exponent && s->exponent != 2047) 383 if (s->exponent && s->exponent != 2047)
385 significand |= (1ULL << 62); 384 significand |= (1ULL << 62);
386 s->significand = significand; 385 s->significand = significand;
387} 386}
388 387
389/* 388/*
@@ -392,30 +391,29 @@ static inline void vfp_double_unpack(struct vfp_double *s, s64 val)
392 */ 391 */
393static inline s64 vfp_double_pack(struct vfp_double *s) 392static inline s64 vfp_double_pack(struct vfp_double *s)
394{ 393{
395 u64 val; 394 u64 val = ((u64)s->sign << 48) +
396 val = ((u64)s->sign << 48) + 395 ((u64)s->exponent << VFP_DOUBLE_MANTISSA_BITS) +
397 ((u64)s->exponent << VFP_DOUBLE_MANTISSA_BITS) + 396 (s->significand >> VFP_DOUBLE_LOW_BITS);
398 (s->significand >> VFP_DOUBLE_LOW_BITS); 397 return (s64)val;
399 return (s64)val;
400} 398}
401 399
402static inline int vfp_double_type(struct vfp_double *s) 400static inline int vfp_double_type(struct vfp_double *s)
403{ 401{
404 int type = VFP_NUMBER; 402 int type = VFP_NUMBER;
405 if (s->exponent == 2047) { 403 if (s->exponent == 2047) {
406 if (s->significand == 0) 404 if (s->significand == 0)
407 type = VFP_INFINITY; 405 type = VFP_INFINITY;
408 else if (s->significand & VFP_DOUBLE_SIGNIFICAND_QNAN) 406 else if (s->significand & VFP_DOUBLE_SIGNIFICAND_QNAN)
409 type = VFP_QNAN; 407 type = VFP_QNAN;
410 else 408 else
411 type = VFP_SNAN; 409 type = VFP_SNAN;
412 } else if (s->exponent == 0) { 410 } else if (s->exponent == 0) {
413 if (s->significand == 0) 411 if (s->significand == 0)
414 type |= VFP_ZERO; 412 type |= VFP_ZERO;
415 else 413 else
416 type |= VFP_DENORMAL; 414 type |= VFP_DENORMAL;
417 } 415 }
418 return type; 416 return type;
419} 417}
420 418
421u32 vfp_double_normaliseround(ARMul_State* state, int dd, struct vfp_double *vd, u32 fpscr, u32 exceptions, const char *func); 419u32 vfp_double_normaliseround(ARMul_State* state, int dd, struct vfp_double *vd, u32 fpscr, u32 exceptions, const char *func);
@@ -448,37 +446,37 @@ u32 vfp_estimate_sqrt_significand(u32 exponent, u32 significand);
448#define OP_SM (1 << 2) 446#define OP_SM (1 << 2)
449 447
450struct op { 448struct op {
451 u32 (* const fn)(ARMul_State* state, int dd, int dn, int dm, u32 fpscr); 449 u32 (* const fn)(ARMul_State* state, int dd, int dn, int dm, u32 fpscr);
452 u32 flags; 450 u32 flags;
453}; 451};
454 452
455static inline u32 fls(ARMword x) 453static inline u32 fls(ARMword x)
456{ 454{
457 int r = 32; 455 int r = 32;
458 456
459 if (!x) 457 if (!x)
460 return 0; 458 return 0;
461 if (!(x & 0xffff0000u)) { 459 if (!(x & 0xffff0000u)) {
462 x <<= 16; 460 x <<= 16;
463 r -= 16; 461 r -= 16;
464 } 462 }
465 if (!(x & 0xff000000u)) { 463 if (!(x & 0xff000000u)) {
466 x <<= 8; 464 x <<= 8;
467 r -= 8; 465 r -= 8;
468 } 466 }
469 if (!(x & 0xf0000000u)) { 467 if (!(x & 0xf0000000u)) {
470 x <<= 4; 468 x <<= 4;
471 r -= 4; 469 r -= 4;
472 } 470 }
473 if (!(x & 0xc0000000u)) { 471 if (!(x & 0xc0000000u)) {
474 x <<= 2; 472 x <<= 2;
475 r -= 2; 473 r -= 2;
476 } 474 }
477 if (!(x & 0x80000000u)) { 475 if (!(x & 0x80000000u)) {
478 x <<= 1; 476 x <<= 1;
479 r -= 1; 477 r -= 1;
480 } 478 }
481 return r; 479 return r;
482 480
483} 481}
484 482