summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGravatar Jannik Vogel2016-05-18 15:12:31 +0200
committerGravatar Jannik Vogel2016-05-18 16:28:13 +0200
commitedf30d84cc0e8299d61c98f5bb40a6428d1576bc (patch)
treea53e1a34a139964323127aff92f101018dbfb2e3 /src
parentFix exception propagation for VFP single precision (diff)
downloadyuzu-edf30d84cc0e8299d61c98f5bb40a6428d1576bc.tar.gz
yuzu-edf30d84cc0e8299d61c98f5bb40a6428d1576bc.tar.xz
yuzu-edf30d84cc0e8299d61c98f5bb40a6428d1576bc.zip
Remove `exceptions` parameter from `normaliseround` VFP functions
Diffstat (limited to 'src')
-rw-r--r--src/core/arm/skyeye_common/vfp/vfp_helper.h4
-rw-r--r--src/core/arm/skyeye_common/vfp/vfpdouble.cpp40
-rw-r--r--src/core/arm/skyeye_common/vfp/vfpsingle.cpp41
3 files changed, 57 insertions, 28 deletions
diff --git a/src/core/arm/skyeye_common/vfp/vfp_helper.h b/src/core/arm/skyeye_common/vfp/vfp_helper.h
index c66a3fad4..68714800c 100644
--- a/src/core/arm/skyeye_common/vfp/vfp_helper.h
+++ b/src/core/arm/skyeye_common/vfp/vfp_helper.h
@@ -304,7 +304,7 @@ inline s32 vfp_single_pack(const vfp_single* s)
304} 304}
305 305
306 306
307u32 vfp_single_normaliseround(ARMul_State* state, int sd, vfp_single* vs, u32 fpscr, u32 exceptions, const char* func); 307u32 vfp_single_normaliseround(ARMul_State* state, int sd, vfp_single* vs, u32 fpscr, const char* func);
308 308
309// Double-precision 309// Double-precision
310struct vfp_double { 310struct vfp_double {
@@ -451,4 +451,4 @@ inline u32 fls(u32 x)
451 451
452u32 vfp_double_multiply(vfp_double* vdd, vfp_double* vdn, vfp_double* vdm, u32 fpscr); 452u32 vfp_double_multiply(vfp_double* vdd, vfp_double* vdn, vfp_double* vdm, u32 fpscr);
453u32 vfp_double_add(vfp_double* vdd, vfp_double* vdn, vfp_double *vdm, u32 fpscr); 453u32 vfp_double_add(vfp_double* vdd, vfp_double* vdn, vfp_double *vdm, u32 fpscr);
454u32 vfp_double_normaliseround(ARMul_State* state, int dd, vfp_double* vd, u32 fpscr, u32 exceptions, const char* func); 454u32 vfp_double_normaliseround(ARMul_State* state, int dd, vfp_double* vd, u32 fpscr, const char* func);
diff --git a/src/core/arm/skyeye_common/vfp/vfpdouble.cpp b/src/core/arm/skyeye_common/vfp/vfpdouble.cpp
index 0182b90b8..580e60c85 100644
--- a/src/core/arm/skyeye_common/vfp/vfpdouble.cpp
+++ b/src/core/arm/skyeye_common/vfp/vfpdouble.cpp
@@ -85,11 +85,12 @@ static void vfp_double_normalise_denormal(struct vfp_double *vd)
85 vfp_double_dump("normalise_denormal: out", vd); 85 vfp_double_dump("normalise_denormal: out", vd);
86} 86}
87 87
88u32 vfp_double_normaliseround(ARMul_State* state, int dd, struct vfp_double *vd, u32 fpscr, u32 exceptions, const char *func) 88u32 vfp_double_normaliseround(ARMul_State* state, int dd, struct vfp_double *vd, u32 fpscr, const char *func)
89{ 89{
90 u64 significand, incr; 90 u64 significand, incr;
91 int exponent, shift, underflow; 91 int exponent, shift, underflow;
92 u32 rmode; 92 u32 rmode;
93 u32 exceptions = 0;
93 94
94 vfp_double_dump("pack: in", vd); 95 vfp_double_dump("pack: in", vd);
95 96
@@ -370,8 +371,7 @@ sqrt_invalid:
370 } 371 }
371 vdd.significand = vfp_shiftright64jamming(vdd.significand, 1); 372 vdd.significand = vfp_shiftright64jamming(vdd.significand, 1);
372 373
373 exceptions |= vfp_double_normaliseround(state, dd, &vdd, fpscr, 0, "fsqrt"); 374 exceptions |= vfp_double_normaliseround(state, dd, &vdd, fpscr, "fsqrt");
374
375 return exceptions; 375 return exceptions;
376} 376}
377 377
@@ -507,7 +507,8 @@ static u32 vfp_double_fcvts(ARMul_State* state, int sd, int unused, int dm, u32
507 else 507 else
508 vsd.exponent = vdm.exponent - (1023 - 127); 508 vsd.exponent = vdm.exponent - (1023 - 127);
509 509
510 return vfp_single_normaliseround(state, sd, &vsd, fpscr, exceptions, "fcvts"); 510 exceptions |= vfp_single_normaliseround(state, sd, &vsd, fpscr, "fcvts");
511 return exceptions;
511 512
512pack_nan: 513pack_nan:
513 vfp_put_float(state, vfp_single_pack(&vsd), sd); 514 vfp_put_float(state, vfp_single_pack(&vsd), sd);
@@ -517,6 +518,7 @@ pack_nan:
517static u32 vfp_double_fuito(ARMul_State* state, int dd, int unused, int dm, u32 fpscr) 518static u32 vfp_double_fuito(ARMul_State* state, int dd, int unused, int dm, u32 fpscr)
518{ 519{
519 struct vfp_double vdm; 520 struct vfp_double vdm;
521 u32 exceptions = 0;
520 u32 m = vfp_get_float(state, dm); 522 u32 m = vfp_get_float(state, dm);
521 523
522 LOG_TRACE(Core_ARM11, "In %s", __FUNCTION__); 524 LOG_TRACE(Core_ARM11, "In %s", __FUNCTION__);
@@ -524,12 +526,14 @@ static u32 vfp_double_fuito(ARMul_State* state, int dd, int unused, int dm, u32
524 vdm.exponent = 1023 + 63 - 1; 526 vdm.exponent = 1023 + 63 - 1;
525 vdm.significand = (u64)m; 527 vdm.significand = (u64)m;
526 528
527 return vfp_double_normaliseround(state, dd, &vdm, fpscr, 0, "fuito"); 529 exceptions |= vfp_double_normaliseround(state, dd, &vdm, fpscr, "fuito");
530 return exceptions;
528} 531}
529 532
530static u32 vfp_double_fsito(ARMul_State* state, int dd, int unused, int dm, u32 fpscr) 533static u32 vfp_double_fsito(ARMul_State* state, int dd, int unused, int dm, u32 fpscr)
531{ 534{
532 struct vfp_double vdm; 535 struct vfp_double vdm;
536 u32 exceptions = 0;
533 u32 m = vfp_get_float(state, dm); 537 u32 m = vfp_get_float(state, dm);
534 538
535 LOG_TRACE(Core_ARM11, "In %s", __FUNCTION__); 539 LOG_TRACE(Core_ARM11, "In %s", __FUNCTION__);
@@ -537,7 +541,8 @@ static u32 vfp_double_fsito(ARMul_State* state, int dd, int unused, int dm, u32
537 vdm.exponent = 1023 + 63 - 1; 541 vdm.exponent = 1023 + 63 - 1;
538 vdm.significand = vdm.sign ? (~m + 1) : m; 542 vdm.significand = vdm.sign ? (~m + 1) : m;
539 543
540 return vfp_double_normaliseround(state, dd, &vdm, fpscr, 0, "fsito"); 544 exceptions |= vfp_double_normaliseround(state, dd, &vdm, fpscr, "fsito");
545 return exceptions;
541} 546}
542 547
543static u32 vfp_double_ftoui(ARMul_State* state, int sd, int unused, int dm, u32 fpscr) 548static u32 vfp_double_ftoui(ARMul_State* state, int sd, int unused, int dm, u32 fpscr)
@@ -918,7 +923,8 @@ vfp_double_multiply_accumulate(ARMul_State* state, int dd, int dn, int dm, u32 f
918 923
919 exceptions |= vfp_double_add(&vdd, &vdn, &vdp, fpscr); 924 exceptions |= vfp_double_add(&vdd, &vdn, &vdp, fpscr);
920 925
921 return vfp_double_normaliseround(state, dd, &vdd, fpscr, exceptions, func); 926 exceptions |= vfp_double_normaliseround(state, dd, &vdd, fpscr, func);
927 return exceptions;
922} 928}
923 929
924/* 930/*
@@ -979,7 +985,9 @@ static u32 vfp_double_fmul(ARMul_State* state, int dd, int dn, int dm, u32 fpscr
979 vfp_double_normalise_denormal(&vdm); 985 vfp_double_normalise_denormal(&vdm);
980 986
981 exceptions |= vfp_double_multiply(&vdd, &vdn, &vdm, fpscr); 987 exceptions |= vfp_double_multiply(&vdd, &vdn, &vdm, fpscr);
982 return vfp_double_normaliseround(state, dd, &vdd, fpscr, exceptions, "fmul"); 988
989 exceptions |= vfp_double_normaliseround(state, dd, &vdd, fpscr, "fmul");
990 return exceptions;
983} 991}
984 992
985/* 993/*
@@ -1002,7 +1010,8 @@ static u32 vfp_double_fnmul(ARMul_State* state, int dd, int dn, int dm, u32 fpsc
1002 exceptions |= vfp_double_multiply(&vdd, &vdn, &vdm, fpscr); 1010 exceptions |= vfp_double_multiply(&vdd, &vdn, &vdm, fpscr);
1003 vdd.sign = vfp_sign_negate(vdd.sign); 1011 vdd.sign = vfp_sign_negate(vdd.sign);
1004 1012
1005 return vfp_double_normaliseround(state, dd, &vdd, fpscr, exceptions, "fnmul"); 1013 exceptions |= vfp_double_normaliseround(state, dd, &vdd, fpscr, "fnmul");
1014 return exceptions;
1006} 1015}
1007 1016
1008/* 1017/*
@@ -1024,7 +1033,8 @@ static u32 vfp_double_fadd(ARMul_State* state, int dd, int dn, int dm, u32 fpscr
1024 1033
1025 exceptions |= vfp_double_add(&vdd, &vdn, &vdm, fpscr); 1034 exceptions |= vfp_double_add(&vdd, &vdn, &vdm, fpscr);
1026 1035
1027 return vfp_double_normaliseround(state, dd, &vdd, fpscr, exceptions, "fadd"); 1036 exceptions |= vfp_double_normaliseround(state, dd, &vdd, fpscr, "fadd");
1037 return exceptions;
1028} 1038}
1029 1039
1030/* 1040/*
@@ -1051,7 +1061,8 @@ static u32 vfp_double_fsub(ARMul_State* state, int dd, int dn, int dm, u32 fpscr
1051 1061
1052 exceptions |= vfp_double_add(&vdd, &vdn, &vdm, fpscr); 1062 exceptions |= vfp_double_add(&vdd, &vdn, &vdm, fpscr);
1053 1063
1054 return vfp_double_normaliseround(state, dd, &vdd, fpscr, exceptions, "fsub"); 1064 exceptions |= vfp_double_normaliseround(state, dd, &vdd, fpscr, "fsub");
1065 return exceptions;
1055} 1066}
1056 1067
1057/* 1068/*
@@ -1134,7 +1145,9 @@ static u32 vfp_double_fdiv(ARMul_State* state, int dd, int dn, int dm, u32 fpscr
1134 } 1145 }
1135 vdd.significand |= (reml != 0); 1146 vdd.significand |= (reml != 0);
1136 } 1147 }
1137 return vfp_double_normaliseround(state, dd, &vdd, fpscr, 0, "fdiv"); 1148
1149 exceptions |= vfp_double_normaliseround(state, dd, &vdd, fpscr, "fdiv");
1150 return exceptions;
1138 1151
1139vdn_nan: 1152vdn_nan:
1140 exceptions |= vfp_propagate_nan(&vdd, &vdn, &vdm, fpscr); 1153 exceptions |= vfp_propagate_nan(&vdd, &vdn, &vdm, fpscr);
@@ -1160,7 +1173,8 @@ infinity:
1160 1173
1161invalid: 1174invalid:
1162 vfp_put_double(state, vfp_double_pack(&vfp_double_default_qnan), dd); 1175 vfp_put_double(state, vfp_double_pack(&vfp_double_default_qnan), dd);
1163 return FPSCR_IOC; 1176 exceptions |= FPSCR_IOC;
1177 return exceptions;
1164} 1178}
1165 1179
1166static struct op fops[] = { 1180static struct op fops[] = {
diff --git a/src/core/arm/skyeye_common/vfp/vfpsingle.cpp b/src/core/arm/skyeye_common/vfp/vfpsingle.cpp
index 5fb6b51ec..23e0cdf26 100644
--- a/src/core/arm/skyeye_common/vfp/vfpsingle.cpp
+++ b/src/core/arm/skyeye_common/vfp/vfpsingle.cpp
@@ -89,10 +89,11 @@ static void vfp_single_normalise_denormal(struct vfp_single *vs)
89} 89}
90 90
91 91
92u32 vfp_single_normaliseround(ARMul_State* state, int sd, struct vfp_single *vs, u32 fpscr, u32 exceptions, const char *func) 92u32 vfp_single_normaliseround(ARMul_State* state, int sd, struct vfp_single *vs, u32 fpscr, const char *func)
93{ 93{
94 u32 significand, incr, rmode; 94 u32 significand, incr, rmode;
95 int exponent, shift, underflow; 95 int exponent, shift, underflow;
96 u32 exceptions = 0;
96 97
97 vfp_single_dump("pack: in", vs); 98 vfp_single_dump("pack: in", vs);
98 99
@@ -409,8 +410,7 @@ sqrt_invalid:
409 } 410 }
410 vsd.significand = vfp_shiftright32jamming(vsd.significand, 1); 411 vsd.significand = vfp_shiftright32jamming(vsd.significand, 1);
411 412
412 exceptions |= vfp_single_normaliseround(state, sd, &vsd, fpscr, 0, "fsqrt"); 413 exceptions |= vfp_single_normaliseround(state, sd, &vsd, fpscr, "fsqrt");
413
414 return exceptions; 414 return exceptions;
415} 415}
416 416
@@ -535,7 +535,8 @@ static u32 vfp_single_fcvtd(ARMul_State* state, int dd, int unused, s32 m, u32 f
535 else 535 else
536 vdd.exponent = vsm.exponent + (1023 - 127); 536 vdd.exponent = vsm.exponent + (1023 - 127);
537 537
538 return vfp_double_normaliseround(state, dd, &vdd, fpscr, exceptions, "fcvtd"); 538 exceptions |= vfp_double_normaliseround(state, dd, &vdd, fpscr, "fcvtd");
539 return exceptions;
539 540
540pack_nan: 541pack_nan:
541 vfp_put_double(state, vfp_double_pack(&vdd), dd); 542 vfp_put_double(state, vfp_double_pack(&vdd), dd);
@@ -545,23 +546,27 @@ pack_nan:
545static u32 vfp_single_fuito(ARMul_State* state, int sd, int unused, s32 m, u32 fpscr) 546static u32 vfp_single_fuito(ARMul_State* state, int sd, int unused, s32 m, u32 fpscr)
546{ 547{
547 struct vfp_single vs; 548 struct vfp_single vs;
549 u32 exceptions = 0;
548 550
549 vs.sign = 0; 551 vs.sign = 0;
550 vs.exponent = 127 + 31 - 1; 552 vs.exponent = 127 + 31 - 1;
551 vs.significand = (u32)m; 553 vs.significand = (u32)m;
552 554
553 return vfp_single_normaliseround(state, sd, &vs, fpscr, 0, "fuito"); 555 exceptions |= vfp_single_normaliseround(state, sd, &vs, fpscr, "fuito");
556 return exceptions;
554} 557}
555 558
556static u32 vfp_single_fsito(ARMul_State* state, int sd, int unused, s32 m, u32 fpscr) 559static u32 vfp_single_fsito(ARMul_State* state, int sd, int unused, s32 m, u32 fpscr)
557{ 560{
558 struct vfp_single vs; 561 struct vfp_single vs;
562 u32 exceptions = 0;
559 563
560 vs.sign = (m & 0x80000000) >> 16; 564 vs.sign = (m & 0x80000000) >> 16;
561 vs.exponent = 127 + 31 - 1; 565 vs.exponent = 127 + 31 - 1;
562 vs.significand = vs.sign ? -m : m; 566 vs.significand = vs.sign ? -m : m;
563 567
564 return vfp_single_normaliseround(state, sd, &vs, fpscr, 0, "fsito"); 568 exceptions |= vfp_single_normaliseround(state, sd, &vs, fpscr, "fsito");
569 return exceptions;
565} 570}
566 571
567static u32 vfp_single_ftoui(ARMul_State* state, int sd, int unused, s32 m, u32 fpscr) 572static u32 vfp_single_ftoui(ARMul_State* state, int sd, int unused, s32 m, u32 fpscr)
@@ -953,7 +958,8 @@ vfp_single_multiply_accumulate(ARMul_State* state, int sd, int sn, s32 m, u32 fp
953 958
954 exceptions |= vfp_single_add(&vsd, &vsn, &vsp, fpscr); 959 exceptions |= vfp_single_add(&vsd, &vsn, &vsp, fpscr);
955 960
956 return vfp_single_normaliseround(state, sd, &vsd, fpscr, exceptions, func); 961 exceptions |= vfp_single_normaliseround(state, sd, &vsd, fpscr, func);
962 return exceptions;
957} 963}
958 964
959/* 965/*
@@ -965,8 +971,10 @@ vfp_single_multiply_accumulate(ARMul_State* state, int sd, int sn, s32 m, u32 fp
965 */ 971 */
966static u32 vfp_single_fmac(ARMul_State* state, int sd, int sn, s32 m, u32 fpscr) 972static u32 vfp_single_fmac(ARMul_State* state, int sd, int sn, s32 m, u32 fpscr)
967{ 973{
974 u32 exceptions = 0;
968 LOG_TRACE(Core_ARM11, "s%u = %08x", sn, sd); 975 LOG_TRACE(Core_ARM11, "s%u = %08x", sn, sd);
969 return vfp_single_multiply_accumulate(state, sd, sn, m, fpscr, 0, "fmac"); 976 exceptions |= vfp_single_multiply_accumulate(state, sd, sn, m, fpscr, 0, "fmac");
977 return exceptions;
970} 978}
971 979
972/* 980/*
@@ -1017,7 +1025,9 @@ static u32 vfp_single_fmul(ARMul_State* state, int sd, int sn, s32 m, u32 fpscr)
1017 vfp_single_normalise_denormal(&vsm); 1025 vfp_single_normalise_denormal(&vsm);
1018 1026
1019 exceptions |= vfp_single_multiply(&vsd, &vsn, &vsm, fpscr); 1027 exceptions |= vfp_single_multiply(&vsd, &vsn, &vsm, fpscr);
1020 return vfp_single_normaliseround(state, sd, &vsd, fpscr, exceptions, "fmul"); 1028
1029 exceptions |= vfp_single_normaliseround(state, sd, &vsd, fpscr, "fmul");
1030 return exceptions;
1021} 1031}
1022 1032
1023/* 1033/*
@@ -1041,7 +1051,9 @@ static u32 vfp_single_fnmul(ARMul_State* state, int sd, int sn, s32 m, u32 fpscr
1041 1051
1042 exceptions |= vfp_single_multiply(&vsd, &vsn, &vsm, fpscr); 1052 exceptions |= vfp_single_multiply(&vsd, &vsn, &vsm, fpscr);
1043 vsd.sign = vfp_sign_negate(vsd.sign); 1053 vsd.sign = vfp_sign_negate(vsd.sign);
1044 return vfp_single_normaliseround(state, sd, &vsd, fpscr, exceptions, "fnmul"); 1054
1055 exceptions |= vfp_single_normaliseround(state, sd, &vsd, fpscr, "fnmul");
1056 return exceptions;
1045} 1057}
1046 1058
1047/* 1059/*
@@ -1068,7 +1080,8 @@ static u32 vfp_single_fadd(ARMul_State* state, int sd, int sn, s32 m, u32 fpscr)
1068 1080
1069 exceptions |= vfp_single_add(&vsd, &vsn, &vsm, fpscr); 1081 exceptions |= vfp_single_add(&vsd, &vsn, &vsm, fpscr);
1070 1082
1071 return vfp_single_normaliseround(state, sd, &vsd, fpscr, exceptions, "fadd"); 1083 exceptions |= vfp_single_normaliseround(state, sd, &vsd, fpscr, "fadd");
1084 return exceptions;
1072} 1085}
1073 1086
1074/* 1087/*
@@ -1165,7 +1178,8 @@ static u32 vfp_single_fdiv(ARMul_State* state, int sd, int sn, s32 m, u32 fpscr)
1165 if ((vsd.significand & 0x3f) == 0) 1178 if ((vsd.significand & 0x3f) == 0)
1166 vsd.significand |= ((u64)vsm.significand * vsd.significand != (u64)vsn.significand << 32); 1179 vsd.significand |= ((u64)vsm.significand * vsd.significand != (u64)vsn.significand << 32);
1167 1180
1168 return vfp_single_normaliseround(state, sd, &vsd, fpscr, 0, "fdiv"); 1181 exceptions |= vfp_single_normaliseround(state, sd, &vsd, fpscr, "fdiv");
1182 return exceptions;
1169 1183
1170vsn_nan: 1184vsn_nan:
1171 exceptions |= vfp_propagate_nan(&vsd, &vsn, &vsm, fpscr); 1185 exceptions |= vfp_propagate_nan(&vsd, &vsn, &vsm, fpscr);
@@ -1191,7 +1205,8 @@ infinity:
1191 1205
1192invalid: 1206invalid:
1193 vfp_put_float(state, vfp_single_pack(&vfp_single_default_qnan), sd); 1207 vfp_put_float(state, vfp_single_pack(&vfp_single_default_qnan), sd);
1194 return FPSCR_IOC; 1208 exceptions |= FPSCR_IOC;
1209 return exceptions;
1195} 1210}
1196 1211
1197static struct op fops[] = { 1212static struct op fops[] = {