xref: /llvm-project/llvm/test/tools/llvm-reduce/remove-attributes-strictfp.ll (revision b06568fa623c746d40638137504d52e19911bf32)
1; RUN: llvm-reduce --abort-on-invalid-reduction --delta-passes=attributes --test FileCheck --test-arg %s --test-arg --input-file %s -o %t
2; RUN: FileCheck --check-prefixes=CHECK,RESULT %s < %t
3
4; Test that invalid reductions aren't produced on strictfp functions.
5
6; CHECK-LABEL: define float @strictfp_intrinsic(float %x, float %y)
7; RESULT-SAME: [[STRICTFP_ONLY:#[0-9]+]] {
8define float @strictfp_intrinsic(float %x, float %y) #0 {
9  %val = call float @llvm.experimental.constrained.fadd.f32(float %x, float %y, metadata !"round.tonearest", metadata !"fpexcept.strict")
10  ret float %val
11}
12
13; CHECK-LABEL: define float @strictfp_callsite(float %x, float %y)
14; RESULT-SAME: [[STRICTFP_ONLY]] {
15; RESULT: call float @extern.func(float %x, float %y) [[STRICTFP_ONLY]]
16define float @strictfp_callsite(float %x, float %y) #0 {
17  %val = call float @extern.func(float %x, float %y) #0
18  ret float %val
19}
20
21; CHECK-LABEL: define float @strictfp_declaration(float %x, float %y)
22; RESULT-SAME: [[STRICTFP_ONLY]] {
23define float @strictfp_declaration(float %x, float %y) #0 {
24  %val = call float @strict.extern.func(float %x, float %y)
25  ret float %val
26}
27
28; CHECK-LABEL: define float @strictfp_no_constrained_ops(float %x, float %y)
29; RESULT-SAME: [[STRICTFP_ONLY]] {
30define float @strictfp_no_constrained_ops(float %x, float %y) #0 {
31  %val = call float @llvm.copysign.f32(float %x, float %y) #1
32  ret float %val
33}
34
35; CHECK-LABEL: declare float @strict.extern.func(float, float)
36; RESULT-SAME: [[STRICTFP_ONLY]]{{$}}
37declare float @strict.extern.func(float, float) #0
38
39declare float @extern.func(float, float)
40
41declare float @llvm.copysign.f32(float, float)
42declare float @llvm.experimental.constrained.fadd.f32(float, float, metadata, metadata)
43
44; RESULT: attributes [[STRICTFP_ONLY]] = { strictfp }
45
46attributes #0 = { nounwind strictfp }
47attributes #1 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) strictfp }
48