Re: [Tinycc-devel] manually inlining functions

2021-04-30 Thread Elijah Stone
On Sat, 1 May 2021, Yakov wrote: On this sample using macros speeds the program up 400% Be that as it may, it's not representative of most application. For instance, cpython's performance increases by only 10-15% with the inliner turned on. (And actually that's misleading, because

Re: [Tinycc-devel] manually inlining functions

2021-04-30 Thread Kyryl Melekhin
Well, I may take that back, recursion may be useful if you have a 5000 loc function that you need to invoke on some very rare occasion once. And if you care about the size of your executable a lot for some reason. But on hotpath, it makes no sense. Unless you are trying to satisfy your academia,

Re: [Tinycc-devel] manually inlining functions

2021-04-30 Thread Kyryl Melekhin
Yakov wrote: > Kyryl you cannot inline everything because you will get code > explosion, often infinite code explosion when functions have a > circular dependency on each other. I am just talking about inlining > certain functions carefully chosen by a programmer. Yeah, I get that. That's why

Re: [Tinycc-devel] manually inlining functions

2021-04-30 Thread Yakov
I have recently read a paper about a Linear Scan Register Allocator[1], they claim it gives you 95% performance or Graph Coloring Register Allocator in basically no time, and requires no SSA. 1. http://web.cs.ucla.edu/~palsberg/course/cs132/linearscan.pdf сб, 1 мая 2021 г. в 10:51, Elijah

Re: [Tinycc-devel] manually inlining functions

2021-04-30 Thread Yakov
Saying that calls are cheap may be right for many cases but definitely not for me, here is a tiny example I made by copying/pasting from my actual project which is a compiler that uses TinyC as a backend. On this sample using macros speeds the program up 400% i.e. 4 times on my AMD Ryzen5. In a

Re: [Tinycc-devel] manually inlining functions

2021-04-30 Thread Yakov
Kyryl you cannot inline everything because you will get code explosion, often infinite code explosion when functions have a circular dependency on each other. I am just talking about inlining certain functions carefully chosen by a programmer. сб, 1 мая 2021 г. в 11:13, Kyryl Melekhin : > >

Re: [Tinycc-devel] manually inlining functions

2021-04-30 Thread Kyryl Melekhin
Yakov wrote: > Manual inlining seems to be a straightforward thing, just clone the > node into the ast and rename all variables to something unique so I > thought maybe that's what tcc supports with some pragma or what not. If you create such a tool which can take any C code and straight up

Re: [Tinycc-devel] manually inlining functions

2021-04-30 Thread Elijah Stone
On Sat, 1 May 2021, Yakov wrote: having to write macros for performance feels so obsolete, double evaluation hiding in dark corners etc. And function calls are so expensive in tight loops. Calls are fairly cheap, on modern architectures. The performance impact of an inliner would be fairly

[Tinycc-devel] manually inlining functions

2021-04-30 Thread Yakov
I know TinyC does not optimize (that's why it's fast and that's what I love) but having to write macros for performance feels so obsolete, double evaluation hiding in dark corners etc. And function calls are so expensive in tight loops. Is there a way in Tiny to tell the compiler always to inline

Re: [Tinycc-devel] Bug found in TCC

2021-04-30 Thread Christian Jullien
Also fixed on mob x86_64 tcc version 0.9.27 - 3564c47 (x86_64 Linux) Conclusion, please take the mob C. -Original Message- From: Tinycc-devel [mailto:tinycc-devel-bounces+eligis=orange...@nongnu.org] On Behalf Of Christian Jullien Sent: Friday, April 30, 2021 15:51 To:

Re: [Tinycc-devel] Bug found in TCC

2021-04-30 Thread Christian Jullien
FYI mod seems to be fixed (at least on RPi): jullien@sims4:~ $ tcc foo.c -o foo && ./foo Hello, world! 4.10, 1.10, 2.20, 3.30 -Original Message- From: Tinycc-devel [mailto:tinycc-devel-bounces+eligis=orange...@nongnu.org] On Behalf Of benja...@benjaminlipnik.eu Sent: Friday, April 30,

Re: [Tinycc-devel] Bug found in TCC

2021-04-30 Thread Christian Jullien
Hi Ben, It appears you're not using mod which now gives you the short hash git revision something like: tcc version 0.9.27 - 9b76a64 (ARM eabihf Linux) It may or may not have been fixed. Can you please check again with mob? Tia. C. -Original Message- From: Tinycc-devel

[Tinycc-devel] Bug found in TCC

2021-04-30 Thread benjamin
Hi! I found an issue with the tcc compiler. Simple code snippet is in the attachment. I am running tcc version 0.9.27 (x86_64 Linux). Regards, Ben#include typedef struct { float x,y,z; }Vec3f; void hello (float a, Vec3f b) { printf("%.2f, %.2f, %.2f, %.2f\n", a, b.x, b.y, b.z); }