xref: /openbmc/qemu/target/ppc/translate/fp-ops.c.inc (revision 7f6c3d1a)
1#define _GEN_FLOAT_ACB(name, op, op1, op2, isfloat, set_fprf, type)           \
2GEN_HANDLER(f##name, op1, op2, 0xFF, 0x00000000, type)
3#define GEN_FLOAT_ACB(name, op2, set_fprf, type)                              \
4_GEN_FLOAT_ACB(name, name, 0x3F, op2, 0, set_fprf, type),                     \
5_GEN_FLOAT_ACB(name##s, name, 0x3B, op2, 1, set_fprf, type)
6#define _GEN_FLOAT_AB(name, op, op1, op2, inval, isfloat, set_fprf, type)     \
7GEN_HANDLER(f##name, op1, op2, 0xFF, inval, type)
8#define GEN_FLOAT_AB(name, op2, inval, set_fprf, type)                        \
9_GEN_FLOAT_AB(name, name, 0x3F, op2, inval, 0, set_fprf, type),               \
10_GEN_FLOAT_AB(name##s, name, 0x3B, op2, inval, 1, set_fprf, type)
11#define _GEN_FLOAT_AC(name, op, op1, op2, inval, isfloat, set_fprf, type)     \
12GEN_HANDLER(f##name, op1, op2, 0xFF, inval, type)
13#define GEN_FLOAT_AC(name, op2, inval, set_fprf, type)                        \
14_GEN_FLOAT_AC(name, name, 0x3F, op2, inval, 0, set_fprf, type),               \
15_GEN_FLOAT_AC(name##s, name, 0x3B, op2, inval, 1, set_fprf, type)
16#define GEN_FLOAT_B(name, op2, op3, set_fprf, type)                           \
17GEN_HANDLER(f##name, 0x3F, op2, op3, 0x001F0000, type)
18#define GEN_FLOAT_BS(name, op1, op2, set_fprf, type)                          \
19GEN_HANDLER(f##name, op1, op2, 0xFF, 0x001F07C0, type)
20
21GEN_FLOAT_AB(add, 0x15, 0x000007C0, 1, PPC_FLOAT),
22GEN_FLOAT_AB(div, 0x12, 0x000007C0, 1, PPC_FLOAT),
23GEN_FLOAT_AC(mul, 0x19, 0x0000F800, 1, PPC_FLOAT),
24GEN_FLOAT_BS(re, 0x3F, 0x18, 1, PPC_FLOAT_EXT),
25GEN_FLOAT_BS(res, 0x3B, 0x18, 1, PPC_FLOAT_FRES),
26GEN_FLOAT_BS(rsqrte, 0x3F, 0x1A, 1, PPC_FLOAT_FRSQRTE),
27_GEN_FLOAT_ACB(sel, sel, 0x3F, 0x17, 0, 0, PPC_FLOAT_FSEL),
28GEN_FLOAT_AB(sub, 0x14, 0x000007C0, 1, PPC_FLOAT),
29GEN_FLOAT_ACB(madd, 0x1D, 1, PPC_FLOAT),
30GEN_FLOAT_ACB(msub, 0x1C, 1, PPC_FLOAT),
31GEN_FLOAT_ACB(nmadd, 0x1F, 1, PPC_FLOAT),
32GEN_FLOAT_ACB(nmsub, 0x1E, 1, PPC_FLOAT),
33GEN_HANDLER_E(ftdiv, 0x3F, 0x00, 0x04, 1, PPC_NONE, PPC2_FP_TST_ISA206),
34GEN_HANDLER_E(ftsqrt, 0x3F, 0x00, 0x05, 1, PPC_NONE, PPC2_FP_TST_ISA206),
35GEN_FLOAT_B(ctiw, 0x0E, 0x00, 0, PPC_FLOAT),
36GEN_HANDLER_E(fctiwu, 0x3F, 0x0E, 0x04, 0, PPC_NONE, PPC2_FP_CVT_ISA206),
37GEN_FLOAT_B(ctiwz, 0x0F, 0x00, 0, PPC_FLOAT),
38GEN_HANDLER_E(fctiwuz, 0x3F, 0x0F, 0x04, 0, PPC_NONE, PPC2_FP_CVT_ISA206),
39GEN_FLOAT_B(rsp, 0x0C, 0x00, 1, PPC_FLOAT),
40GEN_HANDLER_E(fcfid, 0x3F, 0x0E, 0x1A, 0x001F0000, PPC_NONE, PPC2_FP_CVT_S64),
41GEN_HANDLER_E(fcfids, 0x3B, 0x0E, 0x1A, 0, PPC_NONE, PPC2_FP_CVT_ISA206),
42GEN_HANDLER_E(fcfidu, 0x3F, 0x0E, 0x1E, 0, PPC_NONE, PPC2_FP_CVT_ISA206),
43GEN_HANDLER_E(fcfidus, 0x3B, 0x0E, 0x1E, 0, PPC_NONE, PPC2_FP_CVT_ISA206),
44GEN_HANDLER_E(fctid, 0x3F, 0x0E, 0x19, 0x001F0000, PPC_NONE, PPC2_FP_CVT_S64),
45GEN_HANDLER_E(fctidu, 0x3F, 0x0E, 0x1D, 0, PPC_NONE, PPC2_FP_CVT_ISA206),
46GEN_HANDLER_E(fctidz, 0x3F, 0x0F, 0x19, 0x001F0000, PPC_NONE, PPC2_FP_CVT_S64),
47GEN_HANDLER_E(fctiduz, 0x3F, 0x0F, 0x1D, 0, PPC_NONE, PPC2_FP_CVT_ISA206),
48GEN_FLOAT_B(rin, 0x08, 0x0C, 1, PPC_FLOAT_EXT),
49GEN_FLOAT_B(riz, 0x08, 0x0D, 1, PPC_FLOAT_EXT),
50GEN_FLOAT_B(rip, 0x08, 0x0E, 1, PPC_FLOAT_EXT),
51GEN_FLOAT_B(rim, 0x08, 0x0F, 1, PPC_FLOAT_EXT),
52
53#define GEN_LDF(name, ldop, opc, type)                                        \
54GEN_HANDLER(name, opc, 0xFF, 0xFF, 0x00000000, type),
55#define GEN_LDUF(name, ldop, opc, type)                                       \
56GEN_HANDLER(name##u, opc, 0xFF, 0xFF, 0x00000000, type),
57#define GEN_LDUXF(name, ldop, opc, type)                                      \
58GEN_HANDLER(name##ux, 0x1F, 0x17, opc, 0x00000001, type),
59#define GEN_LDXF(name, ldop, opc2, opc3, type)                                \
60GEN_HANDLER(name##x, 0x1F, opc2, opc3, 0x00000001, type),
61#define GEN_LDFS(name, ldop, op, type)                                        \
62GEN_LDF(name, ldop, op | 0x20, type)                                          \
63GEN_LDUF(name, ldop, op | 0x21, type)                                         \
64GEN_LDUXF(name, ldop, op | 0x01, type)                                        \
65GEN_LDXF(name, ldop, 0x17, op | 0x00, type)
66
67GEN_LDFS(lfd, ld64, 0x12, PPC_FLOAT)
68GEN_LDFS(lfs, ld32fs, 0x10, PPC_FLOAT)
69GEN_HANDLER_E(lfdepx, 0x1F, 0x1F, 0x12, 0x00000001, PPC_NONE, PPC2_BOOKE206),
70GEN_HANDLER_E(lfiwax, 0x1f, 0x17, 0x1a, 0x00000001, PPC_NONE, PPC2_ISA205),
71GEN_HANDLER_E(lfiwzx, 0x1f, 0x17, 0x1b, 0x1, PPC_NONE, PPC2_FP_CVT_ISA206),
72GEN_HANDLER_E(lfdpx, 0x1F, 0x17, 0x18, 0x00200001, PPC_NONE, PPC2_ISA205),
73
74#define GEN_STF(name, stop, opc, type)                                        \
75GEN_HANDLER(name, opc, 0xFF, 0xFF, 0x00000000, type),
76#define GEN_STUF(name, stop, opc, type)                                       \
77GEN_HANDLER(name##u, opc, 0xFF, 0xFF, 0x00000000, type),
78#define GEN_STUXF(name, stop, opc, type)                                      \
79GEN_HANDLER(name##ux, 0x1F, 0x17, opc, 0x00000001, type),
80#define GEN_STXF(name, stop, opc2, opc3, type)                                \
81GEN_HANDLER(name##x, 0x1F, opc2, opc3, 0x00000001, type),
82#define GEN_STFS(name, stop, op, type)                                        \
83GEN_STF(name, stop, op | 0x20, type)                                          \
84GEN_STUF(name, stop, op | 0x21, type)                                         \
85GEN_STUXF(name, stop, op | 0x01, type)                                        \
86GEN_STXF(name, stop, 0x17, op | 0x00, type)
87
88GEN_STFS(stfd, st64_i64, 0x16, PPC_FLOAT)
89GEN_STFS(stfs, st32fs, 0x14, PPC_FLOAT)
90GEN_STXF(stfiw, st32fiw, 0x17, 0x1E, PPC_FLOAT_STFIWX)
91GEN_HANDLER_E(stfdepx, 0x1F, 0x1F, 0x16, 0x00000001, PPC_NONE, PPC2_BOOKE206),
92GEN_HANDLER_E(stfdpx, 0x1F, 0x17, 0x1C, 0x00200001, PPC_NONE, PPC2_ISA205),
93
94GEN_HANDLER(frsqrtes, 0x3B, 0x1A, 0xFF, 0x001F07C0, PPC_FLOAT_FRSQRTES),
95GEN_HANDLER(fsqrt, 0x3F, 0x16, 0xFF, 0x001F07C0, PPC_FLOAT_FSQRT),
96GEN_HANDLER(fsqrts, 0x3B, 0x16, 0xFF, 0x001F07C0, PPC_FLOAT_FSQRT),
97GEN_HANDLER(fcmpo, 0x3F, 0x00, 0x01, 0x00600001, PPC_FLOAT),
98GEN_HANDLER(fcmpu, 0x3F, 0x00, 0x00, 0x00600001, PPC_FLOAT),
99GEN_HANDLER(fabs, 0x3F, 0x08, 0x08, 0x001F0000, PPC_FLOAT),
100GEN_HANDLER(fmr, 0x3F, 0x08, 0x02, 0x001F0000, PPC_FLOAT),
101GEN_HANDLER(fnabs, 0x3F, 0x08, 0x04, 0x001F0000, PPC_FLOAT),
102GEN_HANDLER(fneg, 0x3F, 0x08, 0x01, 0x001F0000, PPC_FLOAT),
103GEN_HANDLER_E(fcpsgn, 0x3F, 0x08, 0x00, 0x00000000, PPC_NONE, PPC2_ISA205),
104GEN_HANDLER_E(fmrgew, 0x3F, 0x06, 0x1E, 0x00000001, PPC_NONE, PPC2_VSX207),
105GEN_HANDLER_E(fmrgow, 0x3F, 0x06, 0x1A, 0x00000001, PPC_NONE, PPC2_VSX207),
106GEN_HANDLER(mcrfs, 0x3F, 0x00, 0x02, 0x0063F801, PPC_FLOAT),
107GEN_HANDLER_E_2(mffs, 0x3F, 0x07, 0x12, 0x00, 0x00000000, PPC_FLOAT, PPC_NONE),
108GEN_HANDLER_E_2(mffsce, 0x3F, 0x07, 0x12, 0x01, 0x00000000, PPC_FLOAT,
109    PPC2_ISA300),
110GEN_HANDLER_E_2(mffsl, 0x3F, 0x07, 0x12, 0x18, 0x00000000, PPC_FLOAT,
111    PPC2_ISA300),
112GEN_HANDLER_E_2(mffscrn, 0x3F, 0x07, 0x12, 0x16, 0x00000000, PPC_FLOAT,
113    PPC_NONE),
114GEN_HANDLER_E_2(mffscrni, 0x3F, 0x07, 0x12, 0x17, 0x00000000, PPC_FLOAT,
115    PPC_NONE),
116GEN_HANDLER(mtfsb0, 0x3F, 0x06, 0x02, 0x001FF800, PPC_FLOAT),
117GEN_HANDLER(mtfsb1, 0x3F, 0x06, 0x01, 0x001FF800, PPC_FLOAT),
118GEN_HANDLER(mtfsf, 0x3F, 0x07, 0x16, 0x00000000, PPC_FLOAT),
119GEN_HANDLER(mtfsfi, 0x3F, 0x06, 0x04, 0x006e0800, PPC_FLOAT),
120