aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Makefile.target3
-rw-r--r--linux-user/sparc_quad_float.c124
-rw-r--r--target-sparc/op_helper.c108
3 files changed, 108 insertions, 127 deletions
diff --git a/Makefile.target b/Makefile.target
index 02bf0346d3..446b5f5bce 100644
--- a/Makefile.target
+++ b/Makefile.target
@@ -432,9 +432,6 @@ endif
ifeq ($(TARGET_ARCH), m68k)
OBJS+= m68k-sim.o m68k-semi.o
endif
-ifeq ($(TARGET_BASE_ARCH), sparc)
-OBJS+= sparc_quad_float.o
-endif
ifdef CONFIG_GDBSTUB
OBJS+=gdbstub.o
diff --git a/linux-user/sparc_quad_float.c b/linux-user/sparc_quad_float.c
deleted file mode 100644
index f0d7f299be..0000000000
--- a/linux-user/sparc_quad_float.c
+++ /dev/null
@@ -1,124 +0,0 @@
-#include "exec.h"
-#include "host-utils.h"
-#include "helper.h"
-
-#define F_HELPER(name, p) void helper_f##name##p(void)
-
-#define F_BINOP(name) \
- F_HELPER(name, q) \
- { \
- QT0 = float128_ ## name (QT0, QT1, &env->fp_status); \
- }
-
-F_BINOP(add);
-F_BINOP(sub);
-F_BINOP(mul);
-F_BINOP(div);
-#undef F_BINOP
-
-void helper_fdmulq(void)
-{
- QT0 = float128_mul(float64_to_float128(DT0, &env->fp_status),
- float64_to_float128(DT1, &env->fp_status),
- &env->fp_status);
-}
-
-F_HELPER(ito, q)
-{
- QT0 = int32_to_float128(*((int32_t *)&FT1), &env->fp_status);
-}
-
-void helper_fqtos(void)
-{
- FT0 = float128_to_float32(QT1, &env->fp_status);
-}
-
-void helper_fstoq(void)
-{
- QT0 = float32_to_float128(FT1, &env->fp_status);
-}
-
-void helper_fqtod(void)
-{
- DT0 = float128_to_float64(QT1, &env->fp_status);
-}
-
-void helper_fdtoq(void)
-{
- QT0 = float64_to_float128(DT1, &env->fp_status);
-}
-
-void helper_fqtoi(void)
-{
- *((int32_t *)&FT0) = float128_to_int32_round_to_zero(QT1, &env->fp_status);
-}
-
-void helper_fsqrtq(void)
-{
- QT0 = float128_sqrt(QT1, &env->fp_status);
-}
-
-#ifdef TARGET_SPARC64
-F_HELPER(neg, q)
-{
- QT0 = float128_chs(QT1);
-}
-
-F_HELPER(xto, q)
-{
- QT0 = int64_to_float128(*((int64_t *)&DT1), &env->fp_status);
-}
-
-void helper_fqtox(void)
-{
- *((int64_t *)&DT0) = float128_to_int64_round_to_zero(QT1, &env->fp_status);
-}
-
-void helper_fabsq(void)
-{
- QT0 = float128_abs(QT1);
-}
-#endif
-
-#define GEN_FCMP(name, size, reg1, reg2, FS, TRAP) \
- void glue(helper_, name) (void) \
- { \
- target_ulong new_fsr; \
- \
- env->fsr &= ~((FSR_FCC1 | FSR_FCC0) << FS); \
- switch (glue(size, _compare) (reg1, reg2, &env->fp_status)) { \
- case float_relation_unordered: \
- new_fsr = (FSR_FCC1 | FSR_FCC0) << FS; \
- if ((env->fsr & FSR_NVM) || TRAP) { \
- env->fsr |= new_fsr; \
- env->fsr |= FSR_NVC; \
- env->fsr |= FSR_FTT_IEEE_EXCP; \
- raise_exception(TT_FP_EXCP); \
- } else { \
- env->fsr |= FSR_NVA; \
- } \
- break; \
- case float_relation_less: \
- new_fsr = FSR_FCC0 << FS; \
- break; \
- case float_relation_greater: \
- new_fsr = FSR_FCC1 << FS; \
- break; \
- default: \
- new_fsr = 0; \
- break; \
- } \
- env->fsr |= new_fsr; \
- }
-
-GEN_FCMP(fcmpq, float128, QT0, QT1, 0, 0);
-GEN_FCMP(fcmpeq, float128, QT0, QT1, 0, 1);
-
-#ifdef TARGET_SPARC64
-GEN_FCMP(fcmpq_fcc1, float128, QT0, QT1, 22, 0);
-GEN_FCMP(fcmpq_fcc2, float128, QT0, QT1, 24, 0);
-GEN_FCMP(fcmpq_fcc3, float128, QT0, QT1, 26, 0);
-GEN_FCMP(fcmpeq_fcc1, float128, QT0, QT1, 22, 1);
-GEN_FCMP(fcmpeq_fcc2, float128, QT0, QT1, 24, 1);
-GEN_FCMP(fcmpeq_fcc3, float128, QT0, QT1, 26, 1);
-#endif
diff --git a/target-sparc/op_helper.c b/target-sparc/op_helper.c
index 406ff5fee1..bc9bb179d6 100644
--- a/target-sparc/op_helper.c
+++ b/target-sparc/op_helper.c
@@ -58,6 +58,21 @@ void helper_check_align(target_ulong addr, uint32_t align)
#define F_HELPER(name, p) void helper_f##name##p(void)
+#if defined(CONFIG_USER_ONLY)
+#define F_BINOP(name) \
+ F_HELPER(name, s) \
+ { \
+ FT0 = float32_ ## name (FT0, FT1, &env->fp_status); \
+ } \
+ F_HELPER(name, d) \
+ { \
+ DT0 = float64_ ## name (DT0, DT1, &env->fp_status); \
+ } \
+ F_HELPER(name, q) \
+ { \
+ QT0 = float128_ ## name (QT0, QT1, &env->fp_status); \
+ }
+#else
#define F_BINOP(name) \
F_HELPER(name, s) \
{ \
@@ -67,6 +82,7 @@ void helper_check_align(target_ulong addr, uint32_t align)
{ \
DT0 = float64_ ## name (DT0, DT1, &env->fp_status); \
}
+#endif
F_BINOP(add);
F_BINOP(sub);
@@ -81,6 +97,15 @@ void helper_fsmuld(void)
&env->fp_status);
}
+#if defined(CONFIG_USER_ONLY)
+void helper_fdmulq(void)
+{
+ QT0 = float128_mul(float64_to_float128(DT0, &env->fp_status),
+ float64_to_float128(DT1, &env->fp_status),
+ &env->fp_status);
+}
+#endif
+
F_HELPER(neg, s)
{
FT0 = float32_chs(FT1);
@@ -91,6 +116,13 @@ F_HELPER(neg, d)
{
DT0 = float64_chs(DT1);
}
+
+#if defined(CONFIG_USER_ONLY)
+F_HELPER(neg, q)
+{
+ QT0 = float128_chs(QT1);
+}
+#endif
#endif
/* Integer to float conversion. */
@@ -104,6 +136,13 @@ F_HELPER(ito, d)
DT0 = int32_to_float64(*((int32_t *)&FT1), &env->fp_status);
}
+#if defined(CONFIG_USER_ONLY)
+F_HELPER(ito, q)
+{
+ QT0 = int32_to_float128(*((int32_t *)&FT1), &env->fp_status);
+}
+#endif
+
#ifdef TARGET_SPARC64
F_HELPER(xto, s)
{
@@ -114,6 +153,12 @@ F_HELPER(xto, d)
{
DT0 = int64_to_float64(*((int64_t *)&DT1), &env->fp_status);
}
+#if defined(CONFIG_USER_ONLY)
+F_HELPER(xto, q)
+{
+ QT0 = int64_to_float128(*((int64_t *)&DT1), &env->fp_status);
+}
+#endif
#endif
#undef F_HELPER
@@ -128,6 +173,28 @@ void helper_fstod(void)
DT0 = float32_to_float64(FT1, &env->fp_status);
}
+#if defined(CONFIG_USER_ONLY)
+void helper_fqtos(void)
+{
+ FT0 = float128_to_float32(QT1, &env->fp_status);
+}
+
+void helper_fstoq(void)
+{
+ QT0 = float32_to_float128(FT1, &env->fp_status);
+}
+
+void helper_fqtod(void)
+{
+ DT0 = float128_to_float64(QT1, &env->fp_status);
+}
+
+void helper_fdtoq(void)
+{
+ QT0 = float64_to_float128(DT1, &env->fp_status);
+}
+#endif
+
/* Float to integer conversion. */
void helper_fstoi(void)
{
@@ -139,6 +206,13 @@ void helper_fdtoi(void)
*((int32_t *)&FT0) = float64_to_int32_round_to_zero(DT1, &env->fp_status);
}
+#if defined(CONFIG_USER_ONLY)
+void helper_fqtoi(void)
+{
+ *((int32_t *)&FT0) = float128_to_int32_round_to_zero(QT1, &env->fp_status);
+}
+#endif
+
#ifdef TARGET_SPARC64
void helper_fstox(void)
{
@@ -150,6 +224,13 @@ void helper_fdtox(void)
*((int64_t *)&DT0) = float64_to_int64_round_to_zero(DT1, &env->fp_status);
}
+#if defined(CONFIG_USER_ONLY)
+void helper_fqtox(void)
+{
+ *((int64_t *)&DT0) = float128_to_int64_round_to_zero(QT1, &env->fp_status);
+}
+#endif
+
void helper_faligndata(void)
{
uint64_t tmp;
@@ -637,6 +718,13 @@ void helper_fabsd(void)
{
DT0 = float64_abs(DT1);
}
+
+#if defined(CONFIG_USER_ONLY)
+void helper_fabsq(void)
+{
+ QT0 = float128_abs(QT1);
+}
+#endif
#endif
void helper_fsqrts(void)
@@ -649,6 +737,13 @@ void helper_fsqrtd(void)
DT0 = float64_sqrt(DT1, &env->fp_status);
}
+#if defined(CONFIG_USER_ONLY)
+void helper_fsqrtq(void)
+{
+ QT0 = float128_sqrt(QT1, &env->fp_status);
+}
+#endif
+
#define GEN_FCMP(name, size, reg1, reg2, FS, TRAP) \
void glue(helper_, name) (void) \
{ \
@@ -686,6 +781,11 @@ GEN_FCMP(fcmpd, float64, DT0, DT1, 0, 0);
GEN_FCMP(fcmpes, float32, FT0, FT1, 0, 1);
GEN_FCMP(fcmped, float64, DT0, DT1, 0, 1);
+#ifdef CONFIG_USER_ONLY
+GEN_FCMP(fcmpq, float128, QT0, QT1, 0, 0);
+GEN_FCMP(fcmpeq, float128, QT0, QT1, 0, 1);
+#endif
+
#ifdef TARGET_SPARC64
GEN_FCMP(fcmps_fcc1, float32, FT0, FT1, 22, 0);
GEN_FCMP(fcmpd_fcc1, float64, DT0, DT1, 22, 0);
@@ -704,6 +804,14 @@ GEN_FCMP(fcmped_fcc2, float64, DT0, DT1, 24, 1);
GEN_FCMP(fcmpes_fcc3, float32, FT0, FT1, 26, 1);
GEN_FCMP(fcmped_fcc3, float64, DT0, DT1, 26, 1);
+#ifdef CONFIG_USER_ONLY
+GEN_FCMP(fcmpq_fcc1, float128, QT0, QT1, 22, 0);
+GEN_FCMP(fcmpq_fcc2, float128, QT0, QT1, 24, 0);
+GEN_FCMP(fcmpq_fcc3, float128, QT0, QT1, 26, 0);
+GEN_FCMP(fcmpeq_fcc1, float128, QT0, QT1, 22, 1);
+GEN_FCMP(fcmpeq_fcc2, float128, QT0, QT1, 24, 1);
+GEN_FCMP(fcmpeq_fcc3, float128, QT0, QT1, 26, 1);
+#endif
#endif
#if !defined(TARGET_SPARC64) && !defined(CONFIG_USER_ONLY) && defined(DEBUG_MXCC)