Re: [Tinycc-devel] Crutches_for_TCC_inline_Asm.

2017-07-16 Thread David Mertens
No personal attacks on this list, please.

On Sun, Jul 16, 2017 at 2:30 AM, ANDY TAKKER  wrote:

> Chronology:
> http://lists.nongnu.org/archive/html/tinycc-devel/2017-07/msg00031.html
> http://lists.nongnu.org/archive/html/tinycc-devel/2017-07/msg00032.html
> http://lists.nongnu.org/archive/html/tinycc-devel/2017-07/msg00034.html
> http://lists.nongnu.org/archive/html/tinycc-devel/2017-07/msg00035.html
>
>
> A good programmer writes the program in 10 minutes. And for the
> rest of his life he corrects errors in it. :) Oleg E Tereshlov.
>
> A bad programmer John made a mistake in the code, due to which
> every user of the program was forced to spend an average of 15
> minutes to find a work around the problem. There were 10 million
> members. In total they wasted 150 million minutes = 2.5 million
> hours. If a person sleeps 8 hours a day, then 16 hours are left
> for the conscious activity. That is, John has destroyed 156,250
> man-days ? 427.8 person-years. The average man lives 64 years,
> so John had killed as many as 6.68 people.
>
> Are you sleeping well, John — serial programmer?
>
> Linux, Windows, GCC: But let's create together with our program
> a hundred other, completely useless, which nobody will use. And
> we will force the user to install all of them on the disk. We
> will not give him a choice. And we'll do our main job somehow
> as a typing blunder and ready. And so come down! Hahaha!
>
> Dear student - do not write the code.
> If you write, do not save it.
> If you save - do not upload.
> If laid out - not on the Internet.
> If the Internet - delete.
> If removed - did good to people.
>
> Good Code Rules:
> Simplicity-comprehensibility-compactness-productivity-lack of
> duplication.
>
> Why do I use TCC? Conveniently: Small size, *.def for the
> linker. It is not necessary to determine the parameters of
> functions in proto. Folder 'include' absolutely not needed.
> I can put TCC in any pose. Freedom! But local variables in
> inline Asm are fucked. Fucked.
>
> I would never have thought that TCC is the fork of GCC for
> Primates. But if you insist ...
>
> Dear Daniel. It's very fun to play these games:
>
> int   main()
> {
> unsigned int a;
> int junk1, junk2, junk3;
> b:
> asm ( "cpuid\n"
>   "rdtsc"
>   : "=a"(a), "=b"(junk1), "=c"(junk2), "=d"(junk3));
> printf("%u\n", a);
> goto b;
> }
>
> :00401000 55  push ebp
> :00401001 89E5mov ebp, esp
> :00401003 81EC1000sub esp, 0010
> :00401009 90  nop
>
> :0040100A 53  push ebx
> :0040100B 0FA2cpuid
> :0040100D 0F31rdtsc
> :0040100F 8945FC  mov dword ptr [ebp-04], eax
> :00401012 895DF8  mov dword ptr [ebp-08], ebx
> :00401015 894DF4  mov dword ptr [ebp-0C], ecx
> :00401018 8955F0  mov dword ptr [ebp-10], edx
> :0040101B 5B  pop ebx
> :0040101C 8B45FC  mov eax, dword ptr [ebp-04]
>
> :0040101F 50  push eax
> :00401020 B800204000  mov eax, 00402000
> :00401025 50  push eax
> :00401026 E80D00  call 00401038
> :0040102B 83C408  add esp, 0008
> :0040102E EBDAjmp 0040100A
> :00401030 C9  leave
> :00401031 C3  ret
>
>
> But the joy can quickly disappear when faced with these:
>
> { int a1, a2, ..., a200,
>   .,
>   ab1, ab2, ..., ab200,
>   .,
>   a...z1, a...z2, ..., a...z200; }
>
> I know a lot of fan clubs PureBasic and not one TCC. Do not you
> know why? Even LCC32 have... one. Just do not say that all are
> Fools. If you're the second I'm of Fabrice, pass Hello to him
> and again ask to do, about what he was asked.
>
> If not, then it's not Fabrice's author, but his mother, father,
> sister, wife, mother-in-law, etc. In 2013, the author of the TCC
> died and development stopped.
>
> GCC inline Asm is the most stupid thing in the world, which one
> could think of. Read about its rules yourself.
>
> I'll tell you and Fabrice a secret. When in my simple direct
> question GNU-man, as usual, answers: - read third-party manuals, my
> first thought: - I'll better read "Rest in peace" on your
> grave, hegoat. And I'm not alone. Remember this next time.
> After all, you answered.
>
> Do you want to take the exam again? Show the children how
> directly declare the stdcall function in the TCC. A long time
> ago, it's time. I want you to do it yourself. Do not be shy,
> more boldly. We will understand you. Who need windows.h for it?
> GCC manuals again... Yes? You are fan(n)y.
>
> Yesterday I was visited by inspiration:
> GAS = AssAsm + GNUlicense. Why? Because someone just lost one
> 's' in as.exe. Ass.exe is much better.
>

