aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Pall <mike>2009-12-21 20:11:02 +0100
committerMike Pall <mike>2009-12-21 20:11:02 +0100
commitab02f069aae80ec6772bf7e6b2856c50922d92ee (patch)
tree541de5ad1c61e95545f60dec671c93db87a74d69
parent64a4528cac0bc0d136d935882bf7cf389d7d8130 (diff)
downloadluajit-ab02f069aae80ec6772bf7e6b2856c50922d92ee.tar.gz
luajit-ab02f069aae80ec6772bf7e6b2856c50922d92ee.tar.bz2
luajit-ab02f069aae80ec6772bf7e6b2856c50922d92ee.zip
Add SSE2 variants of basic arithmetic ops in interpreter.
-rw-r--r--src/buildvm_x86.dasc353
-rw-r--r--src/buildvm_x86.h1073
2 files changed, 939 insertions, 487 deletions
diff --git a/src/buildvm_x86.dasc b/src/buildvm_x86.dasc
index 960afa1d..b220c58f 100644
--- a/src/buildvm_x86.dasc
+++ b/src/buildvm_x86.dasc
@@ -322,6 +322,40 @@
322|.macro fdup; fld st0; .endmacro 322|.macro fdup; fld st0; .endmacro
323|.macro fpop1; fstp st1; .endmacro 323|.macro fpop1; fstp st1; .endmacro
324| 324|
325|// Synthesize SSE FP constants.
326|.macro sseconst_sign, reg, tmp // Synthesize sign mask.
327|.if X64
328| mov64 tmp, U64x(80000000,00000000); movd reg, tmp
329|.else
330| mov tmp, 0x80000000; movd xmm1, tmp; pshufd reg, reg, 0x51
331|.endif
332|.endmacro
333|
334|.macro sseconst_abs, reg, tmp // Synthesize abs mask.
335|.if X64
336| mov64 tmp, U64x(7fffffff,ffffffff); movd reg, tmp
337|.else
338| pxor reg, reg; pcmpeqd reg, reg; psrlq reg, 1
339|.endif
340|.endmacro
341|
342|.macro sseconst_1, reg, tmp // Synthesize 1.0.
343|.if X64
344| mov64 tmp, U64x(3ff00000,00000000)
345| movd reg, tmp
346|.else
347| mov tmp, 0x3ff00000; movd reg, tmp; pshufd reg, reg, 0x51
348|.endif
349|.endmacro
350|
351|.macro sseconst_2p52, reg, tmp // Synthesize 2^52.
352|.if X64
353| mov64 tmp, U64x(43300000,00000000); movd reg, tmp
354|.else
355| mov tmp, 0x43300000; movd reg, tmp; pshufd reg, reg, 0x51
356|.endif
357|.endmacro
358|
325|// Move table write barrier back. Overwrites reg. 359|// Move table write barrier back. Overwrites reg.
326|.macro barrierback, tab, reg 360|.macro barrierback, tab, reg
327| and byte tab->marked, cast_byte(~LJ_GC_BLACK) // black2gray(tab) 361| and byte tab->marked, cast_byte(~LJ_GC_BLACK) // black2gray(tab)
@@ -334,7 +368,7 @@
334 368
335/* Generate subroutines used by opcodes and other parts of the VM. */ 369/* Generate subroutines used by opcodes and other parts of the VM. */
336/* The .code_sub section should be last to help static branch prediction. */ 370/* The .code_sub section should be last to help static branch prediction. */
337static void build_subroutines(BuildCtx *ctx, int cmov) 371static void build_subroutines(BuildCtx *ctx, int cmov, int sse)
338{ 372{
339 |.code_sub 373 |.code_sub
340 | 374 |
@@ -2454,21 +2488,51 @@ static void build_subroutines(BuildCtx *ctx, int cmov)
2454 | vm_round 0x0c00, 0xffff 2488 | vm_round 0x0c00, 0xffff
2455 | 2489 |
2456 |// FP modulo x%y. Called by BC_MOD* and vm_arith. 2490 |// FP modulo x%y. Called by BC_MOD* and vm_arith.
2457 |// Args/ret on x87 stack (y on top). No xmm registers modified.
2458 |// Caveat: needs 3 slots on x87 stack! RC (eax) modified!
2459 |->vm_mod: 2491 |->vm_mod:
2460 | fld st1 2492 if (sse) {
2461 | fdiv st1 2493 |// Args in xmm0/xmm1, return value in xmm0.
2462 | fnstcw word [esp+4] 2494 |// Caveat: xmm0-xmm5 and RC (eax) modified!
2463 | mov ax, 0x0400 2495 | movaps xmm5, xmm0
2464 | or ax, [esp+4] 2496 | divsd xmm0, xmm1
2465 | and ax, 0xf7ff 2497 | sseconst_abs xmm2, RDa
2466 | mov [esp+6], ax 2498 | sseconst_2p52 xmm3, RDa
2467 | fldcw word [esp+6] 2499 | movaps xmm4, xmm0
2468 | frndint 2500 | andpd xmm4, xmm2 // |x/y|
2469 | fldcw word [esp+4] 2501 | ucomisd xmm3, xmm4 // No truncation if 2^52 <= |x/y|.
2470 | fmulp st1 2502 | jbe >1
2471 | fsubp st1 2503 | andnpd xmm2, xmm0 // Isolate sign bit.
2504 | addsd xmm4, xmm3 // (|x/y| + 2^52) - 2^52
2505 | subsd xmm4, xmm3
2506 | orpd xmm4, xmm2 // Merge sign bit back in.
2507 | sseconst_1 xmm2, RDa
2508 | cmpsd xmm0, xmm4, 1 // x/y < result?
2509 | andpd xmm0, xmm2
2510 | subsd xmm4, xmm0 // If yes, subtract 1.0.
2511 | movaps xmm0, xmm5
2512 | mulsd xmm1, xmm4
2513 | subsd xmm0, xmm1
2514 | ret
2515 |1:
2516 | mulsd xmm1, xmm0
2517 | movaps xmm0, xmm5
2518 | subsd xmm0, xmm1
2519 | ret
2520 } else {
2521 |// Args/ret on x87 stack (y on top). No xmm registers modified.
2522 |// Caveat: needs 3 slots on x87 stack! RC (eax) modified!
2523 | fld st1
2524 | fdiv st1
2525 | fnstcw word [esp+4]
2526 | mov ax, 0x0400
2527 | or ax, [esp+4]
2528 | and ax, 0xf7ff
2529 | mov [esp+6], ax
2530 | fldcw word [esp+6]
2531 | frndint
2532 | fldcw word [esp+4]
2533 | fmulp st1
2534 | fsubp st1
2535 }
2472 | ret 2536 | ret
2473 | 2537 |
2474 |// FP exponentiation e^x and 2^x. Called by math.exp fast function and 2538 |// FP exponentiation e^x and 2^x. Called by math.exp fast function and
@@ -2619,31 +2683,100 @@ static void build_subroutines(BuildCtx *ctx, int cmov)
2619 |// Compute x op y for basic arithmetic operators (+ - * / % ^ and unary -) 2683 |// Compute x op y for basic arithmetic operators (+ - * / % ^ and unary -)
2620 |// and basic math functions. ORDER ARITH 2684 |// and basic math functions. ORDER ARITH
2621 |->vm_foldarith: 2685 |->vm_foldarith:
2622 | mov eax, [esp+20] 2686 if (sse) {
2623 | fld qword [esp+4] 2687 |.macro retxmm0; .if X64; ret; .else; jmp >7; .endif; .endmacro
2624 | fld qword [esp+12] 2688 |.macro retst0; .if X64; jmp >7; .else; ret; .endif; .endmacro
2625 | cmp eax, 1; je >1; ja >2 2689 |
2626 | faddp st1; ret 2690 |.if X64WIN
2627 |1: ; fsubp st1; ret 2691 | .define foldop, CARG3d
2628 |2: ; cmp eax, 3; je >1; ja >2 2692 |.elif X64
2629 | fmulp st1; ret 2693 | .define foldop, CARG1d
2630 |1: ; fdivp st1; ret 2694 |.else
2631 |2: ; cmp eax, 5; jb ->vm_mod; je ->vm_pow 2695 | .define foldop, eax
2632 | cmp eax, 7; je >1; ja >2 2696 | mov foldop, [esp+20]
2633 | fpop; fchs; ret 2697 | movsd xmm0, qword [esp+4]
2634 |1: ; fpop; fabs; ret 2698 | movsd xmm1, qword [esp+12]
2635 |2: ; cmp eax, 9; je >1; ja >2 2699 |.endif
2636 | fpatan; ret 2700 | cmp foldop, 1; je >1; ja >2
2637 |1: ; fxch; fscale; fpop1; ret 2701 | addsd xmm0, xmm1; retxmm0
2638 |2: ; cmp eax, 11; je >1; ja >9 2702 |1: ; subsd xmm0, xmm1; retxmm0
2639 ||if (cmov) { 2703 |2: ; cmp foldop, 3; je >1; ja >2
2640 | fucomi st1; fcmovnbe st1; fpop1; ret 2704 | mulsd xmm0, xmm1; retxmm0
2641 |1: ; fucomi st1; fcmovbe st1; fpop1; ret 2705 |1: ; divsd xmm0, xmm1; retxmm0
2642 ||} else { 2706 |2: ; cmp foldop, 5
2643 | fucom st1; fnstsw ax; test ah, 1; jz >2; fxch; 2: ; fpop; ret 2707 |.if X64
2644 |1: ; fucom st1; fnstsw ax; test ah, 1; jnz >2; fxch; 2: ; fpop; ret 2708 | jb ->vm_mod; je ->vm_pow // NYI: broken without SSE vm_pow.
2645 ||} 2709 |.else
2646 |9: ; int3 // Bad op. 2710 | je >1; ja >2
2711 | call ->vm_mod; retxmm0
2712 |1: ; fld qword [esp+4]; fld qword [esp+12]; jmp ->vm_pow // NYI
2713 |2:
2714 |.endif
2715 | cmp foldop, 7; je >1; ja >2
2716 | sseconst_sign xmm1, RDa; xorps xmm0, xmm1; retxmm0
2717 |1:
2718 | sseconst_abs xmm1, RDa; andps xmm0, xmm1; retxmm0
2719 |2: ; cmp foldop, 9; ja >2
2720 |.if X64WIN
2721 | movsd qword [esp+8], xmm0 // Use scratch area.
2722 | movsd qword [esp+16], xmm1
2723 | fld qword [esp+8]
2724 | fld qword [esp+16]
2725 |.elif X64
2726 | movsd qword [esp-8], xmm0 // Use red zone.
2727 | movsd qword [esp-16], xmm1
2728 | fld qword [esp-8]
2729 | fld qword [esp-16]
2730 |.else
2731 | fld qword [esp+4] // Reload from stack
2732 | fld qword [esp+12]
2733 |.endif
2734 | je >1
2735 | fpatan; retst0
2736 |1: ; fxch; fscale; fpop1; retst0
2737 |2: ; cmp foldop, 11; je >1; ja >9
2738 | minsd xmm0, xmm1; retxmm0
2739 |1: ; maxsd xmm0, xmm1; retxmm0
2740 |9: ; int3 // Bad op.
2741 |7: // Move return value depending on calling convention.
2742 |.if X64WIN
2743 | fstp qword [esp+8] // Use scratch area.
2744 | movsd xmm0, qword [esp+8]
2745 |.elif X64
2746 | fstp qword [esp-8] // Use red zone.
2747 | movsd xmm0, qword [esp-8]
2748 |.else
2749 | movsd qword [esp+4], xmm0 // Overwrite callee-owned args.
2750 | fld qword [esp+4]
2751 |.endif
2752 | ret
2753 } else {
2754 | mov eax, [esp+20]
2755 | fld qword [esp+4]
2756 | fld qword [esp+12]
2757 | cmp eax, 1; je >1; ja >2
2758 | faddp st1; ret
2759 |1: ; fsubp st1; ret
2760 |2: ; cmp eax, 3; je >1; ja >2
2761 | fmulp st1; ret
2762 |1: ; fdivp st1; ret
2763 |2: ; cmp eax, 5; jb ->vm_mod; je ->vm_pow
2764 | cmp eax, 7; je >1; ja >2
2765 | fpop; fchs; ret
2766 |1: ; fpop; fabs; ret
2767 |2: ; cmp eax, 9; je >1; ja >2
2768 | fpatan; ret
2769 |1: ; fxch; fscale; fpop1; ret
2770 |2: ; cmp eax, 11; je >1; ja >9
2771 ||if (cmov) {
2772 | fucomi st1; fcmovnbe st1; fpop1; ret
2773 |1: ; fucomi st1; fcmovbe st1; fpop1; ret
2774 ||} else {
2775 | fucom st1; fnstsw ax; test ah, 1; jz >2; fxch; 2: ; fpop; ret
2776 |1: ; fucom st1; fnstsw ax; test ah, 1; jnz >2; fxch; 2: ; fpop; ret
2777 ||}
2778 |9: ; int3 // Bad op.
2779 }
2647 | 2780 |
2648 |//----------------------------------------------------------------------- 2781 |//-----------------------------------------------------------------------
2649 |//-- Miscellaneous functions -------------------------------------------- 2782 |//-- Miscellaneous functions --------------------------------------------
@@ -2694,7 +2827,7 @@ static void build_subroutines(BuildCtx *ctx, int cmov)
2694} 2827}
2695 2828
2696/* Generate the code for a single instruction. */ 2829/* Generate the code for a single instruction. */
2697static void build_ins(BuildCtx *ctx, BCOp op, int defop, int cmov) 2830static void build_ins(BuildCtx *ctx, BCOp op, int defop, int cmov, int sse)
2698{ 2831{
2699 int vk = 0; 2832 int vk = 0;
2700 |// Note: aligning all instructions does not pay off. 2833 |// Note: aligning all instructions does not pay off.
@@ -2711,10 +2844,16 @@ static void build_ins(BuildCtx *ctx, BCOp op, int defop, int cmov)
2711 | ins_AD 2844 | ins_AD
2712 | checknum RA, ->vmeta_comp 2845 | checknum RA, ->vmeta_comp
2713 | checknum RD, ->vmeta_comp 2846 | checknum RD, ->vmeta_comp
2714 | fld qword [BASE+RA*8] // Reverse order, i.e like cmp D, A. 2847 if (sse) {
2715 | fld qword [BASE+RD*8] 2848 | movsd xmm0, qword [BASE+RD*8]
2716 | add PC, 4 2849 | add PC, 4
2717 | fcomparepp // eax (RD) modified! 2850 | ucomisd xmm0, qword [BASE+RA*8]
2851 } else {
2852 | fld qword [BASE+RA*8] // Reverse order, i.e like cmp D, A.
2853 | fld qword [BASE+RD*8]
2854 | add PC, 4
2855 | fcomparepp // eax (RD) modified!
2856 }
2718 | // Unordered: all of ZF CF PF set, ordered: PF clear. 2857 | // Unordered: all of ZF CF PF set, ordered: PF clear.
2719 | // To preserve NaN semantics GE/GT branch on unordered, but LT/LE don't. 2858 | // To preserve NaN semantics GE/GT branch on unordered, but LT/LE don't.
2720 switch (op) { 2859 switch (op) {
@@ -2746,9 +2885,14 @@ static void build_ins(BuildCtx *ctx, BCOp op, int defop, int cmov)
2746 | add PC, 4 2885 | add PC, 4
2747 | cmp RB, LJ_TISNUM; ja >5 2886 | cmp RB, LJ_TISNUM; ja >5
2748 | checknum RA, >5 2887 | checknum RA, >5
2749 | fld qword [BASE+RA*8] 2888 if (sse) {
2750 | fld qword [BASE+RD*8] 2889 | movsd xmm0, qword [BASE+RD*8]
2751 | fcomparepp // eax (RD) modified! 2890 | ucomisd xmm0, qword [BASE+RA*8]
2891 } else {
2892 | fld qword [BASE+RA*8]
2893 | fld qword [BASE+RD*8]
2894 | fcomparepp // eax (RD) modified!
2895 }
2752 iseqne_fp: 2896 iseqne_fp:
2753 if (vk) { 2897 if (vk) {
2754 | jp >2 // Unordered means not equal. 2898 | jp >2 // Unordered means not equal.
@@ -2820,9 +2964,14 @@ static void build_ins(BuildCtx *ctx, BCOp op, int defop, int cmov)
2820 | ins_AD // RA = src, RD = num const, JMP with RD = target 2964 | ins_AD // RA = src, RD = num const, JMP with RD = target
2821 | add PC, 4 2965 | add PC, 4
2822 | checknum RA, >2 2966 | checknum RA, >2
2823 | fld qword [BASE+RA*8] 2967 if (sse) {
2824 | fld qword [KBASE+RD*8] 2968 | movsd xmm0, qword [KBASE+RD*8]
2825 | fcomparepp // eax (RD) modified! 2969 | ucomisd xmm0, qword [BASE+RA*8]
2970 } else {
2971 | fld qword [BASE+RA*8]
2972 | fld qword [KBASE+RD*8]
2973 | fcomparepp // eax (RD) modified!
2974 }
2826 goto iseqne_fp; 2975 goto iseqne_fp;
2827 case BC_ISEQP: case BC_ISNEP: 2976 case BC_ISEQP: case BC_ISNEP:
2828 vk = op == BC_ISEQP; 2977 vk = op == BC_ISEQP;
@@ -2875,18 +3024,32 @@ static void build_ins(BuildCtx *ctx, BCOp op, int defop, int cmov)
2875 case BC_UNM: 3024 case BC_UNM:
2876 | ins_AD // RA = dst, RD = src 3025 | ins_AD // RA = dst, RD = src
2877 | checknum RD, ->vmeta_unm 3026 | checknum RD, ->vmeta_unm
2878 | fld qword [BASE+RD*8] 3027 if (sse) {
2879 | fchs 3028 | movsd xmm0, qword [BASE+RD*8]
2880 | fstp qword [BASE+RA*8] 3029 | sseconst_sign xmm1, RDa
3030 | xorps xmm0, xmm1
3031 | movsd qword [BASE+RA*8], xmm0
3032 } else {
3033 | fld qword [BASE+RD*8]
3034 | fchs
3035 | fstp qword [BASE+RA*8]
3036 }
2881 | ins_next 3037 | ins_next
2882 break; 3038 break;
2883 case BC_LEN: 3039 case BC_LEN:
2884 | ins_AD // RA = dst, RD = src 3040 | ins_AD // RA = dst, RD = src
2885 | checkstr RD, >2 3041 | checkstr RD, >2
2886 | mov STR:RD, [BASE+RD*8] 3042 | mov STR:RD, [BASE+RD*8]
2887 | fild dword STR:RD->len 3043 if (sse) {
2888 |1: 3044 | xorps xmm0, xmm0
2889 | fstp qword [BASE+RA*8] 3045 | cvtsi2sd xmm0, dword STR:RD->len
3046 |1:
3047 | movsd qword [BASE+RA*8], xmm0
3048 } else {
3049 | fild dword STR:RD->len
3050 |1:
3051 | fstp qword [BASE+RA*8]
3052 }
2890 | ins_next 3053 | ins_next
2891 |2: 3054 |2:
2892 | checktab RD, ->vmeta_len 3055 | checktab RD, ->vmeta_len
@@ -2894,72 +3057,108 @@ static void build_ins(BuildCtx *ctx, BCOp op, int defop, int cmov)
2894 | mov RB, BASE // Save BASE. 3057 | mov RB, BASE // Save BASE.
2895 | call extern lj_tab_len@4 // (GCtab *t) 3058 | call extern lj_tab_len@4 // (GCtab *t)
2896 | // Length of table returned in eax (RC). 3059 | // Length of table returned in eax (RC).
2897 | mov ARG1, RC 3060 if (sse) {
2898 | mov BASE, RB // Restore BASE. 3061 | cvtsi2sd xmm0, RC
2899 | fild ARG1 3062 | mov BASE, RB // Restore BASE.
3063 } else {
3064 | mov ARG1, RC
3065 | mov BASE, RB // Restore BASE.
3066 | fild ARG1
3067 }
2900 | movzx RA, PC_RA 3068 | movzx RA, PC_RA
2901 | jmp <1 3069 | jmp <1
2902 break; 3070 break;
2903 3071
2904 /* -- Binary ops -------------------------------------------------------- */ 3072 /* -- Binary ops -------------------------------------------------------- */
2905 3073
2906 |.macro ins_arithpre, ins 3074 |.macro ins_arithpre, ins, sseins, ssereg
2907 | ins_ABC 3075 | ins_ABC
2908 ||vk = ((int)op - BC_ADDVN) / (BC_ADDNV-BC_ADDVN); 3076 ||vk = ((int)op - BC_ADDVN) / (BC_ADDNV-BC_ADDVN);
2909 ||switch (vk) { 3077 ||switch (vk) {
2910 ||case 0: 3078 ||case 0:
2911 | checknum RB, ->vmeta_arith_vn 3079 | checknum RB, ->vmeta_arith_vn
3080 ||if (sse) {
3081 | movsd xmm0, qword [BASE+RB*8]
3082 | sseins ssereg, qword [KBASE+RC*8]
3083 ||} else {
2912 | fld qword [BASE+RB*8] 3084 | fld qword [BASE+RB*8]
2913 | ins qword [KBASE+RC*8] 3085 | ins qword [KBASE+RC*8]
3086 ||}
2914 || break; 3087 || break;
2915 ||case 1: 3088 ||case 1:
2916 | checknum RB, ->vmeta_arith_nv 3089 | checknum RB, ->vmeta_arith_nv
3090 ||if (sse) {
3091 | movsd xmm0, qword [KBASE+RC*8]
3092 | sseins ssereg, qword [BASE+RB*8]
3093 ||} else {
2917 | fld qword [KBASE+RC*8] 3094 | fld qword [KBASE+RC*8]
2918 | ins qword [BASE+RB*8] 3095 | ins qword [BASE+RB*8]
3096 ||}
2919 || break; 3097 || break;
2920 ||default: 3098 ||default:
2921 | checknum RB, ->vmeta_arith_vv 3099 | checknum RB, ->vmeta_arith_vv
2922 | checknum RC, ->vmeta_arith_vv 3100 | checknum RC, ->vmeta_arith_vv
3101 ||if (sse) {
3102 | movsd xmm0, qword [BASE+RB*8]
3103 | sseins ssereg, qword [BASE+RC*8]
3104 ||} else {
2923 | fld qword [BASE+RB*8] 3105 | fld qword [BASE+RB*8]
2924 | ins qword [BASE+RC*8] 3106 | ins qword [BASE+RC*8]
3107 ||}
2925 || break; 3108 || break;
2926 ||} 3109 ||}
2927 |.endmacro 3110 |.endmacro
2928 | 3111 |
2929 |.macro ins_arith, ins 3112 |.macro ins_arithpost
2930 | ins_arithpre ins 3113 ||if (sse) {
3114 | movsd qword [BASE+RA*8], xmm0
3115 ||} else {
2931 | fstp qword [BASE+RA*8] 3116 | fstp qword [BASE+RA*8]
3117 ||}
3118 |.endmacro
3119 |
3120 |.macro ins_arith, ins, sseins
3121 | ins_arithpre ins, sseins, xmm0
3122 | ins_arithpost
2932 | ins_next 3123 | ins_next
2933 |.endmacro 3124 |.endmacro
2934 3125
2935 | // RA = dst, RB = src1 or num const, RC = src2 or num const 3126 | // RA = dst, RB = src1 or num const, RC = src2 or num const
2936 case BC_ADDVN: case BC_ADDNV: case BC_ADDVV: 3127 case BC_ADDVN: case BC_ADDNV: case BC_ADDVV:
2937 | ins_arith fadd 3128 | ins_arith fadd, addsd
2938 break; 3129 break;
2939 case BC_SUBVN: case BC_SUBNV: case BC_SUBVV: 3130 case BC_SUBVN: case BC_SUBNV: case BC_SUBVV:
2940 | ins_arith fsub 3131 | ins_arith fsub, subsd
2941 break; 3132 break;
2942 case BC_MULVN: case BC_MULNV: case BC_MULVV: 3133 case BC_MULVN: case BC_MULNV: case BC_MULVV:
2943 | ins_arith fmul 3134 | ins_arith fmul, mulsd
2944 break; 3135 break;
2945 case BC_DIVVN: case BC_DIVNV: case BC_DIVVV: 3136 case BC_DIVVN: case BC_DIVNV: case BC_DIVVV:
2946 | ins_arith fdiv 3137 | ins_arith fdiv, divsd
2947 break; 3138 break;
2948 case BC_MODVN: 3139 case BC_MODVN:
2949 | ins_arithpre fld 3140 | ins_arithpre fld, movsd, xmm1
2950 |->BC_MODVN_Z: 3141 |->BC_MODVN_Z:
2951 | call ->vm_mod 3142 | call ->vm_mod
2952 | fstp qword [BASE+RA*8] 3143 | ins_arithpost
2953 | ins_next 3144 | ins_next
2954 break; 3145 break;
2955 case BC_MODNV: case BC_MODVV: 3146 case BC_MODNV: case BC_MODVV:
2956 | ins_arithpre fld 3147 | ins_arithpre fld, movsd, xmm1
2957 | jmp ->BC_MODVN_Z // Avoid 3 copies. It's slow anyway. 3148 | jmp ->BC_MODVN_Z // Avoid 3 copies. It's slow anyway.
2958 break; 3149 break;
2959 case BC_POW: 3150 case BC_POW:
2960 | ins_arithpre fld 3151 if (sse) {
2961 | call ->vm_pow 3152 sse = 0; /* NYI: temporary workaround. */
2962 | fstp qword [BASE+RA*8] 3153 | ins_arithpre fld, movsd, xmm1
3154 | call ->vm_pow
3155 | ins_arithpost
3156 sse = 1;
3157 } else {
3158 | ins_arithpre fld, movsd, xmm1
3159 | call ->vm_pow
3160 | ins_arithpost
3161 }
2963 | ins_next 3162 | ins_next
2964 break; 3163 break;
2965 3164
@@ -3945,17 +4144,21 @@ static int build_backend(BuildCtx *ctx)
3945{ 4144{
3946 int op; 4145 int op;
3947 int cmov = 1; 4146 int cmov = 1;
4147 int sse = 0;
3948#ifdef LUAJIT_CPU_NOCMOV 4148#ifdef LUAJIT_CPU_NOCMOV
3949 cmov = 0; 4149 cmov = 0;
3950#endif 4150#endif
4151#ifdef LUAJIT_CPU_SSE2
4152 sse = 1;
4153#endif
3951 4154
3952 dasm_growpc(Dst, BC__MAX); 4155 dasm_growpc(Dst, BC__MAX);
3953 4156
3954 build_subroutines(ctx, cmov); 4157 build_subroutines(ctx, cmov, sse);
3955 4158
3956 |.code_op 4159 |.code_op
3957 for (op = 0; op < BC__MAX; op++) 4160 for (op = 0; op < BC__MAX; op++)
3958 build_ins(ctx, (BCOp)op, op, cmov); 4161 build_ins(ctx, (BCOp)op, op, cmov, sse);
3959 4162
3960 return BC__MAX; 4163 return BC__MAX;
3961} 4164}
diff --git a/src/buildvm_x86.h b/src/buildvm_x86.h
index a799cbae..1f990f09 100644
--- a/src/buildvm_x86.h
+++ b/src/buildvm_x86.h
@@ -12,7 +12,7 @@
12#define DASM_SECTION_CODE_OP 0 12#define DASM_SECTION_CODE_OP 0
13#define DASM_SECTION_CODE_SUB 1 13#define DASM_SECTION_CODE_SUB 1
14#define DASM_MAXSECTION 2 14#define DASM_MAXSECTION 2
15static const unsigned char build_actionlist[12310] = { 15static const unsigned char build_actionlist[12791] = {
16 254,1,248,10,137,202,139,173,233,137,114,252,252,15,182,141,233,139,181,233, 16 254,1,248,10,137,202,139,173,233,137,114,252,252,15,182,141,233,139,181,233,
17 139,189,233,139,108,36,48,141,12,202,141,68,194,252,252,59,141,233,15,135, 17 139,189,233,139,108,36,48,141,12,202,141,68,194,252,252,59,141,233,15,135,
18 244,11,248,9,189,237,248,1,137,40,137,104,8,131,192,16,57,200,15,130,244, 18 244,11,248,9,189,237,248,1,137,40,137,104,8,131,192,16,57,200,15,130,244,
@@ -374,61 +374,82 @@ static const unsigned char build_actionlist[12310] = {
374 252,255,252,251,102,137,68,36,6,217,108,36,6,217,252,252,217,108,36,4,139, 374 252,255,252,251,102,137,68,36,6,217,108,36,6,217,252,252,217,108,36,4,139,
375 68,36,8,195,248,102,217,124,36,4,137,68,36,8,102,184,0,12,102,11,68,36,4, 375 68,36,8,195,248,102,217,124,36,4,137,68,36,8,102,184,0,12,102,11,68,36,4,
376 102,137,68,36,6,217,108,36,6,217,252,252,217,108,36,4,139,68,36,8,195,248, 376 102,137,68,36,6,217,108,36,6,217,252,252,217,108,36,4,139,68,36,8,195,248,
377 140,217,193,216,252,241,217,124,36,4,102,184,0,4,102,11,68,36,4,102,37,252, 377 140,255,15,40,232,252,242,15,94,193,102,15,252,239,210,102,15,118,210,102,
378 255,252,247,102,137,68,36,6,217,108,36,6,217,252,252,217,108,36,4,222,201, 378 15,115,210,1,184,0,0,48,67,102,15,110,216,102,15,112,219,81,15,40,224,102,
379 222,252,233,195,248,86,217,252,234,222,201,248,141,217,84,36,4,129,124,36, 379 15,84,226,102,15,46,220,15,134,244,247,102,15,85,208,252,242,15,88,227,252,
380 4,0,0,128,127,15,132,244,247,129,124,36,4,0,0,128,252,255,15,132,244,248, 380 242,15,92,227,102,15,86,226,184,0,0,252,240,63,102,15,110,208,102,15,112,
381 248,142,217,192,217,252,252,220,252,233,217,201,217,252,240,217,232,222,193, 381 210,81,252,242,15,194,196,1,102,15,84,194,252,242,15,92,224,15,40,197,252,
382 217,252,253,221,217,248,1,195,248,2,221,216,217,252,238,195,248,105,219,84, 382 242,15,89,204,252,242,15,92,193,195,248,1,252,242,15,89,200,15,40,197,252,
383 36,4,219,68,36,4,255,223,252,233,255,80,221,252,233,223,224,158,88,255,15, 383 242,15,92,193,195,255,217,193,216,252,241,217,124,36,4,102,184,0,4,102,11,
384 133,244,254,15,138,244,255,221,216,248,143,80,139,68,36,8,131,252,248,1,15, 384 68,36,4,102,37,252,255,252,247,102,137,68,36,6,217,108,36,6,217,252,252,217,
385 142,244,252,248,1,169,1,0,0,0,15,133,244,248,216,200,209,232,252,233,244, 385 108,36,4,222,201,222,252,233,255,195,248,86,217,252,234,222,201,248,141,217,
386 1,248,2,209,232,15,132,244,251,217,192,248,3,216,200,209,232,15,132,244,250, 386 84,36,4,129,124,36,4,0,0,128,127,15,132,244,247,129,124,36,4,0,0,128,252,
387 15,131,244,3,255,220,201,252,233,244,3,248,4,222,201,248,5,88,195,248,6,15, 387 255,15,132,244,248,248,142,217,192,217,252,252,220,252,233,217,201,217,252,
388 132,244,5,15,130,244,253,217,232,222,252,241,252,247,216,131,252,248,1,15, 388 240,217,232,222,193,217,252,253,221,217,248,1,195,248,2,221,216,217,252,238,
389 132,244,5,252,233,244,1,248,7,221,216,217,232,88,195,248,8,80,217,84,36,8, 389 195,248,105,219,84,36,4,219,68,36,4,255,223,252,233,255,80,221,252,233,223,
390 217,201,217,84,36,12,139,68,36,8,209,224,61,0,0,0,252,255,15,132,244,248, 390 224,158,88,255,15,133,244,254,15,138,244,255,221,216,248,143,80,139,68,36,
391 139,68,36,12,209,224,15,132,244,250,61,0,0,0,252,255,15,132,244,250,255,88, 391 8,131,252,248,1,15,142,244,252,248,1,169,1,0,0,0,15,133,244,248,216,200,209,
392 217,252,241,252,233,244,142,248,9,217,232,255,223,252,234,255,80,221,252, 392 232,252,233,244,1,248,2,209,232,15,132,244,251,217,192,248,3,216,200,209,
393 234,223,224,158,88,255,15,132,244,247,217,201,248,1,221,216,195,248,2,217, 393 232,15,132,244,250,15,131,244,3,255,220,201,252,233,244,3,248,4,222,201,248,
394 225,217,232,255,221,252,233,223,224,158,255,15,132,244,249,221,216,217,225, 394 5,88,195,248,6,15,132,244,5,15,130,244,253,217,232,222,252,241,252,247,216,
395 217,252,238,184,0,0,0,0,15,146,208,209,200,51,68,36,8,15,137,244,249,217, 395 131,252,248,1,15,132,244,5,252,233,244,1,248,7,221,216,217,232,88,195,248,
396 201,248,3,221,217,217,225,88,195,248,4,131,124,36,8,0,15,141,244,3,221,216, 396 8,80,217,84,36,8,217,201,217,84,36,12,139,68,36,8,209,224,61,0,0,0,252,255,
397 221,216,133,192,88,15,132,244,251,217,252,238,195,248,5,199,68,36,8,0,0,128, 397 15,132,244,248,139,68,36,12,209,224,15,132,244,250,61,0,0,0,252,255,15,132,
398 127,217,68,36,8,195,248,144,139,68,36,12,221,68,36,4,131,252,248,1,15,130, 398 244,250,255,88,217,252,241,252,233,244,142,248,9,217,232,255,223,252,234,
399 244,79,15,132,244,81,131,252,248,3,15,130,244,102,15,135,244,247,255,217, 399 255,80,221,252,234,223,224,158,88,255,15,132,244,247,217,201,248,1,221,216,
400 252,250,195,248,1,131,252,248,5,15,130,244,86,15,132,244,141,131,252,248, 400 195,248,2,217,225,217,232,255,221,252,233,223,224,158,255,15,132,244,249,
401 7,15,132,244,247,15,135,244,248,217,252,237,217,201,217,252,241,195,248,1, 401 221,216,217,225,217,252,238,184,0,0,0,0,15,146,208,209,200,51,68,36,8,15,
402 217,232,217,201,217,252,241,195,248,2,131,252,248,9,15,132,244,247,15,135, 402 137,244,249,217,201,248,3,221,217,217,225,88,195,248,4,131,124,36,8,0,15,
403 244,248,217,252,236,217,201,217,252,241,195,248,1,217,252,254,195,248,2,131, 403 141,244,3,221,216,221,216,133,192,88,15,132,244,251,217,252,238,195,248,5,
404 252,248,11,15,132,244,247,15,135,244,255,255,217,252,255,195,248,1,217,252, 404 199,68,36,8,0,0,128,127,217,68,36,8,195,248,144,139,68,36,12,221,68,36,4,
405 242,221,216,195,248,9,204,248,145,139,68,36,20,221,68,36,4,221,68,36,12,131, 405 131,252,248,1,15,130,244,79,15,132,244,81,131,252,248,3,15,130,244,102,15,
406 252,248,1,15,132,244,247,15,135,244,248,222,193,195,248,1,222,252,233,195, 406 135,244,247,255,217,252,250,195,248,1,131,252,248,5,15,130,244,86,15,132,
407 248,2,131,252,248,3,15,132,244,247,15,135,244,248,222,201,195,248,1,222,252, 407 244,141,131,252,248,7,15,132,244,247,15,135,244,248,217,252,237,217,201,217,
408 249,195,248,2,131,252,248,5,15,130,244,140,15,132,244,105,131,252,248,7,15, 408 252,241,195,248,1,217,232,217,201,217,252,241,195,248,2,131,252,248,9,15,
409 132,244,247,255,15,135,244,248,221,216,217,224,195,248,1,221,216,217,225, 409 132,244,247,15,135,244,248,217,252,236,217,201,217,252,241,195,248,1,217,
410 195,248,2,131,252,248,9,15,132,244,247,15,135,244,248,217,252,243,195,248, 410 252,254,195,248,2,131,252,248,11,15,132,244,247,15,135,244,255,255,217,252,
411 1,217,201,217,252,253,221,217,195,248,2,131,252,248,11,15,132,244,247,15, 411 255,195,248,1,217,252,242,221,216,195,248,9,204,248,145,255,139,68,36,20,
412 135,244,255,255,219,252,233,219,209,221,217,195,248,1,219,252,233,218,209, 412 252,242,15,16,68,36,4,252,242,15,16,76,36,12,131,252,248,1,15,132,244,247,
413 221,217,195,255,221,225,223,224,252,246,196,1,15,132,244,248,217,201,248, 413 15,135,244,248,252,242,15,88,193,252,233,244,253,248,1,252,242,15,92,193,
414 2,221,216,195,248,1,221,225,223,224,252,246,196,1,15,133,244,248,217,201, 414 252,233,244,253,248,2,131,252,248,3,15,132,244,247,15,135,244,248,252,242,
415 248,2,221,216,195,255,248,9,204,248,146,156,90,137,209,129,252,242,0,0,32, 415 15,89,193,252,233,244,253,248,1,252,242,15,94,193,252,233,244,253,248,2,255,
416 0,82,157,156,90,49,192,57,209,15,132,244,247,139,68,36,4,87,83,15,162,139, 416 131,252,248,5,15,132,244,247,15,135,244,248,232,244,140,252,233,244,253,248,
417 124,36,16,137,7,137,95,4,137,79,8,137,87,12,91,95,248,1,195,255,129,124,253, 417 1,221,68,36,4,221,68,36,12,252,233,244,105,248,2,131,252,248,7,15,132,244,
418 202,4,239,15,135,244,41,129,124,253,194,4,239,15,135,244,41,221,4,202,221, 418 247,15,135,244,248,184,0,0,0,128,102,15,110,200,102,15,112,201,81,15,87,193,
419 4,194,131,198,4,255,223,252,233,221,216,255,218,252,233,223,224,158,255,15, 419 252,233,244,253,248,1,102,15,252,239,201,102,15,118,201,102,15,115,209,1,
420 134,244,248,255,15,135,244,248,255,15,131,244,248,255,248,1,15,183,70,252, 420 15,84,193,252,233,244,253,248,2,255,131,252,248,9,15,135,244,248,221,68,36,
421 254,141,180,253,134,233,248,2,139,6,15,182,204,15,182,232,131,198,4,193,232, 421 4,221,68,36,12,15,132,244,247,217,252,243,195,248,1,217,201,217,252,253,221,
422 16,252,255,36,171,255,139,108,194,4,131,198,4,129,252,253,239,15,135,244, 422 217,195,248,2,131,252,248,11,15,132,244,247,15,135,244,255,252,242,15,93,
423 251,129,124,253,202,4,239,15,135,244,251,221,4,202,221,4,194,255,15,138,244, 423 193,252,233,244,253,248,1,252,242,15,95,193,252,233,244,253,248,9,204,248,
424 248,15,133,244,248,255,15,138,244,248,15,132,244,247,255,248,1,15,183,70, 424 7,252,242,15,17,68,36,4,221,68,36,4,195,255,139,68,36,20,221,68,36,4,221,
425 252,254,141,180,253,134,233,248,2,255,248,2,15,183,70,252,254,141,180,253, 425 68,36,12,131,252,248,1,15,132,244,247,15,135,244,248,222,193,195,248,1,222,
426 134,233,248,1,255,248,5,57,108,202,4,15,133,244,2,129,252,253,239,15,131, 426 252,233,195,248,2,131,252,248,3,15,132,244,247,15,135,244,248,222,201,195,
427 244,1,139,12,202,139,4,194,57,193,15,132,244,1,129,252,253,239,15,135,244, 427 248,1,222,252,249,195,248,2,131,252,248,5,15,130,244,140,15,132,244,105,131,
428 2,139,169,233,133,252,237,15,132,244,2,252,246,133,233,235,15,133,244,2,255, 428 252,248,7,15,132,244,247,15,135,244,248,255,221,216,217,224,195,248,1,221,
429 49,252,237,255,189,1,0,0,0,255,252,233,244,45,255,252,247,208,131,198,4,129, 429 216,217,225,195,248,2,131,252,248,9,15,132,244,247,15,135,244,248,217,252,
430 124,253,202,4,239,15,133,244,248,139,12,202,59,12,135,255,131,198,4,129,124, 430 243,195,248,1,217,201,217,252,253,221,217,195,248,2,131,252,248,11,15,132,
431 253,202,4,239,15,135,244,248,221,4,202,221,4,199,255,252,247,208,131,198, 431 244,247,15,135,244,255,255,219,252,233,219,209,221,217,195,248,1,219,252,
432 233,218,209,221,217,195,255,221,225,223,224,252,246,196,1,15,132,244,248,
433 217,201,248,2,221,216,195,248,1,221,225,223,224,252,246,196,1,15,133,244,
434 248,217,201,248,2,221,216,195,255,248,9,204,255,248,146,156,90,137,209,129,
435 252,242,0,0,32,0,82,157,156,90,49,192,57,209,15,132,244,247,139,68,36,4,87,
436 83,15,162,139,124,36,16,137,7,137,95,4,137,79,8,137,87,12,91,95,248,1,195,
437 255,129,124,253,202,4,239,15,135,244,41,129,124,253,194,4,239,15,135,244,
438 41,255,252,242,15,16,4,194,131,198,4,102,15,46,4,202,255,221,4,202,221,4,
439 194,131,198,4,255,223,252,233,221,216,255,218,252,233,223,224,158,255,15,
440 134,244,248,255,15,131,244,248,255,248,1,15,183,70,252,254,141,180,253,134,
441 233,248,2,139,6,15,182,204,15,182,232,131,198,4,193,232,16,252,255,36,171,
442 255,139,108,194,4,131,198,4,129,252,253,239,15,135,244,251,129,124,253,202,
443 4,239,15,135,244,251,255,252,242,15,16,4,194,102,15,46,4,202,255,221,4,202,
444 221,4,194,255,15,138,244,248,15,133,244,248,255,15,138,244,248,15,132,244,
445 247,255,248,1,15,183,70,252,254,141,180,253,134,233,248,2,255,248,2,15,183,
446 70,252,254,141,180,253,134,233,248,1,255,248,5,57,108,202,4,15,133,244,2,
447 129,252,253,239,15,131,244,1,139,12,202,139,4,194,57,193,15,132,244,1,129,
448 252,253,239,15,135,244,2,139,169,233,133,252,237,15,132,244,2,252,246,133,
449 233,235,15,133,244,2,255,49,252,237,255,189,1,0,0,0,255,252,233,244,45,255,
450 252,247,208,131,198,4,129,124,253,202,4,239,15,133,244,248,139,12,202,59,
451 12,135,255,131,198,4,129,124,253,202,4,239,15,135,244,248,255,252,242,15,
452 16,4,199,102,15,46,4,202,255,221,4,202,221,4,199,255,252,247,208,131,198,
432 4,57,68,202,4,255,139,108,194,4,131,198,4,129,252,253,239,255,15,131,244, 453 4,57,68,202,4,255,139,108,194,4,131,198,4,129,252,253,239,255,15,131,244,
433 247,255,15,130,244,247,255,137,108,202,4,139,44,194,137,44,202,255,15,183, 454 247,255,15,130,244,247,255,137,108,202,4,139,44,194,137,44,202,255,15,183,
434 70,252,254,141,180,253,134,233,248,1,139,6,15,182,204,15,182,232,131,198, 455 70,252,254,141,180,253,134,233,248,1,139,6,15,182,204,15,182,232,131,198,
@@ -436,176 +457,177 @@ static const unsigned char build_actionlist[12310] = {
436 4,202,139,6,15,182,204,15,182,232,131,198,4,193,232,16,252,255,36,171,255, 457 4,202,139,6,15,182,204,15,182,232,131,198,4,193,232,16,252,255,36,171,255,
437 49,252,237,129,124,253,194,4,239,129,213,239,137,108,202,4,139,6,15,182,204, 458 49,252,237,129,124,253,194,4,239,129,213,239,137,108,202,4,139,6,15,182,204,
438 15,182,232,131,198,4,193,232,16,252,255,36,171,255,129,124,253,194,4,239, 459 15,182,232,131,198,4,193,232,16,252,255,36,171,255,129,124,253,194,4,239,
439 15,135,244,48,221,4,194,217,224,221,28,202,139,6,15,182,204,15,182,232,131, 460 15,135,244,48,255,252,242,15,16,4,194,184,0,0,0,128,102,15,110,200,102,15,
440 198,4,193,232,16,252,255,36,171,255,129,124,253,194,4,239,15,133,244,248, 461 112,201,81,15,87,193,252,242,15,17,4,202,255,221,4,194,217,224,221,28,202,
441 139,4,194,219,128,233,248,1,221,28,202,139,6,15,182,204,15,182,232,131,198, 462 255,129,124,253,194,4,239,15,133,244,248,139,4,194,255,15,87,192,252,242,
442 4,193,232,16,252,255,36,171,248,2,129,124,253,194,4,239,15,133,244,50,139, 463 15,42,128,233,248,1,252,242,15,17,4,202,255,219,128,233,248,1,221,28,202,
443 12,194,137,213,232,251,1,18,137,4,36,137,252,234,219,4,36,15,182,78,252,253, 464 255,139,6,15,182,204,15,182,232,131,198,4,193,232,16,252,255,36,171,248,2,
444 252,233,244,1,255,15,182,252,236,15,182,192,255,129,124,253,252,234,4,239, 465 129,124,253,194,4,239,15,133,244,50,139,12,194,137,213,232,251,1,18,255,252,
445 15,135,244,46,221,4,252,234,220,4,199,255,129,124,253,252,234,4,239,15,135, 466 242,15,42,192,137,252,234,255,137,4,36,137,252,234,219,4,36,255,15,182,78,
446 244,47,221,4,199,220,4,252,234,255,129,124,253,252,234,4,239,15,135,244,49, 467 252,253,252,233,244,1,255,15,182,252,236,15,182,192,255,129,124,253,252,234,
447 129,124,253,194,4,239,15,135,244,49,221,4,252,234,220,4,194,255,129,124,253, 468 4,239,15,135,244,46,255,252,242,15,16,4,252,234,252,242,15,88,4,199,255,221,
448 252,234,4,239,15,135,244,46,221,4,252,234,220,36,199,255,129,124,253,252, 469 4,252,234,220,4,199,255,129,124,253,252,234,4,239,15,135,244,47,255,252,242,
449 234,4,239,15,135,244,47,221,4,199,220,36,252,234,255,129,124,253,252,234, 470 15,16,4,199,252,242,15,88,4,252,234,255,221,4,199,220,4,252,234,255,129,124,
450 4,239,15,135,244,49,129,124,253,194,4,239,15,135,244,49,221,4,252,234,220, 471 253,252,234,4,239,15,135,244,49,129,124,253,194,4,239,15,135,244,49,255,252,
451 36,194,255,129,124,253,252,234,4,239,15,135,244,46,221,4,252,234,220,12,199, 472 242,15,16,4,252,234,252,242,15,88,4,194,255,221,4,252,234,220,4,194,255,252,
452 255,129,124,253,252,234,4,239,15,135,244,47,221,4,199,220,12,252,234,255, 473 242,15,16,4,252,234,252,242,15,92,4,199,255,221,4,252,234,220,36,199,255,
453 129,124,253,252,234,4,239,15,135,244,49,129,124,253,194,4,239,15,135,244, 474 252,242,15,16,4,199,252,242,15,92,4,252,234,255,221,4,199,220,36,252,234,
454 49,221,4,252,234,220,12,194,255,129,124,253,252,234,4,239,15,135,244,46,221, 475 255,252,242,15,16,4,252,234,252,242,15,92,4,194,255,221,4,252,234,220,36,
455 4,252,234,220,52,199,255,129,124,253,252,234,4,239,15,135,244,47,221,4,199, 476 194,255,252,242,15,16,4,252,234,252,242,15,89,4,199,255,221,4,252,234,220,
456 220,52,252,234,255,129,124,253,252,234,4,239,15,135,244,49,129,124,253,194, 477 12,199,255,252,242,15,16,4,199,252,242,15,89,4,252,234,255,221,4,199,220,
457 4,239,15,135,244,49,221,4,252,234,220,52,194,255,129,124,253,252,234,4,239, 478 12,252,234,255,252,242,15,16,4,252,234,252,242,15,89,4,194,255,221,4,252,
458 15,135,244,46,221,4,252,234,221,4,199,255,129,124,253,252,234,4,239,15,135, 479 234,220,12,194,255,252,242,15,16,4,252,234,252,242,15,94,4,199,255,221,4,
459 244,47,221,4,199,221,4,252,234,255,129,124,253,252,234,4,239,15,135,244,49, 480 252,234,220,52,199,255,252,242,15,16,4,199,252,242,15,94,4,252,234,255,221,
460 129,124,253,194,4,239,15,135,244,49,221,4,252,234,221,4,194,255,248,147,232, 481 4,199,220,52,252,234,255,252,242,15,16,4,252,234,252,242,15,94,4,194,255,
461 244,140,221,28,202,139,6,15,182,204,15,182,232,131,198,4,193,232,16,252,255, 482 221,4,252,234,220,52,194,255,252,242,15,16,4,252,234,252,242,15,16,12,199,
462 36,171,255,252,233,244,147,255,232,244,105,221,28,202,139,6,15,182,204,15, 483 255,221,4,252,234,221,4,199,255,252,242,15,16,4,199,252,242,15,16,12,252,
463 182,232,131,198,4,193,232,16,252,255,36,171,255,15,182,252,236,15,182,192, 484 234,255,221,4,199,221,4,252,234,255,252,242,15,16,4,252,234,252,242,15,16,
464 141,12,194,41,232,137,76,36,4,137,68,36,8,248,33,139,108,36,48,137,44,36, 485 12,194,255,221,4,252,234,221,4,194,255,248,147,232,244,140,255,252,233,244,
465 137,116,36,24,137,149,233,232,251,1,23,139,149,233,133,192,15,133,244,42, 486 147,255,232,244,105,255,15,182,252,236,15,182,192,141,12,194,41,232,137,76,
466 15,182,110,252,255,15,182,78,252,253,139,68,252,234,4,139,44,252,234,137, 487 36,4,137,68,36,8,248,33,139,108,36,48,137,44,36,137,116,36,24,137,149,233,
467 68,202,4,137,44,202,139,6,15,182,204,15,182,232,131,198,4,193,232,16,252, 488 232,251,1,23,139,149,233,133,192,15,133,244,42,15,182,110,252,255,15,182,
468 255,36,171,255,252,247,208,139,4,135,199,68,202,4,237,137,4,202,139,6,15, 489 78,252,253,139,68,252,234,4,139,44,252,234,137,68,202,4,137,44,202,139,6,
469 182,204,15,182,232,131,198,4,193,232,16,252,255,36,171,255,223,70,252,254, 490 15,182,204,15,182,232,131,198,4,193,232,16,252,255,36,171,255,252,247,208,
470 221,28,202,139,6,15,182,204,15,182,232,131,198,4,193,232,16,252,255,36,171, 491 139,4,135,199,68,202,4,237,137,4,202,139,6,15,182,204,15,182,232,131,198,
471 255,221,4,199,221,28,202,139,6,15,182,204,15,182,232,131,198,4,193,232,16, 492 4,193,232,16,252,255,36,171,255,223,70,252,254,221,28,202,139,6,15,182,204,
472 252,255,36,171,255,252,247,208,137,68,202,4,139,6,15,182,204,15,182,232,131, 493 15,182,232,131,198,4,193,232,16,252,255,36,171,255,221,4,199,221,28,202,139,
473 198,4,193,232,16,252,255,36,171,255,141,76,202,12,141,68,194,4,189,237,137, 494 6,15,182,204,15,182,232,131,198,4,193,232,16,252,255,36,171,255,252,247,208,
474 105,252,248,248,1,137,41,131,193,8,57,193,15,134,244,1,139,6,15,182,204,15, 495 137,68,202,4,139,6,15,182,204,15,182,232,131,198,4,193,232,16,252,255,36,
475 182,232,131,198,4,193,232,16,252,255,36,171,255,139,106,252,248,139,172,253, 496 171,255,141,76,202,12,141,68,194,4,189,237,137,105,252,248,248,1,137,41,131,
476 133,233,139,173,233,139,69,4,139,109,0,137,68,202,4,137,44,202,139,6,15,182, 497 193,8,57,193,15,134,244,1,139,6,15,182,204,15,182,232,131,198,4,193,232,16,
477 204,15,182,232,131,198,4,193,232,16,252,255,36,171,255,139,106,252,248,139, 498 252,255,36,171,255,139,106,252,248,139,172,253,133,233,139,173,233,139,69,
478 172,253,141,233,128,189,233,0,139,173,233,139,12,194,139,68,194,4,137,77, 499 4,139,109,0,137,68,202,4,137,44,202,139,6,15,182,204,15,182,232,131,198,4,
479 0,137,69,4,15,132,244,247,252,246,133,233,235,15,133,244,248,248,1,139,6, 500 193,232,16,252,255,36,171,255,139,106,252,248,139,172,253,141,233,128,189,
480 15,182,204,15,182,232,131,198,4,193,232,16,252,255,36,171,248,2,129,232,239, 501 233,0,139,173,233,139,12,194,139,68,194,4,137,77,0,137,69,4,15,132,244,247,
481 129,252,248,239,15,134,244,1,252,246,129,233,235,15,132,244,1,135,213,141, 502 252,246,133,233,235,15,133,244,248,248,1,139,6,15,182,204,15,182,232,131,
482 139,233,255,232,251,1,24,137,252,234,252,233,244,1,255,252,247,208,139,106, 503 198,4,193,232,16,252,255,36,171,248,2,129,232,239,129,252,248,239,15,134,
483 252,248,139,172,253,141,233,139,12,135,139,133,233,137,8,199,64,4,237,252, 504 244,1,252,246,129,233,235,15,132,244,1,135,213,141,139,233,255,232,251,1,
484 246,133,233,235,15,133,244,248,248,1,139,6,15,182,204,15,182,232,131,198, 505 24,137,252,234,252,233,244,1,255,252,247,208,139,106,252,248,139,172,253,
485 4,193,232,16,252,255,36,171,248,2,252,246,129,233,235,15,132,244,1,128,189, 506 141,233,139,12,135,139,133,233,137,8,199,64,4,237,252,246,133,233,235,15,
486 233,0,15,132,244,1,137,213,137,194,141,139,233,232,251,1,24,137,252,234,252, 507 133,244,248,248,1,139,6,15,182,204,15,182,232,131,198,4,193,232,16,252,255,
487 233,244,1,255,139,106,252,248,221,4,199,139,172,253,141,233,139,141,233,221, 508 36,171,248,2,252,246,129,233,235,15,132,244,1,128,189,233,0,15,132,244,1,
488 25,139,6,15,182,204,15,182,232,131,198,4,193,232,16,252,255,36,171,255,252, 509 137,213,137,194,141,139,233,232,251,1,24,137,252,234,252,233,244,1,255,139,
489 247,208,139,106,252,248,139,172,253,141,233,139,141,233,137,65,4,139,6,15, 510 106,252,248,221,4,199,139,172,253,141,233,139,141,233,221,25,139,6,15,182,
490 182,204,15,182,232,131,198,4,193,232,16,252,255,36,171,255,141,180,253,134, 511 204,15,182,232,131,198,4,193,232,16,252,255,36,171,255,252,247,208,139,106,
491 233,139,108,36,48,131,189,233,0,15,132,244,247,141,12,202,137,76,36,4,137, 512 252,248,139,172,253,141,233,139,141,233,137,65,4,139,6,15,182,204,15,182,
492 44,36,137,149,233,232,251,1,25,139,149,233,248,1,139,6,15,182,204,15,182, 513 232,131,198,4,193,232,16,252,255,36,171,255,141,180,253,134,233,139,108,36,
493 232,131,198,4,193,232,16,252,255,36,171,255,252,247,208,139,74,252,248,139, 514 48,131,189,233,0,15,132,244,247,141,12,202,137,76,36,4,137,44,36,137,149,
494 4,135,139,108,36,48,137,76,36,8,137,68,36,4,137,116,36,24,137,44,36,137,149, 515 233,232,251,1,25,139,149,233,248,1,139,6,15,182,204,15,182,232,131,198,4,
495 233,232,251,1,26,139,149,233,15,182,78,252,253,137,4,202,199,68,202,4,237, 516 193,232,16,252,255,36,171,255,252,247,208,139,74,252,248,139,4,135,139,108,
496 139,6,15,182,204,15,182,232,131,198,4,193,232,16,252,255,36,171,255,137,197, 517 36,48,137,76,36,8,137,68,36,4,137,116,36,24,137,44,36,137,149,233,232,251,
497 37,252,255,7,0,0,193,252,237,11,61,252,255,7,0,0,15,148,209,137,108,36,8, 518 1,26,139,149,233,15,182,78,252,253,137,4,202,199,68,202,4,237,139,6,15,182,
498 1,200,139,108,36,48,1,200,137,68,36,4,137,116,36,24,139,139,233,137,44,36, 519 204,15,182,232,131,198,4,193,232,16,252,255,36,171,255,137,197,37,252,255,
499 59,139,233,137,149,233,15,131,244,248,248,1,232,251,1,27,139,149,233,15,182, 520 7,0,0,193,252,237,11,61,252,255,7,0,0,15,148,209,137,108,36,8,1,200,139,108,
500 78,252,253,137,4,202,199,68,202,4,237,139,6,15,182,204,15,182,232,131,198, 521 36,48,1,200,137,68,36,4,137,116,36,24,139,139,233,137,44,36,59,139,233,137,
501 4,193,232,16,252,255,36,171,248,2,137,252,233,232,251,1,28,252,233,244,1, 522 149,233,15,131,244,248,248,1,232,251,1,27,139,149,233,15,182,78,252,253,137,
502 255,252,247,208,139,108,36,48,139,139,233,137,116,36,24,59,139,233,137,149, 523 4,202,199,68,202,4,237,139,6,15,182,204,15,182,232,131,198,4,193,232,16,252,
503 233,15,131,244,249,248,2,139,20,135,137,252,233,232,251,1,29,139,149,233, 524 255,36,171,248,2,137,252,233,232,251,1,28,252,233,244,1,255,252,247,208,139,
504 15,182,78,252,253,137,4,202,199,68,202,4,237,139,6,15,182,204,15,182,232, 525 108,36,48,139,139,233,137,116,36,24,59,139,233,137,149,233,15,131,244,249,
505 131,198,4,193,232,16,252,255,36,171,248,3,137,252,233,232,251,1,28,15,183, 526 248,2,139,20,135,137,252,233,232,251,1,29,139,149,233,15,182,78,252,253,137,
506 70,252,254,252,247,208,252,233,244,2,255,252,247,208,139,106,252,248,139, 527 4,202,199,68,202,4,237,139,6,15,182,204,15,182,232,131,198,4,193,232,16,252,
507 173,233,139,4,135,252,233,244,148,255,252,247,208,139,106,252,248,139,173, 528 255,36,171,248,3,137,252,233,232,251,1,28,15,183,70,252,254,252,247,208,252,
508 233,139,4,135,252,233,244,149,255,15,182,252,236,15,182,192,129,124,253,252, 529 233,244,2,255,252,247,208,139,106,252,248,139,173,233,139,4,135,252,233,244,
509 234,4,239,15,133,244,36,139,44,252,234,129,124,253,194,4,239,15,135,244,251, 530 148,255,252,247,208,139,106,252,248,139,173,233,139,4,135,252,233,244,149,
510 221,4,194,219,20,36,219,4,36,255,139,4,36,15,133,244,36,59,133,233,15,131, 531 255,15,182,252,236,15,182,192,129,124,253,252,234,4,239,15,133,244,36,139,
511 244,36,193,224,3,3,133,233,129,120,253,4,239,15,132,244,248,248,1,139,40, 532 44,252,234,129,124,253,194,4,239,15,135,244,251,221,4,194,219,20,36,219,4,
512 139,64,4,137,44,202,137,68,202,4,139,6,15,182,204,15,182,232,131,198,4,193, 533 36,255,139,4,36,15,133,244,36,59,133,233,15,131,244,36,193,224,3,3,133,233,
513 232,16,252,255,36,171,248,2,131,189,233,0,15,132,244,1,139,141,233,252,246, 534 129,120,253,4,239,15,132,244,248,248,1,139,40,139,64,4,137,44,202,137,68,
514 129,233,235,15,132,244,36,15,182,78,252,253,252,233,244,1,248,5,255,129,124, 535 202,4,139,6,15,182,204,15,182,232,131,198,4,193,232,16,252,255,36,171,248,
515 253,194,4,239,15,133,244,36,139,4,194,252,233,244,148,255,15,182,252,236, 536 2,131,189,233,0,15,132,244,1,139,141,233,252,246,129,233,235,15,132,244,36,
516 15,182,192,252,247,208,139,4,135,129,124,253,252,234,4,239,15,133,244,34, 537 15,182,78,252,253,252,233,244,1,248,5,255,129,124,253,194,4,239,15,133,244,
517 139,44,252,234,248,148,139,141,233,35,136,233,105,201,239,3,141,233,248,1, 538 36,139,4,194,252,233,244,148,255,15,182,252,236,15,182,192,252,247,208,139,
518 129,185,233,239,15,133,244,250,57,129,233,15,133,244,250,129,121,253,4,239, 539 4,135,129,124,253,252,234,4,239,15,133,244,34,139,44,252,234,248,148,139,
519 15,132,244,251,15,182,70,252,253,139,41,139,73,4,137,44,194,248,2,255,137, 540 141,233,35,136,233,105,201,239,3,141,233,248,1,129,185,233,239,15,133,244,
520 76,194,4,139,6,15,182,204,15,182,232,131,198,4,193,232,16,252,255,36,171, 541 250,57,129,233,15,133,244,250,129,121,253,4,239,15,132,244,251,15,182,70,
521 248,3,15,182,70,252,253,185,237,252,233,244,2,248,4,139,137,233,133,201,15, 542 252,253,139,41,139,73,4,137,44,194,248,2,255,137,76,194,4,139,6,15,182,204,
522 133,244,1,248,5,139,141,233,133,201,15,132,244,3,252,246,129,233,235,15,133, 543 15,182,232,131,198,4,193,232,16,252,255,36,171,248,3,15,182,70,252,253,185,
523 244,3,252,233,244,34,255,15,182,252,236,15,182,192,129,124,253,252,234,4, 544 237,252,233,244,2,248,4,139,137,233,133,201,15,133,244,1,248,5,139,141,233,
524 239,15,133,244,35,139,44,252,234,59,133,233,15,131,244,35,193,224,3,3,133, 545 133,201,15,132,244,3,252,246,129,233,235,15,133,244,3,252,233,244,34,255,
525 233,129,120,253,4,239,15,132,244,248,248,1,139,40,139,64,4,137,44,202,137, 546 15,182,252,236,15,182,192,129,124,253,252,234,4,239,15,133,244,35,139,44,
526 68,202,4,139,6,15,182,204,15,182,232,131,198,4,193,232,16,252,255,36,171, 547 252,234,59,133,233,15,131,244,35,193,224,3,3,133,233,129,120,253,4,239,15,
527 248,2,131,189,233,0,15,132,244,1,139,141,233,252,246,129,233,235,15,132,244, 548 132,244,248,248,1,139,40,139,64,4,137,44,202,137,68,202,4,139,6,15,182,204,
528 35,255,15,182,252,236,15,182,192,129,124,253,252,234,4,239,15,133,244,39, 549 15,182,232,131,198,4,193,232,16,252,255,36,171,248,2,131,189,233,0,15,132,
529 139,44,252,234,129,124,253,194,4,239,15,135,244,251,221,4,194,219,20,36,219, 550 244,1,139,141,233,252,246,129,233,235,15,132,244,35,255,15,182,252,236,15,
530 4,36,255,139,4,36,15,133,244,39,59,133,233,15,131,244,39,193,224,3,3,133, 551 182,192,129,124,253,252,234,4,239,15,133,244,39,139,44,252,234,129,124,253,
531 233,129,120,253,4,239,15,132,244,249,248,1,252,246,133,233,235,15,133,244, 552 194,4,239,15,135,244,251,221,4,194,219,20,36,219,4,36,255,139,4,36,15,133,
532 253,248,2,139,108,202,4,139,12,202,137,104,4,137,8,139,6,15,182,204,15,182, 553 244,39,59,133,233,15,131,244,39,193,224,3,3,133,233,129,120,253,4,239,15,
533 232,131,198,4,193,232,16,252,255,36,171,248,3,131,189,233,0,15,132,244,1, 554 132,244,249,248,1,252,246,133,233,235,15,133,244,253,248,2,139,108,202,4,
534 139,141,233,255,252,246,129,233,235,15,132,244,39,15,182,78,252,253,252,233, 555 139,12,202,137,104,4,137,8,139,6,15,182,204,15,182,232,131,198,4,193,232,
535 244,1,248,5,129,124,253,194,4,239,15,133,244,39,139,4,194,252,233,244,149, 556 16,252,255,36,171,248,3,131,189,233,0,15,132,244,1,139,141,233,255,252,246,
536 248,7,128,165,233,235,139,139,233,137,171,233,137,141,233,15,182,78,252,253, 557 129,233,235,15,132,244,39,15,182,78,252,253,252,233,244,1,248,5,129,124,253,
537 252,233,244,2,255,15,182,252,236,15,182,192,252,247,208,139,4,135,129,124, 558 194,4,239,15,133,244,39,139,4,194,252,233,244,149,248,7,128,165,233,235,139,
538 253,252,234,4,239,15,133,244,37,139,44,252,234,248,149,139,141,233,35,136, 559 139,233,137,171,233,137,141,233,15,182,78,252,253,252,233,244,2,255,15,182,
539 233,105,201,239,198,133,233,0,3,141,233,248,1,129,185,233,239,15,133,244, 560 252,236,15,182,192,252,247,208,139,4,135,129,124,253,252,234,4,239,15,133,
540 251,57,129,233,15,133,244,251,129,121,253,4,239,15,132,244,250,248,2,255, 561 244,37,139,44,252,234,248,149,139,141,233,35,136,233,105,201,239,198,133,
541 252,246,133,233,235,15,133,244,253,248,3,15,182,70,252,253,139,108,194,4, 562 233,0,3,141,233,248,1,129,185,233,239,15,133,244,251,57,129,233,15,133,244,
542 139,4,194,137,105,4,137,1,139,6,15,182,204,15,182,232,131,198,4,193,232,16, 563 251,129,121,253,4,239,15,132,244,250,248,2,255,252,246,133,233,235,15,133,
543 252,255,36,171,248,4,131,189,233,0,15,132,244,2,137,12,36,139,141,233,252, 564 244,253,248,3,15,182,70,252,253,139,108,194,4,139,4,194,137,105,4,137,1,139,
544 246,129,233,235,15,132,244,37,139,12,36,252,233,244,2,248,5,139,137,233,133, 565 6,15,182,204,15,182,232,131,198,4,193,232,16,252,255,36,171,248,4,131,189,
545 201,15,133,244,1,255,139,141,233,133,201,15,132,244,252,252,246,129,233,235, 566 233,0,15,132,244,2,137,12,36,139,141,233,252,246,129,233,235,15,132,244,37,
546 15,132,244,37,248,6,137,68,36,16,199,68,36,20,237,141,68,36,16,137,108,36, 567 139,12,36,252,233,244,2,248,5,139,137,233,133,201,15,133,244,1,255,139,141,
547 12,137,108,36,4,139,108,36,48,137,68,36,8,137,44,36,137,116,36,24,137,149, 568 233,133,201,15,132,244,252,252,246,129,233,235,15,132,244,37,248,6,137,68,
548 233,232,251,1,30,139,149,233,139,108,36,12,137,193,252,233,244,2,248,7,128, 569 36,16,199,68,36,20,237,141,68,36,16,137,108,36,12,137,108,36,4,139,108,36,
549 165,233,235,139,131,233,137,171,233,137,133,233,252,233,244,3,255,15,182, 570 48,137,68,36,8,137,44,36,137,116,36,24,137,149,233,232,251,1,30,139,149,233,
550 252,236,15,182,192,129,124,253,252,234,4,239,15,133,244,38,139,44,252,234, 571 139,108,36,12,137,193,252,233,244,2,248,7,128,165,233,235,139,131,233,137,
551 59,133,233,15,131,244,38,193,224,3,3,133,233,129,120,253,4,239,15,132,244, 572 171,233,137,133,233,252,233,244,3,255,15,182,252,236,15,182,192,129,124,253,
552 249,248,1,252,246,133,233,235,15,133,244,253,248,2,139,108,202,4,139,12,202, 573 252,234,4,239,15,133,244,38,139,44,252,234,59,133,233,15,131,244,38,193,224,
553 137,104,4,137,8,139,6,15,182,204,15,182,232,131,198,4,193,232,16,252,255, 574 3,3,133,233,129,120,253,4,239,15,132,244,249,248,1,252,246,133,233,235,15,
554 36,171,248,3,131,189,233,0,15,132,244,1,255,139,141,233,252,246,129,233,235, 575 133,244,253,248,2,139,108,202,4,139,12,202,137,104,4,137,8,139,6,15,182,204,
555 15,132,244,38,15,182,78,252,253,252,233,244,1,248,7,128,165,233,235,139,139, 576 15,182,232,131,198,4,193,232,16,252,255,36,171,248,3,131,189,233,0,15,132,
556 233,137,171,233,137,141,233,15,182,78,252,253,252,233,244,2,255,137,124,36, 577 244,1,255,139,141,233,252,246,129,233,235,15,132,244,38,15,182,78,252,253,
557 16,221,4,199,219,92,36,12,248,1,141,12,202,139,105,252,248,252,246,133,233, 578 252,233,244,1,248,7,128,165,233,235,139,139,233,137,171,233,137,141,233,15,
558 235,15,133,244,253,248,2,139,68,36,20,139,124,36,12,131,232,1,15,132,244, 579 182,78,252,253,252,233,244,2,255,137,124,36,16,221,4,199,219,92,36,12,248,
559 250,1,252,248,59,133,233,15,131,244,251,41,252,248,193,231,3,3,189,233,248, 580 1,141,12,202,139,105,252,248,252,246,133,233,235,15,133,244,253,248,2,139,
560 3,139,41,137,47,139,105,4,131,193,8,137,111,4,131,199,8,131,232,1,15,133, 581 68,36,20,139,124,36,12,131,232,1,15,132,244,250,1,252,248,59,133,233,15,131,
561 244,3,248,4,139,124,36,16,139,6,15,182,204,15,182,232,131,198,4,193,232,16, 582 244,251,41,252,248,193,231,3,3,189,233,248,3,139,41,137,47,139,105,4,131,
562 252,255,36,171,248,5,137,108,36,4,139,108,36,48,137,68,36,8,137,44,36,137, 583 193,8,137,111,4,131,199,8,131,232,1,15,133,244,3,248,4,139,124,36,16,139,
563 116,36,24,137,149,233,232,251,1,31,139,149,233,15,182,78,252,253,252,233, 584 6,15,182,204,15,182,232,131,198,4,193,232,16,252,255,36,171,248,5,137,108,
564 244,1,248,7,255,128,165,233,235,139,131,233,137,171,233,137,133,233,252,233, 585 36,4,139,108,36,48,137,68,36,8,137,44,36,137,116,36,24,137,149,233,232,251,
565 244,2,255,3,68,36,20,255,141,76,202,8,139,105,252,248,129,121,253,252,252, 586 1,31,139,149,233,15,182,78,252,253,252,233,244,1,248,7,255,128,165,233,235,
566 239,15,133,244,29,252,255,165,233,255,141,76,202,8,137,215,139,105,252,248, 587 139,131,233,137,171,233,137,133,233,252,233,244,2,255,3,68,36,20,255,141,
567 129,121,253,252,252,239,15,133,244,29,248,51,139,114,252,252,252,247,198, 588 76,202,8,139,105,252,248,129,121,253,252,252,239,15,133,244,29,252,255,165,
568 237,15,133,244,253,248,1,137,106,252,248,137,68,36,20,131,232,1,15,132,244, 589 233,255,141,76,202,8,137,215,139,105,252,248,129,121,253,252,252,239,15,133,
569 249,248,2,139,41,137,47,139,105,4,137,111,4,131,199,8,131,193,8,131,232,1, 590 244,29,248,51,139,114,252,252,252,247,198,237,15,133,244,253,248,1,137,106,
570 15,133,244,2,139,106,252,248,248,3,137,209,128,189,233,1,15,135,244,251,248, 591 252,248,137,68,36,20,131,232,1,15,132,244,249,248,2,139,41,137,47,139,105,
571 4,139,68,36,20,252,255,165,233,248,5,255,252,247,198,237,15,133,244,4,15, 592 4,137,111,4,131,199,8,131,193,8,131,232,1,15,133,244,2,139,106,252,248,248,
572 182,70,252,253,252,247,208,141,20,194,139,122,252,248,139,191,233,139,191, 593 3,137,209,128,189,233,1,15,135,244,251,248,4,139,68,36,20,252,255,165,233,
573 233,252,233,244,4,248,7,15,139,244,1,131,230,252,248,41,252,242,137,215,139, 594 248,5,255,252,247,198,237,15,133,244,4,15,182,70,252,253,252,247,208,141,
574 114,252,252,252,233,244,1,255,141,76,202,8,139,105,232,139,65,252,236,137, 595 20,194,139,122,252,248,139,191,233,139,191,233,252,233,244,4,248,7,15,139,
575 41,137,65,4,139,105,252,240,139,65,252,244,137,105,8,137,65,12,139,105,224, 596 244,1,131,230,252,248,41,252,242,137,215,139,114,252,252,252,233,244,1,255,
576 139,65,228,137,105,252,248,137,65,252,252,129,252,248,239,184,3,0,0,0,15, 597 141,76,202,8,139,105,232,139,65,252,236,137,41,137,65,4,139,105,252,240,139,
577 133,244,29,252,255,165,233,255,15,182,252,236,139,66,252,248,141,12,202,139, 598 65,252,244,137,105,8,137,65,12,139,105,224,139,65,228,137,105,252,248,137,
578 128,233,15,182,128,233,137,124,36,8,141,188,253,194,233,43,122,252,252,133, 599 65,252,252,129,252,248,239,184,3,0,0,0,15,133,244,29,252,255,165,233,255,
579 252,237,15,132,244,251,141,108,252,233,252,248,57,215,15,131,244,248,248, 600 15,182,252,236,139,66,252,248,141,12,202,139,128,233,15,182,128,233,137,124,
580 1,139,71,252,248,137,1,139,71,252,252,131,199,8,137,65,4,131,193,8,57,252, 601 36,8,141,188,253,194,233,43,122,252,252,133,252,237,15,132,244,251,141,108,
581 233,15,131,244,249,57,215,15,130,244,1,248,2,199,65,4,237,131,193,8,57,252, 602 252,233,252,248,57,215,15,131,244,248,248,1,139,71,252,248,137,1,139,71,252,
582 233,15,130,244,2,248,3,139,124,36,8,139,6,15,182,204,15,182,232,131,198,4, 603 252,131,199,8,137,65,4,131,193,8,57,252,233,15,131,244,249,57,215,15,130,
583 193,232,16,252,255,36,171,248,5,199,68,36,20,1,0,0,0,137,208,41,252,248,15, 604 244,1,248,2,199,65,4,237,131,193,8,57,252,233,15,130,244,2,248,3,139,124,
584 134,244,3,255,137,197,193,252,237,3,137,108,36,4,131,197,1,137,108,36,20, 605 36,8,139,6,15,182,204,15,182,232,131,198,4,193,232,16,252,255,36,171,248,
585 139,108,36,48,1,200,59,133,233,15,135,244,253,248,6,139,71,252,248,137,1, 606 5,199,68,36,20,1,0,0,0,137,208,41,252,248,15,134,244,3,255,137,197,193,252,
586 139,71,252,252,131,199,8,137,65,4,131,193,8,57,215,15,130,244,6,252,233,244, 607 237,3,137,108,36,4,131,197,1,137,108,36,20,139,108,36,48,1,200,59,133,233,
587 3,248,7,137,149,233,137,141,233,137,116,36,24,41,215,137,44,36,232,251,1, 608 15,135,244,253,248,6,139,71,252,248,137,1,139,71,252,252,131,199,8,137,65,
588 0,139,149,233,139,141,233,1,215,252,233,244,6,255,193,225,3,255,248,1,139, 609 4,131,193,8,57,215,15,130,244,6,252,233,244,3,248,7,137,149,233,137,141,233,
589 114,252,252,137,68,36,20,252,247,198,237,15,133,244,253,255,248,17,137,215, 610 137,116,36,24,41,215,137,44,36,232,251,1,0,139,149,233,139,141,233,1,215,
590 131,232,1,15,132,244,249,248,2,139,44,15,137,111,252,248,139,108,15,4,137, 611 252,233,244,6,255,193,225,3,255,248,1,139,114,252,252,137,68,36,20,252,247,
591 111,252,252,131,199,8,131,232,1,15,133,244,2,248,3,139,68,36,20,15,182,110, 612 198,237,15,133,244,253,255,248,17,137,215,131,232,1,15,132,244,249,248,2,
592 252,255,248,5,57,197,15,135,244,252,255,139,108,10,4,137,106,252,252,139, 613 139,44,15,137,111,252,248,139,108,15,4,137,111,252,252,131,199,8,131,232,
593 44,10,137,106,252,248,255,15,182,78,252,253,252,247,209,141,20,202,139,122, 614 1,15,133,244,2,248,3,139,68,36,20,15,182,110,252,255,248,5,57,197,15,135,
594 252,248,139,191,233,139,191,233,139,6,15,182,204,15,182,232,131,198,4,193, 615 244,252,255,139,108,10,4,137,106,252,252,139,44,10,137,106,252,248,255,15,
595 232,16,252,255,36,171,248,6,255,199,71,252,252,237,131,199,8,255,199,68,194, 616 182,78,252,253,252,247,209,141,20,202,139,122,252,248,139,191,233,139,191,
596 252,244,237,255,131,192,1,252,233,244,5,248,7,15,139,244,18,131,230,252,248, 617 233,139,6,15,182,204,15,182,232,131,198,4,193,232,16,252,255,36,171,248,6,
597 41,252,242,255,1,252,241,255,137,252,245,209,252,237,129,229,239,102,131, 618 255,199,71,252,252,237,131,199,8,255,199,68,194,252,244,237,255,131,192,1,
598 172,253,43,233,1,15,132,244,136,255,141,12,202,255,129,121,253,4,239,15,135, 619 252,233,244,5,248,7,15,139,244,18,131,230,252,248,41,252,242,255,1,252,241,
599 244,52,129,121,253,12,239,15,135,244,52,255,139,105,20,255,129,252,253,239, 620 255,137,252,245,209,252,237,129,229,239,102,131,172,253,43,233,1,15,132,244,
600 15,135,244,52,255,221,65,8,221,1,255,220,65,16,221,17,255,221,81,24,133,252, 621 136,255,141,12,202,255,129,121,253,4,239,15,135,244,52,129,121,253,12,239,
601 237,15,136,244,247,217,201,248,1,255,15,183,70,252,254,255,15,131,244,248, 622 15,135,244,52,255,139,105,20,255,129,252,253,239,15,135,244,52,255,221,65,
602 141,180,253,134,233,255,141,180,253,134,233,15,183,70,252,254,15,131,245, 623 8,221,1,255,220,65,16,221,17,255,221,81,24,133,252,237,15,136,244,247,217,
603 255,15,130,244,248,141,180,253,134,233,255,141,12,202,139,105,4,129,252,253, 624 201,248,1,255,15,183,70,252,254,255,15,131,244,248,141,180,253,134,233,255,
604 239,15,132,244,247,255,137,105,252,252,139,41,137,105,252,248,252,233,245, 625 141,180,253,134,233,15,183,70,252,254,15,131,245,255,15,130,244,248,141,180,
605 255,141,180,253,134,233,139,1,137,105,252,252,137,65,252,248,255,139,139, 626 253,134,233,255,141,12,202,139,105,4,129,252,253,239,15,132,244,247,255,137,
606 233,139,4,129,139,128,233,139,108,36,48,137,147,233,137,171,233,252,255,224, 627 105,252,252,139,41,137,105,252,248,252,233,245,255,141,180,253,134,233,139,
607 255,141,180,253,134,233,139,6,15,182,204,15,182,232,131,198,4,193,232,16, 628 1,137,105,252,252,137,65,252,248,255,139,139,233,139,4,129,139,128,233,139,
608 252,255,36,171,255,254,0 629 108,36,48,137,147,233,137,171,233,252,255,224,255,141,180,253,134,233,139,
630 6,15,182,204,15,182,232,131,198,4,193,232,16,252,255,36,171,255,254,0
609}; 631};
610 632
611enum { 633enum {
@@ -948,7 +970,7 @@ static const char *const extnames[] = {
948 970
949/* Generate subroutines used by opcodes and other parts of the VM. */ 971/* Generate subroutines used by opcodes and other parts of the VM. */
950/* The .code_sub section should be last to help static branch prediction. */ 972/* The .code_sub section should be last to help static branch prediction. */
951static void build_subroutines(BuildCtx *ctx, int cmov) 973static void build_subroutines(BuildCtx *ctx, int cmov, int sse)
952{ 974{
953 dasm_put(Dst, 0); 975 dasm_put(Dst, 0);
954 dasm_put(Dst, 2, Dt7(->pt), Dt9(->framesize), Dt9(->bc), Dt9(->k), Dt1(->maxstack), LJ_TNIL); 976 dasm_put(Dst, 2, Dt7(->pt), Dt9(->framesize), Dt9(->bc), Dt9(->k), Dt1(->maxstack), LJ_TNIL);
@@ -1062,39 +1084,53 @@ static void build_subroutines(BuildCtx *ctx, int cmov)
1062 dasm_put(Dst, 7349, Dt7(->pt), Dt9(->k), DISPATCH_GL(jit_L), DISPATCH_GL(vmstate), ~LJ_VMST_INTERP); 1084 dasm_put(Dst, 7349, Dt7(->pt), Dt9(->k), DISPATCH_GL(jit_L), DISPATCH_GL(vmstate), ~LJ_VMST_INTERP);
1063#endif 1085#endif
1064 dasm_put(Dst, 7389); 1086 dasm_put(Dst, 7389);
1065 if (cmov) { 1087 if (sse) {
1066 dasm_put(Dst, 7653); 1088 dasm_put(Dst, 7524);
1067 } else { 1089 } else {
1068 dasm_put(Dst, 7657); 1090 dasm_put(Dst, 7654);
1069 } 1091 }
1070 dasm_put(Dst, 7666); 1092 dasm_put(Dst, 7700);
1071 dasm_put(Dst, 7735);
1072 dasm_put(Dst, 7837);
1073 if (cmov) { 1093 if (cmov) {
1074 dasm_put(Dst, 7850); 1094 dasm_put(Dst, 7785);
1075 } else { 1095 } else {
1076 dasm_put(Dst, 7854); 1096 dasm_put(Dst, 7789);
1077 } 1097 }
1078 dasm_put(Dst, 7863); 1098 dasm_put(Dst, 7798);
1099 dasm_put(Dst, 7867);
1100 dasm_put(Dst, 7969);
1079 if (cmov) { 1101 if (cmov) {
1080 dasm_put(Dst, 7653); 1102 dasm_put(Dst, 7982);
1081 } else { 1103 } else {
1082 dasm_put(Dst, 7881); 1104 dasm_put(Dst, 7986);
1083 } 1105 }
1084 dasm_put(Dst, 7888); 1106 dasm_put(Dst, 7995);
1085 dasm_put(Dst, 8003);
1086 dasm_put(Dst, 8096);
1087 dasm_put(Dst, 8192);
1088 if (cmov) { 1107 if (cmov) {
1089 dasm_put(Dst, 8251); 1108 dasm_put(Dst, 7785);
1090 } else { 1109 } else {
1091 dasm_put(Dst, 8270); 1110 dasm_put(Dst, 8013);
1092 } 1111 }
1093 dasm_put(Dst, 8311); 1112 dasm_put(Dst, 8020);
1113 dasm_put(Dst, 8135);
1114 dasm_put(Dst, 8228);
1115 if (sse) {
1116 dasm_put(Dst, 8246);
1117 dasm_put(Dst, 8333);
1118 dasm_put(Dst, 8427);
1119 } else {
1120 dasm_put(Dst, 8513);
1121 dasm_put(Dst, 8596);
1122 if (cmov) {
1123 dasm_put(Dst, 8651);
1124 } else {
1125 dasm_put(Dst, 8670);
1126 }
1127 dasm_put(Dst, 8711);
1128 }
1129 dasm_put(Dst, 8715);
1094} 1130}
1095 1131
1096/* Generate the code for a single instruction. */ 1132/* Generate the code for a single instruction. */
1097static void build_ins(BuildCtx *ctx, BCOp op, int defop, int cmov) 1133static void build_ins(BuildCtx *ctx, BCOp op, int defop, int cmov, int sse)
1098{ 1134{
1099 int vk = 0; 1135 int vk = 0;
1100 dasm_put(Dst, 1454, defop); 1136 dasm_put(Dst, 1454, defop);
@@ -1106,403 +1142,612 @@ static void build_ins(BuildCtx *ctx, BCOp op, int defop, int cmov)
1106 /* Remember: all ops branch for a true comparison, fall through otherwise. */ 1142 /* Remember: all ops branch for a true comparison, fall through otherwise. */
1107 1143
1108 case BC_ISLT: case BC_ISGE: case BC_ISLE: case BC_ISGT: 1144 case BC_ISLT: case BC_ISGE: case BC_ISLE: case BC_ISGT:
1109 dasm_put(Dst, 8368, LJ_TISNUM, LJ_TISNUM); 1145 dasm_put(Dst, 8769, LJ_TISNUM, LJ_TISNUM);
1110 if (cmov) { 1146 if (sse) {
1111 dasm_put(Dst, 8398); 1147 dasm_put(Dst, 8790);
1112 } else { 1148 } else {
1113 dasm_put(Dst, 8404); 1149 dasm_put(Dst, 8805);
1150 if (cmov) {
1151 dasm_put(Dst, 8815);
1152 } else {
1153 dasm_put(Dst, 8821);
1154 }
1114 } 1155 }
1115 switch (op) { 1156 switch (op) {
1116 case BC_ISLT: 1157 case BC_ISLT:
1117 dasm_put(Dst, 8411); 1158 dasm_put(Dst, 8828);
1118 break; 1159 break;
1119 case BC_ISGE: 1160 case BC_ISGE:
1120 dasm_put(Dst, 8416); 1161 dasm_put(Dst, 8591);
1121 break; 1162 break;
1122 case BC_ISLE: 1163 case BC_ISLE:
1123 dasm_put(Dst, 5884); 1164 dasm_put(Dst, 5884);
1124 break; 1165 break;
1125 case BC_ISGT: 1166 case BC_ISGT:
1126 dasm_put(Dst, 8421); 1167 dasm_put(Dst, 8833);
1127 break; 1168 break;
1128 default: break; /* Shut up GCC. */ 1169 default: break; /* Shut up GCC. */
1129 } 1170 }
1130 dasm_put(Dst, 8426, -BCBIAS_J*4); 1171 dasm_put(Dst, 8838, -BCBIAS_J*4);
1131 break; 1172 break;
1132 1173
1133 case BC_ISEQV: case BC_ISNEV: 1174 case BC_ISEQV: case BC_ISNEV:
1134 vk = op == BC_ISEQV; 1175 vk = op == BC_ISEQV;
1135 dasm_put(Dst, 8459, LJ_TISNUM, LJ_TISNUM); 1176 dasm_put(Dst, 8871, LJ_TISNUM, LJ_TISNUM);
1136 if (cmov) { 1177 if (sse) {
1137 dasm_put(Dst, 8398); 1178 dasm_put(Dst, 8897);
1138 } else { 1179 } else {
1139 dasm_put(Dst, 8404); 1180 dasm_put(Dst, 8909);
1181 if (cmov) {
1182 dasm_put(Dst, 8815);
1183 } else {
1184 dasm_put(Dst, 8821);
1185 }
1140 } 1186 }
1141 iseqne_fp: 1187 iseqne_fp:
1142 if (vk) { 1188 if (vk) {
1143 dasm_put(Dst, 8491); 1189 dasm_put(Dst, 8916);
1144 } else { 1190 } else {
1145 dasm_put(Dst, 8500); 1191 dasm_put(Dst, 8925);
1146 } 1192 }
1147 iseqne_end: 1193 iseqne_end:
1148 if (vk) { 1194 if (vk) {
1149 dasm_put(Dst, 8509, -BCBIAS_J*4); 1195 dasm_put(Dst, 8934, -BCBIAS_J*4);
1150 } else { 1196 } else {
1151 dasm_put(Dst, 8524, -BCBIAS_J*4); 1197 dasm_put(Dst, 8949, -BCBIAS_J*4);
1152 } 1198 }
1153 dasm_put(Dst, 7174); 1199 dasm_put(Dst, 7174);
1154 if (op == BC_ISEQV || op == BC_ISNEV) { 1200 if (op == BC_ISEQV || op == BC_ISNEV) {
1155 dasm_put(Dst, 8539, LJ_TISPRI, LJ_TISTABUD, Dt6(->metatable), Dt6(->nomm), 1<<MM_eq); 1201 dasm_put(Dst, 8964, LJ_TISPRI, LJ_TISTABUD, Dt6(->metatable), Dt6(->nomm), 1<<MM_eq);
1156 if (vk) { 1202 if (vk) {
1157 dasm_put(Dst, 8597); 1203 dasm_put(Dst, 9022);
1158 } else { 1204 } else {
1159 dasm_put(Dst, 8601); 1205 dasm_put(Dst, 9026);
1160 } 1206 }
1161 dasm_put(Dst, 8607); 1207 dasm_put(Dst, 9032);
1162 } 1208 }
1163 break; 1209 break;
1164 case BC_ISEQS: case BC_ISNES: 1210 case BC_ISEQS: case BC_ISNES:
1165 vk = op == BC_ISEQS; 1211 vk = op == BC_ISEQS;
1166 dasm_put(Dst, 8612, LJ_TSTR); 1212 dasm_put(Dst, 9037, LJ_TSTR);
1167 iseqne_test: 1213 iseqne_test:
1168 if (vk) { 1214 if (vk) {
1169 dasm_put(Dst, 8495); 1215 dasm_put(Dst, 8920);
1170 } else { 1216 } else {
1171 dasm_put(Dst, 8187); 1217 dasm_put(Dst, 8929);
1172 } 1218 }
1173 goto iseqne_end; 1219 goto iseqne_end;
1174 case BC_ISEQN: case BC_ISNEN: 1220 case BC_ISEQN: case BC_ISNEN:
1175 vk = op == BC_ISEQN; 1221 vk = op == BC_ISEQN;
1176 dasm_put(Dst, 8635, LJ_TISNUM); 1222 dasm_put(Dst, 9060, LJ_TISNUM);
1177 if (cmov) { 1223 if (sse) {
1178 dasm_put(Dst, 8398); 1224 dasm_put(Dst, 9074);
1179 } else { 1225 } else {
1180 dasm_put(Dst, 8404); 1226 dasm_put(Dst, 9086);
1227 if (cmov) {
1228 dasm_put(Dst, 8815);
1229 } else {
1230 dasm_put(Dst, 8821);
1231 }
1181 } 1232 }
1182 goto iseqne_fp; 1233 goto iseqne_fp;
1183 case BC_ISEQP: case BC_ISNEP: 1234 case BC_ISEQP: case BC_ISNEP:
1184 vk = op == BC_ISEQP; 1235 vk = op == BC_ISEQP;
1185 dasm_put(Dst, 8655); 1236 dasm_put(Dst, 9093);
1186 goto iseqne_test; 1237 goto iseqne_test;
1187 1238
1188 /* -- Unary test and copy ops ------------------------------------------- */ 1239 /* -- Unary test and copy ops ------------------------------------------- */
1189 1240
1190 case BC_ISTC: case BC_ISFC: case BC_IST: case BC_ISF: 1241 case BC_ISTC: case BC_ISFC: case BC_IST: case BC_ISF:
1191 dasm_put(Dst, 8666, LJ_TISTRUECOND); 1242 dasm_put(Dst, 9104, LJ_TISTRUECOND);
1192 if (op == BC_IST || op == BC_ISTC) { 1243 if (op == BC_IST || op == BC_ISTC) {
1193 dasm_put(Dst, 8678); 1244 dasm_put(Dst, 9116);
1194 } else { 1245 } else {
1195 dasm_put(Dst, 8683); 1246 dasm_put(Dst, 9121);
1196 } 1247 }
1197 if (op == BC_ISTC || op == BC_ISFC) { 1248 if (op == BC_ISTC || op == BC_ISFC) {
1198 dasm_put(Dst, 8688); 1249 dasm_put(Dst, 9126);
1199 } 1250 }
1200 dasm_put(Dst, 8699, -BCBIAS_J*4); 1251 dasm_put(Dst, 9137, -BCBIAS_J*4);
1201 break; 1252 break;
1202 1253
1203 /* -- Unary ops --------------------------------------------------------- */ 1254 /* -- Unary ops --------------------------------------------------------- */
1204 1255
1205 case BC_MOV: 1256 case BC_MOV:
1206 dasm_put(Dst, 8730); 1257 dasm_put(Dst, 9168);
1207 break; 1258 break;
1208 case BC_NOT: 1259 case BC_NOT:
1209 dasm_put(Dst, 8763, LJ_TISTRUECOND, LJ_TTRUE); 1260 dasm_put(Dst, 9201, LJ_TISTRUECOND, LJ_TTRUE);
1210 break; 1261 break;
1211 case BC_UNM: 1262 case BC_UNM:
1212 dasm_put(Dst, 8798, LJ_TISNUM); 1263 dasm_put(Dst, 9236, LJ_TISNUM);
1264 if (sse) {
1265 dasm_put(Dst, 9247);
1266 } else {
1267 dasm_put(Dst, 9277);
1268 }
1269 dasm_put(Dst, 7174);
1213 break; 1270 break;
1214 case BC_LEN: 1271 case BC_LEN:
1215 dasm_put(Dst, 8835, LJ_TSTR, Dt5(->len), LJ_TTAB); 1272 dasm_put(Dst, 9286, LJ_TSTR);
1273 if (sse) {
1274 dasm_put(Dst, 9300, Dt5(->len));
1275 } else {
1276 dasm_put(Dst, 9318, Dt5(->len));
1277 }
1278 dasm_put(Dst, 9327, LJ_TTAB);
1279 if (sse) {
1280 dasm_put(Dst, 9367);
1281 } else {
1282 dasm_put(Dst, 9376);
1283 }
1284 dasm_put(Dst, 9386);
1216 break; 1285 break;
1217 1286
1218 /* -- Binary ops -------------------------------------------------------- */ 1287 /* -- Binary ops -------------------------------------------------------- */
1219 1288
1220 1289
1221 case BC_ADDVN: case BC_ADDNV: case BC_ADDVV: 1290 case BC_ADDVN: case BC_ADDNV: case BC_ADDVV:
1222 dasm_put(Dst, 8914); 1291 dasm_put(Dst, 9396);
1223 vk = ((int)op - BC_ADDVN) / (BC_ADDNV-BC_ADDVN); 1292 vk = ((int)op - BC_ADDVN) / (BC_ADDNV-BC_ADDVN);
1224 switch (vk) { 1293 switch (vk) {
1225 case 0: 1294 case 0:
1226 dasm_put(Dst, 8922, LJ_TISNUM); 1295 dasm_put(Dst, 9404, LJ_TISNUM);
1296 if (sse) {
1297 dasm_put(Dst, 9416);
1298 } else {
1299 dasm_put(Dst, 9430);
1300 }
1227 break; 1301 break;
1228 case 1: 1302 case 1:
1229 dasm_put(Dst, 8941, LJ_TISNUM); 1303 dasm_put(Dst, 9438, LJ_TISNUM);
1304 if (sse) {
1305 dasm_put(Dst, 9450);
1306 } else {
1307 dasm_put(Dst, 9464);
1308 }
1230 break; 1309 break;
1231 default: 1310 default:
1232 dasm_put(Dst, 8960, LJ_TISNUM, LJ_TISNUM); 1311 dasm_put(Dst, 9472, LJ_TISNUM, LJ_TISNUM);
1312 if (sse) {
1313 dasm_put(Dst, 9494);
1314 } else {
1315 dasm_put(Dst, 9508);
1316 }
1233 break; 1317 break;
1234 } 1318 }
1235 dasm_put(Dst, 8813); 1319 if (sse) {
1320 dasm_put(Dst, 9270);
1321 } else {
1322 dasm_put(Dst, 9282);
1323 }
1324 dasm_put(Dst, 7174);
1236 break; 1325 break;
1237 case BC_SUBVN: case BC_SUBNV: case BC_SUBVV: 1326 case BC_SUBVN: case BC_SUBNV: case BC_SUBVV:
1238 dasm_put(Dst, 8914); 1327 dasm_put(Dst, 9396);
1239 vk = ((int)op - BC_ADDVN) / (BC_ADDNV-BC_ADDVN); 1328 vk = ((int)op - BC_ADDVN) / (BC_ADDNV-BC_ADDVN);
1240 switch (vk) { 1329 switch (vk) {
1241 case 0: 1330 case 0:
1242 dasm_put(Dst, 8989, LJ_TISNUM); 1331 dasm_put(Dst, 9404, LJ_TISNUM);
1332 if (sse) {
1333 dasm_put(Dst, 9516);
1334 } else {
1335 dasm_put(Dst, 9530);
1336 }
1243 break; 1337 break;
1244 case 1: 1338 case 1:
1245 dasm_put(Dst, 9008, LJ_TISNUM); 1339 dasm_put(Dst, 9438, LJ_TISNUM);
1340 if (sse) {
1341 dasm_put(Dst, 9538);
1342 } else {
1343 dasm_put(Dst, 9552);
1344 }
1246 break; 1345 break;
1247 default: 1346 default:
1248 dasm_put(Dst, 9027, LJ_TISNUM, LJ_TISNUM); 1347 dasm_put(Dst, 9472, LJ_TISNUM, LJ_TISNUM);
1348 if (sse) {
1349 dasm_put(Dst, 9560);
1350 } else {
1351 dasm_put(Dst, 9574);
1352 }
1249 break; 1353 break;
1250 } 1354 }
1251 dasm_put(Dst, 8813); 1355 if (sse) {
1356 dasm_put(Dst, 9270);
1357 } else {
1358 dasm_put(Dst, 9282);
1359 }
1360 dasm_put(Dst, 7174);
1252 break; 1361 break;
1253 case BC_MULVN: case BC_MULNV: case BC_MULVV: 1362 case BC_MULVN: case BC_MULNV: case BC_MULVV:
1254 dasm_put(Dst, 8914); 1363 dasm_put(Dst, 9396);
1255 vk = ((int)op - BC_ADDVN) / (BC_ADDNV-BC_ADDVN); 1364 vk = ((int)op - BC_ADDVN) / (BC_ADDNV-BC_ADDVN);
1256 switch (vk) { 1365 switch (vk) {
1257 case 0: 1366 case 0:
1258 dasm_put(Dst, 9056, LJ_TISNUM); 1367 dasm_put(Dst, 9404, LJ_TISNUM);
1368 if (sse) {
1369 dasm_put(Dst, 9582);
1370 } else {
1371 dasm_put(Dst, 9596);
1372 }
1259 break; 1373 break;
1260 case 1: 1374 case 1:
1261 dasm_put(Dst, 9075, LJ_TISNUM); 1375 dasm_put(Dst, 9438, LJ_TISNUM);
1376 if (sse) {
1377 dasm_put(Dst, 9604);
1378 } else {
1379 dasm_put(Dst, 9618);
1380 }
1262 break; 1381 break;
1263 default: 1382 default:
1264 dasm_put(Dst, 9094, LJ_TISNUM, LJ_TISNUM); 1383 dasm_put(Dst, 9472, LJ_TISNUM, LJ_TISNUM);
1384 if (sse) {
1385 dasm_put(Dst, 9626);
1386 } else {
1387 dasm_put(Dst, 9640);
1388 }
1265 break; 1389 break;
1266 } 1390 }
1267 dasm_put(Dst, 8813); 1391 if (sse) {
1392 dasm_put(Dst, 9270);
1393 } else {
1394 dasm_put(Dst, 9282);
1395 }
1396 dasm_put(Dst, 7174);
1268 break; 1397 break;
1269 case BC_DIVVN: case BC_DIVNV: case BC_DIVVV: 1398 case BC_DIVVN: case BC_DIVNV: case BC_DIVVV:
1270 dasm_put(Dst, 8914); 1399 dasm_put(Dst, 9396);
1271 vk = ((int)op - BC_ADDVN) / (BC_ADDNV-BC_ADDVN); 1400 vk = ((int)op - BC_ADDVN) / (BC_ADDNV-BC_ADDVN);
1272 switch (vk) { 1401 switch (vk) {
1273 case 0: 1402 case 0:
1274 dasm_put(Dst, 9123, LJ_TISNUM); 1403 dasm_put(Dst, 9404, LJ_TISNUM);
1404 if (sse) {
1405 dasm_put(Dst, 9648);
1406 } else {
1407 dasm_put(Dst, 9662);
1408 }
1275 break; 1409 break;
1276 case 1: 1410 case 1:
1277 dasm_put(Dst, 9142, LJ_TISNUM); 1411 dasm_put(Dst, 9438, LJ_TISNUM);
1412 if (sse) {
1413 dasm_put(Dst, 9670);
1414 } else {
1415 dasm_put(Dst, 9684);
1416 }
1278 break; 1417 break;
1279 default: 1418 default:
1280 dasm_put(Dst, 9161, LJ_TISNUM, LJ_TISNUM); 1419 dasm_put(Dst, 9472, LJ_TISNUM, LJ_TISNUM);
1420 if (sse) {
1421 dasm_put(Dst, 9692);
1422 } else {
1423 dasm_put(Dst, 9706);
1424 }
1281 break; 1425 break;
1282 } 1426 }
1283 dasm_put(Dst, 8813); 1427 if (sse) {
1428 dasm_put(Dst, 9270);
1429 } else {
1430 dasm_put(Dst, 9282);
1431 }
1432 dasm_put(Dst, 7174);
1284 break; 1433 break;
1285 case BC_MODVN: 1434 case BC_MODVN:
1286 dasm_put(Dst, 8914); 1435 dasm_put(Dst, 9396);
1287 vk = ((int)op - BC_ADDVN) / (BC_ADDNV-BC_ADDVN); 1436 vk = ((int)op - BC_ADDVN) / (BC_ADDNV-BC_ADDVN);
1288 switch (vk) { 1437 switch (vk) {
1289 case 0: 1438 case 0:
1290 dasm_put(Dst, 9190, LJ_TISNUM); 1439 dasm_put(Dst, 9404, LJ_TISNUM);
1440 if (sse) {
1441 dasm_put(Dst, 9714);
1442 } else {
1443 dasm_put(Dst, 9728);
1444 }
1291 break; 1445 break;
1292 case 1: 1446 case 1:
1293 dasm_put(Dst, 9209, LJ_TISNUM); 1447 dasm_put(Dst, 9438, LJ_TISNUM);
1448 if (sse) {
1449 dasm_put(Dst, 9736);
1450 } else {
1451 dasm_put(Dst, 9750);
1452 }
1294 break; 1453 break;
1295 default: 1454 default:
1296 dasm_put(Dst, 9228, LJ_TISNUM, LJ_TISNUM); 1455 dasm_put(Dst, 9472, LJ_TISNUM, LJ_TISNUM);
1456 if (sse) {
1457 dasm_put(Dst, 9758);
1458 } else {
1459 dasm_put(Dst, 9772);
1460 }
1297 break; 1461 break;
1298 } 1462 }
1299 dasm_put(Dst, 9257); 1463 dasm_put(Dst, 9780);
1464 if (sse) {
1465 dasm_put(Dst, 9270);
1466 } else {
1467 dasm_put(Dst, 9282);
1468 }
1469 dasm_put(Dst, 7174);
1300 break; 1470 break;
1301 case BC_MODNV: case BC_MODVV: 1471 case BC_MODNV: case BC_MODVV:
1302 dasm_put(Dst, 8914); 1472 dasm_put(Dst, 9396);
1303 vk = ((int)op - BC_ADDVN) / (BC_ADDNV-BC_ADDVN); 1473 vk = ((int)op - BC_ADDVN) / (BC_ADDNV-BC_ADDVN);
1304 switch (vk) { 1474 switch (vk) {
1305 case 0: 1475 case 0:
1306 dasm_put(Dst, 9190, LJ_TISNUM); 1476 dasm_put(Dst, 9404, LJ_TISNUM);
1477 if (sse) {
1478 dasm_put(Dst, 9714);
1479 } else {
1480 dasm_put(Dst, 9728);
1481 }
1307 break; 1482 break;
1308 case 1: 1483 case 1:
1309 dasm_put(Dst, 9209, LJ_TISNUM); 1484 dasm_put(Dst, 9438, LJ_TISNUM);
1485 if (sse) {
1486 dasm_put(Dst, 9736);
1487 } else {
1488 dasm_put(Dst, 9750);
1489 }
1310 break; 1490 break;
1311 default: 1491 default:
1312 dasm_put(Dst, 9228, LJ_TISNUM, LJ_TISNUM); 1492 dasm_put(Dst, 9472, LJ_TISNUM, LJ_TISNUM);
1493 if (sse) {
1494 dasm_put(Dst, 9758);
1495 } else {
1496 dasm_put(Dst, 9772);
1497 }
1313 break; 1498 break;
1314 } 1499 }
1315 dasm_put(Dst, 9284); 1500 dasm_put(Dst, 9786);
1316 break; 1501 break;
1317 case BC_POW: 1502 case BC_POW:
1318 dasm_put(Dst, 8914); 1503 if (sse) {
1319 vk = ((int)op - BC_ADDVN) / (BC_ADDNV-BC_ADDVN); 1504 sse = 0; /* NYI: temporary workaround. */
1320 switch (vk) { 1505 dasm_put(Dst, 9396);
1321 case 0: 1506 vk = ((int)op - BC_ADDVN) / (BC_ADDNV-BC_ADDVN);
1322 dasm_put(Dst, 9190, LJ_TISNUM); 1507 switch (vk) {
1323 break; 1508 case 0:
1324 case 1: 1509 dasm_put(Dst, 9404, LJ_TISNUM);
1325 dasm_put(Dst, 9209, LJ_TISNUM); 1510 if (sse) {
1326 break; 1511 dasm_put(Dst, 9714);
1327 default: 1512 } else {
1328 dasm_put(Dst, 9228, LJ_TISNUM, LJ_TISNUM); 1513 dasm_put(Dst, 9728);
1329 break; 1514 }
1515 break;
1516 case 1:
1517 dasm_put(Dst, 9438, LJ_TISNUM);
1518 if (sse) {
1519 dasm_put(Dst, 9736);
1520 } else {
1521 dasm_put(Dst, 9750);
1522 }
1523 break;
1524 default:
1525 dasm_put(Dst, 9472, LJ_TISNUM, LJ_TISNUM);
1526 if (sse) {
1527 dasm_put(Dst, 9758);
1528 } else {
1529 dasm_put(Dst, 9772);
1530 }
1531 break;
1532 }
1533 dasm_put(Dst, 9791);
1534 if (sse) {
1535 dasm_put(Dst, 9270);
1536 } else {
1537 dasm_put(Dst, 9282);
1538 }
1539 sse = 1;
1540 } else {
1541 dasm_put(Dst, 9396);
1542 vk = ((int)op - BC_ADDVN) / (BC_ADDNV-BC_ADDVN);
1543 switch (vk) {
1544 case 0:
1545 dasm_put(Dst, 9404, LJ_TISNUM);
1546 if (sse) {
1547 dasm_put(Dst, 9714);
1548 } else {
1549 dasm_put(Dst, 9728);
1550 }
1551 break;
1552 case 1:
1553 dasm_put(Dst, 9438, LJ_TISNUM);
1554 if (sse) {
1555 dasm_put(Dst, 9736);
1556 } else {
1557 dasm_put(Dst, 9750);
1558 }
1559 break;
1560 default:
1561 dasm_put(Dst, 9472, LJ_TISNUM, LJ_TISNUM);
1562 if (sse) {
1563 dasm_put(Dst, 9758);
1564 } else {
1565 dasm_put(Dst, 9772);
1566 }
1567 break;
1568 }
1569 dasm_put(Dst, 9791);
1570 if (sse) {
1571 dasm_put(Dst, 9270);
1572 } else {
1573 dasm_put(Dst, 9282);
1574 }
1330 } 1575 }
1331 dasm_put(Dst, 9289); 1576 dasm_put(Dst, 7174);
1332 break; 1577 break;
1333 1578
1334 case BC_CAT: 1579 case BC_CAT:
1335 dasm_put(Dst, 9314, Dt1(->base), Dt1(->base)); 1580 dasm_put(Dst, 9795, Dt1(->base), Dt1(->base));
1336 break; 1581 break;
1337 1582
1338 /* -- Constant ops ------------------------------------------------------ */ 1583 /* -- Constant ops ------------------------------------------------------ */
1339 1584
1340 case BC_KSTR: 1585 case BC_KSTR:
1341 dasm_put(Dst, 9408, LJ_TSTR); 1586 dasm_put(Dst, 9889, LJ_TSTR);
1342 break; 1587 break;
1343 case BC_KSHORT: 1588 case BC_KSHORT:
1344 dasm_put(Dst, 9441); 1589 dasm_put(Dst, 9922);
1345 break; 1590 break;
1346 case BC_KNUM: 1591 case BC_KNUM:
1347 dasm_put(Dst, 9467); 1592 dasm_put(Dst, 9948);
1348 break; 1593 break;
1349 case BC_KPRI: 1594 case BC_KPRI:
1350 dasm_put(Dst, 9492); 1595 dasm_put(Dst, 9973);
1351 break; 1596 break;
1352 case BC_KNIL: 1597 case BC_KNIL:
1353 dasm_put(Dst, 9518, LJ_TNIL); 1598 dasm_put(Dst, 9999, LJ_TNIL);
1354 break; 1599 break;
1355 1600
1356 /* -- Upvalue and function ops ------------------------------------------ */ 1601 /* -- Upvalue and function ops ------------------------------------------ */
1357 1602
1358 case BC_UGET: 1603 case BC_UGET:
1359 dasm_put(Dst, 9564, offsetof(GCfuncL, uvptr), DtA(->v)); 1604 dasm_put(Dst, 10045, offsetof(GCfuncL, uvptr), DtA(->v));
1360 break; 1605 break;
1361 case BC_USETV: 1606 case BC_USETV:
1362#define TV2MARKOFS \ 1607#define TV2MARKOFS \
1363 ((int32_t)offsetof(GCupval, marked)-(int32_t)offsetof(GCupval, tv)) 1608 ((int32_t)offsetof(GCupval, marked)-(int32_t)offsetof(GCupval, tv))
1364 dasm_put(Dst, 9608, offsetof(GCfuncL, uvptr), DtA(->closed), DtA(->v), TV2MARKOFS, LJ_GC_BLACK, LJ_TISGCV, LJ_TISNUM - LJ_TISGCV, Dt4(->gch.marked), LJ_GC_WHITES, GG_DISP2G); 1609 dasm_put(Dst, 10089, offsetof(GCfuncL, uvptr), DtA(->closed), DtA(->v), TV2MARKOFS, LJ_GC_BLACK, LJ_TISGCV, LJ_TISNUM - LJ_TISGCV, Dt4(->gch.marked), LJ_GC_WHITES, GG_DISP2G);
1365 dasm_put(Dst, 9698); 1610 dasm_put(Dst, 10179);
1366 break; 1611 break;
1367#undef TV2MARKOFS 1612#undef TV2MARKOFS
1368 case BC_USETS: 1613 case BC_USETS:
1369 dasm_put(Dst, 9710, offsetof(GCfuncL, uvptr), DtA(->v), LJ_TSTR, DtA(->marked), LJ_GC_BLACK, Dt4(->gch.marked), LJ_GC_WHITES, DtA(->closed), GG_DISP2G); 1614 dasm_put(Dst, 10191, offsetof(GCfuncL, uvptr), DtA(->v), LJ_TSTR, DtA(->marked), LJ_GC_BLACK, Dt4(->gch.marked), LJ_GC_WHITES, DtA(->closed), GG_DISP2G);
1370 break; 1615 break;
1371 case BC_USETN: 1616 case BC_USETN:
1372 dasm_put(Dst, 9801, offsetof(GCfuncL, uvptr), DtA(->v)); 1617 dasm_put(Dst, 10282, offsetof(GCfuncL, uvptr), DtA(->v));
1373 break; 1618 break;
1374 case BC_USETP: 1619 case BC_USETP:
1375 dasm_put(Dst, 9837, offsetof(GCfuncL, uvptr), DtA(->v)); 1620 dasm_put(Dst, 10318, offsetof(GCfuncL, uvptr), DtA(->v));
1376 break; 1621 break;
1377 case BC_UCLO: 1622 case BC_UCLO:
1378 dasm_put(Dst, 9874, -BCBIAS_J*4, Dt1(->openupval), Dt1(->base), Dt1(->base)); 1623 dasm_put(Dst, 10355, -BCBIAS_J*4, Dt1(->openupval), Dt1(->base), Dt1(->base));
1379 break; 1624 break;
1380 1625
1381 case BC_FNEW: 1626 case BC_FNEW:
1382 dasm_put(Dst, 9932, Dt1(->base), Dt1(->base), LJ_TFUNC); 1627 dasm_put(Dst, 10413, Dt1(->base), Dt1(->base), LJ_TFUNC);
1383 break; 1628 break;
1384 1629
1385 /* -- Table ops --------------------------------------------------------- */ 1630 /* -- Table ops --------------------------------------------------------- */
1386 1631
1387 case BC_TNEW: 1632 case BC_TNEW:
1388 dasm_put(Dst, 10003, DISPATCH_GL(gc.total), DISPATCH_GL(gc.threshold), Dt1(->base), Dt1(->base), LJ_TTAB); 1633 dasm_put(Dst, 10484, DISPATCH_GL(gc.total), DISPATCH_GL(gc.threshold), Dt1(->base), Dt1(->base), LJ_TTAB);
1389 break; 1634 break;
1390 case BC_TDUP: 1635 case BC_TDUP:
1391 dasm_put(Dst, 10114, DISPATCH_GL(gc.total), DISPATCH_GL(gc.threshold), Dt1(->base), Dt1(->base), LJ_TTAB); 1636 dasm_put(Dst, 10595, DISPATCH_GL(gc.total), DISPATCH_GL(gc.threshold), Dt1(->base), Dt1(->base), LJ_TTAB);
1392 break; 1637 break;
1393 1638
1394 case BC_GGET: 1639 case BC_GGET:
1395 dasm_put(Dst, 10206, Dt7(->env)); 1640 dasm_put(Dst, 10687, Dt7(->env));
1396 break; 1641 break;
1397 case BC_GSET: 1642 case BC_GSET:
1398 dasm_put(Dst, 10224, Dt7(->env)); 1643 dasm_put(Dst, 10705, Dt7(->env));
1399 break; 1644 break;
1400 1645
1401 case BC_TGETV: 1646 case BC_TGETV:
1402 dasm_put(Dst, 10242, LJ_TTAB, LJ_TISNUM); 1647 dasm_put(Dst, 10723, LJ_TTAB, LJ_TISNUM);
1403 if (cmov) { 1648 if (cmov) {
1404 dasm_put(Dst, 8398); 1649 dasm_put(Dst, 8815);
1405 } else { 1650 } else {
1406 dasm_put(Dst, 8404); 1651 dasm_put(Dst, 8821);
1407 } 1652 }
1408 dasm_put(Dst, 10284, Dt6(->asize), Dt6(->array), LJ_TNIL, Dt6(->metatable), Dt6(->metatable), Dt6(->nomm), 1<<MM_index); 1653 dasm_put(Dst, 10765, Dt6(->asize), Dt6(->array), LJ_TNIL, Dt6(->metatable), Dt6(->metatable), Dt6(->nomm), 1<<MM_index);
1409 dasm_put(Dst, 10379, LJ_TSTR); 1654 dasm_put(Dst, 10860, LJ_TSTR);
1410 break; 1655 break;
1411 case BC_TGETS: 1656 case BC_TGETS:
1412 dasm_put(Dst, 10397, LJ_TTAB, Dt6(->hmask), Dt5(->hash), sizeof(Node), Dt6(->node), DtB(->key.it), LJ_TSTR, DtB(->key.gcr), LJ_TNIL); 1657 dasm_put(Dst, 10878, LJ_TTAB, Dt6(->hmask), Dt5(->hash), sizeof(Node), Dt6(->node), DtB(->key.it), LJ_TSTR, DtB(->key.gcr), LJ_TNIL);
1413 dasm_put(Dst, 10481, LJ_TNIL, DtB(->next), Dt6(->metatable), Dt6(->nomm), 1<<MM_index); 1658 dasm_put(Dst, 10962, LJ_TNIL, DtB(->next), Dt6(->metatable), Dt6(->nomm), 1<<MM_index);
1414 break; 1659 break;
1415 case BC_TGETB: 1660 case BC_TGETB:
1416 dasm_put(Dst, 10552, LJ_TTAB, Dt6(->asize), Dt6(->array), LJ_TNIL, Dt6(->metatable), Dt6(->metatable), Dt6(->nomm), 1<<MM_index); 1661 dasm_put(Dst, 11033, LJ_TTAB, Dt6(->asize), Dt6(->array), LJ_TNIL, Dt6(->metatable), Dt6(->metatable), Dt6(->nomm), 1<<MM_index);
1417 dasm_put(Dst, 8904); 1662 dasm_put(Dst, 9386);
1418 break; 1663 break;
1419 1664
1420 case BC_TSETV: 1665 case BC_TSETV:
1421 dasm_put(Dst, 10651, LJ_TTAB, LJ_TISNUM); 1666 dasm_put(Dst, 11132, LJ_TTAB, LJ_TISNUM);
1422 if (cmov) { 1667 if (cmov) {
1423 dasm_put(Dst, 8398); 1668 dasm_put(Dst, 8815);
1424 } else { 1669 } else {
1425 dasm_put(Dst, 8404); 1670 dasm_put(Dst, 8821);
1426 } 1671 }
1427 dasm_put(Dst, 10693, Dt6(->asize), Dt6(->array), LJ_TNIL, Dt6(->marked), LJ_GC_BLACK, Dt6(->metatable), Dt6(->metatable)); 1672 dasm_put(Dst, 11174, Dt6(->asize), Dt6(->array), LJ_TNIL, Dt6(->marked), LJ_GC_BLACK, Dt6(->metatable), Dt6(->metatable));
1428 dasm_put(Dst, 10779, Dt6(->nomm), 1<<MM_newindex, LJ_TSTR, Dt6(->marked), cast_byte(~LJ_GC_BLACK), DISPATCH_GL(gc.grayagain), DISPATCH_GL(gc.grayagain), Dt6(->gclist)); 1673 dasm_put(Dst, 11260, Dt6(->nomm), 1<<MM_newindex, LJ_TSTR, Dt6(->marked), cast_byte(~LJ_GC_BLACK), DISPATCH_GL(gc.grayagain), DISPATCH_GL(gc.grayagain), Dt6(->gclist));
1429 break; 1674 break;
1430 case BC_TSETS: 1675 case BC_TSETS:
1431 dasm_put(Dst, 10841, LJ_TTAB, Dt6(->hmask), Dt5(->hash), sizeof(Node), Dt6(->nomm), Dt6(->node), DtB(->key.it), LJ_TSTR, DtB(->key.gcr), LJ_TNIL); 1676 dasm_put(Dst, 11322, LJ_TTAB, Dt6(->hmask), Dt5(->hash), sizeof(Node), Dt6(->nomm), Dt6(->node), DtB(->key.it), LJ_TSTR, DtB(->key.gcr), LJ_TNIL);
1432 dasm_put(Dst, 10916, Dt6(->marked), LJ_GC_BLACK, Dt6(->metatable), Dt6(->metatable), Dt6(->nomm), 1<<MM_newindex, DtB(->next)); 1677 dasm_put(Dst, 11397, Dt6(->marked), LJ_GC_BLACK, Dt6(->metatable), Dt6(->metatable), Dt6(->nomm), 1<<MM_newindex, DtB(->next));
1433 dasm_put(Dst, 11006, Dt6(->metatable), Dt6(->nomm), 1<<MM_newindex, LJ_TSTR, Dt1(->base), Dt1(->base), Dt6(->marked), cast_byte(~LJ_GC_BLACK), DISPATCH_GL(gc.grayagain), DISPATCH_GL(gc.grayagain), Dt6(->gclist)); 1678 dasm_put(Dst, 11487, Dt6(->metatable), Dt6(->nomm), 1<<MM_newindex, LJ_TSTR, Dt1(->base), Dt1(->base), Dt6(->marked), cast_byte(~LJ_GC_BLACK), DISPATCH_GL(gc.grayagain), DISPATCH_GL(gc.grayagain), Dt6(->gclist));
1434 break; 1679 break;
1435 case BC_TSETB: 1680 case BC_TSETB:
1436 dasm_put(Dst, 11102, LJ_TTAB, Dt6(->asize), Dt6(->array), LJ_TNIL, Dt6(->marked), LJ_GC_BLACK, Dt6(->metatable)); 1681 dasm_put(Dst, 11583, LJ_TTAB, Dt6(->asize), Dt6(->array), LJ_TNIL, Dt6(->marked), LJ_GC_BLACK, Dt6(->metatable));
1437 dasm_put(Dst, 11200, Dt6(->metatable), Dt6(->nomm), 1<<MM_newindex, Dt6(->marked), cast_byte(~LJ_GC_BLACK), DISPATCH_GL(gc.grayagain), DISPATCH_GL(gc.grayagain), Dt6(->gclist)); 1682 dasm_put(Dst, 11681, Dt6(->metatable), Dt6(->nomm), 1<<MM_newindex, Dt6(->marked), cast_byte(~LJ_GC_BLACK), DISPATCH_GL(gc.grayagain), DISPATCH_GL(gc.grayagain), Dt6(->gclist));
1438 break; 1683 break;
1439 1684
1440 case BC_TSETM: 1685 case BC_TSETM:
1441 dasm_put(Dst, 11246, Dt6(->marked), LJ_GC_BLACK, Dt6(->asize), Dt6(->array), Dt1(->base), Dt1(->base)); 1686 dasm_put(Dst, 11727, Dt6(->marked), LJ_GC_BLACK, Dt6(->asize), Dt6(->array), Dt1(->base), Dt1(->base));
1442 dasm_put(Dst, 11403, Dt6(->marked), cast_byte(~LJ_GC_BLACK), DISPATCH_GL(gc.grayagain), DISPATCH_GL(gc.grayagain), Dt6(->gclist)); 1687 dasm_put(Dst, 11884, Dt6(->marked), cast_byte(~LJ_GC_BLACK), DISPATCH_GL(gc.grayagain), DISPATCH_GL(gc.grayagain), Dt6(->gclist));
1443 break; 1688 break;
1444 1689
1445 /* -- Calls and vararg handling ----------------------------------------- */ 1690 /* -- Calls and vararg handling ----------------------------------------- */
1446 1691
1447 case BC_CALL: case BC_CALLM: 1692 case BC_CALL: case BC_CALLM:
1448 dasm_put(Dst, 8918); 1693 dasm_put(Dst, 9400);
1449 if (op == BC_CALLM) { 1694 if (op == BC_CALLM) {
1450 dasm_put(Dst, 11421); 1695 dasm_put(Dst, 11902);
1451 } 1696 }
1452 dasm_put(Dst, 11426, LJ_TFUNC, Dt7(->gate)); 1697 dasm_put(Dst, 11907, LJ_TFUNC, Dt7(->gate));
1453 break; 1698 break;
1454 1699
1455 case BC_CALLMT: 1700 case BC_CALLMT:
1456 dasm_put(Dst, 11421); 1701 dasm_put(Dst, 11902);
1457 break; 1702 break;
1458 case BC_CALLT: 1703 case BC_CALLT:
1459 dasm_put(Dst, 11449, LJ_TFUNC, FRAME_TYPE, Dt7(->ffid), Dt7(->gate)); 1704 dasm_put(Dst, 11930, LJ_TFUNC, FRAME_TYPE, Dt7(->ffid), Dt7(->gate));
1460 dasm_put(Dst, 11554, FRAME_TYPE, Dt7(->pt), Dt9(->k)); 1705 dasm_put(Dst, 12035, FRAME_TYPE, Dt7(->pt), Dt9(->k));
1461 break; 1706 break;
1462 1707
1463 case BC_ITERC: 1708 case BC_ITERC:
1464 dasm_put(Dst, 11611, LJ_TFUNC, Dt7(->gate)); 1709 dasm_put(Dst, 12092, LJ_TFUNC, Dt7(->gate));
1465 break; 1710 break;
1466 1711
1467 case BC_VARG: 1712 case BC_VARG:
1468 dasm_put(Dst, 11673, Dt7(->pt), Dt9(->numparams), (8+FRAME_VARG), LJ_TNIL); 1713 dasm_put(Dst, 12154, Dt7(->pt), Dt9(->numparams), (8+FRAME_VARG), LJ_TNIL);
1469 dasm_put(Dst, 11817, Dt1(->maxstack), Dt1(->base), Dt1(->top), Dt1(->base), Dt1(->top)); 1714 dasm_put(Dst, 12298, Dt1(->maxstack), Dt1(->base), Dt1(->top), Dt1(->base), Dt1(->top));
1470 break; 1715 break;
1471 1716
1472 /* -- Returns ----------------------------------------------------------- */ 1717 /* -- Returns ----------------------------------------------------------- */
1473 1718
1474 case BC_RETM: 1719 case BC_RETM:
1475 dasm_put(Dst, 11421); 1720 dasm_put(Dst, 11902);
1476 break; 1721 break;
1477 1722
1478 case BC_RET: case BC_RET0: case BC_RET1: 1723 case BC_RET: case BC_RET0: case BC_RET1:
1479 if (op != BC_RET0) { 1724 if (op != BC_RET0) {
1480 dasm_put(Dst, 11912); 1725 dasm_put(Dst, 12393);
1481 } 1726 }
1482 dasm_put(Dst, 11916, FRAME_TYPE); 1727 dasm_put(Dst, 12397, FRAME_TYPE);
1483 switch (op) { 1728 switch (op) {
1484 case BC_RET: 1729 case BC_RET:
1485 dasm_put(Dst, 11935); 1730 dasm_put(Dst, 12416);
1486 break; 1731 break;
1487 case BC_RET1: 1732 case BC_RET1:
1488 dasm_put(Dst, 11993); 1733 dasm_put(Dst, 12474);
1489 /* fallthrough */ 1734 /* fallthrough */
1490 case BC_RET0: 1735 case BC_RET0:
1491 dasm_put(Dst, 3824); 1736 dasm_put(Dst, 3824);
1492 default: 1737 default:
1493 break; 1738 break;
1494 } 1739 }
1495 dasm_put(Dst, 12009, Dt7(->pt), Dt9(->k)); 1740 dasm_put(Dst, 12490, Dt7(->pt), Dt9(->k));
1496 if (op == BC_RET) { 1741 if (op == BC_RET) {
1497 dasm_put(Dst, 12051, LJ_TNIL); 1742 dasm_put(Dst, 12532, LJ_TNIL);
1498 } else { 1743 } else {
1499 dasm_put(Dst, 12060, LJ_TNIL); 1744 dasm_put(Dst, 12541, LJ_TNIL);
1500 } 1745 }
1501 dasm_put(Dst, 12067); 1746 dasm_put(Dst, 12548);
1502 if (op != BC_RET0) { 1747 if (op != BC_RET0) {
1503 dasm_put(Dst, 12088); 1748 dasm_put(Dst, 12569);
1504 } 1749 }
1505 dasm_put(Dst, 8909); 1750 dasm_put(Dst, 9391);
1506 break; 1751 break;
1507 1752
1508 /* -- Loops and branches ------------------------------------------------ */ 1753 /* -- Loops and branches ------------------------------------------------ */
@@ -1510,7 +1755,7 @@ static void build_ins(BuildCtx *ctx, BCOp op, int defop, int cmov)
1510 1755
1511 case BC_FORL: 1756 case BC_FORL:
1512#if LJ_HASJIT 1757#if LJ_HASJIT
1513 dasm_put(Dst, 12092, HOTCOUNT_PCMASK, GG_DISP2HOT); 1758 dasm_put(Dst, 12573, HOTCOUNT_PCMASK, GG_DISP2HOT);
1514#endif 1759#endif
1515 break; 1760 break;
1516 1761
@@ -1522,42 +1767,42 @@ static void build_ins(BuildCtx *ctx, BCOp op, int defop, int cmov)
1522 case BC_FORI: 1767 case BC_FORI:
1523 case BC_IFORL: 1768 case BC_IFORL:
1524 vk = (op == BC_IFORL || op == BC_JFORL); 1769 vk = (op == BC_IFORL || op == BC_JFORL);
1525 dasm_put(Dst, 12113); 1770 dasm_put(Dst, 12594);
1526 if (!vk) { 1771 if (!vk) {
1527 dasm_put(Dst, 12117, LJ_TISNUM, LJ_TISNUM); 1772 dasm_put(Dst, 12598, LJ_TISNUM, LJ_TISNUM);
1528 } 1773 }
1529 dasm_put(Dst, 12136); 1774 dasm_put(Dst, 12617);
1530 if (!vk) { 1775 if (!vk) {
1531 dasm_put(Dst, 12140, LJ_TISNUM); 1776 dasm_put(Dst, 12621, LJ_TISNUM);
1532 } 1777 }
1533 dasm_put(Dst, 12149); 1778 dasm_put(Dst, 12630);
1534 if (vk) { 1779 if (vk) {
1535 dasm_put(Dst, 12155); 1780 dasm_put(Dst, 12636);
1536 } 1781 }
1537 dasm_put(Dst, 12161); 1782 dasm_put(Dst, 12642);
1538 if (cmov) { 1783 if (cmov) {
1539 dasm_put(Dst, 8398); 1784 dasm_put(Dst, 8815);
1540 } else { 1785 } else {
1541 dasm_put(Dst, 8404); 1786 dasm_put(Dst, 8821);
1542 } 1787 }
1543 if (!cmov) { 1788 if (!cmov) {
1544 dasm_put(Dst, 12176); 1789 dasm_put(Dst, 12657);
1545 } 1790 }
1546 if (op == BC_FORI) { 1791 if (op == BC_FORI) {
1547 dasm_put(Dst, 12182, -BCBIAS_J*4); 1792 dasm_put(Dst, 12663, -BCBIAS_J*4);
1548 } else if (op == BC_JFORI) { 1793 } else if (op == BC_JFORI) {
1549 dasm_put(Dst, 12192, -BCBIAS_J*4, BC_JLOOP); 1794 dasm_put(Dst, 12673, -BCBIAS_J*4, BC_JLOOP);
1550 } else if (op == BC_IFORL) { 1795 } else if (op == BC_IFORL) {
1551 dasm_put(Dst, 12206, -BCBIAS_J*4); 1796 dasm_put(Dst, 12687, -BCBIAS_J*4);
1552 } else { 1797 } else {
1553 dasm_put(Dst, 12202, BC_JLOOP); 1798 dasm_put(Dst, 12683, BC_JLOOP);
1554 } 1799 }
1555 dasm_put(Dst, 8438); 1800 dasm_put(Dst, 8850);
1556 break; 1801 break;
1557 1802
1558 case BC_ITERL: 1803 case BC_ITERL:
1559#if LJ_HASJIT 1804#if LJ_HASJIT
1560 dasm_put(Dst, 12092, HOTCOUNT_PCMASK, GG_DISP2HOT); 1805 dasm_put(Dst, 12573, HOTCOUNT_PCMASK, GG_DISP2HOT);
1561#endif 1806#endif
1562 break; 1807 break;
1563 1808
@@ -1566,18 +1811,18 @@ static void build_ins(BuildCtx *ctx, BCOp op, int defop, int cmov)
1566 break; 1811 break;
1567#endif 1812#endif
1568 case BC_IITERL: 1813 case BC_IITERL:
1569 dasm_put(Dst, 12216, LJ_TNIL); 1814 dasm_put(Dst, 12697, LJ_TNIL);
1570 if (op == BC_JITERL) { 1815 if (op == BC_JITERL) {
1571 dasm_put(Dst, 12231, BC_JLOOP); 1816 dasm_put(Dst, 12712, BC_JLOOP);
1572 } else { 1817 } else {
1573 dasm_put(Dst, 12245, -BCBIAS_J*4); 1818 dasm_put(Dst, 12726, -BCBIAS_J*4);
1574 } 1819 }
1575 dasm_put(Dst, 8709); 1820 dasm_put(Dst, 9147);
1576 break; 1821 break;
1577 1822
1578 case BC_LOOP: 1823 case BC_LOOP:
1579#if LJ_HASJIT 1824#if LJ_HASJIT
1580 dasm_put(Dst, 12092, HOTCOUNT_PCMASK, GG_DISP2HOT); 1825 dasm_put(Dst, 12573, HOTCOUNT_PCMASK, GG_DISP2HOT);
1581#endif 1826#endif
1582 break; 1827 break;
1583 1828
@@ -1587,12 +1832,12 @@ static void build_ins(BuildCtx *ctx, BCOp op, int defop, int cmov)
1587 1832
1588 case BC_JLOOP: 1833 case BC_JLOOP:
1589#if LJ_HASJIT 1834#if LJ_HASJIT
1590 dasm_put(Dst, 12261, DISPATCH_J(trace), DtD(->mcode), DISPATCH_GL(jit_base), DISPATCH_GL(jit_L)); 1835 dasm_put(Dst, 12742, DISPATCH_J(trace), DtD(->mcode), DISPATCH_GL(jit_base), DISPATCH_GL(jit_L));
1591#endif 1836#endif
1592 break; 1837 break;
1593 1838
1594 case BC_JMP: 1839 case BC_JMP:
1595 dasm_put(Dst, 12284, -BCBIAS_J*4); 1840 dasm_put(Dst, 12765, -BCBIAS_J*4);
1596 break; 1841 break;
1597 1842
1598 /* ---------------------------------------------------------------------- */ 1843 /* ---------------------------------------------------------------------- */
@@ -1608,17 +1853,21 @@ static int build_backend(BuildCtx *ctx)
1608{ 1853{
1609 int op; 1854 int op;
1610 int cmov = 1; 1855 int cmov = 1;
1856 int sse = 0;
1611#ifdef LUAJIT_CPU_NOCMOV 1857#ifdef LUAJIT_CPU_NOCMOV
1612 cmov = 0; 1858 cmov = 0;
1613#endif 1859#endif
1860#ifdef LUAJIT_CPU_SSE2
1861 sse = 1;
1862#endif
1614 1863
1615 dasm_growpc(Dst, BC__MAX); 1864 dasm_growpc(Dst, BC__MAX);
1616 1865
1617 build_subroutines(ctx, cmov); 1866 build_subroutines(ctx, cmov, sse);
1618 1867
1619 dasm_put(Dst, 12308); 1868 dasm_put(Dst, 12789);
1620 for (op = 0; op < BC__MAX; op++) 1869 for (op = 0; op < BC__MAX; op++)
1621 build_ins(ctx, (BCOp)op, op, cmov); 1870 build_ins(ctx, (BCOp)op, op, cmov, sse);
1622 1871
1623 return BC__MAX; 1872 return BC__MAX;
1624} 1873}