Skip to content

6l doesn't understood MOVQ XMM_REG, XMM_REG #2418

@gopherbot

Description

@gopherbot

by ziutek@Lnet.pl:

What steps will reproduce the problem?
1. Write test function in AMD64 assembler that contains such instruction:

TEXT ·Test(SB), 7, $0
    MOVQ X1, X3
    RET

2. Use 6a to compile it - there is no errors.

3. Use 6l to link it with some code that calls Test function.

What is the expected output?
It should link without errors.

What do you see instead?
mypkg.Test: doasm: notfound from=35 to=37 (2) MOVQ    X1,X3

Which operating system are you using?
Linux

Which revision are you using?  (hg identify)
weekly.2011-11-02

I tried fix 6l and it seems that my fix works:

Assembler code:
 PSRLQ   $63, X2
 MOVQ    X1, X3
 PADDQ   X2, X3

Gdb disassemble:
 0x00000000004190f5 <+42>:    psrlq  $0x3f,%xmm2
 0x00000000004190fa <+47>:    movq   %xmm1,%xmm3
 0x00000000004190fe <+51>:    paddq  %xmm2,%xmm3

But I don't understood 6l code enough to be sure that my small changes didn't broke 6l:

diff -r 19bc41642ed8 -r e2a0695fd6e6 src/cmd/6l/l.h
--- a/src/cmd/6l/l.h    Wed Nov 02 17:11:40 2011 +1100
+++ b/src/cmd/6l/l.h    Wed Nov 02 23:59:20 2011 +0100
@@ -163,7 +163,7 @@
    short   as;
    uchar*  ytab;
    uchar   prefix;
-   uchar   op[20];
+   uchar   op[22];
 };
 struct Movtab
 {
diff -r 19bc41642ed8 -r e2a0695fd6e6 src/cmd/6l/optab.c
--- a/src/cmd/6l/optab.c    Wed Nov 02 17:11:40 2011 +1100
+++ b/src/cmd/6l/optab.c    Wed Nov 02 23:59:20 2011 +0100
@@ -200,10 +200,11 @@
    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
+   //Yiauto,   Yrl,    Zaut_r, 2,  // built-in LEAQ - there is no ops for this entry ?!
    0
 };
 uchar  ym_rl[] =
@@ -862,7 +863,7 @@
    { 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 },

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions