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)
419 if (FLAG_SET(PSR_CARRY))
423 #ifdef TARGET_SPARC64
424 if ((T0 & 0xffffffff) <= (src1 & 0xffffffff))
425 env->psr |= PSR_CARRY;
428 env->xcc |= PSR_CARRY;
431 env->psr |= PSR_CARRY;
438 #ifdef TARGET_SPARC64
439 if ((T0 & 0xffffffff) < (src1 & 0xffffffff))
440 env->psr |= PSR_CARRY;
443 env->xcc |= PSR_CARRY;
446 env->psr |= PSR_CARRY;
449 #ifdef TARGET_SPARC64
450 if (!(T0 & 0xffffffff))
451 env->psr |= PSR_ZERO;
452 if ((int32_t) T0 < 0)
454 if ((((src1 & 0xffffffff) ^ (T1 & 0xffffffff) ^ -1) &
455 ((src1 & 0xffffffff) ^ (T0 & 0xffffffff))) & (1 << 31))
459 env->xcc |= PSR_ZERO;
460 if ((int64_t) T0 < 0)
462 if (((src1 ^ T1 ^ -1) & (src1 ^ T0)) & (1ULL << 63))
466 env->psr |= PSR_ZERO;
467 if ((int32_t) T0 < 0)
469 if (((src1 ^ T1 ^ -1) & (src1 ^ T0)) & (1 << 31))
475 void OPPROTO op_tadd_T1_T0_cc(void)
482 #ifdef TARGET_SPARC64
483 if (!(T0 & 0xffffffff))
484 env->psr |= PSR_ZERO;
485 if ((int32_t) T0 < 0)
487 if ((T0 & 0xffffffff) < (src1 & 0xffffffff))
488 env->psr |= PSR_CARRY;
489 if ((((src1 & 0xffffffff) ^ (T1 & 0xffffffff) ^ -1) &
490 ((src1 & 0xffffffff) ^ (T0 & 0xffffffff))) & (1 << 31))
492 if ((src1 & 0x03) || (T1 & 0x03))
497 env->xcc |= PSR_ZERO;
498 if ((int64_t) T0 < 0)
501 env->xcc |= PSR_CARRY;
502 if (((src1 ^ T1 ^ -1) & (src1 ^ T0)) & (1ULL << 63))
506 env->psr |= PSR_ZERO;
507 if ((int32_t) T0 < 0)
510 env->psr |= PSR_CARRY;
511 if (((src1 ^ T1 ^ -1) & (src1 ^ T0)) & (1 << 31))
513 if ((src1 & 0x03) || (T1 & 0x03))
519 void OPPROTO op_tadd_T1_T0_ccTV(void)
523 if ((T0 & 0x03) || (T1 & 0x03))
524 raise_exception(TT_TOVF);
529 #ifdef TARGET_SPARC64
530 if ((((src1 & 0xffffffff) ^ (T1 & 0xffffffff) ^ -1) &
531 ((src1 & 0xffffffff) ^ (T0 & 0xffffffff))) & (1 << 31))
532 raise_exception(TT_TOVF);
534 if ((src1 & 0x03) || (T1 & 0x03))
535 raise_exception(TT_TOVF);
539 #ifdef TARGET_SPARC64
540 if (!(T0 & 0xffffffff))
541 env->psr |= PSR_ZERO;
542 if ((int32_t) T0 < 0)
544 if ((T0 & 0xffffffff) < (src1 & 0xffffffff))
545 env->psr |= PSR_CARRY;
549 env->xcc |= PSR_ZERO;
550 if ((int64_t) T0 < 0)
553 env->xcc |= PSR_CARRY;
556 env->psr |= PSR_ZERO;
557 if ((int32_t) T0 < 0)
560 env->psr |= PSR_CARRY;
565 void OPPROTO op_sub_T1_T0(void)
570 void OPPROTO op_sub_T1_T0_cc(void)
577 #ifdef TARGET_SPARC64
578 if (!(T0 & 0xffffffff))
579 env->psr |= PSR_ZERO;
580 if ((int32_t) T0 < 0)
582 if ((src1 & 0xffffffff) < (T1 & 0xffffffff))
583 env->psr |= PSR_CARRY;
584 if ((((src1 & 0xffffffff) ^ (T1 & 0xffffffff)) &
585 ((src1 & 0xffffffff) ^ (T0 & 0xffffffff))) & (1 << 31))
590 env->xcc |= PSR_ZERO;
591 if ((int64_t) T0 < 0)
594 env->xcc |= PSR_CARRY;
595 if (((src1 ^ T1) & (src1 ^ T0)) & (1ULL << 63))
599 env->psr |= PSR_ZERO;
600 if ((int32_t) T0 < 0)
603 env->psr |= PSR_CARRY;
604 if (((src1 ^ T1) & (src1 ^ T0)) & (1 << 31))
610 void OPPROTO op_subx_T1_T0(void)
612 T0 -= T1 + FLAG_SET(PSR_CARRY);
615 void OPPROTO op_subx_T1_T0_cc(void)
619 if (FLAG_SET(PSR_CARRY))
623 #ifdef TARGET_SPARC64
624 if ((src1 & 0xffffffff) <= (T1 & 0xffffffff))
625 env->psr |= PSR_CARRY;
628 env->xcc |= PSR_CARRY;
631 env->psr |= PSR_CARRY;
638 #ifdef TARGET_SPARC64
639 if ((src1 & 0xffffffff) < (T1 & 0xffffffff))
640 env->psr |= PSR_CARRY;
643 env->xcc |= PSR_CARRY;
646 env->psr |= PSR_CARRY;
649 #ifdef TARGET_SPARC64
650 if (!(T0 & 0xffffffff))
651 env->psr |= PSR_ZERO;
652 if ((int32_t) T0 < 0)
654 if ((((src1 & 0xffffffff) ^ (T1 & 0xffffffff)) &
655 ((src1 & 0xffffffff) ^ (T0 & 0xffffffff))) & (1 << 31))
659 env->xcc |= PSR_ZERO;
660 if ((int64_t) T0 < 0)
662 if (((src1 ^ T1) & (src1 ^ T0)) & (1ULL << 63))
666 env->psr |= PSR_ZERO;
667 if ((int32_t) T0 < 0)
669 if (((src1 ^ T1) & (src1 ^ T0)) & (1 << 31))
675 void OPPROTO op_tsub_T1_T0_cc(void)
682 #ifdef TARGET_SPARC64
683 if (!(T0 & 0xffffffff))
684 env->psr |= PSR_ZERO;
685 if ((int32_t) T0 < 0)
687 if ((src1 & 0xffffffff) < (T1 & 0xffffffff))
688 env->psr |= PSR_CARRY;
689 if ((((src1 & 0xffffffff) ^ (T1 & 0xffffffff)) &
690 ((src1 & 0xffffffff) ^ (T0 & 0xffffffff))) & (1 << 31))
692 if ((src1 & 0x03) || (T1 & 0x03))
697 env->xcc |= PSR_ZERO;
698 if ((int64_t) T0 < 0)
701 env->xcc |= PSR_CARRY;
702 if (((src1 ^ T1) & (src1 ^ T0)) & (1ULL << 63))
706 env->psr |= PSR_ZERO;
707 if ((int32_t) T0 < 0)
710 env->psr |= PSR_CARRY;
711 if (((src1 ^ T1) & (src1 ^ T0)) & (1 << 31))
713 if ((src1 & 0x03) || (T1 & 0x03))
719 void OPPROTO op_tsub_T1_T0_ccTV(void)
723 if ((T0 & 0x03) || (T1 & 0x03))
724 raise_exception(TT_TOVF);
729 #ifdef TARGET_SPARC64
730 if ((((src1 & 0xffffffff) ^ (T1 & 0xffffffff)) &
731 ((src1 & 0xffffffff) ^ (T0 & 0xffffffff))) & (1 << 31))
732 raise_exception(TT_TOVF);
734 if (((src1 ^ T1) & (src1 ^ T0)) & (1 << 31))
735 raise_exception(TT_TOVF);
739 #ifdef TARGET_SPARC64
740 if (!(T0 & 0xffffffff))
741 env->psr |= PSR_ZERO;
742 if ((int32_t) T0 < 0)
744 if ((src1 & 0xffffffff) < (T1 & 0xffffffff))
745 env->psr |= PSR_CARRY;
749 env->xcc |= PSR_ZERO;
750 if ((int64_t) T0 < 0)
753 env->xcc |= PSR_CARRY;
756 env->psr |= PSR_ZERO;
757 if ((int32_t) T0 < 0)
760 env->psr |= PSR_CARRY;
765 void OPPROTO op_and_T1_T0(void)
770 void OPPROTO op_or_T1_T0(void)
775 void OPPROTO op_xor_T1_T0(void)
780 void OPPROTO op_andn_T1_T0(void)
785 void OPPROTO op_orn_T1_T0(void)
790 void OPPROTO op_xnor_T1_T0(void)
795 void OPPROTO op_umul_T1_T0(void)
798 res = (uint64_t) T0 * (uint64_t) T1;
799 #ifdef TARGET_SPARC64
802 T0 = res & 0xffffffff;
807 void OPPROTO op_smul_T1_T0(void)
810 res = (int64_t) ((int32_t) T0) * (int64_t) ((int32_t) T1);
811 #ifdef TARGET_SPARC64
814 T0 = res & 0xffffffff;
819 void OPPROTO op_mulscc_T1_T0(void)
821 unsigned int b1, N, V, b2;
824 N = FLAG_SET(PSR_NEG);
825 V = FLAG_SET(PSR_OVF);
828 T0 = (b1 << 31) | (T0 >> 1);
831 /* do addition and update flags */
836 env->psr |= PSR_ZERO;
837 if ((int32_t) T0 < 0)
840 env->psr |= PSR_CARRY;
841 if (((src1 ^ T1 ^ -1) & (src1 ^ T0)) & (1 << 31))
843 env->y = (b2 << 31) | (env->y >> 1);
847 void OPPROTO op_udiv_T1_T0(void)
852 x0 = T0 | ((uint64_t) (env->y) << 32);
856 raise_exception(TT_DIV_ZERO);
860 if (x0 > 0xffffffff) {
870 void OPPROTO op_sdiv_T1_T0(void)
875 x0 = T0 | ((int64_t) (env->y) << 32);
879 raise_exception(TT_DIV_ZERO);
883 if ((int32_t) x0 != x0) {
884 T0 = x0 < 0? 0x80000000: 0x7fffffff;
893 void OPPROTO op_div_cc(void)
896 #ifdef TARGET_SPARC64
898 env->psr |= PSR_ZERO;
899 if ((int32_t) T0 < 0)
906 env->xcc |= PSR_ZERO;
907 if ((int64_t) T0 < 0)
911 env->psr |= PSR_ZERO;
912 if ((int32_t) T0 < 0)
920 #ifdef TARGET_SPARC64
921 void OPPROTO op_mulx_T1_T0(void)
927 void OPPROTO op_udivx_T1_T0(void)
930 raise_exception(TT_DIV_ZERO);
936 void OPPROTO op_sdivx_T1_T0(void)
939 raise_exception(TT_DIV_ZERO);
941 if (T0 == INT64_MIN && T1 == -1)
944 T0 /= (target_long) T1;
949 void OPPROTO op_logic_T0_cc(void)
952 #ifdef TARGET_SPARC64
953 if (!(T0 & 0xffffffff))
954 env->psr |= PSR_ZERO;
955 if ((int32_t) T0 < 0)
960 env->xcc |= PSR_ZERO;
961 if ((int64_t) T0 < 0)
965 env->psr |= PSR_ZERO;
966 if ((int32_t) T0 < 0)
972 void OPPROTO op_sll(void)
977 #ifdef TARGET_SPARC64
978 void OPPROTO op_sllx(void)
983 void OPPROTO op_srl(void)
985 T0 = (T0 & 0xffffffff) >> (T1 & 0x1f);
988 void OPPROTO op_srlx(void)
993 void OPPROTO op_sra(void)
995 T0 = ((int32_t) (T0 & 0xffffffff)) >> (T1 & 0x1f);
998 void OPPROTO op_srax(void)
1000 T0 = ((int64_t) T0) >> (T1 & 0x3f);
1003 void OPPROTO op_srl(void)
1008 void OPPROTO op_sra(void)
1010 T0 = ((int32_t) T0) >> (T1 & 0x1f);
1014 /* Load and store */
1015 #define MEMSUFFIX _raw
1017 #if !defined(CONFIG_USER_ONLY)
1018 #define MEMSUFFIX _user
1021 #define MEMSUFFIX _kernel
1025 void OPPROTO op_ldfsr(void)
1027 PUT_FSR32(env, *((uint32_t *) &FT0));
1031 void OPPROTO op_stfsr(void)
1033 *((uint32_t *) &FT0) = GET_FSR32(env);
1036 #ifndef TARGET_SPARC64
1037 void OPPROTO op_rdpsr(void)
1042 void OPPROTO op_wrpsr(void)
1048 void OPPROTO op_wrwim(void)
1053 env->wim = T0 & ((1 << NWINDOWS) - 1);
1057 void OPPROTO op_rett(void)
1063 /* XXX: use another pointer for %iN registers to avoid slow wrapping
1065 void OPPROTO op_save(void)
1068 cwp = (env->cwp - 1) & (NWINDOWS - 1);
1069 if (env->wim & (1 << cwp)) {
1070 raise_exception(TT_WIN_OVF);
1076 void OPPROTO op_restore(void)
1079 cwp = (env->cwp + 1) & (NWINDOWS - 1);
1080 if (env->wim & (1 << cwp)) {
1081 raise_exception(TT_WIN_UNF);
1087 void OPPROTO op_rdccr(void)
1092 void OPPROTO op_wrccr(void)
1097 void OPPROTO op_rdtick(void)
1099 T0 = do_tick_get_count(env->tick);
1102 void OPPROTO op_wrtick(void)
1104 do_tick_set_count(env->tick, T0);
1107 void OPPROTO op_wrtick_cmpr(void)
1109 do_tick_set_limit(env->tick, T0);
1112 void OPPROTO op_rdstick(void)
1114 T0 = do_tick_get_count(env->stick);
1117 void OPPROTO op_wrstick(void)
1119 do_tick_set_count(env->stick, T0);
1120 do_tick_set_count(env->hstick, T0);
1123 void OPPROTO op_wrstick_cmpr(void)
1125 do_tick_set_limit(env->stick, T0);
1128 void OPPROTO op_wrhstick_cmpr(void)
1130 do_tick_set_limit(env->hstick, T0);
1133 void OPPROTO op_rdtpc(void)
1135 T0 = env->tpc[env->tl];
1138 void OPPROTO op_wrtpc(void)
1140 env->tpc[env->tl] = T0;
1143 void OPPROTO op_rdtnpc(void)
1145 T0 = env->tnpc[env->tl];
1148 void OPPROTO op_wrtnpc(void)
1150 env->tnpc[env->tl] = T0;
1153 void OPPROTO op_rdtstate(void)
1155 T0 = env->tstate[env->tl];
1158 void OPPROTO op_wrtstate(void)
1160 env->tstate[env->tl] = T0;
1163 void OPPROTO op_rdtt(void)
1165 T0 = env->tt[env->tl];
1168 void OPPROTO op_wrtt(void)
1170 env->tt[env->tl] = T0;
1173 void OPPROTO op_rdpstate(void)
1178 void OPPROTO op_wrpstate(void)
1183 // CWP handling is reversed in V9, but we still use the V8 register
1185 void OPPROTO op_rdcwp(void)
1187 T0 = NWINDOWS - 1 - env->cwp;
1190 void OPPROTO op_wrcwp(void)
1192 env->cwp = NWINDOWS - 1 - T0;
1195 /* XXX: use another pointer for %iN registers to avoid slow wrapping
1197 void OPPROTO op_save(void)
1200 cwp = (env->cwp - 1) & (NWINDOWS - 1);
1201 if (env->cansave == 0) {
1202 raise_exception(TT_SPILL | (env->otherwin != 0 ?
1203 (TT_WOTHER | ((env->wstate & 0x38) >> 1)):
1204 ((env->wstate & 0x7) << 2)));
1206 if (env->cleanwin - env->canrestore == 0) {
1207 // XXX Clean windows without trap
1208 raise_exception(TT_CLRWIN);
1218 void OPPROTO op_restore(void)
1221 cwp = (env->cwp + 1) & (NWINDOWS - 1);
1222 if (env->canrestore == 0) {
1223 raise_exception(TT_FILL | (env->otherwin != 0 ?
1224 (TT_WOTHER | ((env->wstate & 0x38) >> 1)):
1225 ((env->wstate & 0x7) << 2)));
1235 void OPPROTO op_exception(void)
1237 env->exception_index = PARAM1;
1241 void OPPROTO op_trap_T0(void)
1243 env->exception_index = TT_TRAP + (T0 & 0x7f);
1247 void OPPROTO op_trapcc_T0(void)
1250 env->exception_index = TT_TRAP + (T0 & 0x7f);
1256 void OPPROTO op_fpexception_im(void)
1258 env->exception_index = TT_FP_EXCP;
1259 env->fsr &= ~FSR_FTT_MASK;
1265 void OPPROTO op_debug(void)
1270 void OPPROTO op_exit_tb(void)
1275 void OPPROTO op_eval_ba(void)
1280 void OPPROTO op_eval_be(void)
1282 T2 = FLAG_SET(PSR_ZERO);
1285 void OPPROTO op_eval_ble(void)
1287 target_ulong Z = FLAG_SET(PSR_ZERO), N = FLAG_SET(PSR_NEG), V = FLAG_SET(PSR_OVF);
1292 void OPPROTO op_eval_bl(void)
1294 target_ulong N = FLAG_SET(PSR_NEG), V = FLAG_SET(PSR_OVF);
1299 void OPPROTO op_eval_bleu(void)
1301 target_ulong Z = FLAG_SET(PSR_ZERO), C = FLAG_SET(PSR_CARRY);
1306 void OPPROTO op_eval_bcs(void)
1308 T2 = FLAG_SET(PSR_CARRY);
1311 void OPPROTO op_eval_bvs(void)
1313 T2 = FLAG_SET(PSR_OVF);
1316 void OPPROTO op_eval_bn(void)
1321 void OPPROTO op_eval_bneg(void)
1323 T2 = FLAG_SET(PSR_NEG);
1326 void OPPROTO op_eval_bne(void)
1328 T2 = !FLAG_SET(PSR_ZERO);
1331 void OPPROTO op_eval_bg(void)
1333 target_ulong Z = FLAG_SET(PSR_ZERO), N = FLAG_SET(PSR_NEG), V = FLAG_SET(PSR_OVF);
1335 T2 = !(Z | (N ^ V));
1338 void OPPROTO op_eval_bge(void)
1340 target_ulong N = FLAG_SET(PSR_NEG), V = FLAG_SET(PSR_OVF);
1345 void OPPROTO op_eval_bgu(void)
1347 target_ulong Z = FLAG_SET(PSR_ZERO), C = FLAG_SET(PSR_CARRY);
1352 void OPPROTO op_eval_bcc(void)
1354 T2 = !FLAG_SET(PSR_CARRY);
1357 void OPPROTO op_eval_bpos(void)
1359 T2 = !FLAG_SET(PSR_NEG);
1362 void OPPROTO op_eval_bvc(void)
1364 T2 = !FLAG_SET(PSR_OVF);
1367 #ifdef TARGET_SPARC64
1368 void OPPROTO op_eval_xbe(void)
1370 T2 = XFLAG_SET(PSR_ZERO);
1373 void OPPROTO op_eval_xble(void)
1375 target_ulong Z = XFLAG_SET(PSR_ZERO), N = XFLAG_SET(PSR_NEG), V = XFLAG_SET(PSR_OVF);
1380 void OPPROTO op_eval_xbl(void)
1382 target_ulong N = XFLAG_SET(PSR_NEG), V = XFLAG_SET(PSR_OVF);
1387 void OPPROTO op_eval_xbleu(void)
1389 target_ulong Z = XFLAG_SET(PSR_ZERO), C = XFLAG_SET(PSR_CARRY);
1394 void OPPROTO op_eval_xbcs(void)
1396 T2 = XFLAG_SET(PSR_CARRY);
1399 void OPPROTO op_eval_xbvs(void)
1401 T2 = XFLAG_SET(PSR_OVF);
1404 void OPPROTO op_eval_xbneg(void)
1406 T2 = XFLAG_SET(PSR_NEG);
1409 void OPPROTO op_eval_xbne(void)
1411 T2 = !XFLAG_SET(PSR_ZERO);
1414 void OPPROTO op_eval_xbg(void)
1416 target_ulong Z = XFLAG_SET(PSR_ZERO), N = XFLAG_SET(PSR_NEG), V = XFLAG_SET(PSR_OVF);
1418 T2 = !(Z | (N ^ V));
1421 void OPPROTO op_eval_xbge(void)
1423 target_ulong N = XFLAG_SET(PSR_NEG), V = XFLAG_SET(PSR_OVF);
1428 void OPPROTO op_eval_xbgu(void)
1430 target_ulong Z = XFLAG_SET(PSR_ZERO), C = XFLAG_SET(PSR_CARRY);
1435 void OPPROTO op_eval_xbcc(void)
1437 T2 = !XFLAG_SET(PSR_CARRY);
1440 void OPPROTO op_eval_xbpos(void)
1442 T2 = !XFLAG_SET(PSR_NEG);
1445 void OPPROTO op_eval_xbvc(void)
1447 T2 = !XFLAG_SET(PSR_OVF);
1452 #define FFLAG_SET(x) (env->fsr & x? 1: 0)
1453 #include "fbranch_template.h"
1455 #ifdef TARGET_SPARC64
1457 #define FFLAG_SET(x) ((env->fsr & ((uint64_t)x >> 32))? 1: 0)
1458 #include "fbranch_template.h"
1460 #define FFLAG_SET(x) ((env->fsr & ((uint64_t)x >> 34))? 1: 0)
1461 #include "fbranch_template.h"
1463 #define FFLAG_SET(x) ((env->fsr & ((uint64_t)x >> 36))? 1: 0)
1464 #include "fbranch_template.h"
1467 #ifdef TARGET_SPARC64
1468 void OPPROTO op_eval_brz(void)
1473 void OPPROTO op_eval_brnz(void)
1478 void OPPROTO op_eval_brlz(void)
1480 T2 = ((int64_t)T0 < 0);
1483 void OPPROTO op_eval_brlez(void)
1485 T2 = ((int64_t)T0 <= 0);
1488 void OPPROTO op_eval_brgz(void)
1490 T2 = ((int64_t)T0 > 0);
1493 void OPPROTO op_eval_brgez(void)
1495 T2 = ((int64_t)T0 >= 0);
1498 void OPPROTO op_jmp_im64(void)
1503 void OPPROTO op_movq_npc_im64(void)
1509 void OPPROTO op_jmp_im(void)
1511 env->pc = (uint32_t)PARAM1;
1514 void OPPROTO op_movl_npc_im(void)
1516 env->npc = (uint32_t)PARAM1;
1519 void OPPROTO op_movl_npc_T0(void)
1522 raise_exception(TT_UNALIGNED);
1527 void OPPROTO op_mov_pc_npc(void)
1532 void OPPROTO op_next_insn(void)
1535 env->npc = env->npc + 4;
1538 void OPPROTO op_goto_tb0(void)
1540 GOTO_TB(op_goto_tb0, PARAM1, 0);
1543 void OPPROTO op_goto_tb1(void)
1545 GOTO_TB(op_goto_tb1, PARAM1, 1);
1548 void OPPROTO op_jmp_label(void)
1550 GOTO_LABEL_PARAM(1);
1553 void OPPROTO op_jnz_T2_label(void)
1556 GOTO_LABEL_PARAM(1);
1560 void OPPROTO op_jz_T2_label(void)
1563 GOTO_LABEL_PARAM(1);
1567 void OPPROTO op_flush_T0(void)
1572 void OPPROTO op_clear_ieee_excp_and_FTT(void)
1574 env->fsr &= ~(FSR_FTT_MASK | FSR_CEXC_MASK);;
1577 #define F_OP(name, p) void OPPROTO op_f##name##p(void)
1579 #define F_BINOP(name) \
1582 set_float_exception_flags(0, &env->fp_status); \
1583 FT0 = float32_ ## name (FT0, FT1, &env->fp_status); \
1584 check_ieee_exceptions(); \
1588 set_float_exception_flags(0, &env->fp_status); \
1589 DT0 = float64_ ## name (DT0, DT1, &env->fp_status); \
1590 check_ieee_exceptions(); \
1599 void OPPROTO op_fsmuld(void)
1601 set_float_exception_flags(0, &env->fp_status);
1602 DT0 = float64_mul(float32_to_float64(FT0, &env->fp_status),
1603 float32_to_float64(FT1, &env->fp_status),
1605 check_ieee_exceptions();
1608 #define F_HELPER(name) \
1622 FT0 = float32_chs(FT1);
1633 #ifdef TARGET_SPARC64
1636 DT0 = float64_chs(DT1);
1644 void OPPROTO op_fcmps_fcc1(void)
1649 void OPPROTO op_fcmpd_fcc1(void)
1654 void OPPROTO op_fcmps_fcc2(void)
1659 void OPPROTO op_fcmpd_fcc2(void)
1664 void OPPROTO op_fcmps_fcc3(void)
1669 void OPPROTO op_fcmpd_fcc3(void)
1674 void OPPROTO op_fcmpes_fcc1(void)
1679 void OPPROTO op_fcmped_fcc1(void)
1684 void OPPROTO op_fcmpes_fcc2(void)
1689 void OPPROTO op_fcmped_fcc2(void)
1694 void OPPROTO op_fcmpes_fcc3(void)
1699 void OPPROTO op_fcmped_fcc3(void)
1706 /* Integer to float conversion. */
1707 #ifdef USE_INT_TO_FLOAT_HELPERS
1712 set_float_exception_flags(0, &env->fp_status);
1713 FT0 = int32_to_float32(*((int32_t *)&FT1), &env->fp_status);
1714 check_ieee_exceptions();
1719 set_float_exception_flags(0, &env->fp_status);
1720 DT0 = int32_to_float64(*((int32_t *)&FT1), &env->fp_status);
1721 check_ieee_exceptions();
1724 #ifdef TARGET_SPARC64
1727 set_float_exception_flags(0, &env->fp_status);
1728 FT0 = int64_to_float32(*((int64_t *)&DT1), &env->fp_status);
1729 check_ieee_exceptions();
1734 set_float_exception_flags(0, &env->fp_status);
1735 DT0 = int64_to_float64(*((int64_t *)&DT1), &env->fp_status);
1736 check_ieee_exceptions();
1742 /* floating point conversion */
1743 void OPPROTO op_fdtos(void)
1745 set_float_exception_flags(0, &env->fp_status);
1746 FT0 = float64_to_float32(DT1, &env->fp_status);
1747 check_ieee_exceptions();
1750 void OPPROTO op_fstod(void)
1752 set_float_exception_flags(0, &env->fp_status);
1753 DT0 = float32_to_float64(FT1, &env->fp_status);
1754 check_ieee_exceptions();
1757 /* Float to integer conversion. */
1758 void OPPROTO op_fstoi(void)
1760 set_float_exception_flags(0, &env->fp_status);
1761 *((int32_t *)&FT0) = float32_to_int32_round_to_zero(FT1, &env->fp_status);
1762 check_ieee_exceptions();
1765 void OPPROTO op_fdtoi(void)
1767 set_float_exception_flags(0, &env->fp_status);
1768 *((int32_t *)&FT0) = float64_to_int32_round_to_zero(DT1, &env->fp_status);
1769 check_ieee_exceptions();
1772 #ifdef TARGET_SPARC64
1773 void OPPROTO op_fstox(void)
1775 set_float_exception_flags(0, &env->fp_status);
1776 *((int64_t *)&DT0) = float32_to_int64_round_to_zero(FT1, &env->fp_status);
1777 check_ieee_exceptions();
1780 void OPPROTO op_fdtox(void)
1782 set_float_exception_flags(0, &env->fp_status);
1783 *((int64_t *)&DT0) = float64_to_int64_round_to_zero(DT1, &env->fp_status);
1784 check_ieee_exceptions();
1787 void OPPROTO op_fmovs_cc(void)
1793 void OPPROTO op_fmovd_cc(void)
1799 void OPPROTO op_mov_cc(void)
1805 void OPPROTO op_flushw(void)
1807 if (env->cansave != NWINDOWS - 2) {
1808 raise_exception(TT_SPILL | (env->otherwin != 0 ?
1809 (TT_WOTHER | ((env->wstate & 0x38) >> 1)):
1810 ((env->wstate & 0x7) << 2)));
1814 void OPPROTO op_saved(void)
1817 if (env->otherwin == 0)
1824 void OPPROTO op_restored(void)
1827 if (env->cleanwin < NWINDOWS - 1)
1829 if (env->otherwin == 0)
1836 void OPPROTO op_popc(void)
1841 void OPPROTO op_done(void)
1846 void OPPROTO op_retry(void)
1851 void OPPROTO op_sir(void)
1856 void OPPROTO op_ld_asi_reg()
1859 helper_ld_asi(env->asi, PARAM2, PARAM3);
1862 void OPPROTO op_st_asi_reg()
1865 helper_st_asi(env->asi, PARAM2, PARAM3);
1869 void OPPROTO op_ld_asi()
1871 helper_ld_asi(PARAM1, PARAM2, PARAM3);
1874 void OPPROTO op_st_asi()
1876 helper_st_asi(PARAM1, PARAM2, PARAM3);
1879 #ifdef TARGET_SPARC64
1880 // This function uses non-native bit order
1881 #define GET_FIELD(X, FROM, TO) \
1882 ((X) >> (63 - (TO)) & ((1ULL << ((TO) - (FROM) + 1)) - 1))
1884 // This function uses the order in the manuals, i.e. bit 0 is 2^0
1885 #define GET_FIELD_SP(X, FROM, TO) \
1886 GET_FIELD(X, 63 - (TO), 63 - (FROM))
1888 void OPPROTO op_array8()
1890 T0 = (GET_FIELD_SP(T0, 60, 63) << (17 + 2 * T1)) |
1891 (GET_FIELD_SP(T0, 39, 39 + T1 - 1) << (17 + T1)) |
1892 (GET_FIELD_SP(T0, 17 + T1 - 1, 17) << 17) |
1893 (GET_FIELD_SP(T0, 56, 59) << 13) | (GET_FIELD_SP(T0, 35, 38) << 9) |
1894 (GET_FIELD_SP(T0, 13, 16) << 5) | (((T0 >> 55) & 1) << 4) |
1895 (GET_FIELD_SP(T0, 33, 34) << 2) | GET_FIELD_SP(T0, 11, 12);
1898 void OPPROTO op_array16()
1900 T0 = ((GET_FIELD_SP(T0, 60, 63) << (17 + 2 * T1)) |
1901 (GET_FIELD_SP(T0, 39, 39 + T1 - 1) << (17 + T1)) |
1902 (GET_FIELD_SP(T0, 17 + T1 - 1, 17) << 17) |
1903 (GET_FIELD_SP(T0, 56, 59) << 13) | (GET_FIELD_SP(T0, 35, 38) << 9) |
1904 (GET_FIELD_SP(T0, 13, 16) << 5) | (((T0 >> 55) & 1) << 4) |
1905 (GET_FIELD_SP(T0, 33, 34) << 2) | GET_FIELD_SP(T0, 11, 12)) << 1;
1908 void OPPROTO op_array32()
1910 T0 = ((GET_FIELD_SP(T0, 60, 63) << (17 + 2 * T1)) |
1911 (GET_FIELD_SP(T0, 39, 39 + T1 - 1) << (17 + T1)) |
1912 (GET_FIELD_SP(T0, 17 + T1 - 1, 17) << 17) |
1913 (GET_FIELD_SP(T0, 56, 59) << 13) | (GET_FIELD_SP(T0, 35, 38) << 9) |
1914 (GET_FIELD_SP(T0, 13, 16) << 5) | (((T0 >> 55) & 1) << 4) |
1915 (GET_FIELD_SP(T0, 33, 34) << 2) | GET_FIELD_SP(T0, 11, 12)) << 2;
1918 void OPPROTO op_alignaddr()
1924 env->gsr |= tmp & 7ULL;
1928 void OPPROTO op_faligndata()
1932 tmp = (*((uint64_t *)&DT0)) << ((env->gsr & 7) * 8);
1933 tmp |= (*((uint64_t *)&DT1)) >> (64 - (env->gsr & 7) * 8);
1934 *((uint64_t *)&DT0) = tmp;
1937 void OPPROTO op_movl_FT0_0(void)
1939 *((uint32_t *)&FT0) = 0;
1942 void OPPROTO op_movl_DT0_0(void)
1944 *((uint64_t *)&DT0) = 0;
1947 void OPPROTO op_movl_FT0_1(void)
1949 *((uint32_t *)&FT0) = 0xffffffff;
1952 void OPPROTO op_movl_DT0_1(void)
1954 *((uint64_t *)&DT0) = 0xffffffffffffffffULL;
1957 void OPPROTO op_fnot(void)
1959 *(uint64_t *)&DT0 = ~*(uint64_t *)&DT1;
1962 void OPPROTO op_fnots(void)
1964 *(uint32_t *)&FT0 = ~*(uint32_t *)&FT1;
1967 void OPPROTO op_fnor(void)
1969 *(uint64_t *)&DT0 = ~(*(uint64_t *)&DT0 | *(uint64_t *)&DT1);
1972 void OPPROTO op_fnors(void)
1974 *(uint32_t *)&FT0 = ~(*(uint32_t *)&FT0 | *(uint32_t *)&FT1);
1977 void OPPROTO op_for(void)
1979 *(uint64_t *)&DT0 |= *(uint64_t *)&DT1;
1982 void OPPROTO op_fors(void)
1984 *(uint32_t *)&FT0 |= *(uint32_t *)&FT1;
1987 void OPPROTO op_fxor(void)
1989 *(uint64_t *)&DT0 ^= *(uint64_t *)&DT1;
1992 void OPPROTO op_fxors(void)
1994 *(uint32_t *)&FT0 ^= *(uint32_t *)&FT1;
1997 void OPPROTO op_fand(void)
1999 *(uint64_t *)&DT0 &= *(uint64_t *)&DT1;
2002 void OPPROTO op_fands(void)
2004 *(uint32_t *)&FT0 &= *(uint32_t *)&FT1;
2007 void OPPROTO op_fornot(void)
2009 *(uint64_t *)&DT0 = *(uint64_t *)&DT0 | ~*(uint64_t *)&DT1;
2012 void OPPROTO op_fornots(void)
2014 *(uint32_t *)&FT0 = *(uint32_t *)&FT0 | ~*(uint32_t *)&FT1;
2017 void OPPROTO op_fandnot(void)
2019 *(uint64_t *)&DT0 = *(uint64_t *)&DT0 & ~*(uint64_t *)&DT1;
2022 void OPPROTO op_fandnots(void)
2024 *(uint32_t *)&FT0 = *(uint32_t *)&FT0 & ~*(uint32_t *)&FT1;
2027 void OPPROTO op_fnand(void)
2029 *(uint64_t *)&DT0 = ~(*(uint64_t *)&DT0 & *(uint64_t *)&DT1);
2032 void OPPROTO op_fnands(void)
2034 *(uint32_t *)&FT0 = ~(*(uint32_t *)&FT0 & *(uint32_t *)&FT1);
2037 void OPPROTO op_fxnor(void)
2039 *(uint64_t *)&DT0 ^= ~*(uint64_t *)&DT1;
2042 void OPPROTO op_fxnors(void)
2044 *(uint32_t *)&FT0 ^= ~*(uint32_t *)&FT1;
2047 #ifdef WORDS_BIGENDIAN
2048 #define VIS_B64(n) b[7 - (n)]
2049 #define VIS_W64(n) w[3 - (n)]
2050 #define VIS_SW64(n) sw[3 - (n)]
2051 #define VIS_L64(n) l[1 - (n)]
2052 #define VIS_B32(n) b[3 - (n)]
2053 #define VIS_W32(n) w[1 - (n)]
2055 #define VIS_B64(n) b[n]
2056 #define VIS_W64(n) w[n]
2057 #define VIS_SW64(n) sw[n]
2058 #define VIS_L64(n) l[n]
2059 #define VIS_B32(n) b[n]
2060 #define VIS_W32(n) w[n]
2078 void OPPROTO op_fpmerge(void)
2085 // Reverse calculation order to handle overlap
2086 d.VIS_B64(7) = s.VIS_B64(3);
2087 d.VIS_B64(6) = d.VIS_B64(3);
2088 d.VIS_B64(5) = s.VIS_B64(2);
2089 d.VIS_B64(4) = d.VIS_B64(2);
2090 d.VIS_B64(3) = s.VIS_B64(1);
2091 d.VIS_B64(2) = d.VIS_B64(1);
2092 d.VIS_B64(1) = s.VIS_B64(0);
2093 //d.VIS_B64(0) = d.VIS_B64(0);
2098 void OPPROTO op_fmul8x16(void)
2107 tmp = (int32_t)d.VIS_SW64(r) * (int32_t)s.VIS_B64(r); \
2108 if ((tmp & 0xff) > 0x7f) \
2110 d.VIS_W64(r) = tmp >> 8;
2121 void OPPROTO op_fmul8x16al(void)
2130 tmp = (int32_t)d.VIS_SW64(1) * (int32_t)s.VIS_B64(r); \
2131 if ((tmp & 0xff) > 0x7f) \
2133 d.VIS_W64(r) = tmp >> 8;
2144 void OPPROTO op_fmul8x16au(void)
2153 tmp = (int32_t)d.VIS_SW64(0) * (int32_t)s.VIS_B64(r); \
2154 if ((tmp & 0xff) > 0x7f) \
2156 d.VIS_W64(r) = tmp >> 8;
2167 void OPPROTO op_fmul8sux16(void)
2176 tmp = (int32_t)d.VIS_SW64(r) * ((int32_t)s.VIS_SW64(r) >> 8); \
2177 if ((tmp & 0xff) > 0x7f) \
2179 d.VIS_W64(r) = tmp >> 8;
2190 void OPPROTO op_fmul8ulx16(void)
2199 tmp = (int32_t)d.VIS_SW64(r) * ((uint32_t)s.VIS_B64(r * 2)); \
2200 if ((tmp & 0xff) > 0x7f) \
2202 d.VIS_W64(r) = tmp >> 8;
2213 void OPPROTO op_fmuld8sux16(void)
2222 tmp = (int32_t)d.VIS_SW64(r) * ((int32_t)s.VIS_SW64(r) >> 8); \
2223 if ((tmp & 0xff) > 0x7f) \
2227 // Reverse calculation order to handle overlap
2235 void OPPROTO op_fmuld8ulx16(void)
2244 tmp = (int32_t)d.VIS_SW64(r) * ((uint32_t)s.VIS_B64(r * 2)); \
2245 if ((tmp & 0xff) > 0x7f) \
2249 // Reverse calculation order to handle overlap
2257 void OPPROTO op_fexpand(void)
2262 s.l = (uint32_t)(*(uint64_t *)&DT0 & 0xffffffff);
2264 d.VIS_L64(0) = s.VIS_W32(0) << 4;
2265 d.VIS_L64(1) = s.VIS_W32(1) << 4;
2266 d.VIS_L64(2) = s.VIS_W32(2) << 4;
2267 d.VIS_L64(3) = s.VIS_W32(3) << 4;
2272 #define VIS_OP(name, F) \
2273 void OPPROTO name##16(void) \
2280 d.VIS_W64(0) = F(d.VIS_W64(0), s.VIS_W64(0)); \
2281 d.VIS_W64(1) = F(d.VIS_W64(1), s.VIS_W64(1)); \
2282 d.VIS_W64(2) = F(d.VIS_W64(2), s.VIS_W64(2)); \
2283 d.VIS_W64(3) = F(d.VIS_W64(3), s.VIS_W64(3)); \
2288 void OPPROTO name##16s(void) \
2295 d.VIS_W32(0) = F(d.VIS_W32(0), s.VIS_W32(0)); \
2296 d.VIS_W32(1) = F(d.VIS_W32(1), s.VIS_W32(1)); \
2301 void OPPROTO name##32(void) \
2308 d.VIS_L64(0) = F(d.VIS_L64(0), s.VIS_L64(0)); \
2309 d.VIS_L64(1) = F(d.VIS_L64(1), s.VIS_L64(1)); \
2314 void OPPROTO name##32s(void) \
2321 d.l = F(d.l, s.l); \
2326 #define FADD(a, b) ((a) + (b))
2327 #define FSUB(a, b) ((a) - (b))
2328 VIS_OP(op_fpadd, FADD)
2329 VIS_OP(op_fpsub, FSUB)
2331 #define VIS_CMPOP(name, F) \
2332 void OPPROTO name##16(void) \
2339 d.VIS_W64(0) = F(d.VIS_W64(0), s.VIS_W64(0))? 1: 0; \
2340 d.VIS_W64(0) |= F(d.VIS_W64(1), s.VIS_W64(1))? 2: 0; \
2341 d.VIS_W64(0) |= F(d.VIS_W64(2), s.VIS_W64(2))? 4: 0; \
2342 d.VIS_W64(0) |= F(d.VIS_W64(3), s.VIS_W64(3))? 8: 0; \
2347 void OPPROTO name##32(void) \
2354 d.VIS_L64(0) = F(d.VIS_L64(0), s.VIS_L64(0))? 1: 0; \
2355 d.VIS_L64(0) |= F(d.VIS_L64(1), s.VIS_L64(1))? 2: 0; \
2360 #define FCMPGT(a, b) ((a) > (b))
2361 #define FCMPEQ(a, b) ((a) == (b))
2362 #define FCMPLE(a, b) ((a) <= (b))
2363 #define FCMPNE(a, b) ((a) != (b))
2365 VIS_CMPOP(op_fcmpgt, FCMPGT)
2366 VIS_CMPOP(op_fcmpeq, FCMPEQ)
2367 VIS_CMPOP(op_fcmple, FCMPLE)
2368 VIS_CMPOP(op_fcmpne, FCMPNE)