Thumb2 codegen ready for review

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
8 messages Options
Reply | Threaded
Open this post in threaded view
|

Thumb2 codegen ready for review

Erlend Sveen
Hi,
It's been a while now since I've been working on and off various projects
for the last few months, but I finally think my TCC additions are ready for
a second pair of eyes (and more). I hope you have some time to look at it
before I try getting it into the "real" repo.

Initially I wrote that I would not implement any floating point stuff, but after
looking over the instruction set I found that it was way easier than I expected.
I also got TCC to run on the microcontroller itself, which also took a fair bit
of time. I think this is quite cool, lots of stories about people running
Linux on their micros but not as many about compilers as far as I can tell! In
fact I've found no articles at all after some minutes of searching. People have
done interpreters but I could not find anything for C.

Since I don't want to break the main repo I've put up a temporary one before I
try committing anything to the mob branch. I hoped to make it in one commit but
ended up with multiple, so here is an explanation of them and links:

https://git.erlendjs.no/erlendjs/tinycc/commit/9e5ef0bbab28379b1ecbd7c167892e3af5f14a8d

 - This adds the most of the code, please see the commit message for an
   explanation. The most important bits are of course changes to existing
   files.

https://git.erlendjs.no/erlendjs/tinycc/commit/8698aa391929c5c5f1ae529bda4f98f1d382545f

 - Once I started compiling "real" code I found some bugs, this fixes some.

https://git.erlendjs.no/erlendjs/tinycc/commit/3f8c5163b4d1fe2582d916a231c5e16bbbebf154

 - Adds float support back in and a new test, please see the commit message. It
   also cleans up a bunch of stuff, fixes some bugs and adds another test to
   trigger more branches.

At this point there are some things left that I have not figured out yet.
I hope maybe someone can help a bit with these, either by code or feedback on
how to do things:

 * Interwork between ARM state and Thumb state. Probably required to get it
   working on a Raspberry Pi. But not required for MCU use.
 * The linker in TCC does not seem to work, so I've used the GNU one.
 * Adding a flag similar to "-mcpu", "-march", "-vfp?" etc. to keep control of
   which FPU ISA it uses. I expect that the current code will cause some troble
   linking with elf files that specify e.g. no FPU despite not actually having
   generated any FPU instructions.
 * Using floats requires a Cortex-M7 with double precision, since there are
   no fallbacks to the library routines. Could be fixed if the previous point
   is implemented.
 * There is a branch in the store function that I could not figure out how to
   test, so it remains unimplemented. It is for vmov i think.
 * log10 gets the sign wrong and I have no idea why.

So far I've only tested using a Cortex-M7. M3 and M4 should work for integer
code but I have not gotten around to testing that yet.

There are also plenty of files that I figured does not belong in the TCC
repository. It mostly contains build scripts, test harness code, various notes
and so on. For an overview of how testing is going, check "tcc-hacking.ods"
here:

https://git.erlendjs.no/erlends-os/usr/compiler/tree/master/tinycc

Anyways, I think my code is ready now. It successfully compiles all my projects
that I have tried compiling, and they run properly although much slower.

Regards,
Erlend Sveen

_______________________________________________
Tinycc-devel mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/tinycc-devel
Reply | Threaded
Open this post in threaded view
|

Re: Thumb2 codegen ready for review

Christian Jullien-3

Hi, this is really cool to have a new backend for tcc. Congrat!!

 

I had a quick look on you repository but I’m not qualified to comment it.

FYI the few last weeks I made a POC with a friend of mine to add z80 backend which generates .asm files. It is far from working but I’ve made similar changes.

 

I have more general questions:

-          How this work will be supported, I mean who (you?) will actively maintain this port so that this backend is fully synchronized and working when mob changes.

-          How can we test it? (from RPi would be nice, using a VM with emulator).

-          Do you plan to support tcc linking instead of ld? It would be a nice addition if you can.

 

My concern is that I don’t want to see a new backend that nobody will use or maintain in the next months/years.

 

C.

 

From: Tinycc-devel [mailto:tinycc-devel-bounces+eligis=[hidden email]] On Behalf Of Erlend Sveen
Sent: Saturday, May 23, 2020 11:57
To: [hidden email]
Subject: [Tinycc-devel] Thumb2 codegen ready for review

 

Hi,