[Tinycc-devel] Crutches_for_TCC_inline_Asm.

2017-07-16 Thread ANDY TAKKER
Chronology:
http://lists.nongnu.org/archive/html/tinycc-devel/2017-07/msg00031.html
http://lists.nongnu.org/archive/html/tinycc-devel/2017-07/msg00032.html
http://lists.nongnu.org/archive/html/tinycc-devel/2017-07/msg00034.html
http://lists.nongnu.org/archive/html/tinycc-devel/2017-07/msg00035.html


A good programmer writes the program in 10 minutes. And for the
rest of his life he corrects errors in it. :) Oleg E Tereshlov.

A bad programmer John made a mistake in the code, due to which
every user of the program was forced to spend an average of 15
minutes to find a work around the problem. There were 10 million
members. In total they wasted 150 million minutes = 2.5 million
hours. If a person sleeps 8 hours a day, then 16 hours are left
for the conscious activity. That is, John has destroyed 156,250
man-days ? 427.8 person-years. The average man lives 64 years,
so John had killed as many as 6.68 people.

Are you sleeping well, John — serial programmer?

Linux, Windows, GCC: But let's create together with our program
a hundred other, completely useless, which nobody will use. And
we will force the user to install all of them on the disk. We
will not give him a choice. And we'll do our main job somehow
as a typing blunder and ready. And so come down! Hahaha!

Dear student - do not write the code.
If you write, do not save it.
If you save - do not upload.
If laid out - not on the Internet.
If the Internet - delete.
If removed - did good to people.

Good Code Rules:
Simplicity-comprehensibility-compactness-productivity-lack of
duplication.

Why do I use TCC? Conveniently: Small size, *.def for the
linker. It is not necessary to determine the parameters of
functions in proto. Folder 'include' absolutely not needed.
I can put TCC in any pose. Freedom! But local variables in
inline Asm are fucked. Fucked.

I would never have thought that TCC is the fork of GCC for
Primates. But if you insist ...

Dear Daniel. It's very fun to play these games:

int   main()
{
unsigned int a;
int junk1, junk2, junk3;
b:
asm ( "cpuid\n"
  "rdtsc"
  : "=a"(a), "=b"(junk1), "=c"(junk2), "=d"(junk3));
printf("%u\n", a);
goto b;
}

:00401000 55  push ebp
:00401001 89E5mov ebp, esp
:00401003 81EC1000sub esp, 0010
:00401009 90  nop

:0040100A 53  push ebx
:0040100B 0FA2cpuid
:0040100D 0F31rdtsc
:0040100F 8945FC  mov dword ptr [ebp-04], eax
:00401012 895DF8  mov dword ptr [ebp-08], ebx
:00401015 894DF4  mov dword ptr [ebp-0C], ecx
:00401018 8955F0  mov dword ptr [ebp-10], edx
:0040101B 5B  pop ebx
:0040101C 8B45FC  mov eax, dword ptr [ebp-04]

