[CodeGen] convert math libcalls/builtins to equivalent LLVM intrinsics

There are 20 LLVM math intrinsics that correspond to mathlib calls according to the LangRef:
http://llvm.org/docs/LangRef.html#standard-c-library-intrinsics

We were only converting 3 mathlib calls (sqrt, fma, pow) and 12 builtin calls (ceil, copysign, 
fabs, floor, fma, fmax, fmin, nearbyint, pow, rint, round, trunc) to their intrinsic-equivalents.

This patch pulls the transforms together and handles all 20 cases. The switch is guarded by a 
check for const-ness to make sure we're not doing the transform if errno could possibly be set by
the libcall or builtin.

Differential Revision: https://reviews.llvm.org/D40044

llvm-svn: 319593
diff --git a/clang/test/CodeGen/builtin-sqrt.c b/clang/test/CodeGen/builtin-sqrt.c
index 528ad09..5b275bf 100644
--- a/clang/test/CodeGen/builtin-sqrt.c
+++ b/clang/test/CodeGen/builtin-sqrt.c
@@ -1,17 +1,15 @@
 // RUN: %clang_cc1 -fmath-errno -triple x86_64-apple-darwin %s -emit-llvm -o - | FileCheck %s --check-prefix=HAS_ERRNO
 // RUN: %clang_cc1              -triple x86_64-apple-darwin %s -emit-llvm -o - | FileCheck %s --check-prefix=NO_ERRNO
 
-// FIXME: If the builtin does not set errno, it should be converted to an LLVM intrinsic.
-
 float foo(float X) {
   // HAS_ERRNO: call float @sqrtf(float
-  // NO_ERRNO: call float @sqrtf(float
+  // NO_ERRNO: call float @llvm.sqrt.f32(float
   return __builtin_sqrtf(X);
 }
 
 // HAS_ERRNO: declare float @sqrtf(float) [[ATTR:#[0-9]+]]
 // HAS_ERRNO-NOT: attributes [[ATTR]] = {{{.*}} readnone
 
-// NO_ERRNO: declare float @sqrtf(float) [[ATTR:#[0-9]+]]
+// NO_ERRNO: declare float @llvm.sqrt.f32(float) [[ATTR:#[0-9]+]]
 // NO_ERRNO: attributes [[ATTR]] = { nounwind readnone {{.*}}}
 
diff --git a/clang/test/CodeGen/builtins.c b/clang/test/CodeGen/builtins.c
index 0207bb6..4f84db0 100644
--- a/clang/test/CodeGen/builtins.c
+++ b/clang/test/CodeGen/builtins.c
@@ -331,13 +331,13 @@
   // CHECK: call x86_fp80 @llvm.floor.f80
 
   resf = __builtin_sqrtf(F);
-  // CHECK: call float @sqrtf(
+  // CHECK: call float @llvm.sqrt.f32(
 
   resd = __builtin_sqrt(D);
-  // CHECK: call double @sqrt(
+  // CHECK: call double @llvm.sqrt.f64(
 
   resld = __builtin_sqrtl(LD);
-  // CHECK: call x86_fp80 @sqrtl(
+  // CHECK: call x86_fp80 @llvm.sqrt.f80
 
   resf = __builtin_truncf(F);
   // CHECK: call float @llvm.trunc.f32
diff --git a/clang/test/CodeGen/libcalls.c b/clang/test/CodeGen/libcalls.c
index 3cf86d3..1b314f7 100644
--- a/clang/test/CodeGen/libcalls.c
+++ b/clang/test/CodeGen/libcalls.c
@@ -105,9 +105,9 @@
   double exp_ = exp(d);
   long double expl_ = expl(ld);
   float expf_ = expf(f);
-// CHECK-NO: declare double @exp(double) [[NUW_RN]]
-// CHECK-NO: declare x86_fp80 @expl(x86_fp80) [[NUW_RN]]
-// CHECK-NO: declare float @expf(float) [[NUW_RN]]
+// CHECK-NO: declare double @llvm.exp.f64(double) [[NUW_RNI]]
+// CHECK-NO: declare x86_fp80 @llvm.exp.f80(x86_fp80) [[NUW_RNI]]
+// CHECK-NO: declare float @llvm.exp.f32(float) [[NUW_RNI]]
 // CHECK-YES-NOT: declare double @exp(double) [[NUW_RN]]
 // CHECK-YES-NOT: declare x86_fp80 @expl(x86_fp80) [[NUW_RN]]
 // CHECK-YES-NOT: declare float @expf(float) [[NUW_RN]]
@@ -115,9 +115,9 @@
   double log_ = log(d);
   long double logl_ = logl(ld);
   float logf_ = logf(f);