It's been a while now since I've been working on and off various projects

for the last few months, but I finally think my TCC additions are ready for

a second pair of eyes (and more). I hope you have some time to look at it

before I try getting it into the "real" repo.

 

Initially I wrote that I would not implement any floating point stuff, but after

looking over the instruction set I found that it was way easier than I expected.

I also got TCC to run on the microcontroller itself, which also took a fair bit

of time. I think this is quite cool, lots of stories about people running

Linux on their micros but not as many about compilers as far as I can tell! In

fact I've found no articles at all after some minutes of searching. People have

done interpreters but I could not find anything for C.

 

Since I don't want to break the main repo I've put up a temporary one before I

try committing anything to the mob branch. I hoped to make it in one commit but

ended up with multiple, so here is an explanation of them and links:

 

https://git.erlendjs.no/erlendjs/tinycc/commit/9e5ef0bbab28379b1ecbd7c167892e3af5f14a8d

 

 - This adds the most of the code, please see the commit message for an

   explanation. The most important bits are of course changes to existing

   files.

 

https://git.erlendjs.no/erlendjs/tinycc/commit/8698aa391929c5c5f1ae529bda4f98f1d382545f

 

 - Once I started compiling "real" code I found some bugs, this fixes some.

 

https://git.erlendjs.no/erlendjs/tinycc/commit/3f8c5163b4d1fe2582d916a231c5e16bbbebf154

 

 - Adds float support back in and a new test, please see the commit message. It

   also cleans up a bunch of stuff, fixes some bugs and adds another test to

   trigger more branches.

 

At this point there are some things left that I have not figured out yet.

I hope maybe someone can help a bit with these, either by code or feedback on

how to do things:

 

 * Interwork between ARM state and Thumb state. Probably required to get it

   working on a Raspberry Pi. But not required for MCU use.

 * The linker in TCC does not seem to work, so I've used the GNU one.

 * Adding a flag similar to "-mcpu", "-march", "-vfp?" etc. to keep control of

   which FPU ISA it uses. I expect that the current code will cause some troble

   linking with elf files that specify e.g. no FPU despite not actually having

   generated any FPU instructions.

 * Using floats requires a Cortex-M7 with double precision, since there are

   no fallbacks to the library routines. Could be fixed if the previous point

   is implemented.

 * There is a branch in the store function that I could not figure out how to

   test, so it remains unimplemented. It is for vmov i think.

 * log10 gets the sign wrong and I have no idea why.

 

So far I've only tested using a Cortex-M7. M3 and M4 should work for integer

code but I have not gotten around to testing that yet.

 

There are also plenty of files that I figured does not belong in the TCC

repository. It mostly contains build scripts, test harness code, various notes

and so on. For an overview of how testing is going, check "tcc-hacking.ods"

here:

 

https://git.erlendjs.no/erlends-os/usr/compiler/tree/master/tinycc

 

Anyways, I think my code is ready now. It successfully compiles all my projects

that I have tried compiling, and they run properly although much slower.

 

Regards,

Erlend Sveen


_______________________________________________
Tinycc-devel mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/tinycc-devel
Reply | Threaded
Open this post in threaded view
|

Re: Thumb2 codegen ready for review

grischka
In reply to this post by Erlend Sveen
Hi,

I can't say anything about arm but from the generic part I think this
looks very good.

Related to adding it on the 'real' mob branch:
* use rebase or cherry-pick (don't use merge)
* note that tests2.114 already exists
* add the .expect files too
* you could still combine the commits into one or two if you want
* 117_cleanup_nofloat.c : INCR_GI7 is really slow and probably wouldn't
   find bugs that INCR_GI3 for example would not.
* 118_float_branches.c : print_double() would print for example 0.299
   instead of 0.300 in cases.  This version works for me:
         int s = d < 0 ? -1000 : 1000;
         int f = d * s + 0.1;
         int i = f / s;
         f = f % 1000;
* lib/Makefile : XFLAGS += -DTCC_TARGET_ARM_THUMB is never used, anyway
   the library files shouldn't check TCC_TARGET_* but rather the run-time
   processor symbols (such as __arm__ etc.)

You might want to add some notes somewhere though, about how people can
build this and how and where they can use it at all. ;)

--- grischka

Erlend Sveen wrote:

