1; RUN: llvm-as %s -o %t.bc
2; RUN: llvm-spirv %t.bc -spirv-text -o - | FileCheck %s
3; RUN: llvm-spirv %t.bc -o %t.spv
4; RUN: spirv-val %t.spv
5
6
7; CHECK: Name [[ad:[0-9]+]] "add"
8; CHECK: Name [[di:[0-9]+]] "div"
9; CHECK: Name [[su:[0-9]+]] "sub"
10; CHECK: Name [[mu:[0-9]+]] "mul"
11
12; CHECK-NOT: Decorate {{[0-9]+}} FPRoundingMode
13
14; CHECK: Decorate [[ad]] FPRoundingMode 0
15; CHECK: Decorate [[di]] FPRoundingMode 1
16; CHECK: Decorate [[su]] FPRoundingMode 2
17; CHECK: Decorate [[mu]] FPRoundingMode 3
18
19; CHECK-NOT: Decorate {{[0-9]+}} FPRoundingMode
20
21; CHECK: FAdd {{[0-9]+}} [[ad]]
22; CHECK: FDiv {{[0-9]+}} [[di]]
23; CHECK: FSub {{[0-9]+}} [[su]]
24; CHECK: FMul {{[0-9]+}} [[mu]]
25; CHECK: FMul
26; CHECK: FAdd
27; CHECK: ExtInst {{[0-9]+}} {{[0-9]+}} {{[0-9]+}} fma
28; CHECK: FRem
29
30target datalayout = "e-i64:64-v16:16-v24:32-v32:32-v48:64-v96:128-v192:256-v256:256-v512:512-v1024:1024-n8:16:32:64"
31target triple = "spir64-unknown-linux"
32
33; Function Attrs: norecurse nounwind strictfp
34define dso_local spir_kernel void @test(float %a, i32 %in, i32 %ui) local_unnamed_addr #0 !kernel_arg_addr_space !5 !kernel_arg_access_qual !6 !kernel_arg_type !7 !kernel_arg_base_type !7 !kernel_arg_type_qual !8 !kernel_arg_buffer_location !9 {
35entry:
36  %add = tail call float @llvm.experimental.constrained.fadd.f32(float %a, float %a, metadata !"round.tonearest", metadata !"fpexcept.strict") #2
37  %div = tail call float @llvm.experimental.constrained.fdiv.f32(float %add, float %add, metadata !"round.towardzero", metadata !"fpexcept.strict") #2, !fpmath !10
38  %sub = tail call float @llvm.experimental.constrained.fsub.f32(float %div, float %div, metadata !"round.upward", metadata !"fpexcept.strict") #2
39  %mul = tail call float @llvm.experimental.constrained.fmul.f32(float %sub, float %sub, metadata !"round.downward", metadata !"fpexcept.strict") #2
40  %0 = tail call float @llvm.experimental.constrained.fmuladd.f32(float %mul, float %mul, float %mul, metadata !"round.tonearestaway", metadata !"fpexcept.strict") #2
41  %1 = tail call float @llvm.experimental.constrained.fma.f32(float %0, float %0, float %0, metadata !"round.dynamic", metadata !"fpexcept.strict") #2
42  %2 = tail call float @llvm.experimental.constrained.frem.f32(float %1, float %1, metadata !"round.dynamic", metadata !"fpexcept.strict") #2
43  ret void
44}
45
46; Function Attrs: inaccessiblememonly nounwind willreturn
47declare float @llvm.experimental.constrained.fadd.f32(float, float, metadata, metadata) #1
48
49; Function Attrs: inaccessiblememonly nounwind willreturn
50declare float @llvm.experimental.constrained.fdiv.f32(float, float, metadata, metadata) #1
51
52; Function Attrs: inaccessiblememonly nounwind willreturn
53declare float @llvm.experimental.constrained.fsub.f32(float, float, metadata, metadata) #1
54
55; Function Attrs: inaccessiblememonly nounwind willreturn
56declare float @llvm.experimental.constrained.fmul.f32(float, float, metadata, metadata) #1
57
58; Function Attrs: inaccessiblememonly nounwind willreturn
59declare float @llvm.experimental.constrained.fmuladd.f32(float, float, float, metadata, metadata) #1
60
61; Function Attrs: inaccessiblememonly nounwind willreturn
62declare float @llvm.experimental.constrained.fma.f32(float, float, float, metadata, metadata) #1
63
64; Function Attrs: inaccessiblememonly nounwind willreturn
65declare float @llvm.experimental.constrained.frem.f32(float, float, metadata, metadata) #1
66
67attributes #0 = { norecurse nounwind strictfp "correctly-rounded-divide-sqrt-fp-math"="false" "disable-tail-calls"="false" "frame-pointer"="all" "less-precise-fpmad"="false" "min-legal-vector-width"="0" "no-infs-fp-math"="false" "no-jump-tables"="false" "no-nans-fp-math"="false" "no-signed-zeros-fp-math"="false" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "sycl-module-id"="test2.cl" "uniform-work-group-size"="true" "unsafe-fp-math"="false" "use-soft-float"="false" }
68attributes #1 = { inaccessiblememonly nounwind willreturn }
69attributes #2 = { strictfp }
70
71!llvm.module.flags = !{!0}
72!opencl.ocl.version = !{!1}
73!opencl.spir.version = !{!2, !2}
74!spirv.Source = !{!3}
75!llvm.ident = !{!4}
76
77!0 = !{i32 1, !"wchar_size", i32 4}
78!1 = !{i32 1, i32 0}
79!2 = !{i32 1, i32 2}
80!3 = !{i32 4, i32 100000}
81!4 = !{!"clang version 12.0.0 (https://github.com/c199914007/llvm.git f0c85a8adeb49638c01eee1451aa9b35462cbfd5)"}
82!5 = !{i32 0, i32 0, i32 0}
83!6 = !{!"none", !"none", !"none"}
84!7 = !{!"float", !"int", !"uint"}
85!8 = !{!"", !"", !""}
86!9 = !{i32 -1, i32 -1, i32 -1}
87!10 = !{float 2.500000e+00}
88