-// CHECK-NO: declare double @log(double) [[NUW_RN]]
-// CHECK-NO: declare x86_fp80 @logl(x86_fp80) [[NUW_RN]]
-// CHECK-NO: declare float @logf(float) [[NUW_RN]]
+// CHECK-NO: declare double @llvm.log.f64(double) [[NUW_RNI]]
+// CHECK-NO: declare x86_fp80 @llvm.log.f80(x86_fp80) [[NUW_RNI]]
+// CHECK-NO: declare float @llvm.log.f32(float) [[NUW_RNI]]
 // CHECK-YES-NOT: declare double @log(double) [[NUW_RN]]
 // CHECK-YES-NOT: declare x86_fp80 @logl(x86_fp80) [[NUW_RN]]
 // CHECK-YES-NOT: declare float @logf(float) [[NUW_RN]]
diff --git a/clang/test/CodeGen/math-builtins.c b/clang/test/CodeGen/math-builtins.c
index fb494f2..805babe 100644
--- a/clang/test/CodeGen/math-builtins.c
+++ b/clang/test/CodeGen/math-builtins.c
@@ -192,9 +192,9 @@
 
   __builtin_cos(f);        __builtin_cosf(f);       __builtin_cosl(f); 
 
-// NO__ERRNO: declare double @cos(double) [[READNONE]]
-// NO__ERRNO: declare float @cosf(float) [[READNONE]]
-// NO__ERRNO: declare x86_fp80 @cosl(x86_fp80) [[READNONE]]
+// NO__ERRNO: declare double @llvm.cos.f64(double) [[READNONE_INTRINSIC]]
+// NO__ERRNO: declare float @llvm.cos.f32(float) [[READNONE_INTRINSIC]]
+// NO__ERRNO: declare x86_fp80 @llvm.cos.f80(x86_fp80) [[READNONE_INTRINSIC]]
 // HAS_ERRNO: declare double @cos(double) [[NOT_READNONE]]
 // HAS_ERRNO: declare float @cosf(float) [[NOT_READNONE]]
 // HAS_ERRNO: declare x86_fp80 @cosl(x86_fp80) [[NOT_READNONE]]
@@ -228,18 +228,18 @@
 
   __builtin_exp(f);        __builtin_expf(f);       __builtin_expl(f);
 
-// NO__ERRNO: declare double @exp(double) [[READNONE]]
-// NO__ERRNO: declare float @expf(float) [[READNONE]]
-// NO__ERRNO: declare x86_fp80 @expl(x86_fp80) [[READNONE]]
+// NO__ERRNO: declare double @llvm.exp.f64(double) [[READNONE_INTRINSIC]]
+// NO__ERRNO: declare float @llvm.exp.f32(float) [[READNONE_INTRINSIC]]
+// NO__ERRNO: declare x86_fp80 @llvm.exp.f80(x86_fp80) [[READNONE_INTRINSIC]]
 // HAS_ERRNO: declare double @exp(double) [[NOT_READNONE]]
 // HAS_ERRNO: declare float @expf(float) [[NOT_READNONE]]
 // HAS_ERRNO: declare x86_fp80 @expl(x86_fp80) [[NOT_READNONE]]
 
   __builtin_exp2(f);       __builtin_exp2f(f);      __builtin_exp2l(f); 
 
-// NO__ERRNO: declare double @exp2(double) [[READNONE]]
-// NO__ERRNO: declare float @exp2f(float) [[READNONE]]
-// NO__ERRNO: declare x86_fp80 @exp2l(x86_fp80) [[READNONE]]
+// NO__ERRNO: declare double @llvm.exp2.f64(double) [[READNONE_INTRINSIC]]
+// NO__ERRNO: declare float @llvm.exp2.f32(float) [[READNONE_INTRINSIC]]
+// NO__ERRNO: declare x86_fp80 @llvm.exp2.f80(x86_fp80) [[READNONE_INTRINSIC]]
 // HAS_ERRNO: declare double @exp2(double) [[NOT_READNONE]]
 // HAS_ERRNO: declare float @exp2f(float) [[NOT_READNONE]]
 // HAS_ERRNO: declare x86_fp80 @exp2l(x86_fp80) [[NOT_READNONE]]
@@ -356,18 +356,18 @@
 
   __builtin_log(f);        __builtin_logf(f);       __builtin_logl(f);
 
-// NO__ERRNO: declare double @log(double) [[READNONE]]
-// NO__ERRNO: declare float @logf(float) [[READNONE]]
-// NO__ERRNO: declare x86_fp80 @logl(x86_fp80) [[READNONE]]
+// NO__ERRNO: declare double @llvm.log.f64(double) [[READNONE_INTRINSIC]]
+// NO__ERRNO: declare float @llvm.log.f32(float) [[READNONE_INTRINSIC]]
+// NO__ERRNO: declare x86_fp80 @llvm.log.f80(x86_fp80) [[READNONE_INTRINSIC]]
 // HAS_ERRNO: declare double @log(double) [[NOT_READNONE]]
 // HAS_ERRNO: declare float @logf(float) [[NOT_READNONE]]
 // HAS_ERRNO: declare x86_fp80 @logl(x86_fp80) [[NOT_READNONE]]
 
   __builtin_log10(f);      __builtin_log10f(f);     __builtin_log10l(f);
 
