gcc generates better code than MSVC ? Well, it depends

By: Michael S (already5chosen.delete@this.yahoo.com), October 19, 2019 6:27 pm
Room: Moderated Discussions
Travis Downs (travis.downs.delete@this.gmail.com) on October 3, 2019 8:40 am wrote:
> Foo_ (foo.delete@this.nomail.com) on October 3, 2019 4:21 am wrote:

> > I agree with you that UB is a PITA, but I'm sure ICC exploits it as much as clang and gcc do.
>
>
> Nah, neither MSVC nor icc exploit UB to the extent that gcc or clang do.
>
> Now whether that is as a result of a conscious decision to not exploit UB, or simply because their optimizers
> are behind and have lower hanging fruit, I'm not sure. MSVC in particular generates garbage code compared
> to the other three, all the time, so minor speed boosts from exploiting UB are probably not high on
> their list. I wouldn't be surprised if they abandoned their C++ compiler entirely in favor of clang
> (of course keeping Visual Studio and everything around - just a compiler swap-out).
>

https://godbolt.org/z/YYq6ou

gcc code generation is not bad. It's horrible.

clang used to be horrible in such code, but starting from v.8 it's rather good. A bit too smart for my liking, but good.

MSVC, on the other hand, is simply good and was good at least since 2015. I didn't test earlier versions.

icc.19 looks bad. May be it's just an appearance, I don't know. Unlike with other compilers, I didn't try to run icc compiled binary.

Of course, it's just a single sample...

 Next Post in Thread >
TopicPosted ByDate
gcc generates better code than MSVC ? Well, it dependsMichael S2019/10/19 06:27 PM
  gcc generates better code than MSVC ? Well, it dependsChester2019/10/20 08:38 PM
    gcc generates better code than MSVC ? Well, it dependsMichael S2019/10/21 09:04 AM
Reply to this Topic
Name:
Email:
Topic:
Body: No Text
How do you spell purple?