forked from microsoft/DirectXShaderCompiler
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathLongVectorTestData.h
More file actions
684 lines (600 loc) · 26.7 KB
/
LongVectorTestData.h
File metadata and controls
684 lines (600 loc) · 26.7 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
#ifndef LONGVECTORTESTDATA_H
#define LONGVECTORTESTDATA_H
#include <Verify.h>
#include <limits>
#include <map>
#include <ostream>
#include <string>
#include <vector>
#include <DirectXMath.h>
#include <DirectXPackedVector.h>
#include "dxc/Support/Global.h"
namespace LongVector {
// A helper struct because C++ bools are 1 byte and HLSL bools are 4 bytes.
// Take int32_t as a constuctor argument and convert it to bool when needed.
// Comparisons cast to a bool because we only care if the bool representation is
// true or false.
struct HLSLBool_t {
HLSLBool_t() : Val(0) {}
HLSLBool_t(int32_t Val) : Val(Val) {}
HLSLBool_t(bool Val) : Val(Val) {}
bool operator==(const HLSLBool_t &Other) const {
return static_cast<bool>(Val) == static_cast<bool>(Other.Val);
}
bool operator!=(const HLSLBool_t &Other) const {
return static_cast<bool>(Val) != static_cast<bool>(Other.Val);
}
bool operator<(const HLSLBool_t &Other) const { return Val < Other.Val; }
bool operator>(const HLSLBool_t &Other) const { return Val > Other.Val; }
bool operator<=(const HLSLBool_t &Other) const { return Val <= Other.Val; }
bool operator>=(const HLSLBool_t &Other) const { return Val >= Other.Val; }
HLSLBool_t operator*(const HLSLBool_t &Other) const {
return HLSLBool_t(Val * Other.Val);
}
HLSLBool_t operator+(const HLSLBool_t &Other) const {
return HLSLBool_t(Val + Other.Val);
}
HLSLBool_t operator-(const HLSLBool_t &Other) const {
return HLSLBool_t(Val - Other.Val);
}
HLSLBool_t operator/(const HLSLBool_t &Other) const {
return HLSLBool_t(Val / Other.Val);
}
HLSLBool_t operator%(const HLSLBool_t &Other) const {
return HLSLBool_t(Val % Other.Val);
}
HLSLBool_t operator&&(const HLSLBool_t &Other) const {
return HLSLBool_t(Val && Other.Val);
}
HLSLBool_t operator||(const HLSLBool_t &Other) const {
return HLSLBool_t(Val || Other.Val);
}
bool AsBool() const { return static_cast<bool>(Val); }
operator bool() const { return AsBool(); }
operator int16_t() const { return (int16_t)(AsBool()); }
operator int32_t() const { return (int32_t)(AsBool()); }
operator int64_t() const { return (int64_t)(AsBool()); }
operator uint16_t() const { return (uint16_t)(AsBool()); }
operator uint32_t() const { return (uint32_t)(AsBool()); }
operator uint64_t() const { return (uint64_t)(AsBool()); }
operator float() const { return (float)(AsBool()); }
operator double() const { return (double)(AsBool()); }
// So we can construct std::wstrings using std::wostream
friend std::wostream &operator<<(std::wostream &Os, const HLSLBool_t &Obj) {
Os << static_cast<bool>(Obj.Val);
return Os;
}
// So we can construct std::strings using std::ostream
friend std::ostream &operator<<(std::ostream &Os, const HLSLBool_t &Obj) {
Os << static_cast<bool>(Obj.Val);
return Os;
}
int32_t Val = 0;
};
// No native float16 type in C++ until C++23 . So we use uint16_t to represent
// it. Simple little wrapping struct to help handle the right behavior.
struct HLSLHalf_t {
HLSLHalf_t() : Val(0) {}
HLSLHalf_t(const float F) {
Val = DirectX::PackedVector::XMConvertFloatToHalf(F);
}
HLSLHalf_t(const double D) {
float F;
if (D >= std::numeric_limits<double>::max())
F = std::numeric_limits<float>::max();
else if (D <= std::numeric_limits<double>::lowest())
F = std::numeric_limits<float>::lowest();
else
F = static_cast<float>(D);
Val = DirectX::PackedVector::XMConvertFloatToHalf(F);
}
HLSLHalf_t(const uint32_t U) {
float F = static_cast<float>(U);
Val = DirectX::PackedVector::XMConvertFloatToHalf(F);
}
// PackedVector::HALF is a uint16. Make sure we don't ever accidentally
// convert one of these to a HLSLHalf_t by arithmetically converting it to a
// float.
HLSLHalf_t(DirectX::PackedVector::HALF) = delete;
static double GetULP(HLSLHalf_t A) {
DXASSERT(!std::isnan(A) && !std::isinf(A),
"ULP of NaN or infinity is undefined");
HLSLHalf_t Next = A;
++Next.Val;
double NextD = Next;
double AD = A;
return NextD - AD;
}
static HLSLHalf_t FromHALF(DirectX::PackedVector::HALF Half) {
HLSLHalf_t H;
H.Val = Half;
return H;
}
// Implicit conversion to float for use with things like std::acos, std::tan,
// etc
operator float() const {
return DirectX::PackedVector::XMConvertHalfToFloat(Val);
}
bool operator==(const HLSLHalf_t &Other) const {
// Convert to floats to properly handle the '0 == -0' case which must
// compare to true but have different uint16_t values.
// That is, 0 == -0 is true. We store Val as a uint16_t.
const float A = DirectX::PackedVector::XMConvertHalfToFloat(Val);
const float B = DirectX::PackedVector::XMConvertHalfToFloat(Other.Val);
return A == B;
}
bool operator<(const HLSLHalf_t &Other) const {
return DirectX::PackedVector::XMConvertHalfToFloat(Val) <
DirectX::PackedVector::XMConvertHalfToFloat(Other.Val);
}
bool operator>(const HLSLHalf_t &Other) const {
return DirectX::PackedVector::XMConvertHalfToFloat(Val) >
DirectX::PackedVector::XMConvertHalfToFloat(Other.Val);
}
// Used by tolerance checks in the tests.
bool operator>(float F) const {
const float A = DirectX::PackedVector::XMConvertHalfToFloat(Val);
return A > F;
}
bool operator<(float F) const {
const float A = DirectX::PackedVector::XMConvertHalfToFloat(Val);
return A < F;
}
bool operator<=(const HLSLHalf_t &Other) const {
return DirectX::PackedVector::XMConvertHalfToFloat(Val) <=
DirectX::PackedVector::XMConvertHalfToFloat(Other.Val);
}
bool operator>=(const HLSLHalf_t &Other) const {
return DirectX::PackedVector::XMConvertHalfToFloat(Val) >=
DirectX::PackedVector::XMConvertHalfToFloat(Other.Val);
}
bool operator!=(const HLSLHalf_t &Other) const { return Val != Other.Val; }
HLSLHalf_t operator*(const HLSLHalf_t &Other) const {
const float A = DirectX::PackedVector::XMConvertHalfToFloat(Val);
const float B = DirectX::PackedVector::XMConvertHalfToFloat(Other.Val);
return FromHALF(DirectX::PackedVector::XMConvertFloatToHalf(A * B));
}
HLSLHalf_t operator+(const HLSLHalf_t &Other) const {
const float A = DirectX::PackedVector::XMConvertHalfToFloat(Val);
const float B = DirectX::PackedVector::XMConvertHalfToFloat(Other.Val);
return FromHALF((DirectX::PackedVector::XMConvertFloatToHalf(A + B)));
}
HLSLHalf_t operator-(const HLSLHalf_t &Other) const {
const float A = DirectX::PackedVector::XMConvertHalfToFloat(Val);
const float B = DirectX::PackedVector::XMConvertHalfToFloat(Other.Val);
return FromHALF(DirectX::PackedVector::XMConvertFloatToHalf(A - B));
}
HLSLHalf_t operator/(const HLSLHalf_t &Other) const {
const float A = DirectX::PackedVector::XMConvertHalfToFloat(Val);
const float B = DirectX::PackedVector::XMConvertHalfToFloat(Other.Val);
return FromHALF(DirectX::PackedVector::XMConvertFloatToHalf(A / B));
}
HLSLHalf_t operator%(const HLSLHalf_t &Other) const {
const float A = DirectX::PackedVector::XMConvertHalfToFloat(Val);
const float B = DirectX::PackedVector::XMConvertHalfToFloat(Other.Val);
const float C = std::fmod(A, B);
return FromHALF(DirectX::PackedVector::XMConvertFloatToHalf(C));
}
// So we can construct std::wstrings using std::wostream
friend std::wostream &operator<<(std::wostream &Os, const HLSLHalf_t &Obj) {
Os << DirectX::PackedVector::XMConvertHalfToFloat(Obj.Val);
return Os;
}
// So we can construct std::wstrings using std::wostream
friend std::ostream &operator<<(std::ostream &Os, const HLSLHalf_t &Obj) {
Os << DirectX::PackedVector::XMConvertHalfToFloat(Obj.Val);
return Os;
}
// HALF is an alias to uint16_t
DirectX::PackedVector::HALF Val = 0;
};
// Min precision wrapper types. Without -enable-16bit-types, min precision types
// are 32-bit in DXIL storage. These thin wrappers provide distinct C++ types
// that map to different HLSL type strings via DATA_TYPE.
struct HLSLMin16Float_t {
constexpr HLSLMin16Float_t() : Val(0.0f) {}
constexpr HLSLMin16Float_t(float F) : Val(F) {}
constexpr HLSLMin16Float_t(double D) : Val(static_cast<float>(D)) {}
explicit constexpr HLSLMin16Float_t(int I) : Val(static_cast<float>(I)) {}
explicit constexpr HLSLMin16Float_t(uint32_t U)
: Val(static_cast<float>(U)) {}
constexpr operator float() const { return Val; }
bool operator==(const HLSLMin16Float_t &O) const { return Val == O.Val; }
bool operator!=(const HLSLMin16Float_t &O) const { return Val != O.Val; }
bool operator<(const HLSLMin16Float_t &O) const { return Val < O.Val; }
bool operator>(const HLSLMin16Float_t &O) const { return Val > O.Val; }
bool operator<=(const HLSLMin16Float_t &O) const { return Val <= O.Val; }
bool operator>=(const HLSLMin16Float_t &O) const { return Val >= O.Val; }
HLSLMin16Float_t operator+(const HLSLMin16Float_t &O) const {
return HLSLMin16Float_t(Val + O.Val);
}
HLSLMin16Float_t operator-(const HLSLMin16Float_t &O) const {
return HLSLMin16Float_t(Val - O.Val);
}
HLSLMin16Float_t operator*(const HLSLMin16Float_t &O) const {
return HLSLMin16Float_t(Val * O.Val);
}
HLSLMin16Float_t operator/(const HLSLMin16Float_t &O) const {
return HLSLMin16Float_t(Val / O.Val);
}
HLSLMin16Float_t operator%(const HLSLMin16Float_t &O) const {
return HLSLMin16Float_t(std::fmod(Val, O.Val));
}
friend std::wostream &operator<<(std::wostream &Os,
const HLSLMin16Float_t &Obj) {
Os << Obj.Val;
return Os;
}
friend std::ostream &operator<<(std::ostream &Os,
const HLSLMin16Float_t &Obj) {
Os << Obj.Val;
return Os;
}
float Val;
};
struct HLSLMin16Int_t {
constexpr HLSLMin16Int_t() : Val(0) {}
constexpr HLSLMin16Int_t(int32_t I) : Val(I) {}
constexpr HLSLMin16Int_t(int64_t I) : Val(static_cast<int32_t>(I)) {}
constexpr HLSLMin16Int_t(uint32_t U) : Val(static_cast<int32_t>(U)) {}
constexpr HLSLMin16Int_t(uint64_t U) : Val(static_cast<int32_t>(U)) {}
constexpr HLSLMin16Int_t(float F) : Val(static_cast<int32_t>(F)) {}
constexpr HLSLMin16Int_t(double D) : Val(static_cast<int32_t>(D)) {}
constexpr operator int32_t() const { return Val; }
bool operator==(const HLSLMin16Int_t &O) const { return Val == O.Val; }
bool operator!=(const HLSLMin16Int_t &O) const { return Val != O.Val; }
bool operator<(const HLSLMin16Int_t &O) const { return Val < O.Val; }
bool operator>(const HLSLMin16Int_t &O) const { return Val > O.Val; }
bool operator<=(const HLSLMin16Int_t &O) const { return Val <= O.Val; }
bool operator>=(const HLSLMin16Int_t &O) const { return Val >= O.Val; }
HLSLMin16Int_t operator+(const HLSLMin16Int_t &O) const {
return HLSLMin16Int_t(Val + O.Val);
}
HLSLMin16Int_t operator-(const HLSLMin16Int_t &O) const {
return HLSLMin16Int_t(Val - O.Val);
}
HLSLMin16Int_t operator*(const HLSLMin16Int_t &O) const {
return HLSLMin16Int_t(Val * O.Val);
}
HLSLMin16Int_t operator/(const HLSLMin16Int_t &O) const {
return HLSLMin16Int_t(Val / O.Val);
}
HLSLMin16Int_t operator%(const HLSLMin16Int_t &O) const {
return HLSLMin16Int_t(Val % O.Val);
}
HLSLMin16Int_t operator&(const HLSLMin16Int_t &O) const {
return HLSLMin16Int_t(Val & O.Val);
}
HLSLMin16Int_t operator|(const HLSLMin16Int_t &O) const {
return HLSLMin16Int_t(Val | O.Val);
}
HLSLMin16Int_t operator^(const HLSLMin16Int_t &O) const {
return HLSLMin16Int_t(Val ^ O.Val);
}
HLSLMin16Int_t operator<<(const HLSLMin16Int_t &O) const {
return HLSLMin16Int_t(Val << O.Val);
}
HLSLMin16Int_t operator>>(const HLSLMin16Int_t &O) const {
return HLSLMin16Int_t(Val >> O.Val);
}
HLSLMin16Int_t operator&&(const HLSLMin16Int_t &O) const {
return HLSLMin16Int_t(Val && O.Val);
}
HLSLMin16Int_t operator||(const HLSLMin16Int_t &O) const {
return HLSLMin16Int_t(Val || O.Val);
}
friend std::wostream &operator<<(std::wostream &Os,
const HLSLMin16Int_t &Obj) {
Os << Obj.Val;
return Os;
}
friend std::ostream &operator<<(std::ostream &Os, const HLSLMin16Int_t &Obj) {
Os << Obj.Val;
return Os;
}
int32_t Val;
};
struct HLSLMin16Uint_t {
constexpr HLSLMin16Uint_t() : Val(0) {}
constexpr HLSLMin16Uint_t(uint32_t U) : Val(U) {}
constexpr HLSLMin16Uint_t(uint64_t U) : Val(static_cast<uint32_t>(U)) {}
constexpr HLSLMin16Uint_t(int32_t I) : Val(static_cast<uint32_t>(I)) {}
constexpr HLSLMin16Uint_t(float F) : Val(static_cast<uint32_t>(F)) {}
constexpr HLSLMin16Uint_t(double D) : Val(static_cast<uint32_t>(D)) {}
constexpr operator uint32_t() const { return Val; }
bool operator==(const HLSLMin16Uint_t &O) const { return Val == O.Val; }
bool operator!=(const HLSLMin16Uint_t &O) const { return Val != O.Val; }
bool operator<(const HLSLMin16Uint_t &O) const { return Val < O.Val; }
bool operator>(const HLSLMin16Uint_t &O) const { return Val > O.Val; }
bool operator<=(const HLSLMin16Uint_t &O) const { return Val <= O.Val; }
bool operator>=(const HLSLMin16Uint_t &O) const { return Val >= O.Val; }
HLSLMin16Uint_t operator+(const HLSLMin16Uint_t &O) const {
return HLSLMin16Uint_t(Val + O.Val);
}
HLSLMin16Uint_t operator-(const HLSLMin16Uint_t &O) const {
return HLSLMin16Uint_t(Val - O.Val);
}
HLSLMin16Uint_t operator*(const HLSLMin16Uint_t &O) const {
return HLSLMin16Uint_t(Val * O.Val);
}
HLSLMin16Uint_t operator/(const HLSLMin16Uint_t &O) const {
return HLSLMin16Uint_t(Val / O.Val);
}
HLSLMin16Uint_t operator%(const HLSLMin16Uint_t &O) const {
return HLSLMin16Uint_t(Val % O.Val);
}
HLSLMin16Uint_t operator&(const HLSLMin16Uint_t &O) const {
return HLSLMin16Uint_t(Val & O.Val);
}
HLSLMin16Uint_t operator|(const HLSLMin16Uint_t &O) const {
return HLSLMin16Uint_t(Val | O.Val);
}
HLSLMin16Uint_t operator^(const HLSLMin16Uint_t &O) const {
return HLSLMin16Uint_t(Val ^ O.Val);
}
HLSLMin16Uint_t operator<<(const HLSLMin16Uint_t &O) const {
return HLSLMin16Uint_t(Val << O.Val);
}
HLSLMin16Uint_t operator>>(const HLSLMin16Uint_t &O) const {
return HLSLMin16Uint_t(Val >> O.Val);
}
bool operator&&(const HLSLMin16Uint_t &O) const { return Val && O.Val; }
bool operator||(const HLSLMin16Uint_t &O) const { return Val || O.Val; }
friend std::wostream &operator<<(std::wostream &Os,
const HLSLMin16Uint_t &Obj) {
Os << Obj.Val;
return Os;
}
friend std::ostream &operator<<(std::ostream &Os,
const HLSLMin16Uint_t &Obj) {
Os << Obj.Val;
return Os;
}
uint32_t Val;
};
enum class InputSet {
#define INPUT_SET(SYMBOL) SYMBOL,
#include "LongVectorOps.def"
};
template <typename T> const std::vector<T> &getInputSet(InputSet InputSet) {
static_assert(false, "No InputSet for this type");
}
#define BEGIN_INPUT_SETS(TYPE) \
template <> const std::vector<TYPE> &getInputSet<TYPE>(InputSet InputSet) { \
using T = TYPE; \
switch (InputSet) {
#define INPUT_SET(SET, ...) \
case SET: { \
static std::vector<T> Data = {__VA_ARGS__}; \
return Data; \
}
#define END_INPUT_SETS() \
default: \
break; \
} \
VERIFY_FAIL("Missing input set"); \
std::abort(); \
}
BEGIN_INPUT_SETS(HLSLBool_t)
INPUT_SET(InputSet::Default1, false, true, false, false, false, false, true,
true, true, true);
INPUT_SET(InputSet::Default2, true, false, false, false, false, true, true,
true, false, false);
INPUT_SET(InputSet::Default3, true, false, true, false, true, true, true, true,
false, true);
INPUT_SET(InputSet::Zero, false);
INPUT_SET(InputSet::NoZero, true);
INPUT_SET(InputSet::SelectCond, false, true);
END_INPUT_SETS()
BEGIN_INPUT_SETS(int16_t)
INPUT_SET(InputSet::Default1, -6, 1, 7, 3, 8, 4, -3, 8, 8, -2);
INPUT_SET(InputSet::Default2, 5, -6, -3, -2, 9, 3, 1, -3, -7, 2);
INPUT_SET(InputSet::Default3, -5, 6, 3, 2, -9, -3, -1, 3, 7, -2);
INPUT_SET(InputSet::BitShiftRhs, 1, 6, 3, 0, 9, 3, 12, 13, 14, 15);
INPUT_SET(InputSet::Zero, 0);
INPUT_SET(InputSet::NoZero, 1);
INPUT_SET(InputSet::Bitwise, std::numeric_limits<int16_t>::min(), -1, 0, 1, 3,
6, 9, 0x5555, static_cast<int16_t>(0xAAAA),
std::numeric_limits<int16_t>::max());
INPUT_SET(InputSet::SelectCond, 0, 1);
INPUT_SET(InputSet::AllOnes, 1);
INPUT_SET(InputSet::WaveMultiPrefixBitwise, 0x0, 0x1, 0x3, 0x4, 0x10, 0x12, 0xF,
-1);
END_INPUT_SETS()
BEGIN_INPUT_SETS(int32_t)
INPUT_SET(InputSet::Default1, -6, 1, 7, 3, 8, 4, -3, 8, 8, -2);
INPUT_SET(InputSet::Default2, 5, -6, -3, -2, 9, 3, 1, -3, -7, 2);
INPUT_SET(InputSet::Default3, -5, 6, 3, 2, -9, -3, -1, 3, 7, -2);
INPUT_SET(InputSet::BitShiftRhs, 1, 6, 3, 0, 9, 3, 30, 31, 32);
INPUT_SET(InputSet::Zero, 0);
INPUT_SET(InputSet::NoZero, 1);
INPUT_SET(InputSet::Bitwise, std::numeric_limits<int32_t>::min(), -1, 0, 1, 3,
6, 9, 0x55555555, static_cast<int32_t>(0xAAAAAAAA),
std::numeric_limits<int32_t>::max());
INPUT_SET(InputSet::SelectCond, 0, 1);
INPUT_SET(InputSet::AllOnes, 1);
INPUT_SET(InputSet::WaveMultiPrefixBitwise, 0x0, 0x1, 0x3, 0x4, 0x10, 0x12, 0xF,
-1);
END_INPUT_SETS()
BEGIN_INPUT_SETS(int64_t)
INPUT_SET(InputSet::Default1, -6, 11, 7, 3, 8, 4, -3, 8, 8, -2);
INPUT_SET(InputSet::Default2, 5, -1337, -3, -2, 9, 3, 1, -3, 501, 2);
INPUT_SET(InputSet::Default3, -5, 1337, 3, 2, -9, -3, -1, 3, -501, -2);
INPUT_SET(InputSet::BitShiftRhs, 1, 6, 3, 0, 9, 3, 62, 63, 64);
INPUT_SET(InputSet::Zero, 0);
INPUT_SET(InputSet::NoZero, 1);
INPUT_SET(InputSet::Bitwise, std::numeric_limits<int64_t>::min(), -1, 0, 1, 3,
6, 9, 0x5555555555555555LL, 0xAAAAAAAAAAAAAAAALL,
std::numeric_limits<int64_t>::max());
INPUT_SET(InputSet::SelectCond, 0, 1);
INPUT_SET(InputSet::AllOnes, 1);
INPUT_SET(InputSet::WaveMultiPrefixBitwise, 0x0, 0x1, 0x3, 0x4, 0x10, 0x12, 0xF,
-1ll);
END_INPUT_SETS()
BEGIN_INPUT_SETS(uint16_t)
INPUT_SET(InputSet::Default1, 1, 699, 3, 1023, 5, 6, 0, 8, 9, 10);
INPUT_SET(InputSet::Default2, 2, 111, 3, 4, 5, 9, 21, 8, 9, 10);
INPUT_SET(InputSet::Default3, 4, 112, 4, 5, 3, 7, 21, 1, 11, 9);
INPUT_SET(InputSet::Zero, 0);
INPUT_SET(InputSet::BitShiftRhs, 1, 6, 3, 0, 9, 3, 12, 13, 14, 15);
INPUT_SET(InputSet::Bitwise, 0, 1, 3, 6, 9, 0x5555, 0xAAAA, 0x8000, 127,
std::numeric_limits<uint16_t>::max());
INPUT_SET(InputSet::SelectCond, 0, 1);
INPUT_SET(InputSet::AllOnes, 1);
INPUT_SET(InputSet::WaveMultiPrefixBitwise, 0x0, 0x1, 0x3, 0x4, 0x10, 0x12, 0xF,
std::numeric_limits<uint16_t>::max());
END_INPUT_SETS()
BEGIN_INPUT_SETS(uint32_t)
INPUT_SET(InputSet::Default1, 1, 2, 3, 4, 5, 0, 7, 8, 9, 10);
INPUT_SET(InputSet::Default2, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10);
INPUT_SET(InputSet::Default3, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1);
INPUT_SET(InputSet::Zero, 0);
INPUT_SET(InputSet::BitShiftRhs, 1, 6, 3, 0, 9, 3, 30, 31, 32);
INPUT_SET(InputSet::Bitwise, 0, 1, 3, 6, 9, 0x55555555, 0xAAAAAAAA, 0x80000000,
127, std::numeric_limits<uint32_t>::max());
INPUT_SET(InputSet::SelectCond, 0, 1);
INPUT_SET(InputSet::AllOnes, 1);
INPUT_SET(InputSet::WaveMultiPrefixBitwise, 0x0, 0x1, 0x3, 0x4, 0xA, 0xC, 0xF,
std::numeric_limits<uint32_t>::max());
END_INPUT_SETS()
BEGIN_INPUT_SETS(uint64_t)
INPUT_SET(InputSet::Default1, 1, 2, 3, 4, 5, 0, 7, 1000, 9, 10);
INPUT_SET(InputSet::Default2, 1, 2, 1337, 4, 5, 6, 7, 8, 9, 10);
INPUT_SET(InputSet::Default3, 10, 20, 1338, 40, 50, 60, 70, 80, 90, 11);
INPUT_SET(InputSet::Zero, 0);
INPUT_SET(InputSet::BitShiftRhs, 1, 6, 3, 0, 9, 3, 62, 63, 64);
INPUT_SET(InputSet::Bitwise, 0, 1, 3, 6, 9, 0x5555555555555555,
0xAAAAAAAAAAAAAAAA, 0x8000000000000000, 127,
std::numeric_limits<uint64_t>::max());
INPUT_SET(InputSet::SelectCond, 0, 1);
INPUT_SET(InputSet::AllOnes, 1);
INPUT_SET(InputSet::WaveMultiPrefixBitwise, 0x0, 0x1, 0x3, 0x4, 0xA, 0xC, 0xF,
std::numeric_limits<uint64_t>::max());
END_INPUT_SETS()
BEGIN_INPUT_SETS(HLSLHalf_t)
INPUT_SET(InputSet::Default1, -1.0, -1.0, 1.0, -0.01, 1.0, -0.01, 1.0, -0.01,
1.0, -0.01);
INPUT_SET(InputSet::Default2, 1.0, -1.0, 1.0, -1.0, 1.0, -1.0, 1.0, -1.0, 1.0,
-1.0);
INPUT_SET(InputSet::Default3, -1.0, 1.0, -1.0, 1.0, -1.0, 1.0, -1.0, 1.0, -1.0,
1.0);
INPUT_SET(InputSet::Zero, 0.0);
INPUT_SET(InputSet::RangeHalfPi, -1.073, 0.044, -1.047, 0.313, 1.447, -0.865,
1.364, -0.715, -0.800, 0.541);
INPUT_SET(InputSet::RangeOne, 0.331, 0.727, -0.957, 0.677, -0.025, 0.495, 0.855,
-0.673, -0.678, -0.905);
INPUT_SET(InputSet::Positive, 1.0, 1.0, 342.0, 0.01, 5531.0, 0.01, 1.0, 0.01,
331.2330, 3250.01);
INPUT_SET(InputSet::SelectCond, 0.0, 1.0);
// HLSLHalf_t has a constructor which accepts a float and converts it to half
// precision by clamping to the representable range via
// DirectX::PackedVector::XMConvertFloatToHalf.
INPUT_SET(InputSet::FloatSpecial, std::numeric_limits<float>::infinity(),
-std::numeric_limits<float>::infinity(),
std::numeric_limits<float>::signaling_NaN(),
-std::numeric_limits<float>::signaling_NaN(),
std::numeric_limits<float>::quiet_NaN(),
-std::numeric_limits<float>::quiet_NaN(), 0.0, -0.0,
std::numeric_limits<float>::min(), std::numeric_limits<float>::max(),
-std::numeric_limits<float>::min(),
-std::numeric_limits<float>::max(),
std::numeric_limits<float>::denorm_min(),
std::numeric_limits<float>::denorm_min() * 10.0, 1.0 / 3.0);
INPUT_SET(InputSet::AllOnes, 1.0);
END_INPUT_SETS()
BEGIN_INPUT_SETS(float)
INPUT_SET(InputSet::Default1, 1.0, -1.0, 1.0, -1.0, 1.0, -1.0, 1.0, -1.0, 1.0,
-1.0);
INPUT_SET(InputSet::Default2, 1.0, -1.0, 1.0, -1.0, 1.0, -1.0, 1.0, -1.0, 1.0,
-1.0);
INPUT_SET(InputSet::Default3, -1.0, 1.0, -1.0, 1.0, -1.0, 1.0, -1.0, 1.0, -1.0,
1.0);
INPUT_SET(InputSet::Zero, 0.0);
INPUT_SET(InputSet::RangeHalfPi, 0.315f, -0.316f, 1.409f, -0.09f, -1.569f,
1.302f, -0.326f, 0.781f, -1.235f, 0.623f);
INPUT_SET(InputSet::RangeOne, 0.727f, 0.331f, -0.957f, 0.677f, -0.025f, 0.495f,
0.855f, -0.673f, -0.678f, -0.905f);
INPUT_SET(InputSet::Positive, 1.0f, 1.0f, 65535.0f, 0.01f, 5531.0f, 0.01f, 1.0f,
0.01f, 331.2330f, 3250.01f);
INPUT_SET(InputSet::SelectCond, 0.0f, 1.0f);
INPUT_SET(InputSet::FloatSpecial, std::numeric_limits<float>::infinity(),
-std::numeric_limits<float>::infinity(),
std::numeric_limits<float>::signaling_NaN(),
-std::numeric_limits<float>::signaling_NaN(),
std::numeric_limits<float>::quiet_NaN(),
-std::numeric_limits<float>::quiet_NaN(), 0.0f, -0.0f,
std::numeric_limits<float>::min(), std::numeric_limits<float>::max(),
-std::numeric_limits<float>::min(),
-std::numeric_limits<float>::max(),
std::numeric_limits<float>::denorm_min(),
std::numeric_limits<float>::denorm_min() * 10.0f, 1.0f / 3.0f);
INPUT_SET(InputSet::AllOnes, 1.0f);
END_INPUT_SETS()
BEGIN_INPUT_SETS(double)
INPUT_SET(InputSet::Default1, 1.0, -1.0, 1.0, -1.0, 1.0, -1.0, 1.0, -1.0, 1.0,
-1.0);
INPUT_SET(InputSet::Default2, 1.0, -1.0, 1.0, -1.0, 1.0, -1.0, 1.0, -1.0, 1.0,
-1.0);
INPUT_SET(InputSet::Default3, -1.0, 1.0, -1.0, 1.0, -1.0, 1.0, -1.0, 1.0, -1.0,
1.0);
INPUT_SET(InputSet::Zero, 0.0);
INPUT_SET(InputSet::RangeHalfPi, 0.807, 0.605, 1.317, 0.188, 1.566, -1.507,
0.67, -1.553, 0.194, -0.883);
INPUT_SET(InputSet::RangeOne, 0.331, 0.277, -0.957, 0.677, -0.025, 0.495, 0.855,
-0.673, -0.678, -0.905);
INPUT_SET(InputSet::SplitDouble, 0.0, -1.0, 1.0, -1.0, 12345678.87654321, -1.0,
1.0, -1.0, 1.0, -1.0);
INPUT_SET(InputSet::Positive, 1.0, 1.0, 65535.0, 0.01, 5531.0, 0.01, 1.0, 0.01,
331.2330, 3250.01);
INPUT_SET(InputSet::SelectCond, 0.0, 1.0);
INPUT_SET(InputSet::AllOnes, 1.0);
END_INPUT_SETS()
// Min precision input sets. All values are exactly representable in float16
// to avoid precision mismatch between CPU-side expected values and GPU-side
// min precision computation. No FP specials (INF/NaN/denorm) as min precision
// types do not support them.
BEGIN_INPUT_SETS(HLSLMin16Float_t)
INPUT_SET(InputSet::Default1, -1.0f, -1.0f, 1.0f, -0.03125f, 1.0f, -0.03125f,
1.0f, -0.03125f, 1.0f, -0.03125f);
INPUT_SET(InputSet::Default2, 1.0f, -1.0f, 1.0f, -1.0f, 1.0f, -1.0f, 1.0f,
-1.0f, 1.0f, -1.0f);
INPUT_SET(InputSet::Default3, -1.0f, 1.0f, -1.0f, 1.0f, -1.0f, 1.0f, -1.0f,
1.0f, -1.0f, 1.0f);
INPUT_SET(InputSet::Zero, 0.0f);
INPUT_SET(InputSet::RangeHalfPi, -1.0625f, 0.046875f, -1.046875f, 0.3125f,
1.4375f, -0.875f, 1.375f, -0.71875f, -0.8125f, 0.5625f);
INPUT_SET(InputSet::RangeOne, 0.328125f, 0.71875f, -0.953125f, 0.671875f,
-0.03125f, 0.5f, 0.84375f, -0.671875f, -0.6875f, -0.90625f);
INPUT_SET(InputSet::Positive, 1.0f, 1.0f, 342.0f, 0.03125f, 5504.0f, 0.03125f,
1.0f, 0.03125f, 331.25f, 3250.0f);
INPUT_SET(InputSet::SelectCond, 0.0f, 1.0f);
INPUT_SET(InputSet::AllOnes, 1.0f);
END_INPUT_SETS()
// Values constrained to int16 range. Kept small to avoid overflow ambiguity.
// Shift amounts limited so results fit in int16 (-32768..32767).
BEGIN_INPUT_SETS(HLSLMin16Int_t)
INPUT_SET(InputSet::Default1, -6, 1, 7, 3, 8, 4, -3, 8, 8, -2);
INPUT_SET(InputSet::Default2, 5, -6, -3, -2, 9, 3, 1, -3, -7, 2);
INPUT_SET(InputSet::Default3, -5, 6, 3, 2, -9, -3, -1, 3, 7, -2);
INPUT_SET(InputSet::BitShiftRhs, 1, 6, 3, 0, 9, 3, 12, 11, 11, 14);
INPUT_SET(InputSet::Zero, 0);
INPUT_SET(InputSet::NoZero, 1);
INPUT_SET(InputSet::SelectCond, 0, 1);
INPUT_SET(InputSet::AllOnes, 1);
END_INPUT_SETS()
// Values constrained to uint16 range. Kept small so that multiply, mad,
// subtract, shift, and wave prefix products do not overflow 16 bits.
BEGIN_INPUT_SETS(HLSLMin16Uint_t)
INPUT_SET(InputSet::Default1, 3, 199, 3, 200, 5, 10, 22, 8, 9, 10);
INPUT_SET(InputSet::Default2, 2, 111, 3, 4, 5, 9, 21, 8, 9, 10);
INPUT_SET(InputSet::Default3, 4, 112, 4, 5, 3, 7, 21, 1, 11, 9);
INPUT_SET(InputSet::Zero, 0);
INPUT_SET(InputSet::BitShiftRhs, 1, 6, 3, 0, 9, 3, 11, 12, 12, 12);
INPUT_SET(InputSet::SelectCond, 0, 1);
INPUT_SET(InputSet::AllOnes, 1);
END_INPUT_SETS()
#undef BEGIN_INPUT_SETS
#undef INPUT_SET
#undef END_INPUT_SETS
}; // namespace LongVector
#endif // LONGVECTORTESTDATA_H