Andrew Kaylor | a0a1164 | 2017-01-26 23:27:59 +0000 | [diff] [blame] | 1 | ; RUN: opt -verify -S < %s 2>&1 | FileCheck --check-prefix=CHECK1 %s |
| 2 | ; RUN: sed -e s/.T2:// %s | not opt -verify -disable-output 2>&1 | FileCheck --check-prefix=CHECK2 %s |
| 3 | ; RUN: sed -e s/.T3:// %s | not opt -verify -disable-output 2>&1 | FileCheck --check-prefix=CHECK3 %s |
| 4 | |
| 5 | ; Common declaration used for all runs. |
| 6 | declare double @llvm.experimental.constrained.fadd.f64(double, double, metadata, metadata) |
| 7 | |
| 8 | ; Test that the verifier accepts legal code, and that the correct attributes are |
| 9 | ; attached to the FP intrinsic. |
| 10 | ; CHECK1: declare double @llvm.experimental.constrained.fadd.f64(double, double, metadata, metadata) #[[ATTR:[0-9]+]] |
| 11 | ; CHECK1: attributes #[[ATTR]] = { inaccessiblememonly nounwind } |
| 12 | ; Note: FP exceptions aren't usually caught through normal unwind mechanisms, |
| 13 | ; but we may want to revisit this for asynchronous exception handling. |
| 14 | define double @f1(double %a, double %b) { |
| 15 | entry: |
| 16 | %fadd = call double @llvm.experimental.constrained.fadd.f64( |
| 17 | double %a, double %b, |
| 18 | metadata !"round.dynamic", |
| 19 | metadata !"fpexcept.strict") |
| 20 | ret double %fadd |
| 21 | } |
| 22 | |
| 23 | ; Test an illegal value for the rounding mode argument. |
| 24 | ; CHECK2: invalid rounding mode argument |
| 25 | ;T2: define double @f2(double %a, double %b) { |
| 26 | ;T2: entry: |
| 27 | ;T2: %fadd = call double @llvm.experimental.constrained.fadd.f64( |
| 28 | ;T2: double %a, double %b, |
| 29 | ;T2: metadata !"round.dynomite", |
| 30 | ;T2: metadata !"fpexcept.strict") |
| 31 | ;T2: ret double %fadd |
| 32 | ;T2: } |
| 33 | |
| 34 | ; Test an illegal value for the exception behavior argument. |
| 35 | ; CHECK3: invalid exception behavior argument |
| 36 | ;T3: define double @f2(double %a, double %b) { |
| 37 | ;T3: entry: |
| 38 | ;T3: %fadd = call double @llvm.experimental.constrained.fadd.f64( |
| 39 | ;T3: double %a, double %b, |
| 40 | ;T3: metadata !"round.dynamic", |
| 41 | ;T3: metadata !"fpexcept.restrict") |
| 42 | ;T3: ret double %fadd |
| 43 | ;T3: } |