1 ; RUN: llc -O0 -mtriple=spirv32-unknown-unknown %s -o - | FileCheck %s --check-prefix=CHECK-SPIRV
3 ;; This test checks following SYCL relational builtins with half and half2 types:
4 ;; isfinite, isinf, isnan, isnormal, signbit, isequal, isnotequal, isgreater
5 ;; isgreaterequal, isless, islessequal, islessgreater, isordered, isunordered
7 ; CHECK-SPIRV: %[[#BoolTypeID:]] = OpTypeBool
8 ; CHECK-SPIRV: %[[#BoolVectorTypeID:]] = OpTypeVector %[[#BoolTypeID]] 2
10 ; CHECK-SPIRV: OpIsFinite %[[#BoolTypeID]]
11 ; CHECK-SPIRV: OpIsInf %[[#BoolTypeID]]
12 ; CHECK-SPIRV: OpIsNan %[[#BoolTypeID]]
13 ; CHECK-SPIRV: OpIsNormal %[[#BoolTypeID]]
14 ; CHECK-SPIRV: OpSignBitSet %[[#BoolTypeID]]
15 ; CHECK-SPIRV: OpFOrdEqual %[[#BoolTypeID]]
16 ; CHECK-SPIRV: OpFUnordNotEqual %[[#BoolTypeID]]
17 ; CHECK-SPIRV: OpFOrdGreaterThan %[[#BoolTypeID]]
18 ; CHECK-SPIRV: OpFOrdGreaterThanEqual %[[#BoolTypeID]]
19 ; CHECK-SPIRV: OpFOrdLessThan %[[#BoolTypeID]]
20 ; CHECK-SPIRV: OpFOrdLessThanEqual %[[#BoolTypeID]]
21 ; CHECK-SPIRV: OpFOrdNotEqual %[[#BoolTypeID]]
22 ; CHECK-SPIRV: OpOrdered %[[#BoolTypeID]]
23 ; CHECK-SPIRV: OpUnordered %[[#BoolTypeID]]
25 ; CHECK-SPIRV: OpIsFinite %[[#BoolVectorTypeID]]
26 ; CHECK-SPIRV: OpIsInf %[[#BoolVectorTypeID]]
27 ; CHECK-SPIRV: OpIsNan %[[#BoolVectorTypeID]]
28 ; CHECK-SPIRV: OpIsNormal %[[#BoolVectorTypeID]]
29 ; CHECK-SPIRV: OpSignBitSet %[[#BoolVectorTypeID]]
30 ; CHECK-SPIRV: OpFOrdEqual %[[#BoolVectorTypeID]]
31 ; CHECK-SPIRV: OpFUnordNotEqual %[[#BoolVectorTypeID]]
32 ; CHECK-SPIRV: OpFOrdGreaterThan %[[#BoolVectorTypeID]]
33 ; CHECK-SPIRV: OpFOrdGreaterThanEqual %[[#BoolVectorTypeID]]
34 ; CHECK-SPIRV: OpFOrdLessThan %[[#BoolVectorTypeID]]
35 ; CHECK-SPIRV: OpFOrdLessThanEqual %[[#BoolVectorTypeID]]
36 ; CHECK-SPIRV: OpFOrdNotEqual %[[#BoolVectorTypeID]]
37 ; CHECK-SPIRV: OpOrdered %[[#BoolVectorTypeID]]
38 ; CHECK-SPIRV: OpUnordered %[[#BoolVectorTypeID]]
40 define dso_local spir_func void @test_scalar(i32 addrspace(4)* nocapture writeonly %out, half %h) local_unnamed_addr {
42 %call = tail call spir_func i32 @_Z8isfiniteDh(half %h)
43 %call1 = tail call spir_func i32 @_Z5isinfDh(half %h)
44 %add = add nsw i32 %call1, %call
45 %call2 = tail call spir_func i32 @_Z5isnanDh(half %h)
46 %add3 = add nsw i32 %add, %call2
47 %call4 = tail call spir_func i32 @_Z8isnormalDh(half %h)
48 %add5 = add nsw i32 %add3, %call4
49 %call6 = tail call spir_func i32 @_Z7signbitDh(half %h)
50 %add7 = add nsw i32 %add5, %call6
51 %call8 = tail call spir_func i32 @_Z7isequalDhDh(half %h, half %h)
52 %add9 = add nsw i32 %add7, %call8
53 %call10 = tail call spir_func i32 @_Z10isnotequalDhDh(half %h, half %h)
54 %add11 = add nsw i32 %add9, %call10
55 %call12 = tail call spir_func i32 @_Z9isgreaterDhDh(half %h, half %h)
56 %add13 = add nsw i32 %add11, %call12
57 %call14 = tail call spir_func i32 @_Z14isgreaterequalDhDh(half %h, half %h)
58 %add15 = add nsw i32 %add13, %call14
59 %call16 = tail call spir_func i32 @_Z6islessDhDh(half %h, half %h)
60 %add17 = add nsw i32 %add15, %call16
61 %call18 = tail call spir_func i32 @_Z11islessequalDhDh(half %h, half %h)
62 %add19 = add nsw i32 %add17, %call18
63 %call20 = tail call spir_func i32 @_Z13islessgreaterDhDh(half %h, half %h)
64 %add21 = add nsw i32 %add19, %call20
65 %call22 = tail call spir_func i32 @_Z9isorderedDhDh(half %h, half %h)
66 %add23 = add nsw i32 %add21, %call22
67 %call24 = tail call spir_func i32 @_Z11isunorderedDhDh(half %h, half %h)
68 %add25 = add nsw i32 %add23, %call24
69 store i32 %add25, i32 addrspace(4)* %out, align 4
73 declare spir_func i32 @_Z8isfiniteDh(half) local_unnamed_addr
75 declare spir_func i32 @_Z5isinfDh(half) local_unnamed_addr
77 declare spir_func i32 @_Z5isnanDh(half) local_unnamed_addr
79 declare spir_func i32 @_Z8isnormalDh(half) local_unnamed_addr
81 declare spir_func i32 @_Z7signbitDh(half) local_unnamed_addr
83 declare spir_func i32 @_Z7isequalDhDh(half, half) local_unnamed_addr
85 declare spir_func i32 @_Z10isnotequalDhDh(half, half) local_unnamed_addr
87 declare spir_func i32 @_Z9isgreaterDhDh(half, half) local_unnamed_addr
89 declare spir_func i32 @_Z14isgreaterequalDhDh(half, half) local_unnamed_addr
91 declare spir_func i32 @_Z6islessDhDh(half, half) local_unnamed_addr
93 declare spir_func i32 @_Z11islessequalDhDh(half, half) local_unnamed_addr
95 declare spir_func i32 @_Z13islessgreaterDhDh(half, half) local_unnamed_addr
97 declare spir_func i32 @_Z9isorderedDhDh(half, half) local_unnamed_addr
99 declare spir_func i32 @_Z11isunorderedDhDh(half, half) local_unnamed_addr
101 define dso_local spir_func void @test_vector(<2 x i16> addrspace(4)* nocapture writeonly %out, <2 x half> %h) local_unnamed_addr {
103 %call = tail call spir_func <2 x i16> @_Z8isfiniteDv2_Dh(<2 x half> %h)
104 %call1 = tail call spir_func <2 x i16> @_Z5isinfDv2_Dh(<2 x half> %h)
105 %add = add <2 x i16> %call1, %call
106 %call2 = tail call spir_func <2 x i16> @_Z5isnanDv2_Dh(<2 x half> %h)
107 %add3 = add <2 x i16> %add, %call2
108 %call4 = tail call spir_func <2 x i16> @_Z8isnormalDv2_Dh(<2 x half> %h)
109 %add5 = add <2 x i16> %add3, %call4
110 %call6 = tail call spir_func <2 x i16> @_Z7signbitDv2_Dh(<2 x half> %h)
111 %add7 = add <2 x i16> %add5, %call6
112 %call8 = tail call spir_func <2 x i16> @_Z7isequalDv2_DhS_(<2 x half> %h, <2 x half> %h)
113 %add9 = add <2 x i16> %add7, %call8
114 %call10 = tail call spir_func <2 x i16> @_Z10isnotequalDv2_DhS_(<2 x half> %h, <2 x half> %h)
115 %add11 = add <2 x i16> %add9, %call10
116 %call12 = tail call spir_func <2 x i16> @_Z9isgreaterDv2_DhS_(<2 x half> %h, <2 x half> %h)
117 %add13 = add <2 x i16> %add11, %call12
118 %call14 = tail call spir_func <2 x i16> @_Z14isgreaterequalDv2_DhS_(<2 x half> %h, <2 x half> %h)
119 %add15 = add <2 x i16> %add13, %call14
120 %call16 = tail call spir_func <2 x i16> @_Z6islessDv2_DhS_(<2 x half> %h, <2 x half> %h)
121 %add17 = add <2 x i16> %add15, %call16
122 %call18 = tail call spir_func <2 x i16> @_Z11islessequalDv2_DhS_(<2 x half> %h, <2 x half> %h)
123 %add19 = add <2 x i16> %add17, %call18
124 %call20 = tail call spir_func <2 x i16> @_Z13islessgreaterDv2_DhS_(<2 x half> %h, <2 x half> %h)
125 %add21 = add <2 x i16> %add19, %call20
126 %call22 = tail call spir_func <2 x i16> @_Z9isorderedDv2_DhS_(<2 x half> %h, <2 x half> %h)
127 %add23 = add <2 x i16> %add21, %call22
128 %call24 = tail call spir_func <2 x i16> @_Z11isunorderedDv2_DhS_(<2 x half> %h, <2 x half> %h)
129 %add25 = add <2 x i16> %add23, %call24
130 store <2 x i16> %add25, <2 x i16> addrspace(4)* %out, align 4
134 declare spir_func <2 x i16> @_Z8isfiniteDv2_Dh(<2 x half>) local_unnamed_addr
136 declare spir_func <2 x i16> @_Z5isinfDv2_Dh(<2 x half>) local_unnamed_addr
138 declare spir_func <2 x i16> @_Z5isnanDv2_Dh(<2 x half>) local_unnamed_addr
140 declare spir_func <2 x i16> @_Z8isnormalDv2_Dh(<2 x half>) local_unnamed_addr
142 declare spir_func <2 x i16> @_Z7signbitDv2_Dh(<2 x half>) local_unnamed_addr
144 declare spir_func <2 x i16> @_Z7isequalDv2_DhS_(<2 x half>, <2 x half>) local_unnamed_addr
146 declare spir_func <2 x i16> @_Z10isnotequalDv2_DhS_(<2 x half>, <2 x half>) local_unnamed_addr
148 declare spir_func <2 x i16> @_Z9isgreaterDv2_DhS_(<2 x half>, <2 x half>) local_unnamed_addr
150 declare spir_func <2 x i16> @_Z14isgreaterequalDv2_DhS_(<2 x half>, <2 x half>) local_unnamed_addr
152 declare spir_func <2 x i16> @_Z6islessDv2_DhS_(<2 x half>, <2 x half>) local_unnamed_addr
154 declare spir_func <2 x i16> @_Z11islessequalDv2_DhS_(<2 x half>, <2 x half>) local_unnamed_addr
156 declare spir_func <2 x i16> @_Z13islessgreaterDv2_DhS_(<2 x half>, <2 x half>) local_unnamed_addr
158 declare spir_func <2 x i16> @_Z9isorderedDv2_DhS_(<2 x half>, <2 x half>) local_unnamed_addr
160 declare spir_func <2 x i16> @_Z11isunorderedDv2_DhS_(<2 x half>, <2 x half>) local_unnamed_addr