> Hi,
> It's been a while now since I've been working on and off various projects
> for the last few months, but I finally think my TCC additions are ready for
> a second pair of eyes (and more). I hope you have some time to look at it
> before I try getting it into the "real" repo.
>
> Initially I wrote that I would not implement any floating point stuff, but after
> looking over the instruction set I found that it was way easier than I expected.
> I also got TCC to run on the microcontroller itself, which also took a fair bit
> of time. I think this is quite cool, lots of stories about people running
> Linux on their micros but not as many about compilers as far as I can tell! In
> fact I've found no articles at all after some minutes of searching. People have
> done interpreters but I could not find anything for C.
>
> Since I don't want to break the main repo I've put up a temporary one before I
> try committing anything to the mob branch. I hoped to make it in one commit but
> ended up with multiple, so here is an explanation of them and links:
>
> https://git.erlendjs.no/erlendjs/tinycc/commit/9e5ef0bbab28379b1ecbd7c167892e3af5f14a8d
>
>  - This adds the most of the code, please see the commit message for an
>    explanation. The most important bits are of course changes to existing
>    files.
>
> https://git.erlendjs.no/erlendjs/tinycc/commit/8698aa391929c5c5f1ae529bda4f98f1d382545f
>
>  - Once I started compiling "real" code I found some bugs, this fixes some.
>
> https://git.erlendjs.no/erlendjs/tinycc/commit/3f8c5163b4d1fe2582d916a231c5e16bbbebf154
>
>  - Adds float support back in and a new test, please see the commit message. It
>    also cleans up a bunch of stuff, fixes some bugs and adds another test to
>    trigger more branches.
>
> At this point there are some things left that I have not figured out yet.
> I hope maybe someone can help a bit with these, either by code or feedback on
> how to do things:
>
>  * Interwork between ARM state and Thumb state. Probably required to get it
>    working on a Raspberry Pi. But not required for MCU use.
>  * The linker in TCC does not seem to work, so I've used the GNU one.
>  * Adding a flag similar to "-mcpu", "-march", "-vfp?" etc. to keep control of
>    which FPU ISA it uses. I expect that the current code will cause some troble
>    linking with elf files that specify e.g. no FPU despite not actually having
>    generated any FPU instructions.
>  * Using floats requires a Cortex-M7 with double precision, since there are
>    no fallbacks to the library routines. Could be fixed if the previous point
>    is implemented.
>  * There is a branch in the store function that I could not figure out how to
>    test, so it remains unimplemented. It is for vmov i think.
>  * log10 gets the sign wrong and I have no idea why.
>
> So far I've only tested using a Cortex-M7. M3 and M4 should work for integer
> code but I have not gotten around to testing that yet.
>
> There are also plenty of files that I figured does not belong in the TCC
> repository. It mostly contains build scripts, test harness code, various notes
> and so on. For an overview of how testing is going, check "tcc-hacking.ods"
> here:
>
> https://git.erlendjs.no/erlends-os/usr/compiler/tree/master/tinycc
>
> Anyways, I think my code is ready now. It successfully compiles all my projects
> that I have tried compiling, and they run properly although much slower.
>
> Regards,
> Erlend Sveen

_______________________________________________
Tinycc-devel mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/tinycc-devel
Reply | Threaded
Open this post in threaded view
|

Re: Thumb2 codegen ready for review

Erlend Sveen
In reply to this post by Christian Jullien-3
Hi, some answers:

-          How this work will be supported, I mean who (you?) will actively maintain this port so that this backend is fully synchronized and working when mob changes.

I intend to keep an eye on the mailing list and keep it working, yes. Especially since I have good hardware for running it. One of my other projects is automatic testing with real hardware, hopefully I can get somewhere with that to make this easy.

-          How can we test it? (from RPi would be nice, using a VM with emulator).

As I wrote, RPi would probably need the thumb interwork. This is one of the remaining things that I'm not certain about how to implement. Without it, Thumb2 code cannot call into ARM code reliably which I expect to be common on RPi. I'm guessing this is mostly a linker job that requires some correct metadata of sorts so that it does the right thing.

If there is an emulator for Cortex-M that would probably work too, but I do not know much about these. If anyone knows a good one for MCUs I'd love to know.

