1 ; RUN: llc -O0 -mtriple=spirv32-unknown-unknown %s -o - | FileCheck %s --check-prefix=CHECK-SPIRV
2 ; RUN: %if spirv-tools %{ llc -O0 -mtriple=spirv32-unknown-unknown %s -o - -filetype=obj | spirv-val %}
4 ;; This test checks following SYCL relational builtins with double and double2
6 ;; isfinite, isinf, isnan, isnormal, signbit, isequal, isnotequal, isgreater
7 ;; isgreaterequal, isless, islessequal, islessgreater, isordered, isunordered
9 ; CHECK-SPIRV: %[[#BoolTypeID:]] = OpTypeBool
10 ; CHECK-SPIRV: %[[#BoolVectorTypeID:]] = OpTypeVector %[[#BoolTypeID]] 2
12 ; CHECK-SPIRV: OpIsFinite %[[#BoolTypeID]]
13 ; CHECK-SPIRV: OpIsInf %[[#BoolTypeID]]
14 ; CHECK-SPIRV: OpIsNan %[[#BoolTypeID]]
15 ; CHECK-SPIRV: OpIsNormal %[[#BoolTypeID]]
16 ; CHECK-SPIRV: OpSignBitSet %[[#BoolTypeID]]
17 ; CHECK-SPIRV: OpFOrdEqual %[[#BoolTypeID]]
18 ; CHECK-SPIRV: OpFUnordNotEqual %[[#BoolTypeID]]
19 ; CHECK-SPIRV: OpFOrdGreaterThan %[[#BoolTypeID]]
20 ; CHECK-SPIRV: OpFOrdGreaterThanEqual %[[#BoolTypeID]]
21 ; CHECK-SPIRV: OpFOrdLessThan %[[#BoolTypeID]]
22 ; CHECK-SPIRV: OpFOrdLessThanEqual %[[#BoolTypeID]]
23 ; CHECK-SPIRV: OpFOrdNotEqual %[[#BoolTypeID]]
24 ; CHECK-SPIRV: OpOrdered %[[#BoolTypeID]]
25 ; CHECK-SPIRV: OpUnordered %[[#BoolTypeID]]
27 ; CHECK-SPIRV: OpIsFinite %[[#BoolVectorTypeID]]
28 ; CHECK-SPIRV: OpIsInf %[[#BoolVectorTypeID]]
29 ; CHECK-SPIRV: OpIsNan %[[#BoolVectorTypeID]]
30 ; CHECK-SPIRV: OpIsNormal %[[#BoolVectorTypeID]]
31 ; CHECK-SPIRV: OpSignBitSet %[[#BoolVectorTypeID]]
32 ; CHECK-SPIRV: OpFOrdEqual %[[#BoolVectorTypeID]]
33 ; CHECK-SPIRV: OpFUnordNotEqual %[[#BoolVectorTypeID]]
34 ; CHECK-SPIRV: OpFOrdGreaterThan %[[#BoolVectorTypeID]]
35 ; CHECK-SPIRV: OpFOrdGreaterThanEqual %[[#BoolVectorTypeID]]
36 ; CHECK-SPIRV: OpFOrdLessThan %[[#BoolVectorTypeID]]
37 ; CHECK-SPIRV: OpFOrdLessThanEqual %[[#BoolVectorTypeID]]
38 ; CHECK-SPIRV: OpFOrdNotEqual %[[#BoolVectorTypeID]]
39 ; CHECK-SPIRV: OpOrdered %[[#BoolVectorTypeID]]
40 ; CHECK-SPIRV: OpUnordered %[[#BoolVectorTypeID]]
42 define dso_local spir_func void @test_scalar(i32 addrspace(4)* nocapture writeonly %out, double %d) local_unnamed_addr {
44 %call = tail call spir_func i32 @_Z8isfinited(double %d)
45 %call1 = tail call spir_func i32 @_Z5isinfd(double %d)
46 %add = add nsw i32 %call1, %call
47 %call2 = tail call spir_func i32 @_Z5isnand(double %d)
48 %add3 = add nsw i32 %add, %call2
49 %call4 = tail call spir_func i32 @_Z8isnormald(double %d)
50 %add5 = add nsw i32 %add3, %call4
51 %call6 = tail call spir_func i32 @_Z7signbitd(double %d)
52 %add7 = add nsw i32 %add5, %call6
53 %call8 = tail call spir_func i32 @_Z7isequaldd(double %d, double %d)
54 %add9 = add nsw i32 %add7, %call8
55 %call10 = tail call spir_func i32 @_Z10isnotequaldd(double %d, double %d)
56 %add11 = add nsw i32 %add9, %call10
57 %call12 = tail call spir_func i32 @_Z9isgreaterdd(double %d, double %d)
58 %add13 = add nsw i32 %add11, %call12
59 %call14 = tail call spir_func i32 @_Z14isgreaterequaldd(double %d, double %d)
60 %add15 = add nsw i32 %add13, %call14
61 %call16 = tail call spir_func i32 @_Z6islessdd(double %d, double %d)
62 %add17 = add nsw i32 %add15, %call16
63 %call18 = tail call spir_func i32 @_Z11islessequaldd(double %d, double %d)
64 %add19 = add nsw i32 %add17, %call18
65 %call20 = tail call spir_func i32 @_Z13islessgreaterdd(double %d, double %d)
66 %add21 = add nsw i32 %add19, %call20
67 %call22 = tail call spir_func i32 @_Z9isordereddd(double %d, double %d)
68 %add23 = add nsw i32 %add21, %call22
69 %call24 = tail call spir_func i32 @_Z11isunordereddd(double %d, double %d)
70 %add25 = add nsw i32 %add23, %call24
71 store i32 %add25, i32 addrspace(4)* %out, align 4
75 declare spir_func i32 @_Z8isfinited(double) local_unnamed_addr
77 declare spir_func i32 @_Z5isinfd(double) local_unnamed_addr
79 declare spir_func i32 @_Z5isnand(double) local_unnamed_addr
81 declare spir_func i32 @_Z8isnormald(double) local_unnamed_addr
83 declare spir_func i32 @_Z7signbitd(double) local_unnamed_addr
85 declare spir_func i32 @_Z7isequaldd(double, double) local_unnamed_addr
87 declare spir_func i32 @_Z10isnotequaldd(double, double) local_unnamed_addr
89 declare spir_func i32 @_Z9isgreaterdd(double, double) local_unnamed_addr
91 declare spir_func i32 @_Z14isgreaterequaldd(double, double) local_unnamed_addr
93 declare spir_func i32 @_Z6islessdd(double, double) local_unnamed_addr
95 declare spir_func i32 @_Z11islessequaldd(double, double) local_unnamed_addr
97 declare spir_func i32 @_Z13islessgreaterdd(double, double) local_unnamed_addr
99 declare spir_func i32 @_Z9isordereddd(double, double) local_unnamed_addr
101 declare spir_func i32 @_Z11isunordereddd(double, double) local_unnamed_addr
103 define dso_local spir_func void @test_vector(<2 x i64> addrspace(4)* nocapture writeonly %out, <2 x double> %d) local_unnamed_addr {
105 %call = tail call spir_func <2 x i64> @_Z8isfiniteDv2_d(<2 x double> %d)
106 %call1 = tail call spir_func <2 x i64> @_Z5isinfDv2_d(<2 x double> %d)
107 %add = add <2 x i64> %call1, %call
108 %call2 = tail call spir_func <2 x i64> @_Z5isnanDv2_d(<2 x double> %d)
109 %add3 = add <2 x i64> %add, %call2
110 %call4 = tail call spir_func <2 x i64> @_Z8isnormalDv2_d(<2 x double> %d)
111 %add5 = add <2 x i64> %add3, %call4
112 %call6 = tail call spir_func <2 x i64> @_Z7signbitDv2_d(<2 x double> %d)
113 %add7 = add <2 x i64> %add5, %call6
114 %call8 = tail call spir_func <2 x i64> @_Z7isequalDv2_dS_(<2 x double> %d, <2 x double> %d)
115 %add9 = add <2 x i64> %add7, %call8
116 %call10 = tail call spir_func <2 x i64> @_Z10isnotequalDv2_dS_(<2 x double> %d, <2 x double> %d)
117 %add11 = add <2 x i64> %add9, %call10
118 %call12 = tail call spir_func <2 x i64> @_Z9isgreaterDv2_dS_(<2 x double> %d, <2 x double> %d)
119 %add13 = add <2 x i64> %add11, %call12
120 %call14 = tail call spir_func <2 x i64> @_Z14isgreaterequalDv2_dS_(<2 x double> %d, <2 x double> %d)
121 %add15 = add <2 x i64> %add13, %call14
122 %call16 = tail call spir_func <2 x i64> @_Z6islessDv2_dS_(<2 x double> %d, <2 x double> %d)
123 %add17 = add <2 x i64> %add15, %call16
124 %call18 = tail call spir_func <2 x i64> @_Z11islessequalDv2_dS_(<2 x double> %d, <2 x double> %d)
125 %add19 = add <2 x i64> %add17, %call18
126 %call20 = tail call spir_func <2 x i64> @_Z13islessgreaterDv2_dS_(<2 x double> %d, <2 x double> %d)
127 %add21 = add <2 x i64> %add19, %call20
128 %call22 = tail call spir_func <2 x i64> @_Z9isorderedDv2_dS_(<2 x double> %d, <2 x double> %d)
129 %add23 = add <2 x i64> %add21, %call22
130 %call24 = tail call spir_func <2 x i64> @_Z11isunorderedDv2_dS_(<2 x double> %d, <2 x double> %d)
131 %add25 = add <2 x i64> %add23, %call24
132 store <2 x i64> %add25, <2 x i64> addrspace(4)* %out, align 16
136 declare spir_func <2 x i64> @_Z8isfiniteDv2_d(<2 x double>) local_unnamed_addr
138 declare spir_func <2 x i64> @_Z5isinfDv2_d(<2 x double>) local_unnamed_addr
140 declare spir_func <2 x i64> @_Z5isnanDv2_d(<2 x double>) local_unnamed_addr
142 declare spir_func <2 x i64> @_Z8isnormalDv2_d(<2 x double>) local_unnamed_addr
144 declare spir_func <2 x i64> @_Z7signbitDv2_d(<2 x double>) local_unnamed_addr
146 declare spir_func <2 x i64> @_Z7isequalDv2_dS_(<2 x double>, <2 x double>) local_unnamed_addr
148 declare spir_func <2 x i64> @_Z10isnotequalDv2_dS_(<2 x double>, <2 x double>) local_unnamed_addr
150 declare spir_func <2 x i64> @_Z9isgreaterDv2_dS_(<2 x double>, <2 x double>) local_unnamed_addr
152 declare spir_func <2 x i64> @_Z14isgreaterequalDv2_dS_(<2 x double>, <2 x double>) local_unnamed_addr
154 declare spir_func <2 x i64> @_Z6islessDv2_dS_(<2 x double>, <2 x double>) local_unnamed_addr
156 declare spir_func <2 x i64> @_Z11islessequalDv2_dS_(<2 x double>, <2 x double>) local_unnamed_addr
158 declare spir_func <2 x i64> @_Z13islessgreaterDv2_dS_(<2 x double>, <2 x double>) local_unnamed_addr
160 declare spir_func <2 x i64> @_Z9isorderedDv2_dS_(<2 x double>, <2 x double>) local_unnamed_addr
162 declare spir_func <2 x i64> @_Z11isunorderedDv2_dS_(<2 x double>, <2 x double>) local_unnamed_addr