Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
pew
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Deploy
Releases
Model registry
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Graphics
pew
Commits
7ac1274e
Commit
7ac1274e
authored
2 years ago
by
Evy Storozhenko
Browse files
Options
Downloads
Patches
Plain Diff
updated intrinsics
parent
c222159c
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/pew/vector/intrinsic.hpp
+8
-8
8 additions, 8 deletions
src/pew/vector/intrinsic.hpp
with
8 additions
and
8 deletions
src/pew/vector/intrinsic.hpp
+
8
−
8
View file @
7ac1274e
#ifndef PEW_INTRINSIC
#ifndef PEW_INTRINSIC
#define PEW_INTRINSIC
#define PEW_INTRINSIC
#include
<cstdint>
#include
<emmintrin.h>
#include
<emmintrin.h>
#include
<immintrin.h>
#include
<immintrin.h>
#include
<smmintrin.h>
#include
<smmintrin.h>
...
@@ -8,6 +9,7 @@
...
@@ -8,6 +9,7 @@
#include
<xmmintrin.h>
#include
<xmmintrin.h>
namespace
pew
{
namespace
pew
{
using
imm
=
uint8_t
;
template
<
typename
T
>
template
<
typename
T
>
struct
intrinsic
;
struct
intrinsic
;
...
@@ -187,11 +189,10 @@ namespace pew {
...
@@ -187,11 +189,10 @@ namespace pew {
return
_mm_sub_ps
(
left
,
right
);
return
_mm_sub_ps
(
left
,
right
);
}
}
inline
static
float
template
<
imm
mask
=
0xff
>
inline
static
auto
dot
(
const
type
&
left
,
const
type
&
right
)
{
dot
(
const
type
&
left
,
const
type
&
right
)
{
alignas
(
alignment
)
float
arr
[
4
];
return
_mm_dp_ps
(
left
,
right
,
mask
);
store
(
arr
,
mul
(
left
,
right
));
return
arr
[
0
]
+
arr
[
1
]
+
arr
[
2
];
}
}
inline
static
auto
inline
static
auto
...
@@ -200,10 +201,9 @@ namespace pew {
...
@@ -200,10 +201,9 @@ namespace pew {
}
}
inline
static
auto
inline
static
auto
abs
(
const
type
&
abs
)
{
abs
(
const
type
&
reg
)
{
alignas
(
alignment
)
float
arr
[
4
];
auto
mask
=
_mm_cmplt_ps
(
reg
,
set
(
0
));
store
(
arr
,
abs
);
return
_mm_blendv_ps
(
reg
,
sign
(
reg
),
mask
);
return
set
(
std
::
abs
(
arr
[
0
]),
std
::
abs
(
arr
[
1
]),
std
::
abs
(
arr
[
2
]));
}
}
};
};
}
// namespace pew
}
// namespace pew
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment