Add a test case that I've been using to clarify the bitfield layout for
authorChandler Carruth <chandlerc@gmail.com>
Sun, 9 Dec 2012 10:08:22 +0000 (10:08 +0000)
committerChandler Carruth <chandlerc@gmail.com>
Sun, 9 Dec 2012 10:08:22 +0000 (10:08 +0000)
commite8f7a95941290fd566d6f6813ee3fb8287926713
treeb1ab22f2380822b9796ba09bd61bf03425a459dc
parent5ea3bdd75b7032e18160a0eae13e6a7527f837a5
Add a test case that I've been using to clarify the bitfield layout for
both LE and BE targets.

AFAICT, Clang get's this correct for PPC64. I've compared it to GCC 4.8
output for PPC64 (thanks Roman!) and to my limited ability to read power
assembly, it looks functionally equivalent. It would be really good to
fill in the assertions on this test case for x86-32, PPC32, ARM, etc.,
but I've reached the limit of my time and energy... Hopefully other
folks can chip in as it would be good to have this in place to test any
subsequent changes.

To those who care about PPC64 performance, a side note: there is some
*obnoxiously* bad code generated for these test cases. It would be worth
someone's time to sit down and teach the PPC backend to pattern match
these IR constructs better. It appears that things like '(shr %foo,
<imm>)' turn into 'rldicl R, R, 64-<imm>, <imm>' or some such. They
don't even get combined with other 'rldicl' instructions *immediately
adjacent*. I'll add a couple of these patterns to the README, but
I think it would be better to look at all the patterns produced by this
and other bitfield access code, and systematically build up a collection
of patterns that efficiently reduce them to the minimal code.

llvm-svn: 169693
clang/test/CodeGenCXX/bitfield.cpp