Free Electron
Vector_gnu.h
Go to the documentation of this file.
1 /* Copyright (C) 2003-2021 Free Electron Organization
2  Any use of this software requires a license. If a valid license
3  was not distributed with this file, visit freeelectron.org. */
4 
5 /** @file */
6 
7 #ifndef __math_Vector_gnu_h__
8 #define __math_Vector_gnu_h__
9 
10 #if FE_SSE>=1 && FE_COMPILER==FE_GNU
11 
12 #ifdef __GNUC__
13 #if __GNUC__ > 3 || ( __GNUC__ == 3 && __GNUC_MINOR__ >= 4)
14 
15 #if FE_MEM_ALIGNMENT<16
16 #error FE_SSE requires FE_MEM_ALIGNMENT>=16
17 #endif
18 
19 namespace fe
20 {
21 
22 //typedef float v4sf __attribute__ ((mode(V4SF)));
23 typedef float v4sf __attribute__ ((vector_size (16)));
24 
25 namespace {
26 inline void v4sf_assertAlignment(const v4sf& value)
27 {
28 #if FE_CODEGEN<FE_PROFILE
29  if(long(&value)%16)
30  {
31  feX("v4sf_assertAlignment","v4sf misalignment");
32  }
33 #endif
34 }
35 inline void v4sf_setSame(v4sf& value,const F32 element)
36 {
37  reinterpret_cast<F32*>(&value)[0]=element;
38  value=__builtin_ia32_shufps(value,value,0x00);
39 }
40 } // namespace
41 
42 inline void v4sf_log(String text,const v4sf& value);
43 } // namespace fe
44 
45 #define FE_VDIM 3
46 #include "VectorNf_gnu.h"
47 #undef FE_VDIM
48 
49 #define FE_VDIM 4
50 #include "VectorNf_gnu.h"
51 #undef FE_VDIM
52 
53 namespace fe
54 {
55 namespace {
56 inline void v4sf_log(String text,const v4sf& value)
57 {
58  const F32* v=reinterpret_cast<const F32*>(&value);
59  feLog("%s %s\n",print(Vector<4,F32>(v)).c_str(),text.c_str());
60 }
61 } // namespace
62 } // namespace fe
63 
64 #endif /* __GNUC__ >= 3 && __GNUC_MINOR__ >= 4 */
65 #endif /* __GNUC__ */
66 
67 #endif // FE_SSE>=1 && FE_COMPILER==FE_GNU
68 
69 #endif /* __math_Vector_gnu_h__ */
const FESTRING_I8 * c_str(void) const
Return the contents of the 8-bit buffer cast as signed bytes.
Definition: String.h:352
kernel
Definition: namespace.dox:3