diff options
author | Craig Topper <craig.topper@intel.com> | 2018-03-01 20:05:07 +0000 |
---|---|---|
committer | Craig Topper <craig.topper@intel.com> | 2018-03-01 20:05:07 +0000 |
commit | f1a7c6755df5bd61448ee606dbfe422460d61a4e (patch) | |
tree | 4f2429332647a52b209ab30a70e9cb0642b9ada3 /llvm | |
parent | 50721ab32526af4a884f539266f7e11af72b4849 (diff) | |
download | bcm5719-llvm-f1a7c6755df5bd61448ee606dbfe422460d61a4e.tar.gz bcm5719-llvm-f1a7c6755df5bd61448ee606dbfe422460d61a4e.zip |
[InstCombine] Auto-generate complete checks. NFC
llvm-svn: 326474
Diffstat (limited to 'llvm')
-rw-r--r-- | llvm/test/Transforms/InstCombine/double-float-shrink-2.ll | 387 |
1 files changed, 246 insertions, 141 deletions
diff --git a/llvm/test/Transforms/InstCombine/double-float-shrink-2.ll b/llvm/test/Transforms/InstCombine/double-float-shrink-2.ll index 4813614f26c..5fd6e4ea1c2 100644 --- a/llvm/test/Transforms/InstCombine/double-float-shrink-2.ll +++ b/llvm/test/Transforms/InstCombine/double-float-shrink-2.ll @@ -1,9 +1,10 @@ -; RUN: opt < %s -instcombine -S -mtriple "i386-pc-linux" | FileCheck -check-prefix=DO-SIMPLIFY -check-prefix=ALL %s -; RUN: opt < %s -instcombine -S -mtriple "i386-pc-win32" | FileCheck -check-prefix=DONT-SIMPLIFY -check-prefix=ALL %s -; RUN: opt < %s -instcombine -S -mtriple "x86_64-pc-win32" | FileCheck -check-prefix=C89-SIMPLIFY -check-prefix=ALL %s -; RUN: opt < %s -instcombine -S -mtriple "i386-pc-mingw32" | FileCheck -check-prefix=DO-SIMPLIFY -check-prefix=ALL %s -; RUN: opt < %s -instcombine -S -mtriple "x86_64-pc-mingw32" | FileCheck -check-prefix=DO-SIMPLIFY -check-prefix=ALL %s -; RUN: opt < %s -instcombine -S -mtriple "sparc-sun-solaris" | FileCheck -check-prefix=DO-SIMPLIFY -check-prefix=ALL %s +; 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 declare double @floor(double) declare double @ceil(double) @@ -19,11 +20,11 @@ declare double @llvm.nearbyint.f64(double) declare double @llvm.trunc.f64(double) declare double @llvm.fabs.f64(double) -; ALL-LABEL: @test_shrink_libcall_floor( -; DO-SIMPLIFY: call float @llvm.floor.f32( -; C89-SIMPLIFY: call float @llvm.floor.f32( -; DONT-SIMPLIFY: call float @llvm.floor.f32( 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]] +; %D = fpext float %C to double ; --> floorf %E = call double @floor(double %D) @@ -31,11 +32,11 @@ define float @test_shrink_libcall_floor(float %C) { ret float %F } -; ALL-LABEL: @test_shrink_libcall_ceil( -; DO-SIMPLIFY: call float @llvm.ceil.f32( -; C89-SIMPLIFY: call float @llvm.ceil.f32( -; DONT-SIMPLIFY: call float @llvm.ceil.f32( 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]] +; %D = fpext float %C to double ; --> ceilf %E = call double @ceil(double %D) @@ -43,11 +44,23 @@ define float @test_shrink_libcall_ceil(float %C) { ret float %F } -; ALL-LABEL: @test_shrink_libcall_round( -; DO-SIMPLIFY: call float @llvm.round.f32( -; C89-SIMPLIFY: call double @round( -; DONT-SIMPLIFY: call double @round( 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]] +; %D = fpext float %C to double ; --> roundf %E = call double @round(double %D) @@ -55,11 +68,23 @@ define float @test_shrink_libcall_round(float %C) { ret float %F } -; ALL-LABEL: @test_shrink_libcall_nearbyint( -; DO-SIMPLIFY: call float @llvm.nearbyint.f32( -; C89-SIMPLIFY: call double @nearbyint( -; DONT-SIMPLIFY: call double @nearbyint( 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]] +; %D = fpext float %C to double ; --> nearbyintf %E = call double @nearbyint(double %D) @@ -67,10 +92,23 @@ define float @test_shrink_libcall_nearbyint(float %C) { ret float %F } -; ALL-LABEL: @test_shrink_libcall_trunc( -; DO-SIMPLIFY: call float @llvm.trunc.f32( -; DONT-SIMPLIFY: call double @trunc( 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]] +; %D = fpext float %C to double ; --> truncf %E = call double @trunc(double %D) @@ -78,13 +116,13 @@ define float @test_shrink_libcall_trunc(float %C) { ret float %F } -; ALL-LABEL: @test_shrink_libcall_fabs( -; DO-SIMPLIFY: call float @llvm.fabs.f32( - ; This is replaced with the intrinsic, which does the right thing on ; all platforms. -; DONT-SIMPLIFY: call float @llvm.fabs.f32( 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]] +; %D = fpext float %C to double ; --> fabsf %E = call double @fabs(double %D) @@ -93,9 +131,11 @@ define float @test_shrink_libcall_fabs(float %C) { } ; Make sure fast math flags are preserved -; ALL-LABEL: @test_shrink_libcall_fabs_fast( -; DO-SIMPLIFY: call fast float @llvm.fabs.f32( 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]] +; %D = fpext float %C to double ; --> fabsf %E = call fast double @fabs(double %D) @@ -103,9 +143,11 @@ define float @test_shrink_libcall_fabs_fast(float %C) { ret float %F } -; ALL-LABEL: @test_shrink_intrin_floor( -; ALL: call float @llvm.floor.f32( define float @test_shrink_intrin_floor(float %C) { +; ALL-LABEL: @test_shrink_intrin_floor( +; ALL-NEXT: [[E:%.*]] = call float @llvm.floor.f32(float [[C:%.*]]) +; ALL-NEXT: ret float [[E]] +; %D = fpext float %C to double ; --> floorf %E = call double @llvm.floor.f64(double %D) @@ -113,9 +155,11 @@ define float @test_shrink_intrin_floor(float %C) { ret float %F } -; ALL-LABEL: @test_shrink_intrin_ceil( -; ALL: call float @llvm.ceil.f32( define float @test_shrink_intrin_ceil(float %C) { +; ALL-LABEL: @test_shrink_intrin_ceil( +; ALL-NEXT: [[E:%.*]] = call float @llvm.ceil.f32(float [[C:%.*]]) +; ALL-NEXT: ret float [[E]] +; %D = fpext float %C to double ; --> ceilf %E = call double @llvm.ceil.f64(double %D) @@ -123,9 +167,11 @@ define float @test_shrink_intrin_ceil(float %C) { ret float %F } -; ALL-LABEL: @test_shrink_intrin_round( -; ALL: call float @llvm.round.f32( define float @test_shrink_intrin_round(float %C) { +; ALL-LABEL: @test_shrink_intrin_round( +; ALL-NEXT: [[E:%.*]] = call float @llvm.round.f32(float [[C:%.*]]) +; ALL-NEXT: ret float [[E]] +; %D = fpext float %C to double ; --> roundf %E = call double @llvm.round.f64(double %D) @@ -133,9 +179,11 @@ define float @test_shrink_intrin_round(float %C) { ret float %F } -; ALL-LABEL: @test_shrink_intrin_nearbyint( -; ALL: call float @llvm.nearbyint.f32( define float @test_shrink_intrin_nearbyint(float %C) { +; ALL-LABEL: @test_shrink_intrin_nearbyint( +; ALL-NEXT: [[E:%.*]] = call float @llvm.nearbyint.f32(float [[C:%.*]]) +; ALL-NEXT: ret float [[E]] +; %D = fpext float %C to double ; --> nearbyintf %E = call double @llvm.nearbyint.f64(double %D) @@ -143,18 +191,22 @@ define float @test_shrink_intrin_nearbyint(float %C) { ret float %F } -; ALL-LABEL: @test_shrink_intrin_trunc( -; ALL-SIMPLIFY: call float @llvm.trunc.f32( define float @test_shrink_intrin_trunc(float %C) { +; ALL-LABEL: @test_shrink_intrin_trunc( +; ALL-NEXT: [[E:%.*]] = call float @llvm.trunc.f32(float [[C:%.*]]) +; ALL-NEXT: ret float [[E]] +; %D = fpext float %C to double %E = call double @llvm.trunc.f64(double %D) %F = fptrunc double %E to float ret float %F } -; ALL-LABEL: @test_shrink_intrin_fabs( -; ALL: call float @llvm.fabs.f32( define float @test_shrink_intrin_fabs(float %C) { +; ALL-LABEL: @test_shrink_intrin_fabs( +; ALL-NEXT: [[E:%.*]] = call float @llvm.fabs.f32(float [[C:%.*]]) +; ALL-NEXT: ret float [[E]] +; %D = fpext float %C to double %E = call double @llvm.fabs.f64(double %D) %F = fptrunc double %E to float @@ -162,265 +214,309 @@ define float @test_shrink_intrin_fabs(float %C) { } ; Make sure fast math flags are preserved -; ALL-LABEL: @test_shrink_intrin_fabs_fast( -; ALL: call fast float @llvm.fabs.f32( define float @test_shrink_intrin_fabs_fast(float %C) { +; ALL-LABEL: @test_shrink_intrin_fabs_fast( +; ALL-NEXT: [[E:%.*]] = call fast float @llvm.fabs.f32(float [[C:%.*]]) +; ALL-NEXT: ret float [[E]] +; %D = fpext float %C to double %E = call fast double @llvm.fabs.f64(double %D) %F = fptrunc double %E to float ret float %F } -; ALL-LABEL: @test_no_shrink_intrin_floor( -; ALL: call double @llvm.floor.f64( 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]] +; %E = call double @llvm.floor.f64(double %D) %F = fptrunc double %E to float ret float %F } -; ALL-LABEL: @test_no_shrink_intrin_ceil( -; ALL: call double @llvm.ceil.f64( 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]] +; %E = call double @llvm.ceil.f64(double %D) %F = fptrunc double %E to float ret float %F } -; ALL-LABEL: @test_no_shrink_intrin_round( -; ALL: call double @llvm.round.f64( 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]] +; %E = call double @llvm.round.f64(double %D) %F = fptrunc double %E to float ret float %F } -; ALL-LABEL: @test_no_shrink_intrin_nearbyint( -; ALL: call double @llvm.nearbyint.f64( 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]] +; %E = call double @llvm.nearbyint.f64(double %D) %F = fptrunc double %E to float ret float %F } -; ALL-LABEL: @test_no_shrink_intrin_trunc( -; ALL-SIMPLIFY: call double @llvm.trunc.f64( 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]] +; %E = call double @llvm.trunc.f64(double %D) %F = fptrunc double %E to float ret float %F } -; ALL-LABEL: @test_shrink_intrin_fabs_double_src( -; ALL: call float @llvm.fabs.f32( 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]] +; %E = call double @llvm.fabs.f64(double %D) %F = fptrunc double %E to float ret float %F } ; Make sure fast math flags are preserved -; ALL-LABEL: @test_shrink_intrin_fabs_fast_double_src( -; ALL: call fast float @llvm.fabs.f32( 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]] +; %E = call fast double @llvm.fabs.f64(double %D) %F = fptrunc double %E to float ret float %F } -; ALL-LABEL: @test_shrink_float_convertible_constant_intrin_floor( -; ALL: ret float 2.000000e+00 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 +; %E = call double @llvm.floor.f64(double 2.1) %F = fptrunc double %E to float ret float %F } -; ALL-LABEL: @test_shrink_float_convertible_constant_intrin_ceil( -; ALL: ret float 3.000000e+00 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 +; %E = call double @llvm.ceil.f64(double 2.1) %F = fptrunc double %E to float ret float %F } -; ALL-LABEL: @test_shrink_float_convertible_constant_intrin_round( -; ALL: ret float 2.000000e+00 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 +; %E = call double @llvm.round.f64(double 2.1) %F = fptrunc double %E to float ret float %F } -; ALL-LABEL: @test_shrink_float_convertible_constant_intrin_nearbyint( -; ALL: ret float 2.000000e+00 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 +; %E = call double @llvm.nearbyint.f64(double 2.1) %F = fptrunc double %E to float ret float %F } -; ALL-LABEL: @test_shrink_float_convertible_constant_intrin_trunc( -; ALL: ret float 2.000000e+00 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 +; %E = call double @llvm.trunc.f64(double 2.1) %F = fptrunc double %E to float ret float %F } -; ALL-LABEL: @test_shrink_float_convertible_constant_intrin_fabs( -; ALL: ret float 0x4000CCCCC0000000 define float @test_shrink_float_convertible_constant_intrin_fabs() { +; ALL-LABEL: @test_shrink_float_convertible_constant_intrin_fabs( +; ALL-NEXT: ret float 0x4000CCCCC0000000 +; %E = call double @llvm.fabs.f64(double 2.1) %F = fptrunc double %E to float ret float %F } ; Make sure fast math flags are preserved -; ALL-LABEL: @test_shrink_float_convertible_constant_intrin_fabs_fast( -; ALL: ret float 0x4000CCCCC0000000 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 +; %E = call fast double @llvm.fabs.f64(double 2.1) %F = fptrunc double %E to float ret float %F } -; 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 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]] +; %E = call double @llvm.floor.f64(double %D) %F = fptrunc double %E to half ret half %F } -; 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 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]] +; %E = call double @llvm.ceil.f64(double %D) %F = fptrunc double %E to half ret half %F } -; 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 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]] +; %E = call double @llvm.round.f64(double %D) %F = fptrunc double %E to half ret half %F } -; 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 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]] +; %E = call double @llvm.nearbyint.f64(double %D) %F = fptrunc double %E to half ret half %F } -; 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 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]] +; %E = call double @llvm.trunc.f64(double %D) %F = fptrunc double %E to half ret half %F } -; ALL-LABEL: @test_shrink_mismatched_type_intrin_fabs_double_src( -; ALL-NEXT: %1 = fptrunc double %D to half -; ALL-NEXT: %F = call half @llvm.fabs.f16(half %1) -; ALL-NEXT: ret half %F 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]] +; %E = call double @llvm.fabs.f64(double %D) %F = fptrunc double %E to half ret half %F } ; Make sure fast math flags are preserved -; ALL-LABEL: @test_mismatched_type_intrin_fabs_fast_double_src( -; ALL-NEXT: %1 = fptrunc double %D to half -; ALL-NEXT: %F = call fast half @llvm.fabs.f16(half %1) -; ALL-NEXT: ret half %F 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]] +; %E = call fast double @llvm.fabs.f64(double %D) %F = fptrunc double %E to half ret half %F } -; ALL-LABEL: @test_shrink_intrin_floor_fp16_src( -; ALL-NEXT: %E = call half @llvm.floor.f16(half %C) -; ALL-NEXT: %1 = fpext half %E to double -; ALL-NEXT: %F = fptrunc double %1 to float define float @test_shrink_intrin_floor_fp16_src(half %C) { +; ALL-LABEL: @test_shrink_intrin_floor_fp16_src( +; ALL-NEXT: [[E:%.*]] = call half @llvm.floor.f16(half [[C:%.*]]) +; ALL-NEXT: [[TMP1:%.*]] = fpext half [[E]] to double +; ALL-NEXT: [[F:%.*]] = fptrunc double [[TMP1]] to float +; ALL-NEXT: ret float [[F]] +; %D = fpext half %C to double %E = call double @llvm.floor.f64(double %D) %F = fptrunc double %E to float ret float %F } -; ALL-LABEL: @test_shrink_intrin_ceil_fp16_src( -; ALL-NEXT: %E = call half @llvm.ceil.f16(half %C) -; ALL-NEXT: %1 = fpext half %E to double -; ALL-NEXT: %F = fptrunc double %1 to float -; ALL-NEXT: ret float %F define float @test_shrink_intrin_ceil_fp16_src(half %C) { +; ALL-LABEL: @test_shrink_intrin_ceil_fp16_src( +; ALL-NEXT: [[E:%.*]] = call half @llvm.ceil.f16(half [[C:%.*]]) +; ALL-NEXT: [[TMP1:%.*]] = fpext half [[E]] to double +; ALL-NEXT: [[F:%.*]] = fptrunc double [[TMP1]] to float +; ALL-NEXT: ret float [[F]] +; %D = fpext half %C to double %E = call double @llvm.ceil.f64(double %D) %F = fptrunc double %E to float ret float %F } -; ALL-LABEL: @test_shrink_intrin_round_fp16_src( -; ALL-NEXT: %E = call half @llvm.round.f16(half %C) -; ALL-NEXT: %1 = fpext half %E to double -; ALL-NEXT: %F = fptrunc double %1 to float -; ALL-NEXT: ret float %F define float @test_shrink_intrin_round_fp16_src(half %C) { +; ALL-LABEL: @test_shrink_intrin_round_fp16_src( +; ALL-NEXT: [[E:%.*]] = call half @llvm.round.f16(half [[C:%.*]]) +; ALL-NEXT: [[TMP1:%.*]] = fpext half [[E]] to double +; ALL-NEXT: [[F:%.*]] = fptrunc double [[TMP1]] to float +; ALL-NEXT: ret float [[F]] +; %D = fpext half %C to double %E = call double @llvm.round.f64(double %D) %F = fptrunc double %E to float ret float %F } -; ALL-LABEL: @test_shrink_intrin_nearbyint_fp16_src( -; ALL-NEXT: %E = call half @llvm.nearbyint.f16(half %C) -; ALL-NEXT: %1 = fpext half %E to double -; ALL-NEXT: %F = fptrunc double %1 to float -; ALL-NEXT: ret float %F define float @test_shrink_intrin_nearbyint_fp16_src(half %C) { +; ALL-LABEL: @test_shrink_intrin_nearbyint_fp16_src( +; ALL-NEXT: [[E:%.*]] = call half @llvm.nearbyint.f16(half [[C:%.*]]) +; ALL-NEXT: [[TMP1:%.*]] = fpext half [[E]] to double +; ALL-NEXT: [[F:%.*]] = fptrunc double [[TMP1]] to float +; ALL-NEXT: ret float [[F]] +; %D = fpext half %C to double %E = call double @llvm.nearbyint.f64(double %D) %F = fptrunc double %E to float ret float %F } -; ALL-LABEL: @test_shrink_intrin_trunc_fp16_src( -; ALL-NEXT: %E = call half @llvm.trunc.f16(half %C) -; ALL-NEXT: %1 = fpext half %E to double -; ALL-NEXT: %F = fptrunc double %1 to float -; ALL-NEXT: ret float %F define float @test_shrink_intrin_trunc_fp16_src(half %C) { +; ALL-LABEL: @test_shrink_intrin_trunc_fp16_src( +; ALL-NEXT: [[E:%.*]] = call half @llvm.trunc.f16(half [[C:%.*]]) +; ALL-NEXT: [[TMP1:%.*]] = fpext half [[E]] to double +; ALL-NEXT: [[F:%.*]] = fptrunc double [[TMP1]] to float +; ALL-NEXT: ret float [[F]] +; %D = fpext half %C to double %E = call double @llvm.trunc.f64(double %D) %F = fptrunc double %E to float ret float %F } -; ALL-LABEL: @test_shrink_intrin_fabs_fp16_src( -; ALL-NEXT: %E = call half @llvm.fabs.f16(half %C) -; ALL-NEXT: %1 = fpext half %E to double -; ALL-NEXT: %F = fptrunc double %1 to float -; ALL-NEXT: ret float %F define float @test_shrink_intrin_fabs_fp16_src(half %C) { +; ALL-LABEL: @test_shrink_intrin_fabs_fp16_src( +; ALL-NEXT: [[E:%.*]] = call half @llvm.fabs.f16(half [[C:%.*]]) +; ALL-NEXT: [[TMP1:%.*]] = fpext half [[E]] to double +; ALL-NEXT: [[F:%.*]] = fptrunc double [[TMP1]] to float +; ALL-NEXT: ret float [[F]] +; %D = fpext half %C to double %E = call double @llvm.fabs.f64(double %D) %F = fptrunc double %E to float @@ -428,22 +524,27 @@ define float @test_shrink_intrin_fabs_fp16_src(half %C) { } ; Make sure fast math flags are preserved -; ALL-LABEL: @test_shrink_intrin_fabs_fast_fp16_src( -; ALL-NEXT: %E = call fast half @llvm.fabs.f16(half %C) -; ALL-NEXT: %1 = fpext half %E to double -; ALL-NEXT: %F = fptrunc double %1 to float -; ALL-NEXT: ret float %F define float @test_shrink_intrin_fabs_fast_fp16_src(half %C) { +; ALL-LABEL: @test_shrink_intrin_fabs_fast_fp16_src( +; ALL-NEXT: [[E:%.*]] = call fast half @llvm.fabs.f16(half [[C:%.*]]) +; ALL-NEXT: [[TMP1:%.*]] = fpext half [[E]] to double +; ALL-NEXT: [[F:%.*]] = fptrunc double [[TMP1]] to float +; ALL-NEXT: ret float [[F]] +; %D = fpext half %C to double %E = call fast double @llvm.fabs.f64(double %D) %F = fptrunc double %E to float ret float %F } -; ALL-LABEL: @test_no_shrink_intrin_floor_multi_use_fpext( -; ALL: %D = fpext half %C to double -; ALL: call double @llvm.floor.f64 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]] +; %D = fpext half %C to double store volatile double %D, double* undef %E = call double @llvm.floor.f64(double %D) @@ -451,10 +552,14 @@ define float @test_no_shrink_intrin_floor_multi_use_fpext(half %C) { ret float %F } -; ALL-LABEL: @test_no_shrink_intrin_fabs_multi_use_fpext( -; ALL: %D = fpext half %C to double -; ALL: call double @llvm.fabs.f64 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]] +; %D = fpext half %C to double store volatile double %D, double* undef %E = call double @llvm.fabs.f64(double %D) |