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