-// NO__ERRNO: declare double @log10(double) [[READNONE]]
-// NO__ERRNO: declare float @log10f(float) [[READNONE]]
-// NO__ERRNO: declare x86_fp80 @log10l(x86_fp80) [[READNONE]]
+// NO__ERRNO: declare double @llvm.log10.f64(double) [[READNONE_INTRINSIC]]
+// NO__ERRNO: declare float @llvm.log10.f32(float) [[READNONE_INTRINSIC]]
+// NO__ERRNO: declare x86_fp80 @llvm.log10.f80(x86_fp80) [[READNONE_INTRINSIC]]
 // HAS_ERRNO: declare double @log10(double) [[NOT_READNONE]]
 // HAS_ERRNO: declare float @log10f(float) [[NOT_READNONE]]
 // HAS_ERRNO: declare x86_fp80 @log10l(x86_fp80) [[NOT_READNONE]]
@@ -383,9 +383,9 @@
 
   __builtin_log2(f);       __builtin_log2f(f);      __builtin_log2l(f);
 
-// NO__ERRNO: declare double @log2(double) [[READNONE]]
-// NO__ERRNO: declare float @log2f(float) [[READNONE]]
-// NO__ERRNO: declare x86_fp80 @log2l(x86_fp80) [[READNONE]]
+// NO__ERRNO: declare double @llvm.log2.f64(double) [[READNONE_INTRINSIC]]
+// NO__ERRNO: declare float @llvm.log2.f32(float) [[READNONE_INTRINSIC]]
+// NO__ERRNO: declare x86_fp80 @llvm.log2.f80(x86_fp80) [[READNONE_INTRINSIC]]
 // HAS_ERRNO: declare double @log2(double) [[NOT_READNONE]]
 // HAS_ERRNO: declare float @log2f(float) [[NOT_READNONE]]
 // HAS_ERRNO: declare x86_fp80 @log2l(x86_fp80) [[NOT_READNONE]]
@@ -500,9 +500,9 @@
 
   __builtin_sin(f);        __builtin_sinf(f);       __builtin_sinl(f);
 
-// NO__ERRNO: declare double @sin(double) [[READNONE]]
-// NO__ERRNO: declare float @sinf(float) [[READNONE]]
-// NO__ERRNO: declare x86_fp80 @sinl(x86_fp80) [[READNONE]]
+// NO__ERRNO: declare double @llvm.sin.f64(double) [[READNONE_INTRINSIC]]
+// NO__ERRNO: declare float @llvm.sin.f32(float) [[READNONE_INTRINSIC]]
+// NO__ERRNO: declare x86_fp80 @llvm.sin.f80(x86_fp80) [[READNONE_INTRINSIC]]
 // HAS_ERRNO: declare double @sin(double) [[NOT_READNONE]]
 // HAS_ERRNO: declare float @sinf(float) [[NOT_READNONE]]
 // HAS_ERRNO: declare x86_fp80 @sinl(x86_fp80) [[NOT_READNONE]]
@@ -518,9 +518,9 @@
 
   __builtin_sqrt(f);       __builtin_sqrtf(f);      __builtin_sqrtl(f); 
 
-// NO__ERRNO: declare double @sqrt(double) [[READNONE]]
-// NO__ERRNO: declare float @sqrtf(float) [[READNONE]]
-// NO__ERRNO: declare x86_fp80 @sqrtl(x86_fp80) [[READNONE]]
+// NO__ERRNO: declare double @llvm.sqrt.f64(double) [[READNONE_INTRINSIC]]
+// NO__ERRNO: declare float @llvm.sqrt.f32(float) [[READNONE_INTRINSIC]]
+// NO__ERRNO: declare x86_fp80 @llvm.sqrt.f80(x86_fp80) [[READNONE_INTRINSIC]]
 // HAS_ERRNO: declare double @sqrt(double) [[NOT_READNONE]]
 // HAS_ERRNO: declare float @sqrtf(float) [[NOT_READNONE]]
 // HAS_ERRNO: declare x86_fp80 @sqrtl(x86_fp80) [[NOT_READNONE]]
diff --git a/clang/test/CodeGen/math-libcalls.c b/clang/test/CodeGen/math-libcalls.c
index 129b865..be9481c 100644
--- a/clang/test/CodeGen/math-libcalls.c
+++ b/clang/test/CodeGen/math-libcalls.c
@@ -17,21 +17,21 @@
 
   copysign(f,f); copysignf(f,f);copysignl(f,f);
 
