diff options
author | Andrew Kaylor <andrew.kaylor@intel.com> | 2017-01-26 23:27:59 +0000 |
---|---|---|
committer | Andrew Kaylor <andrew.kaylor@intel.com> | 2017-01-26 23:27:59 +0000 |
commit | a0a1164ce41b5fbb68d86759e96b51e8a2529ece (patch) | |
tree | eb8ceef583dfad25a2c6675d920fa2a7254fbafc /llvm/test/Verifier/fp-intrinsics.ll | |
parent | 79b733bc6b8cdc856c6e5e394b77766dcf07d2f9 (diff) | |
download | bcm5719-llvm-a0a1164ce41b5fbb68d86759e96b51e8a2529ece.tar.gz bcm5719-llvm-a0a1164ce41b5fbb68d86759e96b51e8a2529ece.zip |
Add intrinsics for constrained floating point operations
This commit introduces a set of experimental intrinsics intended to prevent
optimizations that make assumptions about the rounding mode and floating point
exception behavior. These intrinsics will later be extended to specify
flush-to-zero behavior. More work is also required to model instruction
dependencies in machine code and to generate these instructions from clang
(when required by pragmas and/or command line options that are not currently
supported).
Differential Revision: https://reviews.llvm.org/D27028
llvm-svn: 293226
Diffstat (limited to 'llvm/test/Verifier/fp-intrinsics.ll')
-rw-r--r-- | llvm/test/Verifier/fp-intrinsics.ll | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/llvm/test/Verifier/fp-intrinsics.ll b/llvm/test/Verifier/fp-intrinsics.ll new file mode 100644 index 00000000000..0a308115cc3 --- /dev/null +++ b/llvm/test/Verifier/fp-intrinsics.ll @@ -0,0 +1,43 @@ +; RUN: opt -verify -S < %s 2>&1 | FileCheck --check-prefix=CHECK1 %s +; RUN: sed -e s/.T2:// %s | not opt -verify -disable-output 2>&1 | FileCheck --check-prefix=CHECK2 %s +; RUN: sed -e s/.T3:// %s | not opt -verify -disable-output 2>&1 | FileCheck --check-prefix=CHECK3 %s + +; Common declaration used for all runs. +declare double @llvm.experimental.constrained.fadd.f64(double, double, metadata, metadata) + +; Test that the verifier accepts legal code, and that the correct attributes are +; attached to the FP intrinsic. +; CHECK1: declare double @llvm.experimental.constrained.fadd.f64(double, double, metadata, metadata) #[[ATTR:[0-9]+]] +; CHECK1: attributes #[[ATTR]] = { inaccessiblememonly nounwind } +; Note: FP exceptions aren't usually caught through normal unwind mechanisms, +; but we may want to revisit this for asynchronous exception handling. +define double @f1(double %a, double %b) { +entry: + %fadd = call double @llvm.experimental.constrained.fadd.f64( + double %a, double %b, + metadata !"round.dynamic", + metadata !"fpexcept.strict") + ret double %fadd +} + +; Test an illegal value for the rounding mode argument. +; CHECK2: invalid rounding mode argument +;T2: define double @f2(double %a, double %b) { +;T2: entry: +;T2: %fadd = call double @llvm.experimental.constrained.fadd.f64( +;T2: double %a, double %b, +;T2: metadata !"round.dynomite", +;T2: metadata !"fpexcept.strict") +;T2: ret double %fadd +;T2: } + +; Test an illegal value for the exception behavior argument. +; CHECK3: invalid exception behavior argument +;T3: define double @f2(double %a, double %b) { +;T3: entry: +;T3: %fadd = call double @llvm.experimental.constrained.fadd.f64( +;T3: double %a, double %b, +;T3: metadata !"round.dynamic", +;T3: metadata !"fpexcept.restrict") +;T3: ret double %fadd +;T3: } |