Index: lib/Analysis/TargetLibraryInfo.cpp =================================================================== --- lib/Analysis/TargetLibraryInfo.cpp +++ lib/Analysis/TargetLibraryInfo.cpp @@ -61,6 +61,13 @@ } #endif // !NDEBUG + if (T.getArch() == Triple::r600 || + T.getArch() == Triple::amdgcn) { + TLI.setUnavailable(LibFunc::ldexp); + TLI.setUnavailable(LibFunc::ldexpf); + TLI.setUnavailable(LibFunc::ldexpl); + } + // There are no library implementations of mempcy and memset for AMD gpus and // these can be difficult to lower in the backend. if (T.getArch() == Triple::r600 || Index: test/Transforms/InstCombine/exp2-1.ll =================================================================== --- test/Transforms/InstCombine/exp2-1.ll +++ test/Transforms/InstCombine/exp2-1.ll @@ -2,6 +2,7 @@ ; ; RUN: opt < %s -instcombine -S | FileCheck %s ; RUN: opt < %s -instcombine -S -mtriple=i386-pc-win32 | FileCheck %s -check-prefix=CHECK-WIN +; RUN: opt < %s -instcombine -S -mtriple=amdgcn-unknown-unknown | FileCheck %s -check-prefix=CHECK-AMDGPU target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:128:128" @@ -82,19 +83,23 @@ define double @test_simplify9(i8 zeroext %x) { ; CHECK-LABEL: @test_simplify9( ; CHECK-WIN-LABEL: @test_simplify9( +; CHECK-AMDGPU-LABEL: @test_simplify9( %conv = uitofp i8 %x to double %ret = call double @llvm.exp2.f64(double %conv) ; CHECK: call double @ldexp ; CHECK-WIN: call double @ldexp +; CHECK-AMDGPU-NOT: call double @ldexp ret double %ret } define float @test_simplify10(i8 zeroext %x) { ; CHECK-LABEL: @test_simplify10( ; CHECK-WIN-LABEL: @test_simplify10( +; CHECK-AMDGPU-LABEL: @test_simplify10( %conv = uitofp i8 %x to float %ret = call float @llvm.exp2.f32(float %conv) ; CHECK: call float @ldexpf ; CHECK-WIN-NOT: call float @ldexpf +; CHECK-AMDGPU-NOT: call float @ldexpf ret float %ret }