-// NO__ERRNO: declare double @copysign(double, double) [[READNONE]]
-// NO__ERRNO: declare float @copysignf(float, float) [[READNONE]]
-// NO__ERRNO: declare x86_fp80 @copysignl(x86_fp80, x86_fp80) [[READNONE]]
-// HAS_ERRNO: declare double @copysign(double, double) [[READNONE:#[0-9]+]]
-// HAS_ERRNO: declare float @copysignf(float, float) [[READNONE]]
-// HAS_ERRNO: declare x86_fp80 @copysignl(x86_fp80, x86_fp80) [[READNONE]]
+// NO__ERRNO: declare double @llvm.copysign.f64(double, double) [[READNONE_INTRINSIC:#[0-9]+]]
+// NO__ERRNO: declare float @llvm.copysign.f32(float, float) [[READNONE_INTRINSIC]]
+// NO__ERRNO: declare x86_fp80 @llvm.copysign.f80(x86_fp80, x86_fp80) [[READNONE_INTRINSIC]]
+// HAS_ERRNO: declare double @llvm.copysign.f64(double, double) [[READNONE_INTRINSIC:#[0-9]+]]
+// HAS_ERRNO: declare float @llvm.copysign.f32(float, float) [[READNONE_INTRINSIC]]
+// HAS_ERRNO: declare x86_fp80 @llvm.copysign.f80(x86_fp80, x86_fp80) [[READNONE_INTRINSIC]]
 
   fabs(f);       fabsf(f);      fabsl(f);
 
-// NO__ERRNO: declare double @fabs(double) [[READNONE]]
-// NO__ERRNO: declare float @fabsf(float) [[READNONE]]
-// NO__ERRNO: declare x86_fp80 @fabsl(x86_fp80) [[READNONE]]
-// HAS_ERRNO: declare double @fabs(double) [[READNONE]]
-// HAS_ERRNO: declare float @fabsf(float) [[READNONE]]
-// HAS_ERRNO: declare x86_fp80 @fabsl(x86_fp80) [[READNONE]]
+// NO__ERRNO: declare double @llvm.fabs.f64(double) [[READNONE_INTRINSIC]]
+// NO__ERRNO: declare float @llvm.fabs.f32(float) [[READNONE_INTRINSIC]]
+// NO__ERRNO: declare x86_fp80 @llvm.fabs.f80(x86_fp80) [[READNONE_INTRINSIC]]
+// HAS_ERRNO: declare double @llvm.fabs.f64(double) [[READNONE_INTRINSIC]]
+// HAS_ERRNO: declare float @llvm.fabs.f32(float) [[READNONE_INTRINSIC]]
+// HAS_ERRNO: declare x86_fp80 @llvm.fabs.f80(x86_fp80) [[READNONE_INTRINSIC]]
 
   fmod(f,f);     fmodf(f,f);    fmodl(f,f);
 
@@ -80,7 +80,7 @@
 
   pow(f,f);        powf(f,f);       powl(f,f);
 
-// NO__ERRNO: declare double @llvm.pow.f64(double, double) [[READNONE_INTRINSIC:#[0-9]+]]
+// NO__ERRNO: declare double @llvm.pow.f64(double, double) [[READNONE_INTRINSIC]]
 // NO__ERRNO: declare float @llvm.pow.f32(float, float) [[READNONE_INTRINSIC]]
 // NO__ERRNO: declare x86_fp80 @llvm.pow.f80(x86_fp80, x86_fp80) [[READNONE_INTRINSIC]]
 // HAS_ERRNO: declare double @pow(double, double) [[NOT_READNONE]]
@@ -147,24 +147,24 @@
 // NO__ERRNO: declare double @cbrt(double) [[READNONE]]
 // NO__ERRNO: declare float @cbrtf(float) [[READNONE]]
 // NO__ERRNO: declare x86_fp80 @cbrtl(x86_fp80) [[READNONE]]
-// HAS_ERRNO: declare double @cbrt(double) [[READNONE]]
+// HAS_ERRNO: declare double @cbrt(double) [[READNONE:#[0-9]+]]
 // HAS_ERRNO: declare float @cbrtf(float) [[READNONE]]
 // HAS_ERRNO: declare x86_fp80 @cbrtl(x86_fp80) [[READNONE]]
 
   ceil(f);       ceilf(f);      ceill(f);
 
