4 Copyright (C) 2003 Thomas M. Ogrisegg <tom@fnord.at>
6 This library is free software; you can redistribute it and/or
7 modify it under the terms of the GNU Lesser 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 Lesser General Public License for more details.
16 You should have received a copy of the GNU Lesser General Public
17 License along with this library; if not, write to the Free Software
18 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
25 #define REG (env->gregs[0])
26 #include "op_template.h"
28 #define REG (env->gregs[1])
29 #include "op_template.h"
31 #define REG (env->gregs[2])
32 #include "op_template.h"
34 #define REG (env->gregs[3])
35 #include "op_template.h"
37 #define REG (env->gregs[4])
38 #include "op_template.h"
40 #define REG (env->gregs[5])
41 #include "op_template.h"
43 #define REG (env->gregs[6])
44 #include "op_template.h"
46 #define REG (env->gregs[7])
47 #include "op_template.h"
49 #define REG (REGWPTR[16])
50 #include "op_template.h"
52 #define REG (REGWPTR[17])
53 #include "op_template.h"
55 #define REG (REGWPTR[18])
56 #include "op_template.h"
58 #define REG (REGWPTR[19])
59 #include "op_template.h"
61 #define REG (REGWPTR[20])
62 #include "op_template.h"
64 #define REG (REGWPTR[21])
65 #include "op_template.h"
67 #define REG (REGWPTR[22])
68 #include "op_template.h"
70 #define REG (REGWPTR[23])
71 #include "op_template.h"
73 #define REG (REGWPTR[8])
74 #include "op_template.h"
76 #define REG (REGWPTR[9])
77 #include "op_template.h"
79 #define REG (REGWPTR[10])
80 #include "op_template.h"
82 #define REG (REGWPTR[11])
83 #include "op_template.h"
85 #define REG (REGWPTR[12])
86 #include "op_template.h"
88 #define REG (REGWPTR[13])
89 #include "op_template.h"
91 #define REG (REGWPTR[14])
92 #include "op_template.h"
94 #define REG (REGWPTR[15])
95 #include "op_template.h"
97 #define REG (REGWPTR[0])
98 #include "op_template.h"
100 #define REG (REGWPTR[1])
101 #include "op_template.h"
103 #define REG (REGWPTR[2])
104 #include "op_template.h"
106 #define REG (REGWPTR[3])
107 #include "op_template.h"
109 #define REG (REGWPTR[4])
110 #include "op_template.h"
112 #define REG (REGWPTR[5])
113 #include "op_template.h"
115 #define REG (REGWPTR[6])
116 #include "op_template.h"
118 #define REG (REGWPTR[7])
119 #include "op_template.h"
122 #define REG (env->fpr[0])
123 #include "fop_template.h"
125 #define REG (env->fpr[1])
126 #include "fop_template.h"
128 #define REG (env->fpr[2])
129 #include "fop_template.h"
131 #define REG (env->fpr[3])
132 #include "fop_template.h"
134 #define REG (env->fpr[4])
135 #include "fop_template.h"
137 #define REG (env->fpr[5])
138 #include "fop_template.h"
140 #define REG (env->fpr[6])
141 #include "fop_template.h"
143 #define REG (env->fpr[7])
144 #include "fop_template.h"
146 #define REG (env->fpr[8])
147 #include "fop_template.h"
149 #define REG (env->fpr[9])
150 #include "fop_template.h"
152 #define REG (env->fpr[10])
153 #include "fop_template.h"
155 #define REG (env->fpr[11])
156 #include "fop_template.h"
158 #define REG (env->fpr[12])
159 #include "fop_template.h"
161 #define REG (env->fpr[13])
162 #include "fop_template.h"
164 #define REG (env->fpr[14])
165 #include "fop_template.h"
167 #define REG (env->fpr[15])
168 #include "fop_template.h"
170 #define REG (env->fpr[16])
171 #include "fop_template.h"
173 #define REG (env->fpr[17])
174 #include "fop_template.h"
176 #define REG (env->fpr[18])
177 #include "fop_template.h"
179 #define REG (env->fpr[19])
180 #include "fop_template.h"
182 #define REG (env->fpr[20])
183 #include "fop_template.h"
185 #define REG (env->fpr[21])
186 #include "fop_template.h"
188 #define REG (env->fpr[22])
189 #include "fop_template.h"
191 #define REG (env->fpr[23])
192 #include "fop_template.h"
194 #define REG (env->fpr[24])
195 #include "fop_template.h"
197 #define REG (env->fpr[25])
198 #include "fop_template.h"
200 #define REG (env->fpr[26])
201 #include "fop_template.h"
203 #define REG (env->fpr[27])
204 #include "fop_template.h"
206 #define REG (env->fpr[28])
207 #include "fop_template.h"
209 #define REG (env->fpr[29])
210 #include "fop_template.h"
212 #define REG (env->fpr[30])
213 #include "fop_template.h"
215 #define REG (env->fpr[31])
216 #include "fop_template.h"
218 #ifdef TARGET_SPARC64
220 #define REG (env->fpr[32])
221 #include "fop_template.h"
223 #define REG (env->fpr[34])
224 #include "fop_template.h"
226 #define REG (env->fpr[36])
227 #include "fop_template.h"
229 #define REG (env->fpr[38])
230 #include "fop_template.h"
232 #define REG (env->fpr[40])
233 #include "fop_template.h"
235 #define REG (env->fpr[42])
236 #include "fop_template.h"
238 #define REG (env->fpr[44])
239 #include "fop_template.h"
241 #define REG (env->fpr[46])
242 #include "fop_template.h"
244 #define REG (env->fpr[47])
245 #include "fop_template.h"
247 #define REG (env->fpr[50])
248 #include "fop_template.h"
250 #define REG (env->fpr[52])
251 #include "fop_template.h"
253 #define REG (env->fpr[54])
254 #include "fop_template.h"
256 #define REG (env->fpr[56])
257 #include "fop_template.h"
259 #define REG (env->fpr[58])
260 #include "fop_template.h"
262 #define REG (env->fpr[60])
263 #include "fop_template.h"
265 #define REG (env->fpr[62])
266 #include "fop_template.h"
269 #ifdef TARGET_SPARC64
270 #ifdef WORDS_BIGENDIAN
271 typedef union UREG64
{
272 struct { uint16_t v3
, v2
, v1
, v0
; } w
;
273 struct { uint32_t v1
, v0
; } l
;
277 typedef union UREG64
{
278 struct { uint16_t v0
, v1
, v2
, v3
; } w
;
279 struct { uint32_t v0
, v1
; } l
;
292 void OPPROTO
op_movq_T0_im64(void)
297 void OPPROTO
op_movq_T1_im64(void)
302 #define XFLAG_SET(x) ((env->xcc&x)?1:0)
305 #define EIP (env->pc)
308 #define FLAG_SET(x) ((env->psr&x)?1:0)
310 void OPPROTO
op_movl_T0_0(void)
315 void OPPROTO
op_movl_T0_im(void)
317 T0
= (uint32_t)PARAM1
;
320 void OPPROTO
op_movl_T1_im(void)
322 T1
= (uint32_t)PARAM1
;
325 void OPPROTO
op_movl_T2_im(void)
327 T2
= (uint32_t)PARAM1
;
330 void OPPROTO
op_movl_T0_sim(void)
332 T0
= (int32_t)PARAM1
;
335 void OPPROTO
op_movl_T1_sim(void)
337 T1
= (int32_t)PARAM1
;
340 void OPPROTO
op_movl_T2_sim(void)
342 T2
= (int32_t)PARAM1
;
345 void OPPROTO
op_movl_T0_env(void)
347 T0
= *(uint32_t *)((char *)env
+ PARAM1
);
350 void OPPROTO
op_movl_env_T0(void)
352 *(uint32_t *)((char *)env
+ PARAM1
) = T0
;
355 void OPPROTO
op_movtl_T0_env(void)
357 T0
= *(target_ulong
*)((char *)env
+ PARAM1
);
360 void OPPROTO
op_movtl_env_T0(void)
362 *(target_ulong
*)((char *)env
+ PARAM1
) = T0
;
365 void OPPROTO
op_add_T1_T0(void)
370 void OPPROTO
op_add_T1_T0_cc(void)
377 #ifdef TARGET_SPARC64
378 if (!(T0
& 0xffffffff))
379 env
->psr
|= PSR_ZERO
;
380 if ((int32_t) T0
< 0)
382 if ((T0
& 0xffffffff) < (src1
& 0xffffffff))
383 env
->psr
|= PSR_CARRY
;
384 if ((((src1
& 0xffffffff) ^ (T1
& 0xffffffff) ^ -1) &
385 ((src1
& 0xffffffff) ^ (T0
& 0xffffffff))) & (1 << 31))
390 env
->xcc
|= PSR_ZERO
;
391 if ((int64_t) T0
< 0)
394 env
->xcc
|= PSR_CARRY
;
395 if (((src1
^ T1
^ -1) & (src1
^ T0
)) & (1ULL << 63))
399 env
->psr
|= PSR_ZERO
;
400 if ((int32_t) T0
< 0)
403 env
->psr
|= PSR_CARRY
;
404 if (((src1
^ T1
^ -1) & (src1
^ T0
)) & (1 << 31))
410 void OPPROTO
op_addx_T1_T0(void)
412 T0
+= T1
+ FLAG_SET(PSR_CARRY
);
415 void OPPROTO
op_addx_T1_T0_cc(void)
420 T0
+= T1
+ FLAG_SET(PSR_CARRY
);
422 #ifdef TARGET_SPARC64
423 if (!(T0
& 0xffffffff))
424 env
->psr
|= PSR_ZERO
;
425 if ((int32_t) T0
< 0)
427 if ((T0
& 0xffffffff) < (src1
& 0xffffffff))
428 env
->psr
|= PSR_CARRY
;
429 if ((((src1
& 0xffffffff) ^ (T1
& 0xffffffff) ^ -1) &
430 ((src1
& 0xffffffff) ^ (T0
& 0xffffffff))) & (1 << 31))
435 env
->xcc
|= PSR_ZERO
;
436 if ((int64_t) T0
< 0)
439 env
->xcc
|= PSR_CARRY
;
440 if (((src1
^ T1
^ -1) & (src1
^ T0
)) & (1ULL << 63))
444 env
->psr
|= PSR_ZERO
;
445 if ((int32_t) T0
< 0)
448 env
->psr
|= PSR_CARRY
;
449 if (((src1
^ T1
^ -1) & (src1
^ T0
)) & (1 << 31))
455 void OPPROTO
op_sub_T1_T0(void)
460 void OPPROTO
op_sub_T1_T0_cc(void)
467 #ifdef TARGET_SPARC64
468 if (!(T0
& 0xffffffff))
469 env
->psr
|= PSR_ZERO
;
470 if ((int32_t) T0
< 0)
472 if ((src1
& 0xffffffff) < (T1
& 0xffffffff))
473 env
->psr
|= PSR_CARRY
;
474 if ((((src1
& 0xffffffff) ^ (T1
& 0xffffffff)) &
475 ((src1
& 0xffffffff) ^ (T0
& 0xffffffff))) & (1 << 31))
480 env
->xcc
|= PSR_ZERO
;
481 if ((int64_t) T0
< 0)
484 env
->xcc
|= PSR_CARRY
;
485 if (((src1
^ T1
) & (src1
^ T0
)) & (1ULL << 63))
489 env
->psr
|= PSR_ZERO
;
490 if ((int32_t) T0
< 0)
493 env
->psr
|= PSR_CARRY
;
494 if (((src1
^ T1
) & (src1
^ T0
)) & (1 << 31))
500 void OPPROTO
op_subx_T1_T0(void)
502 T0
-= T1
+ FLAG_SET(PSR_CARRY
);
505 void OPPROTO
op_subx_T1_T0_cc(void)
510 T0
-= T1
+ FLAG_SET(PSR_CARRY
);
512 #ifdef TARGET_SPARC64
513 if (!(T0
& 0xffffffff))
514 env
->psr
|= PSR_ZERO
;
515 if ((int32_t) T0
< 0)
517 if ((src1
& 0xffffffff) < (T1
& 0xffffffff))
518 env
->psr
|= PSR_CARRY
;
519 if ((((src1
& 0xffffffff) ^ (T1
& 0xffffffff)) &
520 ((src1
& 0xffffffff) ^ (T0
& 0xffffffff))) & (1 << 31))
525 env
->xcc
|= PSR_ZERO
;
526 if ((int64_t) T0
< 0)
529 env
->xcc
|= PSR_CARRY
;
530 if (((src1
^ T1
) & (src1
^ T0
)) & (1ULL << 63))
534 env
->psr
|= PSR_ZERO
;
535 if ((int32_t) T0
< 0)
538 env
->psr
|= PSR_CARRY
;
539 if (((src1
^ T1
) & (src1
^ T0
)) & (1 << 31))
545 void OPPROTO
op_and_T1_T0(void)
550 void OPPROTO
op_or_T1_T0(void)
555 void OPPROTO
op_xor_T1_T0(void)
560 void OPPROTO
op_andn_T1_T0(void)
565 void OPPROTO
op_orn_T1_T0(void)
570 void OPPROTO
op_xnor_T1_T0(void)
575 void OPPROTO
op_umul_T1_T0(void)
578 res
= (uint64_t) T0
* (uint64_t) T1
;
579 #ifdef TARGET_SPARC64
582 T0
= res
& 0xffffffff;
587 void OPPROTO
op_smul_T1_T0(void)
590 res
= (int64_t) ((int32_t) T0
) * (int64_t) ((int32_t) T1
);
591 #ifdef TARGET_SPARC64
594 T0
= res
& 0xffffffff;
599 void OPPROTO
op_mulscc_T1_T0(void)
601 unsigned int b1
, N
, V
, b2
;
604 N
= FLAG_SET(PSR_NEG
);
605 V
= FLAG_SET(PSR_OVF
);
608 T0
= (b1
<< 31) | (T0
>> 1);
611 /* do addition and update flags */
616 env
->psr
|= PSR_ZERO
;
617 if ((int32_t) T0
< 0)
620 env
->psr
|= PSR_CARRY
;
621 if (((src1
^ T1
^ -1) & (src1
^ T0
)) & (1 << 31))
623 env
->y
= (b2
<< 31) | (env
->y
>> 1);
627 void OPPROTO
op_udiv_T1_T0(void)
632 x0
= T0
| ((uint64_t) (env
->y
) << 32);
635 if (x0
> 0xffffffff) {
645 void OPPROTO
op_sdiv_T1_T0(void)
650 x0
= T0
| ((int64_t) (env
->y
) << 32);
653 if ((int32_t) x0
!= x0
) {
654 T0
= x0
< 0? 0x80000000: 0x7fffffff;
663 void OPPROTO
op_div_cc(void)
666 #ifdef TARGET_SPARC64
668 env
->psr
|= PSR_ZERO
;
669 if ((int32_t) T0
< 0)
676 env
->xcc
|= PSR_ZERO
;
677 if ((int64_t) T0
< 0)
681 env
->psr
|= PSR_ZERO
;
682 if ((int32_t) T0
< 0)
690 #ifdef TARGET_SPARC64
691 void OPPROTO
op_mulx_T1_T0(void)
697 void OPPROTO
op_udivx_T1_T0(void)
703 void OPPROTO
op_sdivx_T1_T0(void)
705 if (T0
== INT64_MIN
&& T1
== -1)
708 T0
/= (target_long
) T1
;
713 void OPPROTO
op_logic_T0_cc(void)
716 #ifdef TARGET_SPARC64
717 if (!(T0
& 0xffffffff))
718 env
->psr
|= PSR_ZERO
;
719 if ((int32_t) T0
< 0)
724 env
->xcc
|= PSR_ZERO
;
725 if ((int64_t) T0
< 0)
729 env
->psr
|= PSR_ZERO
;
730 if ((int32_t) T0
< 0)
736 void OPPROTO
op_sll(void)
741 #ifdef TARGET_SPARC64
742 void OPPROTO
op_srl(void)
744 T0
= (T0
& 0xffffffff) >> T1
;
747 void OPPROTO
op_srlx(void)
752 void OPPROTO
op_sra(void)
754 T0
= ((int32_t) (T0
& 0xffffffff)) >> T1
;
757 void OPPROTO
op_srax(void)
759 T0
= ((int64_t) T0
) >> T1
;
762 void OPPROTO
op_srl(void)
767 void OPPROTO
op_sra(void)
769 T0
= ((int32_t) T0
) >> T1
;
774 #define MEMSUFFIX _raw
776 #if !defined(CONFIG_USER_ONLY)
777 #define MEMSUFFIX _user
780 #define MEMSUFFIX _kernel
784 void OPPROTO
op_ldfsr(void)
786 PUT_FSR32(env
, *((uint32_t *) &FT0
));
790 void OPPROTO
op_stfsr(void)
792 *((uint32_t *) &FT0
) = GET_FSR32(env
);
795 #ifndef TARGET_SPARC64
796 void OPPROTO
op_rdpsr(void)
801 void OPPROTO
op_wrpsr(void)
807 void OPPROTO
op_rett(void)
813 /* XXX: use another pointer for %iN registers to avoid slow wrapping
815 void OPPROTO
op_save(void)
818 cwp
= (env
->cwp
- 1) & (NWINDOWS
- 1);
819 if (env
->wim
& (1 << cwp
)) {
820 raise_exception(TT_WIN_OVF
);
826 void OPPROTO
op_restore(void)
829 cwp
= (env
->cwp
+ 1) & (NWINDOWS
- 1);
830 if (env
->wim
& (1 << cwp
)) {
831 raise_exception(TT_WIN_UNF
);
837 void OPPROTO
op_rdccr(void)
842 void OPPROTO
op_wrccr(void)
847 void OPPROTO
op_rdtick(void)
849 T0
= 0; // XXX read cycle counter and bit 31
852 void OPPROTO
op_wrtick(void)
854 // XXX write cycle counter and bit 31
857 void OPPROTO
op_rdtpc(void)
859 T0
= env
->tpc
[env
->tl
];
862 void OPPROTO
op_wrtpc(void)
864 env
->tpc
[env
->tl
] = T0
;
867 void OPPROTO
op_rdtnpc(void)
869 T0
= env
->tnpc
[env
->tl
];
872 void OPPROTO
op_wrtnpc(void)
874 env
->tnpc
[env
->tl
] = T0
;
877 void OPPROTO
op_rdtstate(void)
879 T0
= env
->tstate
[env
->tl
];
882 void OPPROTO
op_wrtstate(void)
884 env
->tstate
[env
->tl
] = T0
;
887 void OPPROTO
op_rdtt(void)
889 T0
= env
->tt
[env
->tl
];
892 void OPPROTO
op_wrtt(void)
894 env
->tt
[env
->tl
] = T0
;
897 void OPPROTO
op_rdpstate(void)
902 void OPPROTO
op_wrpstate(void)
907 // CWP handling is reversed in V9, but we still use the V8 register
909 void OPPROTO
op_rdcwp(void)
911 T0
= NWINDOWS
- 1 - env
->cwp
;
914 void OPPROTO
op_wrcwp(void)
916 env
->cwp
= NWINDOWS
- 1 - T0
;
919 /* XXX: use another pointer for %iN registers to avoid slow wrapping
921 void OPPROTO
op_save(void)
924 cwp
= (env
->cwp
- 1) & (NWINDOWS
- 1);
925 if (env
->cansave
== 0) {
926 raise_exception(TT_SPILL
| (env
->otherwin
!= 0 ?
927 (TT_WOTHER
| ((env
->wstate
& 0x38) >> 1)):
928 ((env
->wstate
& 0x7) << 2)));
930 if (env
->cleanwin
- env
->canrestore
== 0) {
931 // XXX Clean windows without trap
932 raise_exception(TT_CLRWIN
);
942 void OPPROTO
op_restore(void)
945 cwp
= (env
->cwp
+ 1) & (NWINDOWS
- 1);
946 if (env
->canrestore
== 0) {
947 raise_exception(TT_FILL
| (env
->otherwin
!= 0 ?
948 (TT_WOTHER
| ((env
->wstate
& 0x38) >> 1)):
949 ((env
->wstate
& 0x7) << 2)));
959 void OPPROTO
op_exception(void)
961 env
->exception_index
= PARAM1
;
965 void OPPROTO
op_trap_T0(void)
967 env
->exception_index
= TT_TRAP
+ (T0
& 0x7f);
971 void OPPROTO
op_trapcc_T0(void)
974 env
->exception_index
= TT_TRAP
+ (T0
& 0x7f);
980 void OPPROTO
op_trap_ifnofpu(void)
983 env
->exception_index
= TT_NFPU_INSN
;
989 void OPPROTO
op_fpexception_im(void)
991 env
->exception_index
= TT_FP_EXCP
;
992 env
->fsr
&= ~FSR_FTT_MASK
;
998 void OPPROTO
op_debug(void)
1003 void OPPROTO
op_exit_tb(void)
1008 void OPPROTO
op_eval_ba(void)
1013 void OPPROTO
op_eval_be(void)
1015 T2
= FLAG_SET(PSR_ZERO
);
1018 void OPPROTO
op_eval_ble(void)
1020 target_ulong Z
= FLAG_SET(PSR_ZERO
), N
= FLAG_SET(PSR_NEG
), V
= FLAG_SET(PSR_OVF
);
1025 void OPPROTO
op_eval_bl(void)
1027 target_ulong N
= FLAG_SET(PSR_NEG
), V
= FLAG_SET(PSR_OVF
);
1032 void OPPROTO
op_eval_bleu(void)
1034 target_ulong Z
= FLAG_SET(PSR_ZERO
), C
= FLAG_SET(PSR_CARRY
);
1039 void OPPROTO
op_eval_bcs(void)
1041 T2
= FLAG_SET(PSR_CARRY
);
1044 void OPPROTO
op_eval_bvs(void)
1046 T2
= FLAG_SET(PSR_OVF
);
1049 void OPPROTO
op_eval_bn(void)
1054 void OPPROTO
op_eval_bneg(void)
1056 T2
= FLAG_SET(PSR_NEG
);
1059 void OPPROTO
op_eval_bne(void)
1061 T2
= !FLAG_SET(PSR_ZERO
);
1064 void OPPROTO
op_eval_bg(void)
1066 target_ulong Z
= FLAG_SET(PSR_ZERO
), N
= FLAG_SET(PSR_NEG
), V
= FLAG_SET(PSR_OVF
);
1068 T2
= !(Z
| (N
^ V
));
1071 void OPPROTO
op_eval_bge(void)
1073 target_ulong N
= FLAG_SET(PSR_NEG
), V
= FLAG_SET(PSR_OVF
);
1078 void OPPROTO
op_eval_bgu(void)
1080 target_ulong Z
= FLAG_SET(PSR_ZERO
), C
= FLAG_SET(PSR_CARRY
);
1085 void OPPROTO
op_eval_bcc(void)
1087 T2
= !FLAG_SET(PSR_CARRY
);
1090 void OPPROTO
op_eval_bpos(void)
1092 T2
= !FLAG_SET(PSR_NEG
);
1095 void OPPROTO
op_eval_bvc(void)
1097 T2
= !FLAG_SET(PSR_OVF
);
1100 #ifdef TARGET_SPARC64
1101 void OPPROTO
op_eval_xbe(void)
1103 T2
= XFLAG_SET(PSR_ZERO
);
1106 void OPPROTO
op_eval_xble(void)
1108 target_ulong Z
= XFLAG_SET(PSR_ZERO
), N
= XFLAG_SET(PSR_NEG
), V
= XFLAG_SET(PSR_OVF
);
1113 void OPPROTO
op_eval_xbl(void)
1115 target_ulong N
= XFLAG_SET(PSR_NEG
), V
= XFLAG_SET(PSR_OVF
);
1120 void OPPROTO
op_eval_xbleu(void)
1122 target_ulong Z
= XFLAG_SET(PSR_ZERO
), C
= XFLAG_SET(PSR_CARRY
);
1127 void OPPROTO
op_eval_xbcs(void)
1129 T2
= XFLAG_SET(PSR_CARRY
);
1132 void OPPROTO
op_eval_xbvs(void)
1134 T2
= XFLAG_SET(PSR_OVF
);
1137 void OPPROTO
op_eval_xbneg(void)
1139 T2
= XFLAG_SET(PSR_NEG
);
1142 void OPPROTO
op_eval_xbne(void)
1144 T2
= !XFLAG_SET(PSR_ZERO
);
1147 void OPPROTO
op_eval_xbg(void)
1149 target_ulong Z
= XFLAG_SET(PSR_ZERO
), N
= XFLAG_SET(PSR_NEG
), V
= XFLAG_SET(PSR_OVF
);
1151 T2
= !(Z
| (N
^ V
));
1154 void OPPROTO
op_eval_xbge(void)
1156 target_ulong N
= XFLAG_SET(PSR_NEG
), V
= XFLAG_SET(PSR_OVF
);
1161 void OPPROTO
op_eval_xbgu(void)
1163 target_ulong Z
= XFLAG_SET(PSR_ZERO
), C
= XFLAG_SET(PSR_CARRY
);
1168 void OPPROTO
op_eval_xbcc(void)
1170 T2
= !XFLAG_SET(PSR_CARRY
);
1173 void OPPROTO
op_eval_xbpos(void)
1175 T2
= !XFLAG_SET(PSR_NEG
);
1178 void OPPROTO
op_eval_xbvc(void)
1180 T2
= !XFLAG_SET(PSR_OVF
);
1185 #define FFLAG_SET(x) (env->fsr & x? 1: 0)
1186 #include "fbranch_template.h"
1188 #ifdef TARGET_SPARC64
1190 #define FFLAG_SET(x) ((env->fsr & ((uint64_t)x >> 32))? 1: 0)
1191 #include "fbranch_template.h"
1193 #define FFLAG_SET(x) ((env->fsr & ((uint64_t)x >> 34))? 1: 0)
1194 #include "fbranch_template.h"
1196 #define FFLAG_SET(x) ((env->fsr & ((uint64_t)x >> 36))? 1: 0)
1197 #include "fbranch_template.h"
1200 #ifdef TARGET_SPARC64
1201 void OPPROTO
op_eval_brz(void)
1206 void OPPROTO
op_eval_brnz(void)
1211 void OPPROTO
op_eval_brlz(void)
1213 T2
= ((int64_t)T0
< 0);
1216 void OPPROTO
op_eval_brlez(void)
1218 T2
= ((int64_t)T0
<= 0);
1221 void OPPROTO
op_eval_brgz(void)
1223 T2
= ((int64_t)T0
> 0);
1226 void OPPROTO
op_eval_brgez(void)
1228 T2
= ((int64_t)T0
>= 0);
1231 void OPPROTO
op_jmp_im64(void)
1236 void OPPROTO
op_movq_npc_im64(void)
1242 void OPPROTO
op_jmp_im(void)
1244 env
->pc
= (uint32_t)PARAM1
;
1247 void OPPROTO
op_movl_npc_im(void)
1249 env
->npc
= (uint32_t)PARAM1
;
1252 void OPPROTO
op_movl_npc_T0(void)
1257 void OPPROTO
op_mov_pc_npc(void)
1262 void OPPROTO
op_next_insn(void)
1265 env
->npc
= env
->npc
+ 4;
1268 void OPPROTO
op_goto_tb0(void)
1270 GOTO_TB(op_goto_tb0
, PARAM1
, 0);
1273 void OPPROTO
op_goto_tb1(void)
1275 GOTO_TB(op_goto_tb1
, PARAM1
, 1);
1278 void OPPROTO
op_jmp_label(void)
1280 GOTO_LABEL_PARAM(1);
1283 void OPPROTO
op_jnz_T2_label(void)
1286 GOTO_LABEL_PARAM(1);
1290 void OPPROTO
op_jz_T2_label(void)
1293 GOTO_LABEL_PARAM(1);
1297 void OPPROTO
op_flush_T0(void)
1302 void OPPROTO
op_fnegs(void)
1307 void OPPROTO
op_fabss(void)
1312 #ifdef TARGET_SPARC64
1313 void OPPROTO
op_fnegd(void)
1318 void OPPROTO
op_fabsd(void)
1324 void OPPROTO
op_fsqrts(void)
1329 void OPPROTO
op_fsqrtd(void)
1334 void OPPROTO
op_fmuls(void)
1339 void OPPROTO
op_fmuld(void)
1344 void OPPROTO
op_fsmuld(void)
1349 void OPPROTO
op_fadds(void)
1354 void OPPROTO
op_faddd(void)
1359 void OPPROTO
op_fsubs(void)
1364 void OPPROTO
op_fsubd(void)
1369 void OPPROTO
op_fdivs(void)
1374 void OPPROTO
op_fdivd(void)
1379 void OPPROTO
op_fcmps(void)
1384 void OPPROTO
op_fcmpd(void)
1389 #ifdef TARGET_SPARC64
1390 void OPPROTO
op_fcmps_fcc1(void)
1395 void OPPROTO
op_fcmpd_fcc1(void)
1400 void OPPROTO
op_fcmps_fcc2(void)
1405 void OPPROTO
op_fcmpd_fcc2(void)
1410 void OPPROTO
op_fcmps_fcc3(void)
1415 void OPPROTO
op_fcmpd_fcc3(void)
1421 #ifdef USE_INT_TO_FLOAT_HELPERS
1422 void OPPROTO
op_fitos(void)
1427 void OPPROTO
op_fitod(void)
1432 void OPPROTO
op_fitos(void)
1434 FT0
= (float) *((int32_t *)&FT1
);
1437 void OPPROTO
op_fitod(void)
1439 DT0
= (double) *((int32_t *)&FT1
);
1442 #ifdef TARGET_SPARC64
1443 void OPPROTO
op_fxtos(void)
1445 FT0
= (float) *((int64_t *)&DT1
);
1448 void OPPROTO
op_fxtod(void)
1450 DT0
= (double) *((int64_t *)&DT1
);
1455 void OPPROTO
op_fdtos(void)
1460 void OPPROTO
op_fstod(void)
1465 void OPPROTO
op_fstoi(void)
1467 *((int32_t *)&FT0
) = (int32_t) FT1
;
1470 void OPPROTO
op_fdtoi(void)
1472 *((int32_t *)&FT0
) = (int32_t) DT1
;
1475 #ifdef TARGET_SPARC64
1476 void OPPROTO
op_fstox(void)
1478 *((int64_t *)&DT0
) = (int64_t) FT1
;
1481 void OPPROTO
op_fdtox(void)
1483 *((int64_t *)&DT0
) = (int64_t) DT1
;
1486 void OPPROTO
op_fmovs_cc(void)
1492 void OPPROTO
op_fmovd_cc(void)
1498 void OPPROTO
op_mov_cc(void)
1504 void OPPROTO
op_flushw(void)
1506 if (env
->cansave
!= NWINDOWS
- 2) {
1507 raise_exception(TT_SPILL
| (env
->otherwin
!= 0 ?
1508 (TT_WOTHER
| ((env
->wstate
& 0x38) >> 1)):
1509 ((env
->wstate
& 0x7) << 2)));
1513 void OPPROTO
op_saved(void)
1516 if (env
->otherwin
== 0)
1520 void OPPROTO
op_restored(void)
1523 if (env
->cleanwin
< NWINDOWS
- 1)
1525 if (env
->otherwin
== 0)
1531 void OPPROTO
op_popc(void)
1536 void OPPROTO
op_done(void)
1541 void OPPROTO
op_retry(void)
1546 void OPPROTO
op_sir(void)
1552 void OPPROTO
op_ld_asi_reg()
1555 helper_ld_asi(env
->asi
, PARAM2
, PARAM3
);
1558 void OPPROTO
op_st_asi_reg()
1561 helper_st_asi(env
->asi
, PARAM2
, PARAM3
);
1565 void OPPROTO
op_ld_asi()
1567 helper_ld_asi(PARAM1
, PARAM2
, PARAM3
);
1570 void OPPROTO
op_st_asi()
1572 helper_st_asi(PARAM1
, PARAM2
, PARAM3
);