forked from llvm-mirror/llvm
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Instruction::isAssociative() returns true for fmul/fadd if they are t…
…agged "unsafe" mode. Approved by: Eli and Michael. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@168848 91177308-0d34-0410-b5e6-96231b3b80d8
- Loading branch information
Shuxin Yang
committed
Nov 29, 2012
1 parent
89bea17
commit 9b7f6f2
Showing
3 changed files
with
47 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
; RUN: opt < %s -instcombine -S | FileCheck %s | ||
|
||
; testing-case "float fold(float a) { return 1.2f * a * 2.3f; }" | ||
; 1.2f and 2.3f is supposed to be fold. | ||
define float @fold(float %a) { | ||
fold: | ||
%mul = fmul fast float %a, 0x3FF3333340000000 | ||
%mul1 = fmul fast float %mul, 0x4002666660000000 | ||
ret float %mul1 | ||
; CHECK: fold | ||
; CHECK: fmul float %a, 0x4006147AE0000000 | ||
} | ||
|
||
; Same testing-case as the one used in fold() except that the operators have | ||
; fixed FP mode. | ||
define float @notfold(float %a) { | ||
notfold: | ||
; CHECK: notfold | ||
; CHECK: %mul = fmul fast float %a, 0x3FF3333340000000 | ||
%mul = fmul fast float %a, 0x3FF3333340000000 | ||
%mul1 = fmul float %mul, 0x4002666660000000 | ||
ret float %mul1 | ||
} | ||
|
||
define float @fold2(float %a) { | ||
notfold2: | ||
; CHECK: fold2 | ||
; CHECK: fmul float %a, 0x4006147AE0000000 | ||
%mul = fmul float %a, 0x3FF3333340000000 | ||
%mul1 = fmul fast float %mul, 0x4002666660000000 | ||
ret float %mul1 | ||
} |