aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorMichael Ilseman <milseman@apple.com>2012-11-27 00:45:08 +0000
committerMichael Ilseman <milseman@apple.com>2012-11-27 00:45:08 +0000
commita52f3ae45ce28198bb402ddea8db5a8cb8d8ced7 (patch)
treeeeb411934cfccbaa7d86d76af043f0c4b0fcd1db /test
parent495d10ad56d1113ba33e0589e7c4f96f3c16fa52 (diff)
Fast-math test case for bitcode and textual reading/writing
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@168647 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test')
-rw-r--r--test/Assembler/fast-math-flags.ll142
1 files changed, 142 insertions, 0 deletions
diff --git a/test/Assembler/fast-math-flags.ll b/test/Assembler/fast-math-flags.ll
new file mode 100644
index 0000000000..3a116c507f
--- /dev/null
+++ b/test/Assembler/fast-math-flags.ll
@@ -0,0 +1,142 @@
+; RUN: llvm-as < %s | llvm-dis | FileCheck %s
+; RUN: opt -S < %s | FileCheck %s
+
+@addr = external global i64
+@select = external global i1
+@vec = external global <3 x float>
+@arr = external global [3 x float]
+
+define float @none(float %x, float %y) {
+entry:
+; CHECK: %vec = load <3 x float>* @vec
+ %vec = load <3 x float>* @vec
+; CHECK: %select = load i1* @select
+ %select = load i1* @select
+; CHECK: %arr = load [3 x float]* @arr
+ %arr = load [3 x float]* @arr
+
+; CHECK: %a = fadd float %x, %y
+ %a = fadd float %x, %y
+; CHECK: %a_vec = fadd <3 x float> %vec, %vec
+ %a_vec = fadd <3 x float> %vec, %vec
+; CHECK: %b = fsub float %x, %y
+ %b = fsub float %x, %y
+; CHECK: %b_vec = fsub <3 x float> %vec, %vec
+ %b_vec = fsub <3 x float> %vec, %vec
+; CHECK: %c = fmul float %x, %y
+ %c = fmul float %x, %y
+; CHECK: %c_vec = fmul <3 x float> %vec, %vec
+ %c_vec = fmul <3 x float> %vec, %vec
+; CHECK: %d = fdiv float %x, %y
+ %d = fdiv float %x, %y
+; CHECK: %d_vec = fdiv <3 x float> %vec, %vec
+ %d_vec = fdiv <3 x float> %vec, %vec
+; CHECK: %e = frem float %x, %y
+ %e = frem float %x, %y
+; CHECK: %e_vec = frem <3 x float> %vec, %vec
+ %e_vec = frem <3 x float> %vec, %vec
+; CHECK: ret float %e
+ ret float %e
+}
+
+; CHECK: no_nan
+define float @no_nan(float %x, float %y) {
+entry:
+; CHECK: %vec = load <3 x float>* @vec
+ %vec = load <3 x float>* @vec
+; CHECK: %select = load i1* @select
+ %select = load i1* @select
+; CHECK: %arr = load [3 x float]* @arr
+ %arr = load [3 x float]* @arr
+
+; CHECK: %a = fadd nnan float %x, %y
+ %a = fadd nnan float %x, %y
+; CHECK: %a_vec = fadd nnan <3 x float> %vec, %vec
+ %a_vec = fadd nnan <3 x float> %vec, %vec
+; CHECK: %b = fsub nnan float %x, %y
+ %b = fsub nnan float %x, %y
+; CHECK: %b_vec = fsub nnan <3 x float> %vec, %vec
+ %b_vec = fsub nnan <3 x float> %vec, %vec
+; CHECK: %c = fmul nnan float %x, %y
+ %c = fmul nnan float %x, %y
+; CHECK: %c_vec = fmul nnan <3 x float> %vec, %vec
+ %c_vec = fmul nnan <3 x float> %vec, %vec
+; CHECK: %d = fdiv nnan float %x, %y
+ %d = fdiv nnan float %x, %y
+; CHECK: %d_vec = fdiv nnan <3 x float> %vec, %vec
+ %d_vec = fdiv nnan <3 x float> %vec, %vec
+; CHECK: %e = frem nnan float %x, %y
+ %e = frem nnan float %x, %y
+; CHECK: %e_vec = frem nnan <3 x float> %vec, %vec
+ %e_vec = frem nnan <3 x float> %vec, %vec
+; CHECK: ret float %e
+ ret float %e
+}
+
+; CHECK: no_nan_inf
+define float @no_nan_inf(float %x, float %y) {
+entry:
+; CHECK: %vec = load <3 x float>* @vec
+ %vec = load <3 x float>* @vec
+; CHECK: %select = load i1* @select
+ %select = load i1* @select
+; CHECK: %arr = load [3 x float]* @arr
+ %arr = load [3 x float]* @arr
+
+; CHECK: %a = fadd nnan ninf float %x, %y
+ %a = fadd ninf nnan float %x, %y
+; CHECK: %a_vec = fadd nnan <3 x float> %vec, %vec
+ %a_vec = fadd nnan <3 x float> %vec, %vec
+; CHECK: %b = fsub nnan float %x, %y
+ %b = fsub nnan float %x, %y
+; CHECK: %b_vec = fsub nnan ninf <3 x float> %vec, %vec
+ %b_vec = fsub ninf nnan <3 x float> %vec, %vec
+; CHECK: %c = fmul nnan float %x, %y
+ %c = fmul nnan float %x, %y
+; CHECK: %c_vec = fmul nnan <3 x float> %vec, %vec
+ %c_vec = fmul nnan <3 x float> %vec, %vec
+; CHECK: %d = fdiv nnan ninf float %x, %y
+ %d = fdiv ninf nnan float %x, %y
+; CHECK: %d_vec = fdiv nnan <3 x float> %vec, %vec
+ %d_vec = fdiv nnan <3 x float> %vec, %vec
+; CHECK: %e = frem nnan float %x, %y
+ %e = frem nnan float %x, %y
+; CHECK: %e_vec = frem nnan ninf <3 x float> %vec, %vec
+ %e_vec = frem ninf nnan <3 x float> %vec, %vec
+; CHECK: ret float %e
+ ret float %e
+}
+
+; CHECK: mixed_flags
+define float @mixed_flags(float %x, float %y) {
+entry:
+; CHECK: %vec = load <3 x float>* @vec
+ %vec = load <3 x float>* @vec
+; CHECK: %select = load i1* @select
+ %select = load i1* @select
+; CHECK: %arr = load [3 x float]* @arr
+ %arr = load [3 x float]* @arr
+
+; CHECK: %a = fadd nnan ninf float %x, %y
+ %a = fadd ninf nnan float %x, %y
+; CHECK: %a_vec = fadd nnan <3 x float> %vec, %vec
+ %a_vec = fadd nnan <3 x float> %vec, %vec
+; CHECK: %b = fsub fast float %x, %y
+ %b = fsub nnan nsz fast float %x, %y
+; CHECK: %b_vec = fsub nnan <3 x float> %vec, %vec
+ %b_vec = fsub nnan <3 x float> %vec, %vec
+; CHECK: %c = fmul fast float %x, %y
+ %c = fmul nsz fast arcp float %x, %y
+; CHECK: %c_vec = fmul nsz <3 x float> %vec, %vec
+ %c_vec = fmul nsz <3 x float> %vec, %vec
+; CHECK: %d = fdiv nnan ninf arcp float %x, %y
+ %d = fdiv arcp ninf nnan float %x, %y
+; CHECK: %d_vec = fdiv fast <3 x float> %vec, %vec
+ %d_vec = fdiv fast nnan arcp <3 x float> %vec, %vec
+; CHECK: %e = frem nnan nsz float %x, %y
+ %e = frem nnan nsz float %x, %y
+; CHECK: %e_vec = frem nnan <3 x float> %vec, %vec
+ %e_vec = frem nnan <3 x float> %vec, %vec
+; CHECK: ret float %e
+ ret float %e
+}