Statistics
| Branch: | Revision:

root / target-sparc / op_mem.h @ e909ec2f

History | View | Annotate | Download (2.9 kB)

1
#ifdef TARGET_ABI32
2
#define ADDR(x) ((x) & 0xffffffff)
3
#else
4
#define ADDR(x) (x)
5
#endif
6

    
7
/***                             Integer load                              ***/
8
#define SPARC_LD_OP(name, qp)                                                 \
9
void OPPROTO glue(glue(op_, name), MEMSUFFIX)(void)                           \
10
{                                                                             \
11
    T1 = (target_ulong)glue(qp, MEMSUFFIX)(ADDR(T0));                         \
12
}
13

    
14
#define SPARC_LD_OP_S(name, qp)                                         \
15
    void OPPROTO glue(glue(op_, name), MEMSUFFIX)(void)                 \
16
    {                                                                   \
17
        T1 = (target_long)glue(qp, MEMSUFFIX)(ADDR(T0));                      \
18
    }
19

    
20
#define SPARC_ST_OP(name, op)                                                 \
21
void OPPROTO glue(glue(op_, name), MEMSUFFIX)(void)                           \
22
{                                                                             \
23
    glue(op, MEMSUFFIX)(ADDR(T0), T1);                                      \
24
}
25

    
26
SPARC_LD_OP(ld, ldl);
27
SPARC_LD_OP(ldub, ldub);
28
SPARC_LD_OP(lduh, lduw);
29
SPARC_LD_OP_S(ldsb, ldsb);
30
SPARC_LD_OP_S(ldsh, ldsw);
31

    
32
/***                              Integer store                            ***/
33
SPARC_ST_OP(st, stl);
34
SPARC_ST_OP(stb, stb);
35
SPARC_ST_OP(sth, stw);
36

    
37
void OPPROTO glue(op_std, MEMSUFFIX)(void)
38
{
39
    uint64_t tmp = ((uint64_t)T1 << 32) | (uint64_t)(T2 & 0xffffffff);
40

    
41
    glue(stq, MEMSUFFIX)(ADDR(T0), tmp);
42
}
43

    
44
void OPPROTO glue(op_ldstub, MEMSUFFIX)(void)
45
{
46
    T1 = glue(ldub, MEMSUFFIX)(ADDR(T0));
47
    glue(stb, MEMSUFFIX)(ADDR(T0), 0xff);     /* XXX: Should be Atomically */
48
}
49

    
50
void OPPROTO glue(op_swap, MEMSUFFIX)(void)
51
{
52
    target_ulong tmp = glue(ldl, MEMSUFFIX)(ADDR(T0));
53
    glue(stl, MEMSUFFIX)(ADDR(T0), T1);       /* XXX: Should be Atomically */
54
    T1 = tmp;
55
}
56

    
57
void OPPROTO glue(op_ldd, MEMSUFFIX)(void)
58
{
59
    uint64_t tmp;
60

    
61
    tmp = glue(ldq, MEMSUFFIX)(ADDR(T0));
62
    T1 = tmp >> 32;
63
    T0 = tmp & 0xffffffff;
64
}
65

    
66
/***                         Floating-point store                          ***/
67
void OPPROTO glue(op_stf, MEMSUFFIX) (void)
68
{
69
    glue(stfl, MEMSUFFIX)(ADDR(T0), FT0);
70
}
71

    
72
void OPPROTO glue(op_stdf, MEMSUFFIX) (void)
73
{
74
    glue(stfq, MEMSUFFIX)(ADDR(T0), DT0);
75
}
76

    
77
/***                         Floating-point load                           ***/
78
void OPPROTO glue(op_ldf, MEMSUFFIX) (void)
79
{
80
    FT0 = glue(ldfl, MEMSUFFIX)(ADDR(T0));
81
}
82

    
83
void OPPROTO glue(op_lddf, MEMSUFFIX) (void)
84
{
85
    DT0 = glue(ldfq, MEMSUFFIX)(ADDR(T0));
86
}
87

    
88
#ifdef TARGET_SPARC64
89
void OPPROTO glue(op_lduw, MEMSUFFIX)(void)
90
{
91
    T1 = (uint64_t)(glue(ldl, MEMSUFFIX)(ADDR(T0)) & 0xffffffff);
92
}
93

    
94
void OPPROTO glue(op_ldsw, MEMSUFFIX)(void)
95
{
96
    T1 = (int64_t)(glue(ldl, MEMSUFFIX)(ADDR(T0)) & 0xffffffff);
97
}
98

    
99
SPARC_LD_OP(ldx, ldq);
100
SPARC_ST_OP(stx, stq);
101
#endif
102
#undef MEMSUFFIX