Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
S
swiftshader
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Chen Yisong
swiftshader
Commits
d026c448
Commit
d026c448
authored
Oct 13, 2014
by
Jan Voung
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
emitIAS for the couple of blend instructions.
BUG=none R=stichnot@chromium.org Review URL:
https://codereview.chromium.org/650573002
parent
479e5633
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
79 additions
and
8 deletions
+79
-8
IceInstX8632.cpp
src/IceInstX8632.cpp
+27
-1
IceInstX8632.h
src/IceInstX8632.h
+2
-0
assembler_ia32.cpp
src/assembler_ia32.cpp
+38
-0
assembler_ia32.h
src/assembler_ia32.h
+5
-0
vector-select.ll
tests_lit/llvm2ice_tests/vector-select.ll
+7
-7
No files found.
src/IceInstX8632.cpp
View file @
d026c448
...
@@ -1067,7 +1067,6 @@ void emitVariableBlendInst(const char *Opcode, const Inst *Inst,
...
@@ -1067,7 +1067,6 @@ void emitVariableBlendInst(const char *Opcode, const Inst *Inst,
const
Cfg
*
Func
)
{
const
Cfg
*
Func
)
{
Ostream
&
Str
=
Func
->
getContext
()
->
getStrEmit
();
Ostream
&
Str
=
Func
->
getContext
()
->
getStrEmit
();
assert
(
Inst
->
getSrcSize
()
==
3
);
assert
(
Inst
->
getSrcSize
()
==
3
);
assert
(
llvm
::
isa
<
Variable
>
(
Inst
->
getSrc
(
2
)));
assert
(
llvm
::
cast
<
Variable
>
(
Inst
->
getSrc
(
2
))
->
getRegNum
()
==
assert
(
llvm
::
cast
<
Variable
>
(
Inst
->
getSrc
(
2
))
->
getRegNum
()
==
RegX8632
::
Reg_xmm0
);
RegX8632
::
Reg_xmm0
);
Str
<<
"
\t
"
<<
Opcode
<<
"
\t
"
;
Str
<<
"
\t
"
<<
Opcode
<<
"
\t
"
;
...
@@ -1077,6 +1076,17 @@ void emitVariableBlendInst(const char *Opcode, const Inst *Inst,
...
@@ -1077,6 +1076,17 @@ void emitVariableBlendInst(const char *Opcode, const Inst *Inst,
Str
<<
"
\n
"
;
Str
<<
"
\n
"
;
}
}
void
emitIASVariableBlendInst
(
const
Inst
*
Inst
,
const
Cfg
*
Func
,
const
x86
::
AssemblerX86
::
XmmEmitterRegOp
&
Emitter
)
{
assert
(
Inst
->
getSrcSize
()
==
3
);
assert
(
llvm
::
cast
<
Variable
>
(
Inst
->
getSrc
(
2
))
->
getRegNum
()
==
RegX8632
::
Reg_xmm0
);
const
Variable
*
Dest
=
Inst
->
getDest
();
const
Operand
*
Src
=
Inst
->
getSrc
(
1
);
emitIASRegOpTyXMM
(
Func
,
Dest
->
getType
(),
Dest
,
Src
,
Emitter
);
}
}
// end anonymous namespace
}
// end anonymous namespace
template
<>
void
InstX8632Blendvps
::
emit
(
const
Cfg
*
Func
)
const
{
template
<>
void
InstX8632Blendvps
::
emit
(
const
Cfg
*
Func
)
const
{
...
@@ -1085,12 +1095,28 @@ template <> void InstX8632Blendvps::emit(const Cfg *Func) const {
...
@@ -1085,12 +1095,28 @@ template <> void InstX8632Blendvps::emit(const Cfg *Func) const {
emitVariableBlendInst
(
Opcode
,
this
,
Func
);
emitVariableBlendInst
(
Opcode
,
this
,
Func
);
}
}
template
<>
void
InstX8632Blendvps
::
emitIAS
(
const
Cfg
*
Func
)
const
{
assert
(
static_cast
<
TargetX8632
*>
(
Func
->
getTarget
())
->
getInstructionSet
()
>=
TargetX8632
::
SSE4_1
);
static
const
x86
::
AssemblerX86
::
XmmEmitterRegOp
Emitter
=
{
&
x86
::
AssemblerX86
::
blendvps
,
&
x86
::
AssemblerX86
::
blendvps
};
emitIASVariableBlendInst
(
this
,
Func
,
Emitter
);
}
template
<>
void
InstX8632Pblendvb
::
emit
(
const
Cfg
*
Func
)
const
{
template
<>
void
InstX8632Pblendvb
::
emit
(
const
Cfg
*
Func
)
const
{
assert
(
static_cast
<
TargetX8632
*>
(
Func
->
getTarget
())
->
getInstructionSet
()
>=
assert
(
static_cast
<
TargetX8632
*>
(
Func
->
getTarget
())
->
getInstructionSet
()
>=
TargetX8632
::
SSE4_1
);
TargetX8632
::
SSE4_1
);
emitVariableBlendInst
(
Opcode
,
this
,
Func
);
emitVariableBlendInst
(
Opcode
,
this
,
Func
);
}
}
template
<>
void
InstX8632Pblendvb
::
emitIAS
(
const
Cfg
*
Func
)
const
{
assert
(
static_cast
<
TargetX8632
*>
(
Func
->
getTarget
())
->
getInstructionSet
()
>=
TargetX8632
::
SSE4_1
);
static
const
x86
::
AssemblerX86
::
XmmEmitterRegOp
Emitter
=
{
&
x86
::
AssemblerX86
::
pblendvb
,
&
x86
::
AssemblerX86
::
pblendvb
};
emitIASVariableBlendInst
(
this
,
Func
,
Emitter
);
}
template
<>
void
InstX8632Imul
::
emit
(
const
Cfg
*
Func
)
const
{
template
<>
void
InstX8632Imul
::
emit
(
const
Cfg
*
Func
)
const
{
Ostream
&
Str
=
Func
->
getContext
()
->
getStrEmit
();
Ostream
&
Str
=
Func
->
getContext
()
->
getStrEmit
();
assert
(
getSrcSize
()
==
2
);
assert
(
getSrcSize
()
==
2
);
...
...
src/IceInstX8632.h
View file @
d026c448
...
@@ -1513,6 +1513,7 @@ template <> void InstX8632Psub::emit(const Cfg *Func) const;
...
@@ -1513,6 +1513,7 @@ template <> void InstX8632Psub::emit(const Cfg *Func) const;
template
<>
void
InstX8632Sqrtss
::
emit
(
const
Cfg
*
Func
)
const
;
template
<>
void
InstX8632Sqrtss
::
emit
(
const
Cfg
*
Func
)
const
;
template
<>
void
InstX8632Subss
::
emit
(
const
Cfg
*
Func
)
const
;
template
<>
void
InstX8632Subss
::
emit
(
const
Cfg
*
Func
)
const
;
template
<>
void
InstX8632Blendvps
::
emitIAS
(
const
Cfg
*
Func
)
const
;
template
<>
void
InstX8632Div
::
emitIAS
(
const
Cfg
*
Func
)
const
;
template
<>
void
InstX8632Div
::
emitIAS
(
const
Cfg
*
Func
)
const
;
template
<>
void
InstX8632Idiv
::
emitIAS
(
const
Cfg
*
Func
)
const
;
template
<>
void
InstX8632Idiv
::
emitIAS
(
const
Cfg
*
Func
)
const
;
template
<>
void
InstX8632Imul
::
emitIAS
(
const
Cfg
*
Func
)
const
;
template
<>
void
InstX8632Imul
::
emitIAS
(
const
Cfg
*
Func
)
const
;
...
@@ -1521,6 +1522,7 @@ template <> void InstX8632Movd::emitIAS(const Cfg *Func) const;
...
@@ -1521,6 +1522,7 @@ template <> void InstX8632Movd::emitIAS(const Cfg *Func) const;
template
<>
void
InstX8632Movp
::
emitIAS
(
const
Cfg
*
Func
)
const
;
template
<>
void
InstX8632Movp
::
emitIAS
(
const
Cfg
*
Func
)
const
;
template
<>
void
InstX8632Movq
::
emitIAS
(
const
Cfg
*
Func
)
const
;
template
<>
void
InstX8632Movq
::
emitIAS
(
const
Cfg
*
Func
)
const
;
template
<>
void
InstX8632MovssRegs
::
emitIAS
(
const
Cfg
*
Func
)
const
;
template
<>
void
InstX8632MovssRegs
::
emitIAS
(
const
Cfg
*
Func
)
const
;
template
<>
void
InstX8632Pblendvb
::
emitIAS
(
const
Cfg
*
Func
)
const
;
template
<>
void
InstX8632Pmull
::
emitIAS
(
const
Cfg
*
Func
)
const
;
template
<>
void
InstX8632Pmull
::
emitIAS
(
const
Cfg
*
Func
)
const
;
}
// end of namespace Ice
}
// end of namespace Ice
...
...
src/assembler_ia32.cpp
View file @
d026c448
...
@@ -803,6 +803,44 @@ void AssemblerX86::orps(XmmRegister dst, XmmRegister src) {
...
@@ -803,6 +803,44 @@ void AssemblerX86::orps(XmmRegister dst, XmmRegister src) {
EmitXmmRegisterOperand
(
dst
,
src
);
EmitXmmRegisterOperand
(
dst
,
src
);
}
}
void
AssemblerX86
::
blendvps
(
Type
/* Ty */
,
XmmRegister
dst
,
XmmRegister
src
)
{
AssemblerBuffer
::
EnsureCapacity
ensured
(
&
buffer_
);
EmitUint8
(
0x66
);
EmitUint8
(
0x0F
);
EmitUint8
(
0x38
);
EmitUint8
(
0x14
);
EmitXmmRegisterOperand
(
dst
,
src
);
}
void
AssemblerX86
::
blendvps
(
Type
/* Ty */
,
XmmRegister
dst
,
const
Address
&
src
)
{
AssemblerBuffer
::
EnsureCapacity
ensured
(
&
buffer_
);
EmitUint8
(
0x66
);
EmitUint8
(
0x0F
);
EmitUint8
(
0x38
);
EmitUint8
(
0x14
);
EmitOperand
(
dst
,
src
);
}
void
AssemblerX86
::
pblendvb
(
Type
/* Ty */
,
XmmRegister
dst
,
XmmRegister
src
)
{
AssemblerBuffer
::
EnsureCapacity
ensured
(
&
buffer_
);
EmitUint8
(
0x66
);
EmitUint8
(
0x0F
);
EmitUint8
(
0x38
);
EmitUint8
(
0x10
);
EmitXmmRegisterOperand
(
dst
,
src
);
}
void
AssemblerX86
::
pblendvb
(
Type
/* Ty */
,
XmmRegister
dst
,
const
Address
&
src
)
{
AssemblerBuffer
::
EnsureCapacity
ensured
(
&
buffer_
);
EmitUint8
(
0x66
);
EmitUint8
(
0x0F
);
EmitUint8
(
0x38
);
EmitUint8
(
0x10
);
EmitOperand
(
dst
,
src
);
}
void
AssemblerX86
::
cmpps
(
XmmRegister
dst
,
XmmRegister
src
,
void
AssemblerX86
::
cmpps
(
XmmRegister
dst
,
XmmRegister
src
,
CondX86
::
CmppsCond
CmpCondition
)
{
CondX86
::
CmppsCond
CmpCondition
)
{
AssemblerBuffer
::
EnsureCapacity
ensured
(
&
buffer_
);
AssemblerBuffer
::
EnsureCapacity
ensured
(
&
buffer_
);
...
...
src/assembler_ia32.h
View file @
d026c448
...
@@ -523,6 +523,11 @@ public:
...
@@ -523,6 +523,11 @@ public:
void
andps
(
XmmRegister
dst
,
const
Address
&
src
);
void
andps
(
XmmRegister
dst
,
const
Address
&
src
);
void
orps
(
XmmRegister
dst
,
XmmRegister
src
);
void
orps
(
XmmRegister
dst
,
XmmRegister
src
);
void
blendvps
(
Type
Ty
,
XmmRegister
dst
,
XmmRegister
src
);
void
blendvps
(
Type
Ty
,
XmmRegister
dst
,
const
Address
&
src
);
void
pblendvb
(
Type
Ty
,
XmmRegister
dst
,
XmmRegister
src
);
void
pblendvb
(
Type
Ty
,
XmmRegister
dst
,
const
Address
&
src
);
void
cmpps
(
XmmRegister
dst
,
XmmRegister
src
,
CondX86
::
CmppsCond
CmpCondition
);
void
cmpps
(
XmmRegister
dst
,
XmmRegister
src
,
CondX86
::
CmppsCond
CmpCondition
);
void
cmpps
(
XmmRegister
dst
,
const
Address
&
src
,
void
cmpps
(
XmmRegister
dst
,
const
Address
&
src
,
CondX86
::
CmppsCond
CmpCondition
);
CondX86
::
CmppsCond
CmpCondition
);
...
...
tests_lit/llvm2ice_tests/vector-select.ll
View file @
d026c448
...
@@ -27,7 +27,7 @@ entry:
...
@@ -27,7 +27,7 @@ entry:
; CHECK: por
; CHECK: por
; SSE41-LABEL: test_select_v16i8:
; SSE41-LABEL: test_select_v16i8:
; SSE41: pblendvb
; SSE41: pblendvb
xmm{{[0-7]}}, {{xmm[0-7]|xmmword}}
}
}
define
<
16
x
i1
>
@test_select_v16i1
(<
16
x
i1
>
%cond
,
<
16
x
i1
>
%arg1
,
<
16
x
i1
>
%arg2
)
{
define
<
16
x
i1
>
@test_select_v16i1
(<
16
x
i1
>
%cond
,
<
16
x
i1
>
%arg1
,
<
16
x
i1
>
%arg2
)
{
...
@@ -40,7 +40,7 @@ entry:
...
@@ -40,7 +40,7 @@ entry:
; CHECK: por
; CHECK: por
; SSE41-LABEL: test_select_v16i1:
; SSE41-LABEL: test_select_v16i1:
; SSE41: pblendvb
; SSE41: pblendvb
xmm{{[0-7]}}, {{xmm[0-7]|xmmword}}
}
}
define
<
8
x
i16
>
@test_select_v8i16
(<
8
x
i1
>
%cond
,
<
8
x
i16
>
%arg1
,
<
8
x
i16
>
%arg2
)
{
define
<
8
x
i16
>
@test_select_v8i16
(<
8
x
i1
>
%cond
,
<
8
x
i16
>
%arg1
,
<
8
x
i16
>
%arg2
)
{
...
@@ -53,7 +53,7 @@ entry:
...
@@ -53,7 +53,7 @@ entry:
; CHECK: por
; CHECK: por
; SSE41-LABEL: test_select_v8i16:
; SSE41-LABEL: test_select_v8i16:
; SSE41: pblendvb
; SSE41: pblendvb
xmm{{[0-7]}}, {{xmm[0-7]|xmmword}}
}
}
define
<
8
x
i1
>
@test_select_v8i1
(<
8
x
i1
>
%cond
,
<
8
x
i1
>
%arg1
,
<
8
x
i1
>
%arg2
)
{
define
<
8
x
i1
>
@test_select_v8i1
(<
8
x
i1
>
%cond
,
<
8
x
i1
>
%arg1
,
<
8
x
i1
>
%arg2
)
{
...
@@ -66,7 +66,7 @@ entry:
...
@@ -66,7 +66,7 @@ entry:
; CHECK: por
; CHECK: por
; SSE41-LABEL: test_select_v8i1:
; SSE41-LABEL: test_select_v8i1:
; SSE41: pblendvb
; SSE41: pblendvb
xmm{{[0-7]}}, {{xmm[0-7]|xmmword}}
}
}
define
<
4
x
i32
>
@test_select_v4i32
(<
4
x
i1
>
%cond
,
<
4
x
i32
>
%arg1
,
<
4
x
i32
>
%arg2
)
{
define
<
4
x
i32
>
@test_select_v4i32
(<
4
x
i1
>
%cond
,
<
4
x
i32
>
%arg1
,
<
4
x
i32
>
%arg2
)
{
...
@@ -80,7 +80,7 @@ entry:
...
@@ -80,7 +80,7 @@ entry:
; SSE41-LABEL: test_select_v4i32:
; SSE41-LABEL: test_select_v4i32:
; SSE41: pslld xmm0, 31
; SSE41: pslld xmm0, 31
; SSE41: blendvps
; SSE41: blendvps
xmm{{[0-7]}}, {{xmm[0-7]|xmmword}}
}
}
define
<
4
x
float
>
@test_select_v4f32
(<
4
x
i1
>
%cond
,
<
4
x
float
>
%arg1
,
<
4
x
float
>
%arg2
)
{
define
<
4
x
float
>
@test_select_v4f32
(<
4
x
i1
>
%cond
,
<
4
x
float
>
%arg1
,
<
4
x
float
>
%arg2
)
{
...
@@ -94,7 +94,7 @@ entry:
...
@@ -94,7 +94,7 @@ entry:
; SSE41-LABEL: test_select_v4f32:
; SSE41-LABEL: test_select_v4f32:
; SSE41: pslld xmm0, 31
; SSE41: pslld xmm0, 31
; SSE41: blendvps
; SSE41: blendvps
xmm{{[0-7]}}, {{xmm[0-7]|xmmword}}
}
}
define
<
4
x
i1
>
@test_select_v4i1
(<
4
x
i1
>
%cond
,
<
4
x
i1
>
%arg1
,
<
4
x
i1
>
%arg2
)
{
define
<
4
x
i1
>
@test_select_v4i1
(<
4
x
i1
>
%cond
,
<
4
x
i1
>
%arg1
,
<
4
x
i1
>
%arg2
)
{
...
@@ -108,7 +108,7 @@ entry:
...
@@ -108,7 +108,7 @@ entry:
; SSE41-LABEL: test_select_v4i1:
; SSE41-LABEL: test_select_v4i1:
; SSE41: pslld xmm0, 31
; SSE41: pslld xmm0, 31
; SSE41: blendvps
; SSE41: blendvps
xmm{{[0-7]}}, {{xmm[0-7]|xmmword}}
}
}
; ERRORS-NOT: ICE translation error
; ERRORS-NOT: ICE translation error
...
...
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