- Main Page
- Modules
- Namespaces
- Classes
- Files

- File List

# intrinsic_exponential.hpp

    00001
    00002 // OpenGL Mathematics Copyright (c) 2005 - 2011 G-Truc Creation (www.g-truc.net)
    00004 // Created : 2009-05-11
    00005 // Updated : 2009-05-11
    00006 // Licence : This source is under MIT License
    00007 // File    : glm/core/intrinsic_exponential.hpp
    00009
    00010 #ifndef glm_detail_intrinsic_exponential
    00011 #define glm_detail_intrinsic_exponential
    00012
    00013 #include "setup.hpp"
    00014
    00015 #if((GLM_ARCH & GLM_ARCH_SSE2) != GLM_ARCH_SSE2)
    00016 #       error "SSE2 instructions not supported or enabled"
    00017 #else
    00018
    00019 namespace glm{
    00020 namespace detail
    00021 {
    00022 /*
    00023 inline __m128 sse_rsqrt_nr_ss(__m128 const x)
    00024 {
    00025         __m128 recip = _mm_rsqrt_ss( x );  // "estimate" opcode
    00026         const static __m128 three = { 3, 3, 3, 3 }; // aligned consts for fast load
    00027         const static __m128 half = { 0.5,0.5,0.5,0.5 };
    00028         __m128 halfrecip = _mm_mul_ss( half, recip );
    00029         __m128 threeminus_xrr = _mm_sub_ss( three, _mm_mul_ss( x, _mm_mul_ss ( recip, recip ) ) );
    00030         return _mm_mul_ss( halfrecip, threeminus_xrr );
    00031 }
    00032
    00033 inline __m128 sse_normalize_fast_ps(  float * RESTRICT vOut, float * RESTRICT vIn )
    00034 {
    00035         __m128 x = _mm_load_ss(&vIn[0]);
    00036         __m128 y = _mm_load_ss(&vIn[1]);
    00037         __m128 z = _mm_load_ss(&vIn[2]);
    00038
    00039         const __m128 l =  // compute x*x + y*y + z*z
    00040                 _mm_add_ss(
    00041                  _mm_add_ss( _mm_mul_ss(x,x),
    00042                              _mm_mul_ss(y,y)
    00043                             ),
    00044                  _mm_mul_ss( z, z )
    00045                 );
    00046
    00047
    00048         const __m128 rsqt = _mm_rsqrt_nr_ss( l );
    00049         _mm_store_ss( &vOut[0] , _mm_mul_ss( rsqt, x ) );
    00050         _mm_store_ss( &vOut[1] , _mm_mul_ss( rsqt, y ) );
    00051         _mm_store_ss( &vOut[2] , _mm_mul_ss( rsqt, z ) );
    00052
    00053         return _mm_mul_ss( l , rsqt );
    00054 }
    00055 */
    00056 }//namespace detail
    00057 }//namespace glm
    00058
    00059 #endif//GLM_ARCH
    00060 #endif//glm_detail_intrinsic_exponential