-// NO__ERRNO: declare double @ceil(double) [[READNONE]]
-// NO__ERRNO: declare float @ceilf(float) [[READNONE]]
-// NO__ERRNO: declare x86_fp80 @ceill(x86_fp80) [[READNONE]]
-// HAS_ERRNO: declare double @ceil(double) [[READNONE]]
-// HAS_ERRNO: declare float @ceilf(float) [[READNONE]]
-// HAS_ERRNO: declare x86_fp80 @ceill(x86_fp80) [[READNONE]]
+// NO__ERRNO: declare double @llvm.ceil.f64(double) [[READNONE_INTRINSIC]]
+// NO__ERRNO: declare float @llvm.ceil.f32(float) [[READNONE_INTRINSIC]]
+// NO__ERRNO: declare x86_fp80 @llvm.ceil.f80(x86_fp80) [[READNONE_INTRINSIC]]
+// HAS_ERRNO: declare double @llvm.ceil.f64(double) [[READNONE_INTRINSIC]]
+// HAS_ERRNO: declare float @llvm.ceil.f32(float) [[READNONE_INTRINSIC]]
+// HAS_ERRNO: declare x86_fp80 @llvm.ceil.f80(x86_fp80) [[READNONE_INTRINSIC]]
 
   cos(f);        cosf(f);       cosl(f); 
 
-// NO__ERRNO: declare double @cos(double) [[READNONE]]
-// NO__ERRNO: declare float @cosf(float) [[READNONE]]
-// NO__ERRNO: declare x86_fp80 @cosl(x86_fp80) [[READNONE]]
+// NO__ERRNO: declare double @llvm.cos.f64(double) [[READNONE_INTRINSIC]]
+// NO__ERRNO: declare float @llvm.cos.f32(float) [[READNONE_INTRINSIC]]
+// NO__ERRNO: declare x86_fp80 @llvm.cos.f80(x86_fp80) [[READNONE_INTRINSIC]]
 // HAS_ERRNO: declare double @cos(double) [[NOT_READNONE]]
 // HAS_ERRNO: declare float @cosf(float) [[NOT_READNONE]]
 // HAS_ERRNO: declare x86_fp80 @cosl(x86_fp80) [[NOT_READNONE]]
@@ -198,18 +198,18 @@
 
   exp(f);        expf(f);       expl(f);
 
-// NO__ERRNO: declare double @exp(double) [[READNONE]]
-// NO__ERRNO: declare float @expf(float) [[READNONE]]
-// NO__ERRNO: declare x86_fp80 @expl(x86_fp80) [[READNONE]]
+// NO__ERRNO: declare double @llvm.exp.f64(double) [[READNONE_INTRINSIC]]
+// NO__ERRNO: declare float @llvm.exp.f32(float) [[READNONE_INTRINSIC]]
+// NO__ERRNO: declare x86_fp80 @llvm.exp.f80(x86_fp80) [[READNONE_INTRINSIC]]
 // HAS_ERRNO: declare double @exp(double) [[NOT_READNONE]]
 // HAS_ERRNO: declare float @expf(float) [[NOT_READNONE]]
 // HAS_ERRNO: declare x86_fp80 @expl(x86_fp80) [[NOT_READNONE]]
 
   exp2(f);       exp2f(f);      exp2l(f); 
 
-// NO__ERRNO: declare double @exp2(double) [[READNONE]]
-// NO__ERRNO: declare float @exp2f(float) [[READNONE]]
-// NO__ERRNO: declare x86_fp80 @exp2l(x86_fp80) [[READNONE]]
+// NO__ERRNO: declare double @llvm.exp2.f64(double) [[READNONE_INTRINSIC]]
+// NO__ERRNO: declare float @llvm.exp2.f32(float) [[READNONE_INTRINSIC]]
+// NO__ERRNO: declare x86_fp80 @llvm.exp2.f80(x86_fp80) [[READNONE_INTRINSIC]]
 // HAS_ERRNO: declare double @exp2(double) [[NOT_READNONE]]
 // HAS_ERRNO: declare float @exp2f(float) [[NOT_READNONE]]
 // HAS_ERRNO: declare x86_fp80 @exp2l(x86_fp80) [[NOT_READNONE]]
@@ -234,12 +234,12 @@
 
   floor(f);      floorf(f);     floorl(f);
 
-// NO__ERRNO: declare double @floor(double) [[READNONE]]
-// NO__ERRNO: declare float @floorf(float) [[READNONE]]
-// NO__ERRNO: declare x86_fp80 @floorl(x86_fp80) [[READNONE]]
-// HAS_ERRNO: declare double @floor(double) [[READNONE]]
-// HAS_ERRNO: declare float @floorf(float) [[READNONE]]
-// HAS_ERRNO: declare x86_fp80 @floorl(x86_fp80) [[READNONE]]
+// NO__ERRNO: declare double @llvm.floor.f64(double) [[READNONE_INTRINSIC]]
+// NO__ERRNO: declare float @llvm.floor.f32(float) [[READNONE_INTRINSIC]]
+// NO__ERRNO: declare x86_fp80 @llvm.floor.f80(x86_fp80) [[READNONE_INTRINSIC]]
+// HAS_ERRNO: declare double @llvm.floor.f64(double) [[READNONE_INTRINSIC]]
+// HAS_ERRNO: declare float @llvm.floor.f32(float) [[READNONE_INTRINSIC]]
+// HAS_ERRNO: declare x86_fp80 @llvm.floor.f80(x86_fp80) [[READNONE_INTRINSIC]]
 
   fma(f,f,f);        fmaf(f,f,f);       fmal(f,f,f);
 
