daily update on 20230804 by nitload youmu
This commit is contained in:
@@ -6,8 +6,9 @@
|
||||
#include <stdalign.h>
|
||||
|
||||
#include <xmmintrin.h>
|
||||
#include <pmmintrin.h>
|
||||
|
||||
STGSHARPGRAPHIC_API __m128* __cdecl load(float x, float y, float z, float w)
|
||||
SSGC_API __m128* __cdecl load(float x, float y, float z, float w)
|
||||
{
|
||||
float array[4] = {x,y,z,w};
|
||||
__m128* ptr = _aligned_malloc(sizeof(__m128),16);
|
||||
@@ -23,7 +24,7 @@ STGSHARPGRAPHIC_API __m128* __cdecl load(float x, float y, float z, float w)
|
||||
}
|
||||
}
|
||||
|
||||
STGSHARPGRAPHIC_API __m128* __cdecl addps(__m128* ptr1, __m128* ptr2)
|
||||
SSGC_API __m128* __cdecl addps(__m128* ptr1, __m128* ptr2)
|
||||
{
|
||||
|
||||
__m128* ret = _aligned_malloc(sizeof(__m128*),16);
|
||||
@@ -40,7 +41,7 @@ STGSHARPGRAPHIC_API __m128* __cdecl addps(__m128* ptr1, __m128* ptr2)
|
||||
|
||||
}
|
||||
|
||||
STGSHARPGRAPHIC_API __m128* __cdecl subps(__m128* ptr1, __m128* ptr2)
|
||||
SSGC_API __m128* __cdecl subps(__m128* ptr1, __m128* ptr2)
|
||||
{
|
||||
__m128* ret = _aligned_malloc(sizeof(__m128*), 16);
|
||||
|
||||
@@ -55,7 +56,7 @@ STGSHARPGRAPHIC_API __m128* __cdecl subps(__m128* ptr1, __m128* ptr2)
|
||||
}
|
||||
}
|
||||
|
||||
STGSHARPGRAPHIC_API __m128* __cdecl mulps_const(__m128* ptr, float value)
|
||||
SSGC_API __m128* __cdecl mulps_const(__m128* ptr, float value)
|
||||
{
|
||||
float c[4] = { value, value, value, value };
|
||||
__m128* ret = _aligned_malloc(sizeof(__m128),16);
|
||||
@@ -73,7 +74,7 @@ STGSHARPGRAPHIC_API __m128* __cdecl mulps_const(__m128* ptr, float value)
|
||||
}
|
||||
}
|
||||
|
||||
STGSHARPGRAPHIC_API __m128* __cdecl mulps(__m128* ptr1, __m128* ptr2)
|
||||
SSGC_API __m128* __cdecl mulps(__m128* ptr1, __m128* ptr2)
|
||||
{
|
||||
__m128* ret = _aligned_malloc(sizeof(__m128), 16);
|
||||
|
||||
@@ -88,9 +89,56 @@ STGSHARPGRAPHIC_API __m128* __cdecl mulps(__m128* ptr1, __m128* ptr2)
|
||||
}
|
||||
}
|
||||
|
||||
SSGC_API float __cdecl mulps_sum(__m128* ptr1, __m128* ptr2)
|
||||
{
|
||||
__m128 ret = _mm_mul_ps(*ptr1,*ptr2);
|
||||
ret = _mm_hadd_ps(ret,ret);
|
||||
ret = _mm_hadd_ps(ret,ret);
|
||||
return *(float*)&ret;
|
||||
}
|
||||
|
||||
SSGC_API __m128* __cdecl divps_const(__m128* ptr, float value)
|
||||
{
|
||||
|
||||
float c[4] = { value, value, value, value };
|
||||
__m128* ret = _aligned_malloc(sizeof(__m128), 16);
|
||||
|
||||
__m128 valueVec = _mm_loadu_ps(&c);
|
||||
|
||||
if (NULL != ret)
|
||||
{
|
||||
*ret = _mm_div_ps(*ptr, valueVec);
|
||||
return ret;
|
||||
}
|
||||
else
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
SSGC_API __m128* __cdecl divps(__m128* ptr1, __m128* ptr2)
|
||||
{
|
||||
__m128* ret = _aligned_malloc(sizeof(__m128), 16);
|
||||
|
||||
if (NULL != ret)
|
||||
{
|
||||
*ret = _mm_div_ps(*ptr1, *ptr2);
|
||||
return ret;
|
||||
}
|
||||
else
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
STGSHARPGRAPHIC_API void __cdecl deinitM128(__m128* ptr)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
SSGC_API void __cdecl deinitM128(__m128* ptr)
|
||||
{
|
||||
free(ptr);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user