Re: [PATCH] apply transformation on Darwin platform: pow(10, x) ―> __exp10(x)

Yi Jiang yjiang at apple.com
Thu Dec 5 13:37:49 PST 2013


Hi,

Thank both of you for the comments. I made some adjustment on the patch.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: exp.patch
Type: application/octet-stream
Size: 7054 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20131205/a405fe4d/attachment.obj>
-------------- next part --------------


On Dec 5, 2013, at 12:22 PM, Meador Inge <meadori at codesourcery.com> wrote:

> On 12/05/2013 12:15 PM, Yi Jiang wrote:
> 
>> Index: lib/Target/TargetLibraryInfo.cpp
>> ===================================================================
>> --- lib/Target/TargetLibraryInfo.cpp	(revision 196433)
>> +++ lib/Target/TargetLibraryInfo.cpp	(working copy)
>> @@ -389,30 +389,56 @@
>>     TLI.setUnavailable(LibFunc::sincospi_stret);
>>     TLI.setUnavailable(LibFunc::sincospi_stretf);
>>   }
>> 
>>   if (T.isMacOSX() && T.getArch() == Triple::x86 &&
>>       !T.isMacOSXVersionLT(10, 7)) {
>>     // x86-32 OSX has a scheme where fwrite and fputs (and some other functions
>>     // we don't care about) have two versions; on recent OSX, the one we want
>>     // has a $UNIX2003 suffix. The two implementations are identical except
>>     // for the return value in some edge cases.  However, we don't want to
>>     // generate code that depends on the old symbols.
>>     TLI.setAvailableWithName(LibFunc::fwrite, "fwrite$UNIX2003");
>>     TLI.setAvailableWithName(LibFunc::fputs, "fputs$UNIX2003");
>>   }
>> 
>> +  // "__exp10" and "__exp10f" is Darwin-specific and would be only available on 
>> +  // Mac OSX 10.9 and iOS 7.0 and later.  
> 
> s/Mac OSX/OS X/
> 
> Also, this comment seems slightly inaccurate.  If I understand properly, then I
> think you are claiming that exp10 and exp10f aren't available on OS X until
> 10.9 and iOS until 7.0.  exp10l is not available at all.  Is that right?
> 
> If so, then maybe something like:
> 
>  // exp10 and exp10f are not available on OS X until 10.9 and iOS until 7.0
>  // and they are called __exp10 and __exp10f.  exp10l is not available on
>  // OS X or iOS.
> 
>> +  if (T.isMacOSX()) {
>> +    TLI.setUnavailable(LibFunc::exp10l);
>> +    if (T.isMacOSXVersionLT(10, 9)) {
>> +      TLI.setUnavailable(LibFunc::exp10);
>> +      TLI.setUnavailable(LibFunc::exp10f);
>> +    }
>> +    else {
>> +      TLI.setAvailableWithName(LibFunc::exp10, "__exp10");
>> +      TLI.setAvailableWithName(LibFunc::exp10f, "__exp10f");
>> +    }
>> +  } 
> 
> Brackets on the same line: "} else {".
> 
>> +; Check pow(10.0, x) -> __exp10(x) on Mac OSX 10.9+ and iOS 7.0+ .
> 
> s/Mac OSX/OS X/
> 
> OK with those changes.
> 
> -- 
> Meador Inge
> CodeSourcery / Mentor Embedded



More information about the llvm-commits mailing list