summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
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, 28 insertions, 57 deletions
diff --git a/src/core/arm/skyeye_common/vfp/vfp_helper.h b/src/core/arm/skyeye_common/vfp/vfp_helper.h
index 5e14345ce..1eba71b48 100644
--- a/src/core/arm/skyeye_common/vfp/vfp_helper.h
+++ b/src/core/arm/skyeye_common/vfp/vfp_helper.h
@@ -291,7 +291,7 @@ inline s32 vfp_single_pack(const vfp_single* s) {
291 return (s32)val; 291 return (s32)val;
292} 292}
293 293
294u32 vfp_single_normaliseround(ARMul_State* state, int sd, vfp_single* vs, u32 fpscr, 294u32 vfp_single_normaliseround(ARMul_State* state, int sd, vfp_single* vs, u32 fpscr, u32 exceptions,
295 const char* func); 295 const char* func);
296 296
297// Double-precision 297// Double-precision
@@ -429,5 +429,5 @@ inline u32 fls(u32 x) {
429 429
430u32 vfp_double_multiply(vfp_double* vdd, vfp_double* vdn, vfp_double* vdm, u32 fpscr); 430u32 vfp_double_multiply(vfp_double* vdd, vfp_double* vdn, vfp_double* vdm, u32 fpscr);
431u32 vfp_double_add(vfp_double* vdd, vfp_double* vdn, vfp_double* vdm, u32 fpscr); 431u32 vfp_double_add(vfp_double* vdd, vfp_double* vdn, vfp_double* vdm, u32 fpscr);
432u32 vfp_double_normaliseround(ARMul_State* state, int dd, vfp_double* vd, u32 fpscr, 432u32 vfp_double_normaliseround(ARMul_State* state, int dd, vfp_double* vd, u32 fpscr, u32 exceptions,
433 const char* func); 433 const char* func);
diff --git a/src/core/arm/skyeye_common/vfp/vfpdouble.cpp b/src/core/arm/skyeye_common/vfp/vfpdouble.cpp
index 2886f351f..4b35455f6 100644
--- a/src/core/arm/skyeye_common/vfp/vfpdouble.cpp
+++ b/src/core/arm/skyeye_common/vfp/vfpdouble.cpp
@@ -82,11 +82,10 @@ static void vfp_double_normalise_denormal(struct vfp_double* vd) {
82} 82}
83 83
84u32 vfp_double_normaliseround(ARMul_State* state, int dd, struct vfp_double* vd, u32 fpscr, 84u32 vfp_double_normaliseround(ARMul_State* state, int dd, struct vfp_double* vd, u32 fpscr,
85 const char* func) { 85 u32 exceptions, const char* func) {
86 u64 significand, incr; 86 u64 significand, incr;
87 int exponent, shift, underflow; 87 int exponent, shift, underflow;
88 u32 rmode; 88 u32 rmode;
89 u32 exceptions = 0;
90 89
91 vfp_double_dump("pack: in", vd); 90 vfp_double_dump("pack: in", vd);
92 91
@@ -360,7 +359,8 @@ static u32 vfp_double_fsqrt(ARMul_State* state, int dd, int unused, int dm, u32
360 } 359 }
361 vdd.significand = vfp_shiftright64jamming(vdd.significand, 1); 360 vdd.significand = vfp_shiftright64jamming(vdd.significand, 1);
362 361
363 exceptions |= vfp_double_normaliseround(state, dd, &vdd, fpscr, "fsqrt"); 362 exceptions |= vfp_double_normaliseround(state, dd, &vdd, fpscr, 0, "fsqrt");
363
364 return exceptions; 364 return exceptions;
365} 365}
366 366
@@ -492,8 +492,7 @@ static u32 vfp_double_fcvts(ARMul_State* state, int sd, int unused, int dm, u32
492 else 492 else
493 vsd.exponent = vdm.exponent - (1023 - 127); 493 vsd.exponent = vdm.exponent - (1023 - 127);
494 494
495 exceptions |= vfp_single_normaliseround(state, sd, &vsd, fpscr, "fcvts"); 495 return vfp_single_normaliseround(state, sd, &vsd, fpscr, exceptions, "fcvts");
496 return exceptions;
497 496
498pack_nan: 497pack_nan:
499 vfp_put_float(state, vfp_single_pack(&vsd), sd); 498 vfp_put_float(state, vfp_single_pack(&vsd), sd);
@@ -502,7 +501,6 @@ pack_nan:
502 501
503static u32 vfp_double_fuito(ARMul_State* state, int dd, int unused, int dm, u32 fpscr) { 502static u32 vfp_double_fuito(ARMul_State* state, int dd, int unused, int dm, u32 fpscr) {
504 struct vfp_double vdm; 503 struct vfp_double vdm;
505 u32 exceptions = 0;
506 u32 m = vfp_get_float(state, dm); 504 u32 m = vfp_get_float(state, dm);
507 505
508 LOG_TRACE(Core_ARM11, "In %s", __FUNCTION__); 506 LOG_TRACE(Core_ARM11, "In %s", __FUNCTION__);
@@ -510,13 +508,11 @@ static u32 vfp_double_fuito(ARMul_State* state, int dd, int unused, int dm, u32
510 vdm.exponent = 1023 + 63 - 1; 508 vdm.exponent = 1023 + 63 - 1;
511 vdm.significand = (u64)m; 509 vdm.significand = (u64)m;
512 510
513 exceptions |= vfp_double_normaliseround(state, dd, &vdm, fpscr, "fuito"); 511 return vfp_double_normaliseround(state, dd, &vdm, fpscr, 0, "fuito");
514 return exceptions;
515} 512}
516 513
517static u32 vfp_double_fsito(ARMul_State* state, int dd, int unused, int dm, u32 fpscr) { 514static u32 vfp_double_fsito(ARMul_State* state, int dd, int unused, int dm, u32 fpscr) {
518 struct vfp_double vdm; 515 struct vfp_double vdm;
519 u32 exceptions = 0;
520 u32 m = vfp_get_float(state, dm); 516 u32 m = vfp_get_float(state, dm);
521 517
522 LOG_TRACE(Core_ARM11, "In %s", __FUNCTION__); 518 LOG_TRACE(Core_ARM11, "In %s", __FUNCTION__);
@@ -524,8 +520,7 @@ static u32 vfp_double_fsito(ARMul_State* state, int dd, int unused, int dm, u32
524 vdm.exponent = 1023 + 63 - 1; 520 vdm.exponent = 1023 + 63 - 1;
525 vdm.significand = vdm.sign ? (~m + 1) : m; 521 vdm.significand = vdm.sign ? (~m + 1) : m;
526 522
527 exceptions |= vfp_double_normaliseround(state, dd, &vdm, fpscr, "fsito"); 523 return vfp_double_normaliseround(state, dd, &vdm, fpscr, 0, "fsito");
528 return exceptions;
529} 524}
530 525
531static u32 vfp_double_ftoui(ARMul_State* state, int sd, int unused, int dm, u32 fpscr) { 526static u32 vfp_double_ftoui(ARMul_State* state, int sd, int unused, int dm, u32 fpscr) {
@@ -912,8 +907,7 @@ static u32 vfp_double_multiply_accumulate(ARMul_State* state, int dd, int dn, in
912 907
913 exceptions |= vfp_double_add(&vdd, &vdn, &vdp, fpscr); 908 exceptions |= vfp_double_add(&vdd, &vdn, &vdp, fpscr);
914 909
915 exceptions |= vfp_double_normaliseround(state, dd, &vdd, fpscr, func); 910 return vfp_double_normaliseround(state, dd, &vdd, fpscr, exceptions, func);
916 return exceptions;
917} 911}
918 912
919/* 913/*
@@ -970,9 +964,7 @@ static u32 vfp_double_fmul(ARMul_State* state, int dd, int dn, int dm, u32 fpscr
970 vfp_double_normalise_denormal(&vdm); 964 vfp_double_normalise_denormal(&vdm);
971 965
972 exceptions |= vfp_double_multiply(&vdd, &vdn, &vdm, fpscr); 966 exceptions |= vfp_double_multiply(&vdd, &vdn, &vdm, fpscr);
973 967 return vfp_double_normaliseround(state, dd, &vdd, fpscr, exceptions, "fmul");
974 exceptions |= vfp_double_normaliseround(state, dd, &vdd, fpscr, "fmul");
975 return exceptions;
976} 968}
977 969
978/* 970/*
@@ -994,8 +986,7 @@ static u32 vfp_double_fnmul(ARMul_State* state, int dd, int dn, int dm, u32 fpsc
994 exceptions |= vfp_double_multiply(&vdd, &vdn, &vdm, fpscr); 986 exceptions |= vfp_double_multiply(&vdd, &vdn, &vdm, fpscr);
995 vdd.sign = vfp_sign_negate(vdd.sign); 987 vdd.sign = vfp_sign_negate(vdd.sign);
996 988
997 exceptions |= vfp_double_normaliseround(state, dd, &vdd, fpscr, "fnmul"); 989 return vfp_double_normaliseround(state, dd, &vdd, fpscr, exceptions, "fnmul");
998 return exceptions;
999} 990}
1000 991
1001/* 992/*
@@ -1016,8 +1007,7 @@ static u32 vfp_double_fadd(ARMul_State* state, int dd, int dn, int dm, u32 fpscr
1016 1007
1017 exceptions |= vfp_double_add(&vdd, &vdn, &vdm, fpscr); 1008 exceptions |= vfp_double_add(&vdd, &vdn, &vdm, fpscr);
1018 1009
1019 exceptions |= vfp_double_normaliseround(state, dd, &vdd, fpscr, "fadd"); 1010 return vfp_double_normaliseround(state, dd, &vdd, fpscr, exceptions, "fadd");
1020 return exceptions;
1021} 1011}
1022 1012
1023/* 1013/*
@@ -1043,8 +1033,7 @@ static u32 vfp_double_fsub(ARMul_State* state, int dd, int dn, int dm, u32 fpscr
1043 1033
1044 exceptions |= vfp_double_add(&vdd, &vdn, &vdm, fpscr); 1034 exceptions |= vfp_double_add(&vdd, &vdn, &vdm, fpscr);
1045 1035
1046 exceptions |= vfp_double_normaliseround(state, dd, &vdd, fpscr, "fsub"); 1036 return vfp_double_normaliseround(state, dd, &vdd, fpscr, exceptions, "fsub");
1047 return exceptions;
1048} 1037}
1049 1038
1050/* 1039/*
@@ -1126,9 +1115,7 @@ static u32 vfp_double_fdiv(ARMul_State* state, int dd, int dn, int dm, u32 fpscr
1126 } 1115 }
1127 vdd.significand |= (reml != 0); 1116 vdd.significand |= (reml != 0);
1128 } 1117 }
1129 1118 return vfp_double_normaliseround(state, dd, &vdd, fpscr, 0, "fdiv");
1130 exceptions |= vfp_double_normaliseround(state, dd, &vdd, fpscr, "fdiv");
1131 return exceptions;
1132 1119
1133vdn_nan: 1120vdn_nan:
1134 exceptions |= vfp_propagate_nan(&vdd, &vdn, &vdm, fpscr); 1121 exceptions |= vfp_propagate_nan(&vdd, &vdn, &vdm, fpscr);
@@ -1154,8 +1141,7 @@ infinity:
1154 1141
1155invalid: 1142invalid:
1156 vfp_put_double(state, vfp_double_pack(&vfp_double_default_qnan), dd); 1143 vfp_put_double(state, vfp_double_pack(&vfp_double_default_qnan), dd);
1157 exceptions |= FPSCR_IOC; 1144 return FPSCR_IOC;
1158 return exceptions;
1159} 1145}
1160 1146
1161static struct op fops[] = { 1147static struct op fops[] = {
diff --git a/src/core/arm/skyeye_common/vfp/vfpsingle.cpp b/src/core/arm/skyeye_common/vfp/vfpsingle.cpp
index 1590d89a4..2609d0714 100644
--- a/src/core/arm/skyeye_common/vfp/vfpsingle.cpp
+++ b/src/core/arm/skyeye_common/vfp/vfpsingle.cpp
@@ -83,10 +83,9 @@ static void vfp_single_normalise_denormal(struct vfp_single* vs) {
83} 83}
84 84
85u32 vfp_single_normaliseround(ARMul_State* state, int sd, struct vfp_single* vs, u32 fpscr, 85u32 vfp_single_normaliseround(ARMul_State* state, int sd, struct vfp_single* vs, u32 fpscr,
86 const char* func) { 86 u32 exceptions, const char* func) {
87 u32 significand, incr, rmode; 87 u32 significand, incr, rmode;
88 int exponent, shift, underflow; 88 int exponent, shift, underflow;
89 u32 exceptions = 0;
90 89
91 vfp_single_dump("pack: in", vs); 90 vfp_single_dump("pack: in", vs);
92 91
@@ -394,7 +393,8 @@ static u32 vfp_single_fsqrt(ARMul_State* state, int sd, int unused, s32 m, u32 f
394 } 393 }
395 vsd.significand = vfp_shiftright32jamming(vsd.significand, 1); 394 vsd.significand = vfp_shiftright32jamming(vsd.significand, 1);
396 395
397 exceptions |= vfp_single_normaliseround(state, sd, &vsd, fpscr, "fsqrt"); 396 exceptions |= vfp_single_normaliseround(state, sd, &vsd, fpscr, 0, "fsqrt");
397
398 return exceptions; 398 return exceptions;
399} 399}
400 400
@@ -515,8 +515,7 @@ static u32 vfp_single_fcvtd(ARMul_State* state, int dd, int unused, s32 m, u32 f
515 else 515 else
516 vdd.exponent = vsm.exponent + (1023 - 127); 516 vdd.exponent = vsm.exponent + (1023 - 127);
517 517
518 exceptions |= vfp_double_normaliseround(state, dd, &vdd, fpscr, "fcvtd"); 518 return vfp_double_normaliseround(state, dd, &vdd, fpscr, exceptions, "fcvtd");
519 return exceptions;
520 519
521pack_nan: 520pack_nan:
522 vfp_put_double(state, vfp_double_pack(&vdd), dd); 521 vfp_put_double(state, vfp_double_pack(&vdd), dd);
@@ -525,26 +524,22 @@ pack_nan:
525 524
526static u32 vfp_single_fuito(ARMul_State* state, int sd, int unused, s32 m, u32 fpscr) { 525static u32 vfp_single_fuito(ARMul_State* state, int sd, int unused, s32 m, u32 fpscr) {
527 struct vfp_single vs; 526 struct vfp_single vs;
528 u32 exceptions = 0;
529 527
530 vs.sign = 0; 528 vs.sign = 0;
531 vs.exponent = 127 + 31 - 1; 529 vs.exponent = 127 + 31 - 1;
532 vs.significand = (u32)m; 530 vs.significand = (u32)m;
533 531
534 exceptions |= vfp_single_normaliseround(state, sd, &vs, fpscr, "fuito"); 532 return vfp_single_normaliseround(state, sd, &vs, fpscr, 0, "fuito");
535 return exceptions;
536} 533}
537 534
538static u32 vfp_single_fsito(ARMul_State* state, int sd, int unused, s32 m, u32 fpscr) { 535static u32 vfp_single_fsito(ARMul_State* state, int sd, int unused, s32 m, u32 fpscr) {
539 struct vfp_single vs; 536 struct vfp_single vs;
540 u32 exceptions = 0;
541 537
542 vs.sign = (m & 0x80000000) >> 16; 538 vs.sign = (m & 0x80000000) >> 16;
543 vs.exponent = 127 + 31 - 1; 539 vs.exponent = 127 + 31 - 1;
544 vs.significand = vs.sign ? -m : m; 540 vs.significand = vs.sign ? -m : m;
545 541
546 exceptions |= vfp_single_normaliseround(state, sd, &vs, fpscr, "fsito"); 542 return vfp_single_normaliseround(state, sd, &vs, fpscr, 0, "fsito");
547 return exceptions;
548} 543}
549 544
550static u32 vfp_single_ftoui(ARMul_State* state, int sd, int unused, s32 m, u32 fpscr) { 545static u32 vfp_single_ftoui(ARMul_State* state, int sd, int unused, s32 m, u32 fpscr) {
@@ -936,8 +931,7 @@ static u32 vfp_single_multiply_accumulate(ARMul_State* state, int sd, int sn, s3
936 931
937 exceptions |= vfp_single_add(&vsd, &vsn, &vsp, fpscr); 932 exceptions |= vfp_single_add(&vsd, &vsn, &vsp, fpscr);
938 933
939 exceptions |= vfp_single_normaliseround(state, sd, &vsd, fpscr, func); 934 return vfp_single_normaliseround(state, sd, &vsd, fpscr, exceptions, func);
940 return exceptions;
941} 935}
942 936
943/* 937/*
@@ -948,10 +942,8 @@ static u32 vfp_single_multiply_accumulate(ARMul_State* state, int sd, int sn, s3
948 * sd = sd + (sn * sm) 942 * sd = sd + (sn * sm)
949 */ 943 */
950static u32 vfp_single_fmac(ARMul_State* state, int sd, int sn, s32 m, u32 fpscr) { 944static u32 vfp_single_fmac(ARMul_State* state, int sd, int sn, s32 m, u32 fpscr) {
951 u32 exceptions = 0;
952 LOG_TRACE(Core_ARM11, "s%u = %08x", sn, sd); 945 LOG_TRACE(Core_ARM11, "s%u = %08x", sn, sd);
953 exceptions |= vfp_single_multiply_accumulate(state, sd, sn, m, fpscr, 0, "fmac"); 946 return vfp_single_multiply_accumulate(state, sd, sn, m, fpscr, 0, "fmac");
954 return exceptions;
955} 947}
956 948
957/* 949/*
@@ -999,9 +991,7 @@ static u32 vfp_single_fmul(ARMul_State* state, int sd, int sn, s32 m, u32 fpscr)
999 vfp_single_normalise_denormal(&vsm); 991 vfp_single_normalise_denormal(&vsm);
1000 992
1001 exceptions |= vfp_single_multiply(&vsd, &vsn, &vsm, fpscr); 993 exceptions |= vfp_single_multiply(&vsd, &vsn, &vsm, fpscr);
1002 994 return vfp_single_normaliseround(state, sd, &vsd, fpscr, exceptions, "fmul");
1003 exceptions |= vfp_single_normaliseround(state, sd, &vsd, fpscr, "fmul");
1004 return exceptions;
1005} 995}
1006 996
1007/* 997/*
@@ -1024,9 +1014,7 @@ static u32 vfp_single_fnmul(ARMul_State* state, int sd, int sn, s32 m, u32 fpscr
1024 1014
1025 exceptions |= vfp_single_multiply(&vsd, &vsn, &vsm, fpscr); 1015 exceptions |= vfp_single_multiply(&vsd, &vsn, &vsm, fpscr);
1026 vsd.sign = vfp_sign_negate(vsd.sign); 1016 vsd.sign = vfp_sign_negate(vsd.sign);
1027 1017 return vfp_single_normaliseround(state, sd, &vsd, fpscr, exceptions, "fnmul");
1028 exceptions |= vfp_single_normaliseround(state, sd, &vsd, fpscr, "fnmul");
1029 return exceptions;
1030} 1018}
1031 1019
1032/* 1020/*
@@ -1052,8 +1040,7 @@ static u32 vfp_single_fadd(ARMul_State* state, int sd, int sn, s32 m, u32 fpscr)
1052 1040
1053 exceptions |= vfp_single_add(&vsd, &vsn, &vsm, fpscr); 1041 exceptions |= vfp_single_add(&vsd, &vsn, &vsm, fpscr);
1054 1042
1055 exceptions |= vfp_single_normaliseround(state, sd, &vsd, fpscr, "fadd"); 1043 return vfp_single_normaliseround(state, sd, &vsd, fpscr, exceptions, "fadd");
1056 return exceptions;
1057} 1044}
1058 1045
1059/* 1046/*
@@ -1148,8 +1135,7 @@ static u32 vfp_single_fdiv(ARMul_State* state, int sd, int sn, s32 m, u32 fpscr)
1148 if ((vsd.significand & 0x3f) == 0) 1135 if ((vsd.significand & 0x3f) == 0)
1149 vsd.significand |= ((u64)vsm.significand * vsd.significand != (u64)vsn.significand << 32); 1136 vsd.significand |= ((u64)vsm.significand * vsd.significand != (u64)vsn.significand << 32);
1150 1137
1151 exceptions |= vfp_single_normaliseround(state, sd, &vsd, fpscr, "fdiv"); 1138 return vfp_single_normaliseround(state, sd, &vsd, fpscr, 0, "fdiv");
1152 return exceptions;
1153 1139
1154vsn_nan: 1140vsn_nan:
1155 exceptions |= vfp_propagate_nan(&vsd, &vsn, &vsm, fpscr); 1141 exceptions |= vfp_propagate_nan(&vsd, &vsn, &vsm, fpscr);
@@ -1175,8 +1161,7 @@ infinity:
1175 1161
1176invalid: 1162invalid:
1177 vfp_put_float(state, vfp_single_pack(&vfp_single_default_qnan), sd); 1163 vfp_put_float(state, vfp_single_pack(&vfp_single_default_qnan), sd);
1178 exceptions |= FPSCR_IOC; 1164 return FPSCR_IOC;
1179 return exceptions;
1180} 1165}
1181 1166
1182static struct op fops[] = { 1167static struct op fops[] = {