This is the mail archive of the
mailing list for the GCC project.
Re: [PATCH, rs6000] Fix HTM __builtin_ttest rtl expansion
- From: David Edelsohn <dje dot gcc at gmail dot com>
- To: Peter Bergner <bergner at vnet dot ibm dot com>
- Cc: GCC Patches <gcc-patches at gcc dot gnu dot org>, Michael Meissner <meissner at linux dot vnet dot ibm dot com>
- Date: Tue, 20 May 2014 16:36:09 -0400
- Subject: Re: [PATCH, rs6000] Fix HTM __builtin_ttest rtl expansion
- Authentication-results: sourceware.org; auth=none
- References: <1400614095 dot 12948 dot 91 dot camel at otta>
On Tue, May 20, 2014 at 3:28 PM, Peter Bergner <firstname.lastname@example.org> wrote:
> The following patch fixes a semi-latent bug for the HTM 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.
> With newish -mcpu targets, we generate a "mfocrf rX,128" to copy the cr0
> value into bits 32-35 of the gpr. However, in some cases, we will instead
> generate a "mfcr rX" instruction, which copies all 8 CR fields into the
> gpr, with cr0 again being in bits 32-35. The difference is that the
> mfocrf instruction seems to duplicate the 4-bit CR field in the gpr,
> so bits 36-39 are a duplicate of bits 32-35. The error in the ttest
> pattern is that we only shift the value down 24 bits. This "works"
> when a mfocrf copied the cr0 into the rgeister due the duplicated CR
> field, but is wrong when a mfcr instruction is used.
> The following passed bootstrap and regtesting on powerpc64-linux.
> Ok for trunk? Is this also ok for the 4.9 and 4.8 branches once
> my bootstraps and regtesting is done there?
> * config/rs6000/htm.md (ttest): Use correct shift value to get CR0.
> * gcc.target/powerpc/htm-ttest.c: New test.