Lines Matching +full:c +full:- +full:22
1 // SPDX-License-Identifier: GPL-2.0-or-later
13 #include <asm/ppc-opcode.h>
14 #include <asm/code-patching.h>
64 regs->msr = msr; in init_pt_regs()
68 asm volatile("mfmsr %0" : "=r"(regs->msr)); in init_pt_regs()
70 regs->msr |= MSR_FP; in init_pt_regs()
71 regs->msr |= MSR_VEC; in init_pt_regs()
72 regs->msr |= MSR_VSX; in init_pt_regs()
74 msr = regs->msr; in init_pt_regs()
80 pr_info("%-14s : %s\n", mnemonic, result); in show_result()
86 pr_info("%-14s : %-50s %s\n", mnemonic, descr, result); in show_result_with_descr()
93 int stepped = -1; in test_ld()
111 int stepped = -1; in test_pld()
134 int stepped = -1; in test_lwz()
152 int stepped = -1; in test_plwz()
176 int stepped = -1; in test_lwzx()
195 int stepped = -1; in test_std()
213 int stepped = -1; in test_pstd()
236 int stepped = -1; in test_ldarx_stdcx()
292 } c; in test_lfsx_stfsx() local
294 int stepped = -1; in test_lfsx_stfsx()
301 c.a = 123.45; in test_lfsx_stfsx()
302 cached_b = c.b; in test_lfsx_stfsx()
304 regs.gpr[3] = (unsigned long) &c.a; in test_lfsx_stfsx()
318 c.a = 678.91; in test_lfsx_stfsx()
323 if (stepped == 1 && c.b == cached_b) in test_lfsx_stfsx()
335 } c; in test_plfs_pstfs() local
337 int stepped = -1; in test_plfs_pstfs()
349 c.a = 123.45; in test_plfs_pstfs()
350 cached_b = c.b; in test_plfs_pstfs()
352 regs.gpr[3] = (unsigned long)&c.a; in test_plfs_pstfs()
365 c.a = 678.91; in test_plfs_pstfs()
370 if (stepped == 1 && c.b == cached_b) in test_plfs_pstfs()
382 } c; in test_lfdx_stfdx() local
384 int stepped = -1; in test_lfdx_stfdx()
391 c.a = 123456.78; in test_lfdx_stfdx()
392 cached_b = c.b; in test_lfdx_stfdx()
394 regs.gpr[3] = (unsigned long) &c.a; in test_lfdx_stfdx()
408 c.a = 987654.32; in test_lfdx_stfdx()
413 if (stepped == 1 && c.b == cached_b) in test_lfdx_stfdx()
425 } c; in test_plfd_pstfd() local
427 int stepped = -1; in test_plfd_pstfd()
439 c.a = 123456.78; in test_plfd_pstfd()
440 cached_b = c.b; in test_plfd_pstfd()
442 regs.gpr[3] = (unsigned long)&c.a; in test_plfd_pstfd()
455 c.a = 987654.32; in test_plfd_pstfd()
460 if (stepped == 1 && c.b == cached_b) in test_plfd_pstfd()
498 } c; in test_lvx_stvx() local
500 int stepped = -1; in test_lvx_stvx()
507 cached_b[0] = c.b[0] = 923745; in test_lvx_stvx()
508 cached_b[1] = c.b[1] = 2139478; in test_lvx_stvx()
509 cached_b[2] = c.b[2] = 9012; in test_lvx_stvx()
510 cached_b[3] = c.b[3] = 982134; in test_lvx_stvx()
512 regs.gpr[3] = (unsigned long) &c.a; in test_lvx_stvx()
526 c.b[0] = 4987513; in test_lvx_stvx()
527 c.b[1] = 84313948; in test_lvx_stvx()
528 c.b[2] = 71; in test_lvx_stvx()
529 c.b[3] = 498532; in test_lvx_stvx()
534 if (stepped == 1 && cached_b[0] == c.b[0] && cached_b[1] == c.b[1] && in test_lvx_stvx()
535 cached_b[2] == c.b[2] && cached_b[3] == c.b[3]) in test_lvx_stvx()
555 } c; in test_lxvd2x_stxvd2x() local
557 int stepped = -1; in test_lxvd2x_stxvd2x()
564 cached_b[0] = c.b[0] = 18233; in test_lxvd2x_stxvd2x()
565 cached_b[1] = c.b[1] = 34863571; in test_lxvd2x_stxvd2x()
566 cached_b[2] = c.b[2] = 834; in test_lxvd2x_stxvd2x()
567 cached_b[3] = c.b[3] = 6138911; in test_lxvd2x_stxvd2x()
569 regs.gpr[3] = (unsigned long) &c.a; in test_lxvd2x_stxvd2x()
587 c.b[0] = 21379463; in test_lxvd2x_stxvd2x()
588 c.b[1] = 87; in test_lxvd2x_stxvd2x()
589 c.b[2] = 374234; in test_lxvd2x_stxvd2x()
590 c.b[3] = 4; in test_lxvd2x_stxvd2x()
595 if (stepped == 1 && cached_b[0] == c.b[0] && cached_b[1] == c.b[1] && in test_lxvd2x_stxvd2x()
596 cached_b[2] == c.b[2] && cached_b[3] == c.b[3] && in test_lxvd2x_stxvd2x()
621 } c[2]; in test_lxvp_stxvp() local
623 int stepped = -1; in test_lxvp_stxvp()
635 cached_b[0] = c[0].b[0] = 18233; in test_lxvp_stxvp()
636 cached_b[1] = c[0].b[1] = 34863571; in test_lxvp_stxvp()
637 cached_b[2] = c[0].b[2] = 834; in test_lxvp_stxvp()
638 cached_b[3] = c[0].b[3] = 6138911; in test_lxvp_stxvp()
639 cached_b[4] = c[1].b[0] = 1234; in test_lxvp_stxvp()
640 cached_b[5] = c[1].b[1] = 5678; in test_lxvp_stxvp()
641 cached_b[6] = c[1].b[2] = 91011; in test_lxvp_stxvp()
642 cached_b[7] = c[1].b[3] = 121314; in test_lxvp_stxvp()
644 regs.gpr[4] = (unsigned long)&c[0].a; in test_lxvp_stxvp()
664 c[0].b[0] = 21379463; in test_lxvp_stxvp()
665 c[0].b[1] = 87; in test_lxvp_stxvp()
666 c[0].b[2] = 374234; in test_lxvp_stxvp()
667 c[0].b[3] = 4; in test_lxvp_stxvp()
668 c[1].b[0] = 90; in test_lxvp_stxvp()
669 c[1].b[1] = 122; in test_lxvp_stxvp()
670 c[1].b[2] = 555; in test_lxvp_stxvp()
671 c[1].b[3] = 32144; in test_lxvp_stxvp()
680 if (stepped == 1 && cached_b[0] == c[0].b[0] && cached_b[1] == c[0].b[1] && in test_lxvp_stxvp()
681 cached_b[2] == c[0].b[2] && cached_b[3] == c[0].b[3] && in test_lxvp_stxvp()
682 cached_b[4] == c[1].b[0] && cached_b[5] == c[1].b[1] && in test_lxvp_stxvp()
683 cached_b[6] == c[1].b[2] && cached_b[7] == c[1].b[3] && in test_lxvp_stxvp()
708 } c[2]; in test_lxvpx_stxvpx() local
710 int stepped = -1; in test_lxvpx_stxvpx()
722 cached_b[0] = c[0].b[0] = 18233; in test_lxvpx_stxvpx()
723 cached_b[1] = c[0].b[1] = 34863571; in test_lxvpx_stxvpx()
724 cached_b[2] = c[0].b[2] = 834; in test_lxvpx_stxvpx()
725 cached_b[3] = c[0].b[3] = 6138911; in test_lxvpx_stxvpx()
726 cached_b[4] = c[1].b[0] = 1234; in test_lxvpx_stxvpx()
727 cached_b[5] = c[1].b[1] = 5678; in test_lxvpx_stxvpx()
728 cached_b[6] = c[1].b[2] = 91011; in test_lxvpx_stxvpx()
729 cached_b[7] = c[1].b[3] = 121314; in test_lxvpx_stxvpx()
731 regs.gpr[3] = (unsigned long)&c[0].a; in test_lxvpx_stxvpx()
752 c[0].b[0] = 21379463; in test_lxvpx_stxvpx()
753 c[0].b[1] = 87; in test_lxvpx_stxvpx()
754 c[0].b[2] = 374234; in test_lxvpx_stxvpx()
755 c[0].b[3] = 4; in test_lxvpx_stxvpx()
756 c[1].b[0] = 90; in test_lxvpx_stxvpx()
757 c[1].b[1] = 122; in test_lxvpx_stxvpx()
758 c[1].b[2] = 555; in test_lxvpx_stxvpx()
759 c[1].b[3] = 32144; in test_lxvpx_stxvpx()
768 if (stepped == 1 && cached_b[0] == c[0].b[0] && cached_b[1] == c[0].b[1] && in test_lxvpx_stxvpx()
769 cached_b[2] == c[0].b[2] && cached_b[3] == c[0].b[3] && in test_lxvpx_stxvpx()
770 cached_b[4] == c[1].b[0] && cached_b[5] == c[1].b[1] && in test_lxvpx_stxvpx()
771 cached_b[6] == c[1].b[2] && cached_b[7] == c[1].b[3] && in test_lxvpx_stxvpx()
797 } c[2]; in test_plxvp_pstxvp() local
799 int stepped = -1; in test_plxvp_pstxvp()
809 cached_b[0] = c[0].b[0] = 18233; in test_plxvp_pstxvp()
810 cached_b[1] = c[0].b[1] = 34863571; in test_plxvp_pstxvp()
811 cached_b[2] = c[0].b[2] = 834; in test_plxvp_pstxvp()
812 cached_b[3] = c[0].b[3] = 6138911; in test_plxvp_pstxvp()
813 cached_b[4] = c[1].b[0] = 1234; in test_plxvp_pstxvp()
814 cached_b[5] = c[1].b[1] = 5678; in test_plxvp_pstxvp()
815 cached_b[6] = c[1].b[2] = 91011; in test_plxvp_pstxvp()
816 cached_b[7] = c[1].b[3] = 121314; in test_plxvp_pstxvp()
819 regs.gpr[3] = (unsigned long)&c[0].a; in test_plxvp_pstxvp()
840 c[0].b[0] = 21379463; in test_plxvp_pstxvp()
841 c[0].b[1] = 87; in test_plxvp_pstxvp()
842 c[0].b[2] = 374234; in test_plxvp_pstxvp()
843 c[0].b[3] = 4; in test_plxvp_pstxvp()
844 c[1].b[0] = 90; in test_plxvp_pstxvp()
845 c[1].b[1] = 122; in test_plxvp_pstxvp()
846 c[1].b[2] = 555; in test_plxvp_pstxvp()
847 c[1].b[3] = 32144; in test_plxvp_pstxvp()
858 if (stepped == 1 && cached_b[0] == c[0].b[0] && cached_b[1] == c[0].b[1] && in test_plxvp_pstxvp()
859 cached_b[2] == c[0].b[2] && cached_b[3] == c[0].b[3] && in test_plxvp_pstxvp()
860 cached_b[4] == c[1].b[0] && cached_b[5] == c[1].b[1] && in test_plxvp_pstxvp()
861 cached_b[6] == c[1].b[2] && cached_b[7] == c[1].b[3] && in test_plxvp_pstxvp()
911 /* Extreme values for si0||si1 (the MLS:D-form 34 bit immediate field) */
913 #define SI_MAX (BIT(33) - 1)
914 #define SI_UMAX (BIT(34) - 1)
961 .instr = ppc_inst(PPC_RAW_ADD(20, 21, 22)),
964 .gpr[22] = LONG_MIN,
969 .instr = ppc_inst(PPC_RAW_ADD(20, 21, 22)),
972 .gpr[22] = LONG_MAX,
977 .instr = ppc_inst(PPC_RAW_ADD(20, 21, 22)),
980 .gpr[22] = LONG_MAX,
985 .instr = ppc_inst(PPC_RAW_ADD(20, 21, 22)),
988 .gpr[22] = ULONG_MAX,
993 .instr = ppc_inst(PPC_RAW_ADD(20, 21, 22)),
996 .gpr[22] = 0x1,
1001 .instr = ppc_inst(PPC_RAW_ADD(20, 21, 22)),
1004 .gpr[22] = INT_MIN,
1009 .instr = ppc_inst(PPC_RAW_ADD(20, 21, 22)),
1012 .gpr[22] = INT_MAX,
1017 .instr = ppc_inst(PPC_RAW_ADD(20, 21, 22)),
1020 .gpr[22] = INT_MAX,
1025 .instr = ppc_inst(PPC_RAW_ADD(20, 21, 22)),
1028 .gpr[22] = UINT_MAX,
1033 .instr = ppc_inst(PPC_RAW_ADD(20, 21, 22)),
1036 .gpr[22] = 0x1,
1047 .instr = ppc_inst(PPC_RAW_ADD_DOT(20, 21, 22)),
1050 .gpr[22] = LONG_MIN,
1055 .instr = ppc_inst(PPC_RAW_ADD_DOT(20, 21, 22)),
1058 .gpr[22] = LONG_MAX,
1064 .instr = ppc_inst(PPC_RAW_ADD_DOT(20, 21, 22)),
1067 .gpr[22] = LONG_MAX,
1072 .instr = ppc_inst(PPC_RAW_ADD_DOT(20, 21, 22)),
1075 .gpr[22] = ULONG_MAX,
1080 .instr = ppc_inst(PPC_RAW_ADD_DOT(20, 21, 22)),
1083 .gpr[22] = 0x1,
1088 .instr = ppc_inst(PPC_RAW_ADD_DOT(20, 21, 22)),
1091 .gpr[22] = INT_MIN,
1096 .instr = ppc_inst(PPC_RAW_ADD_DOT(20, 21, 22)),
1099 .gpr[22] = INT_MAX,
1104 .instr = ppc_inst(PPC_RAW_ADD_DOT(20, 21, 22)),
1107 .gpr[22] = INT_MAX,
1112 .instr = ppc_inst(PPC_RAW_ADD_DOT(20, 21, 22)),
1115 .gpr[22] = UINT_MAX,
1120 .instr = ppc_inst(PPC_RAW_ADD_DOT(20, 21, 22)),
1123 .gpr[22] = 0x1,
1133 .instr = ppc_inst(PPC_RAW_ADDC(20, 21, 22)),
1136 .gpr[22] = LONG_MIN,
1141 .instr = ppc_inst(PPC_RAW_ADDC(20, 21, 22)),
1144 .gpr[22] = LONG_MAX,
1149 .instr = ppc_inst(PPC_RAW_ADDC(20, 21, 22)),
1152 .gpr[22] = LONG_MAX,
1157 .instr = ppc_inst(PPC_RAW_ADDC(20, 21, 22)),
1160 .gpr[22] = ULONG_MAX,
1165 .instr = ppc_inst(PPC_RAW_ADDC(20, 21, 22)),
1168 .gpr[22] = 0x1,
1173 .instr = ppc_inst(PPC_RAW_ADDC(20, 21, 22)),
1176 .gpr[22] = INT_MIN,
1181 .instr = ppc_inst(PPC_RAW_ADDC(20, 21, 22)),
1184 .gpr[22] = INT_MAX,
1189 .instr = ppc_inst(PPC_RAW_ADDC(20, 21, 22)),
1192 .gpr[22] = INT_MAX,
1197 .instr = ppc_inst(PPC_RAW_ADDC(20, 21, 22)),
1200 .gpr[22] = UINT_MAX,
1205 .instr = ppc_inst(PPC_RAW_ADDC(20, 21, 22)),
1208 .gpr[22] = 0x1,
1213 .instr = ppc_inst(PPC_RAW_ADDC(20, 21, 22)),
1216 .gpr[22] = LONG_MIN | (uint)INT_MIN,
1227 .instr = ppc_inst(PPC_RAW_ADDC_DOT(20, 21, 22)),
1230 .gpr[22] = LONG_MIN,
1235 .instr = ppc_inst(PPC_RAW_ADDC_DOT(20, 21, 22)),
1238 .gpr[22] = LONG_MAX,
1244 .instr = ppc_inst(PPC_RAW_ADDC_DOT(20, 21, 22)),
1247 .gpr[22] = LONG_MAX,
1252 .instr = ppc_inst(PPC_RAW_ADDC_DOT(20, 21, 22)),
1255 .gpr[22] = ULONG_MAX,
1260 .instr = ppc_inst(PPC_RAW_ADDC_DOT(20, 21, 22)),
1263 .gpr[22] = 0x1,
1268 .instr = ppc_inst(PPC_RAW_ADDC_DOT(20, 21, 22)),
1271 .gpr[22] = INT_MIN,
1276 .instr = ppc_inst(PPC_RAW_ADDC_DOT(20, 21, 22)),
1279 .gpr[22] = INT_MAX,
1284 .instr = ppc_inst(PPC_RAW_ADDC_DOT(20, 21, 22)),
1287 .gpr[22] = INT_MAX,
1292 .instr = ppc_inst(PPC_RAW_ADDC_DOT(20, 21, 22)),
1295 .gpr[22] = UINT_MAX,
1300 .instr = ppc_inst(PPC_RAW_ADDC_DOT(20, 21, 22)),
1303 .gpr[22] = 0x1,
1308 .instr = ppc_inst(PPC_RAW_ADDC_DOT(20, 21, 22)),
1311 .gpr[22] = LONG_MIN | (uint)INT_MIN,
1321 .instr = ppc_inst(PPC_RAW_DIVDE(20, 21, 22)),
1324 .gpr[22] = LONG_MIN,
1329 .instr = ppc_inst(PPC_RAW_DIVDE(20, 21, 22)),
1333 .gpr[22] = 0,
1338 .instr = ppc_inst(PPC_RAW_DIVDE(20, 21, 22)),
1341 .gpr[22] = LONG_MAX,
1351 .instr = ppc_inst(PPC_RAW_DIVDE_DOT(20, 21, 22)),
1354 .gpr[22] = LONG_MIN,
1359 .instr = ppc_inst(PPC_RAW_DIVDE_DOT(20, 21, 22)),
1363 .gpr[22] = 0,
1368 .instr = ppc_inst(PPC_RAW_DIVDE_DOT(20, 21, 22)),
1371 .gpr[22] = LONG_MAX,
1381 .instr = ppc_inst(PPC_RAW_DIVDEU(20, 21, 22)),
1385 .gpr[22] = LONG_MIN,
1390 .instr = ppc_inst(PPC_RAW_DIVDEU(20, 21, 22)),
1394 .gpr[22] = 0,
1399 .instr = ppc_inst(PPC_RAW_DIVDEU(20, 21, 22)),
1402 .gpr[22] = LONG_MAX,
1406 .descr = "RA = LONG_MAX - 1, RB = LONG_MAX",
1407 .instr = ppc_inst(PPC_RAW_DIVDEU(20, 21, 22)),
1409 .gpr[21] = LONG_MAX - 1,
1410 .gpr[22] = LONG_MAX,
1415 .instr = ppc_inst(PPC_RAW_DIVDEU(20, 21, 22)),
1419 .gpr[22] = LONG_MIN,
1429 .instr = ppc_inst(PPC_RAW_DIVDEU_DOT(20, 21, 22)),
1433 .gpr[22] = LONG_MIN,
1438 .instr = ppc_inst(PPC_RAW_DIVDEU_DOT(20, 21, 22)),
1442 .gpr[22] = 0,
1447 .instr = ppc_inst(PPC_RAW_DIVDEU_DOT(20, 21, 22)),
1450 .gpr[22] = LONG_MAX,
1454 .descr = "RA = LONG_MAX - 1, RB = LONG_MAX",
1455 .instr = ppc_inst(PPC_RAW_DIVDEU_DOT(20, 21, 22)),
1457 .gpr[21] = LONG_MAX - 1,
1458 .gpr[22] = LONG_MAX,
1463 .instr = ppc_inst(PPC_RAW_DIVDEU_DOT(20, 21, 22)),
1467 .gpr[22] = LONG_MIN,
1478 .instr = TEST_PADDI(21, 22, SI_MIN, 0),
1481 .gpr[22] = LONG_MIN,
1486 .instr = TEST_PADDI(21, 22, SI_MAX, 0),
1489 .gpr[22] = LONG_MIN,
1494 .instr = TEST_PADDI(21, 22, SI_MAX, 0),
1497 .gpr[22] = LONG_MAX,
1502 .instr = TEST_PADDI(21, 22, SI_UMAX, 0),
1505 .gpr[22] = ULONG_MAX,
1510 .instr = TEST_PADDI(21, 22, 0x1, 0),
1513 .gpr[22] = ULONG_MAX,
1518 .instr = TEST_PADDI(21, 22, SI_MIN, 0),
1521 .gpr[22] = INT_MIN,
1526 .instr = TEST_PADDI(21, 22, SI_MAX, 0),
1529 .gpr[22] = INT_MIN,
1534 .instr = TEST_PADDI(21, 22, SI_MAX, 0),
1537 .gpr[22] = INT_MAX,
1542 .instr = TEST_PADDI(21, 22, 0x1, 0),
1545 .gpr[22] = UINT_MAX,
1550 .instr = TEST_PADDI(21, 22, SI_MAX, 0),
1553 .gpr[22] = UINT_MAX,
1565 .instr = TEST_PADDI(21, 22, SI_MIN, 0),
1568 .gpr[22] = 0x0,
1588 .instr = TEST_PADDI(21, 22, 0, 1),
1592 .gpr[22] = 0,
1607 return -EINVAL; in emulate_compute_instr()
1610 regs->nip = patch_site_addr(&patch__exec_instr); in emulate_compute_instr()
1615 return -EFAULT; in emulate_compute_instr()
1617 return -EFAULT; in emulate_compute_instr()
1632 return -EINVAL; in execute_compute_instr()
1638 return -EFAULT; in execute_compute_instr()
1664 if (test->cpu_feature && !early_cpu_has_feature(test->cpu_feature)) { in run_tests_compute()
1665 show_result(test->mnemonic, "SKIP (!CPU_FTR)"); in run_tests_compute()
1669 for (j = 0; j < MAX_SUBTESTS && test->subtests[j].descr; j++) { in run_tests_compute()
1670 instr = test->subtests[j].instr; in run_tests_compute()
1671 flags = test->subtests[j].flags; in run_tests_compute()
1672 regs = &test->subtests[j].regs; in run_tests_compute()
1726 show_result_with_descr(test->mnemonic, in run_tests_compute()
1727 test->subtests[j].descr, in run_tests_compute()
1735 printk(KERN_INFO "Running instruction emulation self-tests ...\n"); in test_emulate_step()