@@ -263,21 +263,21 @@
 
   fmax(f,f);       fmaxf(f,f);      fmaxl(f,f);
 
-// NO__ERRNO: declare double @fmax(double, double) [[READNONE]]
-// NO__ERRNO: declare float @fmaxf(float, float) [[READNONE]]
-// NO__ERRNO: declare x86_fp80 @fmaxl(x86_fp80, x86_fp80) [[READNONE]]
-// HAS_ERRNO: declare double @fmax(double, double) [[READNONE]]
-// HAS_ERRNO: declare float @fmaxf(float, float) [[READNONE]]
-// HAS_ERRNO: declare x86_fp80 @fmaxl(x86_fp80, x86_fp80) [[READNONE]]
+// NO__ERRNO: declare double @llvm.maxnum.f64(double, double) [[READNONE_INTRINSIC]]
+// NO__ERRNO: declare float @llvm.maxnum.f32(float, float) [[READNONE_INTRINSIC]]
+// NO__ERRNO: declare x86_fp80 @llvm.maxnum.f80(x86_fp80, x86_fp80) [[READNONE_INTRINSIC]]
+// HAS_ERRNO: declare double @llvm.maxnum.f64(double, double) [[READNONE_INTRINSIC]]
+// HAS_ERRNO: declare float @llvm.maxnum.f32(float, float) [[READNONE_INTRINSIC]]
+// HAS_ERRNO: declare x86_fp80 @llvm.maxnum.f80(x86_fp80, x86_fp80) [[READNONE_INTRINSIC]]
 
   fmin(f,f);       fminf(f,f);      fminl(f,f);
 
-// NO__ERRNO: declare double @fmin(double, double) [[READNONE]]
-// NO__ERRNO: declare float @fminf(float, float) [[READNONE]]
-// NO__ERRNO: declare x86_fp80 @fminl(x86_fp80, x86_fp80) [[READNONE]]
-// HAS_ERRNO: declare double @fmin(double, double) [[READNONE]]
-// HAS_ERRNO: declare float @fminf(float, float) [[READNONE]]
-// HAS_ERRNO: declare x86_fp80 @fminl(x86_fp80, x86_fp80) [[READNONE]]
+// NO__ERRNO: declare double @llvm.minnum.f64(double, double) [[READNONE_INTRINSIC]]
+// NO__ERRNO: declare float @llvm.minnum.f32(float, float) [[READNONE_INTRINSIC]]
+// NO__ERRNO: declare x86_fp80 @llvm.minnum.f80(x86_fp80, x86_fp80) [[READNONE_INTRINSIC]]
+// HAS_ERRNO: declare double @llvm.minnum.f64(double, double) [[READNONE_INTRINSIC]]
+// HAS_ERRNO: declare float @llvm.minnum.f32(float, float) [[READNONE_INTRINSIC]]
+// HAS_ERRNO: declare x86_fp80 @llvm.minnum.f80(x86_fp80, x86_fp80) [[READNONE_INTRINSIC]]
 
   hypot(f,f);      hypotf(f,f);     hypotl(f,f);
 
@@ -326,18 +326,18 @@
 
   log(f);        logf(f);       logl(f);
 
-// NO__ERRNO: declare double @log(double) [[READNONE]]
-// NO__ERRNO: declare float @logf(float) [[READNONE]]
-// NO__ERRNO: declare x86_fp80 @logl(x86_fp80) [[READNONE]]
+// NO__ERRNO: declare double @llvm.log.f64(double) [[READNONE_INTRINSIC]]
+// NO__ERRNO: declare float @llvm.log.f32(float) [[READNONE_INTRINSIC]]
+// NO__ERRNO: declare x86_fp80 @llvm.log.f80(x86_fp80) [[READNONE_INTRINSIC]]
 // HAS_ERRNO: declare double @log(double) [[NOT_READNONE]]
 // HAS_ERRNO: declare float @logf(float) [[NOT_READNONE]]
 // HAS_ERRNO: declare x86_fp80 @logl(x86_fp80) [[NOT_READNONE]]
 
   log10(f);      log10f(f);     log10l(f);
 
