1#ifndef _NSEEL_GLUE_X86_64_SSE_H_
2#define _NSEEL_GLUE_X86_64_SSE_H_
6#define GLUE_PREFER_NONFP_DV_ASSIGNS
7#define GLUE_HAS_FPREG2 1
11 0xf2, 0x0f, 0x10, 0x0c, 0x24,
12 0x48, 0x81, 0xC4, 16, 0,0,0,
16#define GLUE_MAX_SPILL_REGS 4
19 #define GLUE_SAVE_TO_SPILL_SIZE(x) (4 + ((x)>1))
20 #define GLUE_RESTORE_SPILL_TO_FPREG2_SIZE(x) (4 + ((x)>1))
26 *(
unsigned int *)
b = 0xce100ff2 + (ws<<24);
31 *(
unsigned int *)
b = 0x100f41f2;
32 ((
unsigned char *)
b)[4] = 0xc8 + (ws-2);
39 *(
unsigned int *)
b = 0xf0100ff2 + (ws<<27);
44 *(
unsigned int *)
b = 0x100f44f2;
45 ((
unsigned char *)
b)[4] = 0xc0 + ((ws-2)<<3);
52#define GLUE_VALIDATE_SPILLS
55#ifdef GLUE_VALIDATE_SPILLS
57static unsigned char save_validate[]={
590xf2,0x0f,0x11,0x04,0x24,
600x66,0x48,0x0f,0x6e,0xe4,
63static unsigned char restore_validate[] = {
64 0xf2, 0x0f, 0x10, 0xcc,
65 0x66, 0x48, 0x0f, 0x6e, 0xdc,
66 0x66, 0x0f, 0x2e, 0xd9,
69 0xf2, 0x0f, 0x10, 0x0c, 0x24,
70 0x48, 0x83, 0xc4, 0x10,
72 #define GLUE_SAVE_TO_SPILL_SIZE(x) (sizeof(save_validate))
73 #define GLUE_RESTORE_SPILL_TO_FPREG2_SIZE(x) (sizeof(restore_validate))
77 #define GLUE_SAVE_TO_SPILL_SIZE(x) (4)
78 #define GLUE_RESTORE_SPILL_TO_FPREG2_SIZE(x) (4)
84#ifdef GLUE_VALIDATE_SPILLS
86 memcpy(
p,restore_validate,
sizeof(restore_validate));
89 *(
unsigned int *)
b = 0xcc100ff2 + (ws<<24);
94#ifdef GLUE_VALIDATE_SPILLS
96 memcpy(
p,save_validate,
sizeof(save_validate));
97 p[
sizeof(save_validate)-1] += ws<<3;
99 *(
unsigned int *)
b = 0xe0100ff2 + (ws<<27);
104#define GLUE_MAX_FPSTACK_SIZE 0
105#define GLUE_JMP_SET_OFFSET(endOfInstruction,offset) (((int *)(endOfInstruction))[-1] = (int) (offset))
112#define GLUE_FUNC_ENTER_SIZE 0
113#define GLUE_FUNC_LEAVE_SIZE 0
121 #define GLUE_MOV_PX_DIRECTVALUE_SIZE 10
122 #define GLUE_MOV_PX_DIRECTVALUE_TOSTACK_SIZE 14
123 #define GLUE_MOV_PX_DIRECTVALUE_TOFPREG2_SIZE 14
125 const static unsigned short tab[3] =
131 unsigned short *
bb = (
unsigned short *)
b;
134 if (wr == -2) *(
unsigned int *)(
bb + 4) = 0x08100ff2;
135 else if (wr == -1) *(
unsigned int *)(
bb + 4) = 0x00100ff2;
140 #define GLUE_STORE_P1_TO_STACK_AT_OFFS_SIZE(x) 8
143 ((
unsigned char *)
b)[0] = 0x48;
144 ((
unsigned char *)
b)[1] = 0x89;
145 ((
unsigned char *)
b)[2] = 0x84;
146 ((
unsigned char *)
b)[3] = 0x24;
147 *(
int *)((
unsigned char *)
b+4) = offs;
150 #define GLUE_MOVE_PX_STACKPTR_SIZE 3
155 { 0x48, 0x89, 0xe0 },
156 { 0x48, 0x89, 0xe7 },
157 { 0x48, 0x89, 0xe1 },
162 #define GLUE_MOVE_STACK_SIZE 7
165 ((
unsigned char *)
b)[0] = 0x48;
166 ((
unsigned char *)
b)[1] = 0x81;
169 ((
unsigned char *)
b)[2] = 0xEC;
170 *(
int *)((
char*)
b+3) = -amt;
174 ((
unsigned char *)
b)[2] = 0xc4;
175 *(
int *)((
char*)
b+3) = amt;
179 #define GLUE_POP_PX_SIZE 2
201 *buf++ = 0x48; *buf++ = 0xB9; *(
void **) buf = destptr; buf+=8;
202 *buf++ = 0x8f; *buf++ = 0x01;
212 *buf++ = 0x48; *buf++ = 0xB9; *(
void **) buf = destptr; buf+=8;
213 *buf++ = 0x48; *buf++ = 0x8B; *buf++ = 0x38;
214 *buf++ = 0x48; *buf++ = 0x89; *buf++ = 0x39;
226 *(
void **) buf = destptr; buf+=8;
237 #define GLUE_SET_PX_FROM_P1_SIZE 3
249 #define GLUE_POP_FPSTACK_SIZE 0
253 0x48, 0x81, 0xEC, 16, 0,0,0,
254 0xf2, 0x0f, 0x11, 0x04, 0x24,
258 0xf2, 0x0f, 0x11, 0x06,
259 0x48, 0x81, 0xC6, 8, 0,0,0,
262 #define GLUE_SET_PX_FROM_WTP_SIZE 3
273 #define GLUE_PUSH_VAL_AT_PX_TO_FPSTACK_SIZE 4
277 {0xf2, 0x0f, 0x10, 0x00},
278 {0xf2, 0x0f, 0x10, 0x07},
279 {0xf2, 0x0f, 0x10, 0x01},
284#define GLUE_POP_FPSTACK_TO_WTP_TO_PX_SIZE (GLUE_SET_PX_FROM_WTP_SIZE + sizeof(GLUE_POP_FPSTACK_TO_WTP))
303 return 2+
sizeof(
void *);
308#define GLUE_CALL_CODE(bp, cp, rt) do { \
309 if (h->compile_flags&NSEEL_CODE_COMPILE_FLAG_NOFPSTATE) eel_callcode64_fast(cp, rt); \
310 else eel_callcode64(cp, rt);\
312#define GLUE_TABPTR_IGNORED
317 INT_PTR scan = 0xFEFEFEFEFEFEFEFE;
320 return (
unsigned char *) (((
INT_PTR*)
p)+1);
323#define INT_TO_LECHARS(x) ((x)&0xff),(((x)>>8)&0xff), (((x)>>16)&0xff), (((x)>>24)&0xff)
325#define GLUE_INLINE_LOOPS
328 0xf2, 0x48, 0x0f, 0x2c, 0xc8,
329 0x48, 0x81, 0xf9, 1,0,0,0,
333#if NSEEL_LOOPFUNC_SUPPORT_MAXLEN > 0
334#define GLUE_LOOP_CLAMPCNT_SIZE sizeof(GLUE_LOOP_CLAMPCNT)
337 0x0F, 0x8C, 10,0,0,0,
341#define GLUE_LOOP_CLAMPCNT_SIZE 0
342#define GLUE_LOOP_CLAMPCNT ""
345#define GLUE_LOOP_BEGIN_SIZE sizeof(GLUE_LOOP_BEGIN)
359#if NSEEL_LOOPFUNC_SUPPORT_MAXLEN > 0
363#define GLUE_WHILE_SETUP_SIZE sizeof(GLUE_WHILE_SETUP)
379#define GLUE_WHILE_SETUP ""
380#define GLUE_WHILE_SETUP_SIZE 0
381#define GLUE_WHILE_END_NOJUMP
412#define GLUE_INVSQRT_NEEDREPL &negativezeropointfive, &onepointfive,
417 static const unsigned char new_sig[8] = { 0x89, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x00 };
419 while (memcmp((
char*)
fn + sz,new_sig,
sizeof(new_sig))) sz++;
424#define GLUE_HAS_FUSE 1
428 const int is_sse_op = right_size == 4 &&
436#ifndef GLUE_VALIDATE_SPILLS
442 if (left_size>=sz && !memcmp(
code-sz,tmp,sz))
456 if (
code[-28] == 0x48 &&
code[-27] == 0xb8 &&
457 *(
int *)(
code - 18) == 0x08100ff2 &&
458 code[-14] == 0x48 &&
code[-13] == 0xb8 &&
459 *(
int *)(
code - 4) == 0x00100ff2
464 unsigned char opc[3];
470#define PTR_32_OK(x) ((x) == (INT_PTR)(int)(x))
474 code[wrpos++] = 0x48;
475 code[wrpos++] = 0xb8;
483 code[wrpos++] = 0x48;
484 code[wrpos++] = 0xbf;
491 *(
int *)(
code+wrpos) = 0x00100ff2;
497 code[wrpos++] = 0xf2;
498 code[wrpos++] = 0x41;
499 code[wrpos++] = 0x0f;
500 code[wrpos++] = 0x10;
501 code[wrpos++] = 0x84;
502 code[wrpos++] = 0x24;
503 *(
int *)(
code+wrpos) = (
int)c2offs;
512 *(
int *)(
code+wrpos) = 0x0f100ff2;
518 code[wrpos++] = 0xf2;
519 code[wrpos++] = 0x41;
520 code[wrpos++] = 0x0f;
521 code[wrpos++] = 0x10;
522 code[wrpos++] = 0x8c;
523 code[wrpos++] = 0x24;
524 *(
int *)(
code+wrpos) = (
int)c1offs;
527 if (wrpos<0) memmove(
code+wrpos,
code,right_size);
535 code[wrpos+3] = 0x07;
541 code[wrpos++] = opc[0];
542 code[wrpos++] = 0x41;
543 code[wrpos++] = opc[1];
544 code[wrpos++] = opc[2];
545 code[wrpos++] = 0x84;
546 code[wrpos++] = 0x24;
547 *(
int *)(
code+wrpos) = (
int)c1offs;
550 return wrpos - right_size;
553 if ((fuse_flags&1) && left_size >= 14)
555 if (
code[-14] == 0x48 &&
code[-13] == 0xb8 &&
556 *(
int *)(
code - 4) == 0x00100ff2)
565 code[wrpos++] = 0xf2;
566 code[wrpos++] = 0x41;
567 code[wrpos++] = 0x0f;
568 code[wrpos++] = 0x10;
569 code[wrpos++] = 0x84;
570 code[wrpos++] = 0x24;
571 *(
int *)(
code+wrpos) = (
int)c1;
573 if (wrpos<0) memmove(
code+wrpos,
code,right_size);
579 if (left_size == 20 && right_size == 9 &&
580 code[-20]==0x48 &&
code[-19] == 0xbf &&
584 static unsigned char assign_copy[9] = { 0x48, 0x8b, 0x10,
588 if (!memcmp(
code,assign_copy,9))
597 code[wrpos++] = 0x48;
598 code[wrpos++] = 0xbf;
603 code[wrpos++] = 0x48;
604 code[wrpos++] = 0xb8;
611 code[wrpos++] = 0x49;
612 code[wrpos++] = 0x8b;
613 code[wrpos++] = 0x94;
614 code[wrpos++] = 0x24;
620 code[wrpos++] = 0x48;
621 code[wrpos++] = 0x8b;
622 code[wrpos++] = 0x17;
625 code[wrpos++] = 0x48;
626 code[wrpos++] = 0x89;
627 code[wrpos++] = 0x10;
629 return wrpos - right_size;
G bb
Definition inflate.c:1057
unsigned v[N_MAX]
Definition inflate.c:1584
static void c2(register WDL_FFT_COMPLEX *a)
Definition fft.c:270
static const unsigned int GLUE_PUSH_P1PTR_AS_VALUE[]
Definition glue_aarch64.h:183
#define GLUE_SET_PX_FROM_P1_SIZE
Definition glue_aarch64.h:176
static const unsigned int GLUE_POP_FPSTACK_TOSTACK[]
Definition glue_aarch64.h:303
static const unsigned int GLUE_POP_FPSTACK[1]
Definition glue_aarch64.h:301
#define GLUE_SET_PX_FROM_WTP_SIZE
Definition glue_aarch64.h:281
#define GLUE_MOVE_PX_STACKPTR_SIZE
Definition glue_aarch64.h:143
static const unsigned int GLUE_FUNC_LEAVE[1]
Definition glue_aarch64.h:106
static const unsigned int GLUE_POP_FPSTACK_TO_WTP[]
Definition glue_aarch64.h:308
#define GLUE_PUSH_VAL_AT_PX_TO_FPSTACK_SIZE
Definition glue_aarch64.h:312
static const unsigned int GLUE_JMP_NC[]
Definition glue_aarch64.h:72
static unsigned int GLUE_POP_STACK_TO_FPREG2[]
Definition glue_aarch64.h:46
static const unsigned int GLUE_JMP_IF_P1_NZ[]
Definition glue_aarch64.h:79
static const unsigned int GLUE_FUNC_ENTER[2]
Definition glue_aarch64.h:104
static const unsigned int GLUE_SET_P1_Z[]
Definition glue_aarch64.h:325
static const unsigned int GLUE_RET[]
Definition glue_aarch64.h:108
static const unsigned int GLUE_JMP_IF_P1_Z[]
Definition glue_aarch64.h:74
static const unsigned int GLUE_COPY_FPSTACK_TO_FPREG2[]
Definition glue_aarch64.h:45
#define GLUE_POP_PX_SIZE
Definition glue_aarch64.h:170
static const unsigned int GLUE_PUSH_P1[1]
Definition glue_aarch64.h:118
static const unsigned int GLUE_SET_P1_NZ[]
Definition glue_aarch64.h:326
#define GLUE_WHILE_SETUP
Definition glue_port.h:185
#define GLUE_LOOP_BEGIN
Definition glue_port.h:175
#define GLUE_LOOP_CLAMPCNT
Definition glue_port.h:177
static EEL_F negativezeropointfive
Definition glue_x86.h:508
static EEL_F onepointfive
Definition glue_x86.h:509
static const unsigned char GLUE_FLDZ[]
Definition glue_x86.h:504
#define GLUE_LOOP_LOADCNT
Definition glue_x86.h:406
static const unsigned char GLUE_WHILE_CHECK_RV[]
Definition glue_x86.h:493
static const unsigned char GLUE_WHILE_END[]
Definition glue_x86.h:486
static const unsigned char GLUE_LOOP_END[]
Definition glue_x86.h:447
static const unsigned char GLUE_WHILE_BEGIN[]
Definition glue_x86.h:482
static void GLUE_MOVE_STACK(void *b, int amt)
Definition glue_x86_64_sse.h:163
static void GLUE_SET_PX_FROM_WTP(void *b, int wv)
Definition glue_x86_64_sse.h:263
#define GLUE_RESTORE_SPILL_TO_FPREG2_SIZE(x)
Definition glue_x86_64_sse.h:78
static void GLUE_POP_FPSTACK_TO_WTP_TO_PX(unsigned char *buf, int wv)
Definition glue_x86_64_sse.h:285
static void GLUE_RESTORE_SPILL_TO_FPREG2(void *b, int ws)
Definition glue_x86_64_sse.h:82
static void * GLUE_realAddress(void *fn, int *size)
Definition glue_x86_64_sse.h:415
static int GLUE_RESET_WTP(unsigned char *out, void *ptr)
Definition glue_x86_64_sse.h:294
static int GLUE_POP_VALUE_TO_ADDR(unsigned char *buf, void *destptr)
Definition glue_x86_64_sse.h:197
static void GLUE_SAVE_TO_SPILL(void *b, int ws)
Definition glue_x86_64_sse.h:92
static void GLUE_MOVE_PX_STACKPTR_GEN(void *b, int wv)
Definition glue_x86_64_sse.h:151
static void GLUE_MOV_PX_DIRECTVALUE_GEN(void *b, INT_PTR v, int wr)
Definition glue_x86_64_sse.h:124
static int GLUE_FUSE(compileContext *ctx, unsigned char *code, int left_size, int right_size, int fuse_flags, int spill_reg)
Definition glue_x86_64_sse.h:425
void eel_callcode64(INT_PTR code, INT_PTR ram_tab)
static void GLUE_STORE_P1_TO_STACK_AT_OFFS(void *b, int offs)
Definition glue_x86_64_sse.h:141
static void GLUE_POP_PX(void *b, int wv)
Definition glue_x86_64_sse.h:180
static int GLUE_POP_FPSTACK_TO_PTR(unsigned char *buf, void *destptr)
Definition glue_x86_64_sse.h:220
static unsigned char * EEL_GLUE_set_immediate(void *_p, INT_PTR newv)
Definition glue_x86_64_sse.h:314
#define INT_TO_LECHARS(x)
Definition glue_x86_64_sse.h:323
static void GLUE_PUSH_VAL_AT_PX_TO_FPSTACK(void *b, int wv)
Definition glue_x86_64_sse.h:274
static void GLUE_SET_PX_FROM_P1(void *b, int wv)
Definition glue_x86_64_sse.h:238
void eel_callcode64_fast(INT_PTR code, INT_PTR ram_tab)
static int GLUE_COPY_VALUE_AT_P1_TO_PTR(unsigned char *buf, void *destptr)
Definition glue_x86_64_sse.h:208
float out
Definition lilv_test.c:1461
struct _compileContext compileContext
#define NSEEL_LOOPFUNC_SUPPORT_MAXLEN
Definition ns-eel.h:209
struct _compileContext::@171017327167146311274025377202307266252366150176 * ram_state
EEL_F * blocks[NSEEL_RAM_BLOCKS]
Definition ns-eel-int.h:242
const char const char const char const char char * fn
Definition swell-functions.h:168
uintptr_t UINT_PTR
Definition swell-types.h:43
intptr_t INT_PTR
Definition swell-types.h:42
uch * p
Definition crypt.c:594
memcpy(hh, h, RAND_HEAD_LEN)
typedef int(UZ_EXP MsgFn)()
#define wdl_max(x, y)
Definition wdltypes.h:106