fix things

git-svn-id: http://svn2.nishi.boats/svn/milsko/trunk@542 b9cfdab3-6d41-4d17-bbe4-086880011989
This commit is contained in:
NishiOwO
2025-11-01 03:59:45 +00:00
parent 957db7129b
commit 0626cb3527
12 changed files with 153 additions and 343 deletions

View File

@@ -1,7 +1,7 @@
/* $Id$ */
#include <Mw/LowLevelMath.h>
#include "math.h"
#include <assert.h>
#include <math.h>
#include "math_internal.h"
static void default_add_u8(MwLLVec* a, MwLLVec* b, MwLLVec* out) {
out->un.u8.a = a->un.u8.a + b->un.u8.a;
@@ -407,6 +407,6 @@ static MwLLMathVTable* defaultMultiTable[_MwLLVecType_Max] = {
&table_i32, // _MwLLVecTypeI32x2
};
MwLLMathVTable** default_multi_table() {
MwLLMathVTable** default_multi_table(void) {
return defaultMultiTable;
}

View File

@@ -1,11 +1,7 @@
/* $Id$ */
#include <Mw/LowLevelMath.h>
#include <assert.h>
#include <stdarg.h>
#include <stdio.h>
#include <unistd.h>
#include "math.h"
#include "Mw/BaseTypes.h"
#include "x86intrin.h"
#include "math_internal.h"
MwLLVec _MwLLVecCreateGeneric(MwLLVecType ty, ...) {
MwLLVecUnion un;
@@ -43,14 +39,23 @@ switch(ty) {
}
static MwBool hasMMX(void) {
MwU32 eax = 1;
MwU32 ebx, edx;
MwU32 _eax = 1;
MwU32 _ebx, _edx;
#ifdef __WATCOMC__
__asm {
cpuid
mov _eax, eax
mov _ebx, ebx
mov _edx, edx
}
#else
__asm__ __volatile__(
"cpuid" : "=a"(eax), "=b"(ebx), "=d"(edx)
"cpuid" : "=a"(_eax), "=b"(_ebx), "=d"(_edx)
: "a"(1));
#endif
return (edx & (1 << 23)) == (1 << 23);
return (_edx & (1 << 23)) == (1 << 23);
}
static MwLLMathVTable** mwLLMultiTable;

View File

@@ -22,7 +22,7 @@ struct _MwLLMathVTable {
typedef struct _MwLLMathVTable MwLLMathVTable;
MwLLMathVTable** default_multi_table();
MwLLMathVTable** default_multi_table(void);
void mmx_apply(MwLLMathVTable**);
#endif

View File

@@ -1,13 +1,13 @@
/* $Id$ */
#include <Mw/LowLevelMath.h>
#include "math.h"
#include <assert.h>
#include "math_internal.h"
#include <mmintrin.h>
#include <stdio.h>
#include <x86intrin.h>
#define DO_MMX_INTRINSIC(intrin, _ty, _rty, _tyn) \
__m64 m = intrin(*(__m64*)&a->un._ty, *(__m64*)&b->un._ty); \
out->un._rty = *(struct _tyn*)&m;
struct _tyn* t = (struct _tyn*)&m; \
out->un._rty = *t;
static void mmx_add_u8(MwLLVec* a, MwLLVec* b, MwLLVec* out) {
DO_MMX_INTRINSIC(_m_paddusb, u8, u8, _MwLLVecDataU8x8);

View File

@@ -1,3 +1,4 @@
/* $Id$ */
#if defined(__WATCOMC__) || defined(__i386__) || defined(__amd64__)
#include "mmx.c"
#else