diff options
Diffstat (limited to 'llvm/test/Transforms/InstCombine/double-float-shrink-2.ll')
-rw-r--r-- | llvm/test/Transforms/InstCombine/double-float-shrink-2.ll | 57 |
1 files changed, 45 insertions, 12 deletions
diff --git a/llvm/test/Transforms/InstCombine/double-float-shrink-2.ll b/llvm/test/Transforms/InstCombine/double-float-shrink-2.ll index 76e497bd68f..d5099531af9 100644 --- a/llvm/test/Transforms/InstCombine/double-float-shrink-2.ll +++ b/llvm/test/Transforms/InstCombine/double-float-shrink-2.ll @@ -1,10 +1,10 @@ ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py -; RUN: opt < %s -instcombine -S -mtriple "i386-pc-linux" | FileCheck %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 "i386-pc-linux" | FileCheck --check-prefixes=CHECK,DO-SIMPLIFY %s +; RUN: opt < %s -instcombine -S -mtriple "i386-pc-win32" | FileCheck --check-prefixes=CHECK,DONT-SIMPLIFY %s +; RUN: opt < %s -instcombine -S -mtriple "x86_64-pc-win32" | FileCheck --check-prefixes=CHECK,C89-SIMPLIFY %s +; RUN: opt < %s -instcombine -S -mtriple "i386-pc-mingw32" | FileCheck --check-prefixes=CHECK,DO-SIMPLIFY %s +; RUN: opt < %s -instcombine -S -mtriple "x86_64-pc-mingw32" | FileCheck --check-prefixes=CHECK,DO-SIMPLIFY %s +; RUN: opt < %s -instcombine -S -mtriple "sparc-sun-solaris" | FileCheck --check-prefixes=CHECK,DO-SIMPLIFY %s ; RUN: opt < %s -instcombine -S -mtriple "x86_64-pc-win32" -enable-debugify 2>&1 | FileCheck --check-prefix=DBG-VALID %s declare double @floor(double) @@ -61,8 +61,19 @@ define float @test_shrink_libcall_ceil(float %C) { define float @test_shrink_libcall_round(float %C) { ; CHECK-LABEL: @test_shrink_libcall_round( -; CHECK-NEXT: [[F:%.*]] = call float @llvm.round.f32(float [[C:%.*]]) -; CHECK-NEXT: ret float [[F]] + +; DO-SIMPLIFY-NEXT: [[F:%.*]] = call float @llvm.round.f32(float [[C:%.*]]) +; DO-SIMPLIFY-NEXT: ret float [[F]] +; +; DONT-SIMPLIFY-NEXT: [[D:%.*]] = fpext float [[C:%.*]] to double +; DONT-SIMPLIFY-NEXT: [[E:%.*]] = call double @round(double [[D]]) +; DONT-SIMPLIFY-NEXT: [[F:%.*]] = fptrunc double [[E]] to float +; DONT-SIMPLIFY-NEXT: ret float [[F]] +; +; C89-SIMPLIFY-NEXT: [[D:%.*]] = fpext float [[C:%.*]] to double +; C89-SIMPLIFY-NEXT: [[E:%.*]] = call double @round(double [[D]]) +; C89-SIMPLIFY-NEXT: [[F:%.*]] = fptrunc double [[E]] to float +; C89-SIMPLIFY-NEXT: ret float [[F]] ; %D = fpext float %C to double ; --> roundf @@ -73,8 +84,19 @@ define float @test_shrink_libcall_round(float %C) { define float @test_shrink_libcall_nearbyint(float %C) { ; CHECK-LABEL: @test_shrink_libcall_nearbyint( -; CHECK-NEXT: [[F:%.*]] = call float @llvm.nearbyint.f32(float [[C:%.*]]) -; CHECK-NEXT: ret float [[F]] + +; DO-SIMPLIFY-NEXT: [[F:%.*]] = call float @llvm.nearbyint.f32(float [[C:%.*]]) +; DO-SIMPLIFY-NEXT: ret float [[F]] +; +; DONT-SIMPLIFY-NEXT: [[D:%.*]] = fpext float [[C:%.*]] to double +; DONT-SIMPLIFY-NEXT: [[E:%.*]] = call double @nearbyint(double [[D]]) +; DONT-SIMPLIFY-NEXT: [[F:%.*]] = fptrunc double [[E]] to float +; DONT-SIMPLIFY-NEXT: ret float [[F]] +; +; C89-SIMPLIFY-NEXT: [[D:%.*]] = fpext float [[C:%.*]] to double +; C89-SIMPLIFY-NEXT: [[E:%.*]] = call double @nearbyint(double [[D]]) +; C89-SIMPLIFY-NEXT: [[F:%.*]] = fptrunc double [[E]] to float +; C89-SIMPLIFY-NEXT: ret float [[F]] ; %D = fpext float %C to double ; --> nearbyintf @@ -85,8 +107,19 @@ define float @test_shrink_libcall_nearbyint(float %C) { define float @test_shrink_libcall_trunc(float %C) { ; CHECK-LABEL: @test_shrink_libcall_trunc( -; CHECK-NEXT: [[F:%.*]] = call float @llvm.trunc.f32(float [[C:%.*]]) -; CHECK-NEXT: ret float [[F]] + +; DO-SIMPLIFY-NEXT: [[F:%.*]] = call float @llvm.trunc.f32(float [[C:%.*]]) +; DO-SIMPLIFY-NEXT: ret float [[F]] +; +; DONT-SIMPLIFY-NEXT: [[D:%.*]] = fpext float [[C:%.*]] to double +; DONT-SIMPLIFY-NEXT: [[E:%.*]] = call double @trunc(double [[D]]) +; DONT-SIMPLIFY-NEXT: [[F:%.*]] = fptrunc double [[E]] to float +; DONT-SIMPLIFY-NEXT: ret float [[F]] +; +; C89-SIMPLIFY-NEXT: [[D:%.*]] = fpext float [[C:%.*]] to double +; C89-SIMPLIFY-NEXT: [[E:%.*]] = call double @trunc(double [[D]]) +; C89-SIMPLIFY-NEXT: [[F:%.*]] = fptrunc double [[E]] to float +; C89-SIMPLIFY-NEXT: ret float [[F]] ; %D = fpext float %C to double ; --> truncf |