target datalayout = "e-p:32:32-i64:64-v16:16-v24:32-v32:32-v48:64-v96:128-v192:256-v256:256-v512:512-v1024:1024"
target triple = "spir-unknown-unknown"
define void @foo(float %1, float %2) {
entry:
%oltRes = fcmp nnan olt float %1, %2, !spirv.Decorations !1
ret void
}
!1 = !{!2}
!2 = !{i32 40, i32 0} ; 40 is FPFastMathMode
The code above results in the following SPIR-V Module:
119734787 67072 393230 11 0
2 Capability Addresses
2 Capability Linkage
2 Capability Kernel
5 ExtInstImport 1 "OpenCL.std"
3 MemoryModel 1 2
3 Source 0 0
3 Name 5 "foo"
4 Name 8 "entry"
4 Name 10 "oltRes"
5 Decorate 5 LinkageAttributes "foo" Export
4 Decorate 10 FPFastMathMode 1
4 Decorate 10 FPFastMathMode 0
2 TypeVoid 2
3 TypeFloat 3 32
5 TypeFunction 4 2 3 3
2 TypeBool 9
5 Function 2 5 0 4
3 FunctionParameter 3 6
3 FunctionParameter 3 7
2 Label 8
5 FOrdLessThan 9 10 6 7
1 Return
1 FunctionEnd
The module contains FPFastMathMode decoration twice for id 10. According to the spec
It is invalid to decorate any given or structure member more than one time with the same decoration, unless explicitly allowed below for a specific decoration.
FPFastMathMode does not explicitly allow it, so this is illegal.
The code above results in the following SPIR-V Module:
The module contains
FPFastMathModedecoration twice for id 10. According to the specFPFastMathModedoes not explicitly allow it, so this is illegal.