-// NO__ERRNO: declare double @log10(double) [[READNONE]]
-// NO__ERRNO: declare float @log10f(float) [[READNONE]]
-// NO__ERRNO: declare x86_fp80 @log10l(x86_fp80) [[READNONE]]
+// NO__ERRNO: declare double @llvm.log10.f64(double) [[READNONE_INTRINSIC]]
+// NO__ERRNO: declare float @llvm.log10.f32(float) [[READNONE_INTRINSIC]]
+// NO__ERRNO: declare x86_fp80 @llvm.log10.f80(x86_fp80) [[READNONE_INTRINSIC]]
 // HAS_ERRNO: declare double @log10(double) [[NOT_READNONE]]
 // HAS_ERRNO: declare float @log10f(float) [[NOT_READNONE]]
 // HAS_ERRNO: declare x86_fp80 @log10l(x86_fp80) [[NOT_READNONE]]
@@ -353,9 +353,9 @@
 
   log2(f);       log2f(f);      log2l(f);
 
-// NO__ERRNO: declare double @log2(double) [[READNONE]]
-// NO__ERRNO: declare float @log2f(float) [[READNONE]]
-// NO__ERRNO: declare x86_fp80 @log2l(x86_fp80) [[READNONE]]
+// NO__ERRNO: declare double @llvm.log2.f64(double) [[READNONE_INTRINSIC]]
+// NO__ERRNO: declare float @llvm.log2.f32(float) [[READNONE_INTRINSIC]]
+// NO__ERRNO: declare x86_fp80 @llvm.log2.f80(x86_fp80) [[READNONE_INTRINSIC]]
 // HAS_ERRNO: declare double @log2(double) [[NOT_READNONE]]
 // HAS_ERRNO: declare float @log2f(float) [[NOT_READNONE]]
 // HAS_ERRNO: declare x86_fp80 @log2l(x86_fp80) [[NOT_READNONE]]
@@ -389,12 +389,12 @@
 
   nearbyint(f);  nearbyintf(f); nearbyintl(f);
 
-// NO__ERRNO: declare double @nearbyint(double) [[READNONE]]
-// NO__ERRNO: declare float @nearbyintf(float) [[READNONE]]
-// NO__ERRNO: declare x86_fp80 @nearbyintl(x86_fp80) [[READNONE]]
-// HAS_ERRNO: declare double @nearbyint(double) [[READNONE]]
-// HAS_ERRNO: declare float @nearbyintf(float) [[READNONE]]
-// HAS_ERRNO: declare x86_fp80 @nearbyintl(x86_fp80) [[READNONE]]
+// NO__ERRNO: declare double @llvm.nearbyint.f64(double) [[READNONE_INTRINSIC]]
+// NO__ERRNO: declare float @llvm.nearbyint.f32(float) [[READNONE_INTRINSIC]]
+// NO__ERRNO: declare x86_fp80 @llvm.nearbyint.f80(x86_fp80) [[READNONE_INTRINSIC]]
+// HAS_ERRNO: declare double @llvm.nearbyint.f64(double) [[READNONE_INTRINSIC]]
+// HAS_ERRNO: declare float @llvm.nearbyint.f32(float) [[READNONE_INTRINSIC]]
+// HAS_ERRNO: declare x86_fp80 @llvm.nearbyint.f80(x86_fp80) [[READNONE_INTRINSIC]]
 
   nextafter(f,f);  nextafterf(f,f); nextafterl(f,f);
 
@@ -434,21 +434,21 @@
 
   rint(f);       rintf(f);      rintl(f);
 
-// NO__ERRNO: declare double @rint(double) [[READNONE]]
-// NO__ERRNO: declare float @rintf(float) [[READNONE]]
-// NO__ERRNO: declare x86_fp80 @rintl(x86_fp80) [[READNONE]]
-// HAS_ERRNO: declare double @rint(double) [[READNONE]]
-// HAS_ERRNO: declare float @rintf(float) [[READNONE]]
-// HAS_ERRNO: declare x86_fp80 @rintl(x86_fp80) [[READNONE]]
+// NO__ERRNO: declare double @llvm.rint.f64(double) [[READNONE_INTRINSIC]]
+// NO__ERRNO: declare float @llvm.rint.f32(float) [[READNONE_INTRINSIC]]
+// NO__ERRNO: declare x86_fp80 @llvm.rint.f80(x86_fp80) [[READNONE_INTRINSIC]]
+// HAS_ERRNO: declare double @llvm.rint.f64(double) [[READNONE_INTRINSIC]]
+// HAS_ERRNO: declare float @llvm.rint.f32(float) [[READNONE_INTRINSIC]]
+// HAS_ERRNO: declare x86_fp80 @llvm.rint.f80(x86_fp80) [[READNONE_INTRINSIC]]
 
   round(f);      roundf(f);     roundl(f);
 
