
In D146869 @arsenm pointed out that the constrained intrinsics aren't getting the strictfp attribute by default. They should be since they are required to have it anyway. TableGen did not know about this attribute until now. This patch adds strictfp to TableGen, and it uses it on all of the constrained intrinsics. Differential Revision: https://reviews.llvm.org/D154991
43 lines
2.2 KiB
LLVM
43 lines
2.2 KiB
LLVM
; RUN: opt -passes=verify -S < %s 2>&1 | FileCheck %s
|
|
|
|
declare double @llvm.experimental.constrained.fadd.f64(double, double, metadata, metadata)
|
|
declare double @llvm.experimental.constrained.sqrt.f64(double, metadata, metadata)
|
|
|
|
; Test that the verifier accepts legal code, and that the correct attributes are
|
|
; attached to the FP intrinsic. The attributes are checked at the bottom.
|
|
; CHECK: declare double @llvm.experimental.constrained.fadd.f64(double, double, metadata, metadata) #[[ATTR:[0-9]+]]
|
|
; CHECK: declare double @llvm.experimental.constrained.sqrt.f64(double, metadata, metadata) #[[ATTR]]
|
|
; 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) strictfp {
|
|
; CHECK-LABEL: define double @f1
|
|
; CHECK-SAME: (double [[A:%.*]], double [[B:%.*]]) #[[STRICTFP:[0-9]+]] {
|
|
; CHECK-NEXT: entry:
|
|
; CHECK-NEXT: [[FADD:%.*]] = call double @llvm.experimental.constrained.fadd.f64(double [[A]], double [[B]], metadata !"round.dynamic", metadata !"fpexcept.strict")
|
|
; CHECK-NEXT: ret double [[FADD]]
|
|
entry:
|
|
%fadd = call double @llvm.experimental.constrained.fadd.f64(
|
|
double %a, double %b,
|
|
metadata !"round.dynamic",
|
|
metadata !"fpexcept.strict")
|
|
ret double %fadd
|
|
}
|
|
|
|
define double @f1u(double %a) strictfp {
|
|
; CHECK-LABEL: define double @f1u
|
|
; CHECK-SAME: (double [[A:%.*]]) #[[STRICTFP]] {
|
|
; CHECK-NEXT: entry:
|
|
; CHECK-NEXT: [[FSQRT:%.*]] = call double @llvm.experimental.constrained.sqrt.f64(double [[A]], metadata !"round.dynamic", metadata !"fpexcept.strict")
|
|
; CHECK-NEXT: ret double [[FSQRT]]
|
|
;
|
|
entry:
|
|
%fsqrt = call double @llvm.experimental.constrained.sqrt.f64(
|
|
double %a,
|
|
metadata !"round.dynamic",
|
|
metadata !"fpexcept.strict")
|
|
ret double %fsqrt
|
|
}
|
|
|
|
; CHECK: attributes #[[ATTR]] = { nocallback nofree nosync nounwind strictfp willreturn memory(inaccessiblemem: readwrite) }
|
|
; CHECK: attributes #[[STRICTFP]] = { strictfp }
|