:0040101F 50  push eax
:00401020 B800204000  mov eax, 00402000
:00401025 50  push eax
:00401026 E80D00  call 00401038
:0040102B 83C408  add esp, 0008
:0040102E EBDAjmp 0040100A
:00401030 C9  leave
:00401031 C3  ret


But the joy can quickly disappear when faced with these:

{ int a1, a2, ..., a200,
  .,
  ab1, ab2, ..., ab200,
  .,
  a...z1, a...z2, ..., a...z200; }

I know a lot of fan clubs PureBasic and not one TCC. Do not you
know why? Even LCC32 have... one. Just do not say that all are
Fools. If you're the second I'm of Fabrice, pass Hello to him
and again ask to do, about what he was asked.

If not, then it's not Fabrice's author, but his mother, father,
sister, wife, mother-in-law, etc. In 2013, the author of the TCC
died and development stopped.

GCC inline Asm is the most stupid thing in the world, which one
could think of. Read about its rules yourself.

I'll tell you and Fabrice a secret. When in my simple direct
question GNU-man, as usual, answers: - read third-party manuals, my
first thought: - I'll better read "Rest in peace" on your
grave, hegoat. And I'm not alone. Remember this next time.
After all, you answered.

Do you want to take the exam again? Show the children how
directly declare the stdcall function in the TCC. A long time
ago, it's time. I want you to do it yourself. Do not be shy,
more boldly. We will understand you. Who need windows.h for it?
GCC manuals again... Yes? You are fan(n)y.

Yesterday I was visited by inspiration:
GAS = AssAsm + GNUlicense. Why? Because someone just lost one
's' in as.exe. Ass.exe is much better.

All my life I was looking for fathers WSMD principle. Why do it
Simply? If you can Make it Difficult. Finally I found them. This
is the brotherhood of the gcc fathers. I'm happy.

And now, a spoonful of honey. Daniel-Fabrice, remember. The
mass success of any compiler depends on exhaustive manual, an
abundance of meaningful examples 

Re: [Tinycc-devel] Crutches_for_TCC_inline_Asm

2017-07-14 Thread Daniel Glöckner
On Fri, Jul 14, 2017 at 10:07:55AM +0300, ANDY TAKKER wrote:
> As I see, there are no good teaches among tinycc-devel.

Yeah, I know, I studied maths and cs, not pedagogy.

> So, let's go on. Next program compiling well, but
> linking bad.

>asm ( "mov %eax, a" );

Linking fails because it expects to find a symbol called "a" but
local variables can not be found in the symbol table.

> The next program compiling well, linking well,
> but brings bad results.


> unsigned int a = 0;
> 
>  int   main()
> {
> 
> unsigned int a;
> b:
>asm ( "cpuid" );
>asm ( "rdtsc" );
>asm ( "mov %eax, a" );
>   printf("%d\n", a);
> goto b;
> }

You should have guessed by now that it will store the value
in the global variable.

> A big piece of work has been done. But
> who really need this heap of trash:

As I wrote in my last eMail, the TCC inline assembler tries to be
compatible to GCC. If you are unhappy with that, use another
compiler.

Did you read the GCC documentation for the inline assembler syntax?
Did you understand it?
Then you should know that the correct way to to it is:

int   main()
{
unsigned int a;
int junk1, junk2, junk3;
b:
asm ( "cpuid\n"
  "rdtsc"
  : "=a"(a), "=b"(junk1), "=c"(junk2), "=d"(junk3));
printf("%u\n", a);
goto b;
}

> Of couse, Fabrice will never patch TCC. Because of because.
> It is life.

No. It's because Fabrice has left the project years ago.
And it does not need patching. It behaves as intended.

Best regards,

  Daniel

___
Tinycc-devel mailing list
Tinycc-devel@nongnu.org
https://lists.nongnu.org/mailman/listinfo/tinycc-devel


[Tinycc-devel] Crutches_for_TCC_inline_Asm

