| 1 |
/* { dg-do compile { target { powerpc*-*-* && lp64 } } } */ |
| 2 |
/* { dg-skip-if "" { powerpc*-*-darwin* } } */ |
| 3 |
/* { dg-options "-mdejagnu-cpu=power8 -mvsx -O1 -std=gnu17" } */ |
| 4 |
/* { dg-require-effective-target powerpc_vsx } */ |
| 5 |
|
| 6 |
enum typecode |
| 7 |
{ |
| 8 |
QIcode, QUcode, HIcode, HUcode, SIcode, SUcode, DIcode, DUcode, SFcode, |
| 9 |
DFcode, XFcode, Pcode, Tcode, LAST_AND_UNUSED_TYPECODE |
| 10 |
}; |
| 11 |
enum bytecode_opcode |
| 12 |
{ |
| 13 |
neverneverland, drop, duplicate, over, setstackSI, adjstackSI, constQI, |
| 14 |
constHI, constSI, constDI, constSF, constDF, constXF, constP, loadQI, |
| 15 |
loadHI, loadSI, loadDI, loadSF, loadDF, loadXF, loadP, storeQI, storeHI, |
| 16 |
storeSI, storeDI, storeSF, storeDF, storeXF, storeP, storeBLK, clearBLK, |
| 17 |
addconstPSI, newlocalSI, localP, argP, convertQIHI, convertHISI, |
| 18 |
convertSIDI, convertQISI, convertQUHU, convertHUSU, convertSUDU, |
| 19 |
convertQUSU, convertSFDF, convertDFXF, convertHIQI, convertSIHI, |
| 20 |
convertDISI, convertSIQI, convertSUQU, convertDFSF, convertXFDF, |
| 21 |
convertSISF, convertSIDF, convertSIXF, convertSUSF, convertSUDF, |
| 22 |
convertSUXF, convertDISF, convertDIDF, convertDIXF, convertDUSF, |
| 23 |
convertDUDF, convertDUXF, convertSFSI, convertDFSI, convertXFSI, |
| 24 |
convertSFSU, convertDFSU, convertXFSU, convertSFDI, convertDFDI, |
| 25 |
convertXFDI, convertSFDU, convertDFDU, convertXFDU, convertPSI, |
| 26 |
convertSIP, convertSIT, convertDIT, convertSFT, convertDFT, convertXFT, |
| 27 |
convertPT, zxloadBI, sxloadBI, sstoreBI, addSI, addDI, addSF, addDF, |
| 28 |
addXF, addPSI, subSI, subDI, subSF, subDF, subXF, subPP, mulSI, mulDI, |
| 29 |
mulSU, mulDU, mulSF, mulDF, mulXF, divSI, divDI, divSU, divDU, divSF, |
| 30 |
divDF, divXF, modSI, modDI, modSU, modDU, andSI, andDI, iorSI, iorDI, |
| 31 |
xorSI, xorDI, lshiftSI, lshiftSU, lshiftDI, lshiftDU, rshiftSI, rshiftSU, |
| 32 |
rshiftDI, rshiftDU, ltSI, ltSU, ltDI, ltDU, ltSF, ltDF, ltXF, ltP, leSI, |
| 33 |
leSU, leDI, leDU, leSF, leDF, leXF, leP, geSI, geSU, geDI, geDU, geSF, |
| 34 |
geDF, geXF, geP, gtSI, gtSU, gtDI, gtDU, gtSF, gtDF, gtXF, gtP, eqSI, |
| 35 |
eqDI, eqSF, eqDF, eqXF, eqP, neSI, neDI, neSF, neDF, neXF, neP, negSI, |
| 36 |
negDI, negSF, negDF, negXF, notSI, notDI, notT, predecQI, predecHI, |
| 37 |
predecSI, predecDI, predecP, predecSF, predecDF, predecXF, predecBI, |
| 38 |
preincQI, preincHI, preincSI, preincDI, preincP, preincSF, preincDF, |
| 39 |
preincXF, preincBI, postdecQI, postdecHI, postdecSI, postdecDI, postdecP, |
| 40 |
postdecSF, postdecDF, postdecXF, postdecBI, postincQI, postincHI, |
| 41 |
postincSI, postincDI, postincP, postincSF, postincDF, postincXF, |
| 42 |
postincBI, xjumpif, xjumpifnot, jump, jumpP, caseSI, caseSU, caseDI, |
| 43 |
caseDU, call, returnP, ret, linenote, LAST_AND_UNUSED_OPCODE |
| 44 |
}; |
| 45 |
struct binary_operator |
| 46 |
{ |
| 47 |
enum bytecode_opcode opcode; |
| 48 |
enum typecode arg0; |
| 49 |
}; |
| 50 |
static struct conversion_recipe |
| 51 |
{ |
| 52 |
unsigned char *opcodes; |
| 53 |
int cost; |
| 54 |
} |
| 55 |
conversion_recipe[((int) LAST_AND_UNUSED_TYPECODE)][((int) |
| 56 |
LAST_AND_UNUSED_TYPECODE)]; |
| 57 |
static struct conversion_recipe |
| 58 |
deduce_conversion (from, to) |
| 59 |
enum typecode from, to; |
| 60 |
{ |
| 61 |
(conversion_recipe[(int) from][(int) to]. |
| 62 |
opcodes ? 0 : (conversion_recipe[(int) from][(int) to] = |
| 63 |
deduce_conversion (from, to), 0)); |
| 64 |
} |
| 65 |
|
| 66 |
void |
| 67 |
bc_expand_binary_operation (optab, resulttype, arg0, arg1) |
| 68 |
int resulttype, arg0, arg1; |
| 69 |
struct binary_operator optab[]; |
| 70 |
{ |
| 71 |
int i, besti, cost, bestcost; |
| 72 |
enum typecode resultcode, arg0code; |
| 73 |
for (i = 0; optab[i].opcode != -1; ++i) |
| 74 |
{ |
| 75 |
(conversion_recipe[(int) arg0code][(int) optab[i].arg0]. |
| 76 |
opcodes ? 0 : (conversion_recipe[(int) arg0code][(int) optab[i].arg0] = |
| 77 |
deduce_conversion (arg0code, optab[i].arg0), 0)); |
| 78 |
} |
| 79 |
} |