HTM __builtin_ttest rtl expansion uses wrong shift amount
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
gcc-4.8 (Ubuntu) |
Fix Released
|
Undecided
|
Unassigned | ||
Trusty |
Fix Released
|
Undecided
|
Unassigned |
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:/
...and has been fixed upstream in trunk and the FSF 4.9 and FSF 4.8
branches, as revisions 210815, 210817 and 210818 respectively.
This bug was fixed in the package gcc-4.8 - 4.8.3-2ubuntu1
---------------
gcc-4.8 (4.8.3-2ubuntu1) utopic; urgency=medium
* Update the fix for PR target/61208 for the Linaro branch.
gcc-4.8 (4.8.3-2) unstable; urgency=medium
* Update to SVN 20140527 (r210956) from the gcc-4_8-branch.
- Fix PR target/61208. Closes: #748422.
-- Matthias Klose <email address hidden> Tue, 27 May 2014 09:36:52 +0200