int_helper.c (a2c67342eed42f181aa123803bc246b8fad7d1d9) | int_helper.c (f56d3c1a140267ae88874d755fa2f24cb71a1572) |
---|---|
1/* 2 * PowerPC integer and vector emulation helpers for QEMU. 3 * 4 * Copyright (c) 2003-2007 Jocelyn Mayer 5 * 6 * This library is free software; you can redistribute it and/or 7 * modify it under the terms of the GNU Lesser General Public 8 * License as published by the Free Software Foundation; either --- 1431 unchanged lines hidden (view full) --- 1440void helper_vpmsumh(ppc_avr_t *r, ppc_avr_t *a, ppc_avr_t *b) 1441{ 1442 for (int i = 0; i < 2; ++i) { 1443 uint64_t aa = a->u64[i], bb = b->u64[i]; 1444 r->u64[i] = clmul_16x2_even(aa, bb) ^ clmul_16x2_odd(aa, bb); 1445 } 1446} 1447 | 1/* 2 * PowerPC integer and vector emulation helpers for QEMU. 3 * 4 * Copyright (c) 2003-2007 Jocelyn Mayer 5 * 6 * This library is free software; you can redistribute it and/or 7 * modify it under the terms of the GNU Lesser General Public 8 * License as published by the Free Software Foundation; either --- 1431 unchanged lines hidden (view full) --- 1440void helper_vpmsumh(ppc_avr_t *r, ppc_avr_t *a, ppc_avr_t *b) 1441{ 1442 for (int i = 0; i < 2; ++i) { 1443 uint64_t aa = a->u64[i], bb = b->u64[i]; 1444 r->u64[i] = clmul_16x2_even(aa, bb) ^ clmul_16x2_odd(aa, bb); 1445 } 1446} 1447 |
1448#define PMSUM(name, srcfld, trgfld, trgtyp) \ 1449void helper_##name(ppc_avr_t *r, ppc_avr_t *a, ppc_avr_t *b) \ 1450{ \ 1451 int i, j; \ 1452 trgtyp prod[sizeof(ppc_avr_t) / sizeof(a->srcfld[0])]; \ 1453 \ 1454 VECTOR_FOR_INORDER_I(i, srcfld) { \ 1455 prod[i] = 0; \ 1456 for (j = 0; j < sizeof(a->srcfld[0]) * 8; j++) { \ 1457 if (a->srcfld[i] & (1ull << j)) { \ 1458 prod[i] ^= ((trgtyp)b->srcfld[i] << j); \ 1459 } \ 1460 } \ 1461 } \ 1462 \ 1463 VECTOR_FOR_INORDER_I(i, trgfld) { \ 1464 r->trgfld[i] = prod[2 * i] ^ prod[2 * i + 1]; \ 1465 } \ | 1448void helper_vpmsumw(ppc_avr_t *r, ppc_avr_t *a, ppc_avr_t *b) 1449{ 1450 for (int i = 0; i < 2; ++i) { 1451 uint64_t aa = a->u64[i], bb = b->u64[i]; 1452 r->u64[i] = clmul_32(aa, bb) ^ clmul_32(aa >> 32, bb >> 32); 1453 } |
1466} 1467 | 1454} 1455 |
1468PMSUM(vpmsumw, u32, u64, uint64_t) 1469 | |
1470void helper_VPMSUMD(ppc_avr_t *r, ppc_avr_t *a, ppc_avr_t *b) 1471{ 1472 int i, j; 1473 Int128 tmp, prod[2] = {int128_zero(), int128_zero()}; 1474 1475 for (j = 0; j < 64; j++) { 1476 for (i = 0; i < ARRAY_SIZE(r->u64); i++) { 1477 if (a->VsrD(i) & (1ull << j)) { --- 1662 unchanged lines hidden --- | 1456void helper_VPMSUMD(ppc_avr_t *r, ppc_avr_t *a, ppc_avr_t *b) 1457{ 1458 int i, j; 1459 Int128 tmp, prod[2] = {int128_zero(), int128_zero()}; 1460 1461 for (j = 0; j < 64; j++) { 1462 for (i = 0; i < ARRAY_SIZE(r->u64); i++) { 1463 if (a->VsrD(i) & (1ull << j)) { --- 1662 unchanged lines hidden --- |