I currently test it on real hardware, STM32F767IGT6 is the device model, but this is somewhat custom regarding peripherals. I'm currently working on getting it to run nicely on more "off the shelf" hardware (the STM32 discovery kits) bit this is kind of the nature of embedded MCU stuff (lots of products of all types, often non-trivial to get started with). The world of ARM based MCUs is of course huge, but the amount of users of this TCC version will probably be much smaller than for RPi or x86 so hopefully we can get it working on the RPi. This is really a niche within a niche!

I also run my own OS on the thing which makes it easy to automate some tasks, among other things. The new backend can of course be used in a "normal" fashion too, that is, bare metal development like you would use gcc-arm-none-eabi toolchain. Which is actually how I've been using it most of the time.

-          Do you plan to support tcc linking instead of ld? It would be a nice addition if you can.

Maybe. I hope to get that working but I do not know how much work this is since I have not looked into it. TCC for linking would be very nice since GNU LD is extremely slow when running on my target.

Regards,
Erlend.


Fra: Tinycc-devel <tinycc-devel-bounces+erlend.sveen=[hidden email]> på vegne av Christian Jullien <[hidden email]>
Sendt: lørdag 23. mai 2020 15:06
Til: [hidden email] <[hidden email]>
Emne: Re: [Tinycc-devel] Thumb2 codegen ready for review
 

Hi, this is really cool to have a new backend for tcc. Congrat!!

 

I had a quick look on you repository but I’m not qualified to comment it.

FYI the few last weeks I made a POC with a friend of mine to add z80 backend which generates .asm files. It is far from working but I’ve made similar changes.

 

I have more general questions:

-          How this work will be supported, I mean who (you?) will actively maintain this port so that this backend is fully synchronized and working when mob changes.

-          How can we test it? (from RPi would be nice, using a VM with emulator).

-          Do you plan to support tcc linking instead of ld? It would be a nice addition if you can.

 

My concern is that I don’t want to see a new backend that nobody will use or maintain in the next months/years.

 

C.

 

From: Tinycc-devel [mailto:tinycc-devel-bounces+eligis=[hidden email]] On Behalf Of Erlend Sveen
Sent: Saturday, May 23, 2020 11:57
To: [hidden email]
Subject: [Tinycc-devel] Thumb2 codegen ready for review

 

Hi,

It's been a while now since I've been working on and off various projects

for the last few months, but I finally think my TCC additions are ready for

a second pair of eyes (and more). I hope you have some time to look at it

before I try getting it into the "real" repo.

 

Initially I wrote that I would not implement any floating point stuff, but after

looking over the instruction set I found that it was way easier than I expected.

I also got TCC to run on the microcontroller itself, which also took a fair bit

of time. I think this is quite cool, lots of stories about people running

Linux on their micros but not as many about compilers as far as I can tell! In

fact I've found no articles at all after some minutes of searching. People have

done interpreters but I could not find anything for C.

 

Since I don't want to break the main repo I've put up a temporary one before I

try committing anything to the mob branch. I hoped to make it in one commit but

ended up with multiple, so here is an explanation of them and links:

 

https://git.erlendjs.no/erlendjs/tinycc/commit/9e5ef0bbab28379b1ecbd7c167892e3af5f14a8d

 

 - This adds the most of the code, please see the commit message for an

   explanation. The most important bits are of course changes to existing

   files.

 

https://git.erlendjs.no/erlendjs/tinycc/commit/8698aa391929c5c5f1ae529bda4f98f1d382545f

 

 - Once I started compiling "real" code I found some bugs, this fixes some.

 

https://git.erlendjs.no/erlendjs/tinycc/commit/3f8c5163b4d1fe2582d916a231c5e16bbbebf154

 

 - Adds float support back in and a new test, please see the commit message. It

   also cleans up a bunch of stuff, fixes some bugs and adds another test to

   trigger more branches.

 

At this point there are some things left that I have not figured out yet.

I hope maybe someone can help a bit with these, either by code or feedback on

how to do things:

 

 * Interwork between ARM state and Thumb state. Probably required to get it

   working on a Raspberry Pi. But not required for MCU use.

 * The linker in TCC does not seem to work, so I've used the GNU one.

 * Adding a flag similar to "-mcpu", "-march", "-vfp?" etc. to keep control of

   which FPU ISA it uses. I expect that the current code will cause some troble

   linking with elf files that specify e.g. no FPU despite not actually having

   generated any FPU instructions.

 * Using floats requires a Cortex-M7 with double precision, since there are

   no fallbacks to the library routines. Could be fixed if the previous point

   is implemented.

 * There is a branch in the store function that I could not figure out how to

   test, so it remains unimplemented. It is for vmov i think.

 * log10 gets the sign wrong and I have no idea why.

 

