Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
SWIFTsim
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
SWIFT
SWIFTsim
Commits
532d70f4
Commit
532d70f4
authored
12 years ago
by
Pedro Gonnet
Browse files
Options
Downloads
Patches
Plain Diff
forgot this.
Former-commit-id: bc838556a2238bee1a083ad95218e7620c6a7119
parent
729ef708
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/vector.h
+71
-0
71 additions, 0 deletions
src/vector.h
with
71 additions
and
0 deletions
src/vector.h
0 → 100644
+
71
−
0
View file @
532d70f4
/*******************************************************************************
* This file is part of SWIFT.
* Coypright (c) 2012 Pedro Gonnet (pedro.gonnet@durham.ac.uk)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published
* by the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
******************************************************************************/
/* Have I already read this file? */
#ifndef VEC_MACRO
/* Include the header file with the intrinsics. */
#include
<immintrin.h>
/* Define the vector macro. */
#define VEC_MACRO(elcount, type) __attribute__((vector_size((elcount)*sizeof(type)))) type
/* So what will the vector size be? */
#ifdef __AVX__
#define VEC_SIZE 8
#define vec_load(a) _mm256_load_ps(a)
#define vec_set1(a) _mm256_set1_ps(a)
#define vec_sqrt(a) _mm256_sqrt_ps(a)
#define vec_rcp(a) _mm256_rcp_ps(a)
#define vec_rsqrt(a) _mm256_rsqrt_ps(a)
#define vec_ftoi(a) _mm256_cvttps_epi32(a)
#define vec_fmin(a,b) _mm256_min_ps(a,b)
#else
#define VEC_SIZE 4
#define vec_load(a) _mm_load_ps(a)
#define vec_set1(a) _mm_set1_ps(a)
#define vec_sqrt(a) _mm_sqrt_ps(a)
#define vec_rcp(a) _mm_rcp_ps(a)
#define vec_rsqrt(a) _mm_rsqrt_ps(a)
#define vec_ftoi(a) _mm_cvttps_epi32(a)
#define vec_fmin(a,b) _mm_min_ps(a,b)
#endif
// #ifdef __AVX__
// #define VEC_SIZE 8
// #define VEC_FLOAT VEC_MACRO(8,float)
// #define VEC_DOUBLE VEC_MACRO(4,double)
// #define VECTORIZE
// #elif defined(__SSE2__)
// #define VEC_SIZE 4
// #define VEC_FLOAT VEC_MACRO(4,float)
// #define VEC_DOUBLE VEC_MACRO(2,double)
// #define VECTORIZE
// #endif
/* Define the composite types for element access. */
#ifdef VECTORIZE
typedef
union
{
VEC_MACRO
(
VEC_SIZE
,
float
)
v
;
VEC_MACRO
(
VEC_SIZE
,
int
)
m
;
float
f
[
VEC_SIZE
];
int
i
[
VEC_SIZE
];
}
vector
;
#endif
#endif
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