On Tue, May 8, 2018 at 11:07 AM, Dávid Bolvanský
wrote:
> Hello,
>
> Code example:
> #include
>
> char * a(int e) {
> char * s;
> switch (e) {
> case 0:
> s = "0";
> break;
> case 1:
> s = "1";
> break;
> case 2:
> s = "2";
> break;
> default:
> s = "def";
> break;
> }
>
> return s;
> }
>
>
> GCC 8.1:
> a:
> mov eax, OFFSET FLAT:.LC0
> cmp edi, 2
> ja .L1
> mov edi, edi <-- redundant?
Is a zero extend from edi to rdi. Yes it is written as a mov but it
causes the cleaning of the top 32bits of rdi.
Thanks,
Andrew
PS gcc-bugs@ is really for the automated bugzilla emails so sending it
to gcc-bugs@ might not get that much attention.
> mov rax, QWORD PTR CSWTCH.0[0+rdi*8]
> .L1:
> ret
http://www.avg.com/email-signature?utm_medium=email_source=link_campaign=sig-email_content=webmail;
target="_blank">https://ipmcdn.avast.com/images/icons/icon-envelope-tick-green-avg-v1.png;
alt="" width="46" height="29" style="width: 46px; height: 29px;"
/>
Virus-free. http://www.avg.com/email-signature?utm_medium=email_source=link_campaign=sig-email_content=webmail;
target="_blank" style="color: #4453ea;">www.avg.com