Skip to content

Commit 4f73712

Browse files
authored
Merge pull request #3449 from WalterBright/SimdCmp
document vector support for == != < <= > >=
2 parents 78e0a5d + d0c2b3c commit 4f73712

File tree

1 file changed

+26
-9
lines changed

1 file changed

+26
-9
lines changed

spec/simd.dd

Lines changed: 26 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,13 @@ $(HEADERNAV_TOC)
2020

2121
$(IMPLEMENTATION_DEFINED Which vector types are supported depends
2222
on the target. The implementation is expected to only support
23-
the vector types that are implemented in the target's hardware.
23+
the vector types and operations that are implemented in the target's hardware.
2424
)
2525

26+
$(RATIONALE Emulating unsupported vector types and operations can exhibit
27+
such poor performance that the user is likely better off selecting a different
28+
algorithm than relying on emulation.)
29+
2630
$(BEST_PRACTICE Use the declarations in $(CORE_SIMD) instead of
2731
the language $(GLINK2 type, Vector) grammar.
2832
)
@@ -37,18 +41,17 @@ import core.simd;
3741
---
3842

3943
$(IMPLEMENTATION_DEFINED
40-
41-
$(P These types and operations will be the ones defined for the architecture
44+
These types and operations will be the ones defined for the architecture
4245
the compiler is targeting. If a particular CPU family has varying
4346
support for vector types, an additional runtime check may be necessary.
4447
The compiler does not emit runtime checks; those must be done by the
4548
programmer.
4649
)
4750

48-
$(P Depending on the architecture, compiler flags may be required to
51+
$(IMPLEMENTATION_DEFINED Depending on the target architecture, compiler flags
52+
may be required to
4953
activate support for SIMD types.
5054
)
51-
)
5255

5356
$(P The types defined will all follow the naming convention:)
5457

@@ -92,7 +95,8 @@ $(H3 $(LNAME2 properties, Properties))
9295

9396
$(H3 $(LNAME2 conversions, Conversions))
9497

95-
$(P Vector types of the same size can be implicitly converted among
98+
$(P Vector types of the same size (number_of_elements * size_of_element)
99+
can be implicitly converted among
96100
each other, this is done as a reinterpret cast (a type paint).
97101
Vector types can be cast to their $(GLINK2 type, VectorBaseType).)
98102

@@ -142,7 +146,7 @@ else
142146
---
143147
float4 a,b;
144148
static if (__traits(compiles, a+b))
145-
... yes, it is supported ...
149+
... yes, add is supported for float4 ...
146150
else
147151
... nope, use workaround ...
148152
---
@@ -152,7 +156,8 @@ else
152156
$(LINK2 $(ROOT_DIR)phobos/core_cpuid.html, core.cpuid).
153157
)
154158

155-
$(P A typical workaround would be to use array vector operations instead:)
159+
$(P A typical workaround for unsupported vector operations would be to
160+
use array operations instead:)
156161

157162
---
158163
float4 a,b;
@@ -201,7 +206,7 @@ $(H2 $(LNAME2 x86_64_vec, X86 And X86$(UNDERSCORE)64 Vector Extension Implementa
201206
$(TROW double4, 4 $(D double)s, $(D double __attribute__((vector_size(32)))))
202207
)
203208

204-
$(P Note: for 32 bit gcc, it's $(D long long) instead of $(D long).)
209+
$(NOTE for 32 bit gcc and clang, it's $(D long long) instead of $(D long).)
205210

206211
$(TABLE2 Supported 128-bit Vector Operators,
207212
$(THEAD Operator,void16,byte16,ubyte16,short8,ushort8,int4,uint4,long2,ulong2,float4,double2)
@@ -220,6 +225,12 @@ $(H2 $(LNAME2 x86_64_vec, X86 And X86$(UNDERSCORE)64 Vector Extension Implementa
220225
$(TROW $(CODE_AMP)=,$(N),$(Y),$(Y),$(Y),$(Y),$(Y),$(Y),$(Y),$(Y),$(N),$(N))
221226
$(TROW |=,$(N),$(Y),$(Y),$(Y),$(Y),$(Y),$(Y),$(Y),$(Y),$(N),$(N))
222227
$(TROW $(D ^=),$(N),$(Y),$(Y),$(Y),$(Y),$(Y),$(Y),$(Y),$(Y),$(N),$(N))
228+
$(TROW ==,$(N),$(Y),$(Y),$(Y),$(Y),$(Y),$(Y),$(Y),$(Y),$(Y),$(Y))
229+
$(TROW !=,$(N),$(Y),$(Y),$(Y),$(Y),$(Y),$(Y),$(Y),$(Y),$(Y),$(Y))
230+
$(TROW <, $(N),$(Y),$(Y),$(Y),$(Y),$(Y),$(Y),$(Y),$(Y),$(Y),$(Y))
231+
$(TROW <=,$(N),$(Y),$(Y),$(Y),$(Y),$(Y),$(Y),$(Y),$(Y),$(Y),$(Y))
232+
$(TROW >=,$(N),$(Y),$(Y),$(Y),$(Y),$(Y),$(Y),$(Y),$(Y),$(Y),$(Y))
233+
$(TROW >, $(N),$(Y),$(Y),$(Y),$(Y),$(Y),$(Y),$(Y),$(Y),$(Y),$(Y))
223234
$(TROW $(I unary)$(D ~),$(N),$(Y),$(Y),$(Y),$(Y),$(Y),$(Y),$(Y),$(Y),$(N),$(N))
224235
$(TROW $(I unary)+,$(N),$(Y),$(Y),$(Y),$(Y),$(Y),$(Y),$(Y),$(Y),$(Y),$(Y))
225236
$(TROW $(I unary)-,$(N),$(Y),$(Y),$(Y),$(Y),$(Y),$(Y),$(Y),$(Y),$(Y),$(Y))
@@ -242,6 +253,12 @@ $(H2 $(LNAME2 x86_64_vec, X86 And X86$(UNDERSCORE)64 Vector Extension Implementa
242253
$(TROW $(CODE_AMP)=,$(N),$(Y),$(Y),$(Y),$(Y),$(Y),$(Y),$(Y),$(Y),$(N),$(N))
243254
$(TROW |=,$(N),$(Y),$(Y),$(Y),$(Y),$(Y),$(Y),$(Y),$(Y),$(N),$(N))
244255
$(TROW $(D ^=),$(N),$(Y),$(Y),$(Y),$(Y),$(Y),$(Y),$(Y),$(Y),$(N),$(N))
256+
$(TROW ==,$(N),$(Y),$(Y),$(Y),$(Y),$(Y),$(Y),$(Y),$(Y),$(Y),$(Y))
257+
$(TROW !=,$(N),$(Y),$(Y),$(Y),$(Y),$(Y),$(Y),$(Y),$(Y),$(Y),$(Y))
258+
$(TROW <, $(N),$(Y),$(Y),$(Y),$(Y),$(Y),$(Y),$(Y),$(Y),$(Y),$(Y))
259+
$(TROW <=,$(N),$(Y),$(Y),$(Y),$(Y),$(Y),$(Y),$(Y),$(Y),$(Y),$(Y))
260+
$(TROW >=,$(N),$(Y),$(Y),$(Y),$(Y),$(Y),$(Y),$(Y),$(Y),$(Y),$(Y))
261+
$(TROW >, $(N),$(Y),$(Y),$(Y),$(Y),$(Y),$(Y),$(Y),$(Y),$(Y),$(Y))
245262
$(TROW $(I unary)$(D ~),$(N),$(Y),$(Y),$(Y),$(Y),$(Y),$(Y),$(Y),$(Y),$(N),$(N))
246263
$(TROW $(I unary)+,$(N),$(Y),$(Y),$(Y),$(Y),$(Y),$(Y),$(Y),$(Y),$(Y),$(Y))
247264
$(TROW $(I unary)-,$(N),$(Y),$(Y),$(Y),$(Y),$(Y),$(Y),$(Y),$(Y),$(Y),$(Y))

0 commit comments

Comments
 (0)