• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Compiler optimization doing strange things
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Compiler optimization doing strange things


  • Subject: Re: Compiler optimization doing strange things
  • From: Steve Checkoway <email@hidden>
  • Date: Mon, 15 May 2006 10:16:53 -0700


On May 15, 2006, at 3:10 AM, Ben Weiss wrote:
It's not an Altivec question. The loop optimizers look for loops that will repeat at least N times, so it can perform N-way unrolling. This is trivial to calculate when the test is an arithmetic inequality, but generally not when the test is a bitfield operation. The compiler is evidently not smart enough to equate (size & ~0x7) with (size >= 8), even though they're equivalent, so it falls back on the simpler non-unrolled behavior.

I suspected that might be the case. I guess I just assume that the compiler is smarter than it actually is.


I often have to do unrolling by hand to get decent optimization, and even do the scheduling by hand some of the time. What's obnoxious is when I have a loop (at the head or tail of a function) that I know will execute less than four times, but the compiler unrolls it four-way anyway, and dynamically tests for whether or not to use the unrolled loop. Sure, branch prediction will make the runtime impact minimal, but it's still obnoxious.

Hmm, unrolling by hand _is_ annoying. I guess I'll give it a shot later, if it becomes necessary (or I'm bored).


Thanks,

- Steve

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


References: 
 >Re: Compiler optimization doing strange things (From: "Jan E. Schotsman" <email@hidden>)
 >Re: Compiler optimization doing strange things (From: Ben Weiss <email@hidden>)

  • Prev by Date: Re: MOVQ Intrinsic?
  • Next by Date: Redefinition of strbuf
  • Previous by thread: Re: Compiler optimization doing strange things
  • Next by thread: MOVQ Intrinsic?
  • Index(es):
    • Date
    • Thread