Stanislav Mekhanoshin | 1d8cf2b | 2017-09-29 23:40:19 +0000 | [diff] [blame] | 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 "less-precise-fpmad"="true" "no-infs-fp-math"="true" "no-nans-fp-math"="true" "unsafe-fp-math"="true" } |
| 10 | ; UNSAFE: attributes #1 = { norecurse nounwind "less-precise-fpmad"="true" "no-infs-fp-math"="true" "no-nans-fp-math"="true" "unsafe-fp-math"="true" } |
| 11 | |
| 12 | ; NOINFS: attributes #0 = { norecurse nounwind readnone "no-infs-fp-math"="true" } |
| 13 | ; NOINFS: attributes #1 = { 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 = { norecurse nounwind "less-precise-fpmad"="false" "no-infs-fp-math"="false" "no-nans-fp-math"="true" "unsafe-fp-math"="false" } |
| 17 | |
| 18 | define float @foo(float %x) #0 { |
| 19 | entry: |
| 20 | %mul = fmul float %x, 1.500000e+01 |
| 21 | ret float %mul |
| 22 | } |
| 23 | |
| 24 | define amdgpu_kernel void @caller(float addrspace(1)* %p) #1 { |
| 25 | entry: |
| 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 | |
| 32 | attributes #0 = { nounwind } |
| 33 | attributes #1 = { nounwind "less-precise-fpmad"="true" "no-infs-fp-math"="true" "no-nans-fp-math"="true" "unsafe-fp-math"="true" } |