So far I've only tested using a Cortex-M7. M3 and M4 should work for integer

code but I have not gotten around to testing that yet.

 

There are also plenty of files that I figured does not belong in the TCC

repository. It mostly contains build scripts, test harness code, various notes

and so on. For an overview of how testing is going, check "tcc-hacking.ods"

here:

 

https://git.erlendjs.no/erlends-os/usr/compiler/tree/master/tinycc

 

Anyways, I think my code is ready now. It successfully compiles all my projects

that I have tried compiling, and they run properly although much slower.

 

Regards,

Erlend Sveen


_______________________________________________
Tinycc-devel mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/tinycc-devel
Reply | Threaded
Open this post in threaded view
|

Re: Thumb2 codegen ready for review

Erlend Sveen
In reply to this post by grischka
Thanks! Good to know I'm getting some things right. Some answers for your questions:

> * use rebase or cherry-pick (don't use merge)
I have not done it this way before but I'll look into it (and hopefully get it right). I'm guessing
you want me to try fixing the other issues here before I try tho? After all, people can test it
using my mirror until then. Hopefully someone will but I'm not expecting it any time soon
since using TCC for embedded is probably a very niche thing to do 🙂

> * note that tests2.114 already exists
Seems like it got added after I started on mine. I can renumber my tests.

> * add the .expect files too
OK

> * you could still combine the commits into one or two if you want
If it is okay I think maybe it is good to keep the separate commits, I think it is "cleaner"
regarding adding float support, the commit messages etc. I just wasn't certain if there
is a preference.

> * 117_cleanup_nofloat.c : INCR_GI7 is really slow and probably wouldn't
>   find bugs that INCR_GI3 for example would not.
I don't understand what you mean here. Note that I just copied the integer parts of test 101
here, and could not get this test to work anyways since it generates a 7MB file before running
into some limits with branching, and my microcontroller does not have enough memory to run
it either. This is actually the only test that totally fails (see spreadsheet I wrote about).

> * 118_float_branches.c : print_double() would print for example 0.299
>   instead of 0.300 in cases.  This version works for me:
>         int s = d < 0 ? -1000 : 1000;
>         int f = d * s + 0.1;
>         int i = f / s;
>         f = f % 1000;
print_double is not meant to be accurate at all. All that matters is that GCC and TCC produces
the same number. The reason that print_double even exists in the first place is that when I
wrote the test, my printf implementation for the MCU did not take doubles. I have since fixed
that but not changed the test since it did not seem important. I can of course add your
suggestion to make it more accurate.

>* lib/Makefile : XFLAGS += -DTCC_TARGET_ARM_THUMB is never used, anyway
>   the library files shouldn't check TCC_TARGET_* but rather the run-time
>   processor symbols (such as __arm__ etc.)
Maybe I can remove it. Actually I need to look into the library a bit since I don't thing I'm using
it much. I'm just linking with my usual GCC stuff. I'm also generating instructions instead of
calling the library in more places, the Thumb2 instruction set differ somewhat here regarding
division and modulo for instance.

> You might want to add some notes somewhere though, about how people can
> build this and how and where they can use it at all. ;)
Absolutely, but where? tcc-doc.texi? The most important thing to document is probably the
limitations (that I hope to solve). But for what I use it for, it kinda "just works" when used as
a regular cross compiler 🙂 . Actually running TCC itself on the MCU is much more complicated
of course, which is why I made that extra repo.

Regards,
Erlend S.


Fra: Tinycc-devel <tinycc-devel-bounces+erlend.sveen=[hidden email]> på vegne av grischka <[hidden email]>
Sendt: lørdag 23. mai 2020 15:56
Til: [hidden email] <[hidden email]>
Emne: Re: [Tinycc-devel] Thumb2 codegen ready for review
 
Hi,

I can't say anything about arm but from the generic part I think this
looks very good.

