2017-01-27 00:27:59 +01:00
|
|
|
; 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
|
2017-05-25 23:31:00 +02:00
|
|
|
; RUN: sed -e s/.T4:// %s | not opt -verify -disable-output 2>&1 | FileCheck --check-prefix=CHECK4 %s
|
|
|
|
; RUN: sed -e s/.T5:// %s | not opt -verify -disable-output 2>&1 | FileCheck --check-prefix=CHECK5 %s
|
2017-01-27 00:27:59 +01:00
|
|
|
|
2017-05-25 23:31:00 +02:00
|
|
|
; Common declarations used for all runs.
|
2017-01-27 00:27:59 +01:00
|
|
|
declare double @llvm.experimental.constrained.fadd.f64(double, double, metadata, metadata)
|
2017-05-25 23:31:00 +02:00
|
|
|
declare double @llvm.experimental.constrained.sqrt.f64(double, metadata, metadata)
|
2017-01-27 00:27:59 +01:00
|
|
|
|
|
|
|
; 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]+]]
|
2017-05-25 23:31:00 +02:00
|
|
|
; CHECK1: declare double @llvm.experimental.constrained.sqrt.f64(double, metadata, metadata) #[[ATTR]]
|
2020-10-15 13:04:36 +02:00
|
|
|
; CHECK1: attributes #[[ATTR]] = { inaccessiblememonly nofree nosync nounwind willreturn }
|
2017-01-27 00:27:59 +01:00
|
|
|
; Note: FP exceptions aren't usually caught through normal unwind mechanisms,
|
|
|
|
; but we may want to revisit this for asynchronous exception handling.
|
2019-10-04 19:03:46 +02:00
|
|
|
define double @f1(double %a, double %b) #0 {
|
2017-01-27 00:27:59 +01:00
|
|
|
entry:
|
|
|
|
%fadd = call double @llvm.experimental.constrained.fadd.f64(
|
|
|
|
double %a, double %b,
|
|
|
|
metadata !"round.dynamic",
|
2019-10-04 19:03:46 +02:00
|
|
|
metadata !"fpexcept.strict") #0
|
2017-01-27 00:27:59 +01:00
|
|
|
ret double %fadd
|
|
|
|
}
|
|
|
|
|
2019-10-04 19:03:46 +02:00
|
|
|
define double @f1u(double %a) #0 {
|
2017-05-25 23:31:00 +02:00
|
|
|
entry:
|
|
|
|
%fsqrt = call double @llvm.experimental.constrained.sqrt.f64(
|
|
|
|
double %a,
|
|
|
|
metadata !"round.dynamic",
|
2019-10-04 19:03:46 +02:00
|
|
|
metadata !"fpexcept.strict") #0
|
2017-05-25 23:31:00 +02:00
|
|
|
ret double %fsqrt
|
|
|
|
}
|
|
|
|
|
2017-01-27 00:27:59 +01:00
|
|
|
; Test an illegal value for the rounding mode argument.
|
|
|
|
; CHECK2: invalid rounding mode argument
|
2019-10-04 19:03:46 +02:00
|
|
|
;T2: define double @f2(double %a, double %b) #0 {
|
2017-01-27 00:27:59 +01:00
|
|
|
;T2: entry:
|
|
|
|
;T2: %fadd = call double @llvm.experimental.constrained.fadd.f64(
|
|
|
|
;T2: double %a, double %b,
|
|
|
|
;T2: metadata !"round.dynomite",
|
2019-10-04 19:03:46 +02:00
|
|
|
;T2: metadata !"fpexcept.strict") #0
|
2017-01-27 00:27:59 +01:00
|
|
|
;T2: ret double %fadd
|
|
|
|
;T2: }
|
|
|
|
|
|
|
|
; Test an illegal value for the exception behavior argument.
|
|
|
|
; CHECK3: invalid exception behavior argument
|
2019-10-04 19:03:46 +02:00
|
|
|
;T3: define double @f3(double %a, double %b) #0 {
|
2017-01-27 00:27:59 +01:00
|
|
|
;T3: entry:
|
|
|
|
;T3: %fadd = call double @llvm.experimental.constrained.fadd.f64(
|
|
|
|
;T3: double %a, double %b,
|
|
|
|
;T3: metadata !"round.dynamic",
|
2019-10-04 19:03:46 +02:00
|
|
|
;T3: metadata !"fpexcept.restrict") #0
|
2017-01-27 00:27:59 +01:00
|
|
|
;T3: ret double %fadd
|
|
|
|
;T3: }
|
2017-05-25 23:31:00 +02:00
|
|
|
|
|
|
|
; Test an illegal value for the rounding mode argument.
|
|
|
|
; CHECK4: invalid rounding mode argument
|
2019-10-04 19:03:46 +02:00
|
|
|
;T4: define double @f4(double %a) #0 {
|
2017-05-25 23:31:00 +02:00
|
|
|
;T4: entry:
|
|
|
|
;T4: %fadd = call double @llvm.experimental.constrained.sqrt.f64(
|
|
|
|
;T4: double %a,
|
|
|
|
;T4: metadata !"round.dynomite",
|
2019-10-04 19:03:46 +02:00
|
|
|
;T4: metadata !"fpexcept.strict") #0
|
2017-05-25 23:31:00 +02:00
|
|
|
;T4: ret double %fadd
|
|
|
|
;T4: }
|
|
|
|
|
|
|
|
; Test an illegal value for the exception behavior argument.
|
|
|
|
; CHECK5: invalid exception behavior argument
|
2019-10-04 19:03:46 +02:00
|
|
|
;T5: define double @f5(double %a) #0 {
|
2017-05-25 23:31:00 +02:00
|
|
|
;T5: entry:
|
|
|
|
;T5: %fadd = call double @llvm.experimental.constrained.sqrt.f64(
|
|
|
|
;T5: double %a,
|
|
|
|
;T5: metadata !"round.dynamic",
|
2019-10-04 19:03:46 +02:00
|
|
|
;T5: metadata !"fpexcept.restrict") #0
|
2017-05-25 23:31:00 +02:00
|
|
|
;T5: ret double %fadd
|
|
|
|
;T5: }
|
2019-10-04 19:03:46 +02:00
|
|
|
|
|
|
|
attributes #0 = { strictfp }
|