[llvm] d251761 - AMDGPU: Replace log libcalls with log intrinsics

Matt Arsenault via llvm-commits llvm-commits at lists.llvm.org
Tue Aug 15 07:48:57 PDT 2023


Author: Matt Arsenault
Date: 2023-08-15T10:48:46-04:00
New Revision: d2517616602a1c1918f5fb3fa9b0bc260c887637

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

LOG: AMDGPU: Replace log libcalls with log intrinsics

Added: 
    

Modified: 
    llvm/lib/Target/AMDGPU/AMDGPULibCalls.cpp
    llvm/test/CodeGen/AMDGPU/amdgpu-simplify-libcall-log.ll
    llvm/test/CodeGen/AMDGPU/amdgpu-simplify-libcall-log10.ll
    llvm/test/CodeGen/AMDGPU/amdgpu-simplify-libcall-log2.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 74aa494812b5e2..b3c6e374183739 100644
--- a/llvm/lib/Target/AMDGPU/AMDGPULibCalls.cpp
+++ b/llvm/lib/Target/AMDGPU/AMDGPULibCalls.cpp
@@ -585,7 +585,7 @@ bool AMDGPULibCalls::fold(CallInst *CI) {
 
     // Specialized optimizations for each function call.
     //
-    // TODO: Handle other simple intrinsic wrappers. Sqrt, log.
+    // TODO: Handle other simple intrinsic wrappers. Sqrt.
     //
     // TODO: Handle native functions
     switch (FInfo.getId()) {
@@ -599,6 +599,21 @@ bool AMDGPULibCalls::fold(CallInst *CI) {
         return false;
       return tryReplaceLibcallWithSimpleIntrinsic(CI, Intrinsic::exp2,
                                                   FMF.approxFunc());
+    case AMDGPULibFunc::EI_LOG:
+      if (FMF.none())
+        return false;
+      return tryReplaceLibcallWithSimpleIntrinsic(CI, Intrinsic::log,
+                                                  FMF.approxFunc());
+    case AMDGPULibFunc::EI_LOG2:
+      if (FMF.none())
+        return false;
+      return tryReplaceLibcallWithSimpleIntrinsic(CI, Intrinsic::log2,
+                                                  FMF.approxFunc());
+    case AMDGPULibFunc::EI_LOG10:
+      if (FMF.none())
+        return false;
+      return tryReplaceLibcallWithSimpleIntrinsic(CI, Intrinsic::log10,
+                                                  FMF.approxFunc());
     case AMDGPULibFunc::EI_FMIN:
       return tryReplaceLibcallWithSimpleIntrinsic(CI, Intrinsic::minnum, true,
                                                   true);

diff  --git a/llvm/test/CodeGen/AMDGPU/amdgpu-simplify-libcall-log.ll b/llvm/test/CodeGen/AMDGPU/amdgpu-simplify-libcall-log.ll
index 4b1444aedcc38d..eebdb1a35001bd 100644
--- a/llvm/test/CodeGen/AMDGPU/amdgpu-simplify-libcall-log.ll
+++ b/llvm/test/CodeGen/AMDGPU/amdgpu-simplify-libcall-log.ll
@@ -217,7 +217,7 @@ define half @test_log_f16(half %arg) {
 define half @test_log_f16_fast(half %arg) {
 ; CHECK-LABEL: define half @test_log_f16_fast
 ; CHECK-SAME: (half [[ARG:%.*]]) {
-; CHECK-NEXT:    [[LOG:%.*]] = tail call fast half @_Z3logDh(half [[ARG]])
+; CHECK-NEXT:    [[LOG:%.*]] = tail call fast half @llvm.log.f16(half [[ARG]])
 ; CHECK-NEXT:    ret half [[LOG]]
 ;
   %log = tail call fast half @_Z3logDh(half %arg)
@@ -277,7 +277,7 @@ define <16 x half> @test_log_v16f16(<16 x half> %arg) {
 define float @test_log_f32_nobuiltin_callsite(float %arg) {
 ; CHECK-LABEL: define float @test_log_f32_nobuiltin_callsite
 ; CHECK-SAME: (float [[ARG:%.*]]) {
-; CHECK-NEXT:    [[LOG:%.*]] = tail call float @_Z3logf(float [[ARG]]) #[[ATTR5:[0-9]+]], !fpmath !0
+; CHECK-NEXT:    [[LOG:%.*]] = tail call float @_Z3logf(float [[ARG]]) #[[ATTR6:[0-9]+]], !fpmath !0
 ; CHECK-NEXT:    ret float [[LOG]]
 ;
   %log = tail call float @_Z3logf(float %arg) #0, !fpmath !0
@@ -287,7 +287,7 @@ define float @test_log_f32_nobuiltin_callsite(float %arg) {
 define <2 x float> @test_log_v2f32_nobuiltin_callsite(<2 x float> %arg) {
 ; CHECK-LABEL: define <2 x float> @test_log_v2f32_nobuiltin_callsite
 ; CHECK-SAME: (<2 x float> [[ARG:%.*]]) {
-; CHECK-NEXT:    [[LOG:%.*]] = tail call <2 x float> @_Z3logDv2_f(<2 x float> [[ARG]]) #[[ATTR5]], !fpmath !0
+; CHECK-NEXT:    [[LOG:%.*]] = tail call <2 x float> @_Z3logDv2_f(<2 x float> [[ARG]]) #[[ATTR6]], !fpmath !0
 ; CHECK-NEXT:    ret <2 x float> [[LOG]]
 ;
   %log = tail call <2 x float> @_Z3logDv2_f(<2 x float> %arg) #0, !fpmath !0
@@ -297,7 +297,7 @@ define <2 x float> @test_log_v2f32_nobuiltin_callsite(<2 x float> %arg) {
 define float @test_log_cr_f32_nobuiltin_callsite(float %arg) {
 ; CHECK-LABEL: define float @test_log_cr_f32_nobuiltin_callsite
 ; CHECK-SAME: (float [[ARG:%.*]]) {
-; CHECK-NEXT:    [[LOG:%.*]] = tail call float @_Z3logf(float [[ARG]]) #[[ATTR5]]
+; CHECK-NEXT:    [[LOG:%.*]] = tail call float @_Z3logf(float [[ARG]]) #[[ATTR6]]
 ; CHECK-NEXT:    ret float [[LOG]]
 ;
   %log = tail call float @_Z3logf(float %arg) #0
@@ -307,7 +307,7 @@ define float @test_log_cr_f32_nobuiltin_callsite(float %arg) {
 define <2 x float> @test_log_cr_v2f32_nobuiltin_callsite(<2 x float> %arg) {
 ; CHECK-LABEL: define <2 x float> @test_log_cr_v2f32_nobuiltin_callsite
 ; CHECK-SAME: (<2 x float> [[ARG:%.*]]) {
-; CHECK-NEXT:    [[LOG:%.*]] = tail call <2 x float> @_Z3logDv2_f(<2 x float> [[ARG]]) #[[ATTR5]]
+; CHECK-NEXT:    [[LOG:%.*]] = tail call <2 x float> @_Z3logDv2_f(<2 x float> [[ARG]]) #[[ATTR6]]
 ; CHECK-NEXT:    ret <2 x float> [[LOG]]
 ;
   %log = tail call <2 x float> @_Z3logDv2_f(<2 x float> %arg) #0
@@ -318,7 +318,7 @@ define <2 x float> @test_log_cr_v2f32_nobuiltin_callsite(<2 x float> %arg) {
 define float @test_log_f32_nobuiltins(float %arg) #1 {
 ; CHECK-LABEL: define float @test_log_f32_nobuiltins
 ; CHECK-SAME: (float [[ARG:%.*]]) #[[ATTR0:[0-9]+]] {
-; CHECK-NEXT:    [[LOG:%.*]] = tail call float @_Z3logf(float [[ARG]]) #[[ATTR5]], !fpmath !0
+; CHECK-NEXT:    [[LOG:%.*]] = tail call float @_Z3logf(float [[ARG]]) #[[ATTR6]], !fpmath !0
 ; CHECK-NEXT:    ret float [[LOG]]
 ;
   %log = tail call float @_Z3logf(float %arg) #0, !fpmath !0
@@ -328,7 +328,7 @@ define float @test_log_f32_nobuiltins(float %arg) #1 {
 define <2 x float> @test_log_v2f32_nobuiltins(<2 x float> %arg) #1 {
 ; CHECK-LABEL: define <2 x float> @test_log_v2f32_nobuiltins
 ; CHECK-SAME: (<2 x float> [[ARG:%.*]]) #[[ATTR0]] {
-; CHECK-NEXT:    [[LOG:%.*]] = tail call <2 x float> @_Z3logDv2_f(<2 x float> [[ARG]]) #[[ATTR5]], !fpmath !0
+; CHECK-NEXT:    [[LOG:%.*]] = tail call <2 x float> @_Z3logDv2_f(<2 x float> [[ARG]]) #[[ATTR6]], !fpmath !0
 ; CHECK-NEXT:    ret <2 x float> [[LOG]]
 ;
   %log = tail call <2 x float> @_Z3logDv2_f(<2 x float> %arg) #0, !fpmath !0
@@ -338,7 +338,7 @@ define <2 x float> @test_log_v2f32_nobuiltins(<2 x float> %arg) #1 {
 define float @test_log_cr_f32_nobuiltins(float %arg) #1 {
 ; CHECK-LABEL: define float @test_log_cr_f32_nobuiltins
 ; CHECK-SAME: (float [[ARG:%.*]]) #[[ATTR0]] {
-; CHECK-NEXT:    [[LOG:%.*]] = tail call float @_Z3logf(float [[ARG]]) #[[ATTR5]]
+; CHECK-NEXT:    [[LOG:%.*]] = tail call float @_Z3logf(float [[ARG]]) #[[ATTR6]]
 ; CHECK-NEXT:    ret float [[LOG]]
 ;
   %log = tail call float @_Z3logf(float %arg) #0
@@ -348,7 +348,7 @@ define float @test_log_cr_f32_nobuiltins(float %arg) #1 {
 define <2 x float> @test_log_cr_v2f32_nobuiltins(<2 x float> %arg) #1 {
 ; CHECK-LABEL: define <2 x float> @test_log_cr_v2f32_nobuiltins
 ; CHECK-SAME: (<2 x float> [[ARG:%.*]]) #[[ATTR0]] {
-; CHECK-NEXT:    [[LOG:%.*]] = tail call <2 x float> @_Z3logDv2_f(<2 x float> [[ARG]]) #[[ATTR5]]
+; CHECK-NEXT:    [[LOG:%.*]] = tail call <2 x float> @_Z3logDv2_f(<2 x float> [[ARG]]) #[[ATTR6]]
 ; CHECK-NEXT:    ret <2 x float> [[LOG]]
 ;
   %log = tail call <2 x float> @_Z3logDv2_f(<2 x float> %arg) #0
@@ -358,7 +358,7 @@ define <2 x float> @test_log_cr_v2f32_nobuiltins(<2 x float> %arg) #1 {
 define float @test_log_f32_preserve_flags(float %arg) {
 ; CHECK-LABEL: define float @test_log_f32_preserve_flags
 ; CHECK-SAME: (float [[ARG:%.*]]) {
-; CHECK-NEXT:    [[LOG:%.*]] = tail call nnan ninf float @_Z3logf(float [[ARG]]), !fpmath !0
+; CHECK-NEXT:    [[LOG:%.*]] = tail call nnan ninf float @llvm.log.f32(float [[ARG]]), !fpmath !0
 ; CHECK-NEXT:    ret float [[LOG]]
 ;
   %log = tail call nnan ninf float @_Z3logf(float %arg), !fpmath !0
@@ -368,7 +368,7 @@ define float @test_log_f32_preserve_flags(float %arg) {
 define <2 x float> @test_log_v2f32_preserve_flags(<2 x float> %arg) {
 ; CHECK-LABEL: define <2 x float> @test_log_v2f32_preserve_flags
 ; CHECK-SAME: (<2 x float> [[ARG:%.*]]) {
-; CHECK-NEXT:    [[LOG:%.*]] = tail call nnan nsz contract <2 x float> @_Z3logDv2_f(<2 x float> [[ARG]]), !fpmath !0
+; CHECK-NEXT:    [[LOG:%.*]] = tail call nnan nsz contract <2 x float> @llvm.log.v2f32(<2 x float> [[ARG]]), !fpmath !0
 ; CHECK-NEXT:    ret <2 x float> [[LOG]]
 ;
   %log = tail call contract nsz nnan <2 x float> @_Z3logDv2_f(<2 x float> %arg), !fpmath !0
@@ -378,7 +378,7 @@ define <2 x float> @test_log_v2f32_preserve_flags(<2 x float> %arg) {
 define float @test_log_f32_preserve_flags_md(float %arg) {
 ; CHECK-LABEL: define float @test_log_f32_preserve_flags_md
 ; CHECK-SAME: (float [[ARG:%.*]]) {
-; CHECK-NEXT:    [[LOG:%.*]] = tail call nnan ninf float @_Z3logf(float [[ARG]]), !fpmath !0, !foo !1
+; CHECK-NEXT:    [[LOG:%.*]] = tail call nnan ninf float @llvm.log.f32(float [[ARG]]), !fpmath !0, !foo !1
 ; CHECK-NEXT:    ret float [[LOG]]
 ;
   %log = tail call nnan ninf float @_Z3logf(float %arg), !fpmath !0, !foo !1
@@ -388,7 +388,7 @@ define float @test_log_f32_preserve_flags_md(float %arg) {
 define <2 x float> @test_log_v2f32_preserve_flags_md(<2 x float> %arg) {
 ; CHECK-LABEL: define <2 x float> @test_log_v2f32_preserve_flags_md
 ; CHECK-SAME: (<2 x float> [[ARG:%.*]]) {
-; CHECK-NEXT:    [[LOG:%.*]] = tail call nnan nsz contract <2 x float> @_Z3logDv2_f(<2 x float> [[ARG]]), !fpmath !0, !foo !1
+; CHECK-NEXT:    [[LOG:%.*]] = tail call nnan nsz contract <2 x float> @llvm.log.v2f32(<2 x float> [[ARG]]), !fpmath !0, !foo !1
 ; CHECK-NEXT:    ret <2 x float> [[LOG]]
 ;
   %log = tail call contract nsz nnan <2 x float> @_Z3logDv2_f(<2 x float> %arg), !fpmath !0, !foo !1
@@ -398,7 +398,7 @@ define <2 x float> @test_log_v2f32_preserve_flags_md(<2 x float> %arg) {
 define float @test_log_cr_f32_preserve_flags(float %arg) {
 ; CHECK-LABEL: define float @test_log_cr_f32_preserve_flags
 ; CHECK-SAME: (float [[ARG:%.*]]) {
-; CHECK-NEXT:    [[LOG:%.*]] = tail call ninf contract float @_Z3logf(float [[ARG]])
+; CHECK-NEXT:    [[LOG:%.*]] = tail call ninf contract float @llvm.log.f32(float [[ARG]])
 ; CHECK-NEXT:    ret float [[LOG]]
 ;
   %log = tail call ninf contract float @_Z3logf(float %arg)
@@ -408,7 +408,7 @@ define float @test_log_cr_f32_preserve_flags(float %arg) {
 define <2 x float> @test_log_cr_v2f32_preserve_flags(<2 x float> %arg) {
 ; CHECK-LABEL: define <2 x float> @test_log_cr_v2f32_preserve_flags
 ; CHECK-SAME: (<2 x float> [[ARG:%.*]]) {
-; CHECK-NEXT:    [[LOG:%.*]] = tail call nnan nsz <2 x float> @_Z3logDv2_f(<2 x float> [[ARG]])
+; CHECK-NEXT:    [[LOG:%.*]] = tail call nnan nsz <2 x float> @llvm.log.v2f32(<2 x float> [[ARG]])
 ; CHECK-NEXT:    ret <2 x float> [[LOG]]
 ;
   %log = tail call nnan nsz <2 x float> @_Z3logDv2_f(<2 x float> %arg)
@@ -482,7 +482,7 @@ define double @test_libm_log_f64_fpmath(double %arg) {
 define float @test_log_f32_fast_noinline(float %arg) {
 ; CHECK-LABEL: define float @test_log_f32_fast_noinline
 ; CHECK-SAME: (float [[ARG:%.*]]) {
-; CHECK-NEXT:    [[LOG:%.*]] = tail call fast float @_Z3logf(float [[ARG]]) #[[ATTR6:[0-9]+]], !fpmath !0
+; CHECK-NEXT:    [[LOG:%.*]] = tail call fast float @_Z3logf(float [[ARG]]) #[[ATTR7:[0-9]+]], !fpmath !0
 ; CHECK-NEXT:    ret float [[LOG]]
 ;
   %log = tail call fast float @_Z3logf(float %arg) #3, !fpmath !0
@@ -492,7 +492,7 @@ define float @test_log_f32_fast_noinline(float %arg) {
 define float @test_log_f32_fast_optsize(float %arg) #4 {
 ; CHECK-LABEL: define float @test_log_f32_fast_optsize
 ; CHECK-SAME: (float [[ARG:%.*]]) #[[ATTR2:[0-9]+]] {
-; CHECK-NEXT:    [[LOG:%.*]] = tail call fast float @_Z3logf(float [[ARG]]), !fpmath !0
+; CHECK-NEXT:    [[LOG:%.*]] = tail call fast float @llvm.log.f32(float [[ARG]]), !fpmath !0
 ; CHECK-NEXT:    ret float [[LOG]]
 ;
   %log = tail call fast float @_Z3logf(float %arg), !fpmath !0
@@ -502,7 +502,7 @@ define float @test_log_f32_fast_optsize(float %arg) #4 {
 define float @test_log_f32_fast_minsize(float %arg) #5 {
 ; CHECK-LABEL: define float @test_log_f32_fast_minsize
 ; CHECK-SAME: (float [[ARG:%.*]]) #[[ATTR3:[0-9]+]] {
-; CHECK-NEXT:    [[LOG:%.*]] = tail call fast float @_Z3logf(float [[ARG]]), !fpmath !0
+; CHECK-NEXT:    [[LOG:%.*]] = tail call fast float @llvm.log.f32(float [[ARG]]), !fpmath !0
 ; CHECK-NEXT:    ret float [[LOG]]
 ;
   %log = tail call fast float @_Z3logf(float %arg), !fpmath !0
@@ -512,7 +512,7 @@ define float @test_log_f32_fast_minsize(float %arg) #5 {
 define float @test_log_f32_nsz_contract_optsize(float %arg) #4 {
 ; CHECK-LABEL: define float @test_log_f32_nsz_contract_optsize
 ; CHECK-SAME: (float [[ARG:%.*]]) #[[ATTR2]] {
-; CHECK-NEXT:    [[LOG:%.*]] = tail call nsz contract float @_Z3logf(float [[ARG]]), !fpmath !0
+; CHECK-NEXT:    [[LOG:%.*]] = tail call nsz contract float @llvm.log.f32(float [[ARG]]), !fpmath !0
 ; CHECK-NEXT:    ret float [[LOG]]
 ;
   %log = tail call nsz contract float @_Z3logf(float %arg), !fpmath !0

diff  --git a/llvm/test/CodeGen/AMDGPU/amdgpu-simplify-libcall-log10.ll b/llvm/test/CodeGen/AMDGPU/amdgpu-simplify-libcall-log10.ll
index 8338600b9efc53..35c2cc77d91cd9 100644
--- a/llvm/test/CodeGen/AMDGPU/amdgpu-simplify-libcall-log10.ll
+++ b/llvm/test/CodeGen/AMDGPU/amdgpu-simplify-libcall-log10.ll
@@ -217,7 +217,7 @@ define half @test_log10_f16(half %arg) {
 define half @test_log10_f16_fast(half %arg) {
 ; CHECK-LABEL: define half @test_log10_f16_fast
 ; CHECK-SAME: (half [[ARG:%.*]]) {
-; CHECK-NEXT:    [[LOG10:%.*]] = tail call fast half @_Z5log10Dh(half [[ARG]])
+; CHECK-NEXT:    [[LOG10:%.*]] = tail call fast half @llvm.log10.f16(half [[ARG]])
 ; CHECK-NEXT:    ret half [[LOG10]]
 ;
   %log10 = tail call fast half @_Z5log10Dh(half %arg)
@@ -277,7 +277,7 @@ define <16 x half> @test_log10_v16f16(<16 x half> %arg) {
 define float @test_log10_f32_nobuiltin_callsite(float %arg) {
 ; CHECK-LABEL: define float @test_log10_f32_nobuiltin_callsite
 ; CHECK-SAME: (float [[ARG:%.*]]) {
-; CHECK-NEXT:    [[LOG10:%.*]] = tail call float @_Z5log10f(float [[ARG]]) #[[ATTR5:[0-9]+]], !fpmath !0
+; CHECK-NEXT:    [[LOG10:%.*]] = tail call float @_Z5log10f(float [[ARG]]) #[[ATTR6:[0-9]+]], !fpmath !0
 ; CHECK-NEXT:    ret float [[LOG10]]
 ;
   %log10 = tail call float @_Z5log10f(float %arg) #0, !fpmath !0
@@ -287,7 +287,7 @@ define float @test_log10_f32_nobuiltin_callsite(float %arg) {
 define <2 x float> @test_log10_v2f32_nobuiltin_callsite(<2 x float> %arg) {
 ; CHECK-LABEL: define <2 x float> @test_log10_v2f32_nobuiltin_callsite
 ; CHECK-SAME: (<2 x float> [[ARG:%.*]]) {
-; CHECK-NEXT:    [[LOG10:%.*]] = tail call <2 x float> @_Z5log10Dv2_f(<2 x float> [[ARG]]) #[[ATTR5]], !fpmath !0
+; CHECK-NEXT:    [[LOG10:%.*]] = tail call <2 x float> @_Z5log10Dv2_f(<2 x float> [[ARG]]) #[[ATTR6]], !fpmath !0
 ; CHECK-NEXT:    ret <2 x float> [[LOG10]]
 ;
   %log10 = tail call <2 x float> @_Z5log10Dv2_f(<2 x float> %arg) #0, !fpmath !0
@@ -297,7 +297,7 @@ define <2 x float> @test_log10_v2f32_nobuiltin_callsite(<2 x float> %arg) {
 define float @test_log10_cr_f32_nobuiltin_callsite(float %arg) {
 ; CHECK-LABEL: define float @test_log10_cr_f32_nobuiltin_callsite
 ; CHECK-SAME: (float [[ARG:%.*]]) {
-; CHECK-NEXT:    [[LOG10:%.*]] = tail call float @_Z5log10f(float [[ARG]]) #[[ATTR5]]
+; CHECK-NEXT:    [[LOG10:%.*]] = tail call float @_Z5log10f(float [[ARG]]) #[[ATTR6]]
 ; CHECK-NEXT:    ret float [[LOG10]]
 ;
   %log10 = tail call float @_Z5log10f(float %arg) #0
@@ -307,7 +307,7 @@ define float @test_log10_cr_f32_nobuiltin_callsite(float %arg) {
 define <2 x float> @test_log10_cr_v2f32_nobuiltin_callsite(<2 x float> %arg) {
 ; CHECK-LABEL: define <2 x float> @test_log10_cr_v2f32_nobuiltin_callsite
 ; CHECK-SAME: (<2 x float> [[ARG:%.*]]) {
-; CHECK-NEXT:    [[LOG10:%.*]] = tail call <2 x float> @_Z5log10Dv2_f(<2 x float> [[ARG]]) #[[ATTR5]]
+; CHECK-NEXT:    [[LOG10:%.*]] = tail call <2 x float> @_Z5log10Dv2_f(<2 x float> [[ARG]]) #[[ATTR6]]
 ; CHECK-NEXT:    ret <2 x float> [[LOG10]]
 ;
   %log10 = tail call <2 x float> @_Z5log10Dv2_f(<2 x float> %arg) #0
@@ -318,7 +318,7 @@ define <2 x float> @test_log10_cr_v2f32_nobuiltin_callsite(<2 x float> %arg) {
 define float @test_log10_f32_nobuiltins(float %arg) #1 {
 ; CHECK-LABEL: define float @test_log10_f32_nobuiltins
 ; CHECK-SAME: (float [[ARG:%.*]]) #[[ATTR0:[0-9]+]] {
-; CHECK-NEXT:    [[LOG10:%.*]] = tail call float @_Z5log10f(float [[ARG]]) #[[ATTR5]], !fpmath !0
+; CHECK-NEXT:    [[LOG10:%.*]] = tail call float @_Z5log10f(float [[ARG]]) #[[ATTR6]], !fpmath !0
 ; CHECK-NEXT:    ret float [[LOG10]]
 ;
   %log10 = tail call float @_Z5log10f(float %arg) #0, !fpmath !0
@@ -328,7 +328,7 @@ define float @test_log10_f32_nobuiltins(float %arg) #1 {
 define <2 x float> @test_log10_v2f32_nobuiltins(<2 x float> %arg) #1 {
 ; CHECK-LABEL: define <2 x float> @test_log10_v2f32_nobuiltins
 ; CHECK-SAME: (<2 x float> [[ARG:%.*]]) #[[ATTR0]] {
-; CHECK-NEXT:    [[LOG10:%.*]] = tail call <2 x float> @_Z5log10Dv2_f(<2 x float> [[ARG]]) #[[ATTR5]], !fpmath !0
+; CHECK-NEXT:    [[LOG10:%.*]] = tail call <2 x float> @_Z5log10Dv2_f(<2 x float> [[ARG]]) #[[ATTR6]], !fpmath !0
 ; CHECK-NEXT:    ret <2 x float> [[LOG10]]
 ;
   %log10 = tail call <2 x float> @_Z5log10Dv2_f(<2 x float> %arg) #0, !fpmath !0
@@ -338,7 +338,7 @@ define <2 x float> @test_log10_v2f32_nobuiltins(<2 x float> %arg) #1 {
 define float @test_log10_cr_f32_nobuiltins(float %arg) #1 {
 ; CHECK-LABEL: define float @test_log10_cr_f32_nobuiltins
 ; CHECK-SAME: (float [[ARG:%.*]]) #[[ATTR0]] {
-; CHECK-NEXT:    [[LOG10:%.*]] = tail call float @_Z5log10f(float [[ARG]]) #[[ATTR5]]
+; CHECK-NEXT:    [[LOG10:%.*]] = tail call float @_Z5log10f(float [[ARG]]) #[[ATTR6]]
 ; CHECK-NEXT:    ret float [[LOG10]]
 ;
   %log10 = tail call float @_Z5log10f(float %arg) #0
@@ -348,7 +348,7 @@ define float @test_log10_cr_f32_nobuiltins(float %arg) #1 {
 define <2 x float> @test_log10_cr_v2f32_nobuiltins(<2 x float> %arg) #1 {
 ; CHECK-LABEL: define <2 x float> @test_log10_cr_v2f32_nobuiltins
 ; CHECK-SAME: (<2 x float> [[ARG:%.*]]) #[[ATTR0]] {
-; CHECK-NEXT:    [[LOG10:%.*]] = tail call <2 x float> @_Z5log10Dv2_f(<2 x float> [[ARG]]) #[[ATTR5]]
+; CHECK-NEXT:    [[LOG10:%.*]] = tail call <2 x float> @_Z5log10Dv2_f(<2 x float> [[ARG]]) #[[ATTR6]]
 ; CHECK-NEXT:    ret <2 x float> [[LOG10]]
 ;
   %log10 = tail call <2 x float> @_Z5log10Dv2_f(<2 x float> %arg) #0
@@ -358,7 +358,7 @@ define <2 x float> @test_log10_cr_v2f32_nobuiltins(<2 x float> %arg) #1 {
 define float @test_log10_f32_preserve_flags(float %arg) {
 ; CHECK-LABEL: define float @test_log10_f32_preserve_flags
 ; CHECK-SAME: (float [[ARG:%.*]]) {
-; CHECK-NEXT:    [[LOG10:%.*]] = tail call nnan ninf float @_Z5log10f(float [[ARG]]), !fpmath !0
+; CHECK-NEXT:    [[LOG10:%.*]] = tail call nnan ninf float @llvm.log10.f32(float [[ARG]]), !fpmath !0
 ; CHECK-NEXT:    ret float [[LOG10]]
 ;
   %log10 = tail call nnan ninf float @_Z5log10f(float %arg), !fpmath !0
@@ -368,7 +368,7 @@ define float @test_log10_f32_preserve_flags(float %arg) {
 define <2 x float> @test_log10_v2f32_preserve_flags(<2 x float> %arg) {
 ; CHECK-LABEL: define <2 x float> @test_log10_v2f32_preserve_flags
 ; CHECK-SAME: (<2 x float> [[ARG:%.*]]) {
-; CHECK-NEXT:    [[LOG10:%.*]] = tail call nnan nsz contract <2 x float> @_Z5log10Dv2_f(<2 x float> [[ARG]]), !fpmath !0
+; CHECK-NEXT:    [[LOG10:%.*]] = tail call nnan nsz contract <2 x float> @llvm.log10.v2f32(<2 x float> [[ARG]]), !fpmath !0
 ; CHECK-NEXT:    ret <2 x float> [[LOG10]]
 ;
   %log10 = tail call contract nsz nnan <2 x float> @_Z5log10Dv2_f(<2 x float> %arg), !fpmath !0
@@ -378,7 +378,7 @@ define <2 x float> @test_log10_v2f32_preserve_flags(<2 x float> %arg) {
 define float @test_log10_f32_preserve_flags_md(float %arg) {
 ; CHECK-LABEL: define float @test_log10_f32_preserve_flags_md
 ; CHECK-SAME: (float [[ARG:%.*]]) {
-; CHECK-NEXT:    [[LOG10:%.*]] = tail call nnan ninf float @_Z5log10f(float [[ARG]]), !fpmath !0, !foo !1
+; CHECK-NEXT:    [[LOG10:%.*]] = tail call nnan ninf float @llvm.log10.f32(float [[ARG]]), !fpmath !0, !foo !1
 ; CHECK-NEXT:    ret float [[LOG10]]
 ;
   %log10 = tail call nnan ninf float @_Z5log10f(float %arg), !fpmath !0, !foo !1
@@ -388,7 +388,7 @@ define float @test_log10_f32_preserve_flags_md(float %arg) {
 define <2 x float> @test_log10_v2f32_preserve_flags_md(<2 x float> %arg) {
 ; CHECK-LABEL: define <2 x float> @test_log10_v2f32_preserve_flags_md
 ; CHECK-SAME: (<2 x float> [[ARG:%.*]]) {
-; CHECK-NEXT:    [[LOG10:%.*]] = tail call nnan nsz contract <2 x float> @_Z5log10Dv2_f(<2 x float> [[ARG]]), !fpmath !0, !foo !1
+; CHECK-NEXT:    [[LOG10:%.*]] = tail call nnan nsz contract <2 x float> @llvm.log10.v2f32(<2 x float> [[ARG]]), !fpmath !0, !foo !1
 ; CHECK-NEXT:    ret <2 x float> [[LOG10]]
 ;
   %log10 = tail call contract nsz nnan <2 x float> @_Z5log10Dv2_f(<2 x float> %arg), !fpmath !0, !foo !1
@@ -398,7 +398,7 @@ define <2 x float> @test_log10_v2f32_preserve_flags_md(<2 x float> %arg) {
 define float @test_log10_cr_f32_preserve_flags(float %arg) {
 ; CHECK-LABEL: define float @test_log10_cr_f32_preserve_flags
 ; CHECK-SAME: (float [[ARG:%.*]]) {
-; CHECK-NEXT:    [[LOG10:%.*]] = tail call ninf contract float @_Z5log10f(float [[ARG]])
+; CHECK-NEXT:    [[LOG10:%.*]] = tail call ninf contract float @llvm.log10.f32(float [[ARG]])
 ; CHECK-NEXT:    ret float [[LOG10]]
 ;
   %log10 = tail call ninf contract float @_Z5log10f(float %arg)
@@ -408,7 +408,7 @@ define float @test_log10_cr_f32_preserve_flags(float %arg) {
 define <2 x float> @test_log10_cr_v2f32_preserve_flags(<2 x float> %arg) {
 ; CHECK-LABEL: define <2 x float> @test_log10_cr_v2f32_preserve_flags
 ; CHECK-SAME: (<2 x float> [[ARG:%.*]]) {
-; CHECK-NEXT:    [[LOG10:%.*]] = tail call nnan nsz <2 x float> @_Z5log10Dv2_f(<2 x float> [[ARG]])
+; CHECK-NEXT:    [[LOG10:%.*]] = tail call nnan nsz <2 x float> @llvm.log10.v2f32(<2 x float> [[ARG]])
 ; CHECK-NEXT:    ret <2 x float> [[LOG10]]
 ;
   %log10 = tail call nnan nsz <2 x float> @_Z5log10Dv2_f(<2 x float> %arg)
@@ -482,7 +482,7 @@ define double @test_libm_log10_f64_fpmath(double %arg) {
 define float @test_log10_f32_fast_noinline(float %arg) {
 ; CHECK-LABEL: define float @test_log10_f32_fast_noinline
 ; CHECK-SAME: (float [[ARG:%.*]]) {
-; CHECK-NEXT:    [[LOG10:%.*]] = tail call fast float @_Z5log10f(float [[ARG]]) #[[ATTR6:[0-9]+]], !fpmath !0
+; CHECK-NEXT:    [[LOG10:%.*]] = tail call fast float @_Z5log10f(float [[ARG]]) #[[ATTR7:[0-9]+]], !fpmath !0
 ; CHECK-NEXT:    ret float [[LOG10]]
 ;
   %log10 = tail call fast float @_Z5log10f(float %arg) #3, !fpmath !0
@@ -492,7 +492,7 @@ define float @test_log10_f32_fast_noinline(float %arg) {
 define float @test_log10_f32_fast_optsize(float %arg) #4 {
 ; CHECK-LABEL: define float @test_log10_f32_fast_optsize
 ; CHECK-SAME: (float [[ARG:%.*]]) #[[ATTR2:[0-9]+]] {
-; CHECK-NEXT:    [[LOG10:%.*]] = tail call fast float @_Z5log10f(float [[ARG]]), !fpmath !0
+; CHECK-NEXT:    [[LOG10:%.*]] = tail call fast float @llvm.log10.f32(float [[ARG]]), !fpmath !0
 ; CHECK-NEXT:    ret float [[LOG10]]
 ;
   %log10 = tail call fast float @_Z5log10f(float %arg), !fpmath !0
@@ -502,7 +502,7 @@ define float @test_log10_f32_fast_optsize(float %arg) #4 {
 define float @test_log10_f32_fast_minsize(float %arg) #5 {
 ; CHECK-LABEL: define float @test_log10_f32_fast_minsize
 ; CHECK-SAME: (float [[ARG:%.*]]) #[[ATTR3:[0-9]+]] {
-; CHECK-NEXT:    [[LOG10:%.*]] = tail call fast float @_Z5log10f(float [[ARG]]), !fpmath !0
+; CHECK-NEXT:    [[LOG10:%.*]] = tail call fast float @llvm.log10.f32(float [[ARG]]), !fpmath !0
 ; CHECK-NEXT:    ret float [[LOG10]]
 ;
   %log10 = tail call fast float @_Z5log10f(float %arg), !fpmath !0
@@ -512,7 +512,7 @@ define float @test_log10_f32_fast_minsize(float %arg) #5 {
 define float @test_log10_f32_nsz_contract_optsize(float %arg) #4 {
 ; CHECK-LABEL: define float @test_log10_f32_nsz_contract_optsize
 ; CHECK-SAME: (float [[ARG:%.*]]) #[[ATTR2]] {
-; CHECK-NEXT:    [[LOG10:%.*]] = tail call nsz contract float @_Z5log10f(float [[ARG]]), !fpmath !0
+; CHECK-NEXT:    [[LOG10:%.*]] = tail call nsz contract float @llvm.log10.f32(float [[ARG]]), !fpmath !0
 ; CHECK-NEXT:    ret float [[LOG10]]
 ;
   %log10 = tail call nsz contract float @_Z5log10f(float %arg), !fpmath !0
@@ -532,7 +532,7 @@ define float @test_log10_f32_nsz_contract_minsize(float %arg) #5 {
 define half @test_log10_f16_fast_minsize(half %arg) #5 {
 ; CHECK-LABEL: define half @test_log10_f16_fast_minsize
 ; CHECK-SAME: (half [[ARG:%.*]]) #[[ATTR3]] {
-; CHECK-NEXT:    [[LOG10:%.*]] = tail call fast half @_Z5log10Dh(half [[ARG]])
+; CHECK-NEXT:    [[LOG10:%.*]] = tail call fast half @llvm.log10.f16(half [[ARG]])
 ; CHECK-NEXT:    ret half [[LOG10]]
 ;
   %log10 = tail call fast half @_Z5log10Dh(half %arg)

diff  --git a/llvm/test/CodeGen/AMDGPU/amdgpu-simplify-libcall-log2.ll b/llvm/test/CodeGen/AMDGPU/amdgpu-simplify-libcall-log2.ll
index 0669dc1df08a58..af9048873b9ddd 100644
--- a/llvm/test/CodeGen/AMDGPU/amdgpu-simplify-libcall-log2.ll
+++ b/llvm/test/CodeGen/AMDGPU/amdgpu-simplify-libcall-log2.ll
@@ -217,7 +217,7 @@ define half @test_log2_f16(half %arg) {
 define half @test_log2_f16_fast(half %arg) {
 ; CHECK-LABEL: define half @test_log2_f16_fast
 ; CHECK-SAME: (half [[ARG:%.*]]) {
-; CHECK-NEXT:    [[LOG2:%.*]] = tail call fast half @_Z4log2Dh(half [[ARG]])
+; CHECK-NEXT:    [[LOG2:%.*]] = tail call fast half @llvm.log2.f16(half [[ARG]])
 ; CHECK-NEXT:    ret half [[LOG2]]
 ;
   %log2 = tail call fast half @_Z4log2Dh(half %arg)
@@ -277,7 +277,7 @@ define <16 x half> @test_log2_v16f16(<16 x half> %arg) {
 define float @test_log2_f32_nobuiltin_callsite(float %arg) {
 ; CHECK-LABEL: define float @test_log2_f32_nobuiltin_callsite
 ; CHECK-SAME: (float [[ARG:%.*]]) {
-; CHECK-NEXT:    [[LOG2:%.*]] = tail call float @_Z4log2f(float [[ARG]]) #[[ATTR5:[0-9]+]], !fpmath !0
+; CHECK-NEXT:    [[LOG2:%.*]] = tail call float @_Z4log2f(float [[ARG]]) #[[ATTR6:[0-9]+]], !fpmath !0
 ; CHECK-NEXT:    ret float [[LOG2]]
 ;
   %log2 = tail call float @_Z4log2f(float %arg) #0, !fpmath !0
@@ -287,7 +287,7 @@ define float @test_log2_f32_nobuiltin_callsite(float %arg) {
 define <2 x float> @test_log2_v2f32_nobuiltin_callsite(<2 x float> %arg) {
 ; CHECK-LABEL: define <2 x float> @test_log2_v2f32_nobuiltin_callsite
 ; CHECK-SAME: (<2 x float> [[ARG:%.*]]) {
-; CHECK-NEXT:    [[LOG2:%.*]] = tail call <2 x float> @_Z4log2Dv2_f(<2 x float> [[ARG]]) #[[ATTR5]], !fpmath !0
+; CHECK-NEXT:    [[LOG2:%.*]] = tail call <2 x float> @_Z4log2Dv2_f(<2 x float> [[ARG]]) #[[ATTR6]], !fpmath !0
 ; CHECK-NEXT:    ret <2 x float> [[LOG2]]
 ;
   %log2 = tail call <2 x float> @_Z4log2Dv2_f(<2 x float> %arg) #0, !fpmath !0
@@ -297,7 +297,7 @@ define <2 x float> @test_log2_v2f32_nobuiltin_callsite(<2 x float> %arg) {
 define float @test_log2_cr_f32_nobuiltin_callsite(float %arg) {
 ; CHECK-LABEL: define float @test_log2_cr_f32_nobuiltin_callsite
 ; CHECK-SAME: (float [[ARG:%.*]]) {
-; CHECK-NEXT:    [[LOG2:%.*]] = tail call float @_Z4log2f(float [[ARG]]) #[[ATTR5]]
+; CHECK-NEXT:    [[LOG2:%.*]] = tail call float @_Z4log2f(float [[ARG]]) #[[ATTR6]]
 ; CHECK-NEXT:    ret float [[LOG2]]
 ;
   %log2 = tail call float @_Z4log2f(float %arg) #0
@@ -307,7 +307,7 @@ define float @test_log2_cr_f32_nobuiltin_callsite(float %arg) {
 define <2 x float> @test_log2_cr_v2f32_nobuiltin_callsite(<2 x float> %arg) {
 ; CHECK-LABEL: define <2 x float> @test_log2_cr_v2f32_nobuiltin_callsite
 ; CHECK-SAME: (<2 x float> [[ARG:%.*]]) {
-; CHECK-NEXT:    [[LOG2:%.*]] = tail call <2 x float> @_Z4log2Dv2_f(<2 x float> [[ARG]]) #[[ATTR5]]
+; CHECK-NEXT:    [[LOG2:%.*]] = tail call <2 x float> @_Z4log2Dv2_f(<2 x float> [[ARG]]) #[[ATTR6]]
 ; CHECK-NEXT:    ret <2 x float> [[LOG2]]
 ;
   %log2 = tail call <2 x float> @_Z4log2Dv2_f(<2 x float> %arg) #0
@@ -318,7 +318,7 @@ define <2 x float> @test_log2_cr_v2f32_nobuiltin_callsite(<2 x float> %arg) {
 define float @test_log2_f32_nobuiltins(float %arg) #1 {
 ; CHECK-LABEL: define float @test_log2_f32_nobuiltins
 ; CHECK-SAME: (float [[ARG:%.*]]) #[[ATTR0:[0-9]+]] {
-; CHECK-NEXT:    [[LOG2:%.*]] = tail call float @_Z4log2f(float [[ARG]]) #[[ATTR5]], !fpmath !0
+; CHECK-NEXT:    [[LOG2:%.*]] = tail call float @_Z4log2f(float [[ARG]]) #[[ATTR6]], !fpmath !0
 ; CHECK-NEXT:    ret float [[LOG2]]
 ;
   %log2 = tail call float @_Z4log2f(float %arg) #0, !fpmath !0
@@ -328,7 +328,7 @@ define float @test_log2_f32_nobuiltins(float %arg) #1 {
 define <2 x float> @test_log2_v2f32_nobuiltins(<2 x float> %arg) #1 {
 ; CHECK-LABEL: define <2 x float> @test_log2_v2f32_nobuiltins
 ; CHECK-SAME: (<2 x float> [[ARG:%.*]]) #[[ATTR0]] {
-; CHECK-NEXT:    [[LOG2:%.*]] = tail call <2 x float> @_Z4log2Dv2_f(<2 x float> [[ARG]]) #[[ATTR5]], !fpmath !0
+; CHECK-NEXT:    [[LOG2:%.*]] = tail call <2 x float> @_Z4log2Dv2_f(<2 x float> [[ARG]]) #[[ATTR6]], !fpmath !0
 ; CHECK-NEXT:    ret <2 x float> [[LOG2]]
 ;
   %log2 = tail call <2 x float> @_Z4log2Dv2_f(<2 x float> %arg) #0, !fpmath !0
@@ -338,7 +338,7 @@ define <2 x float> @test_log2_v2f32_nobuiltins(<2 x float> %arg) #1 {
 define float @test_log2_cr_f32_nobuiltins(float %arg) #1 {
 ; CHECK-LABEL: define float @test_log2_cr_f32_nobuiltins
 ; CHECK-SAME: (float [[ARG:%.*]]) #[[ATTR0]] {
-; CHECK-NEXT:    [[LOG2:%.*]] = tail call float @_Z4log2f(float [[ARG]]) #[[ATTR5]]
+; CHECK-NEXT:    [[LOG2:%.*]] = tail call float @_Z4log2f(float [[ARG]]) #[[ATTR6]]
 ; CHECK-NEXT:    ret float [[LOG2]]
 ;
   %log2 = tail call float @_Z4log2f(float %arg) #0
@@ -348,7 +348,7 @@ define float @test_log2_cr_f32_nobuiltins(float %arg) #1 {
 define <2 x float> @test_log2_cr_v2f32_nobuiltins(<2 x float> %arg) #1 {
 ; CHECK-LABEL: define <2 x float> @test_log2_cr_v2f32_nobuiltins
 ; CHECK-SAME: (<2 x float> [[ARG:%.*]]) #[[ATTR0]] {
-; CHECK-NEXT:    [[LOG2:%.*]] = tail call <2 x float> @_Z4log2Dv2_f(<2 x float> [[ARG]]) #[[ATTR5]]
+; CHECK-NEXT:    [[LOG2:%.*]] = tail call <2 x float> @_Z4log2Dv2_f(<2 x float> [[ARG]]) #[[ATTR6]]
 ; CHECK-NEXT:    ret <2 x float> [[LOG2]]
 ;
   %log2 = tail call <2 x float> @_Z4log2Dv2_f(<2 x float> %arg) #0
@@ -358,7 +358,7 @@ define <2 x float> @test_log2_cr_v2f32_nobuiltins(<2 x float> %arg) #1 {
 define float @test_log2_f32_preserve_flags(float %arg) {
 ; CHECK-LABEL: define float @test_log2_f32_preserve_flags
 ; CHECK-SAME: (float [[ARG:%.*]]) {
-; CHECK-NEXT:    [[LOG2:%.*]] = tail call nnan ninf float @_Z4log2f(float [[ARG]]), !fpmath !0
+; CHECK-NEXT:    [[LOG2:%.*]] = tail call nnan ninf float @llvm.log2.f32(float [[ARG]]), !fpmath !0
 ; CHECK-NEXT:    ret float [[LOG2]]
 ;
   %log2 = tail call nnan ninf float @_Z4log2f(float %arg), !fpmath !0
@@ -368,7 +368,7 @@ define float @test_log2_f32_preserve_flags(float %arg) {
 define <2 x float> @test_log2_v2f32_preserve_flags(<2 x float> %arg) {
 ; CHECK-LABEL: define <2 x float> @test_log2_v2f32_preserve_flags
 ; CHECK-SAME: (<2 x float> [[ARG:%.*]]) {
-; CHECK-NEXT:    [[LOG2:%.*]] = tail call nnan nsz contract <2 x float> @_Z4log2Dv2_f(<2 x float> [[ARG]]), !fpmath !0
+; CHECK-NEXT:    [[LOG2:%.*]] = tail call nnan nsz contract <2 x float> @llvm.log2.v2f32(<2 x float> [[ARG]]), !fpmath !0
 ; CHECK-NEXT:    ret <2 x float> [[LOG2]]
 ;
   %log2 = tail call contract nsz nnan <2 x float> @_Z4log2Dv2_f(<2 x float> %arg), !fpmath !0
@@ -378,7 +378,7 @@ define <2 x float> @test_log2_v2f32_preserve_flags(<2 x float> %arg) {
 define float @test_log2_f32_preserve_flags_md(float %arg) {
 ; CHECK-LABEL: define float @test_log2_f32_preserve_flags_md
 ; CHECK-SAME: (float [[ARG:%.*]]) {
-; CHECK-NEXT:    [[LOG2:%.*]] = tail call nnan ninf float @_Z4log2f(float [[ARG]]), !fpmath !0, !foo !1
+; CHECK-NEXT:    [[LOG2:%.*]] = tail call nnan ninf float @llvm.log2.f32(float [[ARG]]), !fpmath !0, !foo !1
 ; CHECK-NEXT:    ret float [[LOG2]]
 ;
   %log2 = tail call nnan ninf float @_Z4log2f(float %arg), !fpmath !0, !foo !1
@@ -388,7 +388,7 @@ define float @test_log2_f32_preserve_flags_md(float %arg) {
 define <2 x float> @test_log2_v2f32_preserve_flags_md(<2 x float> %arg) {
 ; CHECK-LABEL: define <2 x float> @test_log2_v2f32_preserve_flags_md
 ; CHECK-SAME: (<2 x float> [[ARG:%.*]]) {
-; CHECK-NEXT:    [[LOG2:%.*]] = tail call nnan nsz contract <2 x float> @_Z4log2Dv2_f(<2 x float> [[ARG]]), !fpmath !0, !foo !1
+; CHECK-NEXT:    [[LOG2:%.*]] = tail call nnan nsz contract <2 x float> @llvm.log2.v2f32(<2 x float> [[ARG]]), !fpmath !0, !foo !1
 ; CHECK-NEXT:    ret <2 x float> [[LOG2]]
 ;
   %log2 = tail call contract nsz nnan <2 x float> @_Z4log2Dv2_f(<2 x float> %arg), !fpmath !0, !foo !1
@@ -398,7 +398,7 @@ define <2 x float> @test_log2_v2f32_preserve_flags_md(<2 x float> %arg) {
 define float @test_log2_cr_f32_preserve_flags(float %arg) {
 ; CHECK-LABEL: define float @test_log2_cr_f32_preserve_flags
 ; CHECK-SAME: (float [[ARG:%.*]]) {
-; CHECK-NEXT:    [[LOG2:%.*]] = tail call ninf contract float @_Z4log2f(float [[ARG]])
+; CHECK-NEXT:    [[LOG2:%.*]] = tail call ninf contract float @llvm.log2.f32(float [[ARG]])
 ; CHECK-NEXT:    ret float [[LOG2]]
 ;
   %log2 = tail call ninf contract float @_Z4log2f(float %arg)
@@ -408,7 +408,7 @@ define float @test_log2_cr_f32_preserve_flags(float %arg) {
 define <2 x float> @test_log2_cr_v2f32_preserve_flags(<2 x float> %arg) {
 ; CHECK-LABEL: define <2 x float> @test_log2_cr_v2f32_preserve_flags
 ; CHECK-SAME: (<2 x float> [[ARG:%.*]]) {
-; CHECK-NEXT:    [[LOG2:%.*]] = tail call nnan nsz <2 x float> @_Z4log2Dv2_f(<2 x float> [[ARG]])
+; CHECK-NEXT:    [[LOG2:%.*]] = tail call nnan nsz <2 x float> @llvm.log2.v2f32(<2 x float> [[ARG]])
 ; CHECK-NEXT:    ret <2 x float> [[LOG2]]
 ;
   %log2 = tail call nnan nsz <2 x float> @_Z4log2Dv2_f(<2 x float> %arg)
@@ -482,7 +482,7 @@ define double @test_libm_log2_f64_fpmath(double %arg) {
 define float @test_log2_f32_fast_noinline(float %arg) {
 ; CHECK-LABEL: define float @test_log2_f32_fast_noinline
 ; CHECK-SAME: (float [[ARG:%.*]]) {
-; CHECK-NEXT:    [[LOG2:%.*]] = tail call fast float @_Z4log2f(float [[ARG]]) #[[ATTR6:[0-9]+]], !fpmath !0
+; CHECK-NEXT:    [[LOG2:%.*]] = tail call fast float @_Z4log2f(float [[ARG]]) #[[ATTR7:[0-9]+]], !fpmath !0
 ; CHECK-NEXT:    ret float [[LOG2]]
 ;
   %log2 = tail call fast float @_Z4log2f(float %arg) #3, !fpmath !0
@@ -492,7 +492,7 @@ define float @test_log2_f32_fast_noinline(float %arg) {
 define float @test_log2_f32_fast_optsize(float %arg) #4 {
 ; CHECK-LABEL: define float @test_log2_f32_fast_optsize
 ; CHECK-SAME: (float [[ARG:%.*]]) #[[ATTR2:[0-9]+]] {
-; CHECK-NEXT:    [[LOG2:%.*]] = tail call fast float @_Z4log2f(float [[ARG]]), !fpmath !0
+; CHECK-NEXT:    [[LOG2:%.*]] = tail call fast float @llvm.log2.f32(float [[ARG]]), !fpmath !0
 ; CHECK-NEXT:    ret float [[LOG2]]
 ;
   %log2 = tail call fast float @_Z4log2f(float %arg), !fpmath !0
@@ -502,7 +502,7 @@ define float @test_log2_f32_fast_optsize(float %arg) #4 {
 define float @test_log2_f32_fast_minsize(float %arg) #5 {
 ; CHECK-LABEL: define float @test_log2_f32_fast_minsize
 ; CHECK-SAME: (float [[ARG:%.*]]) #[[ATTR3:[0-9]+]] {
-; CHECK-NEXT:    [[LOG2:%.*]] = tail call fast float @_Z4log2f(float [[ARG]]), !fpmath !0
+; CHECK-NEXT:    [[LOG2:%.*]] = tail call fast float @llvm.log2.f32(float [[ARG]]), !fpmath !0
 ; CHECK-NEXT:    ret float [[LOG2]]
 ;
   %log2 = tail call fast float @_Z4log2f(float %arg), !fpmath !0
@@ -512,7 +512,7 @@ define float @test_log2_f32_fast_minsize(float %arg) #5 {
 define float @test_log2_f32_nsz_contract_optsize(float %arg) #4 {
 ; CHECK-LABEL: define float @test_log2_f32_nsz_contract_optsize
 ; CHECK-SAME: (float [[ARG:%.*]]) #[[ATTR2]] {
-; CHECK-NEXT:    [[LOG2:%.*]] = tail call nsz contract float @_Z4log2f(float [[ARG]]), !fpmath !0
+; CHECK-NEXT:    [[LOG2:%.*]] = tail call nsz contract float @llvm.log2.f32(float [[ARG]]), !fpmath !0
 ; CHECK-NEXT:    ret float [[LOG2]]
 ;
   %log2 = tail call nsz contract float @_Z4log2f(float %arg), !fpmath !0
@@ -532,7 +532,7 @@ define float @test_log2_f32_nsz_contract_minsize(float %arg) #5 {
 define half @test_log2_f16_fast_minsize(half %arg) #5 {
 ; CHECK-LABEL: define half @test_log2_f16_fast_minsize
 ; CHECK-SAME: (half [[ARG:%.*]]) #[[ATTR3]] {
-; CHECK-NEXT:    [[LOG2:%.*]] = tail call fast half @_Z4log2Dh(half [[ARG]])
+; CHECK-NEXT:    [[LOG2:%.*]] = tail call fast half @llvm.log2.f16(half [[ARG]])
 ; CHECK-NEXT:    ret half [[LOG2]]
 ;
   %log2 = tail call fast half @_Z4log2Dh(half %arg)

diff  --git a/llvm/test/CodeGen/AMDGPU/simplify-libcalls.ll b/llvm/test/CodeGen/AMDGPU/simplify-libcalls.ll
index dd3977ff587d55..4468f8ec90faa3 100644
--- a/llvm/test/CodeGen/AMDGPU/simplify-libcalls.ll
+++ b/llvm/test/CodeGen/AMDGPU/simplify-libcalls.ll
@@ -583,7 +583,7 @@ entry:
 declare float @_Z5exp10f(float)
 
 ; GCN-LABEL: {{^}}define amdgpu_kernel void @test_use_native_log
-; GCN-NATIVE: call fast float @_Z10native_logf(float %tmp)
+; GCN-NATIVE: call fast float @llvm.log.f32(float %tmp)
 define amdgpu_kernel void @test_use_native_log(ptr addrspace(1) nocapture %a) {
 entry:
   %tmp = load float, ptr addrspace(1) %a, align 4
@@ -595,7 +595,7 @@ entry:
 declare float @_Z3logf(float)
 
 ; GCN-LABEL: {{^}}define amdgpu_kernel void @test_use_native_log2
-; GCN-NATIVE: call fast float @_Z11native_log2f(float %tmp)
+; GCN-NATIVE: call fast float @llvm.log2.f32(float %tmp)
 define amdgpu_kernel void @test_use_native_log2(ptr addrspace(1) nocapture %a) {
 entry:
   %tmp = load float, ptr addrspace(1) %a, align 4
@@ -607,7 +607,7 @@ entry:
 declare float @_Z4log2f(float)
 
 ; GCN-LABEL: {{^}}define amdgpu_kernel void @test_use_native_log10
-; GCN-NATIVE: call fast float @_Z12native_log10f(float %tmp)
+; GCN-NATIVE: call fast float @llvm.log10.f32(float %tmp)
 define amdgpu_kernel void @test_use_native_log10(ptr addrspace(1) nocapture %a) {
 entry:
   %tmp = load float, ptr addrspace(1) %a, align 4


        


More information about the llvm-commits mailing list