From 4c0d59ff16f76dcbe0c16cf34e6a09dbc2422f93 Mon Sep 17 00:00:00 2001 From: Moon Flower Date: Wed, 20 Aug 2025 14:31:59 +0330 Subject: compat flags explanation --- pu2/pu2.out.c | 24 ++++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) (limited to 'pu2/pu2.out.c') diff --git a/pu2/pu2.out.c b/pu2/pu2.out.c index 98f0554..cd403f5 100644 --- a/pu2/pu2.out.c +++ b/pu2/pu2.out.c @@ -1,10 +1,26 @@ +// clang-format off + // COMPILE TIME FLAGS EXPLANATION + // - NO_MMAP Prevents usage of mmap+hugepages, which is only supported on linux + // - NO_ASM Prevents usage of inline assembly, useful for non-x86 platforms + // - BAD_CLOCK Use if your system clock does not support nanoseconds. Uses microseconds instead. + // - OLD_CLANG Use if your compiler version is not very up-to-date. + // - SPEED_IMPROVEMENT Almost doubles clock rate for the VM with a few optimizations. + // - EXTENDED_INSTRUCTION_SET Adds a few instructions which decrease token throughput for ir2. The high-level IR emitter will not work otherwise. +// clang-format on + /* -- BEGIN COMPILE TIME FLAGS -- */ // #define PU2_NO_MMAP // #define PU2_NO_ASM -#define __PU2_SPEED_IMPROVEMENT -#define __PU2_EXTENDED_INSTRUCTION_SET +// #define PU2_BAD_CLOCK +// #define PU2_OLD_CLANG +#define PU2_SPEED_IMPROVEMENT +#define PU2_EXTENDED_INSTRUCTION_SET /* -- END COMPILE TIME FLAGS --*/ +#ifdef PU2_NO_ASM + #warning Enabling this flag will invalidate all clock speed and cycle count measurements (thus, your CPU clock rate will be reported as 0MHz) +#endif + #define _GNU_SOURCE #include #include @@ -32,9 +48,9 @@ #define J while #define H !--c -#ifndef __PU2_SPEED_IMPROVEMENT +#ifndef PU2_SPEED_IMPROVEMENT - #ifndef __PU2_EXTENDED_INSTRUCTION_SET + #ifndef PU2_EXTENDED_INSTRUCTION_SET // clang-format off m[S],c,v,a,b,u;pu2(){J(c=m[m[7]++],v=m[m[7]++],c){H?a=v:H?a=m[b]:H?u?m[a]=b:0:H?v=a,a=b,b=v:H?a+=b:H?a-=b:H?a&=b:H?a=!a:H?u=v:H?u=a:H?a=u:H?u=b:H?b=u:A;}} -- cgit v1.2.3