2 #define SPARC_LD_OP(name, qp) \
3 void OPPROTO glue(glue(op_, name), MEMSUFFIX)(void) \
5 T1 = (target_ulong)glue(qp, MEMSUFFIX)(T0); \
8 #define SPARC_LD_OP_S(name, qp) \
9 void OPPROTO glue(glue(op_, name), MEMSUFFIX)(void) \
11 T1 = (target_long)glue(qp, MEMSUFFIX)(T0); \
14 #define SPARC_ST_OP(name, op) \
15 void OPPROTO glue(glue(op_, name), MEMSUFFIX)(void) \
17 glue(op, MEMSUFFIX)(T0, T1); \
21 SPARC_LD_OP(ldub
, ldub
);
22 SPARC_LD_OP(lduh
, lduw
);
23 SPARC_LD_OP_S(ldsb
, ldsb
);
24 SPARC_LD_OP_S(ldsh
, ldsw
);
26 /*** Integer store ***/
28 SPARC_ST_OP(stb
, stb
);
29 SPARC_ST_OP(sth
, stw
);
31 void OPPROTO
glue(op_std
, MEMSUFFIX
)(void)
33 glue(stl
, MEMSUFFIX
)(T0
, T1
);
34 glue(stl
, MEMSUFFIX
)((T0
+ 4), T2
);
37 void OPPROTO
glue(op_ldstub
, MEMSUFFIX
)(void)
39 T1
= glue(ldub
, MEMSUFFIX
)(T0
);
40 glue(stb
, MEMSUFFIX
)(T0
, 0xff); /* XXX: Should be Atomically */
43 void OPPROTO
glue(op_swap
, MEMSUFFIX
)(void)
45 target_ulong tmp
= glue(ldl
, MEMSUFFIX
)(T0
);
46 glue(stl
, MEMSUFFIX
)(T0
, T1
); /* XXX: Should be Atomically */
50 void OPPROTO
glue(op_ldd
, MEMSUFFIX
)(void)
52 T1
= glue(ldl
, MEMSUFFIX
)(T0
);
53 T0
= glue(ldl
, MEMSUFFIX
)((T0
+ 4));
56 /*** Floating-point store ***/
57 void OPPROTO
glue(op_stf
, MEMSUFFIX
) (void)
59 glue(stfl
, MEMSUFFIX
)(T0
, FT0
);
62 void OPPROTO
glue(op_stdf
, MEMSUFFIX
) (void)
64 glue(stfq
, MEMSUFFIX
)(T0
, DT0
);
67 /*** Floating-point load ***/
68 void OPPROTO
glue(op_ldf
, MEMSUFFIX
) (void)
70 FT0
= glue(ldfl
, MEMSUFFIX
)(T0
);
73 void OPPROTO
glue(op_lddf
, MEMSUFFIX
) (void)
75 DT0
= glue(ldfq
, MEMSUFFIX
)(T0
);
79 /* XXX: Should be Atomically */
80 /* XXX: There are no cas[x] instructions, only cas[x]a */
81 void OPPROTO
glue(op_cas
, MEMSUFFIX
)(void)
85 tmp
= glue(ldl
, MEMSUFFIX
)(T0
);
87 if (tmp
== (T1
& 0xffffffffULL
)) {
88 glue(stl
, MEMSUFFIX
)(T0
, T2
);
93 void OPPROTO
glue(op_casx
, MEMSUFFIX
)(void)
98 tmp
= (uint64_t)glue(ldl
, MEMSUFFIX
)(T0
) << 32;
99 tmp
|= glue(ldl
, MEMSUFFIX
)(T0
);
101 glue(stq
, MEMSUFFIX
)(T0
, T2
);
106 void OPPROTO
glue(op_ldsw
, MEMSUFFIX
)(void)
108 T1
= (int64_t)(glue(ldl
, MEMSUFFIX
)(T0
) & 0xffffffff);
111 SPARC_LD_OP(ldx
, ldq
);
112 SPARC_ST_OP(stx
, stq
);