}
if (T.isOSWindows() && !T.isOSCygMing()) {
- // Win32 does not support long double
+ // XXX: The earliest documentation available at the moment is for VS2015/VC19:
+ // https://docs.microsoft.com/en-us/cpp/c-runtime-library/floating-point-support?view=vs-2015
+ // XXX: In order to use an MSVCRT older than VC19,
+ // the specific library version must be explicit in the target triple,
+ // e.g., x86_64-pc-windows-msvc18.
+ bool hasPartialC99 = true;
+ if (T.isKnownWindowsMSVCEnvironment()) {
+ unsigned Major, Minor, Micro;
+ T.getEnvironmentVersion(Major, Minor, Micro);
+ hasPartialC99 = (Major == 0 || Major >= 19);
+ }
+
+ // Latest targets support C89 math functions, in part.
+ bool isARM = (T.getArch() == Triple::aarch64 ||
+ T.getArch() == Triple::arm);
+ bool hasPartialFloat = (isARM ||
+ T.getArch() == Triple::x86_64);
+
+ // Win32 does not support float C89 math functions, in general.
+ if (!hasPartialFloat) {
+ TLI.setUnavailable(LibFunc_acosf);
+ TLI.setUnavailable(LibFunc_asinf);
+ TLI.setUnavailable(LibFunc_atan2f);
+ TLI.setUnavailable(LibFunc_atanf);
+ 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_log10f);
+ TLI.setUnavailable(LibFunc_logf);
+ 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);
+ }
+ if (!isARM)
+ TLI.setUnavailable(LibFunc_fabsf);
+ TLI.setUnavailable(LibFunc_frexpf);
+ TLI.setUnavailable(LibFunc_ldexpf);
+
+ // Win32 does not support long double C89 math functions.
TLI.setUnavailable(LibFunc_acosl);
TLI.setUnavailable(LibFunc_asinl);
- TLI.setUnavailable(LibFunc_atanl);
TLI.setUnavailable(LibFunc_atan2l);
+ TLI.setUnavailable(LibFunc_atanl);
TLI.setUnavailable(LibFunc_ceill);
- TLI.setUnavailable(LibFunc_copysignl);
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_log10l);
TLI.setUnavailable(LibFunc_logl);
TLI.setUnavailable(LibFunc_modfl);
TLI.setUnavailable(LibFunc_powl);
TLI.setUnavailable(LibFunc_tanl);
TLI.setUnavailable(LibFunc_tanhl);
- // Win32 only has C89 math
- TLI.setUnavailable(LibFunc_acosh);
- TLI.setUnavailable(LibFunc_acoshf);
+ // Win32 does not fully support C99 math functions.
+ if (!hasPartialC99) {
+ TLI.setUnavailable(LibFunc_acosh);
+ TLI.setUnavailable(LibFunc_acoshf);
+ TLI.setUnavailable(LibFunc_asinh);
+ TLI.setUnavailable(LibFunc_asinhf);
+ TLI.setUnavailable(LibFunc_atanh);
+ TLI.setUnavailable(LibFunc_atanhf);
+ TLI.setAvailableWithName(LibFunc_cabs, "_cabs");
+ TLI.setUnavailable(LibFunc_cabsf);
+ TLI.setUnavailable(LibFunc_cbrt);
+ TLI.setUnavailable(LibFunc_cbrtf);
+ TLI.setAvailableWithName(LibFunc_copysign, "_copysign");
+ TLI.setAvailableWithName(LibFunc_copysignf, "_copysignf");
+ TLI.setUnavailable(LibFunc_exp2);
+ TLI.setUnavailable(LibFunc_exp2f);
+ TLI.setUnavailable(LibFunc_expm1);
+ TLI.setUnavailable(LibFunc_expm1f);
+ TLI.setUnavailable(LibFunc_fmax);
+ TLI.setUnavailable(LibFunc_fmaxf);
+ TLI.setUnavailable(LibFunc_fmin);
+ TLI.setUnavailable(LibFunc_fminf);
+ TLI.setUnavailable(LibFunc_log1p);
+ TLI.setUnavailable(LibFunc_log1pf);
+ TLI.setUnavailable(LibFunc_log2);
+ TLI.setUnavailable(LibFunc_log2f);
+ TLI.setAvailableWithName(LibFunc_logb, "_logb");
+ if (hasPartialFloat)
+ TLI.setAvailableWithName(LibFunc_logbf, "_logbf");
+ else
+ TLI.setUnavailable(LibFunc_logbf);
+ TLI.setUnavailable(LibFunc_rint);
+ TLI.setUnavailable(LibFunc_rintf);
+ TLI.setUnavailable(LibFunc_round);
+ TLI.setUnavailable(LibFunc_roundf);
+ TLI.setUnavailable(LibFunc_trunc);
+ TLI.setUnavailable(LibFunc_truncf);
+ }
+
+ // Win32 does not support long double C99 math functions.
TLI.setUnavailable(LibFunc_acoshl);
- TLI.setUnavailable(LibFunc_asinh);
- TLI.setUnavailable(LibFunc_asinhf);
TLI.setUnavailable(LibFunc_asinhl);
- TLI.setUnavailable(LibFunc_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);
- TLI.setUnavailable(LibFunc_cbrtf);
TLI.setUnavailable(LibFunc_cbrtl);
- TLI.setUnavailable(LibFunc_exp2);
- TLI.setUnavailable(LibFunc_exp2f);
+ TLI.setUnavailable(LibFunc_copysignl);
TLI.setUnavailable(LibFunc_exp2l);
- TLI.setUnavailable(LibFunc_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);
- TLI.setUnavailable(LibFunc_log1pf);
+ TLI.setUnavailable(LibFunc_fmaxl);
+ TLI.setUnavailable(LibFunc_fminl);
TLI.setUnavailable(LibFunc_log1pl);
- TLI.setUnavailable(LibFunc_logb);
- TLI.setUnavailable(LibFunc_logbf);
+ TLI.setUnavailable(LibFunc_log2l);
TLI.setUnavailable(LibFunc_logbl);
- TLI.setUnavailable(LibFunc_nearbyint);
- TLI.setUnavailable(LibFunc_nearbyintf);
TLI.setUnavailable(LibFunc_nearbyintl);
- TLI.setUnavailable(LibFunc_rint);
- TLI.setUnavailable(LibFunc_rintf);
TLI.setUnavailable(LibFunc_rintl);
- TLI.setUnavailable(LibFunc_round);
- TLI.setUnavailable(LibFunc_roundf);
TLI.setUnavailable(LibFunc_roundl);
- TLI.setUnavailable(LibFunc_trunc);
- TLI.setUnavailable(LibFunc_truncf);
TLI.setUnavailable(LibFunc_truncl);
- // Win32 provides some C99 math with mangled names
- TLI.setAvailableWithName(LibFunc_copysign, "_copysign");
-
- 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* provide these functions, but they are
- // generally available on POSIX-compliant systems:
+ // Win32 does not support these functions, but
+ // they are generally available on POSIX-compliant systems.
TLI.setUnavailable(LibFunc_access);
TLI.setUnavailable(LibFunc_bcmp);
TLI.setUnavailable(LibFunc_bcopy);
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()) {
-; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
-; RUN: opt < %s -instcombine -S | FileCheck %s
-
-target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64-S128"
-target triple = "x86_64-unknown-linux-gnu"
+; RUN: opt < %s -instcombine -S -mtriple x86_64-unknown-linux-gnu | FileCheck %s --check-prefixes=CHECK,LINUX,ISC99
+; RUN: opt < %s -instcombine -S -mtriple x86_64-pc-win32 | FileCheck %s --check-prefixes=CHECK,ISC99
+; RUN: opt < %s -instcombine -S -mtriple x86_64-pc-windows-msvc16 | FileCheck %s --check-prefixes=CHECK,MS64,ISC89
+; RUN: opt < %s -instcombine -S -mtriple i386-pc-windows-msvc | FileCheck %s --check-prefixes=CHECK,ISC99
+; RUN: opt < %s -instcombine -S -mtriple i686-pc-windows-msvc17 | FileCheck %s --check-prefixes=CHECK,MS32,ISC89
; Check for and against shrinkage when using the
; unsafe-fp-math function attribute on a math lib
define float @acos_test1(float %f) {
; CHECK-LABEL: @acos_test1(
-; CHECK-NEXT: [[ACOSF:%.*]] = call fast float @acosf(float [[F:%.*]])
-; CHECK-NEXT: ret float [[ACOSF]]
+; LINUX-NEXT: [[ACOSF:%.*]] = call fast float @acosf(float [[F:%.*]])
+; LINUX-NEXT: ret float [[ACOSF]]
+; MS32: [[ACOSF:%.*]] = call fast double @acos(double [[F:%.*]])
+; MS64-NEXT: [[ACOSF:%.*]] = call fast float @acosf(float [[F:%.*]])
;
%conv = fpext float %f to double
%call = call fast double @acos(double %conv)
define float @acosh_test1(float %f) {
; CHECK-LABEL: @acosh_test1(
-; CHECK-NEXT: [[ACOSHF:%.*]] = call fast float @acoshf(float [[F:%.*]])
-; CHECK-NEXT: ret float [[ACOSHF]]
+; ISC99-NEXT: [[ACOSHF:%.*]] = call fast float @acoshf(float [[F:%.*]])
+; ISC99-NEXT: ret float [[ACOSHF]]
+; ISC89: [[ACOSHF:%.*]] = call fast double @acosh(double [[F:%.*]])
;
%conv = fpext float %f to double
%call = call fast double @acosh(double %conv)
define float @asin_test1(float %f) {
; CHECK-LABEL: @asin_test1(
-; CHECK-NEXT: [[ASINF:%.*]] = call fast float @asinf(float [[F:%.*]])
-; CHECK-NEXT: ret float [[ASINF]]
+; LINUX-NEXT: [[ASINF:%.*]] = call fast float @asinf(float [[F:%.*]])
+; LINUX-NEXT: ret float [[ASINF]]
+; MS32: [[ASINF:%.*]] = call fast double @asin(double [[F:%.*]])
+; MS64-NEXT: [[ASINF:%.*]] = call fast float @asinf(float [[F:%.*]])
;
%conv = fpext float %f to double
%call = call fast double @asin(double %conv)
define float @asinh_test1(float %f) {
; CHECK-LABEL: @asinh_test1(
-; CHECK-NEXT: [[ASINHF:%.*]] = call fast float @asinhf(float [[F:%.*]])
-; CHECK-NEXT: ret float [[ASINHF]]
+; ISC99-NEXT: [[ASINHF:%.*]] = call fast float @asinhf(float [[F:%.*]])
+; ISC99-NEXT: ret float [[ASINHF]]
+; ISC89: [[ASINHF:%.*]] = call fast double @asinh(double [[F:%.*]])
;
%conv = fpext float %f to double
%call = call fast double @asinh(double %conv)
define float @atan_test1(float %f) {
; CHECK-LABEL: @atan_test1(
-; CHECK-NEXT: [[ATANF:%.*]] = call fast float @atanf(float [[F:%.*]])
-; CHECK-NEXT: ret float [[ATANF]]
+; LINUX-NEXT: [[ATANF:%.*]] = call fast float @atanf(float [[F:%.*]])
+; LINUX-NEXT: ret float [[ATANF]]
+; MS32: [[ATANF:%.*]] = call fast double @atan(double [[F:%.*]])
+; MS64-NEXT: [[ATANF:%.*]] = call fast float @atanf(float [[F:%.*]])
;
%conv = fpext float %f to double
%call = call fast double @atan(double %conv)
define float @atanh_test1(float %f) {
; CHECK-LABEL: @atanh_test1(
-; CHECK-NEXT: [[ATANHF:%.*]] = call fast float @atanhf(float [[F:%.*]])
-; CHECK-NEXT: ret float [[ATANHF]]
+; ISC99-NEXT: [[ATANHF:%.*]] = call fast float @atanhf(float [[F:%.*]])
+; ISC99-NEXT: ret float [[ATANHF]]
+; ISC89: [[ATANHF:%.*]] = call fast double @atanh(double [[F:%.*]])
;
%conv = fpext float %f to double
%call = call fast double @atanh(double %conv)
define float @cbrt_test1(float %f) {
; CHECK-LABEL: @cbrt_test1(
-; CHECK-NEXT: [[CBRTF:%.*]] = call fast float @cbrtf(float [[F:%.*]])
-; CHECK-NEXT: ret float [[CBRTF]]
+; ISC99-NEXT: [[CBRTF:%.*]] = call fast float @cbrtf(float [[F:%.*]])
+; ISC99-NEXT: ret float [[CBRTF]]
+; ISC89: [[CBRTF:%.*]] = call fast double @cbrt(double [[F:%.*]])
;
%conv = fpext float %f to double
%call = call fast double @cbrt(double %conv)
define float @exp_test1(float %f) {
; CHECK-LABEL: @exp_test1(
-; CHECK-NEXT: [[EXPF:%.*]] = call fast float @expf(float [[F:%.*]])
-; CHECK-NEXT: ret float [[EXPF]]
+; LINUX-NEXT: [[EXPF:%.*]] = call fast float @expf(float [[F:%.*]])
+; LINUX-NEXT: ret float [[EXPF]]
+; MS32: [[EXPF:%.*]] = call fast double @exp(double [[F:%.*]])
+; MS64-NEXT: [[EXPF:%.*]] = call fast float @expf(float [[F:%.*]])
;
%conv = fpext float %f to double
%call = call fast double @exp(double %conv)
define float @expm1_test1(float %f) {
; CHECK-LABEL: @expm1_test1(
-; CHECK-NEXT: [[EXPM1F:%.*]] = call fast float @expm1f(float [[F:%.*]])
-; CHECK-NEXT: ret float [[EXPM1F]]
+; ISC99-NEXT: [[EXPM1F:%.*]] = call fast float @expm1f(float [[F:%.*]])
+; ISC99-NEXT: ret float [[EXPM1F]]
+; ISC89: [[EXPM1F:%.*]] = call fast double @expm1(double [[F:%.*]])
;
%conv = fpext float %f to double
%call = call fast double @expm1(double %conv)
define float @log_test1(float %f) {
; CHECK-LABEL: @log_test1(
-; CHECK-NEXT: [[LOGF:%.*]] = call fast float @logf(float [[F:%.*]])
-; CHECK-NEXT: ret float [[LOGF]]
+; LINUX-NEXT: [[LOGF:%.*]] = call fast float @logf(float [[F:%.*]])
+; LINUX-NEXT: ret float [[LOGF]]
+; MS32: [[LOGF:%.*]] = call fast double @log(double [[F:%.*]])
+; MS64-NEXT: [[LOGF:%.*]] = call fast float @logf(float [[F:%.*]])
;
%conv = fpext float %f to double
%call = call fast double @log(double %conv)
define float @log10_test1(float %f) {
; CHECK-LABEL: @log10_test1(
-; CHECK-NEXT: [[LOG10F:%.*]] = call fast float @log10f(float [[F:%.*]])
-; CHECK-NEXT: ret float [[LOG10F]]
+; LINUX-NEXT: [[LOG10F:%.*]] = call fast float @log10f(float [[F:%.*]])
+; LINUX-NEXT: ret float [[LOG10F]]
+; MS32: [[LOG10F:%.*]] = call fast double @log10(double [[F:%.*]])
+; MS64-NEXT: [[LOG10F:%.*]] = call fast float @log10f(float [[F:%.*]])
;
%conv = fpext float %f to double
%call = call fast double @log10(double %conv)
define float @log1p_test1(float %f) {
; CHECK-LABEL: @log1p_test1(
-; CHECK-NEXT: [[LOG1PF:%.*]] = call fast float @log1pf(float [[F:%.*]])
-; CHECK-NEXT: ret float [[LOG1PF]]
+; ISC99-NEXT: [[LOG1PF:%.*]] = call fast float @log1pf(float [[F:%.*]])
+; ISC99-NEXT: ret float [[LOG1PF]]
+; ISC89: [[LOG1PF:%.*]] = call fast double @log1p(double [[F:%.*]])
;
%conv = fpext float %f to double
%call = call fast double @log1p(double %conv)
define float @log2_test1(float %f) {
; CHECK-LABEL: @log2_test1(
-; CHECK-NEXT: [[LOG2F:%.*]] = call fast float @log2f(float [[F:%.*]])
-; CHECK-NEXT: ret float [[LOG2F]]
+; ISC99-NEXT: [[LOG2F:%.*]] = call fast float @log2f(float [[F:%.*]])
+; ISC99-NEXT: ret float [[LOG2F]]
+; ISC89: [[LOG2F:%.*]] = call fast double @log2(double [[F:%.*]])
;
%conv = fpext float %f to double
%call = call fast double @log2(double %conv)
define float @logb_test1(float %f) {
; CHECK-LABEL: @logb_test1(
-; CHECK-NEXT: [[LOGBF:%.*]] = call fast float @logbf(float [[F:%.*]])
-; CHECK-NEXT: ret float [[LOGBF]]
+; LINUX-NEXT: [[LOGBF:%.*]] = call fast float @logbf(float [[F:%.*]])
+; LINUX-NEXT: ret float [[LOGBF]]
+; MS32: [[POWF:%.*]] = call fast double @logb(double [[F:%.*]])
+; MS64-NEXT: [[LOGBF:%.*]] = call fast float @logbf(float [[F:%.*]])
;
%conv = fpext float %f to double
%call = call fast double @logb(double %conv)
define float @pow_test1(float %f, float %g) {
; CHECK-LABEL: @pow_test1(
-; CHECK-NEXT: [[POWF:%.*]] = call fast float @powf(float %f, float %g)
-; CHECK-NEXT: ret float [[POWF]]
+; LINUX-NEXT: [[POWF:%.*]] = call fast float @powf(float %f, float %g)
+; LINUX-NEXT: ret float [[POWF]]
+; MS32: [[POWF:%.*]] = call fast double @pow(double %df, double %dg)
+; MS64-NEXT: [[POWF:%.*]] = call fast float @powf(float %f, float %g)
;
%df = fpext float %f to double
%dg = fpext float %g to double
define float @sin_test1(float %f) {
; CHECK-LABEL: @sin_test1(
-; CHECK-NEXT: [[SINF:%.*]] = call fast float @sinf(float [[F:%.*]])
-; CHECK-NEXT: ret float [[SINF]]
+; LINUX-NEXT: [[SINF:%.*]] = call fast float @sinf(float [[F:%.*]])
+; LINUX-NEXT: ret float [[SINF]]
+; MS32: [[SINF:%.*]] = call fast double @sin(double [[F:%.*]])
+; MS64-NEXT: [[SINF:%.*]] = call fast float @sinf(float [[F:%.*]])
;
%conv = fpext float %f to double
%call = call fast double @sin(double %conv)
define float @sqrt_test1(float %f) {
; CHECK-LABEL: @sqrt_test1(
-; CHECK-NEXT: [[SQRTF:%.*]] = call float @sqrtf(float [[F:%.*]])
-; CHECK-NEXT: ret float [[SQRTF]]
+; LINUX-NEXT: [[SQRTF:%.*]] = call float @sqrtf(float [[F:%.*]])
+; LINUX-NEXT: ret float [[SQRTF]]
+; MS32: [[SQRTF:%.*]] = call double @sqrt(double [[F:%.*]])
+; MS64-NEXT: [[SQRTF:%.*]] = call float @sqrtf(float [[F:%.*]])
;
%conv = fpext float %f to double
%call = call double @sqrt(double %conv)
define float @sqrt_int_test1(float %f) {
; CHECK-LABEL: @sqrt_int_test1(
-; CHECK-NEXT: [[TMP1:%.*]] = call float @llvm.sqrt.f32(float [[F:%.*]])
-; CHECK-NEXT: ret float [[TMP1]]
+; LINUX-NEXT: [[TMP1:%.*]] = call float @llvm.sqrt.f32(float [[F:%.*]])
+; LINUX-NEXT: ret float [[TMP1]]
+; MS32: [[TMP1:%.*]] = call double @llvm.sqrt.f64(double [[F:%.*]])
+; MS64-NEXT: [[TMP1:%.*]] = call float @llvm.sqrt.f32(float [[F:%.*]])
;
%conv = fpext float %f to double
%call = call double @llvm.sqrt.f64(double %conv)
define float @tan_test1(float %f) {
; CHECK-LABEL: @tan_test1(
-; CHECK-NEXT: [[TANF:%.*]] = call fast float @tanf(float [[F:%.*]])
-; CHECK-NEXT: ret float [[TANF]]
+; LINUX-NEXT: [[TANF:%.*]] = call fast float @tanf(float [[F:%.*]])
+; LINUX-NEXT: ret float [[TANF]]
+; MS32: [[TANF:%.*]] = call fast double @tan(double [[F:%.*]])
+; MS64-NEXT: [[TANF:%.*]] = call fast float @tanf(float [[F:%.*]])
;
%conv = fpext float %f to double
%call = call fast double @tan(double %conv)
}
define float @tanh_test1(float %f) {
; CHECK-LABEL: @tanh_test1(
-; CHECK-NEXT: [[TANHF:%.*]] = call fast float @tanhf(float [[F:%.*]])
-; CHECK-NEXT: ret float [[TANHF]]
+; LINUX-NEXT: [[TANHF:%.*]] = call fast float @tanhf(float [[F:%.*]])
+; LINUX-NEXT: ret float [[TANHF]]
+; MS32: [[TANHF:%.*]] = call fast double @tanh(double [[F:%.*]])
+; MS64-NEXT: [[TANHF:%.*]] = call fast float @tanhf(float [[F:%.*]])
;
%conv = fpext float %f to double
%call = call fast double @tanh(double %conv)
; flags are propagated for shrunken *binary* double FP calls.
define float @max1(float %a, float %b) {
; CHECK-LABEL: @max1(
-; CHECK-NEXT: [[FMAXF:%.*]] = call arcp float @fmaxf(float [[A:%.*]], float [[B:%.*]])
-; CHECK-NEXT: ret float [[FMAXF]]
+; ISC99-NEXT: [[FMAXF:%.*]] = call arcp float @fmaxf(float [[A:%.*]], float [[B:%.*]])
+; ISC99-NEXT: ret float [[FMAXF]]
+; ISC89: [[FMAXF:%.*]] = call arcp double @fmax(double [[A:%.*]], double [[B:%.*]])
;
%c = fpext float %a to double
%d = fpext float %b to double
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
-; RUN: opt < %s -instcombine -S -mtriple "i386-pc-linux" | FileCheck -check-prefix=ALL -check-prefix=DO-SIMPLIFY %s
-; RUN: opt < %s -instcombine -S -mtriple "i386-pc-win32" | FileCheck -check-prefix=ALL -check-prefix=DONT-SIMPLIFY %s
-; RUN: opt < %s -instcombine -S -mtriple "x86_64-pc-win32" | FileCheck -check-prefix=ALL -check-prefix=C89-SIMPLIFY %s
-; RUN: opt < %s -instcombine -S -mtriple "i386-pc-mingw32" | FileCheck -check-prefix=ALL -check-prefix=DO-SIMPLIFY %s
-; RUN: opt < %s -instcombine -S -mtriple "x86_64-pc-mingw32" | FileCheck -check-prefix=ALL -check-prefix=DO-SIMPLIFY %s
-; RUN: opt < %s -instcombine -S -mtriple "sparc-sun-solaris" | FileCheck -check-prefix=ALL -check-prefix=DO-SIMPLIFY %s
-; RUN: opt < %s -enable-debugify -instcombine -S -mtriple "x86_64-pc-win32" 2>&1 | FileCheck -check-prefix=DBG-VALID %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)
declare double @ceil(double)
declare <2 x double> @llvm.trunc.v2f64(<2 x double>)
define float @test_shrink_libcall_floor(float %C) {
-; ALL-LABEL: @test_shrink_libcall_floor(
-; ALL-NEXT: [[F:%.*]] = call float @llvm.floor.f32(float [[C:%.*]])
-; ALL-NEXT: ret float [[F]]
+; CHECK-LABEL: @test_shrink_libcall_floor(
+; CHECK-NEXT: [[F:%.*]] = call float @llvm.floor.f32(float [[C:%.*]])
+; CHECK-NEXT: ret float [[F]]
;
%D = fpext float %C to double
; --> floorf
}
define float @test_shrink_libcall_ceil(float %C) {
-; ALL-LABEL: @test_shrink_libcall_ceil(
-; ALL-NEXT: [[F:%.*]] = call float @llvm.ceil.f32(float [[C:%.*]])
-; ALL-NEXT: ret float [[F]]
+; CHECK-LABEL: @test_shrink_libcall_ceil(
+; CHECK-NEXT: [[F:%.*]] = call float @llvm.ceil.f32(float [[C:%.*]])
+; CHECK-NEXT: ret float [[F]]
;
%D = fpext float %C to double
; --> ceilf
}
define float @test_shrink_libcall_round(float %C) {
-; DO-SIMPLIFY-LABEL: @test_shrink_libcall_round(
-; DO-SIMPLIFY-NEXT: [[F:%.*]] = call float @llvm.round.f32(float [[C:%.*]])
-; DO-SIMPLIFY-NEXT: ret float [[F]]
-;
-; DONT-SIMPLIFY-LABEL: @test_shrink_libcall_round(
-; 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-LABEL: @test_shrink_libcall_round(
-; 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-LABEL: @test_shrink_libcall_round(
+; CHECK-NEXT: [[F:%.*]] = call float @llvm.round.f32(float [[C:%.*]])
+; CHECK-NEXT: ret float [[F]]
;
%D = fpext float %C to double
; --> roundf
}
define float @test_shrink_libcall_nearbyint(float %C) {
-; DO-SIMPLIFY-LABEL: @test_shrink_libcall_nearbyint(
-; DO-SIMPLIFY-NEXT: [[F:%.*]] = call float @llvm.nearbyint.f32(float [[C:%.*]])
-; DO-SIMPLIFY-NEXT: ret float [[F]]
-;
-; DONT-SIMPLIFY-LABEL: @test_shrink_libcall_nearbyint(
-; 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-LABEL: @test_shrink_libcall_nearbyint(
-; 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-LABEL: @test_shrink_libcall_nearbyint(
+; CHECK-NEXT: [[F:%.*]] = call float @llvm.nearbyint.f32(float [[C:%.*]])
+; CHECK-NEXT: ret float [[F]]
;
%D = fpext float %C to double
; --> nearbyintf
}
define float @test_shrink_libcall_trunc(float %C) {
-; DO-SIMPLIFY-LABEL: @test_shrink_libcall_trunc(
-; DO-SIMPLIFY-NEXT: [[F:%.*]] = call float @llvm.trunc.f32(float [[C:%.*]])
-; DO-SIMPLIFY-NEXT: ret float [[F]]
-;
-; DONT-SIMPLIFY-LABEL: @test_shrink_libcall_trunc(
-; 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-LABEL: @test_shrink_libcall_trunc(
-; 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-LABEL: @test_shrink_libcall_trunc(
+; CHECK-NEXT: [[F:%.*]] = call float @llvm.trunc.f32(float [[C:%.*]])
+; CHECK-NEXT: ret float [[F]]
;
%D = fpext float %C to double
; --> truncf
}
; This is replaced with the intrinsic, which does the right thing on
-; all platforms.
+; CHECK platforms.
define float @test_shrink_libcall_fabs(float %C) {
-; ALL-LABEL: @test_shrink_libcall_fabs(
-; ALL-NEXT: [[F:%.*]] = call float @llvm.fabs.f32(float [[C:%.*]])
-; ALL-NEXT: ret float [[F]]
+; CHECK-LABEL: @test_shrink_libcall_fabs(
+; CHECK-NEXT: [[F:%.*]] = call float @llvm.fabs.f32(float [[C:%.*]])
+; CHECK-NEXT: ret float [[F]]
;
%D = fpext float %C to double
%E = call double @fabs(double %D)
; Make sure fast math flags are preserved
define float @test_shrink_libcall_fabs_fast(float %C) {
-; ALL-LABEL: @test_shrink_libcall_fabs_fast(
-; ALL-NEXT: [[F:%.*]] = call fast float @llvm.fabs.f32(float [[C:%.*]])
-; ALL-NEXT: ret float [[F]]
+; CHECK-LABEL: @test_shrink_libcall_fabs_fast(
+; CHECK-NEXT: [[F:%.*]] = call fast float @llvm.fabs.f32(float [[C:%.*]])
+; CHECK-NEXT: ret float [[F]]
;
%D = fpext float %C to double
%E = call fast double @fabs(double %D)
}
define float @test_shrink_intrin_ceil(float %C) {
-; ALL-LABEL: @test_shrink_intrin_ceil(
-; ALL-NEXT: [[TMP1:%.*]] = call float @llvm.ceil.f32(float [[C:%.*]])
-; ALL-NEXT: ret float [[TMP1]]
+; CHECK-LABEL: @test_shrink_intrin_ceil(
+; CHECK-NEXT: [[TMP1:%.*]] = call float @llvm.ceil.f32(float [[C:%.*]])
+; CHECK-NEXT: ret float [[TMP1]]
;
%D = fpext float %C to double
%E = call double @llvm.ceil.f64(double %D)
}
define float @test_shrink_intrin_fabs(float %C) {
-; ALL-LABEL: @test_shrink_intrin_fabs(
-; ALL-NEXT: [[TMP1:%.*]] = call float @llvm.fabs.f32(float [[C:%.*]])
-; ALL-NEXT: ret float [[TMP1]]
+; CHECK-LABEL: @test_shrink_intrin_fabs(
+; CHECK-NEXT: [[TMP1:%.*]] = call float @llvm.fabs.f32(float [[C:%.*]])
+; CHECK-NEXT: ret float [[TMP1]]
;
%D = fpext float %C to double
%E = call double @llvm.fabs.f64(double %D)
}
define float @test_shrink_intrin_floor(float %C) {
-; ALL-LABEL: @test_shrink_intrin_floor(
-; ALL-NEXT: [[TMP1:%.*]] = call float @llvm.floor.f32(float [[C:%.*]])
-; ALL-NEXT: ret float [[TMP1]]
+; CHECK-LABEL: @test_shrink_intrin_floor(
+; CHECK-NEXT: [[TMP1:%.*]] = call float @llvm.floor.f32(float [[C:%.*]])
+; CHECK-NEXT: ret float [[TMP1]]
;
%D = fpext float %C to double
%E = call double @llvm.floor.f64(double %D)
}
define float @test_shrink_intrin_nearbyint(float %C) {
-; ALL-LABEL: @test_shrink_intrin_nearbyint(
-; ALL-NEXT: [[TMP1:%.*]] = call float @llvm.nearbyint.f32(float [[C:%.*]])
-; ALL-NEXT: ret float [[TMP1]]
+; CHECK-LABEL: @test_shrink_intrin_nearbyint(
+; CHECK-NEXT: [[TMP1:%.*]] = call float @llvm.nearbyint.f32(float [[C:%.*]])
+; CHECK-NEXT: ret float [[TMP1]]
;
%D = fpext float %C to double
%E = call double @llvm.nearbyint.f64(double %D)
}
define half @test_shrink_intrin_rint(half %C) {
-; ALL-LABEL: @test_shrink_intrin_rint(
-; ALL-NEXT: [[TMP1:%.*]] = call half @llvm.rint.f16(half [[C:%.*]])
-; ALL-NEXT: ret half [[TMP1]]
+; CHECK-LABEL: @test_shrink_intrin_rint(
+; CHECK-NEXT: [[TMP1:%.*]] = call half @llvm.rint.f16(half [[C:%.*]])
+; CHECK-NEXT: ret half [[TMP1]]
;
%D = fpext half %C to float
%E = call float @llvm.rint.f32(float %D)
}
define float @test_shrink_intrin_round(float %C) {
-; ALL-LABEL: @test_shrink_intrin_round(
-; ALL-NEXT: [[TMP1:%.*]] = call float @llvm.round.f32(float [[C:%.*]])
-; ALL-NEXT: ret float [[TMP1]]
+; CHECK-LABEL: @test_shrink_intrin_round(
+; CHECK-NEXT: [[TMP1:%.*]] = call float @llvm.round.f32(float [[C:%.*]])
+; CHECK-NEXT: ret float [[TMP1]]
;
%D = fpext float %C to double
%E = call double @llvm.round.f64(double %D)
}
define float @test_shrink_intrin_trunc(float %C) {
-; ALL-LABEL: @test_shrink_intrin_trunc(
-; ALL-NEXT: [[TMP1:%.*]] = call float @llvm.trunc.f32(float [[C:%.*]])
-; ALL-NEXT: ret float [[TMP1]]
+; CHECK-LABEL: @test_shrink_intrin_trunc(
+; CHECK-NEXT: [[TMP1:%.*]] = call float @llvm.trunc.f32(float [[C:%.*]])
+; CHECK-NEXT: ret float [[TMP1]]
;
%D = fpext float %C to double
%E = call double @llvm.trunc.f64(double %D)
declare void @use_v2f32(<2 x float>)
define <2 x float> @test_shrink_intrin_ceil_multi_use(<2 x float> %C) {
-; ALL-LABEL: @test_shrink_intrin_ceil_multi_use(
-; ALL-NEXT: [[D:%.*]] = fpext <2 x float> [[C:%.*]] to <2 x double>
-; ALL-NEXT: [[E:%.*]] = call <2 x double> @llvm.ceil.v2f64(<2 x double> [[D]])
-; ALL-NEXT: [[F:%.*]] = fptrunc <2 x double> [[E]] to <2 x float>
-; ALL-NEXT: call void @use_v2f64(<2 x double> [[D]])
-; ALL-NEXT: ret <2 x float> [[F]]
+; CHECK-LABEL: @test_shrink_intrin_ceil_multi_use(
+; CHECK-NEXT: [[D:%.*]] = fpext <2 x float> [[C:%.*]] to <2 x double>
+; CHECK-NEXT: [[E:%.*]] = call <2 x double> @llvm.ceil.v2f64(<2 x double> [[D]])
+; CHECK-NEXT: [[F:%.*]] = fptrunc <2 x double> [[E]] to <2 x float>
+; CHECK-NEXT: call void @use_v2f64(<2 x double> [[D]])
+; CHECK-NEXT: ret <2 x float> [[F]]
;
%D = fpext <2 x float> %C to <2 x double>
%E = call <2 x double> @llvm.ceil.v2f64(<2 x double> %D)
}
define <2 x float> @test_shrink_intrin_fabs_multi_use(<2 x float> %C) {
-; ALL-LABEL: @test_shrink_intrin_fabs_multi_use(
-; ALL-NEXT: [[TMP1:%.*]] = call <2 x float> @llvm.fabs.v2f32(<2 x float> [[C:%.*]])
-; ALL-NEXT: [[E:%.*]] = fpext <2 x float> [[TMP1]] to <2 x double>
-; ALL-NEXT: call void @use_v2f64(<2 x double> [[E]])
-; ALL-NEXT: ret <2 x float> [[TMP1]]
+; CHECK-LABEL: @test_shrink_intrin_fabs_multi_use(
+; CHECK-NEXT: [[TMP1:%.*]] = call <2 x float> @llvm.fabs.v2f32(<2 x float> [[C:%.*]])
+; CHECK-NEXT: [[E:%.*]] = fpext <2 x float> [[TMP1]] to <2 x double>
+; CHECK-NEXT: call void @use_v2f64(<2 x double> [[E]])
+; CHECK-NEXT: ret <2 x float> [[TMP1]]
;
%D = fpext <2 x float> %C to <2 x double>
%E = call <2 x double> @llvm.fabs.v2f64(<2 x double> %D)
}
define <2 x float> @test_shrink_intrin_floor_multi_use(<2 x float> %C) {
-; ALL-LABEL: @test_shrink_intrin_floor_multi_use(
-; ALL-NEXT: [[D:%.*]] = fpext <2 x float> [[C:%.*]] to <2 x double>
-; ALL-NEXT: [[E:%.*]] = call <2 x double> @llvm.floor.v2f64(<2 x double> [[D]])
-; ALL-NEXT: [[F:%.*]] = fptrunc <2 x double> [[E]] to <2 x float>
-; ALL-NEXT: call void @use_v2f64(<2 x double> [[D]])
-; ALL-NEXT: call void @use_v2f64(<2 x double> [[E]])
-; ALL-NEXT: ret <2 x float> [[F]]
+; CHECK-LABEL: @test_shrink_intrin_floor_multi_use(
+; CHECK-NEXT: [[D:%.*]] = fpext <2 x float> [[C:%.*]] to <2 x double>
+; CHECK-NEXT: [[E:%.*]] = call <2 x double> @llvm.floor.v2f64(<2 x double> [[D]])
+; CHECK-NEXT: [[F:%.*]] = fptrunc <2 x double> [[E]] to <2 x float>
+; CHECK-NEXT: call void @use_v2f64(<2 x double> [[D]])
+; CHECK-NEXT: call void @use_v2f64(<2 x double> [[E]])
+; CHECK-NEXT: ret <2 x float> [[F]]
;
%D = fpext <2 x float> %C to <2 x double>
%E = call <2 x double> @llvm.floor.v2f64(<2 x double> %D)
}
define <2 x float> @test_shrink_intrin_nearbyint_multi_use(<2 x float> %C) {
-; ALL-LABEL: @test_shrink_intrin_nearbyint_multi_use(
-; ALL-NEXT: [[D:%.*]] = fpext <2 x float> [[C:%.*]] to <2 x double>
-; ALL-NEXT: [[E:%.*]] = call <2 x double> @llvm.nearbyint.v2f64(<2 x double> [[D]])
-; ALL-NEXT: [[F:%.*]] = fptrunc <2 x double> [[E]] to <2 x float>
-; ALL-NEXT: call void @use_v2f64(<2 x double> [[D]])
-; ALL-NEXT: ret <2 x float> [[F]]
+; CHECK-LABEL: @test_shrink_intrin_nearbyint_multi_use(
+; CHECK-NEXT: [[D:%.*]] = fpext <2 x float> [[C:%.*]] to <2 x double>
+; CHECK-NEXT: [[E:%.*]] = call <2 x double> @llvm.nearbyint.v2f64(<2 x double> [[D]])
+; CHECK-NEXT: [[F:%.*]] = fptrunc <2 x double> [[E]] to <2 x float>
+; CHECK-NEXT: call void @use_v2f64(<2 x double> [[D]])
+; CHECK-NEXT: ret <2 x float> [[F]]
;
%D = fpext <2 x float> %C to <2 x double>
%E = call <2 x double> @llvm.nearbyint.v2f64(<2 x double> %D)
}
define <2 x half> @test_shrink_intrin_rint_multi_use(<2 x half> %C) {
-; ALL-LABEL: @test_shrink_intrin_rint_multi_use(
-; ALL-NEXT: [[TMP1:%.*]] = call <2 x half> @llvm.rint.v2f16(<2 x half> [[C:%.*]])
-; ALL-NEXT: [[E:%.*]] = fpext <2 x half> [[TMP1]] to <2 x float>
-; ALL-NEXT: call void @use_v2f32(<2 x float> [[E]])
-; ALL-NEXT: ret <2 x half> [[TMP1]]
+; CHECK-LABEL: @test_shrink_intrin_rint_multi_use(
+; CHECK-NEXT: [[TMP1:%.*]] = call <2 x half> @llvm.rint.v2f16(<2 x half> [[C:%.*]])
+; CHECK-NEXT: [[E:%.*]] = fpext <2 x half> [[TMP1]] to <2 x float>
+; CHECK-NEXT: call void @use_v2f32(<2 x float> [[E]])
+; CHECK-NEXT: ret <2 x half> [[TMP1]]
;
%D = fpext <2 x half> %C to <2 x float>
%E = call <2 x float> @llvm.rint.v2f32(<2 x float> %D)
}
define <2 x float> @test_shrink_intrin_round_multi_use(<2 x float> %C) {
-; ALL-LABEL: @test_shrink_intrin_round_multi_use(
-; ALL-NEXT: [[D:%.*]] = fpext <2 x float> [[C:%.*]] to <2 x double>
-; ALL-NEXT: [[E:%.*]] = call <2 x double> @llvm.round.v2f64(<2 x double> [[D]])
-; ALL-NEXT: [[F:%.*]] = fptrunc <2 x double> [[E]] to <2 x float>
-; ALL-NEXT: call void @use_v2f64(<2 x double> [[D]])
-; ALL-NEXT: call void @use_v2f64(<2 x double> [[E]])
-; ALL-NEXT: ret <2 x float> [[F]]
+; CHECK-LABEL: @test_shrink_intrin_round_multi_use(
+; CHECK-NEXT: [[D:%.*]] = fpext <2 x float> [[C:%.*]] to <2 x double>
+; CHECK-NEXT: [[E:%.*]] = call <2 x double> @llvm.round.v2f64(<2 x double> [[D]])
+; CHECK-NEXT: [[F:%.*]] = fptrunc <2 x double> [[E]] to <2 x float>
+; CHECK-NEXT: call void @use_v2f64(<2 x double> [[D]])
+; CHECK-NEXT: call void @use_v2f64(<2 x double> [[E]])
+; CHECK-NEXT: ret <2 x float> [[F]]
;
%D = fpext <2 x float> %C to <2 x double>
%E = call <2 x double> @llvm.round.v2f64(<2 x double> %D)
}
define <2 x float> @test_shrink_intrin_trunc_multi_use(<2 x float> %C) {
-; ALL-LABEL: @test_shrink_intrin_trunc_multi_use(
-; ALL-NEXT: [[D:%.*]] = fpext <2 x float> [[C:%.*]] to <2 x double>
-; ALL-NEXT: [[E:%.*]] = call <2 x double> @llvm.trunc.v2f64(<2 x double> [[D]])
-; ALL-NEXT: [[F:%.*]] = fptrunc <2 x double> [[E]] to <2 x float>
-; ALL-NEXT: call void @use_v2f64(<2 x double> [[D]])
-; ALL-NEXT: ret <2 x float> [[F]]
+; CHECK-LABEL: @test_shrink_intrin_trunc_multi_use(
+; CHECK-NEXT: [[D:%.*]] = fpext <2 x float> [[C:%.*]] to <2 x double>
+; CHECK-NEXT: [[E:%.*]] = call <2 x double> @llvm.trunc.v2f64(<2 x double> [[D]])
+; CHECK-NEXT: [[F:%.*]] = fptrunc <2 x double> [[E]] to <2 x float>
+; CHECK-NEXT: call void @use_v2f64(<2 x double> [[D]])
+; CHECK-NEXT: ret <2 x float> [[F]]
;
%D = fpext <2 x float> %C to <2 x double>
%E = call <2 x double> @llvm.trunc.v2f64(<2 x double> %D)
; Make sure fast math flags are preserved
define float @test_shrink_intrin_fabs_fast(float %C) {
-; ALL-LABEL: @test_shrink_intrin_fabs_fast(
-; ALL-NEXT: [[TMP1:%.*]] = call fast float @llvm.fabs.f32(float [[C:%.*]])
-; ALL-NEXT: ret float [[TMP1]]
+; CHECK-LABEL: @test_shrink_intrin_fabs_fast(
+; CHECK-NEXT: [[TMP1:%.*]] = call fast float @llvm.fabs.f32(float [[C:%.*]])
+; CHECK-NEXT: ret float [[TMP1]]
;
%D = fpext float %C to double
%E = call fast double @llvm.fabs.f64(double %D)
}
define float @test_no_shrink_intrin_floor(double %D) {
-; ALL-LABEL: @test_no_shrink_intrin_floor(
-; ALL-NEXT: [[E:%.*]] = call double @llvm.floor.f64(double [[D:%.*]])
-; ALL-NEXT: [[F:%.*]] = fptrunc double [[E]] to float
-; ALL-NEXT: ret float [[F]]
+; CHECK-LABEL: @test_no_shrink_intrin_floor(
+; CHECK-NEXT: [[E:%.*]] = call double @llvm.floor.f64(double [[D:%.*]])
+; CHECK-NEXT: [[F:%.*]] = fptrunc double [[E]] to float
+; CHECK-NEXT: ret float [[F]]
;
%E = call double @llvm.floor.f64(double %D)
%F = fptrunc double %E to float
}
define float @test_no_shrink_intrin_ceil(double %D) {
-; ALL-LABEL: @test_no_shrink_intrin_ceil(
-; ALL-NEXT: [[E:%.*]] = call double @llvm.ceil.f64(double [[D:%.*]])
-; ALL-NEXT: [[F:%.*]] = fptrunc double [[E]] to float
-; ALL-NEXT: ret float [[F]]
+; CHECK-LABEL: @test_no_shrink_intrin_ceil(
+; CHECK-NEXT: [[E:%.*]] = call double @llvm.ceil.f64(double [[D:%.*]])
+; CHECK-NEXT: [[F:%.*]] = fptrunc double [[E]] to float
+; CHECK-NEXT: ret float [[F]]
;
%E = call double @llvm.ceil.f64(double %D)
%F = fptrunc double %E to float
}
define float @test_no_shrink_intrin_round(double %D) {
-; ALL-LABEL: @test_no_shrink_intrin_round(
-; ALL-NEXT: [[E:%.*]] = call double @llvm.round.f64(double [[D:%.*]])
-; ALL-NEXT: [[F:%.*]] = fptrunc double [[E]] to float
-; ALL-NEXT: ret float [[F]]
+; CHECK-LABEL: @test_no_shrink_intrin_round(
+; CHECK-NEXT: [[E:%.*]] = call double @llvm.round.f64(double [[D:%.*]])
+; CHECK-NEXT: [[F:%.*]] = fptrunc double [[E]] to float
+; CHECK-NEXT: ret float [[F]]
;
%E = call double @llvm.round.f64(double %D)
%F = fptrunc double %E to float
}
define float @test_no_shrink_intrin_nearbyint(double %D) {
-; ALL-LABEL: @test_no_shrink_intrin_nearbyint(
-; ALL-NEXT: [[E:%.*]] = call double @llvm.nearbyint.f64(double [[D:%.*]])
-; ALL-NEXT: [[F:%.*]] = fptrunc double [[E]] to float
-; ALL-NEXT: ret float [[F]]
+; CHECK-LABEL: @test_no_shrink_intrin_nearbyint(
+; CHECK-NEXT: [[E:%.*]] = call double @llvm.nearbyint.f64(double [[D:%.*]])
+; CHECK-NEXT: [[F:%.*]] = fptrunc double [[E]] to float
+; CHECK-NEXT: ret float [[F]]
;
%E = call double @llvm.nearbyint.f64(double %D)
%F = fptrunc double %E to float
}
define float @test_no_shrink_intrin_trunc(double %D) {
-; ALL-LABEL: @test_no_shrink_intrin_trunc(
-; ALL-NEXT: [[E:%.*]] = call double @llvm.trunc.f64(double [[D:%.*]])
-; ALL-NEXT: [[F:%.*]] = fptrunc double [[E]] to float
-; ALL-NEXT: ret float [[F]]
+; CHECK-LABEL: @test_no_shrink_intrin_trunc(
+; CHECK-NEXT: [[E:%.*]] = call double @llvm.trunc.f64(double [[D:%.*]])
+; CHECK-NEXT: [[F:%.*]] = fptrunc double [[E]] to float
+; CHECK-NEXT: ret float [[F]]
;
%E = call double @llvm.trunc.f64(double %D)
%F = fptrunc double %E to float
}
define float @test_shrink_intrin_fabs_double_src(double %D) {
-; ALL-LABEL: @test_shrink_intrin_fabs_double_src(
-; ALL-NEXT: [[TMP1:%.*]] = fptrunc double [[D:%.*]] to float
-; ALL-NEXT: [[F:%.*]] = call float @llvm.fabs.f32(float [[TMP1]])
-; ALL-NEXT: ret float [[F]]
+; CHECK-LABEL: @test_shrink_intrin_fabs_double_src(
+; CHECK-NEXT: [[TMP1:%.*]] = fptrunc double [[D:%.*]] to float
+; CHECK-NEXT: [[F:%.*]] = call float @llvm.fabs.f32(float [[TMP1]])
+; CHECK-NEXT: ret float [[F]]
;
%E = call double @llvm.fabs.f64(double %D)
%F = fptrunc double %E to float
; Make sure fast math flags are preserved
define float @test_shrink_intrin_fabs_fast_double_src(double %D) {
-; ALL-LABEL: @test_shrink_intrin_fabs_fast_double_src(
-; ALL-NEXT: [[TMP1:%.*]] = fptrunc double [[D:%.*]] to float
-; ALL-NEXT: [[F:%.*]] = call fast float @llvm.fabs.f32(float [[TMP1]])
-; ALL-NEXT: ret float [[F]]
+; CHECK-LABEL: @test_shrink_intrin_fabs_fast_double_src(
+; CHECK-NEXT: [[TMP1:%.*]] = fptrunc double [[D:%.*]] to float
+; CHECK-NEXT: [[F:%.*]] = call fast float @llvm.fabs.f32(float [[TMP1]])
+; CHECK-NEXT: ret float [[F]]
;
%E = call fast double @llvm.fabs.f64(double %D)
%F = fptrunc double %E to float
}
define float @test_shrink_float_convertible_constant_intrin_floor() {
-; ALL-LABEL: @test_shrink_float_convertible_constant_intrin_floor(
-; ALL-NEXT: ret float 2.000000e+00
+; CHECK-LABEL: @test_shrink_float_convertible_constant_intrin_floor(
+; CHECK-NEXT: ret float 2.000000e+00
;
%E = call double @llvm.floor.f64(double 2.1)
%F = fptrunc double %E to float
}
define float @test_shrink_float_convertible_constant_intrin_ceil() {
-; ALL-LABEL: @test_shrink_float_convertible_constant_intrin_ceil(
-; ALL-NEXT: ret float 3.000000e+00
+; CHECK-LABEL: @test_shrink_float_convertible_constant_intrin_ceil(
+; CHECK-NEXT: ret float 3.000000e+00
;
%E = call double @llvm.ceil.f64(double 2.1)
%F = fptrunc double %E to float
}
define float @test_shrink_float_convertible_constant_intrin_round() {
-; ALL-LABEL: @test_shrink_float_convertible_constant_intrin_round(
-; ALL-NEXT: ret float 2.000000e+00
+; CHECK-LABEL: @test_shrink_float_convertible_constant_intrin_round(
+; CHECK-NEXT: ret float 2.000000e+00
;
%E = call double @llvm.round.f64(double 2.1)
%F = fptrunc double %E to float
}
define float @test_shrink_float_convertible_constant_intrin_nearbyint() {
-; ALL-LABEL: @test_shrink_float_convertible_constant_intrin_nearbyint(
-; ALL-NEXT: ret float 2.000000e+00
+; CHECK-LABEL: @test_shrink_float_convertible_constant_intrin_nearbyint(
+; CHECK-NEXT: ret float 2.000000e+00
;
%E = call double @llvm.nearbyint.f64(double 2.1)
%F = fptrunc double %E to float
}
define float @test_shrink_float_convertible_constant_intrin_trunc() {
-; ALL-LABEL: @test_shrink_float_convertible_constant_intrin_trunc(
-; ALL-NEXT: ret float 2.000000e+00
+; CHECK-LABEL: @test_shrink_float_convertible_constant_intrin_trunc(
+; CHECK-NEXT: ret float 2.000000e+00
;
%E = call double @llvm.trunc.f64(double 2.1)
%F = fptrunc double %E to float
}
define float @test_shrink_float_convertible_constant_intrin_fabs() {
-; ALL-LABEL: @test_shrink_float_convertible_constant_intrin_fabs(
-; ALL-NEXT: ret float 0x4000CCCCC0000000
+; CHECK-LABEL: @test_shrink_float_convertible_constant_intrin_fabs(
+; CHECK-NEXT: ret float 0x4000CCCCC0000000
;
%E = call double @llvm.fabs.f64(double 2.1)
%F = fptrunc double %E to float
; Make sure fast math flags are preserved
define float @test_shrink_float_convertible_constant_intrin_fabs_fast() {
-; ALL-LABEL: @test_shrink_float_convertible_constant_intrin_fabs_fast(
-; ALL-NEXT: ret float 0x4000CCCCC0000000
+; CHECK-LABEL: @test_shrink_float_convertible_constant_intrin_fabs_fast(
+; CHECK-NEXT: ret float 0x4000CCCCC0000000
;
%E = call fast double @llvm.fabs.f64(double 2.1)
%F = fptrunc double %E to float
}
define half @test_no_shrink_mismatched_type_intrin_floor(double %D) {
-; ALL-LABEL: @test_no_shrink_mismatched_type_intrin_floor(
-; ALL-NEXT: [[E:%.*]] = call double @llvm.floor.f64(double [[D:%.*]])
-; ALL-NEXT: [[F:%.*]] = fptrunc double [[E]] to half
-; ALL-NEXT: ret half [[F]]
+; CHECK-LABEL: @test_no_shrink_mismatched_type_intrin_floor(
+; CHECK-NEXT: [[E:%.*]] = call double @llvm.floor.f64(double [[D:%.*]])
+; CHECK-NEXT: [[F:%.*]] = fptrunc double [[E]] to half
+; CHECK-NEXT: ret half [[F]]
;
%E = call double @llvm.floor.f64(double %D)
%F = fptrunc double %E to half
}
define half @test_no_shrink_mismatched_type_intrin_ceil(double %D) {
-; ALL-LABEL: @test_no_shrink_mismatched_type_intrin_ceil(
-; ALL-NEXT: [[E:%.*]] = call double @llvm.ceil.f64(double [[D:%.*]])
-; ALL-NEXT: [[F:%.*]] = fptrunc double [[E]] to half
-; ALL-NEXT: ret half [[F]]
+; CHECK-LABEL: @test_no_shrink_mismatched_type_intrin_ceil(
+; CHECK-NEXT: [[E:%.*]] = call double @llvm.ceil.f64(double [[D:%.*]])
+; CHECK-NEXT: [[F:%.*]] = fptrunc double [[E]] to half
+; CHECK-NEXT: ret half [[F]]
;
%E = call double @llvm.ceil.f64(double %D)
%F = fptrunc double %E to half
}
define half @test_no_shrink_mismatched_type_intrin_round(double %D) {
-; ALL-LABEL: @test_no_shrink_mismatched_type_intrin_round(
-; ALL-NEXT: [[E:%.*]] = call double @llvm.round.f64(double [[D:%.*]])
-; ALL-NEXT: [[F:%.*]] = fptrunc double [[E]] to half
-; ALL-NEXT: ret half [[F]]
+; CHECK-LABEL: @test_no_shrink_mismatched_type_intrin_round(
+; CHECK-NEXT: [[E:%.*]] = call double @llvm.round.f64(double [[D:%.*]])
+; CHECK-NEXT: [[F:%.*]] = fptrunc double [[E]] to half
+; CHECK-NEXT: ret half [[F]]
;
%E = call double @llvm.round.f64(double %D)
%F = fptrunc double %E to half
}
define half @test_no_shrink_mismatched_type_intrin_nearbyint(double %D) {
-; ALL-LABEL: @test_no_shrink_mismatched_type_intrin_nearbyint(
-; ALL-NEXT: [[E:%.*]] = call double @llvm.nearbyint.f64(double [[D:%.*]])
-; ALL-NEXT: [[F:%.*]] = fptrunc double [[E]] to half
-; ALL-NEXT: ret half [[F]]
+; CHECK-LABEL: @test_no_shrink_mismatched_type_intrin_nearbyint(
+; CHECK-NEXT: [[E:%.*]] = call double @llvm.nearbyint.f64(double [[D:%.*]])
+; CHECK-NEXT: [[F:%.*]] = fptrunc double [[E]] to half
+; CHECK-NEXT: ret half [[F]]
;
%E = call double @llvm.nearbyint.f64(double %D)
%F = fptrunc double %E to half
}
define half @test_no_shrink_mismatched_type_intrin_trunc(double %D) {
-; ALL-LABEL: @test_no_shrink_mismatched_type_intrin_trunc(
-; ALL-NEXT: [[E:%.*]] = call double @llvm.trunc.f64(double [[D:%.*]])
-; ALL-NEXT: [[F:%.*]] = fptrunc double [[E]] to half
-; ALL-NEXT: ret half [[F]]
+; CHECK-LABEL: @test_no_shrink_mismatched_type_intrin_trunc(
+; CHECK-NEXT: [[E:%.*]] = call double @llvm.trunc.f64(double [[D:%.*]])
+; CHECK-NEXT: [[F:%.*]] = fptrunc double [[E]] to half
+; CHECK-NEXT: ret half [[F]]
;
%E = call double @llvm.trunc.f64(double %D)
%F = fptrunc double %E to half
}
define half @test_shrink_mismatched_type_intrin_fabs_double_src(double %D) {
-; ALL-LABEL: @test_shrink_mismatched_type_intrin_fabs_double_src(
-; ALL-NEXT: [[TMP1:%.*]] = fptrunc double [[D:%.*]] to half
-; ALL-NEXT: [[F:%.*]] = call half @llvm.fabs.f16(half [[TMP1]])
-; ALL-NEXT: ret half [[F]]
+; CHECK-LABEL: @test_shrink_mismatched_type_intrin_fabs_double_src(
+; CHECK-NEXT: [[TMP1:%.*]] = fptrunc double [[D:%.*]] to half
+; CHECK-NEXT: [[F:%.*]] = call half @llvm.fabs.f16(half [[TMP1]])
+; CHECK-NEXT: ret half [[F]]
;
%E = call double @llvm.fabs.f64(double %D)
%F = fptrunc double %E to half
; Make sure fast math flags are preserved
define half @test_mismatched_type_intrin_fabs_fast_double_src(double %D) {
-; ALL-LABEL: @test_mismatched_type_intrin_fabs_fast_double_src(
-; ALL-NEXT: [[TMP1:%.*]] = fptrunc double [[D:%.*]] to half
-; ALL-NEXT: [[F:%.*]] = call fast half @llvm.fabs.f16(half [[TMP1]])
-; ALL-NEXT: ret half [[F]]
+; CHECK-LABEL: @test_mismatched_type_intrin_fabs_fast_double_src(
+; CHECK-NEXT: [[TMP1:%.*]] = fptrunc double [[D:%.*]] to half
+; CHECK-NEXT: [[F:%.*]] = call fast half @llvm.fabs.f16(half [[TMP1]])
+; CHECK-NEXT: ret half [[F]]
;
%E = call fast double @llvm.fabs.f64(double %D)
%F = fptrunc double %E to half
}
define <2 x double> @test_shrink_intrin_floor_fp16_vec(<2 x half> %C) {
-; ALL-LABEL: @test_shrink_intrin_floor_fp16_vec(
-; ALL-NEXT: [[TMP1:%.*]] = call arcp <2 x half> @llvm.floor.v2f16(<2 x half> [[C:%.*]])
-; ALL-NEXT: [[E:%.*]] = fpext <2 x half> [[TMP1]] to <2 x double>
-; ALL-NEXT: ret <2 x double> [[E]]
+; CHECK-LABEL: @test_shrink_intrin_floor_fp16_vec(
+; CHECK-NEXT: [[TMP1:%.*]] = call arcp <2 x half> @llvm.floor.v2f16(<2 x half> [[C:%.*]])
+; CHECK-NEXT: [[E:%.*]] = fpext <2 x half> [[TMP1]] to <2 x double>
+; CHECK-NEXT: ret <2 x double> [[E]]
;
%D = fpext <2 x half> %C to <2 x double>
%E = call arcp <2 x double> @llvm.floor.v2f64(<2 x double> %D)
}
define float @test_shrink_intrin_ceil_fp16_src(half %C) {
-; ALL-LABEL: @test_shrink_intrin_ceil_fp16_src(
-; ALL-NEXT: [[TMP1:%.*]] = call half @llvm.ceil.f16(half [[C:%.*]])
-; ALL-NEXT: [[F:%.*]] = fpext half [[TMP1]] to float
-; ALL-NEXT: ret float [[F]]
+; CHECK-LABEL: @test_shrink_intrin_ceil_fp16_src(
+; CHECK-NEXT: [[TMP1:%.*]] = call half @llvm.ceil.f16(half [[C:%.*]])
+; CHECK-NEXT: [[F:%.*]] = fpext half [[TMP1]] to float
+; CHECK-NEXT: ret float [[F]]
;
%D = fpext half %C to double
%E = call double @llvm.ceil.f64(double %D)
}
define <2 x double> @test_shrink_intrin_round_fp16_vec(<2 x half> %C) {
-; ALL-LABEL: @test_shrink_intrin_round_fp16_vec(
-; ALL-NEXT: [[TMP1:%.*]] = call <2 x half> @llvm.round.v2f16(<2 x half> [[C:%.*]])
-; ALL-NEXT: [[E:%.*]] = fpext <2 x half> [[TMP1]] to <2 x double>
-; ALL-NEXT: ret <2 x double> [[E]]
+; CHECK-LABEL: @test_shrink_intrin_round_fp16_vec(
+; CHECK-NEXT: [[TMP1:%.*]] = call <2 x half> @llvm.round.v2f16(<2 x half> [[C:%.*]])
+; CHECK-NEXT: [[E:%.*]] = fpext <2 x half> [[TMP1]] to <2 x double>
+; CHECK-NEXT: ret <2 x double> [[E]]
;
%D = fpext <2 x half> %C to <2 x double>
%E = call <2 x double> @llvm.round.v2f64(<2 x double> %D)
}
define float @test_shrink_intrin_nearbyint_fp16_src(half %C) {
-; ALL-LABEL: @test_shrink_intrin_nearbyint_fp16_src(
-; ALL-NEXT: [[TMP1:%.*]] = call half @llvm.nearbyint.f16(half [[C:%.*]])
-; ALL-NEXT: [[F:%.*]] = fpext half [[TMP1]] to float
-; ALL-NEXT: ret float [[F]]
+; CHECK-LABEL: @test_shrink_intrin_nearbyint_fp16_src(
+; CHECK-NEXT: [[TMP1:%.*]] = call half @llvm.nearbyint.f16(half [[C:%.*]])
+; CHECK-NEXT: [[F:%.*]] = fpext half [[TMP1]] to float
+; CHECK-NEXT: ret float [[F]]
;
%D = fpext half %C to double
%E = call double @llvm.nearbyint.f64(double %D)
}
define <2 x double> @test_shrink_intrin_trunc_fp16_src(<2 x half> %C) {
-; ALL-LABEL: @test_shrink_intrin_trunc_fp16_src(
-; ALL-NEXT: [[TMP1:%.*]] = call <2 x half> @llvm.trunc.v2f16(<2 x half> [[C:%.*]])
-; ALL-NEXT: [[E:%.*]] = fpext <2 x half> [[TMP1]] to <2 x double>
-; ALL-NEXT: ret <2 x double> [[E]]
+; CHECK-LABEL: @test_shrink_intrin_trunc_fp16_src(
+; CHECK-NEXT: [[TMP1:%.*]] = call <2 x half> @llvm.trunc.v2f16(<2 x half> [[C:%.*]])
+; CHECK-NEXT: [[E:%.*]] = fpext <2 x half> [[TMP1]] to <2 x double>
+; CHECK-NEXT: ret <2 x double> [[E]]
;
%D = fpext <2 x half> %C to <2 x double>
%E = call <2 x double> @llvm.trunc.v2f64(<2 x double> %D)
}
define float @test_shrink_intrin_fabs_fp16_src(half %C) {
-; ALL-LABEL: @test_shrink_intrin_fabs_fp16_src(
-; ALL-NEXT: [[TMP1:%.*]] = call half @llvm.fabs.f16(half [[C:%.*]])
-; ALL-NEXT: [[F:%.*]] = fpext half [[TMP1]] to float
-; ALL-NEXT: ret float [[F]]
+; CHECK-LABEL: @test_shrink_intrin_fabs_fp16_src(
+; CHECK-NEXT: [[TMP1:%.*]] = call half @llvm.fabs.f16(half [[C:%.*]])
+; CHECK-NEXT: [[F:%.*]] = fpext half [[TMP1]] to float
+; CHECK-NEXT: ret float [[F]]
;
%D = fpext half %C to double
%E = call double @llvm.fabs.f64(double %D)
; Make sure fast math flags are preserved
define float @test_shrink_intrin_fabs_fast_fp16_src(half %C) {
-; ALL-LABEL: @test_shrink_intrin_fabs_fast_fp16_src(
-; ALL-NEXT: [[TMP1:%.*]] = call fast half @llvm.fabs.f16(half [[C:%.*]])
-; ALL-NEXT: [[F:%.*]] = fpext half [[TMP1]] to float
-; ALL-NEXT: ret float [[F]]
+; CHECK-LABEL: @test_shrink_intrin_fabs_fast_fp16_src(
+; CHECK-NEXT: [[TMP1:%.*]] = call fast half @llvm.fabs.f16(half [[C:%.*]])
+; CHECK-NEXT: [[F:%.*]] = fpext half [[TMP1]] to float
+; CHECK-NEXT: ret float [[F]]
;
%D = fpext half %C to double
%E = call fast double @llvm.fabs.f64(double %D)
}
define float @test_no_shrink_intrin_floor_multi_use_fpext(half %C) {
-; ALL-LABEL: @test_no_shrink_intrin_floor_multi_use_fpext(
-; ALL-NEXT: [[D:%.*]] = fpext half [[C:%.*]] to double
-; ALL-NEXT: store volatile double [[D]], double* undef, align 8
-; ALL-NEXT: [[E:%.*]] = call double @llvm.floor.f64(double [[D]])
-; ALL-NEXT: [[F:%.*]] = fptrunc double [[E]] to float
-; ALL-NEXT: ret float [[F]]
+; CHECK-LABEL: @test_no_shrink_intrin_floor_multi_use_fpext(
+; CHECK-NEXT: [[D:%.*]] = fpext half [[C:%.*]] to double
+; CHECK-NEXT: store volatile double [[D]], double* undef, align 8
+; CHECK-NEXT: [[E:%.*]] = call double @llvm.floor.f64(double [[D]])
+; CHECK-NEXT: [[F:%.*]] = fptrunc double [[E]] to float
+; CHECK-NEXT: ret float [[F]]
;
%D = fpext half %C to double
store volatile double %D, double* undef
}
define float @test_no_shrink_intrin_fabs_multi_use_fpext(half %C) {
-; ALL-LABEL: @test_no_shrink_intrin_fabs_multi_use_fpext(
-; ALL-NEXT: [[D:%.*]] = fpext half [[C:%.*]] to double
-; ALL-NEXT: store volatile double [[D]], double* undef, align 8
-; ALL-NEXT: [[E:%.*]] = call double @llvm.fabs.f64(double [[D]])
-; ALL-NEXT: [[F:%.*]] = fptrunc double [[E]] to float
-; ALL-NEXT: ret float [[F]]
+; CHECK-LABEL: @test_no_shrink_intrin_fabs_multi_use_fpext(
+; CHECK-NEXT: [[D:%.*]] = fpext half [[C:%.*]] to double
+; CHECK-NEXT: store volatile double [[D]], double* undef, align 8
+; CHECK-NEXT: [[E:%.*]] = call double @llvm.fabs.f64(double [[D]])
+; CHECK-NEXT: [[F:%.*]] = fptrunc double [[E]] to float
+; CHECK-NEXT: ret float [[F]]
;
%D = fpext half %C to double
store volatile double %D, double* undef
; Test that the pow library call simplifier works correctly.
;
-; RUN: opt -instcombine -S < %s | FileCheck %s --check-prefixes=ANY
-; RUN: opt -instcombine -S < %s -mtriple=x86_64-apple-macosx10.9 | FileCheck %s --check-prefixes=ANY,CHECK-EXP10
-; RUN: opt -instcombine -S < %s -mtriple=arm-apple-ios7.0 | FileCheck %s --check-prefixes=ANY,CHECK-EXP10
-; RUN: opt -instcombine -S < %s -mtriple=x86_64-apple-macosx10.8 | FileCheck %s --check-prefixes=ANY,CHECK-NO-EXP10
-; RUN: opt -instcombine -S < %s -mtriple=arm-apple-ios6.0 | FileCheck %s --check-prefixes=ANY,CHECK-NO-EXP10
-; RUN: opt -instcombine -S < %s -mtriple=x86_64-netbsd | FileCheck %s --check-prefixes=ANY,CHECK-NO-EXP10
-; RUN: opt -instcombine -S < %s -mtriple=arm-apple-tvos9.0 | FileCheck %s --check-prefixes=ANY,CHECK-EXP10
-; RUN: opt -instcombine -S < %s -mtriple=arm-apple-watchos2.0 | FileCheck %s --check-prefixes=ANY,CHECK-EXP10
+; RUN: opt -instcombine -S < %s | FileCheck %s --check-prefixes=CHECK,ANY
+; RUN: opt -instcombine -S < %s -mtriple=x86_64-apple-macosx10.9 | FileCheck %s --check-prefixes=CHECK,ANY,CHECK-EXP10
+; RUN: opt -instcombine -S < %s -mtriple=arm-apple-ios7.0 | FileCheck %s --check-prefixes=CHECK,ANY,CHECK-EXP10
+; RUN: opt -instcombine -S < %s -mtriple=x86_64-apple-macosx10.8 | FileCheck %s --check-prefixes=CHECK,ANY,CHECK-NO-EXP10
+; RUN: opt -instcombine -S < %s -mtriple=arm-apple-ios6.0 | FileCheck %s --check-prefixes=CHECK,ANY,CHECK-NO-EXP10
+; RUN: opt -instcombine -S < %s -mtriple=x86_64-netbsd | FileCheck %s --check-prefixes=CHECK,ANY,CHECK-NO-EXP10
+; RUN: opt -instcombine -S < %s -mtriple=arm-apple-tvos9.0 | FileCheck %s --check-prefixes=CHECK,ANY,CHECK-EXP10
+; RUN: opt -instcombine -S < %s -mtriple=arm-apple-watchos2.0 | FileCheck %s --check-prefixes=CHECK,ANY,CHECK-EXP10
; rdar://7251832
-; RUN: opt -instcombine -S < %s -mtriple=x86_64-pc-windows-msvc | FileCheck %s --check-prefixes=CHECK-WIN
+; RUN: opt -instcombine -S < %s -mtriple=i386-pc-windows-msvc18 | FileCheck %s --check-prefixes=CHECK,MSVC,VC32,CHECK-NO-EXP10
+; RUN: opt -instcombine -S < %s -mtriple=i386-pc-windows-msvc | FileCheck %s --check-prefixes=CHECK,MSVC,VC51,VC19,CHECK-NO-EXP10
+; RUN: opt -instcombine -S < %s -mtriple=x86_64-pc-windows-msvc18 | FileCheck %s --check-prefixes=CHECK,MSVC,VC64,CHECK-NO-EXP10
+; RUN: opt -instcombine -S < %s -mtriple=x86_64-pc-windows-msvc | FileCheck %s --check-prefixes=CHECK,MSVC,VC83,VC19,CHECK-NO-EXP10
; NOTE: The readonly attribute on the pow call should be preserved
; in the cases below where pow is transformed into another function call.
; Check pow(1.0, x) -> 1.0.
define float @test_simplify1(float %x) {
-; ANY-LABEL: @test_simplify1(
+; CHECK-LABEL: @test_simplify1(
; ANY-NEXT: ret float 1.000000e+00
+; VC32-NEXT: [[POW:%.*]] = call float @powf(float 1.000000e+00, float [[X:%.*]])
+; VC32-NEXT: ret float [[POW]]
+; VC64-NEXT: ret float 1.000000e+00
;
%retval = call float @powf(float 1.0, float %x)
ret float %retval
}
define <2 x float> @test_simplify1v(<2 x float> %x) {
-; ANY-LABEL: @test_simplify1v(
+; CHECK-LABEL: @test_simplify1v(
; ANY-NEXT: ret <2 x float> <float 1.000000e+00, float 1.000000e+00>
+; MSVC-NEXT: [[POW:%.*]] = call <2 x float> @llvm.pow.v2f32(<2 x float> <float 1.000000e+00, float 1.000000e+00>, <2 x float> [[X:%.*]])
+; MSVC-NEXT: ret <2 x float> [[POW]]
;
%retval = call <2 x float> @llvm.pow.v2f32(<2 x float> <float 1.0, float 1.0>, <2 x float> %x)
ret <2 x float> %retval
}
define double @test_simplify2(double %x) {
-; ANY-LABEL: @test_simplify2(
-; ANY-NEXT: ret double 1.000000e+00
+; CHECK-LABEL: @test_simplify2(
+; CHECK-NEXT: ret double 1.000000e+00
;
%retval = call double @pow(double 1.0, double %x)
ret double %retval
}
define <2 x double> @test_simplify2v(<2 x double> %x) {
-; ANY-LABEL: @test_simplify2v(
+; CHECK-LABEL: @test_simplify2v(
; ANY-NEXT: ret <2 x double> <double 1.000000e+00, double 1.000000e+00>
+; MSVC-NEXT: [[POW:%.*]] = call <2 x double> @llvm.pow.v2f64(<2 x double> <double 1.000000e+00, double 1.000000e+00>, <2 x double> [[X:%.*]])
+; MSVC-NEXT: ret <2 x double> [[POW]]
;
%retval = call <2 x double> @llvm.pow.v2f64(<2 x double> <double 1.0, double 1.0>, <2 x double> %x)
ret <2 x double> %retval
; Check pow(2.0 ** n, x) -> exp2(n * x).
define float @test_simplify3(float %x) {
-; ANY-LABEL: @test_simplify3(
-; ANY-NEXT: [[EXP2F:%.*]] = call float @exp2f(float [[X:%.*]]) [[NUW_RO:#[0-9]+]]
+; CHECK-LABEL: @test_simplify3(
+; ANY-NEXT: [[EXP2F:%.*]] = call float @exp2f(float [[X:%.*]])
; ANY-NEXT: ret float [[EXP2F]]
-;
-; CHECK-WIN-LABEL: @test_simplify3(
-; CHECK-WIN-NEXT: [[POW:%.*]] = call float @powf(float 2.000000e+00, float [[X:%.*]])
-; CHECK-WIN-NEXT: ret float [[POW]]
+; VC32-NEXT: [[POW:%.*]] = call float @powf(float 2.000000e+00, float [[X:%.*]])
+; VC32-NEXT: ret float [[POW]]
+; VC51-NEXT: [[POW:%.*]] = call float @powf(float 2.000000e+00, float [[X:%.*]])
+; VC51-NEXT: ret float [[POW]]
+; VC64-NEXT: [[POW:%.*]] = call float @powf(float 2.000000e+00, float [[X:%.*]])
+; VC64-NEXT: ret float [[POW]]
+; VC83-NEXT: [[EXP2F:%.*]] = call float @exp2f(float [[X:%.*]])
+; VC83-NEXT: ret float [[EXP2F]]
;
%retval = call float @powf(float 2.0, float %x)
ret float %retval
}
define double @test_simplify3n(double %x) {
-; ANY-LABEL: @test_simplify3n(
+; 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: [[EXP2:%.*]] = call double @exp2(double [[MUL]])
; ANY-NEXT: ret double [[EXP2]]
-;
-; CHECK-WIN-LABEL: @test_simplify3n(
-; CHECK-WIN-NEXT: [[POW:%.*]] = call double @pow(double 2.500000e-01, double [[X:%.*]])
-; CHECK-WIN-NEXT: ret double [[POW]]
+; VC19-NEXT: [[MUL:%.*]] = fmul double [[X:%.*]], -2.000000e+00
+; VC19-NEXT: [[EXP2:%.*]] = call double @exp2(double [[MUL]])
+; VC19-NEXT: ret double [[EXP2]]
+; VC32-NEXT: [[POW:%.*]] = call double @pow(double 2.500000e-01, double [[X:%.*]])
+; VC32-NEXT: ret double [[POW]]
+; VC64-NEXT: [[POW:%.*]] = call double @pow(double 2.500000e-01, double [[X:%.*]])
+; VC64-NEXT: ret double [[POW]]
;
%retval = call double @pow(double 0.25, double %x)
ret double %retval
}
define <2 x float> @test_simplify3v(<2 x float> %x) {
-; ANY-LABEL: @test_simplify3v(
+; CHECK-LABEL: @test_simplify3v(
; ANY-NEXT: [[EXP2:%.*]] = call <2 x float> @llvm.exp2.v2f32(<2 x float> [[X:%.*]])
; ANY-NEXT: ret <2 x float> [[EXP2]]
-;
-; CHECK-WIN-LABEL: @test_simplify3v(
-; CHECK-WIN-NEXT: [[POW:%.*]] = call <2 x float> @llvm.pow.v2f32(<2 x float> <float 2.000000e+00, float 2.000000e+00>, <2 x float> [[X:%.*]])
-; CHECK-WIN-NEXT: ret <2 x float> [[POW]]
+; MSVC-NEXT: [[POW:%.*]] = call <2 x float> @llvm.pow.v2f32(<2 x float> <float 2.000000e+00, float 2.000000e+00>, <2 x float> [[X:%.*]])
+; MSVC-NEXT: ret <2 x float> [[POW]]
;
%retval = call <2 x float> @llvm.pow.v2f32(<2 x float> <float 2.0, float 2.0>, <2 x float> %x)
ret <2 x float> %retval
}
define <2 x double> @test_simplify3vn(<2 x double> %x) {
-; ANY-LABEL: @test_simplify3vn(
+; CHECK-LABEL: @test_simplify3vn(
; ANY-NEXT: [[MUL:%.*]] = fmul <2 x double> [[X:%.*]], <double 2.000000e+00, double 2.000000e+00>
; ANY-NEXT: [[EXP2:%.*]] = call <2 x double> @llvm.exp2.v2f64(<2 x double> [[MUL]])
; ANY-NEXT: ret <2 x double> [[EXP2]]
+; MSVC-NEXT: [[POW:%.*]] = call <2 x double> @llvm.pow.v2f64(<2 x double> <double 4.000000e+00, double 4.000000e+00>, <2 x double> [[X:%.*]])
+; MSVC-NEXT: ret <2 x double> [[POW]]
;
%retval = call <2 x double> @llvm.pow.v2f64(<2 x double> <double 4.0, double 4.0>, <2 x double> %x)
ret <2 x double> %retval
}
define double @test_simplify4(double %x) {
-; ANY-LABEL: @test_simplify4(
-; ANY-NEXT: [[EXP2:%.*]] = call double @exp2(double [[X:%.*]]) [[NUW_RO]]
+; CHECK-LABEL: @test_simplify4(
+; ANY-NEXT: [[EXP2:%.*]] = call double @exp2(double [[X:%.*]])
; ANY-NEXT: ret double [[EXP2]]
-;
-; CHECK-WIN-LABEL: @test_simplify4(
-; CHECK-WIN-NEXT: [[POW:%.*]] = call double @pow(double 2.000000e+00, double [[X:%.*]])
-; CHECK-WIN-NEXT: ret double [[POW]]
+; VC19-NEXT: [[EXP2:%.*]] = call double @exp2(double [[X:%.*]])
+; VC19-NEXT: ret double [[EXP2]]
+; VC32-NEXT: [[POW:%.*]] = call double @pow(double 2.000000e+00, double [[X:%.*]])
+; VC32-NEXT: ret double [[POW]]
+; VC64-NEXT: [[POW:%.*]] = call double @pow(double 2.000000e+00, double [[X:%.*]])
+; VC64-NEXT: ret double [[POW]]
;
%retval = call double @pow(double 2.0, double %x)
ret double %retval
}
define float @test_simplify4n(float %x) {
-; ANY-LABEL: @test_simplify4n(
+; CHECK-LABEL: @test_simplify4n(
; ANY-NEXT: [[MUL:%.*]] = fmul float [[X:%.*]], 3.000000e+00
-; ANY-NEXT: [[EXP2F:%.*]] = call float @exp2f(float [[MUL]]) [[NUW_RO]]
+; ANY-NEXT: [[EXP2F:%.*]] = call float @exp2f(float [[MUL]])
; ANY-NEXT: ret float [[EXP2F]]
-;
-; CHECK-WIN-LABEL: @test_simplify4n(
-; CHECK-WIN-NEXT: [[POW:%.*]] = call float @powf(float 8.000000e+00, float [[X:%.*]])
-; CHECK-WIN-NEXT: ret float [[POW]]
+; VC32-NEXT: [[POW:%.*]] = call float @powf(float 8.000000e+00, float [[X:%.*]])
+; VC32-NEXT: ret float [[POW]]
+; VC51-NEXT: [[POW:%.*]] = call float @powf(float 8.000000e+00, float [[X:%.*]])
+; VC51-NEXT: ret float [[POW]]
+; VC64-NEXT: [[POW:%.*]] = call float @powf(float 8.000000e+00, float [[X:%.*]])
+; VC64-NEXT: ret float [[POW]]
+; VC83-NEXT: [[MUL:%.*]] = fmul float [[X:%.*]], 3.000000e+00
+; VC83-NEXT: [[EXP2F:%.*]] = call float @exp2f(float [[MUL]])
+; VC83-NEXT: ret float [[EXP2F]]
;
%retval = call float @powf(float 8.0, float %x)
ret float %retval
}
define <2 x double> @test_simplify4v(<2 x double> %x) {
-; ANY-LABEL: @test_simplify4v(
+; CHECK-LABEL: @test_simplify4v(
; ANY-NEXT: [[EXP2:%.*]] = call <2 x double> @llvm.exp2.v2f64(<2 x double> [[X:%.*]])
; ANY-NEXT: ret <2 x double> [[EXP2]]
-;
-; CHECK-WIN-LABEL: @test_simplify4v(
-; CHECK-WIN-NEXT: [[POW:%.*]] = call <2 x double> @llvm.pow.v2f64(<2 x double> <double 2.000000e+00, double 2.000000e+00>, <2 x double> [[X:%.*]])
-; CHECK-WIN-NEXT: ret <2 x double> [[POW]]
+; MSVC-NEXT: [[POW:%.*]] = call <2 x double> @llvm.pow.v2f64(<2 x double> <double 2.000000e+00, double 2.000000e+00>, <2 x double> [[X:%.*]])
+; MSVC-NEXT: ret <2 x double> [[POW]]
;
%retval = call <2 x double> @llvm.pow.v2f64(<2 x double> <double 2.0, double 2.0>, <2 x double> %x)
ret <2 x double> %retval
}
define <2 x float> @test_simplify4vn(<2 x float> %x) {
-; ANY-LABEL: @test_simplify4vn(
+; CHECK-LABEL: @test_simplify4vn(
; ANY-NEXT: [[MUL:%.*]] = fsub <2 x float> <float -0.000000e+00, float -0.000000e+00>, [[X:%.*]]
; ANY-NEXT: [[EXP2:%.*]] = call <2 x float> @llvm.exp2.v2f32(<2 x float> [[MUL]])
; ANY-NEXT: ret <2 x float> [[EXP2]]
-;
-; CHECK-WIN-LABEL: @test_simplify4vn(
-; CHECK-WIN-NEXT: [[POW:%.*]] = call <2 x float> @llvm.pow.v2f32(<2 x float> <float 5.000000e-01, float 5.000000e-01>, <2 x float> [[X:%.*]])
-; CHECK-WIN-NEXT: ret <2 x float> [[POW]]
+; MSVC-NEXT: [[POW:%.*]] = call <2 x float> @llvm.pow.v2f32(<2 x float> <float 5.000000e-01, float 5.000000e-01>, <2 x float> [[X:%.*]])
+; MSVC-NEXT: ret <2 x float> [[POW]]
;
%retval = call <2 x float> @llvm.pow.v2f32(<2 x float> <float 0.5, float 0.5>, <2 x float> %x)
ret <2 x float> %retval
; Check pow(x, 0.0) -> 1.0.
define float @test_simplify5(float %x) {
-; ANY-LABEL: @test_simplify5(
+; CHECK-LABEL: @test_simplify5(
; ANY-NEXT: ret float 1.000000e+00
+; VC32-NEXT: [[POW:%.*]] = call float @powf(float [[X:%.*]], float 0.000000e+00)
+; VC32-NEXT: ret float [[POW]]
+; VC51-NEXT: [[POW:%.*]] = call float @powf(float [[X:%.*]], float 0.000000e+00)
+; VC51-NEXT: ret float [[POW]]
+; VC64-NEXT: ret float 1.000000e+00
+; VC83-NEXT: ret float 1.000000e+00
;
%retval = call float @powf(float %x, float 0.0)
ret float %retval
}
define <2 x float> @test_simplify5v(<2 x float> %x) {
-; ANY-LABEL: @test_simplify5v(
+; CHECK-LABEL: @test_simplify5v(
; ANY-NEXT: ret <2 x float> <float 1.000000e+00, float 1.000000e+00>
+; MSVC-NEXT: [[POW:%.*]] = call <2 x float> @llvm.pow.v2f32(<2 x float> [[X:%.*]], <2 x float> zeroinitializer)
+; MSVC-NEXT: ret <2 x float> [[POW]]
;
%retval = call <2 x float> @llvm.pow.v2f32(<2 x float> %x, <2 x float> <float 0.0, float 0.0>)
ret <2 x float> %retval
}
define double @test_simplify6(double %x) {
-; ANY-LABEL: @test_simplify6(
-; ANY-NEXT: ret double 1.000000e+00
+; CHECK-LABEL: @test_simplify6(
+; CHECK-NEXT: ret double 1.000000e+00
;
%retval = call double @pow(double %x, double 0.0)
ret double %retval
}
define <2 x double> @test_simplify6v(<2 x double> %x) {
-; ANY-LABEL: @test_simplify6v(
+; CHECK-LABEL: @test_simplify6v(
; ANY-NEXT: ret <2 x double> <double 1.000000e+00, double 1.000000e+00>
+; MSVC-NEXT: [[POW:%.*]] = call <2 x double> @llvm.pow.v2f64(<2 x double> [[X:%.*]], <2 x double> zeroinitializer)
+; MSVC-NEXT: ret <2 x double> [[POW]]
;
%retval = call <2 x double> @llvm.pow.v2f64(<2 x double> %x, <2 x double> <double 0.0, double 0.0>)
ret <2 x double> %retval
; Check pow(x, 0.5) -> fabs(sqrt(x)), where x != -infinity.
define float @test_simplify7(float %x) {
-; ANY-LABEL: @test_simplify7(
-; ANY-NEXT: [[SQRTF:%.*]] = call float @sqrtf(float [[X:%.*]]) [[NUW_RO]]
+; CHECK-LABEL: @test_simplify7(
+; ANY-NEXT: [[SQRTF:%.*]] = call float @sqrtf(float [[X:%.*]])
; ANY-NEXT: [[ABS:%.*]] = call float @llvm.fabs.f32(float [[SQRTF]])
; ANY-NEXT: [[ISINF:%.*]] = fcmp oeq float [[X]], 0xFFF0000000000000
; ANY-NEXT: [[TMP1:%.*]] = select i1 [[ISINF]], float 0x7FF0000000000000, float [[ABS]]
; ANY-NEXT: ret float [[TMP1]]
+; VC32-NEXT: [[POW:%.*]] = call float @powf(float [[X:%.*]], float 5.000000e-01)
+; VC32-NEXT: ret float [[POW]]
+; VC51-NEXT: [[POW:%.*]] = call float @powf(float [[X:%.*]], float 5.000000e-01)
+; VC51-NEXT: ret float [[POW]]
+; VC64-NEXT: [[SQRTF:%.*]] = call float @sqrtf(float [[X:%.*]])
+; VC64-NEXT: [[ABS:%.*]] = call float @llvm.fabs.f32(float [[SQRTF]])
+; VC64-NEXT: [[ISINF:%.*]] = fcmp oeq float [[X]], 0xFFF0000000000000
+; VC64-NEXT: [[TMP1:%.*]] = select i1 [[ISINF]], float 0x7FF0000000000000, float [[ABS]]
+; VC64-NEXT: ret float [[TMP1]]
+; VC83-NEXT: [[SQRTF:%.*]] = call float @sqrtf(float [[X:%.*]])
+; VC83-NEXT: [[ABS:%.*]] = call float @llvm.fabs.f32(float [[SQRTF]])
+; VC83-NEXT: [[ISINF:%.*]] = fcmp oeq float [[X]], 0xFFF0000000000000
+; VC83-NEXT: [[TMP1:%.*]] = select i1 [[ISINF]], float 0x7FF0000000000000, float [[ABS]]
+; VC83-NEXT: ret float [[TMP1]]
;
%retval = call float @powf(float %x, float 0.5)
ret float %retval
}
define double @test_simplify8(double %x) {
-; ANY-LABEL: @test_simplify8(
-; ANY-NEXT: [[SQRT:%.*]] = call double @sqrt(double [[X:%.*]]) [[NUW_RO]]
-; ANY-NEXT: [[ABS:%.*]] = call double @llvm.fabs.f64(double [[SQRT]])
-; ANY-NEXT: [[ISINF:%.*]] = fcmp oeq double [[X]], 0xFFF0000000000000
-; ANY-NEXT: [[TMP1:%.*]] = select i1 [[ISINF]], double 0x7FF0000000000000, double [[ABS]]
-; ANY-NEXT: ret double [[TMP1]]
+; CHECK-LABEL: @test_simplify8(
+; CHECK-NEXT: [[SQRT:%.*]] = call double @sqrt(double [[X:%.*]])
+; CHECK-NEXT: [[ABS:%.*]] = call double @llvm.fabs.f64(double [[SQRT]])
+; CHECK-NEXT: [[ISINF:%.*]] = fcmp oeq double [[X]], 0xFFF0000000000000
+; CHECK-NEXT: [[TMP1:%.*]] = select i1 [[ISINF]], double 0x7FF0000000000000, double [[ABS]]
+; CHECK-NEXT: ret double [[TMP1]]
;
%retval = call double @pow(double %x, double 0.5)
ret double %retval
; Check pow(-infinity, 0.5) -> +infinity.
define float @test_simplify9(float %x) {
-; ANY-LABEL: @test_simplify9(
+; CHECK-LABEL: @test_simplify9(
; ANY-NEXT: ret float 0x7FF0000000000000
+; VC32-NEXT: [[POW:%.*]] = call float @powf(float 0xFFF0000000000000, float 5.000000e-01)
+; VC32-NEXT: ret float [[POW]]
+; VC51-NEXT: [[POW:%.*]] = call float @powf(float 0xFFF0000000000000, float 5.000000e-01)
+; VC51-NEXT: ret float [[POW]]
+; VC64-NEXT: ret float 0x7FF0000000000000
+; VC83-NEXT: ret float 0x7FF0000000000000
;
%retval = call float @powf(float 0xFFF0000000000000, float 0.5)
ret float %retval
}
define double @test_simplify10(double %x) {
-; ANY-LABEL: @test_simplify10(
-; ANY-NEXT: ret double 0x7FF0000000000000
+; CHECK-LABEL: @test_simplify10(
+; CHECK-NEXT: ret double 0x7FF0000000000000
;
%retval = call double @pow(double 0xFFF0000000000000, double 0.5)
ret double %retval
; Check pow(x, 1.0) -> x.
define float @test_simplify11(float %x) {
-; ANY-LABEL: @test_simplify11(
+; CHECK-LABEL: @test_simplify11(
; ANY-NEXT: ret float [[X:%.*]]
+; VC32-NEXT: [[POW:%.*]] = call float @powf(float [[X:%.*]], float 1.000000e+00)
+; VC32-NEXT: ret float [[POW]]
+; VC51-NEXT: [[POW:%.*]] = call float @powf(float [[X:%.*]], float 1.000000e+00)
+; VC51-NEXT: ret float [[POW]]
+; VC64-NEXT: ret float [[X:%.*]]
+; VC83-NEXT: ret float [[X:%.*]]
;
%retval = call float @powf(float %x, float 1.0)
ret float %retval
}
define <2 x float> @test_simplify11v(<2 x float> %x) {
-; ANY-LABEL: @test_simplify11v(
+; CHECK-LABEL: @test_simplify11v(
; ANY-NEXT: ret <2 x float> [[X:%.*]]
+; MSVC-NEXT: [[POW:%.*]] = call <2 x float> @llvm.pow.v2f32(<2 x float> [[X:%.*]], <2 x float> <float 1.000000e+00, float 1.000000e+00>)
+; MSVC-NEXT: ret <2 x float> [[POW]]
;
%retval = call <2 x float> @llvm.pow.v2f32(<2 x float> %x, <2 x float> <float 1.0, float 1.0>)
ret <2 x float> %retval
}
define double @test_simplify12(double %x) {
-; ANY-LABEL: @test_simplify12(
-; ANY-NEXT: ret double [[X:%.*]]
+; CHECK-LABEL: @test_simplify12(
+; CHECK-NEXT: ret double [[X:%.*]]
;
%retval = call double @pow(double %x, double 1.0)
ret double %retval
}
define <2 x double> @test_simplify12v(<2 x double> %x) {
-; ANY-LABEL: @test_simplify12v(
+; CHECK-LABEL: @test_simplify12v(
; ANY-NEXT: ret <2 x double> [[X:%.*]]
+; MSVC-NEXT: [[POW:%.*]] = call <2 x double> @llvm.pow.v2f64(<2 x double> [[X:%.*]], <2 x double> <double 1.000000e+00, double 1.000000e+00>)
+; MSVC-NEXT: ret <2 x double> [[POW]]
;
%retval = call <2 x double> @llvm.pow.v2f64(<2 x double> %x, <2 x double> <double 1.0, double 1.0>)
ret <2 x double> %retval
; Check pow(x, 2.0) -> x*x.
define float @pow2_strict(float %x) {
-; ANY-LABEL: @pow2_strict(
+; CHECK-LABEL: @pow2_strict(
; ANY-NEXT: [[SQUARE:%.*]] = fmul float [[X:%.*]], [[X]]
; ANY-NEXT: ret float [[SQUARE]]
+; VC32-NEXT: [[POW:%.*]] = call float @powf(float [[X:%.*]], float 2.000000e+00)
+; VC32-NEXT: ret float [[POW]]
+; VC51-NEXT: [[POW:%.*]] = call float @powf(float [[X:%.*]], float 2.000000e+00)
+; VC51-NEXT: ret float [[POW]]
+; VC64-NEXT: [[SQUARE:%.*]] = fmul float [[X:%.*]], [[X]]
+; VC64-NEXT: ret float [[SQUARE]]
+; VC83-NEXT: [[SQUARE:%.*]] = fmul float [[X:%.*]], [[X]]
+; VC83-NEXT: ret float [[SQUARE]]
;
%r = call float @powf(float %x, float 2.0)
ret float %r
}
define <2 x float> @pow2_strictv(<2 x float> %x) {
-; ANY-LABEL: @pow2_strictv(
+; CHECK-LABEL: @pow2_strictv(
; ANY-NEXT: [[SQUARE:%.*]] = fmul <2 x float> [[X:%.*]], [[X]]
; ANY-NEXT: ret <2 x float> [[SQUARE]]
+; MSVC-NEXT: [[POW:%.*]] = call <2 x float> @llvm.pow.v2f32(<2 x float> [[X:%.*]], <2 x float> <float 2.000000e+00, float 2.000000e+00>)
+; MSVC-NEXT: ret <2 x float> [[POW]]
;
%r = call <2 x float> @llvm.pow.v2f32(<2 x float> %x, <2 x float> <float 2.0, float 2.0>)
ret <2 x float> %r
}
define double @pow2_double_strict(double %x) {
-; ANY-LABEL: @pow2_double_strict(
-; ANY-NEXT: [[SQUARE:%.*]] = fmul double [[X:%.*]], [[X]]
-; ANY-NEXT: ret double [[SQUARE]]
+; CHECK-LABEL: @pow2_double_strict(
+; CHECK-NEXT: [[SQUARE:%.*]] = fmul double [[X:%.*]], [[X]]
+; CHECK-NEXT: ret double [[SQUARE]]
;
%r = call double @pow(double %x, double 2.0)
ret double %r
}
define <2 x double> @pow2_double_strictv(<2 x double> %x) {
-; ANY-LABEL: @pow2_double_strictv(
+; CHECK-LABEL: @pow2_double_strictv(
; ANY-NEXT: [[SQUARE:%.*]] = fmul <2 x double> [[X:%.*]], [[X]]
; ANY-NEXT: ret <2 x double> [[SQUARE]]
+; MSVC-NEXT: [[POW:%.*]] = call <2 x double> @llvm.pow.v2f64(<2 x double> [[X:%.*]], <2 x double> <double 2.000000e+00, double 2.000000e+00>)
+; MSVC-NEXT: ret <2 x double> [[POW]]
;
%r = call <2 x double> @llvm.pow.v2f64(<2 x double> %x, <2 x double> <double 2.0, double 2.0>)
ret <2 x double> %r
; Don't drop the FMF - PR35601 ( https://bugs.llvm.org/show_bug.cgi?id=35601 )
define float @pow2_fast(float %x) {
-; ANY-LABEL: @pow2_fast(
+; CHECK-LABEL: @pow2_fast(
; ANY-NEXT: [[SQUARE:%.*]] = fmul fast float [[X:%.*]], [[X]]
; ANY-NEXT: ret float [[SQUARE]]
+; VC32-NEXT: [[POW:%.*]] = call fast float @powf(float [[X:%.*]], float 2.000000e+00)
+; VC32-NEXT: ret float [[POW]]
+; VC51-NEXT: [[POW:%.*]] = call fast float @powf(float [[X:%.*]], float 2.000000e+00)
+; VC51-NEXT: ret float [[POW]]
+; VC64-NEXT: [[SQUARE:%.*]] = fmul fast float [[X:%.*]], [[X]]
+; VC64-NEXT: ret float [[SQUARE]]
+; VC83-NEXT: [[SQUARE:%.*]] = fmul fast float [[X:%.*]], [[X]]
+; VC83-NEXT: ret float [[SQUARE]]
;
%r = call fast float @powf(float %x, float 2.0)
ret float %r
; Check pow(x, -1.0) -> 1.0/x.
define float @pow_neg1_strict(float %x) {
-; ANY-LABEL: @pow_neg1_strict(
+; CHECK-LABEL: @pow_neg1_strict(
; ANY-NEXT: [[RECIPROCAL:%.*]] = fdiv float 1.000000e+00, [[X:%.*]]
; ANY-NEXT: ret float [[RECIPROCAL]]
+; VC32-NEXT: [[POW:%.*]] = call float @powf(float [[X:%.*]], float -1.000000e+00)
+; VC32-NEXT: ret float [[POW]]
+; VC51-NEXT: [[POW:%.*]] = call float @powf(float [[X:%.*]], float -1.000000e+00)
+; VC51-NEXT: ret float [[POW]]
+; VC64-NEXT: [[RECIPROCAL:%.*]] = fdiv float 1.000000e+00, [[X:%.*]]
+; VC64-NEXT: ret float [[RECIPROCAL]]
+; VC83-NEXT: [[RECIPROCAL:%.*]] = fdiv float 1.000000e+00, [[X:%.*]]
+; VC83-NEXT: ret float [[RECIPROCAL]]
;
%r = call float @powf(float %x, float -1.0)
ret float %r
}
define <2 x float> @pow_neg1_strictv(<2 x float> %x) {
-; ANY-LABEL: @pow_neg1_strictv(
+; CHECK-LABEL: @pow_neg1_strictv(
; ANY-NEXT: [[RECIPROCAL:%.*]] = fdiv <2 x float> <float 1.000000e+00, float 1.000000e+00>, [[X:%.*]]
; ANY-NEXT: ret <2 x float> [[RECIPROCAL]]
+; MSVC-NEXT: [[POW:%.*]] = call <2 x float> @llvm.pow.v2f32(<2 x float> [[X:%.*]], <2 x float> <float -1.000000e+00, float -1.000000e+00>)
+; MSVC-NEXT: ret <2 x float> [[POW]]
;
%r = call <2 x float> @llvm.pow.v2f32(<2 x float> %x, <2 x float> <float -1.0, float -1.0>)
ret <2 x float> %r
}
define double @pow_neg1_double_fast(double %x) {
-; ANY-LABEL: @pow_neg1_double_fast(
-; ANY-NEXT: [[RECIPROCAL:%.*]] = fdiv fast double 1.000000e+00, [[X:%.*]]
-; ANY-NEXT: ret double [[RECIPROCAL]]
+; CHECK-LABEL: @pow_neg1_double_fast(
+; CHECK-NEXT: [[RECIPROCAL:%.*]] = fdiv fast double 1.000000e+00, [[X:%.*]]
+; CHECK-NEXT: ret double [[RECIPROCAL]]
;
%r = call fast double @pow(double %x, double -1.0)
ret double %r
}
define <2 x double> @pow_neg1_double_fastv(<2 x double> %x) {
-; ANY-LABEL: @pow_neg1_double_fastv(
+; CHECK-LABEL: @pow_neg1_double_fastv(
; ANY-NEXT: [[RECIPROCAL:%.*]] = fdiv fast <2 x double> <double 1.000000e+00, double 1.000000e+00>, [[X:%.*]]
; ANY-NEXT: ret <2 x double> [[RECIPROCAL]]
+; MSVC-NEXT: [[POW:%.*]] = call fast <2 x double> @llvm.pow.v2f64(<2 x double> [[X:%.*]], <2 x double> <double -1.000000e+00, double -1.000000e+00>)
+; MSVC-NEXT: ret <2 x double> [[POW]]
;
%r = call fast <2 x double> @llvm.pow.v2f64(<2 x double> %x, <2 x double> <double -1.0, double -1.0>)
ret <2 x double> %r
}
define double @test_simplify17(double %x) {
-; ANY-LABEL: @test_simplify17(
-; ANY-NEXT: [[SQRT:%.*]] = call double @llvm.sqrt.f64(double [[X:%.*]])
-; ANY-NEXT: [[ABS:%.*]] = call double @llvm.fabs.f64(double [[SQRT]])
-; ANY-NEXT: [[ISINF:%.*]] = fcmp oeq double [[X]], 0xFFF0000000000000
-; ANY-NEXT: [[TMP1:%.*]] = select i1 [[ISINF]], double 0x7FF0000000000000, double [[ABS]]
-; ANY-NEXT: ret double [[TMP1]]
+; CHECK-LABEL: @test_simplify17(
+; CHECK-NEXT: [[SQRT:%.*]] = call double @llvm.sqrt.f64(double [[X:%.*]])
+; CHECK-NEXT: [[ABS:%.*]] = call double @llvm.fabs.f64(double [[SQRT]])
+; CHECK-NEXT: [[ISINF:%.*]] = fcmp oeq double [[X]], 0xFFF0000000000000
+; CHECK-NEXT: [[TMP1:%.*]] = select i1 [[ISINF]], double 0x7FF0000000000000, double [[ABS]]
+; CHECK-NEXT: ret double [[TMP1]]
;
%retval = call double @llvm.pow.f64(double %x, double 0.5)
ret double %retval
; Check pow(10.0, x) -> __exp10(x) on OS X 10.9+ and iOS 7.0+.
define float @test_simplify18(float %x) {
-; CHECK-EXP10-LABEL: @test_simplify18(
-; CHECK-EXP10-NEXT: [[__EXP10F:%.*]] = call float @__exp10f(float [[X:%.*]]) [[NUW_RO]]
-; CHECK-EXP10-NEXT: ret float [[__EXP10F]]
-;
-; CHECK-NO-EXP10-LABEL: @test_simplify18(
-; CHECK-NO-EXP10-NEXT: [[RETVAL:%.*]] = call float @powf(float 1.000000e+01, float [[X:%.*]])
-; CHECK-NO-EXP10-NEXT: ret float [[RETVAL]]
+; CHECK-LABEL: @test_simplify18(
+; CHECK-EXP10-NEXT: [[__EXP10F:%.*]] = call float @__exp10f(float [[X:%.*]])
+; CHECK-EXP10-NEXT: ret float [[__EXP10F]]
+; CHECK-NO-EXP10-NEXT: [[RETVAL:%.*]] = call float @powf(float 1.000000e+01, float [[X:%.*]])
+; CHECK-NO-EXP10-NEXT: ret float [[RETVAL]]
;
%retval = call float @powf(float 10.0, float %x)
ret float %retval
}
define double @test_simplify19(double %x) {
-; CHECK-EXP10-LABEL: @test_simplify19(
-; CHECK-EXP10-NEXT: [[__EXP10:%.*]] = call double @__exp10(double [[X:%.*]]) [[NUW_RO]]
-; CHECK-EXP10-NEXT: ret double [[__EXP10]]
-;
-; CHECK-NO-EXP10-LABEL: @test_simplify19(
-; CHECK-NO-EXP10-NEXT: [[RETVAL:%.*]] = call double @pow(double 1.000000e+01, double [[X:%.*]])
-; CHECK-NO-EXP10-NEXT: ret double [[RETVAL]]
+; CHECK-LABEL: @test_simplify19(
+; CHECK-EXP10-NEXT: [[__EXP10:%.*]] = call double @__exp10(double [[X:%.*]])
+; CHECK-EXP10-NEXT: ret double [[__EXP10]]
+; CHECK-NO-EXP10-NEXT: [[RETVAL:%.*]] = call double @pow(double 1.000000e+01, double [[X:%.*]])
+; CHECK-NO-EXP10-NEXT: ret double [[RETVAL]]
;
%retval = call double @pow(double 10.0, double %x)
ret double %retval
}
-
-; CHECK-EXP10: attributes [[NUW_RO]] = { nounwind readonly }
-; RUN: opt -O2 -S -mtriple=i386-pc-win32 < %s | FileCheck %s -check-prefix=WIN32
-; RUN: opt -O2 -S -mtriple=x86_64-pc-win32 < %s | FileCheck %s -check-prefix=WIN64
-; RUN: opt -O2 -S -mtriple=i386-pc-mingw32 < %s | FileCheck %s -check-prefix=MINGW32
-; RUN: opt -O2 -S -mtriple=x86_64-pc-mingw32 < %s | FileCheck %s -check-prefix=MINGW64
+; RUN: opt < %s -O2 -S -mtriple=i386-pc-windows-msvc18 | FileCheck %s --check-prefixes=CHECK,MSVCXX,MSVC32
+; RUN: opt < %s -O2 -S -mtriple=i386-pc-windows-msvc | FileCheck %s --check-prefixes=CHECK,MSVC19,MSVC51
+; RUN: opt < %s -O2 -S -mtriple=x86_64-pc-windows-msvc17 | FileCheck %s --check-prefixes=CHECK,MSVCXX,MSVC64
+; RUN: opt < %s -O2 -S -mtriple=x86_64-pc-win32 | FileCheck %s --check-prefixes=CHECK,MSVC19,MSVC83
+; 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 {
-; WIN32-LABEL: @float_acos(
-; WIN32-NOT: float @acosf
-; WIN32: double @acos
+; CHECK-LABEL: @float_acos(
+; MSVCXX-NOT: float @acosf
+; MSVCXX: double @acos
+; MSVC19-NOT: float @acosf
+; MSVC19: double @acos
%1 = fpext float %x to double
%2 = call double @acos(double %1)
%3 = fptrunc double %2 to float
declare double @asin(double %x)
define float @float_asin(float %x) nounwind readnone {
-; WIN32-LABEL: @float_asin(
-; WIN32-NOT: float @asinf
-; WIN32: double @asin
+; CHECK-LABEL: @float_asin(
+; MSVCXX-NOT: float @asinf
+; MSVCXX: double @asin
+; MSVC19-NOT: float @asinf
+; MSVC19: double @asin
%1 = fpext float %x to double
%2 = call double @asin(double %1)
%3 = fptrunc double %2 to float
declare double @atan(double %x)
define float @float_atan(float %x) nounwind readnone {
-; WIN32-LABEL: @float_atan(
-; WIN32-NOT: float @atanf
-; WIN32: double @atan
+; CHECK-LABEL: @float_atan(
+; MSVCXX-NOT: float @atanf
+; MSVCXX: double @atan
+; MSVC19-NOT: float @atanf
+; MSVC19: double @atan
%1 = fpext float %x to double
%2 = call double @atan(double %1)
%3 = fptrunc double %2 to float
declare double @atan2(double %x, double %y)
define float @float_atan2(float %x, float %y) nounwind readnone {
-; WIN32-LABEL: @float_atan2(
-; WIN32-NOT: float @atan2f
-; WIN32: double @atan2
+; CHECK-LABEL: @float_atan2(
+; MSVCXX-NOT: float @atan2f
+; MSVCXX: double @atan2
+; MSVC19-NOT: float @atan2f
+; MSVC19: double @atan2
%1 = fpext float %x to double
%2 = fpext float %y to double
%3 = call double @atan2(double %1, double %2)
declare double @ceil(double %x)
define float @float_ceil(float %x) nounwind readnone {
-; WIN32-LABEL: @float_ceil(
-; WIN32-NOT: float @ceilf
-; WIN32: float @llvm.ceil.f32
-; WIN64-LABEL: @float_ceil(
-; WIN64: float @llvm.ceil.f32
-; WIN64-NOT: double @ceil
-; MINGW32-LABEL: @float_ceil(
-; MINGW32: float @llvm.ceil.f32
+; CHECK-LABEL: @float_ceil(
+; MSVCXX-NOT: float @ceilf
+; MSVCXX: float @llvm.ceil.f32
+; MSVC19-NOT: double @ceil
+; MSVC19: float @llvm.ceil.f32
; MINGW32-NOT: double @ceil
-; MINGW64-LABEL: @float_ceil(
-; MINGW64: float @llvm.ceil.f32
+; MINGW32: float @llvm.ceil.f32
; MINGW64-NOT: double @ceil
+; MINGW64: float @llvm.ceil.f32
%1 = fpext float %x to double
%2 = call double @ceil(double %1)
%3 = fptrunc double %2 to float
declare double @_copysign(double %x)
define float @float_copysign(float %x) nounwind readnone {
-; WIN32-LABEL: @float_copysign(
-; WIN32-NOT: float @copysignf
-; WIN32-NOT: float @_copysignf
-; WIN32: double @_copysign
+; CHECK-LABEL: @float_copysign(
+; MSVCXX-NOT: float @_copysignf
+; MSVCXX: double @_copysign
+; MSVC19-NOT: float @_copysignf
+; MSVC19: double @_copysign
%1 = fpext float %x to double
%2 = call double @_copysign(double %1)
%3 = fptrunc double %2 to float
declare double @cos(double %x)
define float @float_cos(float %x) nounwind readnone {
-; WIN32-LABEL: @float_cos(
-; WIN32-NOT: float @cosf
-; WIN32: double @cos
+; CHECK-LABEL: @float_cos(
+; MSVCXX-NOT: float @cosf
+; MSVCXX: double @cos
+; MSVC19-NOT: float @cosf
+; MSVC19: double @cos
%1 = fpext float %x to double
%2 = call double @cos(double %1)
%3 = fptrunc double %2 to float
declare double @cosh(double %x)
define float @float_cosh(float %x) nounwind readnone {
-; WIN32-LABEL: @float_cosh(
-; WIN32-NOT: float @coshf
-; WIN32: double @cosh
+; CHECK-LABEL: @float_cosh(
+; MSVCXX-NOT: float @coshf
+; MSVCXX: double @cosh
+; MSVC19-NOT: float @coshf
+; MSVC19: double @cosh
%1 = fpext float %x to double
%2 = call double @cosh(double %1)
%3 = fptrunc double %2 to float
declare double @exp(double %x, double %y)
define float @float_exp(float %x, float %y) nounwind readnone {
-; WIN32-LABEL: @float_exp(
-; WIN32-NOT: float @expf
-; WIN32: double @exp
+; CHECK-LABEL: @float_exp(
+; MSVCXX-NOT: float @expf
+; MSVCXX: double @exp
+; MSVC19-NOT: float @expf
+; MSVC19: double @exp
%1 = fpext float %x to double
%2 = fpext float %y to double
%3 = call double @exp(double %1, double %2)
declare double @fabs(double %x, double %y)
define float @float_fabs(float %x, float %y) nounwind readnone {
-; WIN32-LABEL: @float_fabs(
-; WIN32-NOT: float @fabsf
-; WIN32: double @fabs
-; WIN64-LABEL: @float_fabs(
-; WIN64-NOT: float @fabsf
-; WIN64: double @fabs
+; CHECK-LABEL: @float_fabs(
+; MSVCXX-NOT: float @fabsf
+; MSVCXX: double @fabs
+; MSVC19-NOT: float @fabsf
+; MSVC19: double @fabs
%1 = fpext float %x to double
%2 = fpext float %y to double
%3 = call double @fabs(double %1, double %2)
declare double @floor(double %x)
define float @float_floor(float %x) nounwind readnone {
-; WIN32-LABEL: @float_floor(
-; WIN32-NOT: float @floorf
-; WIN32: float @llvm.floor.f32
-; WIN64-LABEL: @float_floor(
-; WIN64: float @llvm.floor.f32
-; WIN64-NOT: double @floor
-; MINGW32-LABEL: @float_floor(
-; MINGW32: float @llvm.floor.f32
+; CHECK-LABEL: @float_floor(
+; MSVCXX-NOT: float @floorf
+; MSVCXX: float @llvm.floor.f32
+; MSVC19-NOT: double @floor
+; MSVC19: float @llvm.floor.f32
; MINGW32-NOT: double @floor
-; MINGW64-LABEL: @float_floor(
-; MINGW64: float @llvm.floor.f32
+; MINGW32: float @llvm.floor.f32
; MINGW64-NOT: double @floor
+; MINGW64: float @llvm.floor.f32
%1 = fpext float %x to double
%2 = call double @floor(double %1)
%3 = fptrunc double %2 to float
declare double @fmod(double %x, double %y)
define float @float_fmod(float %x, float %y) nounwind readnone {
-; WIN32-LABEL: @float_fmod(
-; WIN32-NOT: float @fmodf
-; WIN32: double @fmod
+; MSVCXX-LABEL: @float_fmod(
+; MSVCXX-NOT: float @fmodf
+; MSVCXX: double @fmod
+; MSVC19-NOT: float @fmodf
+; MSVC19: double @fmod
%1 = fpext float %x to double
%2 = fpext float %y to double
%3 = call double @fmod(double %1, double %2)
declare double @log(double %x)
define float @float_log(float %x) nounwind readnone {
-; WIN32-LABEL: @float_log(
-; WIN32-NOT: float @logf
-; WIN32: double @log
+; CHECK-LABEL: @float_log(
+; MSVCXX-NOT: float @logf
+; MSVCXX: double @log
+; MSVC19-NOT: float @logf
+; MSVC19: double @log
%1 = fpext float %x to double
%2 = call double @log(double %1)
%3 = fptrunc double %2 to float
ret float %3
}
+declare double @logb(double %x)
+define float @float_logb(float %x) nounwind readnone {
+; CHECK-LABEL: @float_logb(
+; MSVCXX-NOT: float @logbf
+; MSVCXX: double @logb
+; MSVC19-NOT: float @logbf
+; MSVC19: 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 {
-; WIN32-LABEL: @float_pow(
-; WIN32-NOT: float @powf
-; WIN32: double @pow
+; CHECK-LABEL: @float_pow(
+; MSVCXX-NOT: float @powf
+; MSVCXX: double @pow
+; MSVC19-NOT: float @powf
+; MSVC19: double @pow
%1 = fpext float %x to double
%2 = fpext float %y to double
%3 = call double @pow(double %1, double %2)
declare double @sin(double %x)
define float @float_sin(float %x) nounwind readnone {
-; WIN32-LABEL: @float_sin(
-; WIN32-NOT: float @sinf
-; WIN32: double @sin
+; CHECK-LABEL: @float_sin(
+; MSVCXX-NOT: float @sinf
+; MSVCXX: double @sin
+; MSVC19-NOT: float @sinf
+; MSVC19: double @sin
%1 = fpext float %x to double
%2 = call double @sin(double %1)
%3 = fptrunc double %2 to float
declare double @sinh(double %x)
define float @float_sinh(float %x) nounwind readnone {
-; WIN32-LABEL: @float_sinh(
-; WIN32-NOT: float @sinhf
-; WIN32: double @sinh
+; CHECK-LABEL: @float_sinh(
+; MSVCXX-NOT: float @sinhf
+; MSVCXX: double @sinh
+; MSVC19-NOT: float @sinhf
+; MSVC19: double @sinh
%1 = fpext float %x to double
%2 = call double @sinh(double %1)
%3 = fptrunc double %2 to float
declare double @sqrt(double %x)
define float @float_sqrt(float %x) nounwind readnone {
-; WIN32-LABEL: @float_sqrt(
-; WIN32-NOT: float @sqrtf
-; WIN32: double @sqrt
-; WIN64-LABEL: @float_sqrt(
-; WIN64: float @sqrtf
-; WIN64-NOT: double @sqrt
-; MINGW32-LABEL: @float_sqrt(
-; MINGW32: float @sqrtf
+; CHECK-LABEL: @float_sqrt(
+; MSVC32-NOT: float @sqrtf
+; MSVC32: double @sqrt
+; MSVC51-NOT: float @sqrtf
+; MSVC51: double @sqrt
+; MSVC64-NOT: double @sqrt
+; MSVC64: float @sqrtf
+; MSVC83-NOT: double @sqrt
+; MSVC83: float @sqrtf
; MINGW32-NOT: double @sqrt
-; MINGW64-LABEL: @float_sqrt(
-; MINGW64: float @sqrtf
+; MINGW32: float @sqrtf
; MINGW64-NOT: double @sqrt
+; MINGW64: float @sqrtf
%1 = fpext float %x to double
%2 = call double @sqrt(double %1)
%3 = fptrunc double %2 to float
declare double @tan(double %x)
define float @float_tan(float %x) nounwind readnone {
-; WIN32-LABEL: @float_tan(
-; WIN32-NOT: float @tanf
-; WIN32: double @tan
+; CHECK-LABEL: @float_tan(
+; MSVCXX-NOT: float @tanf
+; MSVCXX: double @tan
+; MSVC19-NOT: float @tanf
+; MSVC19: double @tan
%1 = fpext float %x to double
%2 = call double @tan(double %1)
%3 = fptrunc double %2 to float
declare double @tanh(double %x)
define float @float_tanh(float %x) nounwind readnone {
-; WIN32-LABEL: @float_tanh(
-; WIN32-NOT: float @tanhf
-; WIN32: double @tanh
+; CHECK-LABEL: @float_tanh(
+; MSVCXX-NOT: float @tanhf
+; MSVCXX: double @tanh
+; MSVC19-NOT: float @tanhf
+; MSVC19: double @tanh
%1 = fpext float %x to double
%2 = call double @tanh(double %1)
%3 = fptrunc double %2 to float
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 {
-; WIN32-LABEL: @float_round(
-; WIN32-NOT: float @roundf
-; WIN32: double @round
-; WIN64-LABEL: @float_round(
-; WIN64-NOT: float @roundf
-; WIN64: double @round
-; MINGW32-LABEL: @float_round(
-; MINGW32: float @llvm.round.f32
+; CHECK-LABEL: @float_round(
+; MSVCXX-NOT: double @roundf
+; MSVCXX: double @round
+; MSVC19-NOT: double @round
+; MSVC19: float @llvm.round.f32
; MINGW32-NOT: double @round
-; MINGW64-LABEL: @float_round(
-; MINGW64: float @llvm.round.f32
+; MINGW32: float @llvm.round.f32
; MINGW64-NOT: double @round
+; MINGW64: float @llvm.round.f32
%1 = fpext float %x to double
%2 = call double @round(double %1)
%3 = fptrunc double %2 to float
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 {
-; WIN32-LABEL: @float_powsqrt(
-; WIN32-NOT: float @sqrtf
-; WIN32: float @powf
-
-; WIN64-LABEL: @float_powsqrt(
-; WIN64: float @sqrtf
-; WIN64: float @llvm.fabs.f32(
-; WIN64-NOT: float @powf
-
-; MINGW32-LABEL: @float_powsqrt(
+; CHECK-LABEL: @float_powsqrt(
+; MSVC32-NOT: float @sqrtf
+; MSVC32: float @powf
+; MSVC51-NOT: float @sqrtf
+; MSVC51: float @powf
+; MSVC64-NOT: float @powf
+; MSVC64: float @sqrtf
+; MSVC64: float @llvm.fabs.f32(
+; MSVC83-NOT: float @powf
+; MSVC83: float @sqrtf
+; MSVC83: float @llvm.fabs.f32(
+; MINGW32-NOT: float @powf
; MINGW32: float @sqrtf
; MINGW32: float @llvm.fabs.f32
-; MINGW32-NOT: float @powf
-; MINGW64-LABEL: @float_powsqrt(
+; MINGW64-NOT: float @powf
; MINGW64: float @sqrtf
; MINGW64: float @llvm.fabs.f32(
-; MINGW64-NOT: float @powf
%1 = call float @powf(float %x, float 0.5)
ret float %1
}