[patch] Fix powerpc 64 alignment problem for lwa instruction
Dale Johannesen
dalej@apple.com
Thu Nov 9 19:54:00 GMT 2006
On Nov 7, 2006, at 3:13 PM, Andrew Pinski wrote:
>> #pragma pack(push, 2)
>> struct FixedRectangle {
>> int left;
>> int top;
>> int right;
>> int bottom;
>> };
>> #pragma pack(pop)
>>
>> long getLeft (struct FixedRectangle *a)
>> {
>> return ((struct FixedRectangle*)(((char*)a)+4))->top;
>> }
>>
>> Compile at -Os -m64, we should still get a lwa but with your patch
>> we get a
>> lwz and a extsw.
>>
>> The following patch keeps this regression from showing up and also
>> fixes your orginal
>> testcase:
>> Index: predicates.md
>> ===================================================================
>> --- predicates.md (revision 118565)
>> +++ predicates.md (working copy)
>> @@ -654,7 +654,9 @@ (define_predicate "lwa_operand"
>> && GET_CODE (XEXP (inner, 0)) != PRE_DEC
>> && (GET_CODE (XEXP (inner, 0)) != PLUS
>> || GET_CODE (XEXP (XEXP (inner, 0), 1)) != CONST_INT
>> - || INTVAL (XEXP (XEXP (inner, 0), 1)) % 4 == 0));
>> + || INTVAL (XEXP (XEXP (inner, 0), 1)) % 4 == 0)
>> + && (GET_CODE (XEXP (inner, 0)) != LO_SUM
>> + || (MEM_ALIGN (inner) % 32) == 0));
>> })
>>
>> ;; Return 1 if the operand, used inside a MEM, is a SYMBOL_REF.
(I forgot about this thread, sorry.) While the original patch is
conservatively correct
I agree this one is better.
More information about the Gcc-patches
mailing list