On Fri, Nov 13, 2015 at 04:56:30PM +0100, Jakub Jelinek wrote: > On Fri, Nov 13, 2015 at 04:53:05PM +0100, Marek Polacek wrote: > > On Fri, Nov 13, 2015 at 04:44:21PM +0100, Bernd Schmidt wrote: > > > I don't think so, the three codes are adjacent so we should be generating > > > "(unsigned)(code - RECORD_TYPE) < 3". > > > > Interesting. Yeah, if we change the RECORD_OR_UNION_TYPE_P macro to this > > form, then we don't need a separate version for the C FE. > > Why? The compiler should do that already, or do you care about > -O0 builds or host compilers other than gcc that aren't able to do this?
I don't. > The disadvantage of writing it manually that way is that you need to assert > somewhere that the 3 values indeed are consecutive, while > when the (host?) compiler performs this optimization, it does that only if > they are consecutive, if they are not, the code will be just less efficient. Ok, I understand now what Bernd meant. I didn't realize the compiler already does such optimization with those _TYPEs... Marek