Commit dabd98ddf501ab9e28905f64a28282be96840a2d

Authored by bellard
1 parent daf90626

fixed movd mmx/sse insn


git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@2321 c046a42c-6fe2-441c-8c8c-71466251a162
target-i386/ops_sse.h
... ... @@ -558,6 +558,25 @@ void OPPROTO glue(op_movl_T0_mm, SUFFIX) (void)
558 558 T0 = s->L(0);
559 559 }
560 560  
  561 +#ifdef TARGET_X86_64
  562 +void OPPROTO glue(op_movq_mm_T0, SUFFIX) (void)
  563 +{
  564 + Reg *d;
  565 + d = (Reg *)((char *)env + PARAM1);
  566 + d->Q(0) = T0;
  567 +#if SHIFT == 1
  568 + d->Q(1) = 0;
  569 +#endif
  570 +}
  571 +
  572 +void OPPROTO glue(op_movq_T0_mm, SUFFIX) (void)
  573 +{
  574 + Reg *s;
  575 + s = (Reg *)((char *)env + PARAM1);
  576 + T0 = s->Q(0);
  577 +}
  578 +#endif
  579 +
561 580 #if SHIFT == 0
562 581 void OPPROTO glue(op_pshufw, SUFFIX) (void)
563 582 {
... ...
target-i386/translate.c
... ... @@ -2621,12 +2621,28 @@ static void gen_sse(DisasContext *s, int b, target_ulong pc_start, int rex_r)
2621 2621 gen_sto_env_A0[s->mem_index >> 2](offsetof(CPUX86State,xmm_regs[reg]));
2622 2622 break;
2623 2623 case 0x6e: /* movd mm, ea */
2624   - gen_ldst_modrm(s, modrm, OT_LONG, OR_TMP0, 0);
2625   - gen_op_movl_mm_T0_mmx(offsetof(CPUX86State,fpregs[reg].mmx));
  2624 +#ifdef TARGET_X86_64
  2625 + if (s->dflag == 2) {
  2626 + gen_ldst_modrm(s, modrm, OT_QUAD, OR_TMP0, 0);
  2627 + gen_op_movq_mm_T0_mmx(offsetof(CPUX86State,fpregs[reg].mmx));
  2628 + } else
  2629 +#endif
  2630 + {
  2631 + gen_ldst_modrm(s, modrm, OT_LONG, OR_TMP0, 0);
  2632 + gen_op_movl_mm_T0_mmx(offsetof(CPUX86State,fpregs[reg].mmx));
  2633 + }
2626 2634 break;
2627 2635 case 0x16e: /* movd xmm, ea */
2628   - gen_ldst_modrm(s, modrm, OT_LONG, OR_TMP0, 0);
2629   - gen_op_movl_mm_T0_xmm(offsetof(CPUX86State,xmm_regs[reg]));
  2636 +#ifdef TARGET_X86_64
  2637 + if (s->dflag == 2) {
  2638 + gen_ldst_modrm(s, modrm, OT_QUAD, OR_TMP0, 0);
  2639 + gen_op_movq_mm_T0_xmm(offsetof(CPUX86State,xmm_regs[reg]));
  2640 + } else
  2641 +#endif
  2642 + {
  2643 + gen_ldst_modrm(s, modrm, OT_LONG, OR_TMP0, 0);
  2644 + gen_op_movl_mm_T0_xmm(offsetof(CPUX86State,xmm_regs[reg]));
  2645 + }
2630 2646 break;
2631 2647 case 0x6f: /* movq mm, ea */
2632 2648 if (mod != 3) {
... ... @@ -2750,12 +2766,28 @@ static void gen_sse(DisasContext *s, int b, target_ulong pc_start, int rex_r)
2750 2766 offsetof(CPUX86State,xmm_regs[reg].XMM_L(3)));
2751 2767 break;
2752 2768 case 0x7e: /* movd ea, mm */
2753   - gen_op_movl_T0_mm_mmx(offsetof(CPUX86State,fpregs[reg].mmx));
2754   - gen_ldst_modrm(s, modrm, OT_LONG, OR_TMP0, 1);
  2769 +#ifdef TARGET_X86_64
  2770 + if (s->dflag == 2) {
  2771 + gen_op_movq_T0_mm_mmx(offsetof(CPUX86State,fpregs[reg].mmx));
  2772 + gen_ldst_modrm(s, modrm, OT_QUAD, OR_TMP0, 1);
  2773 + } else
  2774 +#endif
  2775 + {
  2776 + gen_op_movl_T0_mm_mmx(offsetof(CPUX86State,fpregs[reg].mmx));
  2777 + gen_ldst_modrm(s, modrm, OT_LONG, OR_TMP0, 1);
  2778 + }
2755 2779 break;
2756 2780 case 0x17e: /* movd ea, xmm */
2757   - gen_op_movl_T0_mm_xmm(offsetof(CPUX86State,xmm_regs[reg]));
2758   - gen_ldst_modrm(s, modrm, OT_LONG, OR_TMP0, 1);
  2781 +#ifdef TARGET_X86_64
  2782 + if (s->dflag == 2) {
  2783 + gen_op_movq_T0_mm_xmm(offsetof(CPUX86State,xmm_regs[reg]));
  2784 + gen_ldst_modrm(s, modrm, OT_QUAD, OR_TMP0, 1);
  2785 + } else
  2786 +#endif
  2787 + {
  2788 + gen_op_movl_T0_mm_xmm(offsetof(CPUX86State,xmm_regs[reg]));
  2789 + gen_ldst_modrm(s, modrm, OT_LONG, OR_TMP0, 1);
  2790 + }
2759 2791 break;
2760 2792 case 0x27e: /* movq xmm, ea */
2761 2793 if (mod != 3) {
... ...