Commit f24cb33e5ed11a2888fc1de2948897f5c46f4684
1 parent
3d7b417e
TCG: add logical operations found on alpha and powerpc processors
- andc_i32/i64 t0, t1, t2 - eqv_i32/i64 t0, t1, t2 - nand_i32/i64 t0, t1, t2 - nor_i32/i64 t0, t1, t2 - orc_i32/i64 t0, t1, t2 Signed-off-by: Aurelien Jarno <aurelien@aurel32.net> git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5501 c046a42c-6fe2-441c-8c8c-71466251a162
Showing
2 changed files
with
120 additions
and
0 deletions
tcg/README
| ... | ... | @@ -205,6 +205,26 @@ t0=t1^t2 |
| 205 | 205 | |
| 206 | 206 | t0=~t1 |
| 207 | 207 | |
| 208 | +* andc_i32/i64 t0, t1, t2 | |
| 209 | + | |
| 210 | +t0=t1&~t2 | |
| 211 | + | |
| 212 | +* eqv_i32/i64 t0, t1, t2 | |
| 213 | + | |
| 214 | +t0=~(t1^t2) | |
| 215 | + | |
| 216 | +* nand_i32/i64 t0, t1, t2 | |
| 217 | + | |
| 218 | +t0=~(t1&t2) | |
| 219 | + | |
| 220 | +* nor_i32/i64 t0, t1, t2 | |
| 221 | + | |
| 222 | +t0=~(t1|t2) | |
| 223 | + | |
| 224 | +* orc_i32/i64 t0, t1, t2 | |
| 225 | + | |
| 226 | +t0=t1|~t2 | |
| 227 | + | |
| 208 | 228 | ********* Shifts |
| 209 | 229 | |
| 210 | 230 | * shl_i32/i64 t0, t1, t2 | ... | ... |
tcg/tcg-op.h
| ... | ... | @@ -1425,6 +1425,96 @@ static inline void tcg_gen_concat32_i64(TCGv dest, TCGv low, TCGv high) |
| 1425 | 1425 | #endif |
| 1426 | 1426 | } |
| 1427 | 1427 | |
| 1428 | +static inline void tcg_gen_andc_i32(TCGv ret, TCGv arg1, TCGv arg2) | |
| 1429 | +{ | |
| 1430 | + TCGv t0; | |
| 1431 | + t0 = tcg_temp_new(TCG_TYPE_I32); | |
| 1432 | + tcg_gen_not_i32(t0, arg2); | |
| 1433 | + tcg_gen_and_i32(ret, arg1, t0); | |
| 1434 | + tcg_temp_free(t0); | |
| 1435 | +} | |
| 1436 | + | |
| 1437 | +static inline void tcg_gen_andc_i64(TCGv ret, TCGv arg1, TCGv arg2) | |
| 1438 | +{ | |
| 1439 | + TCGv t0; | |
| 1440 | + t0 = tcg_temp_new(TCG_TYPE_I64); | |
| 1441 | + tcg_gen_not_i64(t0, arg2); | |
| 1442 | + tcg_gen_and_i64(ret, arg1, t0); | |
| 1443 | + tcg_temp_free(t0); | |
| 1444 | +} | |
| 1445 | + | |
| 1446 | +static inline void tcg_gen_eqv_i32(TCGv ret, TCGv arg1, TCGv arg2) | |
| 1447 | +{ | |
| 1448 | + TCGv t0; | |
| 1449 | + t0 = tcg_temp_new(TCG_TYPE_I32); | |
| 1450 | + tcg_gen_xor_i32(t0, arg1, arg2); | |
| 1451 | + tcg_gen_not_i32(ret, t0); | |
| 1452 | + tcg_temp_free(t0); | |
| 1453 | +} | |
| 1454 | + | |
| 1455 | +static inline void tcg_gen_eqv_i64(TCGv ret, TCGv arg1, TCGv arg2) | |
| 1456 | +{ | |
| 1457 | + TCGv t0; | |
| 1458 | + t0 = tcg_temp_new(TCG_TYPE_I64); | |
| 1459 | + tcg_gen_xor_i64(t0, arg1, arg2); | |
| 1460 | + tcg_gen_not_i64(ret, t0); | |
| 1461 | + tcg_temp_free(t0); | |
| 1462 | +} | |
| 1463 | + | |
| 1464 | +static inline void tcg_gen_nand_i32(TCGv ret, TCGv arg1, TCGv arg2) | |
| 1465 | +{ | |
| 1466 | + TCGv t0; | |
| 1467 | + t0 = tcg_temp_new(TCG_TYPE_I32); | |
| 1468 | + tcg_gen_and_i32(t0, arg1, arg2); | |
| 1469 | + tcg_gen_not_i32(ret, t0); | |
| 1470 | + tcg_temp_free(t0); | |
| 1471 | +} | |
| 1472 | + | |
| 1473 | +static inline void tcg_gen_nand_i64(TCGv ret, TCGv arg1, TCGv arg2) | |
| 1474 | +{ | |
| 1475 | + TCGv t0; | |
| 1476 | + t0 = tcg_temp_new(TCG_TYPE_I64); | |
| 1477 | + tcg_gen_and_i64(t0, arg1, arg2); | |
| 1478 | + tcg_gen_not_i64(ret, t0); | |
| 1479 | + tcg_temp_free(t0); | |
| 1480 | +} | |
| 1481 | + | |
| 1482 | +static inline void tcg_gen_nor_i32(TCGv ret, TCGv arg1, TCGv arg2) | |
| 1483 | +{ | |
| 1484 | + TCGv t0; | |
| 1485 | + t0 = tcg_temp_new(TCG_TYPE_I32); | |
| 1486 | + tcg_gen_or_i32(t0, arg1, arg2); | |
| 1487 | + tcg_gen_not_i32(ret, t0); | |
| 1488 | + tcg_temp_free(t0); | |
| 1489 | +} | |
| 1490 | + | |
| 1491 | +static inline void tcg_gen_nor_i64(TCGv ret, TCGv arg1, TCGv arg2) | |
| 1492 | +{ | |
| 1493 | + TCGv t0; | |
| 1494 | + t0 = tcg_temp_new(TCG_TYPE_I64); | |
| 1495 | + tcg_gen_or_i64(t0, arg1, arg2); | |
| 1496 | + tcg_gen_not_i64(ret, t0); | |
| 1497 | + tcg_temp_free(t0); | |
| 1498 | +} | |
| 1499 | + | |
| 1500 | +static inline void tcg_gen_orc_i32(TCGv ret, TCGv arg1, TCGv arg2) | |
| 1501 | +{ | |
| 1502 | + TCGv t0; | |
| 1503 | + t0 = tcg_temp_new(TCG_TYPE_I32); | |
| 1504 | + tcg_gen_not_i32(t0, arg2); | |
| 1505 | + tcg_gen_or_i32(ret, arg1, t0); | |
| 1506 | + tcg_temp_free(t0); | |
| 1507 | +} | |
| 1508 | + | |
| 1509 | +static inline void tcg_gen_orc_i64(TCGv ret, TCGv arg1, TCGv arg2) | |
| 1510 | +{ | |
| 1511 | + TCGv t0; | |
| 1512 | + t0 = tcg_temp_new(TCG_TYPE_I64); | |
| 1513 | + tcg_gen_not_i64(t0, arg2); | |
| 1514 | + tcg_gen_or_i64(ret, arg1, t0); | |
| 1515 | + tcg_temp_free(t0); | |
| 1516 | +} | |
| 1517 | + | |
| 1428 | 1518 | /***************************************/ |
| 1429 | 1519 | /* QEMU specific operations. Their type depend on the QEMU CPU |
| 1430 | 1520 | type. */ |
| ... | ... | @@ -1678,6 +1768,11 @@ static inline void tcg_gen_qemu_st64(TCGv arg, TCGv addr, int mem_index) |
| 1678 | 1768 | #define tcg_gen_ext32u_tl tcg_gen_ext32u_i64 |
| 1679 | 1769 | #define tcg_gen_ext32s_tl tcg_gen_ext32s_i64 |
| 1680 | 1770 | #define tcg_gen_concat_tl_i64 tcg_gen_concat32_i64 |
| 1771 | +#define tcg_gen_andc_tl tcg_gen_andc_i64 | |
| 1772 | +#define tcg_gen_eqv_tl tcg_gen_eqv_i64 | |
| 1773 | +#define tcg_gen_nand_tl tcg_gen_nand_i64 | |
| 1774 | +#define tcg_gen_nor_tl tcg_gen_nor_i64 | |
| 1775 | +#define tcg_gen_orc_tl tcg_gen_orc_i64 | |
| 1681 | 1776 | #define tcg_const_tl tcg_const_i64 |
| 1682 | 1777 | #else |
| 1683 | 1778 | #define TCG_TYPE_TL TCG_TYPE_I32 |
| ... | ... | @@ -1730,6 +1825,11 @@ static inline void tcg_gen_qemu_st64(TCGv arg, TCGv addr, int mem_index) |
| 1730 | 1825 | #define tcg_gen_ext32u_tl tcg_gen_mov_i32 |
| 1731 | 1826 | #define tcg_gen_ext32s_tl tcg_gen_mov_i32 |
| 1732 | 1827 | #define tcg_gen_concat_tl_i64 tcg_gen_concat_i32_i64 |
| 1828 | +#define tcg_gen_andc_tl tcg_gen_andc_i32 | |
| 1829 | +#define tcg_gen_eqv_tl tcg_gen_eqv_i32 | |
| 1830 | +#define tcg_gen_nand_tl tcg_gen_nand_i32 | |
| 1831 | +#define tcg_gen_nor_tl tcg_gen_nor_i32 | |
| 1832 | +#define tcg_gen_orc_tl tcg_gen_orc_i32 | |
| 1733 | 1833 | #define tcg_const_tl tcg_const_i32 |
| 1734 | 1834 | #endif |
| 1735 | 1835 | ... | ... |