Related to adding it on the 'real' mob branch:
* use rebase or cherry-pick (don't use merge)
* note that tests2.114 already exists
* add the .expect files too
* you could still combine the commits into one or two if you want
* 117_cleanup_nofloat.c : INCR_GI7 is really slow and probably wouldn't
   find bugs that INCR_GI3 for example would not.
* 118_float_branches.c : print_double() would print for example 0.299
   instead of 0.300 in cases.  This version works for me:
         int s = d < 0 ? -1000 : 1000;
         int f = d * s + 0.1;
         int i = f / s;
         f = f % 1000;
* lib/Makefile : XFLAGS += -DTCC_TARGET_ARM_THUMB is never used, anyway
   the library files shouldn't check TCC_TARGET_* but rather the run-time
   processor symbols (such as __arm__ etc.)

You might want to add some notes somewhere though, about how people can
build this and how and where they can use it at all. ;)

--- grischka

Erlend Sveen wrote:
> Hi,
> It's been a while now since I've been working on and off various projects
> for the last few months, but I finally think my TCC additions are ready for
> a second pair of eyes (and more). I hope you have some time to look at it
> before I try getting it into the "real" repo.
>
> Initially I wrote that I would not implement any floating point stuff, but after
> looking over the instruction set I found that it was way easier than I expected.
> I also got TCC to run on the microcontroller itself, which also took a fair bit
> of time. I think this is quite cool, lots of stories about people running
> Linux on their micros but not as many about compilers as far as I can tell! In
> fact I've found no articles at all after some minutes of searching. People have
> done interpreters but I could not find anything for C.
>
> Since I don't want to break the main repo I've put up a temporary one before I
> try committing anything to the mob branch. I hoped to make it in one commit but
> ended up with multiple, so here is an explanation of them and links:
>
> https://git.erlendjs.no/erlendjs/tinycc/commit/9e5ef0bbab28379b1ecbd7c167892e3af5f14a8d
>
>  - This adds the most of the code, please see the commit message for an
>    explanation. The most important bits are of course changes to existing
>    files.
>
> https://git.erlendjs.no/erlendjs/tinycc/commit/8698aa391929c5c5f1ae529bda4f98f1d382545f
>
>  - Once I started compiling "real" code I found some bugs, this fixes some.
>
> https://git.erlendjs.no/erlendjs/tinycc/commit/3f8c5163b4d1fe2582d916a231c5e16bbbebf154
>
>  - Adds float support back in and a new test, please see the commit message. It
>    also cleans up a bunch of stuff, fixes some bugs and adds another test to
>    trigger more branches.
>
> At this point there are some things left that I have not figured out yet.
> I hope maybe someone can help a bit with these, either by code or feedback on
> how to do things:
>
>  * Interwork between ARM state and Thumb state. Probably required to get it
>    working on a Raspberry Pi. But not required for MCU use.
>  * The linker in TCC does not seem to work, so I've used the GNU one.
>  * Adding a flag similar to "-mcpu", "-march", "-vfp?" etc. to keep control of
>    which FPU ISA it uses. I expect that the current code will cause some troble
>    linking with elf files that specify e.g. no FPU despite not actually having
>    generated any FPU instructions.
>  * Using floats requires a Cortex-M7 with double precision, since there are
>    no fallbacks to the library routines. Could be fixed if the previous point
>    is implemented.
>  * There is a branch in the store function that I could not figure out how to
>    test, so it remains unimplemented. It is for vmov i think.
>  * log10 gets the sign wrong and I have no idea why.
>
> So far I've only tested using a Cortex-M7. M3 and M4 should work for integer
> code but I have not gotten around to testing that yet.
>
> There are also plenty of files that I figured does not belong in the TCC
> repository. It mostly contains build scripts, test harness code, various notes
> and so on. For an overview of how testing is going, check "tcc-hacking.ods"
> here:
>
> https://git.erlendjs.no/erlends-os/usr/compiler/tree/master/tinycc
>
> Anyways, I think my code is ready now. It successfully compiles all my projects
> that I have tried compiling, and they run properly although much slower.
>
> Regards,
> Erlend Sveen

_______________________________________________
Tinycc-devel mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/tinycc-devel

_______________________________________________
Tinycc-devel mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/tinycc-devel
Reply | Threaded
Open this post in threaded view
|

Re: Thumb2 codegen ready for review

