[llvm] r353114 - [PATCH] [TargetLibraryInfo] Update run time support for Windows
Evandro Menezes via llvm-commits
llvm-commits at lists.llvm.org
Mon Feb 4 15:29:41 PST 2019
Author: evandro
Date: Mon Feb 4 15:29:41 2019
New Revision: 353114
URL: http://llvm.org/viewvc/llvm-project?rev=353114&view=rev
Log:
[PATCH] [TargetLibraryInfo] Update run time support for Windows
It seems that the run time for Windows has changed and supports more math
functions than before. Since LLVM requires at least VS2015, I assume that
this is the run time that would be redistributed with programs built with
Clang. Thus, I based this update on the header file `math.h` that
accompanies it.
This patch addresses the PR40541. Unfortunately, I have no access to a
Windows development environment to validate it.
Modified:
llvm/trunk/lib/Analysis/TargetLibraryInfo.cpp
llvm/trunk/test/Transforms/InstCombine/double-float-shrink-1.ll
llvm/trunk/test/Transforms/InstCombine/double-float-shrink-2.ll
llvm/trunk/test/Transforms/InstCombine/pow-1.ll
llvm/trunk/test/Transforms/InstCombine/win-math.ll
Modified: llvm/trunk/lib/Analysis/TargetLibraryInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/TargetLibraryInfo.cpp?rev=353114&r1=353113&r2=353114&view=diff
==============================================================================
--- llvm/trunk/lib/Analysis/TargetLibraryInfo.cpp (original)
+++ llvm/trunk/lib/Analysis/TargetLibraryInfo.cpp Mon Feb 4 15:29:41 2019
@@ -160,7 +160,39 @@ static void initialize(TargetLibraryInfo
}
if (T.isOSWindows() && !T.isOSCygMing()) {
- // Win32 does not support long double
+ bool is64 = (T.getArch() == Triple::aarch64 ||
+ T.getArch() == Triple::x86_64);
+
+ // Win32 does not support float math functions, in general.
+ if (!is64) {
+ TLI.setUnavailable(LibFunc_acosf);
+ TLI.setUnavailable(LibFunc_asinf);
+ TLI.setUnavailable(LibFunc_atanf);
+ TLI.setUnavailable(LibFunc_atan2f);
+ TLI.setUnavailable(LibFunc_ceilf);
+ TLI.setUnavailable(LibFunc_cosf);
+ TLI.setUnavailable(LibFunc_coshf);
+ TLI.setUnavailable(LibFunc_expf);
+ TLI.setUnavailable(LibFunc_floorf);
+ TLI.setUnavailable(LibFunc_fmodf);
+ TLI.setUnavailable(LibFunc_logf);
+ TLI.setUnavailable(LibFunc_log10f);
+ TLI.setUnavailable(LibFunc_modff);
+ TLI.setUnavailable(LibFunc_powf);
+ TLI.setUnavailable(LibFunc_sinf);
+ TLI.setUnavailable(LibFunc_sinhf);
+ TLI.setUnavailable(LibFunc_sqrtf);
+ TLI.setUnavailable(LibFunc_tanf);
+ TLI.setUnavailable(LibFunc_tanhf);
+ }
+ TLI.setUnavailable(LibFunc_copysignf);
+ TLI.setUnavailable(LibFunc_fabsf);
+ TLI.setUnavailable(LibFunc_fmaxf);
+ TLI.setUnavailable(LibFunc_fminf);
+ TLI.setUnavailable(LibFunc_frexpf);
+ TLI.setUnavailable(LibFunc_ldexpf);
+
+ // Win32 does not support long double.
TLI.setUnavailable(LibFunc_acosl);
TLI.setUnavailable(LibFunc_asinl);
TLI.setUnavailable(LibFunc_atanl);
@@ -170,16 +202,15 @@ static void initialize(TargetLibraryInfo
TLI.setUnavailable(LibFunc_cosl);
TLI.setUnavailable(LibFunc_coshl);
TLI.setUnavailable(LibFunc_expl);
- TLI.setUnavailable(LibFunc_fabsf); // Win32 and Win64 both lack fabsf
TLI.setUnavailable(LibFunc_fabsl);
TLI.setUnavailable(LibFunc_floorl);
TLI.setUnavailable(LibFunc_fmaxl);
TLI.setUnavailable(LibFunc_fminl);
TLI.setUnavailable(LibFunc_fmodl);
TLI.setUnavailable(LibFunc_frexpl);
- TLI.setUnavailable(LibFunc_ldexpf);
TLI.setUnavailable(LibFunc_ldexpl);
TLI.setUnavailable(LibFunc_logl);
+ TLI.setUnavailable(LibFunc_log10l);
TLI.setUnavailable(LibFunc_modfl);
TLI.setUnavailable(LibFunc_powl);
TLI.setUnavailable(LibFunc_sinl);
@@ -188,80 +219,61 @@ static void initialize(TargetLibraryInfo
TLI.setUnavailable(LibFunc_tanl);
TLI.setUnavailable(LibFunc_tanhl);
- // Win32 only has C89 math
- TLI.setUnavailable(LibFunc_acosh);
+ // Win32 does not support C89 math functions, in general.
+ // acosh
TLI.setUnavailable(LibFunc_acoshf);
TLI.setUnavailable(LibFunc_acoshl);
- TLI.setUnavailable(LibFunc_asinh);
+ // asinh
TLI.setUnavailable(LibFunc_asinhf);
TLI.setUnavailable(LibFunc_asinhl);
- TLI.setUnavailable(LibFunc_atanh);
+ // atanh
TLI.setUnavailable(LibFunc_atanhf);
TLI.setUnavailable(LibFunc_atanhl);
TLI.setUnavailable(LibFunc_cabs);
TLI.setUnavailable(LibFunc_cabsf);
TLI.setUnavailable(LibFunc_cabsl);
- TLI.setUnavailable(LibFunc_cbrt);
+ // cbrt
TLI.setUnavailable(LibFunc_cbrtf);
TLI.setUnavailable(LibFunc_cbrtl);
- TLI.setUnavailable(LibFunc_exp2);
+ // exp2
TLI.setUnavailable(LibFunc_exp2f);
TLI.setUnavailable(LibFunc_exp2l);
- TLI.setUnavailable(LibFunc_expm1);
+ // expm1
TLI.setUnavailable(LibFunc_expm1f);
TLI.setUnavailable(LibFunc_expm1l);
- TLI.setUnavailable(LibFunc_log2);
- TLI.setUnavailable(LibFunc_log2f);
- TLI.setUnavailable(LibFunc_log2l);
- TLI.setUnavailable(LibFunc_log1p);
+ // log1p
TLI.setUnavailable(LibFunc_log1pf);
TLI.setUnavailable(LibFunc_log1pl);
- TLI.setUnavailable(LibFunc_logb);
- TLI.setUnavailable(LibFunc_logbf);
+ // log2
+ TLI.setUnavailable(LibFunc_log2f);
+ TLI.setUnavailable(LibFunc_log2l);
+ // logb
+ if (!is64)
+ TLI.setUnavailable(LibFunc_logbf);
TLI.setUnavailable(LibFunc_logbl);
- TLI.setUnavailable(LibFunc_nearbyint);
+ // nearbyint
TLI.setUnavailable(LibFunc_nearbyintf);
TLI.setUnavailable(LibFunc_nearbyintl);
- TLI.setUnavailable(LibFunc_rint);
+ // rint
TLI.setUnavailable(LibFunc_rintf);
TLI.setUnavailable(LibFunc_rintl);
- TLI.setUnavailable(LibFunc_round);
+ // round
TLI.setUnavailable(LibFunc_roundf);
TLI.setUnavailable(LibFunc_roundl);
- TLI.setUnavailable(LibFunc_trunc);
+ // trunc
TLI.setUnavailable(LibFunc_truncf);
TLI.setUnavailable(LibFunc_truncl);
- // Win32 provides some C99 math with mangled names
+ // Win32 supports some C89 and C99 math functions, but with mangled names.
TLI.setAvailableWithName(LibFunc_copysign, "_copysign");
+ if (is64)
+ TLI.setAvailableWithName(LibFunc_logbf, "_logbf");
- if (T.getArch() == Triple::x86) {
- // Win32 on x86 implements single-precision math functions as macros
- TLI.setUnavailable(LibFunc_acosf);
- TLI.setUnavailable(LibFunc_asinf);
- TLI.setUnavailable(LibFunc_atanf);
- TLI.setUnavailable(LibFunc_atan2f);
- TLI.setUnavailable(LibFunc_ceilf);
- TLI.setUnavailable(LibFunc_copysignf);
- TLI.setUnavailable(LibFunc_cosf);
- TLI.setUnavailable(LibFunc_coshf);
- TLI.setUnavailable(LibFunc_expf);
- TLI.setUnavailable(LibFunc_floorf);
- TLI.setUnavailable(LibFunc_fminf);
- TLI.setUnavailable(LibFunc_fmaxf);
- TLI.setUnavailable(LibFunc_fmodf);
- TLI.setUnavailable(LibFunc_logf);
- TLI.setUnavailable(LibFunc_log10f);
- TLI.setUnavailable(LibFunc_modff);
- TLI.setUnavailable(LibFunc_powf);
- TLI.setUnavailable(LibFunc_sinf);
- TLI.setUnavailable(LibFunc_sinhf);
- TLI.setUnavailable(LibFunc_sqrtf);
- TLI.setUnavailable(LibFunc_tanf);
- TLI.setUnavailable(LibFunc_tanhf);
- }
+ // Win32 does not support these C99 functions.
+ TLI.setUnavailable(LibFunc_atoll);
+ TLI.setUnavailable(LibFunc_llabs);
- // Win32 does *not* provide these functions, but they are
+ // Win32 does not support these functions, but they are
// generally available on POSIX-compliant systems:
TLI.setUnavailable(LibFunc_access);
TLI.setUnavailable(LibFunc_bcmp);
@@ -317,12 +329,6 @@ static void initialize(TargetLibraryInfo
TLI.setUnavailable(LibFunc_utime);
TLI.setUnavailable(LibFunc_utimes);
TLI.setUnavailable(LibFunc_write);
-
- // Win32 does *not* provide provide these functions, but they are
- // specified by C99:
- TLI.setUnavailable(LibFunc_atoll);
- TLI.setUnavailable(LibFunc_frexpf);
- TLI.setUnavailable(LibFunc_llabs);
}
switch (T.getOS()) {
Modified: llvm/trunk/test/Transforms/InstCombine/double-float-shrink-1.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/InstCombine/double-float-shrink-1.ll?rev=353114&r1=353113&r2=353114&view=diff
==============================================================================
--- llvm/trunk/test/Transforms/InstCombine/double-float-shrink-1.ll (original)
+++ llvm/trunk/test/Transforms/InstCombine/double-float-shrink-1.ll Mon Feb 4 15:29:41 2019
@@ -335,9 +335,9 @@ define double @log2_test2(float %f) {
define float @logb_test1(float %f) {
; CHECK-LABEL: @logb_test1(
-; LINUX-NEXT: [[LOGBF:%.*]] = call fast float @logbf(float [[F:%.*]])
-; LINUX-NEXT: ret float [[LOGBF]]
-; WIN96: [[LOGBF:%.*]] = call fast double @logb(double [[F:%.*]])
+; LIN64-NEXT: [[LOGBF:%.*]] = call fast float @logbf(float [[F:%.*]])
+; LIN64-NEXT: ret float [[LOGBF]]
+; WIN32: [[LOGBF:%.*]] = call fast double @logb(double [[F:%.*]])
;
%conv = fpext float %f to double
%call = call fast double @logb(double %conv)
@@ -498,9 +498,9 @@ define double @tanh_test2(float %f) {
; flags are propagated for shrunken *binary* double FP calls.
define float @max1(float %a, float %b) {
; CHECK-LABEL: @max1(
-; LIN64-NEXT: [[FMAXF:%.*]] = call arcp float @fmaxf(float [[A:%.*]], float [[B:%.*]])
-; LIN64-NEXT: ret float [[FMAXF]]
-; WIN32: [[FMAXF:%.*]] = call arcp double @fmax(double [[A:%.*]], double [[B:%.*]])
+; LINUX-NEXT: [[FMAXF:%.*]] = call arcp float @fmaxf(float [[A:%.*]], float [[B:%.*]])
+; LINUX-NEXT: ret float [[FMAXF]]
+; WIN96: [[FMAXF:%.*]] = call arcp double @fmax(double [[A:%.*]], double [[B:%.*]])
;
%c = fpext float %a to double
%d = fpext float %b to double
Modified: llvm/trunk/test/Transforms/InstCombine/double-float-shrink-2.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/InstCombine/double-float-shrink-2.ll?rev=353114&r1=353113&r2=353114&view=diff
==============================================================================
--- llvm/trunk/test/Transforms/InstCombine/double-float-shrink-2.ll (original)
+++ llvm/trunk/test/Transforms/InstCombine/double-float-shrink-2.ll Mon Feb 4 15:29:41 2019
@@ -1,10 +1,10 @@
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
-; RUN: opt < %s -instcombine -S -mtriple "i386-pc-linux" | FileCheck --check-prefixes=CHECK,DO-SIMPLIFY %s
-; RUN: opt < %s -instcombine -S -mtriple "i386-pc-win32" | FileCheck --check-prefixes=CHECK,DONT-SIMPLIFY %s
-; RUN: opt < %s -instcombine -S -mtriple "x86_64-pc-win32" | FileCheck --check-prefixes=CHECK,C89-SIMPLIFY %s
-; RUN: opt < %s -instcombine -S -mtriple "i386-pc-mingw32" | FileCheck --check-prefixes=CHECK,DO-SIMPLIFY %s
-; RUN: opt < %s -instcombine -S -mtriple "x86_64-pc-mingw32" | FileCheck --check-prefixes=CHECK,DO-SIMPLIFY %s
-; RUN: opt < %s -instcombine -S -mtriple "sparc-sun-solaris" | FileCheck --check-prefixes=CHECK,DO-SIMPLIFY %s
+; RUN: opt < %s -instcombine -S -mtriple "i386-pc-linux" | FileCheck %s
+; RUN: opt < %s -instcombine -S -mtriple "i386-pc-win32" | FileCheck %s
+; RUN: opt < %s -instcombine -S -mtriple "x86_64-pc-win32" | FileCheck %s
+; RUN: opt < %s -instcombine -S -mtriple "i386-pc-mingw32" | FileCheck %s
+; RUN: opt < %s -instcombine -S -mtriple "x86_64-pc-mingw32" | FileCheck %s
+; RUN: opt < %s -instcombine -S -mtriple "sparc-sun-solaris" | FileCheck %s
; RUN: opt < %s -instcombine -S -mtriple "x86_64-pc-win32" -enable-debugify 2>&1 | FileCheck --check-prefix=DBG-VALID %s
declare double @floor(double)
@@ -61,19 +61,8 @@ define float @test_shrink_libcall_ceil(f
define float @test_shrink_libcall_round(float %C) {
; CHECK-LABEL: @test_shrink_libcall_round(
-
-; DO-SIMPLIFY-NEXT: [[F:%.*]] = call float @llvm.round.f32(float [[C:%.*]])
-; DO-SIMPLIFY-NEXT: ret float [[F]]
-;
-; DONT-SIMPLIFY-NEXT: [[D:%.*]] = fpext float [[C:%.*]] to double
-; DONT-SIMPLIFY-NEXT: [[E:%.*]] = call double @round(double [[D]])
-; DONT-SIMPLIFY-NEXT: [[F:%.*]] = fptrunc double [[E]] to float
-; DONT-SIMPLIFY-NEXT: ret float [[F]]
-;
-; C89-SIMPLIFY-NEXT: [[D:%.*]] = fpext float [[C:%.*]] to double
-; C89-SIMPLIFY-NEXT: [[E:%.*]] = call double @round(double [[D]])
-; C89-SIMPLIFY-NEXT: [[F:%.*]] = fptrunc double [[E]] to float
-; C89-SIMPLIFY-NEXT: ret float [[F]]
+; CHECK-NEXT: [[F:%.*]] = call float @llvm.round.f32(float [[C:%.*]])
+; CHECK-NEXT: ret float [[F]]
;
%D = fpext float %C to double
; --> roundf
@@ -84,19 +73,8 @@ define float @test_shrink_libcall_round(
define float @test_shrink_libcall_nearbyint(float %C) {
; CHECK-LABEL: @test_shrink_libcall_nearbyint(
-
-; DO-SIMPLIFY-NEXT: [[F:%.*]] = call float @llvm.nearbyint.f32(float [[C:%.*]])
-; DO-SIMPLIFY-NEXT: ret float [[F]]
-;
-; DONT-SIMPLIFY-NEXT: [[D:%.*]] = fpext float [[C:%.*]] to double
-; DONT-SIMPLIFY-NEXT: [[E:%.*]] = call double @nearbyint(double [[D]])
-; DONT-SIMPLIFY-NEXT: [[F:%.*]] = fptrunc double [[E]] to float
-; DONT-SIMPLIFY-NEXT: ret float [[F]]
-;
-; C89-SIMPLIFY-NEXT: [[D:%.*]] = fpext float [[C:%.*]] to double
-; C89-SIMPLIFY-NEXT: [[E:%.*]] = call double @nearbyint(double [[D]])
-; C89-SIMPLIFY-NEXT: [[F:%.*]] = fptrunc double [[E]] to float
-; C89-SIMPLIFY-NEXT: ret float [[F]]
+; CHECK-NEXT: [[F:%.*]] = call float @llvm.nearbyint.f32(float [[C:%.*]])
+; CHECK-NEXT: ret float [[F]]
;
%D = fpext float %C to double
; --> nearbyintf
@@ -107,19 +85,8 @@ define float @test_shrink_libcall_nearby
define float @test_shrink_libcall_trunc(float %C) {
; CHECK-LABEL: @test_shrink_libcall_trunc(
-
-; DO-SIMPLIFY-NEXT: [[F:%.*]] = call float @llvm.trunc.f32(float [[C:%.*]])
-; DO-SIMPLIFY-NEXT: ret float [[F]]
-;
-; DONT-SIMPLIFY-NEXT: [[D:%.*]] = fpext float [[C:%.*]] to double
-; DONT-SIMPLIFY-NEXT: [[E:%.*]] = call double @trunc(double [[D]])
-; DONT-SIMPLIFY-NEXT: [[F:%.*]] = fptrunc double [[E]] to float
-; DONT-SIMPLIFY-NEXT: ret float [[F]]
-;
-; C89-SIMPLIFY-NEXT: [[D:%.*]] = fpext float [[C:%.*]] to double
-; C89-SIMPLIFY-NEXT: [[E:%.*]] = call double @trunc(double [[D]])
-; C89-SIMPLIFY-NEXT: [[F:%.*]] = fptrunc double [[E]] to float
-; C89-SIMPLIFY-NEXT: ret float [[F]]
+; CHECK-NEXT: [[F:%.*]] = call float @llvm.trunc.f32(float [[C:%.*]])
+; CHECK-NEXT: ret float [[F]]
;
%D = fpext float %C to double
; --> truncf
Modified: llvm/trunk/test/Transforms/InstCombine/pow-1.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/InstCombine/pow-1.ll?rev=353114&r1=353113&r2=353114&view=diff
==============================================================================
--- llvm/trunk/test/Transforms/InstCombine/pow-1.ll (original)
+++ llvm/trunk/test/Transforms/InstCombine/pow-1.ll Mon Feb 4 15:29:41 2019
@@ -73,11 +73,9 @@ define float @test_simplify3(float %x) {
define double @test_simplify3n(double %x) {
; CHECK-LABEL: @test_simplify3n(
-; ANY-NEXT: [[MUL:%.*]] = fmul double [[X:%.*]], -2.000000e+00
-; ANY-NEXT: [[EXP2:%.*]] = call double @exp2(double [[MUL]]) [[NUW_RO]]
-; ANY-NEXT: ret double [[EXP2]]
-; WIN-NEXT: [[POW:%.*]] = call double @pow(double 2.500000e-01, double [[X:%.*]])
-; WIN-NEXT: ret double [[POW]]
+; CHECK-NEXT: [[MUL:%.*]] = fmul double [[X:%.*]], -2.000000e+00
+; CHECK-NEXT: [[EXP2:%.*]] = call double @exp2(double [[MUL]]) [[NUW_RO:#[0-9]+]]
+; CHECK-NEXT: ret double [[EXP2]]
;
%retval = call double @pow(double 0.25, double %x)
ret double %retval
@@ -108,10 +106,8 @@ define <2 x double> @test_simplify3vn(<2
define double @test_simplify4(double %x) {
; CHECK-LABEL: @test_simplify4(
-; ANY-NEXT: [[EXP2:%.*]] = call double @exp2(double [[X:%.*]]) [[NUW_RO]]
-; ANY-NEXT: ret double [[EXP2]]
-; WIN-NEXT: [[POW:%.*]] = call double @pow(double 2.000000e+00, double [[X:%.*]])
-; WIN-NEXT: ret double [[POW]]
+; CHECK-NEXT: [[EXP2:%.*]] = call double @exp2(double [[X:%.*]]) [[NUW_RO]]
+; CHECK-NEXT: ret double [[EXP2]]
;
%retval = call double @pow(double 2.0, double %x)
ret double %retval
@@ -195,7 +191,7 @@ define <2 x double> @test_simplify6v(<2
define float @test_simplify7(float %x) {
; CHECK-LABEL: @test_simplify7(
; ANY-NEXT: [[SQRTF:%.*]] = call float @sqrtf(float [[X:%.*]]) [[NUW_RO]]
-; WIN-NEXT: [[SQRTF:%.*]] = call float @sqrtf(float [[X:%.*]]) [[NUW_RO:#[0-9]+]]
+; WIN-NEXT: [[SQRTF:%.*]] = call float @sqrtf(float [[X:%.*]]) [[NUW_RO]]
; CHECK-NEXT: [[ABS:%.*]] = call float @llvm.fabs.f32(float [[SQRTF]])
; CHECK-NEXT: [[ISINF:%.*]] = fcmp oeq float [[X]], 0xFFF0000000000000
; CHECK-NEXT: [[TMP1:%.*]] = select i1 [[ISINF]], float 0x7FF0000000000000, float [[ABS]]
Modified: llvm/trunk/test/Transforms/InstCombine/win-math.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/InstCombine/win-math.ll?rev=353114&r1=353113&r2=353114&view=diff
==============================================================================
--- llvm/trunk/test/Transforms/InstCombine/win-math.ll (original)
+++ llvm/trunk/test/Transforms/InstCombine/win-math.ll Mon Feb 4 15:29:41 2019
@@ -1,11 +1,11 @@
-; RUN: opt -O2 -S -mtriple=i386-pc-win32 < %s | FileCheck %s --check-prefixes=CHECK,WIN32
-; RUN: opt -O2 -S -mtriple=x86_64-pc-win32 < %s | FileCheck %s --check-prefixes=CHECK,WIN64
-; RUN: opt -O2 -S -mtriple=i386-pc-mingw32 < %s | FileCheck %s --check-prefixes=CHECK,MINGW32
-; RUN: opt -O2 -S -mtriple=x86_64-pc-mingw32 < %s | FileCheck %s --check-prefixes=CHECK,MINGW64
+; RUN: opt < %s -O2 -S -mtriple=i386-pc-win32 | FileCheck %s --check-prefixes=CHECK,WIN32
+; RUN: opt < %s -O2 -S -mtriple=x86_64-pc-win32 | FileCheck %s --check-prefixes=CHECK,WIN64
+; RUN: opt < %s -O2 -S -mtriple=i386-pc-mingw32 | FileCheck %s --check-prefixes=CHECK,MINGW32
+; RUN: opt < %s -O2 -S -mtriple=x86_64-pc-mingw32 | FileCheck %s --check-prefixes=CHECK,MINGW64
; x86 win32 msvcrt does not provide entry points for single-precision libm.
-; x86-64 win32 msvcrt does (except for fabsf)
-; msvcrt does not provide C99 math, but mingw32 does.
+; x86-64 win32 msvcrt does, but with exceptions
+; msvcrt does not provide all of C99 math, but mingw32 does.
declare double @acos(double %x)
define float @float_acos(float %x) nounwind readnone {
@@ -188,6 +188,19 @@ define float @float_log(float %x) nounwi
ret float %3
}
+declare double @logb(double %x)
+define float @float_logb(float %x) nounwind readnone {
+; CHECK-LABEL: @float_logb(
+; WIN32-NOT: float @logbf
+; WIN32: double @logb
+; WIN64-NOT: float @logbf
+; WIN64: double @logb
+ %1 = fpext float %x to double
+ %2 = call double @logb(double %1)
+ %3 = fptrunc double %2 to float
+ ret float %3
+}
+
declare double @pow(double %x, double %y)
define float @float_pow(float %x, float %y) nounwind readnone {
; CHECK-LABEL: @float_pow(
@@ -271,14 +284,14 @@ define float @float_tanh(float %x) nounw
ret float %3
}
-; win32 does not have round; mingw32 does
+; win32 does not have roundf; mingw32 does
declare double @round(double %x)
define float @float_round(float %x) nounwind readnone {
; CHECK-LABEL: @float_round(
-; WIN32-NOT: float @roundf
-; WIN32: double @round
-; WIN64-NOT: float @roundf
-; WIN64: double @round
+; WIN32-NOT: double @round
+; WIN32: float @llvm.round.f32
+; WIN64-NOT: double @round
+; WIN64: float @llvm.round.f32
; MINGW32-NOT: double @round
; MINGW32: float @llvm.round.f32
; MINGW64-NOT: double @round
@@ -291,7 +304,7 @@ define float @float_round(float %x) noun
declare float @powf(float, float)
-; win32 lacks sqrtf&fabsf, win64 lacks fabsf, but
+; win32 lacks sqrtf & fabsf, win64 lacks fabsf, but
; calls to the intrinsics can be emitted instead.
define float @float_powsqrt(float %x) nounwind readnone {
; CHECK-LABEL: @float_powsqrt(
More information about the llvm-commits
mailing list