xref: /qemu/target/sparc/vis_helper.c (revision 2e2f4ade86e335ea7ffa2b5f32e3ad50619fb4e5)
11bccec25SBlue Swirl /*
21bccec25SBlue Swirl  * VIS op helpers
31bccec25SBlue Swirl  *
41bccec25SBlue Swirl  *  Copyright (c) 2003-2005 Fabrice Bellard
51bccec25SBlue Swirl  *
61bccec25SBlue Swirl  * This library is free software; you can redistribute it and/or
71bccec25SBlue Swirl  * modify it under the terms of the GNU Lesser General Public
81bccec25SBlue Swirl  * License as published by the Free Software Foundation; either
91bccec25SBlue Swirl  * version 2 of the License, or (at your option) any later version.
101bccec25SBlue Swirl  *
111bccec25SBlue Swirl  * This library is distributed in the hope that it will be useful,
121bccec25SBlue Swirl  * but WITHOUT ANY WARRANTY; without even the implied warranty of
131bccec25SBlue Swirl  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
141bccec25SBlue Swirl  * Lesser General Public License for more details.
151bccec25SBlue Swirl  *
161bccec25SBlue Swirl  * You should have received a copy of the GNU Lesser General Public
171bccec25SBlue Swirl  * License along with this library; if not, see <http://www.gnu.org/licenses/>.
181bccec25SBlue Swirl  */
191bccec25SBlue Swirl 
201bccec25SBlue Swirl #include "cpu.h"
211bccec25SBlue Swirl #include "helper.h"
221bccec25SBlue Swirl 
231bccec25SBlue Swirl #define DT0 (env->dt0)
241bccec25SBlue Swirl #define DT1 (env->dt1)
251bccec25SBlue Swirl #define QT0 (env->qt0)
261bccec25SBlue Swirl #define QT1 (env->qt1)
271bccec25SBlue Swirl 
281bccec25SBlue Swirl /* This function uses non-native bit order */
291bccec25SBlue Swirl #define GET_FIELD(X, FROM, TO)                                  \
301bccec25SBlue Swirl     ((X) >> (63 - (TO)) & ((1ULL << ((TO) - (FROM) + 1)) - 1))
311bccec25SBlue Swirl 
321bccec25SBlue Swirl /* This function uses the order in the manuals, i.e. bit 0 is 2^0 */
331bccec25SBlue Swirl #define GET_FIELD_SP(X, FROM, TO)               \
341bccec25SBlue Swirl     GET_FIELD(X, 63 - (TO), 63 - (FROM))
351bccec25SBlue Swirl 
362e2f4adeSBlue Swirl target_ulong helper_array8(CPUState *env, target_ulong pixel_addr,
372e2f4adeSBlue Swirl                            target_ulong cubesize)
381bccec25SBlue Swirl {
391bccec25SBlue Swirl     return (GET_FIELD_SP(pixel_addr, 60, 63) << (17 + 2 * cubesize)) |
401bccec25SBlue Swirl         (GET_FIELD_SP(pixel_addr, 39, 39 + cubesize - 1) << (17 + cubesize)) |
411bccec25SBlue Swirl         (GET_FIELD_SP(pixel_addr, 17 + cubesize - 1, 17) << 17) |
421bccec25SBlue Swirl         (GET_FIELD_SP(pixel_addr, 56, 59) << 13) |
431bccec25SBlue Swirl         (GET_FIELD_SP(pixel_addr, 35, 38) << 9) |
441bccec25SBlue Swirl         (GET_FIELD_SP(pixel_addr, 13, 16) << 5) |
451bccec25SBlue Swirl         (((pixel_addr >> 55) & 1) << 4) |
461bccec25SBlue Swirl         (GET_FIELD_SP(pixel_addr, 33, 34) << 2) |
471bccec25SBlue Swirl         GET_FIELD_SP(pixel_addr, 11, 12);
481bccec25SBlue Swirl }
491bccec25SBlue Swirl 
502e2f4adeSBlue Swirl target_ulong helper_alignaddr(CPUState *env, target_ulong addr,
512e2f4adeSBlue Swirl                               target_ulong offset)
521bccec25SBlue Swirl {
531bccec25SBlue Swirl     uint64_t tmp;
541bccec25SBlue Swirl 
551bccec25SBlue Swirl     tmp = addr + offset;
561bccec25SBlue Swirl     env->gsr &= ~7ULL;
571bccec25SBlue Swirl     env->gsr |= tmp & 7ULL;
581bccec25SBlue Swirl     return tmp & ~7ULL;
591bccec25SBlue Swirl }
601bccec25SBlue Swirl 
612e2f4adeSBlue Swirl void helper_faligndata(CPUState *env)
621bccec25SBlue Swirl {
631bccec25SBlue Swirl     uint64_t tmp;
641bccec25SBlue Swirl 
651bccec25SBlue Swirl     tmp = (*((uint64_t *)&DT0)) << ((env->gsr & 7) * 8);
661bccec25SBlue Swirl     /* on many architectures a shift of 64 does nothing */
671bccec25SBlue Swirl     if ((env->gsr & 7) != 0) {
681bccec25SBlue Swirl         tmp |= (*((uint64_t *)&DT1)) >> (64 - (env->gsr & 7) * 8);
691bccec25SBlue Swirl     }
701bccec25SBlue Swirl     *((uint64_t *)&DT0) = tmp;
711bccec25SBlue Swirl }
721bccec25SBlue Swirl 
731bccec25SBlue Swirl #ifdef HOST_WORDS_BIGENDIAN
741bccec25SBlue Swirl #define VIS_B64(n) b[7 - (n)]
751bccec25SBlue Swirl #define VIS_W64(n) w[3 - (n)]
761bccec25SBlue Swirl #define VIS_SW64(n) sw[3 - (n)]
771bccec25SBlue Swirl #define VIS_L64(n) l[1 - (n)]
781bccec25SBlue Swirl #define VIS_B32(n) b[3 - (n)]
791bccec25SBlue Swirl #define VIS_W32(n) w[1 - (n)]
801bccec25SBlue Swirl #else
811bccec25SBlue Swirl #define VIS_B64(n) b[n]
821bccec25SBlue Swirl #define VIS_W64(n) w[n]
831bccec25SBlue Swirl #define VIS_SW64(n) sw[n]
841bccec25SBlue Swirl #define VIS_L64(n) l[n]
851bccec25SBlue Swirl #define VIS_B32(n) b[n]
861bccec25SBlue Swirl #define VIS_W32(n) w[n]
871bccec25SBlue Swirl #endif
881bccec25SBlue Swirl 
891bccec25SBlue Swirl typedef union {
901bccec25SBlue Swirl     uint8_t b[8];
911bccec25SBlue Swirl     uint16_t w[4];
921bccec25SBlue Swirl     int16_t sw[4];
931bccec25SBlue Swirl     uint32_t l[2];
941bccec25SBlue Swirl     uint64_t ll;
951bccec25SBlue Swirl     float64 d;
961bccec25SBlue Swirl } VIS64;
971bccec25SBlue Swirl 
981bccec25SBlue Swirl typedef union {
991bccec25SBlue Swirl     uint8_t b[4];
1001bccec25SBlue Swirl     uint16_t w[2];
1011bccec25SBlue Swirl     uint32_t l;
1021bccec25SBlue Swirl     float32 f;
1031bccec25SBlue Swirl } VIS32;
1041bccec25SBlue Swirl 
1052e2f4adeSBlue Swirl void helper_fpmerge(CPUState *env)
1061bccec25SBlue Swirl {
1071bccec25SBlue Swirl     VIS64 s, d;
1081bccec25SBlue Swirl 
1091bccec25SBlue Swirl     s.d = DT0;
1101bccec25SBlue Swirl     d.d = DT1;
1111bccec25SBlue Swirl 
1121bccec25SBlue Swirl     /* Reverse calculation order to handle overlap */
1131bccec25SBlue Swirl     d.VIS_B64(7) = s.VIS_B64(3);
1141bccec25SBlue Swirl     d.VIS_B64(6) = d.VIS_B64(3);
1151bccec25SBlue Swirl     d.VIS_B64(5) = s.VIS_B64(2);
1161bccec25SBlue Swirl     d.VIS_B64(4) = d.VIS_B64(2);
1171bccec25SBlue Swirl     d.VIS_B64(3) = s.VIS_B64(1);
1181bccec25SBlue Swirl     d.VIS_B64(2) = d.VIS_B64(1);
1191bccec25SBlue Swirl     d.VIS_B64(1) = s.VIS_B64(0);
1201bccec25SBlue Swirl     /* d.VIS_B64(0) = d.VIS_B64(0); */
1211bccec25SBlue Swirl 
1221bccec25SBlue Swirl     DT0 = d.d;
1231bccec25SBlue Swirl }
1241bccec25SBlue Swirl 
1252e2f4adeSBlue Swirl void helper_fmul8x16(CPUState *env)
1261bccec25SBlue Swirl {
1271bccec25SBlue Swirl     VIS64 s, d;
1281bccec25SBlue Swirl     uint32_t tmp;
1291bccec25SBlue Swirl 
1301bccec25SBlue Swirl     s.d = DT0;
1311bccec25SBlue Swirl     d.d = DT1;
1321bccec25SBlue Swirl 
1331bccec25SBlue Swirl #define PMUL(r)                                                 \
1341bccec25SBlue Swirl     tmp = (int32_t)d.VIS_SW64(r) * (int32_t)s.VIS_B64(r);       \
1351bccec25SBlue Swirl     if ((tmp & 0xff) > 0x7f) {                                  \
1361bccec25SBlue Swirl         tmp += 0x100;                                           \
1371bccec25SBlue Swirl     }                                                           \
1381bccec25SBlue Swirl     d.VIS_W64(r) = tmp >> 8;
1391bccec25SBlue Swirl 
1401bccec25SBlue Swirl     PMUL(0);
1411bccec25SBlue Swirl     PMUL(1);
1421bccec25SBlue Swirl     PMUL(2);
1431bccec25SBlue Swirl     PMUL(3);
1441bccec25SBlue Swirl #undef PMUL
1451bccec25SBlue Swirl 
1461bccec25SBlue Swirl     DT0 = d.d;
1471bccec25SBlue Swirl }
1481bccec25SBlue Swirl 
1492e2f4adeSBlue Swirl void helper_fmul8x16al(CPUState *env)
1501bccec25SBlue Swirl {
1511bccec25SBlue Swirl     VIS64 s, d;
1521bccec25SBlue Swirl     uint32_t tmp;
1531bccec25SBlue Swirl 
1541bccec25SBlue Swirl     s.d = DT0;
1551bccec25SBlue Swirl     d.d = DT1;
1561bccec25SBlue Swirl 
1571bccec25SBlue Swirl #define PMUL(r)                                                 \
1581bccec25SBlue Swirl     tmp = (int32_t)d.VIS_SW64(1) * (int32_t)s.VIS_B64(r);       \
1591bccec25SBlue Swirl     if ((tmp & 0xff) > 0x7f) {                                  \
1601bccec25SBlue Swirl         tmp += 0x100;                                           \
1611bccec25SBlue Swirl     }                                                           \
1621bccec25SBlue Swirl     d.VIS_W64(r) = tmp >> 8;
1631bccec25SBlue Swirl 
1641bccec25SBlue Swirl     PMUL(0);
1651bccec25SBlue Swirl     PMUL(1);
1661bccec25SBlue Swirl     PMUL(2);
1671bccec25SBlue Swirl     PMUL(3);
1681bccec25SBlue Swirl #undef PMUL
1691bccec25SBlue Swirl 
1701bccec25SBlue Swirl     DT0 = d.d;
1711bccec25SBlue Swirl }
1721bccec25SBlue Swirl 
1732e2f4adeSBlue Swirl void helper_fmul8x16au(CPUState *env)
1741bccec25SBlue Swirl {
1751bccec25SBlue Swirl     VIS64 s, d;
1761bccec25SBlue Swirl     uint32_t tmp;
1771bccec25SBlue Swirl 
1781bccec25SBlue Swirl     s.d = DT0;
1791bccec25SBlue Swirl     d.d = DT1;
1801bccec25SBlue Swirl 
1811bccec25SBlue Swirl #define PMUL(r)                                                 \
1821bccec25SBlue Swirl     tmp = (int32_t)d.VIS_SW64(0) * (int32_t)s.VIS_B64(r);       \
1831bccec25SBlue Swirl     if ((tmp & 0xff) > 0x7f) {                                  \
1841bccec25SBlue Swirl         tmp += 0x100;                                           \
1851bccec25SBlue Swirl     }                                                           \
1861bccec25SBlue Swirl     d.VIS_W64(r) = tmp >> 8;
1871bccec25SBlue Swirl 
1881bccec25SBlue Swirl     PMUL(0);
1891bccec25SBlue Swirl     PMUL(1);
1901bccec25SBlue Swirl     PMUL(2);
1911bccec25SBlue Swirl     PMUL(3);
1921bccec25SBlue Swirl #undef PMUL
1931bccec25SBlue Swirl 
1941bccec25SBlue Swirl     DT0 = d.d;
1951bccec25SBlue Swirl }
1961bccec25SBlue Swirl 
1972e2f4adeSBlue Swirl void helper_fmul8sux16(CPUState *env)
1981bccec25SBlue Swirl {
1991bccec25SBlue Swirl     VIS64 s, d;
2001bccec25SBlue Swirl     uint32_t tmp;
2011bccec25SBlue Swirl 
2021bccec25SBlue Swirl     s.d = DT0;
2031bccec25SBlue Swirl     d.d = DT1;
2041bccec25SBlue Swirl 
2051bccec25SBlue Swirl #define PMUL(r)                                                         \
2061bccec25SBlue Swirl     tmp = (int32_t)d.VIS_SW64(r) * ((int32_t)s.VIS_SW64(r) >> 8);       \
2071bccec25SBlue Swirl     if ((tmp & 0xff) > 0x7f) {                                          \
2081bccec25SBlue Swirl         tmp += 0x100;                                                   \
2091bccec25SBlue Swirl     }                                                                   \
2101bccec25SBlue Swirl     d.VIS_W64(r) = tmp >> 8;
2111bccec25SBlue Swirl 
2121bccec25SBlue Swirl     PMUL(0);
2131bccec25SBlue Swirl     PMUL(1);
2141bccec25SBlue Swirl     PMUL(2);
2151bccec25SBlue Swirl     PMUL(3);
2161bccec25SBlue Swirl #undef PMUL
2171bccec25SBlue Swirl 
2181bccec25SBlue Swirl     DT0 = d.d;
2191bccec25SBlue Swirl }
2201bccec25SBlue Swirl 
2212e2f4adeSBlue Swirl void helper_fmul8ulx16(CPUState *env)
2221bccec25SBlue Swirl {
2231bccec25SBlue Swirl     VIS64 s, d;
2241bccec25SBlue Swirl     uint32_t tmp;
2251bccec25SBlue Swirl 
2261bccec25SBlue Swirl     s.d = DT0;
2271bccec25SBlue Swirl     d.d = DT1;
2281bccec25SBlue Swirl 
2291bccec25SBlue Swirl #define PMUL(r)                                                         \
2301bccec25SBlue Swirl     tmp = (int32_t)d.VIS_SW64(r) * ((uint32_t)s.VIS_B64(r * 2));        \
2311bccec25SBlue Swirl     if ((tmp & 0xff) > 0x7f) {                                          \
2321bccec25SBlue Swirl         tmp += 0x100;                                                   \
2331bccec25SBlue Swirl     }                                                                   \
2341bccec25SBlue Swirl     d.VIS_W64(r) = tmp >> 8;
2351bccec25SBlue Swirl 
2361bccec25SBlue Swirl     PMUL(0);
2371bccec25SBlue Swirl     PMUL(1);
2381bccec25SBlue Swirl     PMUL(2);
2391bccec25SBlue Swirl     PMUL(3);
2401bccec25SBlue Swirl #undef PMUL
2411bccec25SBlue Swirl 
2421bccec25SBlue Swirl     DT0 = d.d;
2431bccec25SBlue Swirl }
2441bccec25SBlue Swirl 
2452e2f4adeSBlue Swirl void helper_fmuld8sux16(CPUState *env)
2461bccec25SBlue Swirl {
2471bccec25SBlue Swirl     VIS64 s, d;
2481bccec25SBlue Swirl     uint32_t tmp;
2491bccec25SBlue Swirl 
2501bccec25SBlue Swirl     s.d = DT0;
2511bccec25SBlue Swirl     d.d = DT1;
2521bccec25SBlue Swirl 
2531bccec25SBlue Swirl #define PMUL(r)                                                         \
2541bccec25SBlue Swirl     tmp = (int32_t)d.VIS_SW64(r) * ((int32_t)s.VIS_SW64(r) >> 8);       \
2551bccec25SBlue Swirl     if ((tmp & 0xff) > 0x7f) {                                          \
2561bccec25SBlue Swirl         tmp += 0x100;                                                   \
2571bccec25SBlue Swirl     }                                                                   \
2581bccec25SBlue Swirl     d.VIS_L64(r) = tmp;
2591bccec25SBlue Swirl 
2601bccec25SBlue Swirl     /* Reverse calculation order to handle overlap */
2611bccec25SBlue Swirl     PMUL(1);
2621bccec25SBlue Swirl     PMUL(0);
2631bccec25SBlue Swirl #undef PMUL
2641bccec25SBlue Swirl 
2651bccec25SBlue Swirl     DT0 = d.d;
2661bccec25SBlue Swirl }
2671bccec25SBlue Swirl 
2682e2f4adeSBlue Swirl void helper_fmuld8ulx16(CPUState *env)
2691bccec25SBlue Swirl {
2701bccec25SBlue Swirl     VIS64 s, d;
2711bccec25SBlue Swirl     uint32_t tmp;
2721bccec25SBlue Swirl 
2731bccec25SBlue Swirl     s.d = DT0;
2741bccec25SBlue Swirl     d.d = DT1;
2751bccec25SBlue Swirl 
2761bccec25SBlue Swirl #define PMUL(r)                                                         \
2771bccec25SBlue Swirl     tmp = (int32_t)d.VIS_SW64(r) * ((uint32_t)s.VIS_B64(r * 2));        \
2781bccec25SBlue Swirl     if ((tmp & 0xff) > 0x7f) {                                          \
2791bccec25SBlue Swirl         tmp += 0x100;                                                   \
2801bccec25SBlue Swirl     }                                                                   \
2811bccec25SBlue Swirl     d.VIS_L64(r) = tmp;
2821bccec25SBlue Swirl 
2831bccec25SBlue Swirl     /* Reverse calculation order to handle overlap */
2841bccec25SBlue Swirl     PMUL(1);
2851bccec25SBlue Swirl     PMUL(0);
2861bccec25SBlue Swirl #undef PMUL
2871bccec25SBlue Swirl 
2881bccec25SBlue Swirl     DT0 = d.d;
2891bccec25SBlue Swirl }
2901bccec25SBlue Swirl 
2912e2f4adeSBlue Swirl void helper_fexpand(CPUState *env)
2921bccec25SBlue Swirl {
2931bccec25SBlue Swirl     VIS32 s;
2941bccec25SBlue Swirl     VIS64 d;
2951bccec25SBlue Swirl 
2961bccec25SBlue Swirl     s.l = (uint32_t)(*(uint64_t *)&DT0 & 0xffffffff);
2971bccec25SBlue Swirl     d.d = DT1;
2981bccec25SBlue Swirl     d.VIS_W64(0) = s.VIS_B32(0) << 4;
2991bccec25SBlue Swirl     d.VIS_W64(1) = s.VIS_B32(1) << 4;
3001bccec25SBlue Swirl     d.VIS_W64(2) = s.VIS_B32(2) << 4;
3011bccec25SBlue Swirl     d.VIS_W64(3) = s.VIS_B32(3) << 4;
3021bccec25SBlue Swirl 
3031bccec25SBlue Swirl     DT0 = d.d;
3041bccec25SBlue Swirl }
3051bccec25SBlue Swirl 
3061bccec25SBlue Swirl #define VIS_HELPER(name, F)                             \
3072e2f4adeSBlue Swirl     void name##16(CPUState *env)                        \
3081bccec25SBlue Swirl     {                                                   \
3091bccec25SBlue Swirl         VIS64 s, d;                                     \
3101bccec25SBlue Swirl                                                         \
3111bccec25SBlue Swirl         s.d = DT0;                                      \
3121bccec25SBlue Swirl         d.d = DT1;                                      \
3131bccec25SBlue Swirl                                                         \
3141bccec25SBlue Swirl         d.VIS_W64(0) = F(d.VIS_W64(0), s.VIS_W64(0));   \
3151bccec25SBlue Swirl         d.VIS_W64(1) = F(d.VIS_W64(1), s.VIS_W64(1));   \
3161bccec25SBlue Swirl         d.VIS_W64(2) = F(d.VIS_W64(2), s.VIS_W64(2));   \
3171bccec25SBlue Swirl         d.VIS_W64(3) = F(d.VIS_W64(3), s.VIS_W64(3));   \
3181bccec25SBlue Swirl                                                         \
3191bccec25SBlue Swirl         DT0 = d.d;                                      \
3201bccec25SBlue Swirl     }                                                   \
3211bccec25SBlue Swirl                                                         \
3222e2f4adeSBlue Swirl     uint32_t name##16s(CPUState *env, uint32_t src1,    \
3232e2f4adeSBlue Swirl                        uint32_t src2)                   \
3241bccec25SBlue Swirl     {                                                   \
3251bccec25SBlue Swirl         VIS32 s, d;                                     \
3261bccec25SBlue Swirl                                                         \
3271bccec25SBlue Swirl         s.l = src1;                                     \
3281bccec25SBlue Swirl         d.l = src2;                                     \
3291bccec25SBlue Swirl                                                         \
3301bccec25SBlue Swirl         d.VIS_W32(0) = F(d.VIS_W32(0), s.VIS_W32(0));   \
3311bccec25SBlue Swirl         d.VIS_W32(1) = F(d.VIS_W32(1), s.VIS_W32(1));   \
3321bccec25SBlue Swirl                                                         \
3331bccec25SBlue Swirl         return d.l;                                     \
3341bccec25SBlue Swirl     }                                                   \
3351bccec25SBlue Swirl                                                         \
3362e2f4adeSBlue Swirl     void name##32(CPUState *env)                        \
3371bccec25SBlue Swirl     {                                                   \
3381bccec25SBlue Swirl         VIS64 s, d;                                     \
3391bccec25SBlue Swirl                                                         \
3401bccec25SBlue Swirl         s.d = DT0;                                      \
3411bccec25SBlue Swirl         d.d = DT1;                                      \
3421bccec25SBlue Swirl                                                         \
3431bccec25SBlue Swirl         d.VIS_L64(0) = F(d.VIS_L64(0), s.VIS_L64(0));   \
3441bccec25SBlue Swirl         d.VIS_L64(1) = F(d.VIS_L64(1), s.VIS_L64(1));   \
3451bccec25SBlue Swirl                                                         \
3461bccec25SBlue Swirl         DT0 = d.d;                                      \
3471bccec25SBlue Swirl     }                                                   \
3481bccec25SBlue Swirl                                                         \
3492e2f4adeSBlue Swirl     uint32_t name##32s(CPUState *env, uint32_t src1,    \
3502e2f4adeSBlue Swirl                        uint32_t src2)                   \
3511bccec25SBlue Swirl     {                                                   \
3521bccec25SBlue Swirl         VIS32 s, d;                                     \
3531bccec25SBlue Swirl                                                         \
3541bccec25SBlue Swirl         s.l = src1;                                     \
3551bccec25SBlue Swirl         d.l = src2;                                     \
3561bccec25SBlue Swirl                                                         \
3571bccec25SBlue Swirl         d.l = F(d.l, s.l);                              \
3581bccec25SBlue Swirl                                                         \
3591bccec25SBlue Swirl         return d.l;                                     \
3601bccec25SBlue Swirl     }
3611bccec25SBlue Swirl 
3621bccec25SBlue Swirl #define FADD(a, b) ((a) + (b))
3631bccec25SBlue Swirl #define FSUB(a, b) ((a) - (b))
3641bccec25SBlue Swirl VIS_HELPER(helper_fpadd, FADD)
3651bccec25SBlue Swirl VIS_HELPER(helper_fpsub, FSUB)
3661bccec25SBlue Swirl 
3671bccec25SBlue Swirl #define VIS_CMPHELPER(name, F)                                    \
3682e2f4adeSBlue Swirl     uint64_t name##16(CPUState *env)                              \
3691bccec25SBlue Swirl     {                                                             \
3701bccec25SBlue Swirl         VIS64 s, d;                                               \
3711bccec25SBlue Swirl                                                                   \
3721bccec25SBlue Swirl         s.d = DT0;                                                \
3731bccec25SBlue Swirl         d.d = DT1;                                                \
3741bccec25SBlue Swirl                                                                   \
3751bccec25SBlue Swirl         d.VIS_W64(0) = F(s.VIS_W64(0), d.VIS_W64(0)) ? 1 : 0;     \
3761bccec25SBlue Swirl         d.VIS_W64(0) |= F(s.VIS_W64(1), d.VIS_W64(1)) ? 2 : 0;    \
3771bccec25SBlue Swirl         d.VIS_W64(0) |= F(s.VIS_W64(2), d.VIS_W64(2)) ? 4 : 0;    \
3781bccec25SBlue Swirl         d.VIS_W64(0) |= F(s.VIS_W64(3), d.VIS_W64(3)) ? 8 : 0;    \
3791bccec25SBlue Swirl         d.VIS_W64(1) = d.VIS_W64(2) = d.VIS_W64(3) = 0;           \
3801bccec25SBlue Swirl                                                                   \
3811bccec25SBlue Swirl         return d.ll;                                              \
3821bccec25SBlue Swirl     }                                                             \
3831bccec25SBlue Swirl                                                                   \
3842e2f4adeSBlue Swirl     uint64_t name##32(CPUState *env)                              \
3851bccec25SBlue Swirl     {                                                             \
3861bccec25SBlue Swirl         VIS64 s, d;                                               \
3871bccec25SBlue Swirl                                                                   \
3881bccec25SBlue Swirl         s.d = DT0;                                                \
3891bccec25SBlue Swirl         d.d = DT1;                                                \
3901bccec25SBlue Swirl                                                                   \
3911bccec25SBlue Swirl         d.VIS_L64(0) = F(s.VIS_L64(0), d.VIS_L64(0)) ? 1 : 0;     \
3921bccec25SBlue Swirl         d.VIS_L64(0) |= F(s.VIS_L64(1), d.VIS_L64(1)) ? 2 : 0;    \
3931bccec25SBlue Swirl         d.VIS_L64(1) = 0;                                         \
3941bccec25SBlue Swirl                                                                   \
3951bccec25SBlue Swirl         return d.ll;                                              \
3961bccec25SBlue Swirl     }
3971bccec25SBlue Swirl 
3981bccec25SBlue Swirl #define FCMPGT(a, b) ((a) > (b))
3991bccec25SBlue Swirl #define FCMPEQ(a, b) ((a) == (b))
4001bccec25SBlue Swirl #define FCMPLE(a, b) ((a) <= (b))
4011bccec25SBlue Swirl #define FCMPNE(a, b) ((a) != (b))
4021bccec25SBlue Swirl 
4031bccec25SBlue Swirl VIS_CMPHELPER(helper_fcmpgt, FCMPGT)
4041bccec25SBlue Swirl VIS_CMPHELPER(helper_fcmpeq, FCMPEQ)
4051bccec25SBlue Swirl VIS_CMPHELPER(helper_fcmple, FCMPLE)
4061bccec25SBlue Swirl VIS_CMPHELPER(helper_fcmpne, FCMPNE)
407