grischka
Erlend Sveen wrote:
>> * 117_cleanup_nofloat.c : INCR_GI7 is really slow and probably wouldn't
>>   find bugs that INCR_GI3 for example would not.
> I don't understand what you mean here. Note that I just copied the integer parts of test 101
> here, and could not get this test to work anyways since it generates a 7MB file before running
> into some limits with branching, and my microcontroller does not have enough memory to run
> it either. This is actually the only test that totally fails (see spreadsheet I wrote about).

Ok, so I note that it's not only really slow but also really big, and
that this mis-feature already does exist in our repository.

Anyway, I don't think we really want stripped down copies of already
existing tests.  The original tests may work at some point or they can
be excluded for that platform or the original version might be adjusted
if it doesn't defeat its purpose.

> print_double is not meant to be accurate at all. All that matters is that
> GCC and TCC produces the same number.

That was the point.  They don't. (not with a i386-mingw-gcc).

>> You might want to add some notes somewhere though, about how people can
>> build this and how and where they can use it at all. ;)
> Absolutely, but where? tcc-doc.texi? The most important thing to document is probably the
> limitations (that I hope to solve). But for what I use it for, it kinda "just works" when used as
> a regular cross compiler 🙂 . Actually running TCC itself on the MCU is much more complicated
> of course, which is why I made that extra repo.

Ok, I looked at your scripts at
   https://git.erlendjs.no/erlends-os/usr/compiler/tree/master/tinycc
which of course have all the information I could think of.

Well, so at this point I'd maybe suggest just to put the web-link to
this into the comment header of your arm-thumb generator.

I think the decision you need to make is when you want to switch from
your clone to the tinycc main repository as THE PLACE where you make
your work on the tinycc core visible to the public audience.  Sooner
or later, both has advantages and disadvantages.

--- grischka

> Regards,
> Erlend S.
>


_______________________________________________
Tinycc-devel mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/tinycc-devel
Reply | Threaded
Open this post in threaded view
|

Re: Thumb2 codegen ready for review

Erlend Sveen
Yeah, it is probably best to drop that test unless there is a way to
make a smaller version of it that would still be useful, if the test
makes sense from a codegen perspective at all. Maybe if it is fine
as long as it passes for x86 or something.

Strange that you got different results with the print function, I was
so certain I did not have that issue but maybe I remember it wrong.
It could also be due to platform differences, looks like you tested
with Windows while I'm running Linux.

I do of course hope to get it into the main repository but I also think
it needs some more fixing first. Hopefully more people get to have a
look at it over the next few weeks for some feedback.

Regards,
Erlend S


Fra: Tinycc-devel <tinycc-devel-bounces+erlend.sveen=[hidden email]> på vegne av grischka <[hidden email]>
Sendt: mandag 25. mai 2020 14:03
Til: [hidden email] <[hidden email]>
Emne: Re: [Tinycc-devel] Thumb2 codegen ready for review
 
Erlend Sveen wrote:
>> * 117_cleanup_nofloat.c : INCR_GI7 is really slow and probably wouldn't
>>   find bugs that INCR_GI3 for example would not.
> I don't understand what you mean here. Note that I just copied the integer parts of test 101
> here, and could not get this test to work anyways since it generates a 7MB file before running
> into some limits with branching, and my microcontroller does not have enough memory to run
> it either. This is actually the only test that totally fails (see spreadsheet I wrote about).

Ok, so I note that it's not only really slow but also really big, and
that this mis-feature already does exist in our repository.

Anyway, I don't think we really want stripped down copies of already
existing tests.  The original tests may work at some point or they can
be excluded for that platform or the original version might be adjusted
if it doesn't defeat its purpose.

> print_double is not meant to be accurate at all. All that matters is that
> GCC and TCC produces the same number.

That was the point.  They don't. (not with a i386-mingw-gcc).

>> You might want to add some notes somewhere though, about how people can
>> build this and how and where they can use it at all. ;)
> Absolutely, but where? tcc-doc.texi? The most important thing to document is probably the
> limitations (that I hope to solve). But for what I use it for, it kinda "just works" when used as
> a regular cross compiler 🙂 . Actually running TCC itself on the MCU is much more complicated
> of course, which is why I made that extra repo.

Ok, I looked at your scripts at
   https://git.erlendjs.no/erlends-os/usr/compiler/tree/master/tinycc
which of course have all the information I could think of.

