forked from ~ljy/RK356X_SDK_RELEASE

hc
2024-05-10 37f49e37ab4cb5d0bc4c60eb5c6d4dd57db767bb
kernel/arch/parisc/math-emu/fpudispatch.c
....@@ -1,22 +1,9 @@
1
+// SPDX-License-Identifier: GPL-2.0-or-later
12 /*
23 * Linux/PA-RISC Project (http://www.parisc-linux.org/)
34 *
45 * Floating-point emulation code
56 * Copyright (C) 2001 Hewlett-Packard (Paul Bame) <bame@debian.org>
6
- *
7
- * This program is free software; you can redistribute it and/or modify
8
- * it under the terms of the GNU General Public License as published by
9
- * the Free Software Foundation; either version 2, or (at your option)
10
- * any later version.
11
- *
12
- * This program is distributed in the hope that it will be useful,
13
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
14
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
- * GNU General Public License for more details.
16
- *
17
- * You should have received a copy of the GNU General Public License
18
- * along with this program; if not, write to the Free Software
19
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
207 */
218 /*
229 * BEGIN_DESC
....@@ -323,12 +310,15 @@
323310 r1 &= ~3;
324311 fpregs[t+3] = fpregs[r1+3];
325312 fpregs[t+2] = fpregs[r1+2];
313
+ fallthrough;
326314 case 1: /* double */
327315 fpregs[t+1] = fpregs[r1+1];
316
+ fallthrough;
328317 case 0: /* single */
329318 fpregs[t] = fpregs[r1];
330319 return(NOEXCEPTION);
331320 }
321
+ BUG();
332322 case 3: /* FABS */
333323 switch (fmt) {
334324 case 2: /* illegal */
....@@ -338,13 +328,16 @@
338328 r1 &= ~3;
339329 fpregs[t+3] = fpregs[r1+3];
340330 fpregs[t+2] = fpregs[r1+2];
331
+ fallthrough;
341332 case 1: /* double */
342333 fpregs[t+1] = fpregs[r1+1];
334
+ fallthrough;
343335 case 0: /* single */
344336 /* copy and clear sign bit */
345337 fpregs[t] = fpregs[r1] & 0x7fffffff;
346338 return(NOEXCEPTION);
347339 }
340
+ BUG();
348341 case 6: /* FNEG */
349342 switch (fmt) {
350343 case 2: /* illegal */
....@@ -354,13 +347,16 @@
354347 r1 &= ~3;
355348 fpregs[t+3] = fpregs[r1+3];
356349 fpregs[t+2] = fpregs[r1+2];
350
+ fallthrough;
357351 case 1: /* double */
358352 fpregs[t+1] = fpregs[r1+1];
353
+ fallthrough;
359354 case 0: /* single */
360355 /* copy and invert sign bit */
361356 fpregs[t] = fpregs[r1] ^ 0x80000000;
362357 return(NOEXCEPTION);
363358 }
359
+ BUG();
364360 case 7: /* FNEGABS */
365361 switch (fmt) {
366362 case 2: /* illegal */
....@@ -370,13 +366,16 @@
370366 r1 &= ~3;
371367 fpregs[t+3] = fpregs[r1+3];
372368 fpregs[t+2] = fpregs[r1+2];
369
+ fallthrough;
373370 case 1: /* double */
374371 fpregs[t+1] = fpregs[r1+1];
372
+ fallthrough;
375373 case 0: /* single */
376374 /* copy and set sign bit */
377375 fpregs[t] = fpregs[r1] | 0x80000000;
378376 return(NOEXCEPTION);
379377 }
378
+ BUG();
380379 case 4: /* FSQRT */
381380 switch (fmt) {
382381 case 0:
....@@ -389,6 +388,7 @@
389388 case 3: /* quad not implemented */
390389 return(MAJOR_0C_EXCP);
391390 }
391
+ BUG();
392392 case 5: /* FRND */
393393 switch (fmt) {
394394 case 0:
....@@ -402,7 +402,7 @@
402402 return(MAJOR_0C_EXCP);
403403 }
404404 } /* end of switch (subop) */
405
-
405
+ BUG();
406406 case 1: /* class 1 */
407407 df = extru(ir,fpdfpos,2); /* get dest format */
408408 if ((df & 2) || (fmt & 2)) {
....@@ -432,6 +432,7 @@
432432 case 3: /* dbl/dbl */
433433 return(MAJOR_0C_EXCP);
434434 }
435
+ BUG();
435436 case 1: /* FCNVXF */
436437 switch(fmt) {
437438 case 0: /* sgl/sgl */
....@@ -447,6 +448,7 @@
447448 return(dbl_to_dbl_fcnvxf(&fpregs[r1],0,
448449 &fpregs[t],status));
449450 }
451
+ BUG();
450452 case 2: /* FCNVFX */
451453 switch(fmt) {
452454 case 0: /* sgl/sgl */
....@@ -462,6 +464,7 @@
462464 return(dbl_to_dbl_fcnvfx(&fpregs[r1],0,
463465 &fpregs[t],status));
464466 }
467
+ BUG();
465468 case 3: /* FCNVFXT */
466469 switch(fmt) {
467470 case 0: /* sgl/sgl */
....@@ -477,6 +480,7 @@
477480 return(dbl_to_dbl_fcnvfxt(&fpregs[r1],0,
478481 &fpregs[t],status));
479482 }
483
+ BUG();
480484 case 5: /* FCNVUF (PA2.0 only) */
481485 switch(fmt) {
482486 case 0: /* sgl/sgl */
....@@ -492,6 +496,7 @@
492496 return(dbl_to_dbl_fcnvuf(&fpregs[r1],0,
493497 &fpregs[t],status));
494498 }
499
+ BUG();
495500 case 6: /* FCNVFU (PA2.0 only) */
496501 switch(fmt) {
497502 case 0: /* sgl/sgl */
....@@ -507,6 +512,7 @@
507512 return(dbl_to_dbl_fcnvfu(&fpregs[r1],0,
508513 &fpregs[t],status));
509514 }
515
+ BUG();
510516 case 7: /* FCNVFUT (PA2.0 only) */
511517 switch(fmt) {
512518 case 0: /* sgl/sgl */
....@@ -522,10 +528,11 @@
522528 return(dbl_to_dbl_fcnvfut(&fpregs[r1],0,
523529 &fpregs[t],status));
524530 }
531
+ BUG();
525532 case 4: /* undefined */
526533 return(MAJOR_0C_EXCP);
527534 } /* end of switch subop */
528
-
535
+ BUG();
529536 case 2: /* class 2 */
530537 fpu_type_flags=fpregs[FPU_TYPE_FLAG_POS];
531538 r2 = extru(ir, fpr2pos, 5) * sizeof(double)/sizeof(u_int);
....@@ -603,6 +610,7 @@
603610 case 3: /* quad not implemented */
604611 return(MAJOR_0C_EXCP);
605612 }
613
+ BUG();
606614 case 1: /* FTEST */
607615 switch (fmt) {
608616 case 0:
....@@ -622,8 +630,10 @@
622630 case 3:
623631 return(MAJOR_0C_EXCP);
624632 }
633
+ BUG();
625634 } /* end of switch subop */
626635 } /* end of else for PA1.0 & PA1.1 */
636
+ BUG();
627637 case 3: /* class 3 */
628638 r2 = extru(ir,fpr2pos,5) * sizeof(double)/sizeof(u_int);
629639 if (r2 == 0)
....@@ -646,6 +656,7 @@
646656 case 3: /* quad not implemented */
647657 return(MAJOR_0C_EXCP);
648658 }
659
+ BUG();
649660 case 1: /* FSUB */
650661 switch (fmt) {
651662 case 0:
....@@ -658,6 +669,7 @@
658669 case 3: /* quad not implemented */
659670 return(MAJOR_0C_EXCP);
660671 }
672
+ BUG();
661673 case 2: /* FMPY */
662674 switch (fmt) {
663675 case 0:
....@@ -670,6 +682,7 @@
670682 case 3: /* quad not implemented */
671683 return(MAJOR_0C_EXCP);
672684 }
685
+ BUG();
673686 case 3: /* FDIV */
674687 switch (fmt) {
675688 case 0:
....@@ -682,6 +695,7 @@
682695 case 3: /* quad not implemented */
683696 return(MAJOR_0C_EXCP);
684697 }
698
+ BUG();
685699 case 4: /* FREM */
686700 switch (fmt) {
687701 case 0:
....@@ -694,6 +708,7 @@
694708 case 3: /* quad not implemented */
695709 return(MAJOR_0C_EXCP);
696710 }
711
+ BUG();
697712 } /* end of class 3 switch */
698713 } /* end of switch(class) */
699714
....@@ -749,10 +764,12 @@
749764 return(MAJOR_0E_EXCP);
750765 case 1: /* double */
751766 fpregs[t+1] = fpregs[r1+1];
767
+ fallthrough;
752768 case 0: /* single */
753769 fpregs[t] = fpregs[r1];
754770 return(NOEXCEPTION);
755771 }
772
+ BUG();
756773 case 3: /* FABS */
757774 switch (fmt) {
758775 case 2:
....@@ -760,10 +777,12 @@
760777 return(MAJOR_0E_EXCP);
761778 case 1: /* double */
762779 fpregs[t+1] = fpregs[r1+1];
780
+ fallthrough;
763781 case 0: /* single */
764782 fpregs[t] = fpregs[r1] & 0x7fffffff;
765783 return(NOEXCEPTION);
766784 }
785
+ BUG();
767786 case 6: /* FNEG */
768787 switch (fmt) {
769788 case 2:
....@@ -771,10 +790,12 @@
771790 return(MAJOR_0E_EXCP);
772791 case 1: /* double */
773792 fpregs[t+1] = fpregs[r1+1];
793
+ fallthrough;
774794 case 0: /* single */
775795 fpregs[t] = fpregs[r1] ^ 0x80000000;
776796 return(NOEXCEPTION);
777797 }
798
+ BUG();
778799 case 7: /* FNEGABS */
779800 switch (fmt) {
780801 case 2:
....@@ -782,10 +803,12 @@
782803 return(MAJOR_0E_EXCP);
783804 case 1: /* double */
784805 fpregs[t+1] = fpregs[r1+1];
806
+ fallthrough;
785807 case 0: /* single */
786808 fpregs[t] = fpregs[r1] | 0x80000000;
787809 return(NOEXCEPTION);
788810 }
811
+ BUG();
789812 case 4: /* FSQRT */
790813 switch (fmt) {
791814 case 0:
....@@ -798,6 +821,7 @@
798821 case 3:
799822 return(MAJOR_0E_EXCP);
800823 }
824
+ BUG();
801825 case 5: /* FRMD */
802826 switch (fmt) {
803827 case 0:
....@@ -811,7 +835,7 @@
811835 return(MAJOR_0E_EXCP);
812836 }
813837 } /* end of switch (subop */
814
-
838
+ BUG();
815839 case 1: /* class 1 */
816840 df = extru(ir,fpdfpos,2); /* get dest format */
817841 /*
....@@ -839,6 +863,7 @@
839863 case 3: /* dbl/dbl */
840864 return(MAJOR_0E_EXCP);
841865 }
866
+ BUG();
842867 case 1: /* FCNVXF */
843868 switch(fmt) {
844869 case 0: /* sgl/sgl */
....@@ -854,6 +879,7 @@
854879 return(dbl_to_dbl_fcnvxf(&fpregs[r1],0,
855880 &fpregs[t],status));
856881 }
882
+ BUG();
857883 case 2: /* FCNVFX */
858884 switch(fmt) {
859885 case 0: /* sgl/sgl */
....@@ -869,6 +895,7 @@
869895 return(dbl_to_dbl_fcnvfx(&fpregs[r1],0,
870896 &fpregs[t],status));
871897 }
898
+ BUG();
872899 case 3: /* FCNVFXT */
873900 switch(fmt) {
874901 case 0: /* sgl/sgl */
....@@ -884,6 +911,7 @@
884911 return(dbl_to_dbl_fcnvfxt(&fpregs[r1],0,
885912 &fpregs[t],status));
886913 }
914
+ BUG();
887915 case 5: /* FCNVUF (PA2.0 only) */
888916 switch(fmt) {
889917 case 0: /* sgl/sgl */
....@@ -899,6 +927,7 @@
899927 return(dbl_to_dbl_fcnvuf(&fpregs[r1],0,
900928 &fpregs[t],status));
901929 }
930
+ BUG();
902931 case 6: /* FCNVFU (PA2.0 only) */
903932 switch(fmt) {
904933 case 0: /* sgl/sgl */
....@@ -914,6 +943,7 @@
914943 return(dbl_to_dbl_fcnvfu(&fpregs[r1],0,
915944 &fpregs[t],status));
916945 }
946
+ BUG();
917947 case 7: /* FCNVFUT (PA2.0 only) */
918948 switch(fmt) {
919949 case 0: /* sgl/sgl */
....@@ -929,9 +959,11 @@
929959 return(dbl_to_dbl_fcnvfut(&fpregs[r1],0,
930960 &fpregs[t],status));
931961 }
962
+ BUG();
932963 case 4: /* undefined */
933964 return(MAJOR_0C_EXCP);
934965 } /* end of switch subop */
966
+ BUG();
935967 case 2: /* class 2 */
936968 /*
937969 * Be careful out there.
....@@ -1007,6 +1039,7 @@
10071039 }
10081040 } /* end of switch subop */
10091041 } /* end of else for PA1.0 & PA1.1 */
1042
+ BUG();
10101043 case 3: /* class 3 */
10111044 /*
10121045 * Be careful out there.
....@@ -1039,6 +1072,7 @@
10391072 return(dbl_fadd(&fpregs[r1],&fpregs[r2],
10401073 &fpregs[t],status));
10411074 }
1075
+ BUG();
10421076 case 1: /* FSUB */
10431077 switch (fmt) {
10441078 case 0:
....@@ -1048,6 +1082,7 @@
10481082 return(dbl_fsub(&fpregs[r1],&fpregs[r2],
10491083 &fpregs[t],status));
10501084 }
1085
+ BUG();
10511086 case 2: /* FMPY or XMPYU */
10521087 /*
10531088 * check for integer multiply (x bit set)
....@@ -1084,6 +1119,7 @@
10841119 &fpregs[r2],&fpregs[t],status));
10851120 }
10861121 }
1122
+ BUG();
10871123 case 3: /* FDIV */
10881124 switch (fmt) {
10891125 case 0:
....@@ -1093,6 +1129,7 @@
10931129 return(dbl_fdiv(&fpregs[r1],&fpregs[r2],
10941130 &fpregs[t],status));
10951131 }
1132
+ BUG();
10961133 case 4: /* FREM */
10971134 switch (fmt) {
10981135 case 0: