Skip to content

Commit

Permalink
Fast-math test for SimplifyInstruction: fold multiply by 0
Browse files Browse the repository at this point in the history
Applied the patch, rather than committing it.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@168656 91177308-0d34-0410-b5e6-96231b3b80d8
  • Loading branch information
milseman committed Nov 27, 2012
1 parent 9780d35 commit bc43fe1
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 55 deletions.
55 changes: 0 additions & 55 deletions 0007-Fast-math-test-for-SimplifyInstruction-fold-multiply.patch

This file was deleted.

35 changes: 35 additions & 0 deletions test/Transforms/InstSimplify/fast-math.ll
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
; RUN: opt < %s -instsimplify -S | FileCheck %s

;; x * 0 ==> 0 when no-nans and no-signed-zero
; CHECK: mul_zero_1
define float @mul_zero_1(float %a) {
%b = fmul nsz nnan float %a, 0.0
; CHECK: ret float 0.0
ret float %b
}
; CHECK: mul_zero_2
define float @mul_zero_2(float %a) {
%b = fmul fast float 0.0, %a
; CHECK: ret float 0.0
ret float %b
}

;; x * 0 =/=> 0 when there could be nans or -0
; CHECK: no_mul_zero_1
define float @no_mul_zero_1(float %a) {
%b = fmul nsz float %a, 0.0
; CHECK: ret float %b
ret float %b
}
; CHECK: no_mul_zero_2
define float @no_mul_zero_2(float %a) {
%b = fmul nnan float %a, 0.0
; CHECK: ret float %b
ret float %b
}
; CHECK: no_mul_zero_3
define float @no_mul_zero_3(float %a) {
%b = fmul float %a, 0.0
; CHECK: ret float %b
ret float %b
}

0 comments on commit bc43fe1

Please sign in to comment.