Well, so at this point I'd maybe suggest just to put the web-link to
this into the comment header of your arm-thumb generator.

I think the decision you need to make is when you want to switch from
your clone to the tinycc main repository as THE PLACE where you make
your work on the tinycc core visible to the public audience.  Sooner
or later, both has advantages and disadvantages.

--- grischka

> Regards,
> Erlend S.
>


_______________________________________________
Tinycc-devel mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/tinycc-devel

_______________________________________________
Tinycc-devel mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/tinycc-devel
Reply | Threaded
Open this post in threaded view
|

Re: Thumb2 codegen ready for review

Michael Matz-4
Hello,


On Mon, 25 May 2020, Erlend Sveen wrote:

> Yeah, it is probably best to drop that test unless there is a way to
> make a smaller version of it that would still be useful, if the test
> makes sense from a codegen perspective at all. Maybe if it is fine as
> long as it passes for x86 or something.

I did find a (real) problem in one of my riscv64 patches with this test
caused by too large functions, so it was helpful.  The general
functionality it wants to test (cleanups for local variables) can also be
had with a limited variant, so you could play with target macros to enable
only (say) INCR_GI2 or GI3 on small targets.  (i.e. as long as it's still
the large one for hosted/native targets ...)


Ciao,
Michael.

>
> Strange that you got different results with the print function, I was
> so certain I did not have that issue but maybe I remember it wrong.
> It could also be due to platform differences, looks like you tested
> with Windows while I'm running Linux.
>
> I do of course hope to get it into the main repository but I also think
> it needs some more fixing first. Hopefully more people get to have a
> look at it over the next few weeks for some feedback.
>
> Regards,
> Erlend S
>
> ____________________________________________________________________________
> Fra: Tinycc-devel <tinycc-devel-bounces+erlend.sveen=[hidden email]>
> på vegne av grischka <[hidden email]>
> Sendt: mandag 25. mai 2020 14:03
> Til: [hidden email] <[hidden email]>
> Emne: Re: [Tinycc-devel] Thumb2 codegen ready for review  
> Erlend Sveen wrote:
> >> * 117_cleanup_nofloat.c : INCR_GI7 is really slow and probably wouldn't
> >>   find bugs that INCR_GI3 for example would not.
> > I don't understand what you mean here. Note that I just copied the integer
> parts of test 101
> > here, and could not get this test to work anyways since it generates a 7MB
> file before running
> > into some limits with branching, and my microcontroller does not have
> enough memory to run
> > it either. This is actually the only test that totally fails (see
> spreadsheet I wrote about).
>
> Ok, so I note that it's not only really slow but also really big, and
> that this mis-feature already does exist in our repository.
>
> Anyway, I don't think we really want stripped down copies of already
> existing tests.  The original tests may work at some point or they can
> be excluded for that platform or the original version might be adjusted
> if it doesn't defeat its purpose.
>
> > print_double is not meant to be accurate at all. All that matters is that
> > GCC and TCC produces the same number.
>
> That was the point.  They don't. (not with a i386-mingw-gcc).
>
> >> You might want to add some notes somewhere though, about how people can
> >> build this and how and where they can use it at all. ;)
> > Absolutely, but where? tcc-doc.texi? The most important thing to document
> is probably the
> > limitations (that I hope to solve). But for what I use it for, it kinda
> "just works" when used as
> > a regular cross compiler 🙂 . Actually running TCC itself on the MCU is
> much more complicated
> > of course, which is why I made that extra repo.
>
> Ok, I looked at your scripts at
>    https://git.erlendjs.no/erlends-os/usr/compiler/tree/master/tinycc
> which of course have all the information I could think of.
>
> Well, so at this point I'd maybe suggest just to put the web-link to
> this into the comment header of your arm-thumb generator.
>
> I think the decision you need to make is when you want to switch from
> your clone to the tinycc main repository as THE PLACE where you make
> your work on the tinycc core visible to the public audience.  Sooner
> or later, both has advantages and disadvantages.
>
> --- grischka
>
> > Regards,
> > Erlend S.
> >
>
>
> _______________________________________________
> Tinycc-devel mailing list
> [hidden email]
> https://lists.nongnu.org/mailman/listinfo/tinycc-devel
>
>
_______________________________________________
Tinycc-devel mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/tinycc-devel