2017-07-14 Thread ANDY TAKKER
Crutches for TCC inline Asm.

The beginning of the story is here:
http://lists.nongnu.org/archive/html/tinycc-devel/2017-07/msg00031.html
http://lists.nongnu.org/archive/html/tinycc-devel/2017-07/msg00032.html

As I see, there are no good teaches among tinycc-devel.
So, let's go on. Next program compiling well, but
linking bad.

#include 

 int   main()
{

unsigned int a = 0;
b:
   asm ( "cpuid" );
   asm ( "rdtsc" );
   asm ( "mov %eax, a" );
  printf("%d\n", a);
goto b;
}

:0040 55  push ebp
:0041 89E5mov ebp, esp
:0043 81EC0400sub esp, 0004
:0049 90  nop
:004A B8  mov eax, 
:004F 8945FC  mov dword ptr [ebp-04], eax
:0052 0FA2cpuid
:0054 0F31rdtsc
mistake :0056 A3  mov dword ptr [], eax
:005B 8B45FC  mov eax, dword ptr [ebp-04]
:005E 50  push eax
:005F B8  mov eax, 
:0064 50  push eax
:0065 E8FCFF  call 0066
:006A 83C408  add esp, 0008
:006D EBE3jmp 0052
:006F C9  leave
:0070 C3  ret

The next program compiling well, linking well,
but brings bad results.

#include 

unsigned int a = 0;

 int   main()
{

unsigned int a;
b:
   asm ( "cpuid" );
   asm ( "rdtsc" );
   asm ( "mov %eax, a" );
  printf("%d\n", a);
goto b;
}

And now... THE CRUTCHES!!!

A good pattern, for all beginners, who
does not want to drown in such nonsense:

int src = 1;
int dst;
asm ("mov %1, %0\n\t"
"add $1, %0"
: "=r" (dst)
: "r" (src));
printf("%d\n", dst);

ENJOY!

#include 

unsigned int temp0;

 int   main()
{

unsigned int a;
b:
   a = 0;
   temp0 = a;
   asm ( "cpuid" );
   asm ( "rdtsc" );
   asm ( "mov %eax, temp0" );
   a = temp0;
  printf("%d\n", a);
goto b;
}

As you see, TCC inline Assembler
not see local variables. And it's
not evil tongues from
https://sites.google.com/site/excelmidi/universal_student_ide/universal_student_ide_en
  .

A big piece of work has been done. But
who really need this heap of trash:

#include 

 int   main()
{

int src = 1;
int dst = 0;

asm ("mov %1, %0\n\t"
"add $1, %0"
: "=r" (dst)
   : "r" (src));

printf("%d\n", dst);
}

:0040 55  push ebp
:0041 89E5mov ebp, esp
:0043 81EC0800sub esp, 0008
:0049 90  nop
:004A B80100  mov eax, 0001
:004F 8945FC  mov dword ptr [ebp-04], eax
:0052 B8  mov eax, 
:0057 8945F8  mov dword ptr [ebp-08], eax
:005A 8B45FC  mov eax, dword ptr [ebp-04]
:005D 89C0mov eax, eax
:005F 050100  add eax, 0001
:0064 8945F8  mov dword ptr [ebp-08], eax
:0067 8B45F8  mov eax, dword ptr [ebp-08]
:006A 50  push eax
:006B B8  mov eax, 
:0070 50  push eax
:0071 E8FCFF  call 0072
:0076 83C408  add esp, 0008
:0079 C9  leave
:007A C3  ret

Of couse, Fabrice will never patch TCC. Because of because.
It is life.

Welcome https://sites.google.com/site/excelmidi   . Check
your CPU. New funny bug all x86.  Forget about optimization:
https://sites.google.com/site/excelmidi/stupid-bug-x86-cpu-tupoj-bag-processora-h86
 :)!

___
Tinycc-devel mailing list
Tinycc-devel@nongnu.org
https://lists.nongnu.org/mailman/listinfo/tinycc-devel