[ASM] [PowerPC] floating-point registers mnemonics

Andrew Haley aph@redhat.com
Fri Jan 14 18:31:00 GMT 2011


On 01/14/2011 05:13 PM, Segher Boessenkool wrote:
>> On the code below, I'm storing the result of the product in a temporary
>> variable (fra).
>>
>> inline void MTH_Vec3Scale(register MTH_tt_Vector3 *D,register const
>> MTH_tt_Vector3 *A, register f32 f)
>> {
>>      register       f32  fra;
>>      asm     (       "lfs   %3,   0(%0)              \n"        // FRA<-
>> *A
>>                      "\t    fmul   %3,   %3,     %2  \n"       // FRT<-
>> FRA
>> * FRC
>>                      "\t    stfs   %3,   0(%1)       \n"         // *dest =
>> FRT
>>
>>                      "\t    lfs    %3,   4(%0)       \n"
>>                      "\t    fmul   %3,   %3,     %2  \n"
>>                      "\t    stfs   %3,   4(%1)       \n"
>>
>>                      "\t    lfs    %3,   8(%0)       \n"
>>                      "\t    fmul   %3,   %3,     %2  \n"
>>                      "\t    stfs   %3,   8(%1)       \n"
>>          /* outputs: */ :
>>          /* inputs : */ :"b"(A),"b"(D),"f"(f),"f"(fra)
>>          /* clobbers:*/ :"memory");
>> }
>
> You write to "fra" (and never read it), so you should list it in
> outputs instead of in inputs:
>
>           /* outputs: */ :"=f"(fra)

Make that an earlyclobber: "=&f"

Andrew.



More information about the Gcc-help mailing list