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
ef8210d9
Commit
ef8210d9
authored
Oct 17, 2016
by
Nicolas Capens
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Implement vector packing intrinsics.
BUG=swiftshader:15 Change-Id: Id95a08f82c47ec20bb958358c01f389b6fb5565b
parent
32f9ccef
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
39 additions
and
13 deletions
+39
-13
IceAssemblerX86BaseImpl.h
src/IceAssemblerX86BaseImpl.h
+12
-12
IceIntrinsics.h
src/IceIntrinsics.h
+3
-1
IceTargetLoweringX86BaseImpl.h
src/IceTargetLoweringX86BaseImpl.h
+24
-0
No files found.
src/IceAssemblerX86BaseImpl.h
View file @
ef8210d9
...
@@ -1667,15 +1667,15 @@ void AssemblerX86Base<TraitsType>::punpckh(Type Ty, XmmRegister Dst,
...
@@ -1667,15 +1667,15 @@ void AssemblerX86Base<TraitsType>::punpckh(Type Ty, XmmRegister Dst,
}
}
template
<
typename
TraitsType
>
template
<
typename
TraitsType
>
void
AssemblerX86Base
<
TraitsType
>::
packss
(
Type
Ty
,
XmmRegister
Dst
,
void
AssemblerX86Base
<
TraitsType
>::
packss
(
Type
Dest
Ty
,
XmmRegister
Dst
,
XmmRegister
Src
)
{
XmmRegister
Src
)
{
AssemblerBuffer
::
EnsureCapacity
ensured
(
&
Buffer
);
AssemblerBuffer
::
EnsureCapacity
ensured
(
&
Buffer
);
emitUint8
(
0x66
);
emitUint8
(
0x66
);
emitRexRB
(
RexTypeIrrelevant
,
Dst
,
Src
);
emitRexRB
(
RexTypeIrrelevant
,
Dst
,
Src
);
emitUint8
(
0x0F
);
emitUint8
(
0x0F
);
if
(
Ty
==
IceType_v4i32
||
Ty
==
IceType_v4f32
)
{
if
(
DestTy
==
IceType_v8i16
)
{
emitUint8
(
0x6B
);
emitUint8
(
0x6B
);
}
else
if
(
Ty
==
IceType_v8i16
)
{
}
else
if
(
DestTy
==
IceType_v16i8
)
{
emitUint8
(
0x63
);
emitUint8
(
0x63
);
}
else
{
}
else
{
assert
(
false
&&
"Unexpected vector pack operand type"
);
assert
(
false
&&
"Unexpected vector pack operand type"
);
...
@@ -1684,16 +1684,16 @@ void AssemblerX86Base<TraitsType>::packss(Type Ty, XmmRegister Dst,
...
@@ -1684,16 +1684,16 @@ void AssemblerX86Base<TraitsType>::packss(Type Ty, XmmRegister Dst,
}
}
template
<
typename
TraitsType
>
template
<
typename
TraitsType
>
void
AssemblerX86Base
<
TraitsType
>::
packss
(
Type
Ty
,
XmmRegister
Dst
,
void
AssemblerX86Base
<
TraitsType
>::
packss
(
Type
Dest
Ty
,
XmmRegister
Dst
,
const
Address
&
Src
)
{
const
Address
&
Src
)
{
AssemblerBuffer
::
EnsureCapacity
ensured
(
&
Buffer
);
AssemblerBuffer
::
EnsureCapacity
ensured
(
&
Buffer
);
emitUint8
(
0x66
);
emitUint8
(
0x66
);
emitAddrSizeOverridePrefix
();
emitAddrSizeOverridePrefix
();
emitRex
(
RexTypeIrrelevant
,
Src
,
Dst
);
emitRex
(
RexTypeIrrelevant
,
Src
,
Dst
);
emitUint8
(
0x0F
);
emitUint8
(
0x0F
);
if
(
Ty
==
IceType_v4i32
||
Ty
==
IceType_v4f32
)
{
if
(
DestTy
==
IceType_v8i16
)
{
emitUint8
(
0x6B
);
emitUint8
(
0x6B
);
}
else
if
(
Ty
==
IceType_v8i16
)
{
}
else
if
(
DestTy
==
IceType_v16i8
)
{
emitUint8
(
0x63
);
emitUint8
(
0x63
);
}
else
{
}
else
{
assert
(
false
&&
"Unexpected vector pack operand type"
);
assert
(
false
&&
"Unexpected vector pack operand type"
);
...
@@ -1702,16 +1702,16 @@ void AssemblerX86Base<TraitsType>::packss(Type Ty, XmmRegister Dst,
...
@@ -1702,16 +1702,16 @@ void AssemblerX86Base<TraitsType>::packss(Type Ty, XmmRegister Dst,
}
}
template
<
typename
TraitsType
>
template
<
typename
TraitsType
>
void
AssemblerX86Base
<
TraitsType
>::
packus
(
Type
Ty
,
XmmRegister
Dst
,
void
AssemblerX86Base
<
TraitsType
>::
packus
(
Type
Dest
Ty
,
XmmRegister
Dst
,
XmmRegister
Src
)
{
XmmRegister
Src
)
{
AssemblerBuffer
::
EnsureCapacity
ensured
(
&
Buffer
);
AssemblerBuffer
::
EnsureCapacity
ensured
(
&
Buffer
);
emitUint8
(
0x66
);
emitUint8
(
0x66
);
emitRexRB
(
RexTypeIrrelevant
,
Dst
,
Src
);
emitRexRB
(
RexTypeIrrelevant
,
Dst
,
Src
);
emitUint8
(
0x0F
);
emitUint8
(
0x0F
);
if
(
Ty
==
IceType_v4i32
||
Ty
==
IceType_v4f32
)
{
if
(
DestTy
==
IceType_v8i16
)
{
emitUint8
(
0x38
);
emitUint8
(
0x38
);
emitUint8
(
0x2B
);
emitUint8
(
0x2B
);
}
else
if
(
Ty
==
IceType_v8i16
)
{
}
else
if
(
DestTy
==
IceType_v16i8
)
{
emitUint8
(
0x67
);
emitUint8
(
0x67
);
}
else
{
}
else
{
assert
(
false
&&
"Unexpected vector pack operand type"
);
assert
(
false
&&
"Unexpected vector pack operand type"
);
...
@@ -1720,17 +1720,17 @@ void AssemblerX86Base<TraitsType>::packus(Type Ty, XmmRegister Dst,
...
@@ -1720,17 +1720,17 @@ void AssemblerX86Base<TraitsType>::packus(Type Ty, XmmRegister Dst,
}
}
template
<
typename
TraitsType
>
template
<
typename
TraitsType
>
void
AssemblerX86Base
<
TraitsType
>::
packus
(
Type
Ty
,
XmmRegister
Dst
,
void
AssemblerX86Base
<
TraitsType
>::
packus
(
Type
Dest
Ty
,
XmmRegister
Dst
,
const
Address
&
Src
)
{
const
Address
&
Src
)
{
AssemblerBuffer
::
EnsureCapacity
ensured
(
&
Buffer
);
AssemblerBuffer
::
EnsureCapacity
ensured
(
&
Buffer
);
emitUint8
(
0x66
);
emitUint8
(
0x66
);
emitAddrSizeOverridePrefix
();
emitAddrSizeOverridePrefix
();
emitRex
(
RexTypeIrrelevant
,
Src
,
Dst
);
emitRex
(
RexTypeIrrelevant
,
Src
,
Dst
);
emitUint8
(
0x0F
);
emitUint8
(
0x0F
);
if
(
Ty
==
IceType_v4i32
||
Ty
==
IceType_v4f32
)
{
if
(
DestTy
==
IceType_v8i16
)
{
emitUint8
(
0x38
);
emitUint8
(
0x38
);
emitUint8
(
0x2B
);
emitUint8
(
0x2B
);
}
else
if
(
Ty
==
IceType_v8i16
)
{
}
else
if
(
DestTy
==
IceType_v16i8
)
{
emitUint8
(
0x67
);
emitUint8
(
0x67
);
}
else
{
}
else
{
assert
(
false
&&
"Unexpected vector pack operand type"
);
assert
(
false
&&
"Unexpected vector pack operand type"
);
...
...
src/IceIntrinsics.h
View file @
ef8210d9
...
@@ -63,7 +63,9 @@ public:
...
@@ -63,7 +63,9 @@ public:
Trap
,
Trap
,
// The intrinsics below are not part of the PNaCl specification.
// The intrinsics below are not part of the PNaCl specification.
LoadSubVector
,
LoadSubVector
,
StoreSubVector
StoreSubVector
,
VectorPackSigned
,
VectorPackUnsigned
};
};
/// Operations that can be represented by the AtomicRMW intrinsic.
/// Operations that can be represented by the AtomicRMW intrinsic.
...
...
src/IceTargetLoweringX86BaseImpl.h
View file @
ef8210d9
...
@@ -4424,6 +4424,30 @@ void TargetX86Base<TraitsType>::lowerIntrinsicCall(
...
@@ -4424,6 +4424,30 @@ void TargetX86Base<TraitsType>::lowerIntrinsicCall(
}
}
return
;
return
;
}
}
case
Intrinsics
:
:
VectorPackSigned
:
{
Operand
*
Src0
=
Instr
->
getArg
(
0
);
Operand
*
Src1
=
Instr
->
getArg
(
1
);
Variable
*
Dest
=
Instr
->
getDest
();
auto
*
T
=
makeReg
(
Dest
->
getType
());
auto
*
Src0RM
=
legalize
(
Src0
,
Legal_Reg
|
Legal_Mem
);
auto
*
Src1RM
=
legalize
(
Src1
,
Legal_Reg
|
Legal_Mem
);
_movp
(
T
,
Src0RM
);
_packss
(
T
,
Src1RM
);
_movp
(
Dest
,
T
);
return
;
}
case
Intrinsics
:
:
VectorPackUnsigned
:
{
Operand
*
Src0
=
Instr
->
getArg
(
0
);
Operand
*
Src1
=
Instr
->
getArg
(
1
);
Variable
*
Dest
=
Instr
->
getDest
();
auto
*
T
=
makeReg
(
Dest
->
getType
());
auto
*
Src0RM
=
legalize
(
Src0
,
Legal_Reg
|
Legal_Mem
);
auto
*
Src1RM
=
legalize
(
Src1
,
Legal_Reg
|
Legal_Mem
);
_movp
(
T
,
Src0RM
);
_packus
(
T
,
Src1RM
);
_movp
(
Dest
,
T
);
return
;
}
default
:
// UnknownIntrinsic
default
:
// UnknownIntrinsic
Func
->
setError
(
"Unexpected intrinsic"
);
Func
->
setError
(
"Unexpected intrinsic"
);
return
;
return
;
...
...
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