1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
|
static inline void gen_vector_op3(TCGOpcode opc, TCGArg arg1, TCGArg arg2,
TCGArg arg3)
{
int pi = tcg_ctx.gen_next_parm_idx;
tcg_emit_op(&tcg_ctx, opc, pi);
*tcg_ctx.vec_opparam_ptr++ = arg1;
*tcg_ctx.vec_opparam_ptr++ = arg2;
*tcg_ctx.vec_opparam_ptr++ = arg3;
}
#define gen_vector_arith(op,etype,size) \
do { \
TCGOpcode _opc = 0; \
TCGArg _rd = offsetof(CPUX86State, xmm_regs[rd]); \
TCGArg _rn = offsetof(CPUX86State, xmm_regs[rn]); \
TCGArg _rm = (rm == -1) ? offsetof(CPUX86State, xmm_t0) : \
offsetof(CPUX86State, xmm_regs[rm]); \
switch(size) { \
case 0: _opc = INDEX_op_##op##_##etype##8_128; break; \
case 1: _opc = INDEX_op_##op##_##etype##16_128; break; \
case 2: _opc = INDEX_op_##op##_##etype##32_128; break; \
case 3: _opc = INDEX_op_##op##_##etype##64_128; break; \
default: \
fprintf(stderr, "%s:%d: tcg fatal error: size=%d\n", \
__FILE__, __LINE__, size); \
exit(0); \
break; \
} \
gen_vector_op3(_opc, _rd, _rn, _rm); \
} while (0)
#define gen_vector_fop(op,size) \
do { \
TCGOpcode _opc = 0; \
TCGArg _rd = offsetof(CPUX86State, xmm_regs[rd]); \
TCGArg _rn = offsetof(CPUX86State, xmm_regs[rn]); \
TCGArg _rm = (rm == -1) ? offsetof(CPUX86State, xmm_t0) : \
offsetof(CPUX86State, xmm_regs[rm]); \
if(size == 0) \
_opc = INDEX_op_##op##_f32_128;\
else \
_opc = INDEX_op_##op##_f64_128;\
gen_vector_op3(_opc, _rd, _rn, _rm); \
} while (0)
#define gen_vector_logical(op) \
do { \
TCGOpcode _opc = INDEX_op_##op##_128; \
TCGArg _rd = offsetof(CPUX86State, xmm_regs[rd]); \
TCGArg _rn = (rn == -1) ? offsetof(CPUX86State, xmm_t0) : \
offsetof(CPUX86State, xmm_regs[rn]); \
TCGArg _rm = (rm == -1) ? offsetof(CPUX86State, xmm_t0) : \
offsetof(CPUX86State, xmm_regs[rm]); \
gen_vector_op3(_opc, _rd, _rn, _rm); \
} while (0)
#define gen_vector_cvt(op,size) \
do { \
TCGOpcode _opc = INDEX_op_##op##_128; \
TCGArg _rd = offsetof(CPUX86State, xmm_regs[rd]); \
TCGArg _rm = (rm == -1) ? offsetof(CPUX86State, xmm_t0) : \
offsetof(CPUX86State, xmm_regs[rm]); \
gen_vector_op3(_opc, _rd, _rm, size); \
} while (0)
|