Commit 17105870 authored by Michał Derkacz's avatar Michał Derkacz Committed by Russ Cox

6l: add MOVQ xmm_reg, xmm_reg

Added handler for:
        MOVQ xmm_reg, xmm_reg/mem64
        MOVQ xmm_reg/mem64, xmm_reg
using native MOVQ (it take precedence above REX.W MOVD)
I don't understood 6l code enough to be sure that my small changes
didn't broke it. But now 6l works with MOVQ xmm_reg, xmm_reg and
all.bash reports "0 unexpected bugs".

There is test assembly source:
MOVQ    X0, X1
MOVQ    AX, X1
MOVQ    X1, AX
MOVQ    xxx+8(FP), X2
MOVQ    X2, xxx+8(FP)

and generated code (gdb disassemble /r):

0x000000000040f112 <+0>:   f3 0f 7e c8        movq  %xmm0,%xmm1
0x000000000040f116 <+4>:   66 48 0f 6e c8     movq  %rax,%xmm1
0x000000000040f11b <+9>:   66 48 0f 7e c8     movq  %xmm1,%rax
0x000000000040f120 <+14>:  f3 0f 7e 54 24 10  movq  0x10(%rsp),%xmm2
0x000000000040f126 <+20>:  66 0f d6 54 24 10  movq  %xmm2,0x10(%rsp)

Fixes #2418.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/5316076
parent c8a2be8c
......@@ -163,7 +163,7 @@ struct Optab
short as;
uchar* ytab;
uchar prefix;
uchar op[20];
uchar op[22];
};
struct Movtab
{
......
......@@ -200,7 +200,8 @@ uchar ymovq[] =
Ymm, Ymr, Zm_r_xm, 1, // MMX MOVD
Ymr, Ymm, Zr_m_xm, 1, // MMX MOVD
Yxr, Ymr, Zm_r_xm_nr, 2, // MOVDQ2Q
Yxr, Ym, Zr_m_xm_nr, 2, // MOVQ xmm store
Yxm, Yxr, Zm_r_xm_nr, 2, // MOVQ xmm1/m64 -> xmm2
Yxr, Yxm, Zr_m_xm_nr, 2, // MOVQ xmm1 -> xmm2/m64
Yml, Yxr, Zm_r_xm, 2, // MOVD xmm load
Yxr, Yml, Zr_m_xm, 2, // MOVD xmm store
Yiauto, Yrl, Zaut_r, 2, // built-in LEAQ
......@@ -862,7 +863,7 @@ Optab optab[] =
{ AMOVNTPD, yxr_ml, Pe, 0x2b },
{ AMOVNTPS, yxr_ml, Pm, 0x2b },
{ AMOVNTQ, ymr_ml, Pm, 0xe7 },
{ AMOVQ, ymovq, Pw, 0x89,0x8b,0x31,0xc7,(00),0xb8,0xc7,(00),0x6f,0x7f,0x6e,0x7e,Pf2,0xd6,Pe,0xd6,Pe,0x6e,Pe,0x7e },
{ AMOVQ, ymovq, Pw, 0x89, 0x8b, 0x31, 0xc7,(00), 0xb8, 0xc7,(00), 0x6f, 0x7f, 0x6e, 0x7e, Pf2,0xd6, Pf3,0x7e, Pe,0xd6, Pe,0x6e, Pe,0x7e },
{ AMOVQOZX, ymrxr, Pf3, 0xd6,0x7e },
{ AMOVSB, ynone, Pb, 0xa4 },
{ AMOVSD, yxmov, Pf2, 0x10,0x11 },
......
......@@ -266,10 +266,6 @@ instinit(void)
ycover[Ym*Ymax + Ymm] = 1;
ycover[Ymr*Ymax + Ymm] = 1;
ycover[Yax*Ymax + Yxm] = 1;
ycover[Ycx*Ymax + Yxm] = 1;
ycover[Yrx*Ymax + Yxm] = 1;
ycover[Yrl*Ymax + Yxm] = 1;
ycover[Ym*Ymax + Yxm] = 1;
ycover[Yxr*Ymax + Yxm] = 1;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment