Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
go
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
go
Commits
c1d06cef
Commit
c1d06cef
authored
Oct 07, 2012
by
Russ Cox
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
cmd/8l: add SSE2 instructions
R=ken CC=golang-dev
https://golang.org/cl/6610065
parent
d749783f
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
411 additions
and
13 deletions
+411
-13
src/cmd/8l/8.out.h
src/cmd/8l/8.out.h
+126
-11
src/cmd/8l/l.h
src/cmd/8l/l.h
+8
-0
src/cmd/8l/list.c
src/cmd/8l/list.c
+9
-0
src/cmd/8l/obj.c
src/cmd/8l/obj.c
+14
-0
src/cmd/8l/optab.c
src/cmd/8l/optab.c
+178
-0
src/cmd/8l/span.c
src/cmd/8l/span.c
+76
-2
No files found.
src/cmd/8l/8.out.h
View file @
c1d06cef
...
...
@@ -461,6 +461,112 @@ enum as
AUNDEF
,
// SSE2
AADDPD
,
AADDPS
,
AADDSD
,
AADDSS
,
AANDNPD
,
AANDNPS
,
AANDPD
,
AANDPS
,
ACMPPD
,
ACMPPS
,
ACMPSD
,
ACMPSS
,
ACOMISD
,
ACOMISS
,
ACVTPL2PD
,
ACVTPL2PS
,
ACVTPD2PL
,
ACVTPD2PS
,
ACVTPS2PL
,
ACVTPS2PD
,
ACVTSD2SL
,
ACVTSD2SS
,
ACVTSL2SD
,
ACVTSL2SS
,
ACVTSS2SD
,
ACVTSS2SL
,
ACVTTPD2PL
,
AC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_STATIC
=
70
,
D_AUTO
=
71
,
D_PARAM
=
72
,
D_CONST
=
73
,
D_FCONST
=
74
,
D_SCONST
=
75
,
D_ADDR
=
76
,
D_FILE
,
D_FILE1
,
...
...
src/cmd/8l/l.h
View file @
c1d06cef
...
...
@@ -203,6 +203,8 @@ enum
Ycr0
,
Ycr1
,
Ycr2
,
Ycr3
,
Ycr4
,
Ycr5
,
Ycr6
,
Ycr7
,
Ydr0
,
Ydr1
,
Ydr2
,
Ydr3
,
Ydr4
,
Ydr5
,
Ydr6
,
Ydr7
,
Ytr0
,
Ytr1
,
Ytr2
,
Ytr3
,
Ytr4
,
Ytr5
,
Ytr6
,
Ytr7
,
Ymr
,
Ymm
,
Yxr
,
Yxm
,
Ymax
,
Zxxx
=
0
,
...
...
@@ -224,10 +226,14 @@ enum
Zloop
,
Zm_o
,
Zm_r
,
Zm_r_xm
,
Zm_r_i_xm
,
Zaut_r
,
Zo_m
,
Zpseudo
,
Zr_m
,
Zr_m_xm
,
Zr_m_i_xm
,
Zrp_
,
Z_ib
,
Z_il
,
...
...
@@ -245,6 +251,8 @@ enum
Pm
=
0x0f
,
/* 2byte opcode escape */
Pq
=
0xff
,
/* both escape */
Pb
=
0xfe
,
/* byte operands */
Pf2
=
0xf2
,
/* xmm escape 1 */
Pf3
=
0xf3
,
/* xmm escape 2 */
};
#pragma varargck type "A" int
...
...
src/cmd/8l/list.c
View file @
c1d06cef
...
...
@@ -255,6 +255,15 @@ char* regstr[] =
"TR6"
,
"TR7"
,
"X0"
,
"X1"
,
"X2"
,
"X3"
,
"X4"
,
"X5"
,
"X6"
,
"X7"
,
"NONE"
,
/* [D_NONE] */
};
...
...
src/cmd/8l/obj.c
View file @
c1d06cef
...
...
@@ -657,6 +657,13 @@ loop:
case
AFDIVRF
:
case
AFCOMF
:
case
AFCOMFP
:
case
AMOVSS
:
case
AADDSS
:
case
ASUBSS
:
case
AMULSS
:
case
ADIVSS
:
case
ACOMISS
:
case
AUCOMISS
:
if
(
skip
)
goto
casdef
;
if
(
p
->
from
.
type
==
D_FCONST
)
{
...
...
@@ -683,6 +690,13 @@ loop:
case
AFDIVRD
:
case
AFCOMD
:
case
AFCOMDP
:
case
AMOVSD
:
case
AADDSD
:
case
ASUBSD
:
case
AMULSD
:
case
ADIVSD
:
case
ACOMISD
:
case
AUCOMISD
:
if
(
skip
)
goto
casdef
;
if
(
p
->
from
.
type
==
D_FCONST
)
{
...
...
src/cmd/8l/optab.c
View file @
c1d06cef
...
...
@@ -356,6 +356,79 @@ uchar ysvrs[] =
Ym
,
Ynone
,
Zm_o
,
2
,
0
};
uchar
yxm
[]
=
{
Yxm
,
Yxr
,
Zm_r_xm
,
1
,
0
};
uchar
yxcvm1
[]
=
{
Yxm
,
Yxr
,
Zm_r_xm
,
2
,
Yxm
,
Ymr
,
Zm_r_xm
,
2
,
0
};
uchar
yxcvm2
[]
=
{
Yxm
,
Yxr
,
Zm_r_xm
,
2
,
Ymm
,
Yxr
,
Zm_r_xm
,
2
,
0
};
uchar
yxmq
[]
=
{
Yxm
,
Yxr
,
Zm_r_xm
,
2
,
0
};
uchar
yxr
[]
=
{
Yxr
,
Yxr
,
Zm_r_xm
,
1
,
0
};
uchar
yxr_ml
[]
=
{
Yxr
,
Yml
,
Zr_m_xm
,
1
,
0
};
uchar
yxcmp
[]
=
{
Yxm
,
Yxr
,
Zm_r_xm
,
1
,
0
};
uchar
yxcmpi
[]
=
{
Yxm
,
Yxr
,
Zm_r_i_xm
,
2
,
0
};
uchar
yxmov
[]
=
{
Yxm
,
Yxr
,
Zm_r_xm
,
1
,
Yxr
,
Yxm
,
Zr_m_xm
,
1
,
0
};
uchar
yxcvfl
[]
=
{
Yxm
,
Yrl
,
Zm_r_xm
,
1
,
0
};
uchar
yxcvlf
[]
=
{
Yml
,
Yxr
,
Zm_r_xm
,
1
,
0
};
uchar
yxcvfq
[]
=
{
Yxm
,
Yrl
,
Zm_r_xm
,
2
,
0
};
uchar
yxcvqf
[]
=
{
Yml
,
Yxr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xm
,
Pf3
,
0x53
},
{
ARSQRTPS
,
yxm
,
Pm
,
0x52
},
{
ARSQRTSS
,
yxm
,
Pf3
,
0x52
},
{
ASQRTPD
,
yxm
,
Pe
,
0x51
},
{
ASQRTPS
,
yxm
,
Pm
,
0x51
},
{
ASQRTSD
,
yxm
,
Pf2
,
0x51
},
{
ASQRTSS
,
yxm
,
Pf3
,
0x51
},
{
ASUBPD
,
yxm
,
Pe
,
0x5c
},
{
ASUBPS
,
yxm
,
Pm
,
0x5c
},
{
ASUBSD
,
yxm
,
Pf2
,
0x5c
},
{
ASUBSS
,
yxm
,
Pf3
,
0x5c
},
{
AUCOMISD
,
yxcmp
,
Pe
,
0x2e
},
{
AUCOMISS
,
yxcmp
,
Pm
,
0x2e
},
{
AUNPCKHPD
,
yxm
,
Pe
,
0x15
},
{
AUNPCKHPS
,
yxm
,
Pm
,
0x15
},
{
AUNPCKLPD
,
yxm
,
Pe
,
0x14
},
{
AUNPCKLPS
,
yxm
,
Pm
,
0x14
},
{
AXORPD
,
yxm
,
Pe
,
0x57
},
{
AXORPS
,
yxm
,
Pm
,
0x57
},
0
};
src/cmd/8l/span.c
View file @
c1d06cef
...
...
@@ -194,7 +194,7 @@ instinit(void)
for
(
i
=
1
;
optab
[
i
].
as
;
i
++
)
if
(
i
!=
optab
[
i
].
as
)
{
diag
(
"phase error in optab:
%d"
,
i
);
diag
(
"phase error in optab:
at %A found %A"
,
i
,
optab
[
i
].
as
);
errorexit
();
}
maxop
=
i
;
...
...
@@ -238,6 +238,16 @@ instinit(void)
ycover
[
Yrl
*
Ymax
+
Yml
]
=
1
;
ycover
[
Ym
*
Ymax
+
Yml
]
=
1
;
ycover
[
Yax
*
Ymax
+
Ymm
]
=
1
;
ycover
[
Ycx
*
Ymax
+
Ymm
]
=
1
;
ycover
[
Yrx
*
Ymax
+
Ymm
]
=
1
;
ycover
[
Yrl
*
Ymax
+
Ymm
]
=
1
;
ycover
[
Ym
*
Ymax
+
Ymm
]
=
1
;
ycover
[
Ymr
*
Ymax
+
Ymm
]
=
1
;
ycover
[
Ym
*
Ymax
+
Yxm
]
=
1
;
ycover
[
Yxr
*
Ymax
+
Yxm
]
=
1
;
for
(
i
=
0
;
i
<
D_NONE
;
i
++
)
{
reg
[
i
]
=
-
1
;
if
(
i
>=
D_AL
&&
i
<=
D_BH
)
...
...
@@ -246,6 +256,8 @@ instinit(void)
reg
[
i
]
=
(
i
-
D_AX
)
&
7
;
if
(
i
>=
D_F0
&&
i
<=
D_F0
+
7
)
reg
[
i
]
=
(
i
-
D_F0
)
&
7
;
if
(
i
>=
D_X0
&&
i
<=
D_X0
+
7
)
reg
[
i
]
=
(
i
-
D_X0
)
&
7
;
}
}
...
...
@@ -333,6 +345,16 @@ oclass(Adr *a)
case
D_F0
+
7
:
return
Yrf
;
case
D_X0
+
0
:
case
D_X0
+
1
:
case
D_X0
+
2
:
case
D_X0
+
3
:
case
D_X0
+
4
:
case
D_X0
+
5
:
case
D_X0
+
6
:
case
D_X0
+
7
:
return
Yxr
;
case
D_NONE
:
return
Ynone
;
...
...
@@ -585,7 +607,7 @@ asmand(Adr *a, int r)
asmidx
(
a
->
scale
,
a
->
index
,
t
);
goto
putrelv
;
}
if
(
t
>=
D_AL
&&
t
<=
D_F
0
+
7
)
{
if
(
t
>=
D_AL
&&
t
<=
D_F
7
||
t
>=
D_X0
&&
t
<=
D_X
7
)
{
if
(
v
)
goto
bad
;
*
andptr
++
=
(
3
<<
6
)
|
(
reg
[
t
]
<<
0
)
|
(
r
<<
3
);
...
...
@@ -827,6 +849,30 @@ subreg(Prog *p, int from, int to)
print
(
"%P
\n
"
,
p
);
}
static
int
mediaop
(
Optab
*
o
,
int
op
,
int
osize
,
int
z
)
{
switch
(
op
){
case
Pm
:
case
Pe
:
case
Pf2
:
case
Pf3
:
if
(
osize
!=
1
){
if
(
op
!=
Pm
)
*
andptr
++
=
op
;
*
andptr
++
=
Pm
;
op
=
o
->
op
[
++
z
];
break
;
}
default:
if
(
andptr
==
and
||
andptr
[
-
1
]
!=
Pm
)
*
andptr
++
=
Pm
;
break
;
}
*
andptr
++
=
op
;
return
z
;
}
void
doasm
(
Prog
*
p
)
{
...
...
@@ -873,6 +919,12 @@ found:
*
andptr
++
=
Pm
;
break
;
case
Pf2
:
/* xmm opcode escape */
case
Pf3
:
*
andptr
++
=
o
->
prefix
;
*
andptr
++
=
Pm
;
break
;
case
Pm
:
/* opcode escape */
*
andptr
++
=
Pm
;
break
;
...
...
@@ -904,6 +956,17 @@ found:
asmand
(
&
p
->
from
,
reg
[
p
->
to
.
type
]);
break
;
case
Zm_r_xm
:
mediaop
(
o
,
op
,
t
[
3
],
z
);
asmand
(
&
p
->
from
,
reg
[
p
->
to
.
type
]);
break
;
case
Zm_r_i_xm
:
mediaop
(
o
,
op
,
t
[
3
],
z
);
asmand
(
&
p
->
from
,
reg
[
p
->
to
.
type
]);
*
andptr
++
=
p
->
to
.
offset
;
break
;
case
Zaut_r
:
*
andptr
++
=
0x8d
;
/* leal */
if
(
p
->
from
.
type
!=
D_ADDR
)
...
...
@@ -927,6 +990,17 @@ found:
asmand
(
&
p
->
to
,
reg
[
p
->
from
.
type
]);
break
;
case
Zr_m_xm
:
mediaop
(
o
,
op
,
t
[
3
],
z
);
asmand
(
&
p
->
to
,
reg
[
p
->
from
.
type
]);
break
;
case
Zr_m_i_xm
:
mediaop
(
o
,
op
,
t
[
3
],
z
);
asmand
(
&
p
->
to
,
reg
[
p
->
from
.
type
]);
*
andptr
++
=
p
->
from
.
offset
;
break
;
case
Zo_m
:
*
andptr
++
=
op
;
asmand
(
&
p
->
to
,
o
->
op
[
z
+
1
]);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment