summaryrefslogtreecommitdiff
path: root/target-ppc
diff options
context:
space:
mode:
authoraurel32 <aurel32@c046a42c-6fe2-441c-8c8c-71466251a162>2009-02-04 13:52:03 +0000
committeraurel32 <aurel32@c046a42c-6fe2-441c-8c8c-71466251a162>2009-02-04 13:52:03 +0000
commitf6b19645485237c9ce98409834b97b6a6bf0c0dd (patch)
treee70b0eb054fe07053d301a13683db12c94f0388a /target-ppc
parent34ba2857a067e142301e73cc04a294fd64fc1bc2 (diff)
downloadqemu-f6b19645485237c9ce98409834b97b6a6bf0c0dd.tar.gz
qemu-f6b19645485237c9ce98409834b97b6a6bf0c0dd.tar.bz2
qemu-f6b19645485237c9ce98409834b97b6a6bf0c0dd.zip
Add vrfi{m,n,p,z} instructions
Signed-off-by: Nathan Froyd <froydnj@codesourcery.com> Signed-off-by: Aurelien Jarno <aurelien@aurel32.net> git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6512 c046a42c-6fe2-441c-8c8c-71466251a162
Diffstat (limited to 'target-ppc')
-rw-r--r--target-ppc/helper.h4
-rw-r--r--target-ppc/op_helper.c18
-rw-r--r--target-ppc/translate.c4
3 files changed, 26 insertions, 0 deletions
diff --git a/target-ppc/helper.h b/target-ppc/helper.h
index 8c04ba71b0..3e546f3276 100644
--- a/target-ppc/helper.h
+++ b/target-ppc/helper.h
@@ -232,6 +232,10 @@ DEF_HELPER_3(vsum2sws, void, avr, avr, avr)
DEF_HELPER_3(vsum4sbs, void, avr, avr, avr)
DEF_HELPER_3(vsum4shs, void, avr, avr, avr)
DEF_HELPER_3(vsum4ubs, void, avr, avr, avr)
+DEF_HELPER_2(vrfim, void, avr, avr)
+DEF_HELPER_2(vrfin, void, avr, avr)
+DEF_HELPER_2(vrfip, void, avr, avr)
+DEF_HELPER_2(vrfiz, void, avr, avr)
DEF_HELPER_1(efscfsi, i32, i32)
DEF_HELPER_1(efscfui, i32, i32)
diff --git a/target-ppc/op_helper.c b/target-ppc/op_helper.c
index 107f977b0d..1fca5d6a58 100644
--- a/target-ppc/op_helper.c
+++ b/target-ppc/op_helper.c
@@ -2490,6 +2490,24 @@ VPK(uwum, u32, u16, I, 0)
#undef VPK
#undef PKBIG
+#define VRFI(suffix, rounding) \
+ void helper_vrfi##suffix (ppc_avr_t *r, ppc_avr_t *b) \
+ { \
+ int i; \
+ float_status s = env->vec_status; \
+ set_float_rounding_mode(rounding, &s); \
+ for (i = 0; i < ARRAY_SIZE(r->f); i++) { \
+ HANDLE_NAN1(r->f[i], b->f[i]) { \
+ r->f[i] = float32_round_to_int (b->f[i], &s); \
+ } \
+ } \
+ }
+VRFI(n, float_round_nearest_even)
+VRFI(m, float_round_down)
+VRFI(p, float_round_up)
+VRFI(z, float_round_to_zero)
+#undef VRFI
+
#define VROTATE(suffix, element) \
void helper_vrl##suffix (ppc_avr_t *r, ppc_avr_t *a, ppc_avr_t *b) \
{ \
diff --git a/target-ppc/translate.c b/target-ppc/translate.c
index 59e4ced45d..4926ac78e7 100644
--- a/target-ppc/translate.c
+++ b/target-ppc/translate.c
@@ -6468,6 +6468,10 @@ GEN_VXFORM_NOA(vupklsb, 7, 10);
GEN_VXFORM_NOA(vupklsh, 7, 11);
GEN_VXFORM_NOA(vupkhpx, 7, 13);
GEN_VXFORM_NOA(vupklpx, 7, 15);
+GEN_VXFORM_NOA(vrfim, 5, 8);
+GEN_VXFORM_NOA(vrfin, 5, 9);
+GEN_VXFORM_NOA(vrfip, 5, 10);
+GEN_VXFORM_NOA(vrfiz, 5, 11);
#define GEN_VXFORM_SIMM(name, opc2, opc3) \
GEN_HANDLER(name, 0x04, opc2, opc3, 0x00000000, PPC_ALTIVEC) \