[llvm] a70006c - AMDGPU: Replace some libcalls with intrinsics

Matt Arsenault via llvm-commits llvm-commits at lists.llvm.org
Mon Aug 14 15:23:43 PDT 2023


Author: Matt Arsenault
Date: 2023-08-14T18:20:47-04:00
New Revision: a70006c4c581ef3f9b355ec78ec38023faada6c6

URL: https://github.com/llvm/llvm-project/commit/a70006c4c581ef3f9b355ec78ec38023faada6c6
DIFF: https://github.com/llvm/llvm-project/commit/a70006c4c581ef3f9b355ec78ec38023faada6c6.diff

LOG: AMDGPU: Replace some libcalls with intrinsics

OpenCL loses fast math information by going through libcall wrappers
around intrinsics.

Do this to preserve call site flags which are lost when inlining. It's
not safe in general to propagate flags during inline, so avoid dealing
with this by just special casing some of the useful calls.

Added: 
    

Modified: 
    llvm/lib/Target/AMDGPU/AMDGPULibCalls.cpp
    llvm/test/CodeGen/AMDGPU/amdgpu-simplify-libcall-exp.ll
    llvm/test/CodeGen/AMDGPU/amdgpu-simplify-libcall-exp2.ll
    llvm/test/CodeGen/AMDGPU/amdgpu-simplify-libcall-fma.ll
    llvm/test/CodeGen/AMDGPU/amdgpu-simplify-libcall-fmax.ll
    llvm/test/CodeGen/AMDGPU/amdgpu-simplify-libcall-fmin.ll
    llvm/test/CodeGen/AMDGPU/amdgpu-simplify-libcall-mad.ll
    llvm/test/CodeGen/AMDGPU/simplify-libcalls.ll

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Target/AMDGPU/AMDGPULibCalls.cpp b/llvm/lib/Target/AMDGPU/AMDGPULibCalls.cpp
index f49c06e55fdfec..3372200edd1ef7 100644
--- a/llvm/lib/Target/AMDGPU/AMDGPULibCalls.cpp
+++ b/llvm/lib/Target/AMDGPU/AMDGPULibCalls.cpp
@@ -99,6 +99,17 @@ class AMDGPULibCalls {
   // Get a scalar native builtin single argument FP function
   FunctionCallee getNativeFunction(Module *M, const FuncInfo &FInfo);
 
+  /// Substitute a call to a known libcall with an intrinsic call. If \p
+  /// AllowMinSize is true, allow the replacement in a minsize function.
+  bool shouldReplaceLibcallWithIntrinsic(const CallInst *CI,
+                                         bool AllowMinSizeF32 = false,
+                                         bool AllowF64 = false);
+  void replaceLibCallWithSimpleIntrinsic(CallInst *CI, Intrinsic::ID IntrID);
+
+  bool tryReplaceLibcallWithSimpleIntrinsic(CallInst *CI, Intrinsic::ID IntrID,
+                                            bool AllowMinSizeF32 = false,
+                                            bool AllowF64 = false);
+
 protected:
   bool isUnsafeMath(const FPMathOperator *FPOp) const;
 
@@ -567,10 +578,38 @@ bool AMDGPULibCalls::fold(CallInst *CI) {
       return true;
 
     // Copy fast flags from the original call.
-    B.setFastMathFlags(FPOp->getFastMathFlags());
-
-    // Specialized optimizations for each function call
+    FastMathFlags FMF = FPOp->getFastMathFlags();
+    B.setFastMathFlags(FMF);
+
+    // Specialized optimizations for each function call.
+    //
+    // TODO: Handle other simple intrinsic wrappers. Sqrt, copysign, fabs,
+    // ldexp, log, rounding intrinsics.
+    //
+    // TODO: Handle native functions
     switch (FInfo.getId()) {
+    case AMDGPULibFunc::EI_EXP:
+      if (FMF.none())
+        return false;
+      return tryReplaceLibcallWithSimpleIntrinsic(CI, Intrinsic::exp,
+                                                  FMF.approxFunc());
+    case AMDGPULibFunc::EI_EXP2:
+      if (FMF.none())
+        return false;
+      return tryReplaceLibcallWithSimpleIntrinsic(CI, Intrinsic::exp2,
+                                                  FMF.approxFunc());
+    case AMDGPULibFunc::EI_FMIN:
+      return tryReplaceLibcallWithSimpleIntrinsic(CI, Intrinsic::minnum, true,
+                                                  true);
+    case AMDGPULibFunc::EI_FMAX:
+      return tryReplaceLibcallWithSimpleIntrinsic(CI, Intrinsic::maxnum, true,
+                                                  true);
+    case AMDGPULibFunc::EI_FMA:
+      return tryReplaceLibcallWithSimpleIntrinsic(CI, Intrinsic::fma, true,
+                                                  true);
+    case AMDGPULibFunc::EI_MAD:
+      return tryReplaceLibcallWithSimpleIntrinsic(CI, Intrinsic::fmuladd, true,
+                                                  true);
     case AMDGPULibFunc::EI_POW:
     case AMDGPULibFunc::EI_POWR:
     case AMDGPULibFunc::EI_POWN:
@@ -1022,6 +1061,50 @@ FunctionCallee AMDGPULibCalls::getNativeFunction(Module *M,
   return getFunction(M, nf);
 }
 
+// Some library calls are just wrappers around llvm intrinsics, but compiled
+// conservatively. Preserve the flags from the original call site by
+// substituting them with direct calls with all the flags.
+bool AMDGPULibCalls::shouldReplaceLibcallWithIntrinsic(const CallInst *CI,
+                                                       bool AllowMinSizeF32,
+                                                       bool AllowF64) {
+  Type *FltTy = CI->getType()->getScalarType();
+  const bool IsF32 = FltTy->isFloatTy();
+
+  // f64 intrinsics aren't implemented for most operations.
+  if (!IsF32 && !FltTy->isHalfTy() && (!AllowF64 || !FltTy->isDoubleTy()))
+    return false;
+
+  // We're implicitly inlining by replacing the libcall with the intrinsic, so
+  // don't do it for noinline call sites.
+  if (CI->isNoInline())
+    return false;
+
+  const Function *ParentF = CI->getFunction();
+  // TODO: Handle strictfp
+  if (ParentF->hasFnAttribute(Attribute::StrictFP))
+    return false;
+
+  if (IsF32 && !AllowMinSizeF32 && ParentF->hasMinSize())
+    return false;
+  return true;
+}
+
+void AMDGPULibCalls::replaceLibCallWithSimpleIntrinsic(CallInst *CI,
+                                                       Intrinsic::ID IntrID) {
+  CI->setCalledFunction(
+      Intrinsic::getDeclaration(CI->getModule(), IntrID, {CI->getType()}));
+}
+
+bool AMDGPULibCalls::tryReplaceLibcallWithSimpleIntrinsic(CallInst *CI,
+                                                          Intrinsic::ID IntrID,
+                                                          bool AllowMinSizeF32,
+                                                          bool AllowF64) {
+  if (!shouldReplaceLibcallWithIntrinsic(CI, AllowMinSizeF32, AllowF64))
+    return false;
+  replaceLibCallWithSimpleIntrinsic(CI, IntrID);
+  return true;
+}
+
 // fold sqrt -> native_sqrt (x)
 bool AMDGPULibCalls::fold_sqrt(FPMathOperator *FPOp, IRBuilder<> &B,
                                const FuncInfo &FInfo) {

diff  --git a/llvm/test/CodeGen/AMDGPU/amdgpu-simplify-libcall-exp.ll b/llvm/test/CodeGen/AMDGPU/amdgpu-simplify-libcall-exp.ll
index fc455d607e176c..f34e6031effb78 100644
--- a/llvm/test/CodeGen/AMDGPU/amdgpu-simplify-libcall-exp.ll
+++ b/llvm/test/CodeGen/AMDGPU/amdgpu-simplify-libcall-exp.ll
@@ -217,7 +217,7 @@ define half @test_exp_f16(half %arg) {
 define half @test_exp_f16_fast(half %arg) {
 ; CHECK-LABEL: define half @test_exp_f16_fast
 ; CHECK-SAME: (half [[ARG:%.*]]) {
-; CHECK-NEXT:    [[EXP:%.*]] = tail call fast half @_Z3expDh(half [[ARG]])
+; CHECK-NEXT:    [[EXP:%.*]] = tail call fast half @llvm.exp.f16(half [[ARG]])
 ; CHECK-NEXT:    ret half [[EXP]]
 ;
   %exp = tail call fast half @_Z3expDh(half %arg)
@@ -277,7 +277,7 @@ define <16 x half> @test_exp_v16f16(<16 x half> %arg) {
 define float @test_exp_f32_nobuiltin_callsite(float %arg) {
 ; CHECK-LABEL: define float @test_exp_f32_nobuiltin_callsite
 ; CHECK-SAME: (float [[ARG:%.*]]) {
-; CHECK-NEXT:    [[EXP:%.*]] = tail call float @_Z3expf(float [[ARG]]) #[[ATTR5:[0-9]+]], !fpmath !0
+; CHECK-NEXT:    [[EXP:%.*]] = tail call float @_Z3expf(float [[ARG]]) #[[ATTR6:[0-9]+]], !fpmath !0
 ; CHECK-NEXT:    ret float [[EXP]]
 ;
   %exp = tail call float @_Z3expf(float %arg) #0, !fpmath !0
@@ -287,7 +287,7 @@ define float @test_exp_f32_nobuiltin_callsite(float %arg) {
 define <2 x float> @test_exp_v2f32_nobuiltin_callsite(<2 x float> %arg) {
 ; CHECK-LABEL: define <2 x float> @test_exp_v2f32_nobuiltin_callsite
 ; CHECK-SAME: (<2 x float> [[ARG:%.*]]) {
-; CHECK-NEXT:    [[EXP:%.*]] = tail call <2 x float> @_Z3expDv2_f(<2 x float> [[ARG]]) #[[ATTR5]], !fpmath !0
+; CHECK-NEXT:    [[EXP:%.*]] = tail call <2 x float> @_Z3expDv2_f(<2 x float> [[ARG]]) #[[ATTR6]], !fpmath !0
 ; CHECK-NEXT:    ret <2 x float> [[EXP]]
 ;
   %exp = tail call <2 x float> @_Z3expDv2_f(<2 x float> %arg) #0, !fpmath !0
@@ -297,7 +297,7 @@ define <2 x float> @test_exp_v2f32_nobuiltin_callsite(<2 x float> %arg) {
 define float @test_exp_cr_f32_nobuiltin_callsite(float %arg) {
 ; CHECK-LABEL: define float @test_exp_cr_f32_nobuiltin_callsite
 ; CHECK-SAME: (float [[ARG:%.*]]) {
-; CHECK-NEXT:    [[EXP:%.*]] = tail call float @_Z3expf(float [[ARG]]) #[[ATTR5]]
+; CHECK-NEXT:    [[EXP:%.*]] = tail call float @_Z3expf(float [[ARG]]) #[[ATTR6]]
 ; CHECK-NEXT:    ret float [[EXP]]
 ;
   %exp = tail call float @_Z3expf(float %arg) #0
@@ -307,7 +307,7 @@ define float @test_exp_cr_f32_nobuiltin_callsite(float %arg) {
 define <2 x float> @test_exp_cr_v2f32_nobuiltin_callsite(<2 x float> %arg) {
 ; CHECK-LABEL: define <2 x float> @test_exp_cr_v2f32_nobuiltin_callsite
 ; CHECK-SAME: (<2 x float> [[ARG:%.*]]) {
-; CHECK-NEXT:    [[EXP:%.*]] = tail call <2 x float> @_Z3expDv2_f(<2 x float> [[ARG]]) #[[ATTR5]]
+; CHECK-NEXT:    [[EXP:%.*]] = tail call <2 x float> @_Z3expDv2_f(<2 x float> [[ARG]]) #[[ATTR6]]
 ; CHECK-NEXT:    ret <2 x float> [[EXP]]
 ;
   %exp = tail call <2 x float> @_Z3expDv2_f(<2 x float> %arg) #0
@@ -318,7 +318,7 @@ define <2 x float> @test_exp_cr_v2f32_nobuiltin_callsite(<2 x float> %arg) {
 define float @test_exp_f32_nobuiltins(float %arg) #1 {
 ; CHECK-LABEL: define float @test_exp_f32_nobuiltins
 ; CHECK-SAME: (float [[ARG:%.*]]) #[[ATTR0:[0-9]+]] {
-; CHECK-NEXT:    [[EXP:%.*]] = tail call float @_Z3expf(float [[ARG]]) #[[ATTR5]], !fpmath !0
+; CHECK-NEXT:    [[EXP:%.*]] = tail call float @_Z3expf(float [[ARG]]) #[[ATTR6]], !fpmath !0
 ; CHECK-NEXT:    ret float [[EXP]]
 ;
   %exp = tail call float @_Z3expf(float %arg) #0, !fpmath !0
@@ -328,7 +328,7 @@ define float @test_exp_f32_nobuiltins(float %arg) #1 {
 define <2 x float> @test_exp_v2f32_nobuiltins(<2 x float> %arg) #1 {
 ; CHECK-LABEL: define <2 x float> @test_exp_v2f32_nobuiltins
 ; CHECK-SAME: (<2 x float> [[ARG:%.*]]) #[[ATTR0]] {
-; CHECK-NEXT:    [[EXP:%.*]] = tail call <2 x float> @_Z3expDv2_f(<2 x float> [[ARG]]) #[[ATTR5]], !fpmath !0
+; CHECK-NEXT:    [[EXP:%.*]] = tail call <2 x float> @_Z3expDv2_f(<2 x float> [[ARG]]) #[[ATTR6]], !fpmath !0
 ; CHECK-NEXT:    ret <2 x float> [[EXP]]
 ;
   %exp = tail call <2 x float> @_Z3expDv2_f(<2 x float> %arg) #0, !fpmath !0
@@ -338,7 +338,7 @@ define <2 x float> @test_exp_v2f32_nobuiltins(<2 x float> %arg) #1 {
 define float @test_exp_cr_f32_nobuiltins(float %arg) #1 {
 ; CHECK-LABEL: define float @test_exp_cr_f32_nobuiltins
 ; CHECK-SAME: (float [[ARG:%.*]]) #[[ATTR0]] {
-; CHECK-NEXT:    [[EXP:%.*]] = tail call float @_Z3expf(float [[ARG]]) #[[ATTR5]]
+; CHECK-NEXT:    [[EXP:%.*]] = tail call float @_Z3expf(float [[ARG]]) #[[ATTR6]]
 ; CHECK-NEXT:    ret float [[EXP]]
 ;
   %exp = tail call float @_Z3expf(float %arg) #0
@@ -348,7 +348,7 @@ define float @test_exp_cr_f32_nobuiltins(float %arg) #1 {
 define <2 x float> @test_exp_cr_v2f32_nobuiltins(<2 x float> %arg) #1 {
 ; CHECK-LABEL: define <2 x float> @test_exp_cr_v2f32_nobuiltins
 ; CHECK-SAME: (<2 x float> [[ARG:%.*]]) #[[ATTR0]] {
-; CHECK-NEXT:    [[EXP:%.*]] = tail call <2 x float> @_Z3expDv2_f(<2 x float> [[ARG]]) #[[ATTR5]]
+; CHECK-NEXT:    [[EXP:%.*]] = tail call <2 x float> @_Z3expDv2_f(<2 x float> [[ARG]]) #[[ATTR6]]
 ; CHECK-NEXT:    ret <2 x float> [[EXP]]
 ;
   %exp = tail call <2 x float> @_Z3expDv2_f(<2 x float> %arg) #0
@@ -358,7 +358,7 @@ define <2 x float> @test_exp_cr_v2f32_nobuiltins(<2 x float> %arg) #1 {
 define float @test_exp_f32_preserve_flags(float %arg) {
 ; CHECK-LABEL: define float @test_exp_f32_preserve_flags
 ; CHECK-SAME: (float [[ARG:%.*]]) {
-; CHECK-NEXT:    [[EXP:%.*]] = tail call nnan ninf float @_Z3expf(float [[ARG]]), !fpmath !0
+; CHECK-NEXT:    [[EXP:%.*]] = tail call nnan ninf float @llvm.exp.f32(float [[ARG]]), !fpmath !0
 ; CHECK-NEXT:    ret float [[EXP]]
 ;
   %exp = tail call nnan ninf float @_Z3expf(float %arg), !fpmath !0
@@ -368,7 +368,7 @@ define float @test_exp_f32_preserve_flags(float %arg) {
 define <2 x float> @test_exp_v2f32_preserve_flags(<2 x float> %arg) {
 ; CHECK-LABEL: define <2 x float> @test_exp_v2f32_preserve_flags
 ; CHECK-SAME: (<2 x float> [[ARG:%.*]]) {
-; CHECK-NEXT:    [[EXP:%.*]] = tail call nnan nsz contract <2 x float> @_Z3expDv2_f(<2 x float> [[ARG]]), !fpmath !0
+; CHECK-NEXT:    [[EXP:%.*]] = tail call nnan nsz contract <2 x float> @llvm.exp.v2f32(<2 x float> [[ARG]]), !fpmath !0
 ; CHECK-NEXT:    ret <2 x float> [[EXP]]
 ;
   %exp = tail call contract nsz nnan <2 x float> @_Z3expDv2_f(<2 x float> %arg), !fpmath !0
@@ -378,7 +378,7 @@ define <2 x float> @test_exp_v2f32_preserve_flags(<2 x float> %arg) {
 define float @test_exp_f32_preserve_flags_md(float %arg) {
 ; CHECK-LABEL: define float @test_exp_f32_preserve_flags_md
 ; CHECK-SAME: (float [[ARG:%.*]]) {
-; CHECK-NEXT:    [[EXP:%.*]] = tail call nnan ninf float @_Z3expf(float [[ARG]]), !fpmath !0, !foo !1
+; CHECK-NEXT:    [[EXP:%.*]] = tail call nnan ninf float @llvm.exp.f32(float [[ARG]]), !fpmath !0, !foo !1
 ; CHECK-NEXT:    ret float [[EXP]]
 ;
   %exp = tail call nnan ninf float @_Z3expf(float %arg), !fpmath !0, !foo !1
@@ -388,7 +388,7 @@ define float @test_exp_f32_preserve_flags_md(float %arg) {
 define <2 x float> @test_exp_v2f32_preserve_flags_md(<2 x float> %arg) {
 ; CHECK-LABEL: define <2 x float> @test_exp_v2f32_preserve_flags_md
 ; CHECK-SAME: (<2 x float> [[ARG:%.*]]) {
-; CHECK-NEXT:    [[EXP:%.*]] = tail call nnan nsz contract <2 x float> @_Z3expDv2_f(<2 x float> [[ARG]]), !fpmath !0, !foo !1
+; CHECK-NEXT:    [[EXP:%.*]] = tail call nnan nsz contract <2 x float> @llvm.exp.v2f32(<2 x float> [[ARG]]), !fpmath !0, !foo !1
 ; CHECK-NEXT:    ret <2 x float> [[EXP]]
 ;
   %exp = tail call contract nsz nnan <2 x float> @_Z3expDv2_f(<2 x float> %arg), !fpmath !0, !foo !1
@@ -398,7 +398,7 @@ define <2 x float> @test_exp_v2f32_preserve_flags_md(<2 x float> %arg) {
 define float @test_exp_cr_f32_preserve_flags(float %arg) {
 ; CHECK-LABEL: define float @test_exp_cr_f32_preserve_flags
 ; CHECK-SAME: (float [[ARG:%.*]]) {
-; CHECK-NEXT:    [[EXP:%.*]] = tail call ninf contract float @_Z3expf(float [[ARG]])
+; CHECK-NEXT:    [[EXP:%.*]] = tail call ninf contract float @llvm.exp.f32(float [[ARG]])
 ; CHECK-NEXT:    ret float [[EXP]]
 ;
   %exp = tail call ninf contract float @_Z3expf(float %arg)
@@ -408,7 +408,7 @@ define float @test_exp_cr_f32_preserve_flags(float %arg) {
 define <2 x float> @test_exp_cr_v2f32_preserve_flags(<2 x float> %arg) {
 ; CHECK-LABEL: define <2 x float> @test_exp_cr_v2f32_preserve_flags
 ; CHECK-SAME: (<2 x float> [[ARG:%.*]]) {
-; CHECK-NEXT:    [[EXP:%.*]] = tail call nnan nsz <2 x float> @_Z3expDv2_f(<2 x float> [[ARG]])
+; CHECK-NEXT:    [[EXP:%.*]] = tail call nnan nsz <2 x float> @llvm.exp.v2f32(<2 x float> [[ARG]])
 ; CHECK-NEXT:    ret <2 x float> [[EXP]]
 ;
   %exp = tail call nnan nsz <2 x float> @_Z3expDv2_f(<2 x float> %arg)
@@ -482,7 +482,7 @@ define double @test_libm_exp_f64_fpmath(double %arg) {
 define float @test_exp_f32_fast_noinline(float %arg) {
 ; CHECK-LABEL: define float @test_exp_f32_fast_noinline
 ; CHECK-SAME: (float [[ARG:%.*]]) {
-; CHECK-NEXT:    [[EXP:%.*]] = tail call fast float @_Z3expf(float [[ARG]]) #[[ATTR6:[0-9]+]], !fpmath !0
+; CHECK-NEXT:    [[EXP:%.*]] = tail call fast float @_Z3expf(float [[ARG]]) #[[ATTR7:[0-9]+]], !fpmath !0
 ; CHECK-NEXT:    ret float [[EXP]]
 ;
   %exp = tail call fast float @_Z3expf(float %arg) #3, !fpmath !0
@@ -492,7 +492,7 @@ define float @test_exp_f32_fast_noinline(float %arg) {
 define float @test_exp_f32_fast_optsize(float %arg) #4 {
 ; CHECK-LABEL: define float @test_exp_f32_fast_optsize
 ; CHECK-SAME: (float [[ARG:%.*]]) #[[ATTR2:[0-9]+]] {
-; CHECK-NEXT:    [[EXP:%.*]] = tail call fast float @_Z3expf(float [[ARG]]), !fpmath !0
+; CHECK-NEXT:    [[EXP:%.*]] = tail call fast float @llvm.exp.f32(float [[ARG]]), !fpmath !0
 ; CHECK-NEXT:    ret float [[EXP]]
 ;
   %exp = tail call fast float @_Z3expf(float %arg), !fpmath !0
@@ -502,7 +502,7 @@ define float @test_exp_f32_fast_optsize(float %arg) #4 {
 define float @test_exp_f32_fast_minsize(float %arg) #5 {
 ; CHECK-LABEL: define float @test_exp_f32_fast_minsize
 ; CHECK-SAME: (float [[ARG:%.*]]) #[[ATTR3:[0-9]+]] {
-; CHECK-NEXT:    [[EXP:%.*]] = tail call fast float @_Z3expf(float [[ARG]]), !fpmath !0
+; CHECK-NEXT:    [[EXP:%.*]] = tail call fast float @llvm.exp.f32(float [[ARG]]), !fpmath !0
 ; CHECK-NEXT:    ret float [[EXP]]
 ;
   %exp = tail call fast float @_Z3expf(float %arg), !fpmath !0
@@ -512,7 +512,7 @@ define float @test_exp_f32_fast_minsize(float %arg) #5 {
 define float @test_exp_f32_nsz_contract_optsize(float %arg) #4 {
 ; CHECK-LABEL: define float @test_exp_f32_nsz_contract_optsize
 ; CHECK-SAME: (float [[ARG:%.*]]) #[[ATTR2]] {
-; CHECK-NEXT:    [[EXP:%.*]] = tail call nsz contract float @_Z3expf(float [[ARG]]), !fpmath !0
+; CHECK-NEXT:    [[EXP:%.*]] = tail call nsz contract float @llvm.exp.f32(float [[ARG]]), !fpmath !0
 ; CHECK-NEXT:    ret float [[EXP]]
 ;
   %exp = tail call nsz contract float @_Z3expf(float %arg), !fpmath !0

diff  --git a/llvm/test/CodeGen/AMDGPU/amdgpu-simplify-libcall-exp2.ll b/llvm/test/CodeGen/AMDGPU/amdgpu-simplify-libcall-exp2.ll
index 80fac9c6f85e46..eddf5ff602dfb1 100644
--- a/llvm/test/CodeGen/AMDGPU/amdgpu-simplify-libcall-exp2.ll
+++ b/llvm/test/CodeGen/AMDGPU/amdgpu-simplify-libcall-exp2.ll
@@ -217,7 +217,7 @@ define half @test_exp2_f16(half %arg) {
 define half @test_exp2_f16_fast(half %arg) {
 ; CHECK-LABEL: define half @test_exp2_f16_fast
 ; CHECK-SAME: (half [[ARG:%.*]]) {
-; CHECK-NEXT:    [[EXP2:%.*]] = tail call fast half @_Z4exp2Dh(half [[ARG]])
+; CHECK-NEXT:    [[EXP2:%.*]] = tail call fast half @llvm.exp2.f16(half [[ARG]])
 ; CHECK-NEXT:    ret half [[EXP2]]
 ;
   %exp2 = tail call fast half @_Z4exp2Dh(half %arg)
@@ -277,7 +277,7 @@ define <16 x half> @test_exp2_v16f16(<16 x half> %arg) {
 define float @test_exp2_f32_nobuiltin_callsite(float %arg) {
 ; CHECK-LABEL: define float @test_exp2_f32_nobuiltin_callsite
 ; CHECK-SAME: (float [[ARG:%.*]]) {
-; CHECK-NEXT:    [[EXP2:%.*]] = tail call float @_Z4exp2f(float [[ARG]]) #[[ATTR5:[0-9]+]], !fpmath !0
+; CHECK-NEXT:    [[EXP2:%.*]] = tail call float @_Z4exp2f(float [[ARG]]) #[[ATTR6:[0-9]+]], !fpmath !0
 ; CHECK-NEXT:    ret float [[EXP2]]
 ;
   %exp2 = tail call float @_Z4exp2f(float %arg) #0, !fpmath !0
@@ -287,7 +287,7 @@ define float @test_exp2_f32_nobuiltin_callsite(float %arg) {
 define <2 x float> @test_exp2_v2f32_nobuiltin_callsite(<2 x float> %arg) {
 ; CHECK-LABEL: define <2 x float> @test_exp2_v2f32_nobuiltin_callsite
 ; CHECK-SAME: (<2 x float> [[ARG:%.*]]) {
-; CHECK-NEXT:    [[EXP2:%.*]] = tail call <2 x float> @_Z4exp2Dv2_f(<2 x float> [[ARG]]) #[[ATTR5]], !fpmath !0
+; CHECK-NEXT:    [[EXP2:%.*]] = tail call <2 x float> @_Z4exp2Dv2_f(<2 x float> [[ARG]]) #[[ATTR6]], !fpmath !0
 ; CHECK-NEXT:    ret <2 x float> [[EXP2]]
 ;
   %exp2 = tail call <2 x float> @_Z4exp2Dv2_f(<2 x float> %arg) #0, !fpmath !0
@@ -297,7 +297,7 @@ define <2 x float> @test_exp2_v2f32_nobuiltin_callsite(<2 x float> %arg) {
 define float @test_exp2_cr_f32_nobuiltin_callsite(float %arg) {
 ; CHECK-LABEL: define float @test_exp2_cr_f32_nobuiltin_callsite
 ; CHECK-SAME: (float [[ARG:%.*]]) {
-; CHECK-NEXT:    [[EXP2:%.*]] = tail call float @_Z4exp2f(float [[ARG]]) #[[ATTR5]]
+; CHECK-NEXT:    [[EXP2:%.*]] = tail call float @_Z4exp2f(float [[ARG]]) #[[ATTR6]]
 ; CHECK-NEXT:    ret float [[EXP2]]
 ;
   %exp2 = tail call float @_Z4exp2f(float %arg) #0
@@ -307,7 +307,7 @@ define float @test_exp2_cr_f32_nobuiltin_callsite(float %arg) {
 define <2 x float> @test_exp2_cr_v2f32_nobuiltin_callsite(<2 x float> %arg) {
 ; CHECK-LABEL: define <2 x float> @test_exp2_cr_v2f32_nobuiltin_callsite
 ; CHECK-SAME: (<2 x float> [[ARG:%.*]]) {
-; CHECK-NEXT:    [[EXP2:%.*]] = tail call <2 x float> @_Z4exp2Dv2_f(<2 x float> [[ARG]]) #[[ATTR5]]
+; CHECK-NEXT:    [[EXP2:%.*]] = tail call <2 x float> @_Z4exp2Dv2_f(<2 x float> [[ARG]]) #[[ATTR6]]
 ; CHECK-NEXT:    ret <2 x float> [[EXP2]]
 ;
   %exp2 = tail call <2 x float> @_Z4exp2Dv2_f(<2 x float> %arg) #0
@@ -318,7 +318,7 @@ define <2 x float> @test_exp2_cr_v2f32_nobuiltin_callsite(<2 x float> %arg) {
 define float @test_exp2_f32_nobuiltins(float %arg) #1 {
 ; CHECK-LABEL: define float @test_exp2_f32_nobuiltins
 ; CHECK-SAME: (float [[ARG:%.*]]) #[[ATTR0:[0-9]+]] {
-; CHECK-NEXT:    [[EXP2:%.*]] = tail call float @_Z4exp2f(float [[ARG]]) #[[ATTR5]], !fpmath !0
+; CHECK-NEXT:    [[EXP2:%.*]] = tail call float @_Z4exp2f(float [[ARG]]) #[[ATTR6]], !fpmath !0
 ; CHECK-NEXT:    ret float [[EXP2]]
 ;
   %exp2 = tail call float @_Z4exp2f(float %arg) #0, !fpmath !0
@@ -328,7 +328,7 @@ define float @test_exp2_f32_nobuiltins(float %arg) #1 {
 define <2 x float> @test_exp2_v2f32_nobuiltins(<2 x float> %arg) #1 {
 ; CHECK-LABEL: define <2 x float> @test_exp2_v2f32_nobuiltins
 ; CHECK-SAME: (<2 x float> [[ARG:%.*]]) #[[ATTR0]] {
-; CHECK-NEXT:    [[EXP2:%.*]] = tail call <2 x float> @_Z4exp2Dv2_f(<2 x float> [[ARG]]) #[[ATTR5]], !fpmath !0
+; CHECK-NEXT:    [[EXP2:%.*]] = tail call <2 x float> @_Z4exp2Dv2_f(<2 x float> [[ARG]]) #[[ATTR6]], !fpmath !0
 ; CHECK-NEXT:    ret <2 x float> [[EXP2]]
 ;
   %exp2 = tail call <2 x float> @_Z4exp2Dv2_f(<2 x float> %arg) #0, !fpmath !0
@@ -338,7 +338,7 @@ define <2 x float> @test_exp2_v2f32_nobuiltins(<2 x float> %arg) #1 {
 define float @test_exp2_cr_f32_nobuiltins(float %arg) #1 {
 ; CHECK-LABEL: define float @test_exp2_cr_f32_nobuiltins
 ; CHECK-SAME: (float [[ARG:%.*]]) #[[ATTR0]] {
-; CHECK-NEXT:    [[EXP2:%.*]] = tail call float @_Z4exp2f(float [[ARG]]) #[[ATTR5]]
+; CHECK-NEXT:    [[EXP2:%.*]] = tail call float @_Z4exp2f(float [[ARG]]) #[[ATTR6]]
 ; CHECK-NEXT:    ret float [[EXP2]]
 ;
   %exp2 = tail call float @_Z4exp2f(float %arg) #0
@@ -348,7 +348,7 @@ define float @test_exp2_cr_f32_nobuiltins(float %arg) #1 {
 define <2 x float> @test_exp2_cr_v2f32_nobuiltins(<2 x float> %arg) #1 {
 ; CHECK-LABEL: define <2 x float> @test_exp2_cr_v2f32_nobuiltins
 ; CHECK-SAME: (<2 x float> [[ARG:%.*]]) #[[ATTR0]] {
-; CHECK-NEXT:    [[EXP2:%.*]] = tail call <2 x float> @_Z4exp2Dv2_f(<2 x float> [[ARG]]) #[[ATTR5]]
+; CHECK-NEXT:    [[EXP2:%.*]] = tail call <2 x float> @_Z4exp2Dv2_f(<2 x float> [[ARG]]) #[[ATTR6]]
 ; CHECK-NEXT:    ret <2 x float> [[EXP2]]
 ;
   %exp2 = tail call <2 x float> @_Z4exp2Dv2_f(<2 x float> %arg) #0
@@ -358,7 +358,7 @@ define <2 x float> @test_exp2_cr_v2f32_nobuiltins(<2 x float> %arg) #1 {
 define float @test_exp2_f32_preserve_flags(float %arg) {
 ; CHECK-LABEL: define float @test_exp2_f32_preserve_flags
 ; CHECK-SAME: (float [[ARG:%.*]]) {
-; CHECK-NEXT:    [[EXP2:%.*]] = tail call nnan ninf float @_Z4exp2f(float [[ARG]]), !fpmath !0
+; CHECK-NEXT:    [[EXP2:%.*]] = tail call nnan ninf float @llvm.exp2.f32(float [[ARG]]), !fpmath !0
 ; CHECK-NEXT:    ret float [[EXP2]]
 ;
   %exp2 = tail call nnan ninf float @_Z4exp2f(float %arg), !fpmath !0
@@ -368,7 +368,7 @@ define float @test_exp2_f32_preserve_flags(float %arg) {
 define <2 x float> @test_exp2_v2f32_preserve_flags(<2 x float> %arg) {
 ; CHECK-LABEL: define <2 x float> @test_exp2_v2f32_preserve_flags
 ; CHECK-SAME: (<2 x float> [[ARG:%.*]]) {
-; CHECK-NEXT:    [[EXP2:%.*]] = tail call nnan nsz contract <2 x float> @_Z4exp2Dv2_f(<2 x float> [[ARG]]), !fpmath !0
+; CHECK-NEXT:    [[EXP2:%.*]] = tail call nnan nsz contract <2 x float> @llvm.exp2.v2f32(<2 x float> [[ARG]]), !fpmath !0
 ; CHECK-NEXT:    ret <2 x float> [[EXP2]]
 ;
   %exp2 = tail call contract nsz nnan <2 x float> @_Z4exp2Dv2_f(<2 x float> %arg), !fpmath !0
@@ -378,7 +378,7 @@ define <2 x float> @test_exp2_v2f32_preserve_flags(<2 x float> %arg) {
 define float @test_exp2_f32_preserve_flags_md(float %arg) {
 ; CHECK-LABEL: define float @test_exp2_f32_preserve_flags_md
 ; CHECK-SAME: (float [[ARG:%.*]]) {
-; CHECK-NEXT:    [[EXP2:%.*]] = tail call nnan ninf float @_Z4exp2f(float [[ARG]]), !fpmath !0, !foo !1
+; CHECK-NEXT:    [[EXP2:%.*]] = tail call nnan ninf float @llvm.exp2.f32(float [[ARG]]), !fpmath !0, !foo !1
 ; CHECK-NEXT:    ret float [[EXP2]]
 ;
   %exp2 = tail call nnan ninf float @_Z4exp2f(float %arg), !fpmath !0, !foo !1
@@ -388,7 +388,7 @@ define float @test_exp2_f32_preserve_flags_md(float %arg) {
 define <2 x float> @test_exp2_v2f32_preserve_flags_md(<2 x float> %arg) {
 ; CHECK-LABEL: define <2 x float> @test_exp2_v2f32_preserve_flags_md
 ; CHECK-SAME: (<2 x float> [[ARG:%.*]]) {
-; CHECK-NEXT:    [[EXP2:%.*]] = tail call nnan nsz contract <2 x float> @_Z4exp2Dv2_f(<2 x float> [[ARG]]), !fpmath !0, !foo !1
+; CHECK-NEXT:    [[EXP2:%.*]] = tail call nnan nsz contract <2 x float> @llvm.exp2.v2f32(<2 x float> [[ARG]]), !fpmath !0, !foo !1
 ; CHECK-NEXT:    ret <2 x float> [[EXP2]]
 ;
   %exp2 = tail call contract nsz nnan <2 x float> @_Z4exp2Dv2_f(<2 x float> %arg), !fpmath !0, !foo !1
@@ -398,7 +398,7 @@ define <2 x float> @test_exp2_v2f32_preserve_flags_md(<2 x float> %arg) {
 define float @test_exp2_cr_f32_preserve_flags(float %arg) {
 ; CHECK-LABEL: define float @test_exp2_cr_f32_preserve_flags
 ; CHECK-SAME: (float [[ARG:%.*]]) {
-; CHECK-NEXT:    [[EXP2:%.*]] = tail call ninf contract float @_Z4exp2f(float [[ARG]])
+; CHECK-NEXT:    [[EXP2:%.*]] = tail call ninf contract float @llvm.exp2.f32(float [[ARG]])
 ; CHECK-NEXT:    ret float [[EXP2]]
 ;
   %exp2 = tail call ninf contract float @_Z4exp2f(float %arg)
@@ -408,7 +408,7 @@ define float @test_exp2_cr_f32_preserve_flags(float %arg) {
 define <2 x float> @test_exp2_cr_v2f32_preserve_flags(<2 x float> %arg) {
 ; CHECK-LABEL: define <2 x float> @test_exp2_cr_v2f32_preserve_flags
 ; CHECK-SAME: (<2 x float> [[ARG:%.*]]) {
-; CHECK-NEXT:    [[EXP2:%.*]] = tail call nnan nsz <2 x float> @_Z4exp2Dv2_f(<2 x float> [[ARG]])
+; CHECK-NEXT:    [[EXP2:%.*]] = tail call nnan nsz <2 x float> @llvm.exp2.v2f32(<2 x float> [[ARG]])
 ; CHECK-NEXT:    ret <2 x float> [[EXP2]]
 ;
   %exp2 = tail call nnan nsz <2 x float> @_Z4exp2Dv2_f(<2 x float> %arg)
@@ -482,7 +482,7 @@ define double @test_libm_exp2_f64_fpmath(double %arg) {
 define float @test_exp2_f32_fast_noinline(float %arg) {
 ; CHECK-LABEL: define float @test_exp2_f32_fast_noinline
 ; CHECK-SAME: (float [[ARG:%.*]]) {
-; CHECK-NEXT:    [[EXP2:%.*]] = tail call fast float @_Z4exp2f(float [[ARG]]) #[[ATTR6:[0-9]+]], !fpmath !0
+; CHECK-NEXT:    [[EXP2:%.*]] = tail call fast float @_Z4exp2f(float [[ARG]]) #[[ATTR7:[0-9]+]], !fpmath !0
 ; CHECK-NEXT:    ret float [[EXP2]]
 ;
   %exp2 = tail call fast float @_Z4exp2f(float %arg) #3, !fpmath !0
@@ -492,7 +492,7 @@ define float @test_exp2_f32_fast_noinline(float %arg) {
 define float @test_exp2_f32_fast_optsize(float %arg) #4 {
 ; CHECK-LABEL: define float @test_exp2_f32_fast_optsize
 ; CHECK-SAME: (float [[ARG:%.*]]) #[[ATTR2:[0-9]+]] {
-; CHECK-NEXT:    [[EXP2:%.*]] = tail call fast float @_Z4exp2f(float [[ARG]]), !fpmath !0
+; CHECK-NEXT:    [[EXP2:%.*]] = tail call fast float @llvm.exp2.f32(float [[ARG]]), !fpmath !0
 ; CHECK-NEXT:    ret float [[EXP2]]
 ;
   %exp2 = tail call fast float @_Z4exp2f(float %arg), !fpmath !0
@@ -502,7 +502,7 @@ define float @test_exp2_f32_fast_optsize(float %arg) #4 {
 define float @test_exp2_f32_fast_minsize(float %arg) #5 {
 ; CHECK-LABEL: define float @test_exp2_f32_fast_minsize
 ; CHECK-SAME: (float [[ARG:%.*]]) #[[ATTR3:[0-9]+]] {
-; CHECK-NEXT:    [[EXP2:%.*]] = tail call fast float @_Z4exp2f(float [[ARG]]), !fpmath !0
+; CHECK-NEXT:    [[EXP2:%.*]] = tail call fast float @llvm.exp2.f32(float [[ARG]]), !fpmath !0
 ; CHECK-NEXT:    ret float [[EXP2]]
 ;
   %exp2 = tail call fast float @_Z4exp2f(float %arg), !fpmath !0
@@ -512,7 +512,7 @@ define float @test_exp2_f32_fast_minsize(float %arg) #5 {
 define float @test_exp2_f32_nsz_contract_optsize(float %arg) #4 {
 ; CHECK-LABEL: define float @test_exp2_f32_nsz_contract_optsize
 ; CHECK-SAME: (float [[ARG:%.*]]) #[[ATTR2]] {
-; CHECK-NEXT:    [[EXP2:%.*]] = tail call nsz contract float @_Z4exp2f(float [[ARG]]), !fpmath !0
+; CHECK-NEXT:    [[EXP2:%.*]] = tail call nsz contract float @llvm.exp2.f32(float [[ARG]]), !fpmath !0
 ; CHECK-NEXT:    ret float [[EXP2]]
 ;
   %exp2 = tail call nsz contract float @_Z4exp2f(float %arg), !fpmath !0
@@ -532,7 +532,7 @@ define float @test_exp2_f32_nsz_contract_minsize(float %arg) #5 {
 define half @test_exp2_f16_fast_minsize(half %arg) #5 {
 ; CHECK-LABEL: define half @test_exp2_f16_fast_minsize
 ; CHECK-SAME: (half [[ARG:%.*]]) #[[ATTR3]] {
-; CHECK-NEXT:    [[EXP2:%.*]] = tail call fast half @_Z4exp2Dh(half [[ARG]])
+; CHECK-NEXT:    [[EXP2:%.*]] = tail call fast half @llvm.exp2.f16(half [[ARG]])
 ; CHECK-NEXT:    ret half [[EXP2]]
 ;
   %exp2 = tail call fast half @_Z4exp2Dh(half %arg)

diff  --git a/llvm/test/CodeGen/AMDGPU/amdgpu-simplify-libcall-fma.ll b/llvm/test/CodeGen/AMDGPU/amdgpu-simplify-libcall-fma.ll
index cda3a260436b02..cc068ac5c443b8 100644
--- a/llvm/test/CodeGen/AMDGPU/amdgpu-simplify-libcall-fma.ll
+++ b/llvm/test/CodeGen/AMDGPU/amdgpu-simplify-libcall-fma.ll
@@ -25,7 +25,7 @@ declare <16 x half> @_Z3fmaDv16_DhS_S_(<16 x half>, <16 x half>, <16 x half>)
 define float @test_fma_f32(float %x, float %y, float %z) {
 ; CHECK-LABEL: define float @test_fma_f32
 ; CHECK-SAME: (float [[X:%.*]], float [[Y:%.*]], float [[Z:%.*]]) {
-; CHECK-NEXT:    [[FMA:%.*]] = tail call float @_Z3fmafff(float [[X]], float [[Y]], float [[Z]])
+; CHECK-NEXT:    [[FMA:%.*]] = tail call float @llvm.fma.f32(float [[X]], float [[Y]], float [[Z]])
 ; CHECK-NEXT:    ret float [[FMA]]
 ;
   %fma = tail call float @_Z3fmafff(float %x, float %y, float %z)
@@ -35,7 +35,7 @@ define float @test_fma_f32(float %x, float %y, float %z) {
 define <2 x float> @test_fma_v2f32(<2 x float> %x, <2 x float> %y, <2 x float> %z) {
 ; CHECK-LABEL: define <2 x float> @test_fma_v2f32
 ; CHECK-SAME: (<2 x float> [[X:%.*]], <2 x float> [[Y:%.*]], <2 x float> [[Z:%.*]]) {
-; CHECK-NEXT:    [[FMA:%.*]] = tail call <2 x float> @_Z3fmaDv2_fS_S_(<2 x float> [[X]], <2 x float> [[Y]], <2 x float> [[Z]])
+; CHECK-NEXT:    [[FMA:%.*]] = tail call <2 x float> @llvm.fma.v2f32(<2 x float> [[X]], <2 x float> [[Y]], <2 x float> [[Z]])
 ; CHECK-NEXT:    ret <2 x float> [[FMA]]
 ;
   %fma = tail call <2 x float> @_Z3fmaDv2_fS_S_(<2 x float> %x, <2 x float> %y, <2 x float> %z)
@@ -45,7 +45,7 @@ define <2 x float> @test_fma_v2f32(<2 x float> %x, <2 x float> %y, <2 x float> %
 define <3 x float> @test_fma_v3f32(<3 x float> %x, <3 x float> %y, <3 x float> %z) {
 ; CHECK-LABEL: define <3 x float> @test_fma_v3f32
 ; CHECK-SAME: (<3 x float> [[X:%.*]], <3 x float> [[Y:%.*]], <3 x float> [[Z:%.*]]) {
-; CHECK-NEXT:    [[FMA:%.*]] = tail call <3 x float> @_Z3fmaDv3_fS_S_(<3 x float> [[X]], <3 x float> [[Y]], <3 x float> [[Z]])
+; CHECK-NEXT:    [[FMA:%.*]] = tail call <3 x float> @llvm.fma.v3f32(<3 x float> [[X]], <3 x float> [[Y]], <3 x float> [[Z]])
 ; CHECK-NEXT:    ret <3 x float> [[FMA]]
 ;
   %fma = tail call <3 x float> @_Z3fmaDv3_fS_S_(<3 x float> %x, <3 x float> %y, <3 x float> %z)
@@ -55,7 +55,7 @@ define <3 x float> @test_fma_v3f32(<3 x float> %x, <3 x float> %y, <3 x float> %
 define <4 x float> @test_fma_v4f32(<4 x float> %x, <4 x float> %y, <4 x float> %z) {
 ; CHECK-LABEL: define <4 x float> @test_fma_v4f32
 ; CHECK-SAME: (<4 x float> [[X:%.*]], <4 x float> [[Y:%.*]], <4 x float> [[Z:%.*]]) {
-; CHECK-NEXT:    [[FMA:%.*]] = tail call <4 x float> @_Z3fmaDv4_fS_S_(<4 x float> [[X]], <4 x float> [[Y]], <4 x float> [[Z]])
+; CHECK-NEXT:    [[FMA:%.*]] = tail call <4 x float> @llvm.fma.v4f32(<4 x float> [[X]], <4 x float> [[Y]], <4 x float> [[Z]])
 ; CHECK-NEXT:    ret <4 x float> [[FMA]]
 ;
   %fma = tail call <4 x float> @_Z3fmaDv4_fS_S_(<4 x float> %x, <4 x float> %y, <4 x float> %z)
@@ -65,7 +65,7 @@ define <4 x float> @test_fma_v4f32(<4 x float> %x, <4 x float> %y, <4 x float> %
 define <8 x float> @test_fma_v8f32(<8 x float> %x, <8 x float> %y, <8 x float> %z) {
 ; CHECK-LABEL: define <8 x float> @test_fma_v8f32
 ; CHECK-SAME: (<8 x float> [[X:%.*]], <8 x float> [[Y:%.*]], <8 x float> [[Z:%.*]]) {
-; CHECK-NEXT:    [[FMA:%.*]] = tail call <8 x float> @_Z3fmaDv8_fS_S_(<8 x float> [[X]], <8 x float> [[Y]], <8 x float> [[Z]])
+; CHECK-NEXT:    [[FMA:%.*]] = tail call <8 x float> @llvm.fma.v8f32(<8 x float> [[X]], <8 x float> [[Y]], <8 x float> [[Z]])
 ; CHECK-NEXT:    ret <8 x float> [[FMA]]
 ;
   %fma = tail call <8 x float> @_Z3fmaDv8_fS_S_(<8 x float> %x, <8 x float> %y, <8 x float> %z)
@@ -75,7 +75,7 @@ define <8 x float> @test_fma_v8f32(<8 x float> %x, <8 x float> %y, <8 x float> %
 define <16 x float> @test_fma_v16f32(<16 x float> %x, <16 x float> %y, <16 x float> %z) {
 ; CHECK-LABEL: define <16 x float> @test_fma_v16f32
 ; CHECK-SAME: (<16 x float> [[X:%.*]], <16 x float> [[Y:%.*]], <16 x float> [[Z:%.*]]) {
-; CHECK-NEXT:    [[FMA:%.*]] = tail call <16 x float> @_Z3fmaDv16_fS_S_(<16 x float> [[X]], <16 x float> [[Y]], <16 x float> [[Z]])
+; CHECK-NEXT:    [[FMA:%.*]] = tail call <16 x float> @llvm.fma.v16f32(<16 x float> [[X]], <16 x float> [[Y]], <16 x float> [[Z]])
 ; CHECK-NEXT:    ret <16 x float> [[FMA]]
 ;
   %fma = tail call <16 x float> @_Z3fmaDv16_fS_S_(<16 x float> %x, <16 x float> %y, <16 x float> %z)
@@ -85,7 +85,7 @@ define <16 x float> @test_fma_v16f32(<16 x float> %x, <16 x float> %y, <16 x flo
 define double @test_fma_f64(double %x, double %y, double %z) {
 ; CHECK-LABEL: define double @test_fma_f64
 ; CHECK-SAME: (double [[X:%.*]], double [[Y:%.*]], double [[Z:%.*]]) {
-; CHECK-NEXT:    [[FMA:%.*]] = tail call double @_Z3fmaddd(double [[X]], double [[Y]], double [[Z]])
+; CHECK-NEXT:    [[FMA:%.*]] = tail call double @llvm.fma.f64(double [[X]], double [[Y]], double [[Z]])
 ; CHECK-NEXT:    ret double [[FMA]]
 ;
   %fma = tail call double @_Z3fmaddd(double %x, double %y, double %z)
@@ -95,7 +95,7 @@ define double @test_fma_f64(double %x, double %y, double %z) {
 define <2 x double> @test_fma_v2f64(<2 x double> %x, <2 x double> %y, <2 x double> %z) {
 ; CHECK-LABEL: define <2 x double> @test_fma_v2f64
 ; CHECK-SAME: (<2 x double> [[X:%.*]], <2 x double> [[Y:%.*]], <2 x double> [[Z:%.*]]) {
-; CHECK-NEXT:    [[FMA:%.*]] = tail call <2 x double> @_Z3fmaDv2_dS_S_(<2 x double> [[X]], <2 x double> [[Y]], <2 x double> [[Z]])
+; CHECK-NEXT:    [[FMA:%.*]] = tail call <2 x double> @llvm.fma.v2f64(<2 x double> [[X]], <2 x double> [[Y]], <2 x double> [[Z]])
 ; CHECK-NEXT:    ret <2 x double> [[FMA]]
 ;
   %fma = tail call <2 x double> @_Z3fmaDv2_dS_S_(<2 x double> %x, <2 x double> %y, <2 x double> %z)
@@ -105,7 +105,7 @@ define <2 x double> @test_fma_v2f64(<2 x double> %x, <2 x double> %y, <2 x doubl
 define <3 x double> @test_fma_v3f64(<3 x double> %x, <3 x double> %y, <3 x double> %z) {
 ; CHECK-LABEL: define <3 x double> @test_fma_v3f64
 ; CHECK-SAME: (<3 x double> [[X:%.*]], <3 x double> [[Y:%.*]], <3 x double> [[Z:%.*]]) {
-; CHECK-NEXT:    [[FMA:%.*]] = tail call <3 x double> @_Z3fmaDv3_dS_S_(<3 x double> [[X]], <3 x double> [[Y]], <3 x double> [[Z]])
+; CHECK-NEXT:    [[FMA:%.*]] = tail call <3 x double> @llvm.fma.v3f64(<3 x double> [[X]], <3 x double> [[Y]], <3 x double> [[Z]])
 ; CHECK-NEXT:    ret <3 x double> [[FMA]]
 ;
   %fma = tail call <3 x double> @_Z3fmaDv3_dS_S_(<3 x double> %x, <3 x double> %y, <3 x double> %z)
@@ -115,7 +115,7 @@ define <3 x double> @test_fma_v3f64(<3 x double> %x, <3 x double> %y, <3 x doubl
 define <4 x double> @test_fma_v4f64(<4 x double> %x, <4 x double> %y, <4 x double> %z) {
 ; CHECK-LABEL: define <4 x double> @test_fma_v4f64
 ; CHECK-SAME: (<4 x double> [[X:%.*]], <4 x double> [[Y:%.*]], <4 x double> [[Z:%.*]]) {
-; CHECK-NEXT:    [[FMA:%.*]] = tail call <4 x double> @_Z3fmaDv4_dS_S_(<4 x double> [[X]], <4 x double> [[Y]], <4 x double> [[Z]])
+; CHECK-NEXT:    [[FMA:%.*]] = tail call <4 x double> @llvm.fma.v4f64(<4 x double> [[X]], <4 x double> [[Y]], <4 x double> [[Z]])
 ; CHECK-NEXT:    ret <4 x double> [[FMA]]
 ;
   %fma = tail call <4 x double> @_Z3fmaDv4_dS_S_(<4 x double> %x, <4 x double> %y, <4 x double> %z)
@@ -125,7 +125,7 @@ define <4 x double> @test_fma_v4f64(<4 x double> %x, <4 x double> %y, <4 x doubl
 define <8 x double> @test_fma_v8f64(<8 x double> %x, <8 x double> %y, <8 x double> %z) {
 ; CHECK-LABEL: define <8 x double> @test_fma_v8f64
 ; CHECK-SAME: (<8 x double> [[X:%.*]], <8 x double> [[Y:%.*]], <8 x double> [[Z:%.*]]) {
-; CHECK-NEXT:    [[FMA:%.*]] = tail call <8 x double> @_Z3fmaDv8_dS_S_(<8 x double> [[X]], <8 x double> [[Y]], <8 x double> [[Z]])
+; CHECK-NEXT:    [[FMA:%.*]] = tail call <8 x double> @llvm.fma.v8f64(<8 x double> [[X]], <8 x double> [[Y]], <8 x double> [[Z]])
 ; CHECK-NEXT:    ret <8 x double> [[FMA]]
 ;
   %fma = tail call <8 x double> @_Z3fmaDv8_dS_S_(<8 x double> %x, <8 x double> %y, <8 x double> %z)
@@ -135,7 +135,7 @@ define <8 x double> @test_fma_v8f64(<8 x double> %x, <8 x double> %y, <8 x doubl
 define <16 x double> @test_fma_v16f64(<16 x double> %x, <16 x double> %y, <16 x double> %z) {
 ; CHECK-LABEL: define <16 x double> @test_fma_v16f64
 ; CHECK-SAME: (<16 x double> [[X:%.*]], <16 x double> [[Y:%.*]], <16 x double> [[Z:%.*]]) {
-; CHECK-NEXT:    [[FMA:%.*]] = tail call <16 x double> @_Z3fmaDv16_dS_S_(<16 x double> [[X]], <16 x double> [[Y]], <16 x double> [[Z]])
+; CHECK-NEXT:    [[FMA:%.*]] = tail call <16 x double> @llvm.fma.v16f64(<16 x double> [[X]], <16 x double> [[Y]], <16 x double> [[Z]])
 ; CHECK-NEXT:    ret <16 x double> [[FMA]]
 ;
   %fma = tail call <16 x double> @_Z3fmaDv16_dS_S_(<16 x double> %x, <16 x double> %y, <16 x double> %z)
@@ -145,7 +145,7 @@ define <16 x double> @test_fma_v16f64(<16 x double> %x, <16 x double> %y, <16 x
 define half @test_fma_f16(half %x, half %y, half %z) {
 ; CHECK-LABEL: define half @test_fma_f16
 ; CHECK-SAME: (half [[X:%.*]], half [[Y:%.*]], half [[Z:%.*]]) {
-; CHECK-NEXT:    [[FMA:%.*]] = tail call half @_Z3fmaDhDhDh(half [[X]], half [[Y]], half [[Z]])
+; CHECK-NEXT:    [[FMA:%.*]] = tail call half @llvm.fma.f16(half [[X]], half [[Y]], half [[Z]])
 ; CHECK-NEXT:    ret half [[FMA]]
 ;
   %fma = tail call half @_Z3fmaDhDhDh(half %x, half %y, half %z)
@@ -155,7 +155,7 @@ define half @test_fma_f16(half %x, half %y, half %z) {
 define <2 x half> @test_fma_v2f16(<2 x half> %x, <2 x half> %y, <2 x half> %z) {
 ; CHECK-LABEL: define <2 x half> @test_fma_v2f16
 ; CHECK-SAME: (<2 x half> [[X:%.*]], <2 x half> [[Y:%.*]], <2 x half> [[Z:%.*]]) {
-; CHECK-NEXT:    [[FMA:%.*]] = tail call <2 x half> @_Z3fmaDv2_DhS_S_(<2 x half> [[X]], <2 x half> [[Y]], <2 x half> [[Z]])
+; CHECK-NEXT:    [[FMA:%.*]] = tail call <2 x half> @llvm.fma.v2f16(<2 x half> [[X]], <2 x half> [[Y]], <2 x half> [[Z]])
 ; CHECK-NEXT:    ret <2 x half> [[FMA]]
 ;
   %fma = tail call <2 x half> @_Z3fmaDv2_DhS_S_(<2 x half> %x, <2 x half> %y, <2 x half> %z)
@@ -165,7 +165,7 @@ define <2 x half> @test_fma_v2f16(<2 x half> %x, <2 x half> %y, <2 x half> %z) {
 define <3 x half> @test_fma_v3f16(<3 x half> %x, <3 x half> %y, <3 x half> %z) {
 ; CHECK-LABEL: define <3 x half> @test_fma_v3f16
 ; CHECK-SAME: (<3 x half> [[X:%.*]], <3 x half> [[Y:%.*]], <3 x half> [[Z:%.*]]) {
-; CHECK-NEXT:    [[FMA:%.*]] = tail call <3 x half> @_Z3fmaDv3_DhS_S_(<3 x half> [[X]], <3 x half> [[Y]], <3 x half> [[Z]])
+; CHECK-NEXT:    [[FMA:%.*]] = tail call <3 x half> @llvm.fma.v3f16(<3 x half> [[X]], <3 x half> [[Y]], <3 x half> [[Z]])
 ; CHECK-NEXT:    ret <3 x half> [[FMA]]
 ;
   %fma = tail call <3 x half> @_Z3fmaDv3_DhS_S_(<3 x half> %x, <3 x half> %y, <3 x half> %z)
@@ -175,7 +175,7 @@ define <3 x half> @test_fma_v3f16(<3 x half> %x, <3 x half> %y, <3 x half> %z) {
 define <4 x half> @test_fma_v4f16(<4 x half> %x, <4 x half> %y, <4 x half> %z) {
 ; CHECK-LABEL: define <4 x half> @test_fma_v4f16
 ; CHECK-SAME: (<4 x half> [[X:%.*]], <4 x half> [[Y:%.*]], <4 x half> [[Z:%.*]]) {
-; CHECK-NEXT:    [[FMA:%.*]] = tail call <4 x half> @_Z3fmaDv4_DhS_S_(<4 x half> [[X]], <4 x half> [[Y]], <4 x half> [[Z]])
+; CHECK-NEXT:    [[FMA:%.*]] = tail call <4 x half> @llvm.fma.v4f16(<4 x half> [[X]], <4 x half> [[Y]], <4 x half> [[Z]])
 ; CHECK-NEXT:    ret <4 x half> [[FMA]]
 ;
   %fma = tail call <4 x half> @_Z3fmaDv4_DhS_S_(<4 x half> %x, <4 x half> %y, <4 x half> %z)
@@ -185,7 +185,7 @@ define <4 x half> @test_fma_v4f16(<4 x half> %x, <4 x half> %y, <4 x half> %z) {
 define <8 x half> @test_fma_v8f16(<8 x half> %x, <8 x half> %y, <8 x half> %z) {
 ; CHECK-LABEL: define <8 x half> @test_fma_v8f16
 ; CHECK-SAME: (<8 x half> [[X:%.*]], <8 x half> [[Y:%.*]], <8 x half> [[Z:%.*]]) {
-; CHECK-NEXT:    [[FMA:%.*]] = tail call <8 x half> @_Z3fmaDv8_DhS_S_(<8 x half> [[X]], <8 x half> [[Y]], <8 x half> [[Z]])
+; CHECK-NEXT:    [[FMA:%.*]] = tail call <8 x half> @llvm.fma.v8f16(<8 x half> [[X]], <8 x half> [[Y]], <8 x half> [[Z]])
 ; CHECK-NEXT:    ret <8 x half> [[FMA]]
 ;
   %fma = tail call <8 x half> @_Z3fmaDv8_DhS_S_(<8 x half> %x, <8 x half> %y, <8 x half> %z)
@@ -195,7 +195,7 @@ define <8 x half> @test_fma_v8f16(<8 x half> %x, <8 x half> %y, <8 x half> %z) {
 define <16 x half> @test_fma_v16f16(<16 x half> %x, <16 x half> %y, <16 x half> %z) {
 ; CHECK-LABEL: define <16 x half> @test_fma_v16f16
 ; CHECK-SAME: (<16 x half> [[X:%.*]], <16 x half> [[Y:%.*]], <16 x half> [[Z:%.*]]) {
-; CHECK-NEXT:    [[FMA:%.*]] = tail call <16 x half> @_Z3fmaDv16_DhS_S_(<16 x half> [[X]], <16 x half> [[Y]], <16 x half> [[Z]])
+; CHECK-NEXT:    [[FMA:%.*]] = tail call <16 x half> @llvm.fma.v16f16(<16 x half> [[X]], <16 x half> [[Y]], <16 x half> [[Z]])
 ; CHECK-NEXT:    ret <16 x half> [[FMA]]
 ;
   %fma = tail call <16 x half> @_Z3fmaDv16_DhS_S_(<16 x half> %x, <16 x half> %y, <16 x half> %z)
@@ -205,7 +205,7 @@ define <16 x half> @test_fma_v16f16(<16 x half> %x, <16 x half> %y, <16 x half>
 define float @test_fma_f32_fast(float %x, float %y, float %z) {
 ; CHECK-LABEL: define float @test_fma_f32_fast
 ; CHECK-SAME: (float [[X:%.*]], float [[Y:%.*]], float [[Z:%.*]]) {
-; CHECK-NEXT:    [[FMA:%.*]] = tail call fast float @_Z3fmafff(float [[X]], float [[Y]], float [[Z]])
+; CHECK-NEXT:    [[FMA:%.*]] = tail call fast float @llvm.fma.f32(float [[X]], float [[Y]], float [[Z]])
 ; CHECK-NEXT:    ret float [[FMA]]
 ;
   %fma = tail call fast float @_Z3fmafff(float %x, float %y, float %z)
@@ -215,7 +215,7 @@ define float @test_fma_f32_fast(float %x, float %y, float %z) {
 define float @test_fma_f32_noinline(float %x, float %y, float %z) {
 ; CHECK-LABEL: define float @test_fma_f32_noinline
 ; CHECK-SAME: (float [[X:%.*]], float [[Y:%.*]], float [[Z:%.*]]) {
-; CHECK-NEXT:    [[FMA:%.*]] = tail call fast float @_Z3fmafff(float [[X]], float [[Y]], float [[Z]]) #[[ATTR2:[0-9]+]]
+; CHECK-NEXT:    [[FMA:%.*]] = tail call fast float @_Z3fmafff(float [[X]], float [[Y]], float [[Z]]) #[[ATTR3:[0-9]+]]
 ; CHECK-NEXT:    ret float [[FMA]]
 ;
   %fma = tail call fast float @_Z3fmafff(float %x, float %y, float %z) #1
@@ -225,7 +225,7 @@ define float @test_fma_f32_noinline(float %x, float %y, float %z) {
 define float @test_fma_f32_fast_minsize(float %x, float %y, float %z) #0 {
 ; CHECK-LABEL: define float @test_fma_f32_fast_minsize
 ; CHECK-SAME: (float [[X:%.*]], float [[Y:%.*]], float [[Z:%.*]]) #[[ATTR0:[0-9]+]] {
-; CHECK-NEXT:    [[FMA:%.*]] = tail call fast float @_Z3fmafff(float [[X]], float [[Y]], float [[Z]])
+; CHECK-NEXT:    [[FMA:%.*]] = tail call fast float @llvm.fma.f32(float [[X]], float [[Y]], float [[Z]])
 ; CHECK-NEXT:    ret float [[FMA]]
 ;
   %fma = tail call fast float @_Z3fmafff(float %x, float %y, float %z)
@@ -245,7 +245,7 @@ define float @test_fma_f32_fast_strictfp(float %x, float %y, float %z) #2 {
 define float @test_fma_f32_fast_nobuiltin(float %x, float %y, float %z) {
 ; CHECK-LABEL: define float @test_fma_f32_fast_nobuiltin
 ; CHECK-SAME: (float [[X:%.*]], float [[Y:%.*]], float [[Z:%.*]]) {
-; CHECK-NEXT:    [[FMA:%.*]] = tail call fast float @_Z3fmafff(float [[X]], float [[Y]], float [[Z]]) #[[ATTR3:[0-9]+]]
+; CHECK-NEXT:    [[FMA:%.*]] = tail call fast float @_Z3fmafff(float [[X]], float [[Y]], float [[Z]]) #[[ATTR4:[0-9]+]]
 ; CHECK-NEXT:    ret float [[FMA]]
 ;
   %fma = tail call fast float @_Z3fmafff(float %x, float %y, float %z) #3

diff  --git a/llvm/test/CodeGen/AMDGPU/amdgpu-simplify-libcall-fmax.ll b/llvm/test/CodeGen/AMDGPU/amdgpu-simplify-libcall-fmax.ll
index 33d90ca87db187..153f6080702849 100644
--- a/llvm/test/CodeGen/AMDGPU/amdgpu-simplify-libcall-fmax.ll
+++ b/llvm/test/CodeGen/AMDGPU/amdgpu-simplify-libcall-fmax.ll
@@ -25,7 +25,7 @@ declare <16 x half> @_Z4fmaxDv16_DhS_(<16 x half>, <16 x half>)
 define float @test_fmax_f32(float %x, float %y) {
 ; CHECK-LABEL: define float @test_fmax_f32
 ; CHECK-SAME: (float [[X:%.*]], float [[Y:%.*]]) {
-; CHECK-NEXT:    [[FMAX:%.*]] = tail call float @_Z4fmaxff(float [[X]], float [[Y]])
+; CHECK-NEXT:    [[FMAX:%.*]] = tail call float @llvm.maxnum.f32(float [[X]], float [[Y]])
 ; CHECK-NEXT:    ret float [[FMAX]]
 ;
   %fmax = tail call float @_Z4fmaxff(float %x, float %y)
@@ -35,7 +35,7 @@ define float @test_fmax_f32(float %x, float %y) {
 define float @test_fmax_f32_nnan(float %x, float %y) {
 ; CHECK-LABEL: define float @test_fmax_f32_nnan
 ; CHECK-SAME: (float [[X:%.*]], float [[Y:%.*]]) {
-; CHECK-NEXT:    [[FMAX:%.*]] = tail call nnan float @_Z4fmaxff(float [[X]], float [[Y]])
+; CHECK-NEXT:    [[FMAX:%.*]] = tail call nnan float @llvm.maxnum.f32(float [[X]], float [[Y]])
 ; CHECK-NEXT:    ret float [[FMAX]]
 ;
   %fmax = tail call nnan float @_Z4fmaxff(float %x, float %y)
@@ -45,7 +45,7 @@ define float @test_fmax_f32_nnan(float %x, float %y) {
 define <2 x float> @test_fmax_v2f32(<2 x float> %x, <2 x float> %y) {
 ; CHECK-LABEL: define <2 x float> @test_fmax_v2f32
 ; CHECK-SAME: (<2 x float> [[X:%.*]], <2 x float> [[Y:%.*]]) {
-; CHECK-NEXT:    [[FMAX:%.*]] = tail call <2 x float> @_Z4fmaxDv2_fS_(<2 x float> [[X]], <2 x float> [[Y]])
+; CHECK-NEXT:    [[FMAX:%.*]] = tail call <2 x float> @llvm.maxnum.v2f32(<2 x float> [[X]], <2 x float> [[Y]])
 ; CHECK-NEXT:    ret <2 x float> [[FMAX]]
 ;
   %fmax = tail call <2 x float> @_Z4fmaxDv2_fS_(<2 x float> %x, <2 x float> %y)
@@ -55,7 +55,7 @@ define <2 x float> @test_fmax_v2f32(<2 x float> %x, <2 x float> %y) {
 define <3 x float> @test_fmax_v3f32(<3 x float> %x, <3 x float> %y) {
 ; CHECK-LABEL: define <3 x float> @test_fmax_v3f32
 ; CHECK-SAME: (<3 x float> [[X:%.*]], <3 x float> [[Y:%.*]]) {
-; CHECK-NEXT:    [[FMAX:%.*]] = tail call <3 x float> @_Z4fmaxDv3_fS_(<3 x float> [[X]], <3 x float> [[Y]])
+; CHECK-NEXT:    [[FMAX:%.*]] = tail call <3 x float> @llvm.maxnum.v3f32(<3 x float> [[X]], <3 x float> [[Y]])
 ; CHECK-NEXT:    ret <3 x float> [[FMAX]]
 ;
   %fmax = tail call <3 x float> @_Z4fmaxDv3_fS_(<3 x float> %x, <3 x float> %y)
@@ -65,7 +65,7 @@ define <3 x float> @test_fmax_v3f32(<3 x float> %x, <3 x float> %y) {
 define <4 x float> @test_fmax_v4f32(<4 x float> %x, <4 x float> %y) {
 ; CHECK-LABEL: define <4 x float> @test_fmax_v4f32
 ; CHECK-SAME: (<4 x float> [[X:%.*]], <4 x float> [[Y:%.*]]) {
-; CHECK-NEXT:    [[FMAX:%.*]] = tail call <4 x float> @_Z4fmaxDv4_fS_(<4 x float> [[X]], <4 x float> [[Y]])
+; CHECK-NEXT:    [[FMAX:%.*]] = tail call <4 x float> @llvm.maxnum.v4f32(<4 x float> [[X]], <4 x float> [[Y]])
 ; CHECK-NEXT:    ret <4 x float> [[FMAX]]
 ;
   %fmax = tail call <4 x float> @_Z4fmaxDv4_fS_(<4 x float> %x, <4 x float> %y)
@@ -75,7 +75,7 @@ define <4 x float> @test_fmax_v4f32(<4 x float> %x, <4 x float> %y) {
 define <8 x float> @test_fmax_v8f32(<8 x float> %x, <8 x float> %y) {
 ; CHECK-LABEL: define <8 x float> @test_fmax_v8f32
 ; CHECK-SAME: (<8 x float> [[X:%.*]], <8 x float> [[Y:%.*]]) {
-; CHECK-NEXT:    [[FMAX:%.*]] = tail call <8 x float> @_Z4fmaxDv8_fS_(<8 x float> [[X]], <8 x float> [[Y]])
+; CHECK-NEXT:    [[FMAX:%.*]] = tail call <8 x float> @llvm.maxnum.v8f32(<8 x float> [[X]], <8 x float> [[Y]])
 ; CHECK-NEXT:    ret <8 x float> [[FMAX]]
 ;
   %fmax = tail call <8 x float> @_Z4fmaxDv8_fS_(<8 x float> %x, <8 x float> %y)
@@ -85,7 +85,7 @@ define <8 x float> @test_fmax_v8f32(<8 x float> %x, <8 x float> %y) {
 define <16 x float> @test_fmax_v16f32(<16 x float> %x, <16 x float> %y) {
 ; CHECK-LABEL: define <16 x float> @test_fmax_v16f32
 ; CHECK-SAME: (<16 x float> [[X:%.*]], <16 x float> [[Y:%.*]]) {
-; CHECK-NEXT:    [[FMAX:%.*]] = tail call <16 x float> @_Z4fmaxDv16_fS_(<16 x float> [[X]], <16 x float> [[Y]])
+; CHECK-NEXT:    [[FMAX:%.*]] = tail call <16 x float> @llvm.maxnum.v16f32(<16 x float> [[X]], <16 x float> [[Y]])
 ; CHECK-NEXT:    ret <16 x float> [[FMAX]]
 ;
   %fmax = tail call <16 x float> @_Z4fmaxDv16_fS_(<16 x float> %x, <16 x float> %y)
@@ -95,7 +95,7 @@ define <16 x float> @test_fmax_v16f32(<16 x float> %x, <16 x float> %y) {
 define double @test_fmax_f64(double %x, double %y) {
 ; CHECK-LABEL: define double @test_fmax_f64
 ; CHECK-SAME: (double [[X:%.*]], double [[Y:%.*]]) {
-; CHECK-NEXT:    [[FMAX:%.*]] = tail call double @_Z4fmaxdd(double [[X]], double [[Y]])
+; CHECK-NEXT:    [[FMAX:%.*]] = tail call double @llvm.maxnum.f64(double [[X]], double [[Y]])
 ; CHECK-NEXT:    ret double [[FMAX]]
 ;
   %fmax = tail call double @_Z4fmaxdd(double %x, double %y)
@@ -105,7 +105,7 @@ define double @test_fmax_f64(double %x, double %y) {
 define <2 x double> @test_fmax_v2f64(<2 x double> %x, <2 x double> %y) {
 ; CHECK-LABEL: define <2 x double> @test_fmax_v2f64
 ; CHECK-SAME: (<2 x double> [[X:%.*]], <2 x double> [[Y:%.*]]) {
-; CHECK-NEXT:    [[FMAX:%.*]] = tail call <2 x double> @_Z4fmaxDv2_dS_(<2 x double> [[X]], <2 x double> [[Y]])
+; CHECK-NEXT:    [[FMAX:%.*]] = tail call <2 x double> @llvm.maxnum.v2f64(<2 x double> [[X]], <2 x double> [[Y]])
 ; CHECK-NEXT:    ret <2 x double> [[FMAX]]
 ;
   %fmax = tail call <2 x double> @_Z4fmaxDv2_dS_(<2 x double> %x, <2 x double> %y)
@@ -115,7 +115,7 @@ define <2 x double> @test_fmax_v2f64(<2 x double> %x, <2 x double> %y) {
 define <3 x double> @test_fmax_v3f64(<3 x double> %x, <3 x double> %y) {
 ; CHECK-LABEL: define <3 x double> @test_fmax_v3f64
 ; CHECK-SAME: (<3 x double> [[X:%.*]], <3 x double> [[Y:%.*]]) {
-; CHECK-NEXT:    [[FMAX:%.*]] = tail call <3 x double> @_Z4fmaxDv3_dS_(<3 x double> [[X]], <3 x double> [[Y]])
+; CHECK-NEXT:    [[FMAX:%.*]] = tail call <3 x double> @llvm.maxnum.v3f64(<3 x double> [[X]], <3 x double> [[Y]])
 ; CHECK-NEXT:    ret <3 x double> [[FMAX]]
 ;
   %fmax = tail call <3 x double> @_Z4fmaxDv3_dS_(<3 x double> %x, <3 x double> %y)
@@ -125,7 +125,7 @@ define <3 x double> @test_fmax_v3f64(<3 x double> %x, <3 x double> %y) {
 define <4 x double> @test_fmax_v4f64(<4 x double> %x, <4 x double> %y) {
 ; CHECK-LABEL: define <4 x double> @test_fmax_v4f64
 ; CHECK-SAME: (<4 x double> [[X:%.*]], <4 x double> [[Y:%.*]]) {
-; CHECK-NEXT:    [[FMAX:%.*]] = tail call <4 x double> @_Z4fmaxDv4_dS_(<4 x double> [[X]], <4 x double> [[Y]])
+; CHECK-NEXT:    [[FMAX:%.*]] = tail call <4 x double> @llvm.maxnum.v4f64(<4 x double> [[X]], <4 x double> [[Y]])
 ; CHECK-NEXT:    ret <4 x double> [[FMAX]]
 ;
   %fmax = tail call <4 x double> @_Z4fmaxDv4_dS_(<4 x double> %x, <4 x double> %y)
@@ -135,7 +135,7 @@ define <4 x double> @test_fmax_v4f64(<4 x double> %x, <4 x double> %y) {
 define <8 x double> @test_fmax_v8f64(<8 x double> %x, <8 x double> %y) {
 ; CHECK-LABEL: define <8 x double> @test_fmax_v8f64
 ; CHECK-SAME: (<8 x double> [[X:%.*]], <8 x double> [[Y:%.*]]) {
-; CHECK-NEXT:    [[FMAX:%.*]] = tail call <8 x double> @_Z4fmaxDv8_dS_(<8 x double> [[X]], <8 x double> [[Y]])
+; CHECK-NEXT:    [[FMAX:%.*]] = tail call <8 x double> @llvm.maxnum.v8f64(<8 x double> [[X]], <8 x double> [[Y]])
 ; CHECK-NEXT:    ret <8 x double> [[FMAX]]
 ;
   %fmax = tail call <8 x double> @_Z4fmaxDv8_dS_(<8 x double> %x, <8 x double> %y)
@@ -145,7 +145,7 @@ define <8 x double> @test_fmax_v8f64(<8 x double> %x, <8 x double> %y) {
 define <16 x double> @test_fmax_v16f64(<16 x double> %x, <16 x double> %y) {
 ; CHECK-LABEL: define <16 x double> @test_fmax_v16f64
 ; CHECK-SAME: (<16 x double> [[X:%.*]], <16 x double> [[Y:%.*]]) {
-; CHECK-NEXT:    [[FMAX:%.*]] = tail call <16 x double> @_Z4fmaxDv16_dS_(<16 x double> [[X]], <16 x double> [[Y]])
+; CHECK-NEXT:    [[FMAX:%.*]] = tail call <16 x double> @llvm.maxnum.v16f64(<16 x double> [[X]], <16 x double> [[Y]])
 ; CHECK-NEXT:    ret <16 x double> [[FMAX]]
 ;
   %fmax = tail call <16 x double> @_Z4fmaxDv16_dS_(<16 x double> %x, <16 x double> %y)
@@ -155,7 +155,7 @@ define <16 x double> @test_fmax_v16f64(<16 x double> %x, <16 x double> %y) {
 define half @test_fmax_f16(half %x, half %y) {
 ; CHECK-LABEL: define half @test_fmax_f16
 ; CHECK-SAME: (half [[X:%.*]], half [[Y:%.*]]) {
-; CHECK-NEXT:    [[FMAX:%.*]] = tail call half @_Z4fmaxDhDh(half [[X]], half [[Y]])
+; CHECK-NEXT:    [[FMAX:%.*]] = tail call half @llvm.maxnum.f16(half [[X]], half [[Y]])
 ; CHECK-NEXT:    ret half [[FMAX]]
 ;
   %fmax = tail call half @_Z4fmaxDhDh(half %x, half %y)
@@ -165,7 +165,7 @@ define half @test_fmax_f16(half %x, half %y) {
 define <2 x half> @test_fmax_v2f16(<2 x half> %x, <2 x half> %y) {
 ; CHECK-LABEL: define <2 x half> @test_fmax_v2f16
 ; CHECK-SAME: (<2 x half> [[X:%.*]], <2 x half> [[Y:%.*]]) {
-; CHECK-NEXT:    [[FMAX:%.*]] = tail call <2 x half> @_Z4fmaxDv2_DhS_(<2 x half> [[X]], <2 x half> [[Y]])
+; CHECK-NEXT:    [[FMAX:%.*]] = tail call <2 x half> @llvm.maxnum.v2f16(<2 x half> [[X]], <2 x half> [[Y]])
 ; CHECK-NEXT:    ret <2 x half> [[FMAX]]
 ;
   %fmax = tail call <2 x half> @_Z4fmaxDv2_DhS_(<2 x half> %x, <2 x half> %y)
@@ -175,7 +175,7 @@ define <2 x half> @test_fmax_v2f16(<2 x half> %x, <2 x half> %y) {
 define <3 x half> @test_fmax_v3f16(<3 x half> %x, <3 x half> %y) {
 ; CHECK-LABEL: define <3 x half> @test_fmax_v3f16
 ; CHECK-SAME: (<3 x half> [[X:%.*]], <3 x half> [[Y:%.*]]) {
-; CHECK-NEXT:    [[FMAX:%.*]] = tail call <3 x half> @_Z4fmaxDv3_DhS_(<3 x half> [[X]], <3 x half> [[Y]])
+; CHECK-NEXT:    [[FMAX:%.*]] = tail call <3 x half> @llvm.maxnum.v3f16(<3 x half> [[X]], <3 x half> [[Y]])
 ; CHECK-NEXT:    ret <3 x half> [[FMAX]]
 ;
   %fmax = tail call <3 x half> @_Z4fmaxDv3_DhS_(<3 x half> %x, <3 x half> %y)
@@ -185,7 +185,7 @@ define <3 x half> @test_fmax_v3f16(<3 x half> %x, <3 x half> %y) {
 define <4 x half> @test_fmax_v4f16(<4 x half> %x, <4 x half> %y) {
 ; CHECK-LABEL: define <4 x half> @test_fmax_v4f16
 ; CHECK-SAME: (<4 x half> [[X:%.*]], <4 x half> [[Y:%.*]]) {
-; CHECK-NEXT:    [[FMAX:%.*]] = tail call <4 x half> @_Z4fmaxDv4_DhS_(<4 x half> [[X]], <4 x half> [[Y]])
+; CHECK-NEXT:    [[FMAX:%.*]] = tail call <4 x half> @llvm.maxnum.v4f16(<4 x half> [[X]], <4 x half> [[Y]])
 ; CHECK-NEXT:    ret <4 x half> [[FMAX]]
 ;
   %fmax = tail call <4 x half> @_Z4fmaxDv4_DhS_(<4 x half> %x, <4 x half> %y)
@@ -195,7 +195,7 @@ define <4 x half> @test_fmax_v4f16(<4 x half> %x, <4 x half> %y) {
 define <8 x half> @test_fmax_v8f16(<8 x half> %x, <8 x half> %y) {
 ; CHECK-LABEL: define <8 x half> @test_fmax_v8f16
 ; CHECK-SAME: (<8 x half> [[X:%.*]], <8 x half> [[Y:%.*]]) {
-; CHECK-NEXT:    [[FMAX:%.*]] = tail call <8 x half> @_Z4fmaxDv8_DhS_(<8 x half> [[X]], <8 x half> [[Y]])
+; CHECK-NEXT:    [[FMAX:%.*]] = tail call <8 x half> @llvm.maxnum.v8f16(<8 x half> [[X]], <8 x half> [[Y]])
 ; CHECK-NEXT:    ret <8 x half> [[FMAX]]
 ;
   %fmax = tail call <8 x half> @_Z4fmaxDv8_DhS_(<8 x half> %x, <8 x half> %y)
@@ -205,7 +205,7 @@ define <8 x half> @test_fmax_v8f16(<8 x half> %x, <8 x half> %y) {
 define <16 x half> @test_fmax_v16f16(<16 x half> %x, <16 x half> %y) {
 ; CHECK-LABEL: define <16 x half> @test_fmax_v16f16
 ; CHECK-SAME: (<16 x half> [[X:%.*]], <16 x half> [[Y:%.*]]) {
-; CHECK-NEXT:    [[FMAX:%.*]] = tail call <16 x half> @_Z4fmaxDv16_DhS_(<16 x half> [[X]], <16 x half> [[Y]])
+; CHECK-NEXT:    [[FMAX:%.*]] = tail call <16 x half> @llvm.maxnum.v16f16(<16 x half> [[X]], <16 x half> [[Y]])
 ; CHECK-NEXT:    ret <16 x half> [[FMAX]]
 ;
   %fmax = tail call <16 x half> @_Z4fmaxDv16_DhS_(<16 x half> %x, <16 x half> %y)
@@ -215,7 +215,7 @@ define <16 x half> @test_fmax_v16f16(<16 x half> %x, <16 x half> %y) {
 define float @test_fmax_f32_minsize(float %x, float %y) #0 {
 ; CHECK-LABEL: define float @test_fmax_f32_minsize
 ; CHECK-SAME: (float [[X:%.*]], float [[Y:%.*]]) #[[ATTR0:[0-9]+]] {
-; CHECK-NEXT:    [[FMAX:%.*]] = tail call float @_Z4fmaxff(float [[X]], float [[Y]])
+; CHECK-NEXT:    [[FMAX:%.*]] = tail call float @llvm.maxnum.f32(float [[X]], float [[Y]])
 ; CHECK-NEXT:    ret float [[FMAX]]
 ;
   %fmax = tail call float @_Z4fmaxff(float %x, float %y)
@@ -225,7 +225,7 @@ define float @test_fmax_f32_minsize(float %x, float %y) #0 {
 define float @test_fmax_f32_nnan_minsize(float %x, float %y) #0 {
 ; CHECK-LABEL: define float @test_fmax_f32_nnan_minsize
 ; CHECK-SAME: (float [[X:%.*]], float [[Y:%.*]]) #[[ATTR0]] {
-; CHECK-NEXT:    [[FMAX:%.*]] = tail call nnan float @_Z4fmaxff(float [[X]], float [[Y]])
+; CHECK-NEXT:    [[FMAX:%.*]] = tail call nnan float @llvm.maxnum.f32(float [[X]], float [[Y]])
 ; CHECK-NEXT:    ret float [[FMAX]]
 ;
   %fmax = tail call nnan float @_Z4fmaxff(float %x, float %y)
@@ -235,7 +235,7 @@ define float @test_fmax_f32_nnan_minsize(float %x, float %y) #0 {
 define float @test_fmax_f32_noinline(float %x, float %y) {
 ; CHECK-LABEL: define float @test_fmax_f32_noinline
 ; CHECK-SAME: (float [[X:%.*]], float [[Y:%.*]]) {
-; CHECK-NEXT:    [[FMAX:%.*]] = tail call float @_Z4fmaxff(float [[X]], float [[Y]]) #[[ATTR2:[0-9]+]]
+; CHECK-NEXT:    [[FMAX:%.*]] = tail call float @_Z4fmaxff(float [[X]], float [[Y]]) #[[ATTR3:[0-9]+]]
 ; CHECK-NEXT:    ret float [[FMAX]]
 ;
   %fmax = tail call float @_Z4fmaxff(float %x, float %y) #1
@@ -245,7 +245,7 @@ define float @test_fmax_f32_noinline(float %x, float %y) {
 define float @test_fmax_f32_nnan_noinline(float %x, float %y) {
 ; CHECK-LABEL: define float @test_fmax_f32_nnan_noinline
 ; CHECK-SAME: (float [[X:%.*]], float [[Y:%.*]]) {
-; CHECK-NEXT:    [[FMAX:%.*]] = tail call nnan float @_Z4fmaxff(float [[X]], float [[Y]]) #[[ATTR2]]
+; CHECK-NEXT:    [[FMAX:%.*]] = tail call nnan float @_Z4fmaxff(float [[X]], float [[Y]]) #[[ATTR3]]
 ; CHECK-NEXT:    ret float [[FMAX]]
 ;
   %fmax = tail call nnan float @_Z4fmaxff(float %x, float %y) #1
@@ -265,7 +265,7 @@ define float @test_fmax_f32_strictfp(float %x, float %y) #2 {
 define float @test_fmax_f32_fast_nobuiltin(float %x, float %y) {
 ; CHECK-LABEL: define float @test_fmax_f32_fast_nobuiltin
 ; CHECK-SAME: (float [[X:%.*]], float [[Y:%.*]]) {
-; CHECK-NEXT:    [[FMAX:%.*]] = tail call fast float @_Z4fmaxff(float [[X]], float [[Y]]) #[[ATTR3:[0-9]+]]
+; CHECK-NEXT:    [[FMAX:%.*]] = tail call fast float @_Z4fmaxff(float [[X]], float [[Y]]) #[[ATTR4:[0-9]+]]
 ; CHECK-NEXT:    ret float [[FMAX]]
 ;
   %fmax = tail call fast float @_Z4fmaxff(float %x, float %y) #3

diff  --git a/llvm/test/CodeGen/AMDGPU/amdgpu-simplify-libcall-fmin.ll b/llvm/test/CodeGen/AMDGPU/amdgpu-simplify-libcall-fmin.ll
index b1719c81c53a6f..3b680d86990207 100644
--- a/llvm/test/CodeGen/AMDGPU/amdgpu-simplify-libcall-fmin.ll
+++ b/llvm/test/CodeGen/AMDGPU/amdgpu-simplify-libcall-fmin.ll
@@ -25,7 +25,7 @@ declare <16 x half> @_Z4fminDv16_DhS_(<16 x half>, <16 x half>)
 define float @test_fmin_f32(float %x, float %y) {
 ; CHECK-LABEL: define float @test_fmin_f32
 ; CHECK-SAME: (float [[X:%.*]], float [[Y:%.*]]) {
-; CHECK-NEXT:    [[FMIN:%.*]] = tail call float @_Z4fminff(float [[X]], float [[Y]])
+; CHECK-NEXT:    [[FMIN:%.*]] = tail call float @llvm.minnum.f32(float [[X]], float [[Y]])
 ; CHECK-NEXT:    ret float [[FMIN]]
 ;
   %fmin = tail call float @_Z4fminff(float %x, float %y)
@@ -35,7 +35,7 @@ define float @test_fmin_f32(float %x, float %y) {
 define float @test_fmin_f32_nnan(float %x, float %y) {
 ; CHECK-LABEL: define float @test_fmin_f32_nnan
 ; CHECK-SAME: (float [[X:%.*]], float [[Y:%.*]]) {
-; CHECK-NEXT:    [[FMIN:%.*]] = tail call nnan float @_Z4fminff(float [[X]], float [[Y]])
+; CHECK-NEXT:    [[FMIN:%.*]] = tail call nnan float @llvm.minnum.f32(float [[X]], float [[Y]])
 ; CHECK-NEXT:    ret float [[FMIN]]
 ;
   %fmin = tail call nnan float @_Z4fminff(float %x, float %y)
@@ -45,7 +45,7 @@ define float @test_fmin_f32_nnan(float %x, float %y) {
 define <2 x float> @test_fmin_v2f32(<2 x float> %x, <2 x float> %y) {
 ; CHECK-LABEL: define <2 x float> @test_fmin_v2f32
 ; CHECK-SAME: (<2 x float> [[X:%.*]], <2 x float> [[Y:%.*]]) {
-; CHECK-NEXT:    [[FMIN:%.*]] = tail call <2 x float> @_Z4fminDv2_fS_(<2 x float> [[X]], <2 x float> [[Y]])
+; CHECK-NEXT:    [[FMIN:%.*]] = tail call <2 x float> @llvm.minnum.v2f32(<2 x float> [[X]], <2 x float> [[Y]])
 ; CHECK-NEXT:    ret <2 x float> [[FMIN]]
 ;
   %fmin = tail call <2 x float> @_Z4fminDv2_fS_(<2 x float> %x, <2 x float> %y)
@@ -55,7 +55,7 @@ define <2 x float> @test_fmin_v2f32(<2 x float> %x, <2 x float> %y) {
 define <3 x float> @test_fmin_v3f32(<3 x float> %x, <3 x float> %y) {
 ; CHECK-LABEL: define <3 x float> @test_fmin_v3f32
 ; CHECK-SAME: (<3 x float> [[X:%.*]], <3 x float> [[Y:%.*]]) {
-; CHECK-NEXT:    [[FMIN:%.*]] = tail call <3 x float> @_Z4fminDv3_fS_(<3 x float> [[X]], <3 x float> [[Y]])
+; CHECK-NEXT:    [[FMIN:%.*]] = tail call <3 x float> @llvm.minnum.v3f32(<3 x float> [[X]], <3 x float> [[Y]])
 ; CHECK-NEXT:    ret <3 x float> [[FMIN]]
 ;
   %fmin = tail call <3 x float> @_Z4fminDv3_fS_(<3 x float> %x, <3 x float> %y)
@@ -65,7 +65,7 @@ define <3 x float> @test_fmin_v3f32(<3 x float> %x, <3 x float> %y) {
 define <4 x float> @test_fmin_v4f32(<4 x float> %x, <4 x float> %y) {
 ; CHECK-LABEL: define <4 x float> @test_fmin_v4f32
 ; CHECK-SAME: (<4 x float> [[X:%.*]], <4 x float> [[Y:%.*]]) {
-; CHECK-NEXT:    [[FMIN:%.*]] = tail call <4 x float> @_Z4fminDv4_fS_(<4 x float> [[X]], <4 x float> [[Y]])
+; CHECK-NEXT:    [[FMIN:%.*]] = tail call <4 x float> @llvm.minnum.v4f32(<4 x float> [[X]], <4 x float> [[Y]])
 ; CHECK-NEXT:    ret <4 x float> [[FMIN]]
 ;
   %fmin = tail call <4 x float> @_Z4fminDv4_fS_(<4 x float> %x, <4 x float> %y)
@@ -75,7 +75,7 @@ define <4 x float> @test_fmin_v4f32(<4 x float> %x, <4 x float> %y) {
 define <8 x float> @test_fmin_v8f32(<8 x float> %x, <8 x float> %y) {
 ; CHECK-LABEL: define <8 x float> @test_fmin_v8f32
 ; CHECK-SAME: (<8 x float> [[X:%.*]], <8 x float> [[Y:%.*]]) {
-; CHECK-NEXT:    [[FMIN:%.*]] = tail call <8 x float> @_Z4fminDv8_fS_(<8 x float> [[X]], <8 x float> [[Y]])
+; CHECK-NEXT:    [[FMIN:%.*]] = tail call <8 x float> @llvm.minnum.v8f32(<8 x float> [[X]], <8 x float> [[Y]])
 ; CHECK-NEXT:    ret <8 x float> [[FMIN]]
 ;
   %fmin = tail call <8 x float> @_Z4fminDv8_fS_(<8 x float> %x, <8 x float> %y)
@@ -85,7 +85,7 @@ define <8 x float> @test_fmin_v8f32(<8 x float> %x, <8 x float> %y) {
 define <16 x float> @test_fmin_v16f32(<16 x float> %x, <16 x float> %y) {
 ; CHECK-LABEL: define <16 x float> @test_fmin_v16f32
 ; CHECK-SAME: (<16 x float> [[X:%.*]], <16 x float> [[Y:%.*]]) {
-; CHECK-NEXT:    [[FMIN:%.*]] = tail call <16 x float> @_Z4fminDv16_fS_(<16 x float> [[X]], <16 x float> [[Y]])
+; CHECK-NEXT:    [[FMIN:%.*]] = tail call <16 x float> @llvm.minnum.v16f32(<16 x float> [[X]], <16 x float> [[Y]])
 ; CHECK-NEXT:    ret <16 x float> [[FMIN]]
 ;
   %fmin = tail call <16 x float> @_Z4fminDv16_fS_(<16 x float> %x, <16 x float> %y)
@@ -95,7 +95,7 @@ define <16 x float> @test_fmin_v16f32(<16 x float> %x, <16 x float> %y) {
 define double @test_fmin_f64(double %x, double %y) {
 ; CHECK-LABEL: define double @test_fmin_f64
 ; CHECK-SAME: (double [[X:%.*]], double [[Y:%.*]]) {
-; CHECK-NEXT:    [[FMIN:%.*]] = tail call double @_Z4fmindd(double [[X]], double [[Y]])
+; CHECK-NEXT:    [[FMIN:%.*]] = tail call double @llvm.minnum.f64(double [[X]], double [[Y]])
 ; CHECK-NEXT:    ret double [[FMIN]]
 ;
   %fmin = tail call double @_Z4fmindd(double %x, double %y)
@@ -105,7 +105,7 @@ define double @test_fmin_f64(double %x, double %y) {
 define <2 x double> @test_fmin_v2f64(<2 x double> %x, <2 x double> %y) {
 ; CHECK-LABEL: define <2 x double> @test_fmin_v2f64
 ; CHECK-SAME: (<2 x double> [[X:%.*]], <2 x double> [[Y:%.*]]) {
-; CHECK-NEXT:    [[FMIN:%.*]] = tail call <2 x double> @_Z4fminDv2_dS_(<2 x double> [[X]], <2 x double> [[Y]])
+; CHECK-NEXT:    [[FMIN:%.*]] = tail call <2 x double> @llvm.minnum.v2f64(<2 x double> [[X]], <2 x double> [[Y]])
 ; CHECK-NEXT:    ret <2 x double> [[FMIN]]
 ;
   %fmin = tail call <2 x double> @_Z4fminDv2_dS_(<2 x double> %x, <2 x double> %y)
@@ -115,7 +115,7 @@ define <2 x double> @test_fmin_v2f64(<2 x double> %x, <2 x double> %y) {
 define <3 x double> @test_fmin_v3f64(<3 x double> %x, <3 x double> %y) {
 ; CHECK-LABEL: define <3 x double> @test_fmin_v3f64
 ; CHECK-SAME: (<3 x double> [[X:%.*]], <3 x double> [[Y:%.*]]) {
-; CHECK-NEXT:    [[FMIN:%.*]] = tail call <3 x double> @_Z4fminDv3_dS_(<3 x double> [[X]], <3 x double> [[Y]])
+; CHECK-NEXT:    [[FMIN:%.*]] = tail call <3 x double> @llvm.minnum.v3f64(<3 x double> [[X]], <3 x double> [[Y]])
 ; CHECK-NEXT:    ret <3 x double> [[FMIN]]
 ;
   %fmin = tail call <3 x double> @_Z4fminDv3_dS_(<3 x double> %x, <3 x double> %y)
@@ -125,7 +125,7 @@ define <3 x double> @test_fmin_v3f64(<3 x double> %x, <3 x double> %y) {
 define <4 x double> @test_fmin_v4f64(<4 x double> %x, <4 x double> %y) {
 ; CHECK-LABEL: define <4 x double> @test_fmin_v4f64
 ; CHECK-SAME: (<4 x double> [[X:%.*]], <4 x double> [[Y:%.*]]) {
-; CHECK-NEXT:    [[FMIN:%.*]] = tail call <4 x double> @_Z4fminDv4_dS_(<4 x double> [[X]], <4 x double> [[Y]])
+; CHECK-NEXT:    [[FMIN:%.*]] = tail call <4 x double> @llvm.minnum.v4f64(<4 x double> [[X]], <4 x double> [[Y]])
 ; CHECK-NEXT:    ret <4 x double> [[FMIN]]
 ;
   %fmin = tail call <4 x double> @_Z4fminDv4_dS_(<4 x double> %x, <4 x double> %y)
@@ -135,7 +135,7 @@ define <4 x double> @test_fmin_v4f64(<4 x double> %x, <4 x double> %y) {
 define <8 x double> @test_fmin_v8f64(<8 x double> %x, <8 x double> %y) {
 ; CHECK-LABEL: define <8 x double> @test_fmin_v8f64
 ; CHECK-SAME: (<8 x double> [[X:%.*]], <8 x double> [[Y:%.*]]) {
-; CHECK-NEXT:    [[FMIN:%.*]] = tail call <8 x double> @_Z4fminDv8_dS_(<8 x double> [[X]], <8 x double> [[Y]])
+; CHECK-NEXT:    [[FMIN:%.*]] = tail call <8 x double> @llvm.minnum.v8f64(<8 x double> [[X]], <8 x double> [[Y]])
 ; CHECK-NEXT:    ret <8 x double> [[FMIN]]
 ;
   %fmin = tail call <8 x double> @_Z4fminDv8_dS_(<8 x double> %x, <8 x double> %y)
@@ -145,7 +145,7 @@ define <8 x double> @test_fmin_v8f64(<8 x double> %x, <8 x double> %y) {
 define <16 x double> @test_fmin_v16f64(<16 x double> %x, <16 x double> %y) {
 ; CHECK-LABEL: define <16 x double> @test_fmin_v16f64
 ; CHECK-SAME: (<16 x double> [[X:%.*]], <16 x double> [[Y:%.*]]) {
-; CHECK-NEXT:    [[FMIN:%.*]] = tail call <16 x double> @_Z4fminDv16_dS_(<16 x double> [[X]], <16 x double> [[Y]])
+; CHECK-NEXT:    [[FMIN:%.*]] = tail call <16 x double> @llvm.minnum.v16f64(<16 x double> [[X]], <16 x double> [[Y]])
 ; CHECK-NEXT:    ret <16 x double> [[FMIN]]
 ;
   %fmin = tail call <16 x double> @_Z4fminDv16_dS_(<16 x double> %x, <16 x double> %y)
@@ -155,7 +155,7 @@ define <16 x double> @test_fmin_v16f64(<16 x double> %x, <16 x double> %y) {
 define half @test_fmin_f16(half %x, half %y) {
 ; CHECK-LABEL: define half @test_fmin_f16
 ; CHECK-SAME: (half [[X:%.*]], half [[Y:%.*]]) {
-; CHECK-NEXT:    [[FMIN:%.*]] = tail call half @_Z4fminDhDh(half [[X]], half [[Y]])
+; CHECK-NEXT:    [[FMIN:%.*]] = tail call half @llvm.minnum.f16(half [[X]], half [[Y]])
 ; CHECK-NEXT:    ret half [[FMIN]]
 ;
   %fmin = tail call half @_Z4fminDhDh(half %x, half %y)
@@ -165,7 +165,7 @@ define half @test_fmin_f16(half %x, half %y) {
 define <2 x half> @test_fmin_v2f16(<2 x half> %x, <2 x half> %y) {
 ; CHECK-LABEL: define <2 x half> @test_fmin_v2f16
 ; CHECK-SAME: (<2 x half> [[X:%.*]], <2 x half> [[Y:%.*]]) {
-; CHECK-NEXT:    [[FMIN:%.*]] = tail call <2 x half> @_Z4fminDv2_DhS_(<2 x half> [[X]], <2 x half> [[Y]])
+; CHECK-NEXT:    [[FMIN:%.*]] = tail call <2 x half> @llvm.minnum.v2f16(<2 x half> [[X]], <2 x half> [[Y]])
 ; CHECK-NEXT:    ret <2 x half> [[FMIN]]
 ;
   %fmin = tail call <2 x half> @_Z4fminDv2_DhS_(<2 x half> %x, <2 x half> %y)
@@ -175,7 +175,7 @@ define <2 x half> @test_fmin_v2f16(<2 x half> %x, <2 x half> %y) {
 define <3 x half> @test_fmin_v3f16(<3 x half> %x, <3 x half> %y) {
 ; CHECK-LABEL: define <3 x half> @test_fmin_v3f16
 ; CHECK-SAME: (<3 x half> [[X:%.*]], <3 x half> [[Y:%.*]]) {
-; CHECK-NEXT:    [[FMIN:%.*]] = tail call <3 x half> @_Z4fminDv3_DhS_(<3 x half> [[X]], <3 x half> [[Y]])
+; CHECK-NEXT:    [[FMIN:%.*]] = tail call <3 x half> @llvm.minnum.v3f16(<3 x half> [[X]], <3 x half> [[Y]])
 ; CHECK-NEXT:    ret <3 x half> [[FMIN]]
 ;
   %fmin = tail call <3 x half> @_Z4fminDv3_DhS_(<3 x half> %x, <3 x half> %y)
@@ -185,7 +185,7 @@ define <3 x half> @test_fmin_v3f16(<3 x half> %x, <3 x half> %y) {
 define <4 x half> @test_fmin_v4f16(<4 x half> %x, <4 x half> %y) {
 ; CHECK-LABEL: define <4 x half> @test_fmin_v4f16
 ; CHECK-SAME: (<4 x half> [[X:%.*]], <4 x half> [[Y:%.*]]) {
-; CHECK-NEXT:    [[FMIN:%.*]] = tail call <4 x half> @_Z4fminDv4_DhS_(<4 x half> [[X]], <4 x half> [[Y]])
+; CHECK-NEXT:    [[FMIN:%.*]] = tail call <4 x half> @llvm.minnum.v4f16(<4 x half> [[X]], <4 x half> [[Y]])
 ; CHECK-NEXT:    ret <4 x half> [[FMIN]]
 ;
   %fmin = tail call <4 x half> @_Z4fminDv4_DhS_(<4 x half> %x, <4 x half> %y)
@@ -195,7 +195,7 @@ define <4 x half> @test_fmin_v4f16(<4 x half> %x, <4 x half> %y) {
 define <8 x half> @test_fmin_v8f16(<8 x half> %x, <8 x half> %y) {
 ; CHECK-LABEL: define <8 x half> @test_fmin_v8f16
 ; CHECK-SAME: (<8 x half> [[X:%.*]], <8 x half> [[Y:%.*]]) {
-; CHECK-NEXT:    [[FMIN:%.*]] = tail call <8 x half> @_Z4fminDv8_DhS_(<8 x half> [[X]], <8 x half> [[Y]])
+; CHECK-NEXT:    [[FMIN:%.*]] = tail call <8 x half> @llvm.minnum.v8f16(<8 x half> [[X]], <8 x half> [[Y]])
 ; CHECK-NEXT:    ret <8 x half> [[FMIN]]
 ;
   %fmin = tail call <8 x half> @_Z4fminDv8_DhS_(<8 x half> %x, <8 x half> %y)
@@ -205,7 +205,7 @@ define <8 x half> @test_fmin_v8f16(<8 x half> %x, <8 x half> %y) {
 define <16 x half> @test_fmin_v16f16(<16 x half> %x, <16 x half> %y) {
 ; CHECK-LABEL: define <16 x half> @test_fmin_v16f16
 ; CHECK-SAME: (<16 x half> [[X:%.*]], <16 x half> [[Y:%.*]]) {
-; CHECK-NEXT:    [[FMIN:%.*]] = tail call <16 x half> @_Z4fminDv16_DhS_(<16 x half> [[X]], <16 x half> [[Y]])
+; CHECK-NEXT:    [[FMIN:%.*]] = tail call <16 x half> @llvm.minnum.v16f16(<16 x half> [[X]], <16 x half> [[Y]])
 ; CHECK-NEXT:    ret <16 x half> [[FMIN]]
 ;
   %fmin = tail call <16 x half> @_Z4fminDv16_DhS_(<16 x half> %x, <16 x half> %y)
@@ -215,7 +215,7 @@ define <16 x half> @test_fmin_v16f16(<16 x half> %x, <16 x half> %y) {
 define float @test_fmin_f32_minsize(float %x, float %y) #0 {
 ; CHECK-LABEL: define float @test_fmin_f32_minsize
 ; CHECK-SAME: (float [[X:%.*]], float [[Y:%.*]]) #[[ATTR0:[0-9]+]] {
-; CHECK-NEXT:    [[FMIN:%.*]] = tail call float @_Z4fminff(float [[X]], float [[Y]])
+; CHECK-NEXT:    [[FMIN:%.*]] = tail call float @llvm.minnum.f32(float [[X]], float [[Y]])
 ; CHECK-NEXT:    ret float [[FMIN]]
 ;
   %fmin = tail call float @_Z4fminff(float %x, float %y)
@@ -225,7 +225,7 @@ define float @test_fmin_f32_minsize(float %x, float %y) #0 {
 define float @test_fmin_f32_nnan_minsize(float %x, float %y) #0 {
 ; CHECK-LABEL: define float @test_fmin_f32_nnan_minsize
 ; CHECK-SAME: (float [[X:%.*]], float [[Y:%.*]]) #[[ATTR0]] {
-; CHECK-NEXT:    [[FMIN:%.*]] = tail call nnan float @_Z4fminff(float [[X]], float [[Y]])
+; CHECK-NEXT:    [[FMIN:%.*]] = tail call nnan float @llvm.minnum.f32(float [[X]], float [[Y]])
 ; CHECK-NEXT:    ret float [[FMIN]]
 ;
   %fmin = tail call nnan float @_Z4fminff(float %x, float %y)
@@ -235,7 +235,7 @@ define float @test_fmin_f32_nnan_minsize(float %x, float %y) #0 {
 define float @test_fmin_f32_noinline(float %x, float %y) {
 ; CHECK-LABEL: define float @test_fmin_f32_noinline
 ; CHECK-SAME: (float [[X:%.*]], float [[Y:%.*]]) {
-; CHECK-NEXT:    [[FMIN:%.*]] = tail call float @_Z4fminff(float [[X]], float [[Y]]) #[[ATTR2:[0-9]+]]
+; CHECK-NEXT:    [[FMIN:%.*]] = tail call float @_Z4fminff(float [[X]], float [[Y]]) #[[ATTR3:[0-9]+]]
 ; CHECK-NEXT:    ret float [[FMIN]]
 ;
   %fmin = tail call float @_Z4fminff(float %x, float %y) #1
@@ -245,7 +245,7 @@ define float @test_fmin_f32_noinline(float %x, float %y) {
 define float @test_fmin_f32_nnan_noinline(float %x, float %y) {
 ; CHECK-LABEL: define float @test_fmin_f32_nnan_noinline
 ; CHECK-SAME: (float [[X:%.*]], float [[Y:%.*]]) {
-; CHECK-NEXT:    [[FMIN:%.*]] = tail call nnan float @_Z4fminff(float [[X]], float [[Y]]) #[[ATTR2]]
+; CHECK-NEXT:    [[FMIN:%.*]] = tail call nnan float @_Z4fminff(float [[X]], float [[Y]]) #[[ATTR3]]
 ; CHECK-NEXT:    ret float [[FMIN]]
 ;
   %fmin = tail call nnan float @_Z4fminff(float %x, float %y) #1
@@ -265,7 +265,7 @@ define float @test_fmin_f32_strictfp(float %x, float %y) #2 {
 define float @test_fmin_f32_fast_nobuiltin(float %x, float %y) {
 ; CHECK-LABEL: define float @test_fmin_f32_fast_nobuiltin
 ; CHECK-SAME: (float [[X:%.*]], float [[Y:%.*]]) {
-; CHECK-NEXT:    [[FMIN:%.*]] = tail call fast float @_Z4fminff(float [[X]], float [[Y]]) #[[ATTR3:[0-9]+]]
+; CHECK-NEXT:    [[FMIN:%.*]] = tail call fast float @_Z4fminff(float [[X]], float [[Y]]) #[[ATTR4:[0-9]+]]
 ; CHECK-NEXT:    ret float [[FMIN]]
 ;
   %fmin = tail call fast float @_Z4fminff(float %x, float %y) #3

diff  --git a/llvm/test/CodeGen/AMDGPU/amdgpu-simplify-libcall-mad.ll b/llvm/test/CodeGen/AMDGPU/amdgpu-simplify-libcall-mad.ll
index ea27bd37b8eeda..0aace74dbeb2c5 100644
--- a/llvm/test/CodeGen/AMDGPU/amdgpu-simplify-libcall-mad.ll
+++ b/llvm/test/CodeGen/AMDGPU/amdgpu-simplify-libcall-mad.ll
@@ -25,7 +25,7 @@ declare <16 x half> @_Z3madDv16_DhS_S_(<16 x half>, <16 x half>, <16 x half>)
 define float @test_mad_f32(float %x, float %y, float %z) {
 ; CHECK-LABEL: define float @test_mad_f32
 ; CHECK-SAME: (float [[X:%.*]], float [[Y:%.*]], float [[Z:%.*]]) {
-; CHECK-NEXT:    [[MAD:%.*]] = tail call float @_Z3madfff(float [[X]], float [[Y]], float [[Z]])
+; CHECK-NEXT:    [[MAD:%.*]] = tail call float @llvm.fmuladd.f32(float [[X]], float [[Y]], float [[Z]])
 ; CHECK-NEXT:    ret float [[MAD]]
 ;
   %mad = tail call float @_Z3madfff(float %x, float %y, float %z)
@@ -35,7 +35,7 @@ define float @test_mad_f32(float %x, float %y, float %z) {
 define <2 x float> @test_mad_v2f32(<2 x float> %x, <2 x float> %y, <2 x float> %z) {
 ; CHECK-LABEL: define <2 x float> @test_mad_v2f32
 ; CHECK-SAME: (<2 x float> [[X:%.*]], <2 x float> [[Y:%.*]], <2 x float> [[Z:%.*]]) {
-; CHECK-NEXT:    [[MAD:%.*]] = tail call <2 x float> @_Z3madDv2_fS_S_(<2 x float> [[X]], <2 x float> [[Y]], <2 x float> [[Z]])
+; CHECK-NEXT:    [[MAD:%.*]] = tail call <2 x float> @llvm.fmuladd.v2f32(<2 x float> [[X]], <2 x float> [[Y]], <2 x float> [[Z]])
 ; CHECK-NEXT:    ret <2 x float> [[MAD]]
 ;
   %mad = tail call <2 x float> @_Z3madDv2_fS_S_(<2 x float> %x, <2 x float> %y, <2 x float> %z)
@@ -45,7 +45,7 @@ define <2 x float> @test_mad_v2f32(<2 x float> %x, <2 x float> %y, <2 x float> %
 define <3 x float> @test_mad_v3f32(<3 x float> %x, <3 x float> %y, <3 x float> %z) {
 ; CHECK-LABEL: define <3 x float> @test_mad_v3f32
 ; CHECK-SAME: (<3 x float> [[X:%.*]], <3 x float> [[Y:%.*]], <3 x float> [[Z:%.*]]) {
-; CHECK-NEXT:    [[MAD:%.*]] = tail call <3 x float> @_Z3madDv3_fS_S_(<3 x float> [[X]], <3 x float> [[Y]], <3 x float> [[Z]])
+; CHECK-NEXT:    [[MAD:%.*]] = tail call <3 x float> @llvm.fmuladd.v3f32(<3 x float> [[X]], <3 x float> [[Y]], <3 x float> [[Z]])
 ; CHECK-NEXT:    ret <3 x float> [[MAD]]
 ;
   %mad = tail call <3 x float> @_Z3madDv3_fS_S_(<3 x float> %x, <3 x float> %y, <3 x float> %z)
@@ -55,7 +55,7 @@ define <3 x float> @test_mad_v3f32(<3 x float> %x, <3 x float> %y, <3 x float> %
 define <4 x float> @test_mad_v4f32(<4 x float> %x, <4 x float> %y, <4 x float> %z) {
 ; CHECK-LABEL: define <4 x float> @test_mad_v4f32
 ; CHECK-SAME: (<4 x float> [[X:%.*]], <4 x float> [[Y:%.*]], <4 x float> [[Z:%.*]]) {
-; CHECK-NEXT:    [[MAD:%.*]] = tail call <4 x float> @_Z3madDv4_fS_S_(<4 x float> [[X]], <4 x float> [[Y]], <4 x float> [[Z]])
+; CHECK-NEXT:    [[MAD:%.*]] = tail call <4 x float> @llvm.fmuladd.v4f32(<4 x float> [[X]], <4 x float> [[Y]], <4 x float> [[Z]])
 ; CHECK-NEXT:    ret <4 x float> [[MAD]]
 ;
   %mad = tail call <4 x float> @_Z3madDv4_fS_S_(<4 x float> %x, <4 x float> %y, <4 x float> %z)
@@ -65,7 +65,7 @@ define <4 x float> @test_mad_v4f32(<4 x float> %x, <4 x float> %y, <4 x float> %
 define <8 x float> @test_mad_v8f32(<8 x float> %x, <8 x float> %y, <8 x float> %z) {
 ; CHECK-LABEL: define <8 x float> @test_mad_v8f32
 ; CHECK-SAME: (<8 x float> [[X:%.*]], <8 x float> [[Y:%.*]], <8 x float> [[Z:%.*]]) {
-; CHECK-NEXT:    [[MAD:%.*]] = tail call <8 x float> @_Z3madDv8_fS_S_(<8 x float> [[X]], <8 x float> [[Y]], <8 x float> [[Z]])
+; CHECK-NEXT:    [[MAD:%.*]] = tail call <8 x float> @llvm.fmuladd.v8f32(<8 x float> [[X]], <8 x float> [[Y]], <8 x float> [[Z]])
 ; CHECK-NEXT:    ret <8 x float> [[MAD]]
 ;
   %mad = tail call <8 x float> @_Z3madDv8_fS_S_(<8 x float> %x, <8 x float> %y, <8 x float> %z)
@@ -75,7 +75,7 @@ define <8 x float> @test_mad_v8f32(<8 x float> %x, <8 x float> %y, <8 x float> %
 define <16 x float> @test_mad_v16f32(<16 x float> %x, <16 x float> %y, <16 x float> %z) {
 ; CHECK-LABEL: define <16 x float> @test_mad_v16f32
 ; CHECK-SAME: (<16 x float> [[X:%.*]], <16 x float> [[Y:%.*]], <16 x float> [[Z:%.*]]) {
-; CHECK-NEXT:    [[MAD:%.*]] = tail call <16 x float> @_Z3madDv16_fS_S_(<16 x float> [[X]], <16 x float> [[Y]], <16 x float> [[Z]])
+; CHECK-NEXT:    [[MAD:%.*]] = tail call <16 x float> @llvm.fmuladd.v16f32(<16 x float> [[X]], <16 x float> [[Y]], <16 x float> [[Z]])
 ; CHECK-NEXT:    ret <16 x float> [[MAD]]
 ;
   %mad = tail call <16 x float> @_Z3madDv16_fS_S_(<16 x float> %x, <16 x float> %y, <16 x float> %z)
@@ -85,7 +85,7 @@ define <16 x float> @test_mad_v16f32(<16 x float> %x, <16 x float> %y, <16 x flo
 define double @test_mad_f64(double %x, double %y, double %z) {
 ; CHECK-LABEL: define double @test_mad_f64
 ; CHECK-SAME: (double [[X:%.*]], double [[Y:%.*]], double [[Z:%.*]]) {
-; CHECK-NEXT:    [[MAD:%.*]] = tail call double @_Z3madddd(double [[X]], double [[Y]], double [[Z]])
+; CHECK-NEXT:    [[MAD:%.*]] = tail call double @llvm.fmuladd.f64(double [[X]], double [[Y]], double [[Z]])
 ; CHECK-NEXT:    ret double [[MAD]]
 ;
   %mad = tail call double @_Z3madddd(double %x, double %y, double %z)
@@ -95,7 +95,7 @@ define double @test_mad_f64(double %x, double %y, double %z) {
 define <2 x double> @test_mad_v2f64(<2 x double> %x, <2 x double> %y, <2 x double> %z) {
 ; CHECK-LABEL: define <2 x double> @test_mad_v2f64
 ; CHECK-SAME: (<2 x double> [[X:%.*]], <2 x double> [[Y:%.*]], <2 x double> [[Z:%.*]]) {
-; CHECK-NEXT:    [[MAD:%.*]] = tail call <2 x double> @_Z3madDv2_dS_S_(<2 x double> [[X]], <2 x double> [[Y]], <2 x double> [[Z]])
+; CHECK-NEXT:    [[MAD:%.*]] = tail call <2 x double> @llvm.fmuladd.v2f64(<2 x double> [[X]], <2 x double> [[Y]], <2 x double> [[Z]])
 ; CHECK-NEXT:    ret <2 x double> [[MAD]]
 ;
   %mad = tail call <2 x double> @_Z3madDv2_dS_S_(<2 x double> %x, <2 x double> %y, <2 x double> %z)
@@ -105,7 +105,7 @@ define <2 x double> @test_mad_v2f64(<2 x double> %x, <2 x double> %y, <2 x doubl
 define <3 x double> @test_mad_v3f64(<3 x double> %x, <3 x double> %y, <3 x double> %z) {
 ; CHECK-LABEL: define <3 x double> @test_mad_v3f64
 ; CHECK-SAME: (<3 x double> [[X:%.*]], <3 x double> [[Y:%.*]], <3 x double> [[Z:%.*]]) {
-; CHECK-NEXT:    [[MAD:%.*]] = tail call <3 x double> @_Z3madDv3_dS_S_(<3 x double> [[X]], <3 x double> [[Y]], <3 x double> [[Z]])
+; CHECK-NEXT:    [[MAD:%.*]] = tail call <3 x double> @llvm.fmuladd.v3f64(<3 x double> [[X]], <3 x double> [[Y]], <3 x double> [[Z]])
 ; CHECK-NEXT:    ret <3 x double> [[MAD]]
 ;
   %mad = tail call <3 x double> @_Z3madDv3_dS_S_(<3 x double> %x, <3 x double> %y, <3 x double> %z)
@@ -115,7 +115,7 @@ define <3 x double> @test_mad_v3f64(<3 x double> %x, <3 x double> %y, <3 x doubl
 define <4 x double> @test_mad_v4f64(<4 x double> %x, <4 x double> %y, <4 x double> %z) {
 ; CHECK-LABEL: define <4 x double> @test_mad_v4f64
 ; CHECK-SAME: (<4 x double> [[X:%.*]], <4 x double> [[Y:%.*]], <4 x double> [[Z:%.*]]) {
-; CHECK-NEXT:    [[MAD:%.*]] = tail call <4 x double> @_Z3madDv4_dS_S_(<4 x double> [[X]], <4 x double> [[Y]], <4 x double> [[Z]])
+; CHECK-NEXT:    [[MAD:%.*]] = tail call <4 x double> @llvm.fmuladd.v4f64(<4 x double> [[X]], <4 x double> [[Y]], <4 x double> [[Z]])
 ; CHECK-NEXT:    ret <4 x double> [[MAD]]
 ;
   %mad = tail call <4 x double> @_Z3madDv4_dS_S_(<4 x double> %x, <4 x double> %y, <4 x double> %z)
@@ -125,7 +125,7 @@ define <4 x double> @test_mad_v4f64(<4 x double> %x, <4 x double> %y, <4 x doubl
 define <8 x double> @test_mad_v8f64(<8 x double> %x, <8 x double> %y, <8 x double> %z) {
 ; CHECK-LABEL: define <8 x double> @test_mad_v8f64
 ; CHECK-SAME: (<8 x double> [[X:%.*]], <8 x double> [[Y:%.*]], <8 x double> [[Z:%.*]]) {
-; CHECK-NEXT:    [[MAD:%.*]] = tail call <8 x double> @_Z3madDv8_dS_S_(<8 x double> [[X]], <8 x double> [[Y]], <8 x double> [[Z]])
+; CHECK-NEXT:    [[MAD:%.*]] = tail call <8 x double> @llvm.fmuladd.v8f64(<8 x double> [[X]], <8 x double> [[Y]], <8 x double> [[Z]])
 ; CHECK-NEXT:    ret <8 x double> [[MAD]]
 ;
   %mad = tail call <8 x double> @_Z3madDv8_dS_S_(<8 x double> %x, <8 x double> %y, <8 x double> %z)
@@ -135,7 +135,7 @@ define <8 x double> @test_mad_v8f64(<8 x double> %x, <8 x double> %y, <8 x doubl
 define <16 x double> @test_mad_v16f64(<16 x double> %x, <16 x double> %y, <16 x double> %z) {
 ; CHECK-LABEL: define <16 x double> @test_mad_v16f64
 ; CHECK-SAME: (<16 x double> [[X:%.*]], <16 x double> [[Y:%.*]], <16 x double> [[Z:%.*]]) {
-; CHECK-NEXT:    [[MAD:%.*]] = tail call <16 x double> @_Z3madDv16_dS_S_(<16 x double> [[X]], <16 x double> [[Y]], <16 x double> [[Z]])
+; CHECK-NEXT:    [[MAD:%.*]] = tail call <16 x double> @llvm.fmuladd.v16f64(<16 x double> [[X]], <16 x double> [[Y]], <16 x double> [[Z]])
 ; CHECK-NEXT:    ret <16 x double> [[MAD]]
 ;
   %mad = tail call <16 x double> @_Z3madDv16_dS_S_(<16 x double> %x, <16 x double> %y, <16 x double> %z)
@@ -145,7 +145,7 @@ define <16 x double> @test_mad_v16f64(<16 x double> %x, <16 x double> %y, <16 x
 define half @test_mad_f16(half %x, half %y, half %z) {
 ; CHECK-LABEL: define half @test_mad_f16
 ; CHECK-SAME: (half [[X:%.*]], half [[Y:%.*]], half [[Z:%.*]]) {
-; CHECK-NEXT:    [[MAD:%.*]] = tail call half @_Z3madDhDhDh(half [[X]], half [[Y]], half [[Z]])
+; CHECK-NEXT:    [[MAD:%.*]] = tail call half @llvm.fmuladd.f16(half [[X]], half [[Y]], half [[Z]])
 ; CHECK-NEXT:    ret half [[MAD]]
 ;
   %mad = tail call half @_Z3madDhDhDh(half %x, half %y, half %z)
@@ -155,7 +155,7 @@ define half @test_mad_f16(half %x, half %y, half %z) {
 define <2 x half> @test_mad_v2f16(<2 x half> %x, <2 x half> %y, <2 x half> %z) {
 ; CHECK-LABEL: define <2 x half> @test_mad_v2f16
 ; CHECK-SAME: (<2 x half> [[X:%.*]], <2 x half> [[Y:%.*]], <2 x half> [[Z:%.*]]) {
-; CHECK-NEXT:    [[MAD:%.*]] = tail call <2 x half> @_Z3madDv2_DhS_S_(<2 x half> [[X]], <2 x half> [[Y]], <2 x half> [[Z]])
+; CHECK-NEXT:    [[MAD:%.*]] = tail call <2 x half> @llvm.fmuladd.v2f16(<2 x half> [[X]], <2 x half> [[Y]], <2 x half> [[Z]])
 ; CHECK-NEXT:    ret <2 x half> [[MAD]]
 ;
   %mad = tail call <2 x half> @_Z3madDv2_DhS_S_(<2 x half> %x, <2 x half> %y, <2 x half> %z)
@@ -165,7 +165,7 @@ define <2 x half> @test_mad_v2f16(<2 x half> %x, <2 x half> %y, <2 x half> %z) {
 define <3 x half> @test_mad_v3f16(<3 x half> %x, <3 x half> %y, <3 x half> %z) {
 ; CHECK-LABEL: define <3 x half> @test_mad_v3f16
 ; CHECK-SAME: (<3 x half> [[X:%.*]], <3 x half> [[Y:%.*]], <3 x half> [[Z:%.*]]) {
-; CHECK-NEXT:    [[MAD:%.*]] = tail call <3 x half> @_Z3madDv3_DhS_S_(<3 x half> [[X]], <3 x half> [[Y]], <3 x half> [[Z]])
+; CHECK-NEXT:    [[MAD:%.*]] = tail call <3 x half> @llvm.fmuladd.v3f16(<3 x half> [[X]], <3 x half> [[Y]], <3 x half> [[Z]])
 ; CHECK-NEXT:    ret <3 x half> [[MAD]]
 ;
   %mad = tail call <3 x half> @_Z3madDv3_DhS_S_(<3 x half> %x, <3 x half> %y, <3 x half> %z)
@@ -175,7 +175,7 @@ define <3 x half> @test_mad_v3f16(<3 x half> %x, <3 x half> %y, <3 x half> %z) {
 define <4 x half> @test_mad_v4f16(<4 x half> %x, <4 x half> %y, <4 x half> %z) {
 ; CHECK-LABEL: define <4 x half> @test_mad_v4f16
 ; CHECK-SAME: (<4 x half> [[X:%.*]], <4 x half> [[Y:%.*]], <4 x half> [[Z:%.*]]) {
-; CHECK-NEXT:    [[MAD:%.*]] = tail call <4 x half> @_Z3madDv4_DhS_S_(<4 x half> [[X]], <4 x half> [[Y]], <4 x half> [[Z]])
+; CHECK-NEXT:    [[MAD:%.*]] = tail call <4 x half> @llvm.fmuladd.v4f16(<4 x half> [[X]], <4 x half> [[Y]], <4 x half> [[Z]])
 ; CHECK-NEXT:    ret <4 x half> [[MAD]]
 ;
   %mad = tail call <4 x half> @_Z3madDv4_DhS_S_(<4 x half> %x, <4 x half> %y, <4 x half> %z)
@@ -185,7 +185,7 @@ define <4 x half> @test_mad_v4f16(<4 x half> %x, <4 x half> %y, <4 x half> %z) {
 define <8 x half> @test_mad_v8f16(<8 x half> %x, <8 x half> %y, <8 x half> %z) {
 ; CHECK-LABEL: define <8 x half> @test_mad_v8f16
 ; CHECK-SAME: (<8 x half> [[X:%.*]], <8 x half> [[Y:%.*]], <8 x half> [[Z:%.*]]) {
-; CHECK-NEXT:    [[MAD:%.*]] = tail call <8 x half> @_Z3madDv8_DhS_S_(<8 x half> [[X]], <8 x half> [[Y]], <8 x half> [[Z]])
+; CHECK-NEXT:    [[MAD:%.*]] = tail call <8 x half> @llvm.fmuladd.v8f16(<8 x half> [[X]], <8 x half> [[Y]], <8 x half> [[Z]])
 ; CHECK-NEXT:    ret <8 x half> [[MAD]]
 ;
   %mad = tail call <8 x half> @_Z3madDv8_DhS_S_(<8 x half> %x, <8 x half> %y, <8 x half> %z)
@@ -195,7 +195,7 @@ define <8 x half> @test_mad_v8f16(<8 x half> %x, <8 x half> %y, <8 x half> %z) {
 define <16 x half> @test_mad_v16f16(<16 x half> %x, <16 x half> %y, <16 x half> %z) {
 ; CHECK-LABEL: define <16 x half> @test_mad_v16f16
 ; CHECK-SAME: (<16 x half> [[X:%.*]], <16 x half> [[Y:%.*]], <16 x half> [[Z:%.*]]) {
-; CHECK-NEXT:    [[MAD:%.*]] = tail call <16 x half> @_Z3madDv16_DhS_S_(<16 x half> [[X]], <16 x half> [[Y]], <16 x half> [[Z]])
+; CHECK-NEXT:    [[MAD:%.*]] = tail call <16 x half> @llvm.fmuladd.v16f16(<16 x half> [[X]], <16 x half> [[Y]], <16 x half> [[Z]])
 ; CHECK-NEXT:    ret <16 x half> [[MAD]]
 ;
   %mad = tail call <16 x half> @_Z3madDv16_DhS_S_(<16 x half> %x, <16 x half> %y, <16 x half> %z)
@@ -205,7 +205,7 @@ define <16 x half> @test_mad_v16f16(<16 x half> %x, <16 x half> %y, <16 x half>
 define float @test_mad_f32_fast(float %x, float %y, float %z) {
 ; CHECK-LABEL: define float @test_mad_f32_fast
 ; CHECK-SAME: (float [[X:%.*]], float [[Y:%.*]], float [[Z:%.*]]) {
-; CHECK-NEXT:    [[MAD:%.*]] = tail call fast float @_Z3madfff(float [[X]], float [[Y]], float [[Z]])
+; CHECK-NEXT:    [[MAD:%.*]] = tail call fast float @llvm.fmuladd.f32(float [[X]], float [[Y]], float [[Z]])
 ; CHECK-NEXT:    ret float [[MAD]]
 ;
   %mad = tail call fast float @_Z3madfff(float %x, float %y, float %z)
@@ -215,7 +215,7 @@ define float @test_mad_f32_fast(float %x, float %y, float %z) {
 define float @test_mad_f32_noinline(float %x, float %y, float %z) {
 ; CHECK-LABEL: define float @test_mad_f32_noinline
 ; CHECK-SAME: (float [[X:%.*]], float [[Y:%.*]], float [[Z:%.*]]) {
-; CHECK-NEXT:    [[MAD:%.*]] = tail call fast float @_Z3madfff(float [[X]], float [[Y]], float [[Z]]) #[[ATTR2:[0-9]+]]
+; CHECK-NEXT:    [[MAD:%.*]] = tail call fast float @_Z3madfff(float [[X]], float [[Y]], float [[Z]]) #[[ATTR3:[0-9]+]]
 ; CHECK-NEXT:    ret float [[MAD]]
 ;
   %mad = tail call fast float @_Z3madfff(float %x, float %y, float %z) #1
@@ -225,7 +225,7 @@ define float @test_mad_f32_noinline(float %x, float %y, float %z) {
 define float @test_mad_f32_fast_minsize(float %x, float %y, float %z) #0 {
 ; CHECK-LABEL: define float @test_mad_f32_fast_minsize
 ; CHECK-SAME: (float [[X:%.*]], float [[Y:%.*]], float [[Z:%.*]]) #[[ATTR0:[0-9]+]] {
-; CHECK-NEXT:    [[MAD:%.*]] = tail call fast float @_Z3madfff(float [[X]], float [[Y]], float [[Z]])
+; CHECK-NEXT:    [[MAD:%.*]] = tail call fast float @llvm.fmuladd.f32(float [[X]], float [[Y]], float [[Z]])
 ; CHECK-NEXT:    ret float [[MAD]]
 ;
   %mad = tail call fast float @_Z3madfff(float %x, float %y, float %z)
@@ -245,7 +245,7 @@ define float @test_mad_f32_fast_strictfp(float %x, float %y, float %z) #2 {
 define float @test_mad_f32_fast_nobuiltin(float %x, float %y, float %z) {
 ; CHECK-LABEL: define float @test_mad_f32_fast_nobuiltin
 ; CHECK-SAME: (float [[X:%.*]], float [[Y:%.*]], float [[Z:%.*]]) {
-; CHECK-NEXT:    [[MAD:%.*]] = tail call fast float @_Z3madfff(float [[X]], float [[Y]], float [[Z]]) #[[ATTR3:[0-9]+]]
+; CHECK-NEXT:    [[MAD:%.*]] = tail call fast float @_Z3madfff(float [[X]], float [[Y]], float [[Z]]) #[[ATTR4:[0-9]+]]
 ; CHECK-NEXT:    ret float [[MAD]]
 ;
   %mad = tail call fast float @_Z3madfff(float %x, float %y, float %z) #3

diff  --git a/llvm/test/CodeGen/AMDGPU/simplify-libcalls.ll b/llvm/test/CodeGen/AMDGPU/simplify-libcalls.ll
index 17617efeeac18c..5ead0c157611d7 100644
--- a/llvm/test/CodeGen/AMDGPU/simplify-libcalls.ll
+++ b/llvm/test/CodeGen/AMDGPU/simplify-libcalls.ll
@@ -471,7 +471,7 @@ entry:
 }
 
 ; GCN-LABEL: {{^}}define amdgpu_kernel void @test_fma_0x
-; GCN: %call = tail call fast float @_Z3fmafff(float 0.000000e+00, float %tmp, float %y)
+; GCN: store float %y
 define amdgpu_kernel void @test_fma_0x(ptr addrspace(1) nocapture %a, float %y) {
 entry:
   %tmp = load float, ptr addrspace(1) %a, align 4
@@ -483,7 +483,7 @@ entry:
 declare float @_Z3fmafff(float, float, float)
 
 ; GCN-LABEL: {{^}}define amdgpu_kernel void @test_fma_x0
-; GCN: %call = tail call fast float @_Z3fmafff(float %tmp, float 0.000000e+00, float %y)
+; GCN: store float %y,
 define amdgpu_kernel void @test_fma_x0(ptr addrspace(1) nocapture %a, float %y) {
 entry:
   %tmp = load float, ptr addrspace(1) %a, align 4
@@ -493,7 +493,7 @@ entry:
 }
 
 ; GCN-LABEL: {{^}}define amdgpu_kernel void @test_mad_0x
-; GCN: %call = tail call fast float @_Z3madfff(float 0.000000e+00, float %tmp, float %y)
+; GCN: store float %y,
 define amdgpu_kernel void @test_mad_0x(ptr addrspace(1) nocapture %a, float %y) {
 entry:
   %tmp = load float, ptr addrspace(1) %a, align 4
@@ -505,7 +505,7 @@ entry:
 declare float @_Z3madfff(float, float, float)
 
 ; GCN-LABEL: {{^}}define amdgpu_kernel void @test_mad_x0
-; GCN: %call = tail call fast float @_Z3madfff(float %tmp, float 0.000000e+00, float %y)
+; GCN: store float %y,
 define amdgpu_kernel void @test_mad_x0(ptr addrspace(1) nocapture %a, float %y) {
 entry:
   %tmp = load float, ptr addrspace(1) %a, align 4
@@ -515,7 +515,7 @@ entry:
 }
 
 ; GCN-LABEL: {{^}}define amdgpu_kernel void @test_fma_x1y
-; GCN: %call = tail call fast float @_Z3fmafff(float %tmp, float 1.000000e+00, float %y)
+; GCN: %call = fadd fast float %tmp, %y
 define amdgpu_kernel void @test_fma_x1y(ptr addrspace(1) nocapture %a, float %y) {
 entry:
   %tmp = load float, ptr addrspace(1) %a, align 4
@@ -525,7 +525,7 @@ entry:
 }
 
 ; GCN-LABEL: {{^}}define amdgpu_kernel void @test_fma_1xy
-; GCN: %call = tail call fast float @_Z3fmafff(float 1.000000e+00, float %tmp, float %y)
+; GCN: %call = fadd fast float %tmp, %y
 define amdgpu_kernel void @test_fma_1xy(ptr addrspace(1) nocapture %a, float %y) {
 entry:
   %tmp = load float, ptr addrspace(1) %a, align 4
@@ -535,7 +535,7 @@ entry:
 }
 
 ; GCN-LABEL: {{^}}define amdgpu_kernel void @test_fma_xy0
-; GCN: %call = tail call fast float @_Z3fmafff(float %tmp, float %tmp1, float 0.000000e+00)
+; GCN: %call = fmul fast float %tmp1, %tmp
 define amdgpu_kernel void @test_fma_xy0(ptr addrspace(1) nocapture %a) {
 entry:
   %arrayidx = getelementptr inbounds float, ptr addrspace(1) %a, i64 1
@@ -547,7 +547,7 @@ entry:
 }
 
 ; GCN-LABEL: {{^}}define amdgpu_kernel void @test_use_native_exp
-; GCN-NATIVE: call fast float @_Z10native_expf(float %tmp)
+; GCN-NATIVE: call fast float @llvm.exp.f32(float %tmp)
 define amdgpu_kernel void @test_use_native_exp(ptr addrspace(1) nocapture %a) {
 entry:
   %tmp = load float, ptr addrspace(1) %a, align 4
@@ -559,7 +559,7 @@ entry:
 declare float @_Z3expf(float)
 
 ; GCN-LABEL: {{^}}define amdgpu_kernel void @test_use_native_exp2
-; GCN-NATIVE: call fast float @_Z11native_exp2f(float %tmp)
+; GCN-NATIVE: call fast float @llvm.exp2.f32(float %tmp)
 define amdgpu_kernel void @test_use_native_exp2(ptr addrspace(1) nocapture %a) {
 entry:
   %tmp = load float, ptr addrspace(1) %a, align 4


        


More information about the llvm-commits mailing list