cancel
Showing results for 
Search instead for 
Did you mean: 

SDCC generates the fastest integer code for STM8

Philipp Krause
Senior II
Posted on July 25, 2016 at 12:39

Code speed results didn't look that good for SDCC at the time of the SDCC 3.6.0 release about a month ago (http://colecovision.eu/stm8/compilers.shtml). But SDCC has made huge progress since, and now achieves higher Dhrystone and Coremark scores than the other compilers. Here are the results for the current development version (SDCC 3.6.2 #9667): 0690X00000604s9QAA.png

Philipp

P.S.: It's really time to look for some paid work for myself now. This will slow SDCC stm8 progress a bit, since I am the main developer of the stm8 backend in SDCC. However, development will continue both by me and the other SDCC developers.

Note: this post was migrated and contained many threaded conversations, some content may be missing.
14 REPLIES 14
Vyacheslav Azarov
Associate III
Posted on December 07, 2016 at 13:30

Very interested. Version 3.6.2 will be accessible for free?

Posted on December 08, 2016 at 13:18

SDCC is free. The previous release is 3.6.0, the next release will be 3.7.0 (probably in the first half of 2017). 3.6.2 is a developmental version, not a release version, so you'd have to build it yourself. The most recent snapshots of developmental versions are available at

http://sdcc.sourceforge.net/snap.php

  as source, Windows and Linux binaries, but they haven't undergone as much testing as the releases.

Philipp

Posted on December 08, 2016 at 14:08

Ok. Thanks for explanation.

Posted on December 12, 2016 at 07:25

Hello, Philipp.

Excuse me persistence. Now I try make workable test by SDCC. But have some

unresolved issues. The lack of optimization require to write rules for peephole. But I would like to have developed and ready to use definitions. It can be accessible? It is not clear, how to determine the vector interrupt of trap. If you can, tell please.

Sincerely, Viacheslav.
Posted on December 12, 2016 at 12:48

The trap handler is declared using the __trap keyword where normal user interrupts use __interrupt(N):

void handler(void) __trap

{

    …

}

As for normal interrupts, a declaration for the handler needs to be in the same file as main().

This information is missing from the SDCC 3.6.0 manual. In the current development version it is in section 3.6.7 ('STM8 Interrupt Service Routines'), and will thus be in the SDCC 3.7.0 manual.

Philipp

Posted on December 12, 2016 at 12:55

Viacheslav Azarov schrieb:

The lack of optimization require to write rules for peephole. But I would like to have developed and ready to use definitions. It can be accessible? […]

I'm not sure what you mean here. SDCC has peephole rules that are used for optimization (unless you specify --no-peep). While it is possible to specify additional peephole optimizer rules using --peep-file that should not be necessary for typical use.

The most important options for optimization for STM8 are:

* --opt-code-size to optimize for code size (possibly resulting in slower code)

* --opt-code-speed to optimize for code speed (possibly resulting in bigger code)

* --max-allocs-per-node N (higher values for N result in better code, but slower compilation; the default for N is 3000)

Philipp

Posted on December 12, 2016 at 14:17

Thank You for reply.

I tried all optimisation options for 3.6.0 version, but this has no effect.

Until I not applied the peephole file that was written relative to outcome.

And about __trap, thanks. But it would be better to save indexes of native

vector table.

...

Application of the native peephole file does not give expected result.

Code still contains unnecessary instructions. Attachment contains one example.

Hopefully that in version 3.7.0 everything will be beautiful.

Sincerely, Viacheslav.

2016-12-12 13:56 GMT+02:00 krause.philipp <

mailto:st-microelectronics@jiveon.com

>:

STMicroelectronics Community

<

https://community.st.com/?et=watches.email.thread

>

Re: SDCC generates the fastest integer code for STM8

reply from krause.philipp

<

https://community.st.com/people/Krause.Philipp?et=watches.email.thread

>

in STM8 MCUs - View the full discussion

<

https://community.st.com/thread/8847?commentID=139256&et=watches.email.thread#comment-139256

>

________________

Attachments :

stm8opt.txt.zip : https://st--c.eu10.content.force.com/sfc/dist/version/download/?oid=00Db0000000YtG6&ids=0680X000006Hz2m&d=%2Fa%2F0X0000000bFm%2FhLJtWxn.VM1gRR54iWANO4RGS0_KZ627DOCEryeW6.s&asPdf=false

peephole.def.zip : https://st--c.eu10.content.force.com/sfc/dist/version/download/?oid=00Db0000000YtG6&ids=0680X000006Hyqd&d=%2Fa%2F0X0000000bFj%2FY8xo2m9Ry4DTXbGEMeAUbyaWYCZi3B4x403N2qwtFoA&asPdf=false

lacksdcc.txt.zip : https://st--c.eu10.content.force.com/sfc/dist/version/download/?oid=00Db0000000YtG6&ids=0680X000006Hz2h&d=%2Fa%2F0X0000000bFk%2FkBI4LZ61Iuq9ZtFOrsTnuFO5i8gArY9fNvmQWkNxHP4&asPdf=false
Posted on December 17, 2016 at 22:07

Application of  the native peephole file does not give expected result.

Code still contains unnecessary instructions. Attachment contains one example.

Unfortunately it is not that simple. Your stm8opt.txt contains 4 rules for the peephole optimizer.

The first and second could incorrectly remove accesses to volatile variables. If the check for volatile is added, they become equivalent to existing official rules 1 and 1w.

The third rule is correct, but I haven't yet found code to which it would apply in the SDCC output.

The fourth rule does not preserve flags N and Z.

Philipp

Posted on December 18, 2016 at 16:35

Hello, Philipp.

I understand problems of optimisation algorithms. It is really complex. I

am not specialist in this field. And my four rules has been written for

experiment only. But native rules that from source have same effect.

Viacheslav.

2016-12-17 23:07 GMT+02:00 krause.philipp <st-microelectronics@jiveon.com>:

STMicroelectronics Community

<https://community.st.com/?et=watches.email.thread>

Re: SDCC generates the fastest integer code for STM8

reply from krause.philipp

<

in STM8 MCUs - View the full discussion

<https://community.st.com/0D70X000006T1B6SAK