[Bug 1322287] Re: HTM __builtin_ttest rtl expansion uses wrong shift amount
Matthias Klose
doko at ubuntu.com
Mon May 26 09:59:04 UTC 2014
** Also affects: gcc-4.8 (Ubuntu Trusty)
Importance: Undecided
Status: New
--
You received this bug notification because you are a member of Ubuntu
Foundations Bugs, which is subscribed to gcc-4.8 in Ubuntu.
https://bugs.launchpad.net/bugs/1322287
Title:
HTM __builtin_ttest rtl expansion uses wrong shift amount
Status in “gcc-4.8” package in Ubuntu:
New
Status in “gcc-4.8” source package in Trusty:
New
Bug description:
There is a semi-latent bug for the HTM ttest pattern used with the
__builtin_ttest() builtin. This is supposed to expand to a tabortwci.
instruction which sets cr0 and then some code that copies the cr0 value
into a gpr and then shifts and masks it into the lowest 2 bits in the gpr.
The mfcr and mfocrf instructions which can be used to copy the CR0 value
into a gpr, both copy the value into bits 32-35 of the gpr. The bug is
that we only shift the gpr 24 bits to get the CR value into the low
order bits of the gpr, when we should be shifting 28 bits. This "works"
most of the time due to a peculiarity in how the mfocrf instruction
works, since it copies the CR value into bits 32-35 and duplicates
that value in bits 36-39. Since newish -mcpu targets (eg, power8)
normally generate a mfocrf, we don't see the problem. However, in some
cases, we will instead generate a mfcr instruction, which does expose
the bug.
This bug was reported upstream with a patch here:
https://gcc.gnu.org/ml/gcc-patches/2014-05/msg01667.html
...and has been fixed upstream in trunk and the FSF 4.9 and FSF 4.8
branches, as revisions 210815, 210817 and 210818 respectively.
To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/gcc-4.8/+bug/1322287/+subscriptions
More information about the foundations-bugs
mailing list