1; RUN: opt -mtriple=amdgcn--amdhsa -S -O3 -enable-unsafe-fp-math %s  | FileCheck -check-prefix=GCN -check-prefix=UNSAFE %s
2; RUN: opt -mtriple=amdgcn--amdhsa -S -O3 -enable-no-nans-fp-math %s | FileCheck -check-prefix=GCN -check-prefix=NONANS %s
3; RUN: opt -mtriple=amdgcn--amdhsa -S -O3 -enable-no-infs-fp-math %s | FileCheck -check-prefix=GCN -check-prefix=NOINFS %s
4
5; GCN: define float @foo(float %x) local_unnamed_addr #0 {
6; GCN: define amdgpu_kernel void @caller(float addrspace(1)* nocapture %p) local_unnamed_addr #1 {
7; GCN: %mul.i = fmul float %load, 1.500000e+01
8
9; UNSAFE: attributes #0 = { norecurse nounwind readnone "unsafe-fp-math"="true" }
10; UNSAFE: attributes #1 = { nofree norecurse nounwind "less-precise-fpmad"="false" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "unsafe-fp-math"="true" }
11
12; NOINFS: attributes #0 = { norecurse nounwind readnone "no-infs-fp-math"="true" }
13; NOINFS: attributes #1 = { nofree norecurse nounwind "less-precise-fpmad"="false" "no-infs-fp-math"="true" "no-nans-fp-math"="false" "unsafe-fp-math"="false" }
14
15; NONANS: attributes #0 = { norecurse nounwind readnone "no-nans-fp-math"="true" }
16; NONANS: attributes #1 = { nofree norecurse nounwind "less-precise-fpmad"="false" "no-infs-fp-math"="false" "no-nans-fp-math"="true" "unsafe-fp-math"="false" }
17
18define float @foo(float %x) #0 {
19entry:
20  %mul = fmul float %x, 1.500000e+01
21  ret float %mul
22}
23
24define amdgpu_kernel void @caller(float addrspace(1)* %p) #1 {
25entry:
26  %load = load float, float addrspace(1)* %p, align 4
27  %call = call fast float @foo(float %load) #0
28  store float %call, float addrspace(1)* %p, align 4
29  ret void
30}
31
32attributes #0 = { nounwind }
33attributes #1 = { nounwind "less-precise-fpmad"="true" "no-infs-fp-math"="true" "no-nans-fp-math"="true" "unsafe-fp-math"="true" }
34