1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-24 19:52:54 +01:00

[InstCombine] Expand testing for Windows (NFC)

Added the checks to the existing cases when the target is Win64.

llvm-svn: 352714
This commit is contained in:
Evandro Menezes 2019-01-31 01:41:39 +00:00
parent 1067bf29d3
commit d240a1f88f

View File

@ -9,7 +9,7 @@
; 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=x86_64-pc-windows-msvc | FileCheck %s --check-prefixes=CHECK,WIN,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.
@ -24,7 +24,7 @@ declare <2 x double> @llvm.pow.v2f64(<2 x double>, <2 x double>) nounwind readon
define float @test_simplify1(float %x) {
; CHECK-LABEL: @test_simplify1(
; ANY-NEXT: ret float 1.000000e+00
; CHECK-NEXT: ret float 1.000000e+00
;
%retval = call float @powf(float 1.0, float %x)
ret float %retval
@ -33,6 +33,8 @@ define float @test_simplify1(float %x) {
define <2 x float> @test_simplify1v(<2 x float> %x) {
; CHECK-LABEL: @test_simplify1v(
; ANY-NEXT: ret <2 x float> <float 1.000000e+00, float 1.000000e+00>
; WIN-NEXT: [[POW:%.*]] = call <2 x float> @llvm.pow.v2f32(<2 x float> <float 1.000000e+00, float 1.000000e+00>, <2 x float> %x)
; WIN-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
@ -40,7 +42,7 @@ define <2 x float> @test_simplify1v(<2 x float> %x) {
define double @test_simplify2(double %x) {
; CHECK-LABEL: @test_simplify2(
; ANY-NEXT: ret double 1.000000e+00
; CHECK-NEXT: ret double 1.000000e+00
;
%retval = call double @pow(double 1.0, double %x)
ret double %retval
@ -49,6 +51,8 @@ define double @test_simplify2(double %x) {
define <2 x double> @test_simplify2v(<2 x double> %x) {
; CHECK-LABEL: @test_simplify2v(
; ANY-NEXT: ret <2 x double> <double 1.000000e+00, double 1.000000e+00>
; WIN-NEXT: [[POW:%.*]] = call <2 x double> @llvm.pow.v2f64(<2 x double> <double 1.000000e+00, double 1.000000e+00>, <2 x double> %x)
; WIN-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
@ -95,6 +99,8 @@ define <2 x double> @test_simplify3vn(<2 x double> %x) {
; 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]]
; WIN-NEXT: [[POW:%.*]] = call <2 x double> @llvm.pow.v2f64(<2 x double> <double 4.000000e+00, double 4.000000e+00>, <2 x double> %x)
; WIN-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
@ -150,7 +156,7 @@ define <2 x float> @test_simplify4vn(<2 x float> %x) {
define float @test_simplify5(float %x) {
; CHECK-LABEL: @test_simplify5(
; ANY-NEXT: ret float 1.000000e+00
; CHECK-NEXT: ret float 1.000000e+00
;
%retval = call float @powf(float %x, float 0.0)
ret float %retval
@ -159,6 +165,8 @@ define float @test_simplify5(float %x) {
define <2 x float> @test_simplify5v(<2 x float> %x) {
; CHECK-LABEL: @test_simplify5v(
; ANY-NEXT: ret <2 x float> <float 1.000000e+00, float 1.000000e+00>
; WIN-NEXT: [[POW:%.*]] = call <2 x float> @llvm.pow.v2f32(<2 x float> [[X:%.*]], <2 x float> zeroinitializer)
; WIN-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
@ -166,7 +174,7 @@ define <2 x float> @test_simplify5v(<2 x float> %x) {
define double @test_simplify6(double %x) {
; CHECK-LABEL: @test_simplify6(
; ANY-NEXT: ret double 1.000000e+00
; CHECK-NEXT: ret double 1.000000e+00
;
%retval = call double @pow(double %x, double 0.0)
ret double %retval
@ -175,6 +183,8 @@ define double @test_simplify6(double %x) {
define <2 x double> @test_simplify6v(<2 x double> %x) {
; CHECK-LABEL: @test_simplify6v(
; ANY-NEXT: ret <2 x double> <double 1.000000e+00, double 1.000000e+00>
; WIN-NEXT: [[POW:%.*]] = call <2 x double> @llvm.pow.v2f64(<2 x double> [[X:%.*]], <2 x double> zeroinitializer)
; WIN-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
@ -185,10 +195,11 @@ define <2 x double> @test_simplify6v(<2 x double> %x) {
define float @test_simplify7(float %x) {
; CHECK-LABEL: @test_simplify7(
; ANY-NEXT: [[SQRTF:%.*]] = call float @sqrtf(float [[X:%.*]]) [[NUW_RO]]
; 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]]
; WIN-NEXT: [[SQRTF:%.*]] = call float @sqrtf(float [[X:%.*]]) [[NUW_RO:#[0-9]+]]
; 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]]
; CHECK-NEXT: ret float [[TMP1]]
;
%retval = call float @powf(float %x, float 0.5)
ret float %retval
@ -196,11 +207,11 @@ define float @test_simplify7(float %x) {
define double @test_simplify8(double %x) {
; CHECK-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-NEXT: [[SQRT:%.*]] = call double @sqrt(double [[X:%.*]]) [[NUW_RO]]
; 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
@ -210,7 +221,7 @@ define double @test_simplify8(double %x) {
define float @test_simplify9(float %x) {
; CHECK-LABEL: @test_simplify9(
; ANY-NEXT: ret float 0x7FF0000000000000
; CHECK-NEXT: ret float 0x7FF0000000000000
;
%retval = call float @powf(float 0xFFF0000000000000, float 0.5)
ret float %retval
@ -218,7 +229,7 @@ define float @test_simplify9(float %x) {
define double @test_simplify10(double %x) {
; CHECK-LABEL: @test_simplify10(
; ANY-NEXT: ret double 0x7FF0000000000000
; CHECK-NEXT: ret double 0x7FF0000000000000
;
%retval = call double @pow(double 0xFFF0000000000000, double 0.5)
ret double %retval
@ -228,7 +239,7 @@ define double @test_simplify10(double %x) {
define float @test_simplify11(float %x) {
; CHECK-LABEL: @test_simplify11(
; ANY-NEXT: ret float [[X:%.*]]
; CHECK-NEXT: ret float [[X:%.*]]
;
%retval = call float @powf(float %x, float 1.0)
ret float %retval
@ -237,6 +248,8 @@ define float @test_simplify11(float %x) {
define <2 x float> @test_simplify11v(<2 x float> %x) {
; CHECK-LABEL: @test_simplify11v(
; ANY-NEXT: ret <2 x float> [[X:%.*]]
; WIN-NEXT: [[POW:%.*]] = call <2 x float> @llvm.pow.v2f32(<2 x float> [[X:%.*]], <2 x float> <float 1.000000e+00, float 1.000000e+00>)
; WIN-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
@ -244,7 +257,7 @@ define <2 x float> @test_simplify11v(<2 x float> %x) {
define double @test_simplify12(double %x) {
; CHECK-LABEL: @test_simplify12(
; ANY-NEXT: ret double [[X:%.*]]
; CHECK-NEXT: ret double [[X:%.*]]
;
%retval = call double @pow(double %x, double 1.0)
ret double %retval
@ -253,6 +266,8 @@ define double @test_simplify12(double %x) {
define <2 x double> @test_simplify12v(<2 x double> %x) {
; CHECK-LABEL: @test_simplify12v(
; ANY-NEXT: ret <2 x double> [[X:%.*]]
; WIN-NEXT: [[POW:%.*]] = call <2 x double> @llvm.pow.v2f64(<2 x double> [[X:%.*]], <2 x double> <double 1.000000e+00, double 1.000000e+00>)
; WIN-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
@ -262,8 +277,8 @@ define <2 x double> @test_simplify12v(<2 x double> %x) {
define float @pow2_strict(float %x) {
; CHECK-LABEL: @pow2_strict(
; ANY-NEXT: [[SQUARE:%.*]] = fmul float [[X:%.*]], [[X]]
; ANY-NEXT: ret float [[SQUARE]]
; CHECK-NEXT: [[SQUARE:%.*]] = fmul float [[X:%.*]], [[X]]
; CHECK-NEXT: ret float [[SQUARE]]
;
%r = call float @powf(float %x, float 2.0)
ret float %r
@ -273,6 +288,8 @@ define <2 x float> @pow2_strictv(<2 x float> %x) {
; CHECK-LABEL: @pow2_strictv(
; ANY-NEXT: [[SQUARE:%.*]] = fmul <2 x float> [[X:%.*]], [[X]]
; ANY-NEXT: ret <2 x float> [[SQUARE]]
; WIN-NEXT: [[POW:%.*]] = call <2 x float> @llvm.pow.v2f32(<2 x float> [[X:%.*]], <2 x float> <float 2.000000e+00, float 2.000000e+00>)
; WIN-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
@ -280,8 +297,8 @@ define <2 x float> @pow2_strictv(<2 x float> %x) {
define double @pow2_double_strict(double %x) {
; CHECK-LABEL: @pow2_double_strict(
; ANY-NEXT: [[SQUARE:%.*]] = fmul double [[X:%.*]], [[X]]
; ANY-NEXT: ret double [[SQUARE]]
; CHECK-NEXT: [[SQUARE:%.*]] = fmul double [[X:%.*]], [[X]]
; CHECK-NEXT: ret double [[SQUARE]]
;
%r = call double @pow(double %x, double 2.0)
ret double %r
@ -291,6 +308,8 @@ define <2 x double> @pow2_double_strictv(<2 x double> %x) {
; CHECK-LABEL: @pow2_double_strictv(
; ANY-NEXT: [[SQUARE:%.*]] = fmul <2 x double> [[X:%.*]], [[X]]
; ANY-NEXT: ret <2 x double> [[SQUARE]]
; WIN-NEXT: [[POW:%.*]] = call <2 x double> @llvm.pow.v2f64(<2 x double> [[X:%.*]], <2 x double> <double 2.000000e+00, double 2.000000e+00>)
; WIN-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
@ -300,8 +319,8 @@ define <2 x double> @pow2_double_strictv(<2 x double> %x) {
define float @pow2_fast(float %x) {
; CHECK-LABEL: @pow2_fast(
; ANY-NEXT: [[SQUARE:%.*]] = fmul fast float [[X:%.*]], [[X]]
; ANY-NEXT: ret float [[SQUARE]]
; CHECK-NEXT: [[SQUARE:%.*]] = fmul fast float [[X:%.*]], [[X]]
; CHECK-NEXT: ret float [[SQUARE]]
;
%r = call fast float @powf(float %x, float 2.0)
ret float %r
@ -311,8 +330,8 @@ define float @pow2_fast(float %x) {
define float @pow_neg1_strict(float %x) {
; CHECK-LABEL: @pow_neg1_strict(
; ANY-NEXT: [[RECIPROCAL:%.*]] = fdiv float 1.000000e+00, [[X:%.*]]
; ANY-NEXT: ret float [[RECIPROCAL]]
; CHECK-NEXT: [[RECIPROCAL:%.*]] = fdiv float 1.000000e+00, [[X:%.*]]
; CHECK-NEXT: ret float [[RECIPROCAL]]
;
%r = call float @powf(float %x, float -1.0)
ret float %r
@ -322,6 +341,8 @@ define <2 x float> @pow_neg1_strictv(<2 x float> %x) {
; 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]]
; WIN-NEXT: [[POW:%.*]] = call <2 x float> @llvm.pow.v2f32(<2 x float> [[X:%.*]], <2 x float> <float -1.000000e+00, float -1.000000e+00>)
; WIN-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
@ -329,8 +350,8 @@ define <2 x float> @pow_neg1_strictv(<2 x float> %x) {
define double @pow_neg1_double_fast(double %x) {
; CHECK-LABEL: @pow_neg1_double_fast(
; ANY-NEXT: [[RECIPROCAL:%.*]] = fdiv fast double 1.000000e+00, [[X:%.*]]
; ANY-NEXT: ret double [[RECIPROCAL]]
; 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
@ -340,6 +361,8 @@ define <2 x double> @pow_neg1_double_fastv(<2 x double> %x) {
; 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]]
; WIN-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>)
; WIN-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
@ -347,11 +370,11 @@ define <2 x double> @pow_neg1_double_fastv(<2 x double> %x) {
define double @test_simplify17(double %x) {
; CHECK-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-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
@ -360,29 +383,25 @@ define double @test_simplify17(double %x) {
; 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:%.*]]) [[NUW_RO]]
; 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:%.*]]) [[NUW_RO]]
; 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 }
; CHECK: attributes [[NUW_RO]] = { nounwind readonly }