Tom St Denis said:
Feeding the troll...
you ever think the compiler/compiler options could be to blame?
GCC with "-O3 -fomit-frame-pointer" on an x86_64 box produced the
following asm from this C source
**** GCC and all that shit lol that s even worse LOL no just kidding... it's
nice for making little stinking cross compilers LOL.
You want fucking assembler you got mister smart ass.
Stick this were the sun dont shine:
Fresh assembler straight out of Visual Studio .NET 2003 disassembly.
And I like this kinda of assembler much better than the shit that you
posted...
What the **** is that shit ?
This shit below represent the intel instruction set much more clear than
your posted SSSSHITTTT.
Now that we have some decent assembler shit we can go analyze, assimilate
and analizate it haha.
But you pretend to be the assembler smart ass so first I let you have a go
at it...
Because I have better things to do than analyze bullshit Visual Studio
shit...
And remember buddy/smartass hehe... I dont even know what the visual studio
optimizer settings are...
For all I care they off... I never really use the piece of shit... DUH...
It shouldn't matter anyway... default settings much always be good
*
--- y:\c
testen\arrayaccesstest\arrayaccesstest\arrayaccesstest.cpp ------------
// ArrayAccessTest.cpp : Defines the entry point for the console
application.
//
#include "stdafx.h"
#include "windows.h"
#include "stdlib.h"
int _tmain(int argc, _TCHAR* argv[])
{
00411C80 push ebp
00411C81 mov ebp,esp
00411C83 sub esp,130h
00411C89 push ebx
00411C8A push esi
00411C8B push edi
00411C8C lea edi,[ebp-130h]
00411C92 mov ecx,4Ch
00411C97 mov eax,0CCCCCCCCh
00411C9C rep stos dword ptr [edi]
//int ***vArray;
int Tick1;
int Tick2;
int Interval;
int x,y,z;
int *vArray = new int[300*300*300];
00411C9E push 66FF300h
00411CA3 call operator new[] (411253h)
00411CA8 add esp,4
00411CAB mov dword ptr [ebp-128h],eax
00411CB1 mov eax,dword ptr [ebp-128h]
00411CB7 mov dword ptr [vArray],eax
// test 1
Tick1 = GetTickCount();
00411CBA mov esi,esp
00411CBC call dword ptr [__imp__GetTickCount@0 (42F18Ch)]
00411CC2 cmp esi,esp
00411CC4 call @ILT+1160(__RTC_CheckEsp) (41148Dh)
00411CC9 mov dword ptr [Tick1],eax
for (x=0; x<300; x++)
00411CCC mov dword ptr [x],0
00411CD3 jmp main+5Eh (411CDEh)
00411CD5 mov eax,dword ptr [x]
00411CD8 add eax,1
00411CDB mov dword ptr [x],eax
00411CDE cmp dword ptr [x],12Ch
00411CE5 jge main+0CAh (411D4Ah)
{
for (y=0; y<300; y++)
00411CE7 mov dword ptr [y],0
00411CEE jmp main+79h (411CF9h)
00411CF0 mov eax,dword ptr [y]
00411CF3 add eax,1
00411CF6 mov dword ptr [y],eax
00411CF9 cmp dword ptr [y],12Ch
00411D00 jge main+0C8h (411D48h)
{
for (z=0; z<300; z++)
00411D02 mov dword ptr [z],0
00411D09 jmp main+94h (411D14h)
00411D0B mov eax,dword ptr [z]
00411D0E add eax,1
00411D11 mov dword ptr [z],eax
00411D14 cmp dword ptr [z],12Ch
00411D1B jge main+0C6h (411D46h)
{
vArray[x+y*300+z*300*300] = 123456789;
00411D1D mov eax,dword ptr [y]
00411D20 imul eax,eax,12Ch
00411D26 add eax,dword ptr [x]
00411D29 mov ecx,dword ptr [z]
00411D2C imul ecx,ecx,12Ch
00411D32 imul ecx,ecx,12Ch
00411D38 add eax,ecx
00411D3A mov edx,dword ptr [vArray]
00411D3D mov dword ptr [edx+eax*4],75BCD15h
}
00411D44 jmp main+8Bh (411D0Bh)
}
00411D46 jmp main+70h (411CF0h)
}
00411D48 jmp main+55h (411CD5h)
Tick2 = GetTickCount();
00411D4A mov esi,esp
00411D4C call dword ptr [__imp__GetTickCount@0 (42F18Ch)]
00411D52 cmp esi,esp
00411D54 call @ILT+1160(__RTC_CheckEsp) (41148Dh)
00411D59 mov dword ptr [Tick2],eax
Interval = Tick2 - Tick1;
00411D5C mov eax,dword ptr [Tick2]
00411D5F sub eax,dword ptr [Tick1]
00411D62 mov dword ptr [Interval],eax
printf("%d\n", Interval );
00411D65 mov eax,dword ptr [Interval]
00411D68 push eax
00411D69 push offset string "%d\n" (42701Ch)
00411D6E call @ILT+1435(_printf) (4115A0h)
00411D73 add esp,8
// test 2
Tick1 = GetTickCount();
00411D76 mov esi,esp
00411D78 call dword ptr [__imp__GetTickCount@0 (42F18Ch)]
00411D7E cmp esi,esp
00411D80 call @ILT+1160(__RTC_CheckEsp) (41148Dh)
00411D85 mov dword ptr [Tick1],eax
for (x=0; x<300; x++)
00411D88 mov dword ptr [x],0
00411D8F jmp main+11Ah (411D9Ah)
00411D91 mov eax,dword ptr [x]
00411D94 add eax,1
00411D97 mov dword ptr [x],eax
00411D9A cmp dword ptr [x],12Ch
00411DA1 jge main+186h (411E06h)
{
for (y=0; y<300; y++)
00411DA3 mov dword ptr [y],0
00411DAA jmp main+135h (411DB5h)
00411DAC mov eax,dword ptr [y]
00411DAF add eax,1
00411DB2 mov dword ptr [y],eax
00411DB5 cmp dword ptr [y],12Ch
00411DBC jge main+184h (411E04h)
{
for (z=0; z<300; z++)
00411DBE mov dword ptr [z],0
00411DC5 jmp main+150h (411DD0h)
00411DC7 mov eax,dword ptr [z]
00411DCA add eax,1
00411DCD mov dword ptr [z],eax
00411DD0 cmp dword ptr [z],12Ch
00411DD7 jge main+182h (411E02h)
{
vArray[x*300*300+y*300+z] = 123456789;
00411DD9 mov eax,dword ptr [x]
00411DDC imul eax,eax,12Ch
00411DE2 imul eax,eax,12Ch
00411DE8 mov ecx,dword ptr [y]
00411DEB imul ecx,ecx,12Ch
00411DF1 add eax,dword ptr [z]
00411DF4 add ecx,eax
00411DF6 mov edx,dword ptr [vArray]
00411DF9 mov dword ptr [edx+ecx*4],75BCD15h
}
00411E00 jmp main+147h (411DC7h)
}
00411E02 jmp main+12Ch (411DACh)
}
00411E04 jmp main+111h (411D91h)
Tick2 = GetTickCount();
00411E06 mov esi,esp
00411E08 call dword ptr [__imp__GetTickCount@0 (42F18Ch)]
00411E0E cmp esi,esp
00411E10 call @ILT+1160(__RTC_CheckEsp) (41148Dh)
00411E15 mov dword ptr [Tick2],eax
Interval = Tick2 - Tick1;
00411E18 mov eax,dword ptr [Tick2]
00411E1B sub eax,dword ptr [Tick1]
00411E1E mov dword ptr [Interval],eax
printf("%d\n", Interval );
00411E21 mov eax,dword ptr [Interval]
00411E24 push eax
00411E25 push offset string "%d\n" (42701Ch)
00411E2A call @ILT+1435(_printf) (4115A0h)
00411E2F add esp,8
// test 3
Tick1 = GetTickCount();
00411E32 mov esi,esp
00411E34 call dword ptr [__imp__GetTickCount@0 (42F18Ch)]
00411E3A cmp esi,esp
00411E3C call @ILT+1160(__RTC_CheckEsp) (41148Dh)
00411E41 mov dword ptr [Tick1],eax
for (x=0; x<300*300*300; x++)
00411E44 mov dword ptr [x],0
00411E4B jmp main+1D6h (411E56h)
00411E4D mov eax,dword ptr [x]
00411E50 add eax,1
00411E53 mov dword ptr [x],eax
00411E56 cmp dword ptr [x],19BFCC0h
00411E5D jge main+1EEh (411E6Eh)
{
vArray[x] = 123456789;
00411E5F mov eax,dword ptr [x]
00411E62 mov ecx,dword ptr [vArray]
00411E65 mov dword ptr [ecx+eax*4],75BCD15h
}
00411E6C jmp main+1CDh (411E4Dh)
Tick2 = GetTickCount();
00411E6E mov esi,esp
00411E70 call dword ptr [__imp__GetTickCount@0 (42F18Ch)]
00411E76 cmp esi,esp
00411E78 call @ILT+1160(__RTC_CheckEsp) (41148Dh)
00411E7D mov dword ptr [Tick2],eax
Interval = Tick2 - Tick1;
00411E80 mov eax,dword ptr [Tick2]
00411E83 sub eax,dword ptr [Tick1]
00411E86 mov dword ptr [Interval],eax
printf("%d\n", Interval );
00411E89 mov eax,dword ptr [Interval]
00411E8C push eax
00411E8D push offset string "%d\n" (42701Ch)
00411E92 call @ILT+1435(_printf) (4115A0h)
00411E97 add esp,8
// test 4
Tick1 = GetTickCount();
00411E9A mov esi,esp
00411E9C call dword ptr [__imp__GetTickCount@0 (42F18Ch)]
00411EA2 cmp esi,esp
00411EA4 call @ILT+1160(__RTC_CheckEsp) (41148Dh)
00411EA9 mov dword ptr [Tick1],eax
for (x=(300*300*300)-1; x>=0; x--)
00411EAC mov dword ptr [x],19BFCBFh
00411EB3 jmp main+23Eh (411EBEh)
00411EB5 mov eax,dword ptr [x]
00411EB8 sub eax,1
00411EBB mov dword ptr [x],eax
00411EBE cmp dword ptr [x],0
00411EC2 jl main+253h (411ED3h)
{
vArray[x] = 123456789;
00411EC4 mov eax,dword ptr [x]
00411EC7 mov ecx,dword ptr [vArray]
00411ECA mov dword ptr [ecx+eax*4],75BCD15h
}
00411ED1 jmp main+235h (411EB5h)
Tick2 = GetTickCount();
00411ED3 mov esi,esp
00411ED5 call dword ptr [__imp__GetTickCount@0 (42F18Ch)]
00411EDB cmp esi,esp
00411EDD call @ILT+1160(__RTC_CheckEsp) (41148Dh)
00411EE2 mov dword ptr [Tick2],eax
Interval = Tick2 - Tick1;
00411EE5 mov eax,dword ptr [Tick2]
00411EE8 sub eax,dword ptr [Tick1]
00411EEB mov dword ptr [Interval],eax
printf("%d\n", Interval );
00411EEE mov eax,dword ptr [Interval]
00411EF1 push eax
00411EF2 push offset string "%d\n" (42701Ch)
00411EF7 call @ILT+1435(_printf) (4115A0h)
00411EFC add esp,8
delete []vArray;
00411EFF mov eax,dword ptr [vArray]
00411F02 mov dword ptr [ebp-11Ch],eax
00411F08 mov ecx,dword ptr [ebp-11Ch]
00411F0E push ecx
00411F0F call operator delete[] (4110AFh)
00411F14 add esp,4
getchar();
00411F17 mov eax,dword ptr [__iob+4 (42BD84h)]
00411F1C sub eax,1
00411F1F mov dword ptr [__iob+4 (42BD84h)],eax
00411F24 js main+2CAh (411F4Ah)
00411F26 mov ecx,dword ptr [__iob (42BD80h)]
00411F2C movsx edx,byte ptr [ecx]
00411F2F and edx,0FFh
00411F35 mov dword ptr [ebp-130h],edx
00411F3B mov eax,dword ptr [__iob (42BD80h)]
00411F40 add eax,1
00411F43 mov dword ptr [__iob (42BD80h)],eax
00411F48 jmp main+2DDh (411F5Dh)
00411F4A push offset __iob (42BD80h)
00411F4F call @ILT+890(__filbuf) (41137Fh)
00411F54 add esp,4
00411F57 mov dword ptr [ebp-130h],eax
return 0;
00411F5D xor eax,eax
}
Gjez... when I look at gcc assembler below that really makes me vomit and
puke BLURP.
Such disrespect for the intel instruction set reference manual !
I like disrecpect LOL.
GCC gets A STRAIGHT ROYAL ACE 10 from me for disrespect... LOL
UTTER AND UTTeR AND UTTER DISRESPECT ! =D
BEEEPBYE
Slybuxck out. haha.
void blah(int *n)
{
int x, y, z;
for (x = 0; x < 200; x++)
for (y = 0; y < 200; y++)
for (z = 0; z < 200; z++) n[x*200*200 + y *200 + z] = x+y+z;
}
.type blah, @function
blah:
.LFB2:
xorl %r10d, %r10d
.L2:
movl %r10d, %r9d
movq %rdi, %r8
xorl %esi, %esi
.p2align 4,,7
.L5:
leal (%r9,%rsi), %edx
movq %r8, %rcx
xorl %eax, %eax
.p2align 4,,7
.L3:
addl $1, %eax
movl %edx, (%rcx)
addq $4, %rcx
addl $1, %edx
cmpl $200, %eax
jne .L3
addq $1, %rsi
addq $800, %r8
cmpq $200, %rsi
jne .L5
addq $1, %r10
addq $160000, %rdi
cmpq $200, %r10
jne .L2
ret
(I purposefully turned off loop unrolling to show what GCC did).
In this case, GCC removed the multiplications and did simple additions
to get the correct offsets. My bet is MSVC is not doing that, instead
they are doing three IMULs per iteration and hence the slowness.
Hint: GCC basically correctly produces the optimal code for this and
Delphi won't do any better.
Case closed, move on.
Tom