2 * Z80 translation (templates for various register related operations)
4 * Copyright (c) 2007-2009 Stuart Brady <stuart.brady@gmail.com>
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Library General Public
8 * License as published by the Free Software Foundation; either
9 * version 2 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Library General Public License for more details.
16 * You should have received a copy of the GNU Library General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA
23 static inline void glue(gen_movw_v_
,REGPAIR
)(TCGv v
)
25 TCGv tmp1
= tcg_temp_new();
27 tcg_gen_ld8u_tl(tmp1
, cpu_env
,
28 offsetof(CPUState
, regs
[glue(R_
,REGHIGH
)]) +
29 BYTE_OFFSET(cpu_env
->regs
[], 0));
30 tcg_gen_shli_tl(tmp1
, tmp1
, 8);
31 tcg_gen_ld8u_tl(v
, cpu_env
,
32 offsetof(CPUState
, regs
[glue(R_
,REGLOW
)]) +
33 BYTE_OFFSET(cpu_env
->regs
[], 0));
34 tcg_gen_or_tl(v
, tmp1
, v
);
39 static inline void glue(gen_movb_v_
,REGHIGH
)(TCGv v
)
41 tcg_gen_ld8u_tl(v
, cpu_env
,
42 offsetof(CPUState
, regs
[glue(R_
,REGHIGH
)]) +
43 BYTE_OFFSET(cpu_env
->regs
[], 0));
46 static inline void glue(gen_movb_v_
,REGLOW
)(TCGv v
)
48 tcg_gen_ld8u_tl(v
, cpu_env
,
49 offsetof(CPUState
, regs
[glue(R_
,REGLOW
)]) +
50 BYTE_OFFSET(cpu_env
->regs
[], 0));
55 static inline void glue(glue(gen_movw_
,REGPAIR
),_v
)(TCGv v
)
57 TCGv tmp1
= tcg_temp_new();
59 tcg_gen_shri_tl(tmp1
, v
, 8);
60 tcg_gen_st8_tl(tmp1
, cpu_env
,
61 offsetof(CPUState
, regs
[glue(R_
,REGHIGH
)]) +
62 BYTE_OFFSET(cpu_env
->regs
[], 0));
63 tcg_gen_ext8u_tl(tmp1
, v
);
64 tcg_gen_st8_tl(tmp1
, cpu_env
,
65 offsetof(CPUState
, regs
[glue(R_
,REGLOW
)]) +
66 BYTE_OFFSET(cpu_env
->regs
[], 0));
71 static inline void glue(glue(gen_movb_
,REGHIGH
),_v
)(TCGv v
)
73 tcg_gen_st8_tl(v
, cpu_env
,
74 offsetof(CPUState
, regs
[glue(R_
,REGHIGH
)]) +
75 BYTE_OFFSET(cpu_env
->regs
[], 0));
78 static inline void glue(glue(gen_movb_
,REGLOW
),_v
)(TCGv v
)
80 tcg_gen_st8_tl(v
, cpu_env
,
81 offsetof(CPUState
, regs
[glue(R_
,REGLOW
)]) +
82 BYTE_OFFSET(cpu_env
->regs
[], 0));