-// NO__ERRNO: declare double @round(double) [[READNONE]]
-// NO__ERRNO: declare float @roundf(float) [[READNONE]]
-// NO__ERRNO: declare x86_fp80 @roundl(x86_fp80) [[READNONE]]
-// HAS_ERRNO: declare double @round(double) [[READNONE]]
-// HAS_ERRNO: declare float @roundf(float) [[READNONE]]
-// HAS_ERRNO: declare x86_fp80 @roundl(x86_fp80) [[READNONE]]
+// NO__ERRNO: declare double @llvm.round.f64(double) [[READNONE_INTRINSIC]]
+// NO__ERRNO: declare float @llvm.round.f32(float) [[READNONE_INTRINSIC]]
+// NO__ERRNO: declare x86_fp80 @llvm.round.f80(x86_fp80) [[READNONE_INTRINSIC]]
+// HAS_ERRNO: declare double @llvm.round.f64(double) [[READNONE_INTRINSIC]]
+// HAS_ERRNO: declare float @llvm.round.f32(float) [[READNONE_INTRINSIC]]
+// HAS_ERRNO: declare x86_fp80 @llvm.round.f80(x86_fp80) [[READNONE_INTRINSIC]]
 
   scalbln(f,f);    scalblnf(f,f);   scalblnl(f,f);
 
@@ -470,9 +470,9 @@
 
   sin(f);        sinf(f);       sinl(f);
 
-// NO__ERRNO: declare double @sin(double) [[READNONE]]
-// NO__ERRNO: declare float @sinf(float) [[READNONE]]
-// NO__ERRNO: declare x86_fp80 @sinl(x86_fp80) [[READNONE]]
+// NO__ERRNO: declare double @llvm.sin.f64(double) [[READNONE_INTRINSIC]]
+// NO__ERRNO: declare float @llvm.sin.f32(float) [[READNONE_INTRINSIC]]
+// NO__ERRNO: declare x86_fp80 @llvm.sin.f80(x86_fp80) [[READNONE_INTRINSIC]]
 // HAS_ERRNO: declare double @sin(double) [[NOT_READNONE]]
 // HAS_ERRNO: declare float @sinf(float) [[NOT_READNONE]]
 // HAS_ERRNO: declare x86_fp80 @sinl(x86_fp80) [[NOT_READNONE]]
@@ -524,23 +524,24 @@
 
   trunc(f);      truncf(f);     truncl(f);
 
-// NO__ERRNO: declare double @trunc(double) [[READNONE]]
-// NO__ERRNO: declare float @truncf(float) [[READNONE]]
-// NO__ERRNO: declare x86_fp80 @truncl(x86_fp80) [[READNONE]]
-// HAS_ERRNO: declare double @trunc(double) [[READNONE]]
-// HAS_ERRNO: declare float @truncf(float) [[READNONE]]
-// HAS_ERRNO: declare x86_fp80 @truncl(x86_fp80) [[READNONE]]
+// NO__ERRNO: declare double @llvm.trunc.f64(double) [[READNONE_INTRINSIC]]
+// NO__ERRNO: declare float @llvm.trunc.f32(float) [[READNONE_INTRINSIC]]
+// NO__ERRNO: declare x86_fp80 @llvm.trunc.f80(x86_fp80) [[READNONE_INTRINSIC]]
+// HAS_ERRNO: declare double @llvm.trunc.f64(double) [[READNONE_INTRINSIC]]
+// HAS_ERRNO: declare float @llvm.trunc.f32(float) [[READNONE_INTRINSIC]]
+// HAS_ERRNO: declare x86_fp80 @llvm.trunc.f80(x86_fp80) [[READNONE_INTRINSIC]]
 };
 
 
 // NO__ERRNO: attributes [[READNONE]] = { {{.*}}readnone{{.*}} }
+// NO__ERRNO: attributes [[READNONE_INTRINSIC]] = { {{.*}}readnone{{.*}} }
 // NO__ERRNO: attributes [[NOT_READNONE]] = { nounwind "correctly{{.*}} }
 // NO__ERRNO: attributes [[READONLY]] = { {{.*}}readonly{{.*}} }
-// NO__ERRNO: attributes [[READNONE_INTRINSIC]] = { {{.*}}readnone{{.*}} }
 
 // HAS_ERRNO: attributes [[NOT_READNONE]] = { nounwind "correctly{{.*}} }
-// HAS_ERRNO: attributes [[READNONE]] = { {{.*}}readnone{{.*}} }
+// HAS_ERRNO: attributes [[READNONE_INTRINSIC]] = { {{.*}}readnone{{.*}} }
 // HAS_ERRNO: attributes [[READONLY]] = { {{.*}}readonly{{.*}} }
+// HAS_ERRNO: attributes [[READNONE]] = { {{.*}}readnone{{.*}} }
 
 // HAS_ERRNO_GNU: attributes [[READNONE_INTRINSIC]] = { {{.*}}readnone{{.*}} }
 // HAS_ERRNO_WIN: attributes [[READNONE_INTRINSIC]] = { {{.*}}readnone{{.*}} }