By: Linus Torvalds (, January 23, 2020 5:33 pm
Room: Moderated Discussions
Travis Downs ( on January 23, 2020 12:51 am wrote:
> Yeah, it is, see this example.

Ouch. Both compilers do some odd stupid things.

clang seems to do much nicer register allocation , and avoids unnecessary move instructions. Plus gcc gets so confused about register allocation that it causes stack spills, so the end result is just ugly. clang just does much better.

Maybe the code gcc generates is equally fast (maybe it's not decode limited and the moves just turn to renames and the stack spills end up scheduling fine), but it just looks bad.

But then gcc handles that "nothing to sum" case so much better than clang, noticing that it's just zero, while the clang code there is just silly ("let's explicitly zero all these registers so that we can add them up").

No idea whether the different init sequences (gcc: "zero one register, then move it to the others", clang: "zero all registers with xor") are better or worse, might depend on just uarch details.

< Previous Post in ThreadNext Post in Thread >
TopicPosted ByDate
AVX-512 downclocking postTravis Downs2020/01/16 09:20 PM
  AVX-512 downclocking postanon³2020/01/17 01:25 AM
    AVX-512 downclocking postAndrei2020/01/17 02:47 AM
      AVX-512 downclocking postMontaray Jack2020/01/17 03:58 PM
        AVX-512 downclocking postAndrei2020/01/17 11:40 PM
          AVX-512 downclocking postMontaray Jack2020/01/19 02:10 AM
            AVX-512 downclocking postJan Olšan2020/01/19 01:01 PM
              AVX-512 downclocking postJan Olšan2020/01/19 01:11 PM
    AVX-512 downclocking postTravis Downs2020/01/17 02:59 PM
    AVX-512 downclocking postDavid Kanter2020/01/18 10:27 AM
      magnetic inductorsjokerman2020/01/18 08:03 PM
      AVX-512 downclocking postTravis Downs2020/01/24 11:36 AM
  AVX-512 downclocking postRay2020/01/17 02:22 AM
    AVX-512 downclocking postTravis Downs2020/01/17 01:10 PM
  AVX-512 downclocking postEtienne2020/01/17 03:16 AM
    Thanks, typos fixed and credited (NT)Travis Downs2020/01/17 01:15 PM
  Title suggestions welcome (NT)Travis Downs2020/01/17 08:54 AM
  AVX-512 downclocking postanonymou52020/01/17 10:53 AM
    AVX-512 downclocking postTravis Downs2020/01/17 11:14 AM
      AVX-512 downclocking postYoav2020/01/17 11:50 AM
        AVX-512 downclocking postTravis Downs2020/01/17 01:14 PM
      AVX-512 downclocking postanonymou52020/01/17 04:26 PM
        AVX-512 downclocking postTravis Downs2020/01/22 08:19 PM
          AVX-512 downclocking postanonymou52020/01/23 12:56 AM
            AVX-512 downclocking postFoyle2020/01/23 05:51 AM
              AVX-512 downclocking postanonymou52020/01/23 06:57 AM
                AVX-512 downclocking postTravis Downs2020/01/24 12:49 PM
            finer-grained licensesTravis Downs2020/01/24 01:03 PM
              finer-grained licensesanonymou52020/01/24 04:28 PM
                finer-grained licensesTravis Downs2020/01/25 09:46 AM
  post published (new line)Travis Downs2020/01/17 11:55 AM
    should say: (new LINK) (NT)Travis Downs2020/01/17 11:55 AM
      should say: (new LINK)Tim McCaffrey2020/01/17 01:44 PM
        Thanks, fixed and credited (NT)Travis Downs2020/01/17 02:54 PM
      should say: (new LINK)anon2020/01/17 09:12 PM
        should say: (new LINK)Travis Downs2020/01/22 03:28 PM
          Thanks!anon2020/01/22 08:06 PM
            Thanks!Travis Downs2020/01/22 08:16 PM
              Thanks!anon2020/01/22 10:20 PM
                Thanks!Travis Downs2020/01/23 01:51 AM
                  Thanks!Linus Torvalds2020/01/23 05:33 PM
                    Thanks!Travis Downs2020/01/24 12:44 PM
  Throttling dispatchGabriele Svelto2020/01/22 01:40 PM
    Itanium also used itDavid Kanter2020/01/22 02:04 PM
Reply to this Topic
Body: No Text
How do you spell tangerine? 🍊