xref: /llvm-project/llvm/test/CodeGen/AMDGPU/inline-attr.ll (revision 29441e4f5fa5f5c7709f7cf180815ba97f611297)
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(ptr addrspace(1) captures(none) %p) local_unnamed_addr #1 {
7; GCN: %mul.i = fmul float %load, 1.500000e+01
8
9; UNSAFE: attributes #0 = { nounwind "uniform-work-group-size"="false" "unsafe-fp-math"="true" }
10; UNSAFE: attributes #1 = { nounwind "less-precise-fpmad"="false" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "uniform-work-group-size"="false" "unsafe-fp-math"="true" }
11
12; NOINFS: attributes #0 = { nounwind "no-infs-fp-math"="true" "uniform-work-group-size"="false" "unsafe-fp-math"="true" }
13; NOINFS: attributes #1 = { nounwind "less-precise-fpmad"="false" "no-infs-fp-math"="true" "no-nans-fp-math"="false" "uniform-work-group-size"="false" "unsafe-fp-math"="true" }
14
15; NONANS: attributes #0 = { nounwind "no-nans-fp-math"="true" "uniform-work-group-size"="false" "unsafe-fp-math"="true" }
16; NONANS: attributes #1 = { nounwind "less-precise-fpmad"="false" "no-infs-fp-math"="false" "no-nans-fp-math"="true" "uniform-work-group-size"="false" "unsafe-fp-math"="true" }
17
18declare void @extern() #0
19
20define float @foo(float %x) #0 {
21entry:
22  call void @extern()
23  %mul = fmul float %x, 1.500000e+01
24  ret float %mul
25}
26
27define amdgpu_kernel void @caller(ptr addrspace(1) %p) #1 {
28entry:
29  %load = load float, ptr addrspace(1) %p, align 4
30  %call = call fast float @foo(float %load)
31  store float %call, ptr addrspace(1) %p, align 4
32  ret void
33}
34
35attributes #0 = { nounwind "uniform-work-group-size"="false" "unsafe-fp-math"="true"}
36attributes #1 = { nounwind "less-precise-fpmad"="true" "no-infs-fp-math"="true" "no-nans-fp-math"="true" "unsafe-fp-math"="true" }
37