TempleOSCDV4.05.ISO
This commit is contained in:
1 parent
d1856315e0
commit
6fe38d2d9d
118 files changed
+4559
-5069
No files matched your search
@@ -1,4 +1,4 @@
|
||||
/*"Fixed point" means you use integers
|
||||
/*"Fixed point" means you use ints
|
||||
that are scaled by a value. A common
|
||||
example would be using number of pennies
|
||||
instead of dollars with a float.
|
||||
@@ -10,7 +10,7 @@ and my compiler used to do floats poorly.
|
||||
It's a little better.
|
||||
|
||||
I often use 64-bit ints with upper 32-bits
|
||||
as integer and lower 32-bits as fraction.
|
||||
as int and lower 32-bits as fraction.
|
||||
|
||||
See $LK,"::/Demo/SubIntAccess.CPP"$ for how
|
||||
to access upper or lower 32-bits.
|
||||
@@ -29,7 +29,7 @@ U0 Main()
|
||||
t0=tS;
|
||||
for (i=1000000000;i;i--)
|
||||
i_sum+=i_val;
|
||||
"Integer Sum:%.9f Time:%7.3fs\n",i_sum/ToF64(0x100000000),tS-t0;
|
||||
"Int Sum:%.9f Time:%7.3fs\n",i_sum/ToF64(0x100000000),tS-t0;
|
||||
|
||||
f_val= 2.0000002;
|
||||
t0=tS;
|
||||
@@ -47,7 +47,7 @@ U0 DoIt2()
|
||||
"i&0xFFFFFFFF=%X\n",i&0xFFFFFFFF;
|
||||
"i>>32 =%X\n",i>>32;
|
||||
|
||||
/* Standard integer types are declared
|
||||
/* Standard int types are declared
|
||||
with a special compiler feature which
|
||||
allows a structure to be accessed as a
|
||||
whole. That's why the i variable can
|
||||
@@ -87,7 +87,7 @@ DoIt2;
|
||||
/*Program Output$HL,0$$WW+H,1$$FD,1$
|
||||
|
||||
8 Cores 2.660GHz
|
||||
Integer Sum:2000000199.768689408 Time: 0.787s
|
||||
Int Sum:2000000199.768689408 Time: 0.787s
|
||||
Float Sum:2000000225.656126208 Time: 3.918s
|
||||
|
||||
i =123456789ABCDEF0
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/*"Fixed point" means you use integers
|
||||
/*"Fixed point" means you use ints
|
||||
that are scaled by a value. A common
|
||||
example would be using number of pennies
|
||||
instead of dollars with a float.
|
||||
@@ -9,7 +9,7 @@ floats. It also depends on the compiler
|
||||
and my compiler used to do floats poorly.
|
||||
|
||||
I often use 64-bit ints with upper 32-bits
|
||||
as integer and lower 32-bits as fraction.
|
||||
as int and lower 32-bits as fraction.
|
||||
|
||||
See $LK,"::/Demo/SubIntAccess.CPP"$ for how
|
||||
to access upper or lower 32-bits.
|
||||
|
||||
@@ -11,7 +11,7 @@ $ID,-2$
|
||||
$TR,"Mini Compiler"$
|
||||
$ID,2$For this mini compiler, some things you should know about 64-bit asm:
|
||||
|
||||
* Putting a 0x48, known as the REX byte, in front of an instruction makes it 64-bit size.
|
||||
* Putting a 0x48, known as the REX byte, in front of an inst makes it 64-bit size.
|
||||
|
||||
* "PUSH EAX", "POP EAX" and "XOR EAX,EAX" will behave as 64-bit even without REX because the stk is always 64 bit and because the XOR clears the upper 32-bits.
|
||||
|
||||
@@ -112,7 +112,7 @@ U0 PrsTerm(U8 **_src,U8 **_dst,I64 prec)
|
||||
|
||||
I64 Parse(U8 **_src,U8 **_dst)
|
||||
{//See $LK,"PrsExpression",A="MN:PrsExpression"$().
|
||||
//See $LK,"Opcode Fmts",A="FF:::/Compiler/OpCodes.TXT,IDIV"$ for details on asm instructions.
|
||||
//See $LK,"Opcode Fmts",A="FF:::/Compiler/OpCodes.TXT,IDIV"$ for details on asm insts.
|
||||
I64 i;
|
||||
U8 *dst=*_dst;
|
||||
switch (Lex(_src,&i)) {
|
||||
@@ -204,7 +204,7 @@ U0 Main()
|
||||
|
||||
while (TRUE) {
|
||||
"This will compile an expression\n"
|
||||
"consisting of integers, parentheses\n"
|
||||
"consisting of ints, parentheses\n"
|
||||
"and the operators +,-,* and /.\n";
|
||||
src=GetStr;
|
||||
if (*src) {
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
/*The moral of this story is simple
|
||||
instruction level optimizations
|
||||
inst level optimizations
|
||||
don't matter much on a modern Intel CPU
|
||||
because they convert complex instructions
|
||||
to a stream of RISC instructions.
|
||||
because they convert complex insts
|
||||
to a stream of RISC insts.
|
||||
|
||||
I learned this the hard way when I thought
|
||||
I was greatly improving my compiler by
|
||||
@@ -61,7 +61,7 @@ _WELL_OPTIMIZED3::
|
||||
XOR RAX,RAX
|
||||
MOV RCX,SAMPLES-1
|
||||
@@05: ADD RAX,RCX
|
||||
LOOP @@05 //Instruction sucks in speed, but saves code size.
|
||||
LOOP @@05 //Inst sucks in speed, but saves code size.
|
||||
RET
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user