Lines Matching refs:res
132 static void set_parity_flag(u32 res) in set_parity_flag() argument
134 CONDITIONAL_SET_FLAG(PARITY(res & 0xFF), F_PF); in set_parity_flag()
137 static void set_szp_flags_8(u8 res) in set_szp_flags_8() argument
139 CONDITIONAL_SET_FLAG(res & 0x80, F_SF); in set_szp_flags_8()
140 CONDITIONAL_SET_FLAG(res == 0, F_ZF); in set_szp_flags_8()
141 set_parity_flag(res); in set_szp_flags_8()
144 static void set_szp_flags_16(u16 res) in set_szp_flags_16() argument
146 CONDITIONAL_SET_FLAG(res & 0x8000, F_SF); in set_szp_flags_16()
147 CONDITIONAL_SET_FLAG(res == 0, F_ZF); in set_szp_flags_16()
148 set_parity_flag(res); in set_szp_flags_16()
151 static void set_szp_flags_32(u32 res) in set_szp_flags_32() argument
153 CONDITIONAL_SET_FLAG(res & 0x80000000, F_SF); in set_szp_flags_32()
154 CONDITIONAL_SET_FLAG(res == 0, F_ZF); in set_szp_flags_32()
155 set_parity_flag(res); in set_szp_flags_32()
158 static void no_carry_byte_side_eff(u8 res) in no_carry_byte_side_eff() argument
163 set_szp_flags_8(res); in no_carry_byte_side_eff()
166 static void no_carry_word_side_eff(u16 res) in no_carry_word_side_eff() argument
171 set_szp_flags_16(res); in no_carry_word_side_eff()
174 static void no_carry_long_side_eff(u32 res) in no_carry_long_side_eff() argument
179 set_szp_flags_32(res); in no_carry_long_side_eff()
182 static void calc_carry_chain(int bits, u32 d, u32 s, u32 res, int set_carry) in calc_carry_chain() argument
186 cc = (s & d) | ((~res) & (s | d)); in calc_carry_chain()
190 CONDITIONAL_SET_FLAG(res & (1 << bits), F_CF); in calc_carry_chain()
194 static void calc_borrow_chain(int bits, u32 d, u32 s, u32 res, int set_carry) in calc_borrow_chain() argument
198 bc = (res & (~d | s)) | (~d & s); in calc_borrow_chain()
212 u16 res; in aaa_word() local
222 res = (u16)(d & 0xFF0F); in aaa_word()
223 set_szp_flags_16(res); in aaa_word()
224 return res; in aaa_word()
233 u16 res; in aas_word() local
243 res = (u16)(d & 0xFF0F); in aas_word()
244 set_szp_flags_16(res); in aas_word()
245 return res; in aas_word()
287 u32 res; /* all operands in native machine order */ in adc_byte() local
289 res = d + s; in adc_byte()
290 if (ACCESS_FLAG(F_CF)) res++; in adc_byte()
292 set_szp_flags_8(res); in adc_byte()
293 calc_carry_chain(8,s,d,res,1); in adc_byte()
295 return (u8)res; in adc_byte()
304 u32 res; /* all operands in native machine order */ in adc_word() local
306 res = d + s; in adc_word()
308 res++; in adc_word()
310 set_szp_flags_16((u16)res); in adc_word()
311 calc_carry_chain(16,s,d,res,1); in adc_word()
313 return (u16)res; in adc_word()
324 u32 res; in adc_long() local
327 res = d + s; in adc_long()
331 res++; in adc_long()
336 set_szp_flags_32(res); in adc_long()
337 calc_carry_chain(32,s,d,res,0); in adc_long()
341 return res; in adc_long()
350 u32 res; /* all operands in native machine order */ in add_byte() local
352 res = d + s; in add_byte()
353 set_szp_flags_8((u8)res); in add_byte()
354 calc_carry_chain(8,s,d,res,1); in add_byte()
356 return (u8)res; in add_byte()
365 u32 res; /* all operands in native machine order */ in add_word() local
367 res = d + s; in add_word()
368 set_szp_flags_16((u16)res); in add_word()
369 calc_carry_chain(16,s,d,res,1); in add_word()
371 return (u16)res; in add_word()
380 u32 res; in add_long() local
382 res = d + s; in add_long()
383 set_szp_flags_32(res); in add_long()
384 calc_carry_chain(32,s,d,res,0); in add_long()
386 CONDITIONAL_SET_FLAG(res < d || res < s, F_CF); in add_long()
388 return res; in add_long()
397 u8 res; /* all operands in native machine order */ in and_byte() local
399 res = d & s; in and_byte()
401 no_carry_byte_side_eff(res); in and_byte()
402 return res; in and_byte()
411 u16 res; /* all operands in native machine order */ in and_word() local
413 res = d & s; in and_word()
415 no_carry_word_side_eff(res); in and_word()
416 return res; in and_word()
425 u32 res; /* all operands in native machine order */ in and_long() local
427 res = d & s; in and_long()
428 no_carry_long_side_eff(res); in and_long()
429 return res; in and_long()
438 u32 res; /* all operands in native machine order */ in cmp_byte() local
440 res = d - s; in cmp_byte()
441 set_szp_flags_8((u8)res); in cmp_byte()
442 calc_borrow_chain(8, d, s, res, 1); in cmp_byte()
453 u32 res; /* all operands in native machine order */ in cmp_word() local
455 res = d - s; in cmp_word()
456 set_szp_flags_16((u16)res); in cmp_word()
457 calc_borrow_chain(16, d, s, res, 1); in cmp_word()
468 u32 res; /* all operands in native machine order */ in cmp_long() local
470 res = d - s; in cmp_long()
471 set_szp_flags_32(res); in cmp_long()
472 calc_borrow_chain(32, d, s, res, 1); in cmp_long()
483 u32 res = d; in daa_byte() local
485 res += 6; in daa_byte()
488 if (res > 0x9F || ACCESS_FLAG(F_CF)) { in daa_byte()
489 res += 0x60; in daa_byte()
492 set_szp_flags_8((u8)res); in daa_byte()
493 return (u8)res; in daa_byte()
520 u32 res; /* all operands in native machine order */ in dec_byte() local
522 res = d - 1; in dec_byte()
523 set_szp_flags_8((u8)res); in dec_byte()
524 calc_borrow_chain(8, d, 1, res, 0); in dec_byte()
526 return (u8)res; in dec_byte()
535 u32 res; /* all operands in native machine order */ in dec_word() local
537 res = d - 1; in dec_word()
538 set_szp_flags_16((u16)res); in dec_word()
539 calc_borrow_chain(16, d, 1, res, 0); in dec_word()
541 return (u16)res; in dec_word()
550 u32 res; /* all operands in native machine order */ in dec_long() local
552 res = d - 1; in dec_long()
554 set_szp_flags_32(res); in dec_long()
555 calc_borrow_chain(32, d, 1, res, 0); in dec_long()
557 return res; in dec_long()
566 u32 res; /* all operands in native machine order */ in inc_byte() local
568 res = d + 1; in inc_byte()
569 set_szp_flags_8((u8)res); in inc_byte()
570 calc_carry_chain(8, d, 1, res, 0); in inc_byte()
572 return (u8)res; in inc_byte()
581 u32 res; /* all operands in native machine order */ in inc_word() local
583 res = d + 1; in inc_word()
584 set_szp_flags_16((u16)res); in inc_word()
585 calc_carry_chain(16, d, 1, res, 0); in inc_word()
587 return (u16)res; in inc_word()
596 u32 res; /* all operands in native machine order */ in inc_long() local
598 res = d + 1; in inc_long()
599 set_szp_flags_32(res); in inc_long()
600 calc_carry_chain(32, d, 1, res, 0); in inc_long()
602 return res; in inc_long()
611 u8 res; /* all operands in native machine order */ in or_byte() local
613 res = d | s; in or_byte()
614 no_carry_byte_side_eff(res); in or_byte()
616 return res; in or_byte()
625 u16 res; /* all operands in native machine order */ in or_word() local
627 res = d | s; in or_word()
628 no_carry_word_side_eff(res); in or_word()
629 return res; in or_word()
638 u32 res; /* all operands in native machine order */ in or_long() local
640 res = d | s; in or_long()
641 no_carry_long_side_eff(res); in or_long()
642 return res; in or_long()
651 u8 res; in neg_byte() local
654 res = (u8)-s; in neg_byte()
655 set_szp_flags_8(res); in neg_byte()
656 calc_borrow_chain(8, 0, s, res, 0); in neg_byte()
658 return res; in neg_byte()
667 u16 res; in neg_word() local
670 res = (u16)-s; in neg_word()
671 set_szp_flags_16((u16)res); in neg_word()
672 calc_borrow_chain(16, 0, s, res, 0); in neg_word()
674 return res; in neg_word()
683 u32 res; in neg_long() local
686 res = (u32)-s; in neg_long()
687 set_szp_flags_32(res); in neg_long()
688 calc_borrow_chain(32, 0, s, res, 0); in neg_long()
690 return res; in neg_long()
726 unsigned int res, cnt, mask, cf; in rcl_byte() local
754 res = d; in rcl_byte()
764 res = (d << cnt) & 0xff; in rcl_byte()
773 res |= (d >> (9 - cnt)) & mask; in rcl_byte()
778 res |= 1 << (cnt - 1); in rcl_byte()
786 CONDITIONAL_SET_FLAG(cnt == 1 && XOR2(cf + ((res >> 6) & 0x2)), in rcl_byte()
790 return (u8)res; in rcl_byte()
799 unsigned int res, cnt, mask, cf; in rcl_word() local
801 res = d; in rcl_word()
804 res = (d << cnt) & 0xffff; in rcl_word()
806 res |= (d >> (17 - cnt)) & mask; in rcl_word()
808 res |= 1 << (cnt - 1); in rcl_word()
811 CONDITIONAL_SET_FLAG(cnt == 1 && XOR2(cf + ((res >> 14) & 0x2)), in rcl_word()
814 return (u16)res; in rcl_word()
823 u32 res, cnt, mask, cf; in rcl_long() local
825 res = d; in rcl_long()
828 res = (d << cnt) & 0xffffffff; in rcl_long()
830 res |= (d >> (33 - cnt)) & mask; in rcl_long()
832 res |= 1 << (cnt - 1); in rcl_long()
835 CONDITIONAL_SET_FLAG(cnt == 1 && XOR2(cf + ((res >> 30) & 0x2)), in rcl_long()
838 return res; in rcl_long()
847 u32 res, cnt; in rcr_byte() local
872 res = d; in rcr_byte()
897 res = (d >> cnt) & mask; in rcr_byte()
905 res |= (d << (9 - cnt)); in rcr_byte()
910 res |= 1 << (8 - cnt); in rcr_byte()
922 return (u8)res; in rcr_byte()
931 u32 res, cnt; in rcr_word() local
935 res = d; in rcr_word()
943 res = (d >> cnt) & mask; in rcr_word()
944 res |= (d << (17 - cnt)); in rcr_word()
946 res |= 1 << (16 - cnt); in rcr_word()
954 return (u16)res; in rcr_word()
963 u32 res, cnt; in rcr_long() local
967 res = d; in rcr_long()
975 res = (d >> cnt) & mask; in rcr_long()
977 res |= (d << (33 - cnt)); in rcr_long()
979 res |= 1 << (32 - cnt); in rcr_long()
987 return res; in rcr_long()
996 unsigned int res, cnt, mask; in rol_byte() local
1014 res = d; in rol_byte()
1017 res = (d << cnt); in rol_byte()
1021 res |= (d >> (8 - cnt)) & mask; in rol_byte()
1025 CONDITIONAL_SET_FLAG(res & 0x1, F_CF); in rol_byte()
1029 XOR2((res & 0x1) + ((res >> 6) & 0x2)), in rol_byte()
1034 CONDITIONAL_SET_FLAG(res & 0x1, F_CF); in rol_byte()
1036 return (u8)res; in rol_byte()
1045 unsigned int res, cnt, mask; in rol_word() local
1047 res = d; in rol_word()
1049 res = (d << cnt); in rol_word()
1051 res |= (d >> (16 - cnt)) & mask; in rol_word()
1052 CONDITIONAL_SET_FLAG(res & 0x1, F_CF); in rol_word()
1054 XOR2((res & 0x1) + ((res >> 14) & 0x2)), in rol_word()
1059 CONDITIONAL_SET_FLAG(res & 0x1, F_CF); in rol_word()
1061 return (u16)res; in rol_word()
1070 u32 res, cnt, mask; in rol_long() local
1072 res = d; in rol_long()
1074 res = (d << cnt); in rol_long()
1076 res |= (d >> (32 - cnt)) & mask; in rol_long()
1077 CONDITIONAL_SET_FLAG(res & 0x1, F_CF); in rol_long()
1079 XOR2((res & 0x1) + ((res >> 30) & 0x2)), in rol_long()
1084 CONDITIONAL_SET_FLAG(res & 0x1, F_CF); in rol_long()
1086 return res; in rol_long()
1095 unsigned int res, cnt, mask; in ror_byte() local
1112 res = d; in ror_byte()
1115 res = (d << (8 - cnt)); in ror_byte()
1119 res |= (d >> (cnt)) & mask; in ror_byte()
1123 CONDITIONAL_SET_FLAG(res & 0x80, F_CF); in ror_byte()
1126 CONDITIONAL_SET_FLAG(s == 1 && XOR2(res >> 6), F_OF); in ror_byte()
1130 CONDITIONAL_SET_FLAG(res & 0x80, F_CF); in ror_byte()
1132 return (u8)res; in ror_byte()
1141 unsigned int res, cnt, mask; in ror_word() local
1143 res = d; in ror_word()
1145 res = (d << (16 - cnt)); in ror_word()
1147 res |= (d >> (cnt)) & mask; in ror_word()
1148 CONDITIONAL_SET_FLAG(res & 0x8000, F_CF); in ror_word()
1149 CONDITIONAL_SET_FLAG(s == 1 && XOR2(res >> 14), F_OF); in ror_word()
1153 CONDITIONAL_SET_FLAG(res & 0x8000, F_CF); in ror_word()
1155 return (u16)res; in ror_word()
1164 u32 res, cnt, mask; in ror_long() local
1166 res = d; in ror_long()
1168 res = (d << (32 - cnt)); in ror_long()
1170 res |= (d >> (cnt)) & mask; in ror_long()
1171 CONDITIONAL_SET_FLAG(res & 0x80000000, F_CF); in ror_long()
1172 CONDITIONAL_SET_FLAG(s == 1 && XOR2(res >> 30), F_OF); in ror_long()
1176 CONDITIONAL_SET_FLAG(res & 0x80000000, F_CF); in ror_long()
1178 return res; in ror_long()
1187 unsigned int cnt, res, cf; in shl_byte() local
1194 res = d << cnt; in shl_byte()
1197 set_szp_flags_8((u8)res); in shl_byte()
1199 res = (u8) d; in shl_byte()
1205 (((res & 0x80) == 0x80) ^ in shl_byte()
1213 res = 0; in shl_byte()
1220 return (u8)res; in shl_byte()
1229 unsigned int cnt, res, cf; in shl_word() local
1234 res = d << cnt; in shl_word()
1237 set_szp_flags_16((u16)res); in shl_word()
1239 res = (u16) d; in shl_word()
1244 (((res & 0x8000) == 0x8000) ^ in shl_word()
1251 res = 0; in shl_word()
1258 return (u16)res; in shl_word()
1267 unsigned int cnt, res, cf; in shl_long() local
1272 res = d << cnt; in shl_long()
1275 set_szp_flags_32((u32)res); in shl_long()
1277 res = d; in shl_long()
1280 CONDITIONAL_SET_FLAG((((res & 0x80000000) == 0x80000000) ^ in shl_long()
1286 res = 0; in shl_long()
1293 return res; in shl_long()
1302 unsigned int cnt, res, cf; in shr_byte() local
1308 res = d >> cnt; in shr_byte()
1310 set_szp_flags_8((u8)res); in shr_byte()
1312 res = (u8) d; in shr_byte()
1316 CONDITIONAL_SET_FLAG(XOR2(res >> 6), F_OF); in shr_byte()
1321 res = 0; in shr_byte()
1328 return (u8)res; in shr_byte()
1337 unsigned int cnt, res, cf; in shr_word() local
1343 res = d >> cnt; in shr_word()
1345 set_szp_flags_16((u16)res); in shr_word()
1347 res = d; in shr_word()
1351 CONDITIONAL_SET_FLAG(XOR2(res >> 14), F_OF); in shr_word()
1356 res = 0; in shr_word()
1363 return (u16)res; in shr_word()
1372 unsigned int cnt, res, cf; in shr_long() local
1378 res = d >> cnt; in shr_long()
1380 set_szp_flags_32((u32)res); in shr_long()
1382 res = d; in shr_long()
1385 CONDITIONAL_SET_FLAG(XOR2(res >> 30), F_OF); in shr_long()
1390 res = 0; in shr_long()
1397 return res; in shr_long()
1406 unsigned int cnt, res, cf, mask, sf; in sar_byte() local
1408 res = d; in sar_byte()
1414 res = (d >> cnt) & mask; in sar_byte()
1417 res |= ~mask; in sar_byte()
1419 set_szp_flags_8((u8)res); in sar_byte()
1422 res = 0xff; in sar_byte()
1428 res = 0; in sar_byte()
1435 return (u8)res; in sar_byte()
1444 unsigned int cnt, res, cf, mask, sf; in sar_word() local
1448 res = d; in sar_word()
1452 res = (d >> cnt) & mask; in sar_word()
1455 res |= ~mask; in sar_word()
1457 set_szp_flags_16((u16)res); in sar_word()
1460 res = 0xffff; in sar_word()
1466 res = 0; in sar_word()
1473 return (u16)res; in sar_word()
1482 u32 cnt, res, cf, mask, sf; in sar_long() local
1486 res = d; in sar_long()
1490 res = (d >> cnt) & mask; in sar_long()
1493 res |= ~mask; in sar_long()
1495 set_szp_flags_32(res); in sar_long()
1498 res = 0xffffffff; in sar_long()
1504 res = 0; in sar_long()
1511 return res; in sar_long()
1520 unsigned int cnt, res, cf; in shld_word() local
1525 res = (d << cnt) | (fill >> (16-cnt)); in shld_word()
1528 set_szp_flags_16((u16)res); in shld_word()
1530 res = d; in shld_word()
1533 CONDITIONAL_SET_FLAG((((res & 0x8000) == 0x8000) ^ in shld_word()
1539 res = 0; in shld_word()
1546 return (u16)res; in shld_word()
1555 unsigned int cnt, res, cf; in shld_long() local
1560 res = (d << cnt) | (fill >> (32-cnt)); in shld_long()
1563 set_szp_flags_32((u32)res); in shld_long()
1565 res = d; in shld_long()
1568 CONDITIONAL_SET_FLAG((((res & 0x80000000) == 0x80000000) ^ in shld_long()
1574 res = 0; in shld_long()
1581 return res; in shld_long()
1590 unsigned int cnt, res, cf; in shrd_word() local
1596 res = (d >> cnt) | (fill << (16 - cnt)); in shrd_word()
1598 set_szp_flags_16((u16)res); in shrd_word()
1600 res = d; in shrd_word()
1604 CONDITIONAL_SET_FLAG(XOR2(res >> 14), F_OF); in shrd_word()
1609 res = 0; in shrd_word()
1616 return (u16)res; in shrd_word()
1625 unsigned int cnt, res, cf; in shrd_long() local
1631 res = (d >> cnt) | (fill << (32 - cnt)); in shrd_long()
1633 set_szp_flags_32((u32)res); in shrd_long()
1635 res = d; in shrd_long()
1638 CONDITIONAL_SET_FLAG(XOR2(res >> 30), F_OF); in shrd_long()
1643 res = 0; in shrd_long()
1650 return res; in shrd_long()
1659 u32 res; /* all operands in native machine order */ in sbb_byte() local
1663 res = d - s - 1; in sbb_byte()
1665 res = d - s; in sbb_byte()
1666 set_szp_flags_8((u8)res); in sbb_byte()
1669 bc = (res & (~d | s)) | (~d & s); in sbb_byte()
1673 return (u8)res; in sbb_byte()
1682 u32 res; /* all operands in native machine order */ in sbb_word() local
1686 res = d - s - 1; in sbb_word()
1688 res = d - s; in sbb_word()
1689 set_szp_flags_16((u16)res); in sbb_word()
1692 bc = (res & (~d | s)) | (~d & s); in sbb_word()
1696 return (u16)res; in sbb_word()
1705 u32 res; /* all operands in native machine order */ in sbb_long() local
1709 res = d - s - 1; in sbb_long()
1711 res = d - s; in sbb_long()
1713 set_szp_flags_32(res); in sbb_long()
1716 bc = (res & (~d | s)) | (~d & s); in sbb_long()
1720 return res; in sbb_long()
1729 u32 res; /* all operands in native machine order */ in sub_byte() local
1732 res = d - s; in sub_byte()
1733 set_szp_flags_8((u8)res); in sub_byte()
1736 bc = (res & (~d | s)) | (~d & s); in sub_byte()
1740 return (u8)res; in sub_byte()
1749 u32 res; /* all operands in native machine order */ in sub_word() local
1752 res = d - s; in sub_word()
1753 set_szp_flags_16((u16)res); in sub_word()
1756 bc = (res & (~d | s)) | (~d & s); in sub_word()
1760 return (u16)res; in sub_word()
1769 u32 res; /* all operands in native machine order */ in sub_long() local
1772 res = d - s; in sub_long()
1773 set_szp_flags_32(res); in sub_long()
1776 bc = (res & (~d | s)) | (~d & s); in sub_long()
1780 return res; in sub_long()
1789 u32 res; /* all operands in native machine order */ in test_byte() local
1791 res = d & s; in test_byte()
1794 set_szp_flags_8((u8)res); in test_byte()
1805 u32 res; /* all operands in native machine order */ in test_word() local
1807 res = d & s; in test_word()
1810 set_szp_flags_16((u16)res); in test_word()
1821 u32 res; /* all operands in native machine order */ in test_long() local
1823 res = d & s; in test_long()
1826 set_szp_flags_32(res); in test_long()
1837 u8 res; /* all operands in native machine order */ in xor_byte() local
1839 res = d ^ s; in xor_byte()
1840 no_carry_byte_side_eff(res); in xor_byte()
1841 return res; in xor_byte()
1850 u16 res; /* all operands in native machine order */ in xor_word() local
1852 res = d ^ s; in xor_word()
1853 no_carry_word_side_eff(res); in xor_word()
1854 return res; in xor_word()
1863 u32 res; /* all operands in native machine order */ in xor_long() local
1865 res = d ^ s; in xor_long()
1866 no_carry_long_side_eff(res); in xor_long()
1867 return res; in xor_long()
1876 s16 res = (s16)((s8)M.x86.R_AL * (s8)s); in imul_byte() local
1878 M.x86.R_AX = res; in imul_byte()
1895 s32 res = (s16)M.x86.R_AX * (s16)s; in imul_word() local
1897 M.x86.R_AX = (u16)res; in imul_word()
1898 M.x86.R_DX = (u16)(res >> 16); in imul_word()
1916 s64 res = (s32)d * (s32)s; in imul_long_direct() local
1918 *res_lo = (u32)res; in imul_long_direct()
1919 *res_hi = (u32)(res >> 32); in imul_long_direct()
1970 u16 res = (u16)(M.x86.R_AL * s); in mul_byte() local
1972 M.x86.R_AX = res; in mul_byte()
1988 u32 res = M.x86.R_AX * s; in mul_word() local
1990 M.x86.R_AX = (u16)res; in mul_word()
1991 M.x86.R_DX = (u16)(res >> 16); in mul_word()
2008 u64 res = (u32)M.x86.R_EAX * (u32)s; in mul_long() local
2010 M.x86.R_EAX = (u32)res; in mul_long()
2011 M.x86.R_EDX = (u32)(res >> 32); in mul_long()
2418 u16 res; in pop_word() local
2422 res = (*sys_rdw)(((u32)M.x86.R_SS << 4) + M.x86.R_SP); in pop_word()
2424 return res; in pop_word()
2435 u32 res; in pop_long() local
2439 res = (*sys_rdl)(((u32)M.x86.R_SS << 4) + M.x86.R_SP); in pop_long()
2441 return res; in pop_long()