]>
git.proxmox.com Git - mirror_qemu.git/blob - target-sparc/op.c
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
271 #define JUMP_TB(opname, tbparam, n, eip) \
273 GOTO_TB(opname, tbparam, n); \
274 T0 = (long)(tbparam) + (n); \
275 env->pc = (eip) & 0xffffffff; \
279 #ifdef WORDS_BIGENDIAN
280 typedef union UREG64
{
281 struct { uint16_t v3
, v2
, v1
, v0
; } w
;
282 struct { uint32_t v1
, v0
; } l
;
286 typedef union UREG64
{
287 struct { uint16_t v0
, v1
, v2
, v3
; } w
;
288 struct { uint32_t v0
, v1
; } l
;
301 void OPPROTO
op_movq_T0_im64(void)
306 void OPPROTO
op_movq_T1_im64(void)
311 #define XFLAG_SET(x) ((env->xcc&x)?1:0)
314 #define EIP (env->pc)
317 #define FLAG_SET(x) ((env->psr&x)?1:0)
319 void OPPROTO
op_movl_T0_0(void)
324 void OPPROTO
op_movl_T0_im(void)
326 T0
= (uint32_t)PARAM1
;
329 void OPPROTO
op_movl_T1_im(void)
331 T1
= (uint32_t)PARAM1
;
334 void OPPROTO
op_movl_T2_im(void)
336 T2
= (uint32_t)PARAM1
;
339 void OPPROTO
op_movl_T0_sim(void)
341 T0
= (int32_t)PARAM1
;
344 void OPPROTO
op_movl_T1_sim(void)
346 T1
= (int32_t)PARAM1
;
349 void OPPROTO
op_movl_T2_sim(void)
351 T2
= (int32_t)PARAM1
;
354 void OPPROTO
op_movl_T0_env(void)
356 T0
= *(uint32_t *)((char *)env
+ PARAM1
);
359 void OPPROTO
op_movl_env_T0(void)
361 *(uint32_t *)((char *)env
+ PARAM1
) = T0
;
364 void OPPROTO
op_movtl_T0_env(void)
366 T0
= *(target_ulong
*)((char *)env
+ PARAM1
);
369 void OPPROTO
op_movtl_env_T0(void)
371 *(target_ulong
*)((char *)env
+ PARAM1
) = T0
;
374 void OPPROTO
op_add_T1_T0(void)
379 void OPPROTO
op_add_T1_T0_cc(void)
386 #ifdef TARGET_SPARC64
387 if (!(T0
& 0xffffffff))
388 env
->psr
|= PSR_ZERO
;
389 if ((int32_t) T0
< 0)
391 if ((T0
& 0xffffffff) < (src1
& 0xffffffff))
392 env
->psr
|= PSR_CARRY
;
393 if ((((src1
& 0xffffffff) ^ (T1
& 0xffffffff) ^ -1) &
394 ((src1
& 0xffffffff) ^ (T0
& 0xffffffff))) & (1 << 31))
399 env
->xcc
|= PSR_ZERO
;
400 if ((int64_t) T0
< 0)
403 env
->xcc
|= PSR_CARRY
;
404 if (((src1
^ T1
^ -1) & (src1
^ T0
)) & (1ULL << 63))
408 env
->psr
|= PSR_ZERO
;
409 if ((int32_t) T0
< 0)
412 env
->psr
|= PSR_CARRY
;
413 if (((src1
^ T1
^ -1) & (src1
^ T0
)) & (1 << 31))
419 void OPPROTO
op_addx_T1_T0(void)
421 T0
+= T1
+ FLAG_SET(PSR_CARRY
);
424 void OPPROTO
op_addx_T1_T0_cc(void)
429 T0
+= T1
+ FLAG_SET(PSR_CARRY
);
431 #ifdef TARGET_SPARC64
432 if (!(T0
& 0xffffffff))
433 env
->psr
|= PSR_ZERO
;
434 if ((int32_t) T0
< 0)
436 if ((T0
& 0xffffffff) < (src1
& 0xffffffff))
437 env
->psr
|= PSR_CARRY
;
438 if ((((src1
& 0xffffffff) ^ (T1
& 0xffffffff) ^ -1) &
439 ((src1
& 0xffffffff) ^ (T0
& 0xffffffff))) & (1 << 31))
444 env
->xcc
|= PSR_ZERO
;
445 if ((int64_t) T0
< 0)
448 env
->xcc
|= PSR_CARRY
;
449 if (((src1
^ T1
^ -1) & (src1
^ T0
)) & (1ULL << 63))
453 env
->psr
|= PSR_ZERO
;
454 if ((int32_t) T0
< 0)
457 env
->psr
|= PSR_CARRY
;
458 if (((src1
^ T1
^ -1) & (src1
^ T0
)) & (1 << 31))
464 void OPPROTO
op_sub_T1_T0(void)
469 void OPPROTO
op_sub_T1_T0_cc(void)
476 #ifdef TARGET_SPARC64
477 if (!(T0
& 0xffffffff))
478 env
->psr
|= PSR_ZERO
;
479 if ((int32_t) T0
< 0)
481 if ((T0
& 0xffffffff) < (src1
& 0xffffffff))
482 env
->psr
|= PSR_CARRY
;
483 if ((((src1
& 0xffffffff) ^ (T1
& 0xffffffff)) &
484 ((src1
& 0xffffffff) ^ (T0
& 0xffffffff))) & (1 << 31))
489 env
->xcc
|= PSR_ZERO
;
490 if ((int64_t) T0
< 0)
493 env
->xcc
|= PSR_CARRY
;
494 if (((src1
^ T1
) & (src1
^ T0
)) & (1ULL << 63))
498 env
->psr
|= PSR_ZERO
;
499 if ((int32_t) T0
< 0)
502 env
->psr
|= PSR_CARRY
;
503 if (((src1
^ T1
) & (src1
^ T0
)) & (1 << 31))
509 void OPPROTO
op_subx_T1_T0(void)
511 T0
-= T1
+ FLAG_SET(PSR_CARRY
);
514 void OPPROTO
op_subx_T1_T0_cc(void)
519 T0
-= T1
+ FLAG_SET(PSR_CARRY
);
521 #ifdef TARGET_SPARC64
522 if (!(T0
& 0xffffffff))
523 env
->psr
|= PSR_ZERO
;
524 if ((int32_t) T0
< 0)
526 if ((T0
& 0xffffffff) < (src1
& 0xffffffff))
527 env
->psr
|= PSR_CARRY
;
528 if ((((src1
& 0xffffffff) ^ (T1
& 0xffffffff)) &
529 ((src1
& 0xffffffff) ^ (T0
& 0xffffffff))) & (1 << 31))
534 env
->xcc
|= PSR_ZERO
;
535 if ((int64_t) T0
< 0)
538 env
->xcc
|= PSR_CARRY
;
539 if (((src1
^ T1
) & (src1
^ T0
)) & (1ULL << 63))
543 env
->psr
|= PSR_ZERO
;
544 if ((int32_t) T0
< 0)
547 env
->psr
|= PSR_CARRY
;
548 if (((src1
^ T1
) & (src1
^ T0
)) & (1 << 31))
554 void OPPROTO
op_and_T1_T0(void)
559 void OPPROTO
op_or_T1_T0(void)
564 void OPPROTO
op_xor_T1_T0(void)
569 void OPPROTO
op_andn_T1_T0(void)
574 void OPPROTO
op_orn_T1_T0(void)
579 void OPPROTO
op_xnor_T1_T0(void)
584 void OPPROTO
op_umul_T1_T0(void)
587 res
= (uint64_t) T0
* (uint64_t) T1
;
588 T0
= res
& 0xffffffff;
592 void OPPROTO
op_smul_T1_T0(void)
595 res
= (int64_t) ((int32_t) T0
) * (int64_t) ((int32_t) T1
);
596 T0
= res
& 0xffffffff;
600 void OPPROTO
op_mulscc_T1_T0(void)
602 unsigned int b1
, N
, V
, b2
;
605 N
= FLAG_SET(PSR_NEG
);
606 V
= FLAG_SET(PSR_OVF
);
609 T0
= (b1
<< 31) | (T0
>> 1);
612 /* do addition and update flags */
617 env
->psr
|= PSR_ZERO
;
618 if ((int32_t) T0
< 0)
621 env
->psr
|= PSR_CARRY
;
622 if (((src1
^ T1
^ -1) & (src1
^ T0
)) & (1 << 31))
624 env
->y
= (b2
<< 31) | (env
->y
>> 1);
628 void OPPROTO
op_udiv_T1_T0(void)
633 x0
= T0
| ((uint64_t) (env
->y
) << 32);
636 if (x0
> 0xffffffff) {
646 void OPPROTO
op_sdiv_T1_T0(void)
651 x0
= T0
| ((int64_t) (env
->y
) << 32);
654 if ((int32_t) x0
!= x0
) {
655 T0
= x0
< 0? 0x80000000: 0x7fffffff;
664 void OPPROTO
op_div_cc(void)
667 #ifdef TARGET_SPARC64
669 env
->psr
|= PSR_ZERO
;
670 if ((int32_t) T0
< 0)
677 env
->xcc
|= PSR_ZERO
;
678 if ((int64_t) T0
< 0)
682 env
->psr
|= PSR_ZERO
;
683 if ((int32_t) T0
< 0)
691 #ifdef TARGET_SPARC64
692 void OPPROTO
op_mulx_T1_T0(void)
698 void OPPROTO
op_udivx_T1_T0(void)
704 void OPPROTO
op_sdivx_T1_T0(void)
706 if (T0
== INT64_MIN
&& T1
== -1)
709 T0
/= (target_long
) T1
;
714 void OPPROTO
op_logic_T0_cc(void)
717 #ifdef TARGET_SPARC64
718 if (!(T0
& 0xffffffff))
719 env
->psr
|= PSR_ZERO
;
720 if ((int32_t) T0
< 0)
725 env
->xcc
|= PSR_ZERO
;
726 if ((int64_t) T0
< 0)
730 env
->psr
|= PSR_ZERO
;
731 if ((int32_t) T0
< 0)
737 void OPPROTO
op_sll(void)
742 #ifdef TARGET_SPARC64
743 void OPPROTO
op_srl(void)
745 T0
= (T0
& 0xffffffff) >> T1
;
748 void OPPROTO
op_srlx(void)
753 void OPPROTO
op_sra(void)
755 T0
= ((int32_t) (T0
& 0xffffffff)) >> T1
;
758 void OPPROTO
op_srax(void)
760 T0
= ((int64_t) T0
) >> T1
;
763 void OPPROTO
op_srl(void)
768 void OPPROTO
op_sra(void)
770 T0
= ((int32_t) T0
) >> T1
;
775 #define MEMSUFFIX _raw
777 #if !defined(CONFIG_USER_ONLY)
778 #define MEMSUFFIX _user
781 #define MEMSUFFIX _kernel
785 void OPPROTO
op_ldfsr(void)
787 PUT_FSR32(env
, *((uint32_t *) &FT0
));
791 void OPPROTO
op_stfsr(void)
793 *((uint32_t *) &FT0
) = GET_FSR32(env
);
796 #ifndef TARGET_SPARC64
797 void OPPROTO
op_rdpsr(void)
802 void OPPROTO
op_wrpsr(void)
808 void OPPROTO
op_rett(void)
814 /* XXX: use another pointer for %iN registers to avoid slow wrapping
816 void OPPROTO
op_save(void)
819 cwp
= (env
->cwp
- 1) & (NWINDOWS
- 1);
820 if (env
->wim
& (1 << cwp
)) {
821 raise_exception(TT_WIN_OVF
);
827 void OPPROTO
op_restore(void)
830 cwp
= (env
->cwp
+ 1) & (NWINDOWS
- 1);
831 if (env
->wim
& (1 << cwp
)) {
832 raise_exception(TT_WIN_UNF
);
838 void OPPROTO
op_rdccr(void)
843 void OPPROTO
op_wrccr(void)
848 void OPPROTO
op_rdtick(void)
850 T0
= 0; // XXX read cycle counter and bit 31
853 void OPPROTO
op_wrtick(void)
855 // XXX write cycle counter and bit 31
858 void OPPROTO
op_rdtpc(void)
860 T0
= env
->tpc
[env
->tl
];
863 void OPPROTO
op_wrtpc(void)
865 env
->tpc
[env
->tl
] = T0
;
868 void OPPROTO
op_rdtnpc(void)
870 T0
= env
->tnpc
[env
->tl
];
873 void OPPROTO
op_wrtnpc(void)
875 env
->tnpc
[env
->tl
] = T0
;
878 void OPPROTO
op_rdtstate(void)
880 T0
= env
->tstate
[env
->tl
];
883 void OPPROTO
op_wrtstate(void)
885 env
->tstate
[env
->tl
] = T0
;
888 void OPPROTO
op_rdtt(void)
890 T0
= env
->tt
[env
->tl
];
893 void OPPROTO
op_wrtt(void)
895 env
->tt
[env
->tl
] = T0
;
898 void OPPROTO
op_rdpstate(void)
903 void OPPROTO
op_wrpstate(void)
905 env
->pstate
= T0
& 0x1f;
908 // CWP handling is reversed in V9, but we still use the V8 register
910 void OPPROTO
op_rdcwp(void)
912 T0
= NWINDOWS
- 1 - env
->cwp
;
915 void OPPROTO
op_wrcwp(void)
917 env
->cwp
= NWINDOWS
- 1 - T0
;
920 /* XXX: use another pointer for %iN registers to avoid slow wrapping
922 void OPPROTO
op_save(void)
925 cwp
= (env
->cwp
- 1) & (NWINDOWS
- 1);
926 if (env
->cansave
== 0) {
927 raise_exception(TT_SPILL
| (env
->otherwin
!= 0 ?
928 (TT_WOTHER
| ((env
->wstate
& 0x38) >> 1)):
929 ((env
->wstate
& 0x7) << 2)));
931 if (env
->cleanwin
- env
->canrestore
== 0) {
932 // XXX Clean windows without trap
933 raise_exception(TT_CLRWIN
);
943 void OPPROTO
op_restore(void)
946 cwp
= (env
->cwp
+ 1) & (NWINDOWS
- 1);
947 if (env
->canrestore
== 0) {
948 raise_exception(TT_FILL
| (env
->otherwin
!= 0 ?
949 (TT_WOTHER
| ((env
->wstate
& 0x38) >> 1)):
950 ((env
->wstate
& 0x7) << 2)));
960 void OPPROTO
op_exception(void)
962 env
->exception_index
= PARAM1
;
966 void OPPROTO
op_trap_T0(void)
968 env
->exception_index
= TT_TRAP
+ (T0
& 0x7f);
972 void OPPROTO
op_trapcc_T0(void)
975 env
->exception_index
= TT_TRAP
+ (T0
& 0x7f);
981 void OPPROTO
op_trap_ifnofpu(void)
984 env
->exception_index
= TT_NFPU_INSN
;
990 void OPPROTO
op_fpexception_im(void)
992 env
->exception_index
= TT_FP_EXCP
;
993 env
->fsr
&= ~FSR_FTT_MASK
;
999 void OPPROTO
op_debug(void)
1004 void OPPROTO
op_exit_tb(void)
1009 void OPPROTO
op_eval_ba(void)
1014 void OPPROTO
op_eval_be(void)
1016 T2
= FLAG_SET(PSR_ZERO
);
1019 void OPPROTO
op_eval_ble(void)
1021 target_ulong Z
= FLAG_SET(PSR_ZERO
), N
= FLAG_SET(PSR_NEG
), V
= FLAG_SET(PSR_OVF
);
1026 void OPPROTO
op_eval_bl(void)
1028 target_ulong N
= FLAG_SET(PSR_NEG
), V
= FLAG_SET(PSR_OVF
);
1033 void OPPROTO
op_eval_bleu(void)
1035 target_ulong Z
= FLAG_SET(PSR_ZERO
), C
= FLAG_SET(PSR_CARRY
);
1040 void OPPROTO
op_eval_bcs(void)
1042 T2
= FLAG_SET(PSR_CARRY
);
1045 void OPPROTO
op_eval_bvs(void)
1047 T2
= FLAG_SET(PSR_OVF
);
1050 void OPPROTO
op_eval_bn(void)
1055 void OPPROTO
op_eval_bneg(void)
1057 T2
= FLAG_SET(PSR_NEG
);
1060 void OPPROTO
op_eval_bne(void)
1062 T2
= !FLAG_SET(PSR_ZERO
);
1065 void OPPROTO
op_eval_bg(void)
1067 target_ulong Z
= FLAG_SET(PSR_ZERO
), N
= FLAG_SET(PSR_NEG
), V
= FLAG_SET(PSR_OVF
);
1069 T2
= !(Z
| (N
^ V
));
1072 void OPPROTO
op_eval_bge(void)
1074 target_ulong N
= FLAG_SET(PSR_NEG
), V
= FLAG_SET(PSR_OVF
);
1079 void OPPROTO
op_eval_bgu(void)
1081 target_ulong Z
= FLAG_SET(PSR_ZERO
), C
= FLAG_SET(PSR_CARRY
);
1086 void OPPROTO
op_eval_bcc(void)
1088 T2
= !FLAG_SET(PSR_CARRY
);
1091 void OPPROTO
op_eval_bpos(void)
1093 T2
= !FLAG_SET(PSR_NEG
);
1096 void OPPROTO
op_eval_bvc(void)
1098 T2
= !FLAG_SET(PSR_OVF
);
1101 #ifdef TARGET_SPARC64
1102 void OPPROTO
op_eval_xbe(void)
1104 T2
= XFLAG_SET(PSR_ZERO
);
1107 void OPPROTO
op_eval_xble(void)
1109 target_ulong Z
= XFLAG_SET(PSR_ZERO
), N
= XFLAG_SET(PSR_NEG
), V
= XFLAG_SET(PSR_OVF
);
1114 void OPPROTO
op_eval_xbl(void)
1116 target_ulong N
= XFLAG_SET(PSR_NEG
), V
= XFLAG_SET(PSR_OVF
);
1121 void OPPROTO
op_eval_xbleu(void)
1123 target_ulong Z
= XFLAG_SET(PSR_ZERO
), C
= XFLAG_SET(PSR_CARRY
);
1128 void OPPROTO
op_eval_xbcs(void)
1130 T2
= XFLAG_SET(PSR_CARRY
);
1133 void OPPROTO
op_eval_xbvs(void)
1135 T2
= XFLAG_SET(PSR_OVF
);
1138 void OPPROTO
op_eval_xbneg(void)
1140 T2
= XFLAG_SET(PSR_NEG
);
1143 void OPPROTO
op_eval_xbne(void)
1145 T2
= !XFLAG_SET(PSR_ZERO
);
1148 void OPPROTO
op_eval_xbg(void)
1150 target_ulong Z
= XFLAG_SET(PSR_ZERO
), N
= XFLAG_SET(PSR_NEG
), V
= XFLAG_SET(PSR_OVF
);
1152 T2
= !(Z
| (N
^ V
));
1155 void OPPROTO
op_eval_xbge(void)
1157 target_ulong N
= XFLAG_SET(PSR_NEG
), V
= XFLAG_SET(PSR_OVF
);
1162 void OPPROTO
op_eval_xbgu(void)
1164 target_ulong Z
= XFLAG_SET(PSR_ZERO
), C
= XFLAG_SET(PSR_CARRY
);
1169 void OPPROTO
op_eval_xbcc(void)
1171 T2
= !XFLAG_SET(PSR_CARRY
);
1174 void OPPROTO
op_eval_xbpos(void)
1176 T2
= !XFLAG_SET(PSR_NEG
);
1179 void OPPROTO
op_eval_xbvc(void)
1181 T2
= !XFLAG_SET(PSR_OVF
);
1186 #define FFLAG_SET(x) (env->fsr & x? 1: 0)
1187 #include "fbranch_template.h"
1189 #ifdef TARGET_SPARC64
1191 #define FFLAG_SET(x) ((env->fsr & ((uint64_t)x >> 32))? 1: 0)
1192 #include "fbranch_template.h"
1194 #define FFLAG_SET(x) ((env->fsr & ((uint64_t)x >> 34))? 1: 0)
1195 #include "fbranch_template.h"
1197 #define FFLAG_SET(x) ((env->fsr & ((uint64_t)x >> 36))? 1: 0)
1198 #include "fbranch_template.h"
1201 #ifdef TARGET_SPARC64
1202 void OPPROTO
op_eval_brz(void)
1207 void OPPROTO
op_eval_brnz(void)
1212 void OPPROTO
op_eval_brlz(void)
1214 T2
= ((int64_t)T0
< 0);
1217 void OPPROTO
op_eval_brlez(void)
1219 T2
= ((int64_t)T0
<= 0);
1222 void OPPROTO
op_eval_brgz(void)
1224 T2
= ((int64_t)T0
> 0);
1227 void OPPROTO
op_eval_brgez(void)
1229 T2
= ((int64_t)T0
>= 0);
1232 void OPPROTO
op_jmp_im64(void)
1237 void OPPROTO
op_movq_npc_im64(void)
1243 void OPPROTO
op_jmp_im(void)
1245 env
->pc
= (uint32_t)PARAM1
;
1248 void OPPROTO
op_movl_npc_im(void)
1250 env
->npc
= (uint32_t)PARAM1
;
1253 void OPPROTO
op_movl_npc_T0(void)
1258 void OPPROTO
op_mov_pc_npc(void)
1263 void OPPROTO
op_next_insn(void)
1266 env
->npc
= env
->npc
+ 4;
1269 void OPPROTO
op_branch(void)
1271 env
->npc
= (uint32_t)PARAM3
; /* XXX: optimize */
1272 JUMP_TB(op_branch
, PARAM1
, 0, PARAM2
);
1275 void OPPROTO
op_branch2(void)
1278 env
->npc
= (uint32_t)PARAM2
+ 4;
1279 JUMP_TB(op_branch2
, PARAM1
, 0, PARAM2
);
1281 env
->npc
= (uint32_t)PARAM3
+ 4;
1282 JUMP_TB(op_branch2
, PARAM1
, 1, PARAM3
);
1287 void OPPROTO
op_branch_a(void)
1290 env
->npc
= (uint32_t)PARAM2
; /* XXX: optimize */
1291 JUMP_TB(op_branch_a
, PARAM1
, 0, PARAM3
);
1293 env
->npc
= (uint32_t)PARAM3
+ 8; /* XXX: optimize */
1294 JUMP_TB(op_branch_a
, PARAM1
, 1, PARAM3
+ 4);
1299 void OPPROTO
op_generic_branch(void)
1302 env
->npc
= (uint32_t)PARAM1
;
1304 env
->npc
= (uint32_t)PARAM2
;
1309 void OPPROTO
op_flush_T0(void)
1314 void OPPROTO
op_fnegs(void)
1319 void OPPROTO
op_fabss(void)
1324 #ifdef TARGET_SPARC64
1325 void OPPROTO
op_fnegd(void)
1330 void OPPROTO
op_fabsd(void)
1336 void OPPROTO
op_fsqrts(void)
1341 void OPPROTO
op_fsqrtd(void)
1346 void OPPROTO
op_fmuls(void)
1351 void OPPROTO
op_fmuld(void)
1356 void OPPROTO
op_fsmuld(void)
1361 void OPPROTO
op_fadds(void)
1366 void OPPROTO
op_faddd(void)
1371 void OPPROTO
op_fsubs(void)
1376 void OPPROTO
op_fsubd(void)
1381 void OPPROTO
op_fdivs(void)
1386 void OPPROTO
op_fdivd(void)
1391 void OPPROTO
op_fcmps(void)
1396 void OPPROTO
op_fcmpd(void)
1401 #ifdef TARGET_SPARC64
1402 void OPPROTO
op_fcmps_fcc1(void)
1407 void OPPROTO
op_fcmpd_fcc1(void)
1412 void OPPROTO
op_fcmps_fcc2(void)
1417 void OPPROTO
op_fcmpd_fcc2(void)
1422 void OPPROTO
op_fcmps_fcc3(void)
1427 void OPPROTO
op_fcmpd_fcc3(void)
1433 #ifdef USE_INT_TO_FLOAT_HELPERS
1434 void OPPROTO
op_fitos(void)
1439 void OPPROTO
op_fitod(void)
1444 void OPPROTO
op_fitos(void)
1446 FT0
= (float) *((int32_t *)&FT1
);
1449 void OPPROTO
op_fitod(void)
1451 DT0
= (double) *((int32_t *)&FT1
);
1454 #ifdef TARGET_SPARC64
1455 void OPPROTO
op_fxtos(void)
1457 FT0
= (float) *((int64_t *)&DT1
);
1460 void OPPROTO
op_fxtod(void)
1462 DT0
= (double) *((int64_t *)&DT1
);
1467 void OPPROTO
op_fdtos(void)
1472 void OPPROTO
op_fstod(void)
1477 void OPPROTO
op_fstoi(void)
1479 *((int32_t *)&FT0
) = (int32_t) FT1
;
1482 void OPPROTO
op_fdtoi(void)
1484 *((int32_t *)&FT0
) = (int32_t) DT1
;
1487 #ifdef TARGET_SPARC64
1488 void OPPROTO
op_fstox(void)
1490 *((int64_t *)&DT0
) = (int64_t) FT1
;
1493 void OPPROTO
op_fdtox(void)
1495 *((int64_t *)&DT0
) = (int64_t) DT1
;
1498 void OPPROTO
op_fmovs_cc(void)
1504 void OPPROTO
op_fmovd_cc(void)
1510 void OPPROTO
op_mov_cc(void)
1516 void OPPROTO
op_flushw(void)
1518 if (env
->cansave
!= NWINDOWS
- 2) {
1519 raise_exception(TT_SPILL
| (env
->otherwin
!= 0 ?
1520 (TT_WOTHER
| ((env
->wstate
& 0x38) >> 1)):
1521 ((env
->wstate
& 0x7) << 2)));
1525 void OPPROTO
op_saved(void)
1528 if (env
->otherwin
== 0)
1532 void OPPROTO
op_restored(void)
1535 if (env
->cleanwin
< NWINDOWS
- 1)
1537 if (env
->otherwin
== 0)
1543 void OPPROTO
op_popc(void)
1548 void OPPROTO
op_done(void)
1550 env
->pc
= env
->tnpc
[env
->tl
];
1551 env
->npc
= env
->tnpc
[env
->tl
] + 4;
1552 env
->pstate
= env
->tstate
[env
->tl
];
1556 void OPPROTO
op_retry(void)
1558 env
->pc
= env
->tpc
[env
->tl
];
1559 env
->npc
= env
->tnpc
[env
->tl
];
1560 env
->pstate
= env
->tstate
[env
->tl
];
1564 void OPPROTO
op_sir(void)
1570 void OPPROTO
op_ld_asi_reg()
1573 helper_ld_asi(env
->asi
, PARAM2
, PARAM3
);
1576 void OPPROTO
op_st_asi_reg()
1579 helper_st_asi(env
->asi
, PARAM2
, PARAM3
);
1583 void OPPROTO
op_ld_asi()
1585 helper_ld_asi(PARAM1
, PARAM2
, PARAM3
);
1588 void OPPROTO
op_st_asi()
1590 helper_st_asi(PARAM1
, PARAM2
, PARAM3
);