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

Meador Inge meadori at codesourcery.com
Thu Dec 5 12:22:28 PST 2013


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