Commit 644ad8066d171f5e0ce58912f72e1f13d55f4a93

Authored by pbrook
1 parent 69397542

Fix VFP fixed point conversion routines.


Signed-off-by: Paul Brook <paul@codesourcery.com>


git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6103 c046a42c-6fe2-441c-8c8c-71466251a162
target-arm/helper.c
... ... @@ -2522,7 +2522,7 @@ ftype VFP_HELPER(name##to, p)(ftype x, uint32_t shift, CPUState *env) \
2522 2522 ftype tmp; \
2523 2523 tmp = sign##int32_to_##ftype ((itype)vfp_##p##toi(x), \
2524 2524 &env->vfp.fp_status); \
2525   - return ftype##_scalbn(tmp, shift, &env->vfp.fp_status); \
  2525 + return ftype##_scalbn(tmp, -(int)shift, &env->vfp.fp_status); \
2526 2526 } \
2527 2527 ftype VFP_HELPER(to##name, p)(ftype x, uint32_t shift, CPUState *env) \
2528 2528 { \
... ...
target-arm/translate.c
... ... @@ -3001,6 +3001,10 @@ static int disas_vfp_insn(CPUState * env, DisasContext *s, uint32_t insn)
3001 3001 case 21:
3002 3002 case 22:
3003 3003 case 23:
  3004 + case 28:
  3005 + case 29:
  3006 + case 30:
  3007 + case 31:
3004 3008 /* Source and destination the same. */
3005 3009 gen_mov_F0_vreg(dp, rd);
3006 3010 break;
... ... @@ -3120,22 +3124,22 @@ static int disas_vfp_insn(CPUState * env, DisasContext *s, uint32_t insn)
3120 3124 case 20: /* fshto */
3121 3125 if (!arm_feature(env, ARM_FEATURE_VFP3))
3122 3126 return 1;
3123   - gen_vfp_shto(dp, rm);
  3127 + gen_vfp_shto(dp, 16 - rm);
3124 3128 break;
3125 3129 case 21: /* fslto */
3126 3130 if (!arm_feature(env, ARM_FEATURE_VFP3))
3127 3131 return 1;
3128   - gen_vfp_slto(dp, rm);
  3132 + gen_vfp_slto(dp, 32 - rm);
3129 3133 break;
3130 3134 case 22: /* fuhto */
3131 3135 if (!arm_feature(env, ARM_FEATURE_VFP3))
3132 3136 return 1;
3133   - gen_vfp_uhto(dp, rm);
  3137 + gen_vfp_uhto(dp, 16 - rm);
3134 3138 break;
3135 3139 case 23: /* fulto */
3136 3140 if (!arm_feature(env, ARM_FEATURE_VFP3))
3137 3141 return 1;
3138   - gen_vfp_ulto(dp, rm);
  3142 + gen_vfp_ulto(dp, 32 - rm);
3139 3143 break;
3140 3144 case 24: /* ftoui */
3141 3145 gen_vfp_toui(dp);
... ... @@ -3152,22 +3156,22 @@ static int disas_vfp_insn(CPUState * env, DisasContext *s, uint32_t insn)
3152 3156 case 28: /* ftosh */
3153 3157 if (!arm_feature(env, ARM_FEATURE_VFP3))
3154 3158 return 1;
3155   - gen_vfp_tosh(dp, rm);
  3159 + gen_vfp_tosh(dp, 16 - rm);
3156 3160 break;
3157 3161 case 29: /* ftosl */
3158 3162 if (!arm_feature(env, ARM_FEATURE_VFP3))
3159 3163 return 1;
3160   - gen_vfp_tosl(dp, rm);
  3164 + gen_vfp_tosl(dp, 32 - rm);
3161 3165 break;
3162 3166 case 30: /* ftouh */
3163 3167 if (!arm_feature(env, ARM_FEATURE_VFP3))
3164 3168 return 1;
3165   - gen_vfp_touh(dp, rm);
  3169 + gen_vfp_touh(dp, 16 - rm);
3166 3170 break;
3167 3171 case 31: /* ftoul */
3168 3172 if (!arm_feature(env, ARM_FEATURE_VFP3))
3169 3173 return 1;
3170   - gen_vfp_toul(dp, rm);
  3174 + gen_vfp_toul(dp, 32 - rm);
3171 3175 break;
3172 3176 default: /* undefined */
3173 3177 printf ("rn:%d\n", rn);
... ...