-
Notifications
You must be signed in to change notification settings - Fork 16
/
UMESimdInterface.h
3534 lines (3003 loc) · 155 KB
/
UMESimdInterface.h
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
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
// The MIT License (MIT)
//
// Copyright (c) 2015-2017 CERN
//
// Author: Przemyslaw Karpinski
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.
//
//
// This piece of code was developed as part of ICE-DIP project at CERN.
// "ICE-DIP is a European Industrial Doctorate project funded by the European Community's
// 7th Framework programme Marie Curie Actions under grant PITN-GA-2012-316596".
//
#ifndef UME_SIMD_INTERFACE_H_
#define UME_SIMD_INTERFACE_H_
#include <cmath>
#include <limits>
#include "UMEBasicTypes.h"
#include "UMESimdScalarEmulation.h"
#include "UMESimdVectorEmulation.h"
namespace UME
{
namespace SIMD
{
// **********************************************************************
// *
// * Declaration of IndexVectorInterface class
// *
// **********************************************************************
//// Checks if N is power of 2
//template<unsigned int N>
//struct isPow2
//{
// enum {
// value = N && !(N & (N -1))
// };
//};
//// Calculates number of bits required to represent element of swizzle mask.
//template<unsigned int N, unsigned int P=0>
//struct SwizzleMaskBitsPerElement
//{
// //static const unsigned int value = LogBase2<N/2, P+1>.value;
// enum {
// value = SwizzleMaskBitsPerElement<N/2 + !(isPow2<N>::value), P+1>::value
// };
//};
//// Partial specialization for base case
//template<unsigned P>
//struct SwizzleMaskBitsPerElement<0, P>
//{
// enum {
// value = P
// };
//};
//template<unsigned P>
//struct SwizzleMaskBitsPerElement<1, P>
//{
// enum {
// value = P
// };
//};
template<class DERIVED_SWIZZLE_TYPE, uint32_t SMASK_LEN>
class SIMDSwizzleMaskBaseInterface
{
// Declarations only. These operators should be overriden in derived types.
// EXTRACT
UME_FUNC_ATTRIB bool extract(uint32_t index);
// EXTRACT
UME_FUNC_ATTRIB bool operator[] (uint32_t index);
// INSERT
UME_FUNC_ATTRIB void insert(uint32_t index, uint32_t value);
protected:
~SIMDSwizzleMaskBaseInterface() {};
public:
// LENGTH
constexpr static uint32_t length () { return SMASK_LEN; };
// LOAD
UME_FUNC_ATTRIB DERIVED_SWIZZLE_TYPE & load(uint32_t const * addr) {
return SCALAR_EMULATION::load<DERIVED_SWIZZLE_TYPE, uint32_t>(static_cast<DERIVED_SWIZZLE_TYPE &>(*this), addr);
}
UME_FUNC_ATTRIB DERIVED_SWIZZLE_TYPE & load(uint64_t const * addr) {
return SCALAR_EMULATION::load<DERIVED_SWIZZLE_TYPE, uint64_t>(static_cast<DERIVED_SWIZZLE_TYPE &>(*this), addr);
}
// ALIGNMENT
static int alignment () { return SMASK_LEN*sizeof(uint32_t); };
};
// This class represents a vector of VEC_LEN scalars and is used for emulation.
template<typename SCALAR_TYPE, uint32_t VEC_LEN>
class SIMDVecEmuRegister
{
private:
SCALAR_TYPE reg[VEC_LEN];
public:
SIMDVecEmuRegister() {
UME_EMULATION_WARNING();
for(unsigned int i = 0; i < VEC_LEN; i++) { reg[i] = 0; }
}
SIMDVecEmuRegister(SCALAR_TYPE x) {
UME_EMULATION_WARNING();
for(unsigned int i = 0; i < VEC_LEN; i++) { reg[i] = x; }
}
SIMDVecEmuRegister(SIMDVecEmuRegister const & x) {
UME_EMULATION_WARNING();
for(unsigned int i = 0; i < VEC_LEN; i++) { reg[i] = x.reg[i]; }
}
// Also define a non-modifying access operator
UME_FUNC_ATTRIB SCALAR_TYPE operator[] (uint32_t index) const {
SCALAR_TYPE temp = reg[index];
return temp;
}
UME_FUNC_ATTRIB void insert(uint32_t index, SCALAR_TYPE value){
reg[index] = value;
}
};
template<uint32_t MASK_LEN>
struct MaskAsInt{
uint64_t m0;
};
template<>
struct MaskAsInt<128> {
uint64_t m0;
uint64_t m1;
};
// **********************************************************************
// *
// * Declaration of SIMDMaskBaseInterface class
// *
// * This class should be used as a basic class for all masks.
// * All masks should implement interface contained in
// * SIMDMaskBaseInterface. If the derived class does not provide an
// * overload for given operation, this class will default
// * to scalar emulation, thus providing interface coherence over
// * different plugins.
// *
// **********************************************************************
template<class DERIVED_MASK_TYPE,
typename MASK_BASE_TYPE,
uint32_t MASK_LEN>
class SIMDMaskBaseInterface {
// Declarations only. These operators should be overriden in derived types.
// EXTRACT
UME_FUNC_ATTRIB bool extract(uint32_t index);
// EXTRACT
UME_FUNC_ATTRIB bool operator[] (uint32_t index);
// INSERT
UME_FUNC_ATTRIB void insert(uint32_t index, bool value);
protected:
~SIMDMaskBaseInterface() {}
public:
// LENGTH
constexpr static uint32_t length() { return MASK_LEN; }
// ALIGNMENT
constexpr static int alignment() { return MASK_LEN*sizeof(MASK_BASE_TYPE); }
// LOAD
UME_FUNC_ATTRIB DERIVED_MASK_TYPE & load(bool const * addr) {
UME_EMULATION_WARNING();
return SCALAR_EMULATION::load<DERIVED_MASK_TYPE, bool>(static_cast<DERIVED_MASK_TYPE &>(*this), addr);
}
// LOADA
UME_FUNC_ATTRIB DERIVED_MASK_TYPE & loada(bool const * addrAligned) {
UME_EMULATION_WARNING();
return SCALAR_EMULATION::loadAligned<DERIVED_MASK_TYPE, bool>(static_cast<DERIVED_MASK_TYPE &>(*this), addrAligned);
}
// STORE
UME_FUNC_ATTRIB bool* store(bool* addr) const {
UME_EMULATION_WARNING();
return SCALAR_EMULATION::store<DERIVED_MASK_TYPE, bool>(static_cast<DERIVED_MASK_TYPE const &>(*this), addr);
}
// STOREA
UME_FUNC_ATTRIB bool* storea(bool* addrAligned) const {
UME_EMULATION_WARNING();
return SCALAR_EMULATION::storeAligned<DERIVED_MASK_TYPE, bool>(static_cast<DERIVED_MASK_TYPE const &>(*this), addrAligned);
}
// GATHERU
UME_FUNC_ATTRIB DERIVED_MASK_TYPE & gatheru (bool const * baseAddr, uint32_t stride) {
UME_EMULATION_WARNING();
return SCALAR_EMULATION::gatheru<DERIVED_MASK_TYPE, bool> (static_cast<DERIVED_MASK_TYPE &>(*this), baseAddr, stride);
}
// SCATTERU
UME_FUNC_ATTRIB bool* scatteru (bool * baseAddr, uint32_t stride) {
UME_EMULATION_WARNING();
return SCALAR_EMULATION::scatteru<DERIVED_MASK_TYPE, bool> (static_cast<DERIVED_MASK_TYPE &>(*this), baseAddr, stride);
}
// ASSIGNV
UME_FUNC_ATTRIB DERIVED_MASK_TYPE & assign(DERIVED_MASK_TYPE const & maskOp) {
UME_EMULATION_WARNING();
return SCALAR_EMULATION::assign<DERIVED_MASK_TYPE>(static_cast<DERIVED_MASK_TYPE &>(*this), maskOp);
}
UME_FUNC_ATTRIB DERIVED_MASK_TYPE & operator= (DERIVED_MASK_TYPE const & maskOp) {
return assign(maskOp);
}
// MASSIGNV
UME_FUNC_ATTRIB DERIVED_MASK_TYPE & assign(DERIVED_MASK_TYPE const & mask, DERIVED_MASK_TYPE const & maskOp) {
UME_EMULATION_WARNING();
return SCALAR_EMULATION::assign<DERIVED_MASK_TYPE, DERIVED_MASK_TYPE>(mask, static_cast<DERIVED_MASK_TYPE &>(*this), maskOp);
}
// ASSIGNS
UME_FUNC_ATTRIB DERIVED_MASK_TYPE & assign(bool scalarOp) {
UME_EMULATION_WARNING();
return SCALAR_EMULATION::assign<DERIVED_MASK_TYPE, bool>(static_cast<DERIVED_MASK_TYPE &>(*this), scalarOp);
}
UME_FUNC_ATTRIB DERIVED_MASK_TYPE & operator= (bool scalarOp) {
return assign(scalarOp);
}
// MASSIGNS
UME_FUNC_ATTRIB DERIVED_MASK_TYPE & assign(DERIVED_MASK_TYPE const & mask, bool scalarOp) {
UME_EMULATION_WARNING();
return SCALAR_EMULATION::assign<DERIVED_MASK_TYPE, bool, DERIVED_MASK_TYPE>(mask, static_cast<DERIVED_MASK_TYPE &>(*this), scalarOp);
}
// LANDV
UME_FUNC_ATTRIB DERIVED_MASK_TYPE land(DERIVED_MASK_TYPE const & maskOp) const {
UME_EMULATION_WARNING();
return SCALAR_EMULATION::binaryAnd<DERIVED_MASK_TYPE>(static_cast<DERIVED_MASK_TYPE const &>(*this), maskOp);
}
UME_FUNC_ATTRIB DERIVED_MASK_TYPE operator& (DERIVED_MASK_TYPE const & maskOp) const {
return land(maskOp);
}
UME_FUNC_ATTRIB DERIVED_MASK_TYPE operator&& (DERIVED_MASK_TYPE const & maskOp) const {
return land(maskOp);
}
// LANDS
UME_FUNC_ATTRIB DERIVED_MASK_TYPE land(bool value) const {
UME_EMULATION_WARNING();
return SCALAR_EMULATION::binaryAnd<DERIVED_MASK_TYPE>(static_cast<DERIVED_MASK_TYPE const &>(*this), value);
}
UME_FUNC_ATTRIB DERIVED_MASK_TYPE operator& (bool value) const {
return land(value);
}
UME_FUNC_ATTRIB DERIVED_MASK_TYPE operator&& (bool value) const {
return land(value);
}
// LANDVA
UME_FUNC_ATTRIB DERIVED_MASK_TYPE & landa(DERIVED_MASK_TYPE const & maskOp) {
UME_EMULATION_WARNING();
return SCALAR_EMULATION::binaryAndAssign<DERIVED_MASK_TYPE>(static_cast<DERIVED_MASK_TYPE &>(*this), maskOp);
}
UME_FUNC_ATTRIB DERIVED_MASK_TYPE & operator&= (DERIVED_MASK_TYPE const & maskOp) {
return landa(maskOp);
}
// LANDSA
UME_FUNC_ATTRIB DERIVED_MASK_TYPE & landa(bool value) {
UME_EMULATION_WARNING();
return SCALAR_EMULATION::binaryAndAssign<DERIVED_MASK_TYPE, bool>(static_cast<DERIVED_MASK_TYPE &>(*this), value);
}
UME_FUNC_ATTRIB DERIVED_MASK_TYPE & operator&= (bool value) {
return landa(value);
}
// LORV
UME_FUNC_ATTRIB DERIVED_MASK_TYPE lor(DERIVED_MASK_TYPE const & maskOp) const {
UME_EMULATION_WARNING();
return SCALAR_EMULATION::binaryOr<DERIVED_MASK_TYPE>(static_cast<DERIVED_MASK_TYPE const &>(*this), maskOp);
}
UME_FUNC_ATTRIB DERIVED_MASK_TYPE operator| (DERIVED_MASK_TYPE const & maskOp) const {
return lor(maskOp);
}
UME_FUNC_ATTRIB DERIVED_MASK_TYPE operator|| (DERIVED_MASK_TYPE const & maskOp) const {
return lor(maskOp);
}
// LORS
UME_FUNC_ATTRIB DERIVED_MASK_TYPE lor(bool value) const {
UME_EMULATION_WARNING();
return SCALAR_EMULATION::binaryOr<DERIVED_MASK_TYPE>(static_cast<DERIVED_MASK_TYPE const &>(*this), value);
}
UME_FUNC_ATTRIB DERIVED_MASK_TYPE operator| (bool value) const {
UME_EMULATION_WARNING();
return SCALAR_EMULATION::binaryOr<DERIVED_MASK_TYPE, bool>(static_cast<DERIVED_MASK_TYPE const &>(*this), value);
}
UME_FUNC_ATTRIB DERIVED_MASK_TYPE operator|| (bool value) const {
UME_EMULATION_WARNING();
return SCALAR_EMULATION::binaryOr<DERIVED_MASK_TYPE, bool>(static_cast<DERIVED_MASK_TYPE const &>(*this), value);
}
// LORVA
UME_FUNC_ATTRIB DERIVED_MASK_TYPE & lora(DERIVED_MASK_TYPE const & maskOp) {
UME_EMULATION_WARNING();
return SCALAR_EMULATION::binaryOrAssign<DERIVED_MASK_TYPE>(static_cast<DERIVED_MASK_TYPE &>(*this), maskOp);
}
UME_FUNC_ATTRIB DERIVED_MASK_TYPE & operator|= (DERIVED_MASK_TYPE const & maskOp) {
return lora(maskOp);
}
// LORSA
UME_FUNC_ATTRIB DERIVED_MASK_TYPE & lora(bool value) {
UME_EMULATION_WARNING();
return SCALAR_EMULATION::binaryOrAssign<DERIVED_MASK_TYPE, bool>(static_cast<DERIVED_MASK_TYPE &>(*this), value);
}
UME_FUNC_ATTRIB DERIVED_MASK_TYPE & operator|= (bool value) {
return lora(value);
}
// LXORV
UME_FUNC_ATTRIB DERIVED_MASK_TYPE lxor(DERIVED_MASK_TYPE const & maskOp) const {
UME_EMULATION_WARNING();
return SCALAR_EMULATION::binaryXor<DERIVED_MASK_TYPE>(static_cast<DERIVED_MASK_TYPE const &>(*this), maskOp);
}
UME_FUNC_ATTRIB DERIVED_MASK_TYPE operator^ (DERIVED_MASK_TYPE const & maskOp) const {
return lxor(maskOp);
}
// LXORS
UME_FUNC_ATTRIB DERIVED_MASK_TYPE lxor(bool value) const {
UME_EMULATION_WARNING();
return SCALAR_EMULATION::binaryXor<DERIVED_MASK_TYPE, bool>(static_cast<DERIVED_MASK_TYPE const &>(*this), value);
}
UME_FUNC_ATTRIB DERIVED_MASK_TYPE operator^ (bool value) const {
return lxor(value);
}
// LXORVA
UME_FUNC_ATTRIB DERIVED_MASK_TYPE & lxora(DERIVED_MASK_TYPE const & maskOp) {
UME_EMULATION_WARNING();
return SCALAR_EMULATION::binaryXorAssign<DERIVED_MASK_TYPE>(static_cast<DERIVED_MASK_TYPE &>(*this), maskOp);
}
UME_FUNC_ATTRIB DERIVED_MASK_TYPE & operator^= (DERIVED_MASK_TYPE const & maskOp) {
return lxora(maskOp);
}
// LXORSA
UME_FUNC_ATTRIB DERIVED_MASK_TYPE & lxora(bool value) {
UME_EMULATION_WARNING();
return SCALAR_EMULATION::binaryXorAssign<DERIVED_MASK_TYPE, bool>(static_cast<DERIVED_MASK_TYPE &>(*this), value);
}
UME_FUNC_ATTRIB DERIVED_MASK_TYPE & operator^= (bool value) {
return lxora(value);
}
// LNOT
UME_FUNC_ATTRIB DERIVED_MASK_TYPE lnot () const {
UME_EMULATION_WARNING();
return SCALAR_EMULATION::logicalNot<DERIVED_MASK_TYPE>(static_cast<DERIVED_MASK_TYPE const &>(*this));
}
UME_FUNC_ATTRIB DERIVED_MASK_TYPE operator!() const {
return lnot();
}
// LNOTA
UME_FUNC_ATTRIB DERIVED_MASK_TYPE & lnota () {
UME_EMULATION_WARNING();
return SCALAR_EMULATION::logicalNotAssign<DERIVED_MASK_TYPE>(static_cast<DERIVED_MASK_TYPE &>(*this));
}
// LANDNOTV
UME_FUNC_ATTRIB DERIVED_MASK_TYPE landnot(DERIVED_MASK_TYPE const & b) const {
UME_EMULATION_WARNING();
return SCALAR_EMULATION::logicalAndNot<DERIVED_MASK_TYPE>(static_cast<DERIVED_MASK_TYPE const &>(*this), b);
}
// LANDNOTS
UME_FUNC_ATTRIB DERIVED_MASK_TYPE landnot(bool b) const {
UME_EMULATION_WARNING();
return SCALAR_EMULATION::logicalAndNot<DERIVED_MASK_TYPE>(static_cast<DERIVED_MASK_TYPE const &>(*this), b);
}
// CMPEQV
UME_FUNC_ATTRIB DERIVED_MASK_TYPE cmpeq(DERIVED_MASK_TYPE const & b) const {
UME_EMULATION_WARNING();
return SCALAR_EMULATION::isEqual<DERIVED_MASK_TYPE, DERIVED_MASK_TYPE>(static_cast<DERIVED_MASK_TYPE const &>(*this), b);
}
UME_FUNC_ATTRIB DERIVED_MASK_TYPE operator== (DERIVED_MASK_TYPE const & b) const {
return cmpeq(b);
}
// CMPEQS
UME_FUNC_ATTRIB DERIVED_MASK_TYPE cmpeq(bool b) const {
UME_EMULATION_WARNING();
return SCALAR_EMULATION::isEqual<DERIVED_MASK_TYPE, DERIVED_MASK_TYPE, bool>(static_cast<DERIVED_MASK_TYPE const &>(*this), b);
}
UME_FUNC_ATTRIB DERIVED_MASK_TYPE operator== (bool b) const {
return cmpeq(b);
}
// CMPNEV
UME_FUNC_ATTRIB DERIVED_MASK_TYPE cmpne(DERIVED_MASK_TYPE const & b) const {
UME_EMULATION_WARNING();
return SCALAR_EMULATION::isNotEqual<DERIVED_MASK_TYPE, DERIVED_MASK_TYPE>(static_cast<DERIVED_MASK_TYPE const &>(*this), b);
}
UME_FUNC_ATTRIB DERIVED_MASK_TYPE operator!= (DERIVED_MASK_TYPE const & b) const {
return cmpne(b);
}
// CMPNES
UME_FUNC_ATTRIB DERIVED_MASK_TYPE cmpne(bool b) const {
UME_EMULATION_WARNING();
return SCALAR_EMULATION::isNotEqual<DERIVED_MASK_TYPE, DERIVED_MASK_TYPE, bool>(static_cast<DERIVED_MASK_TYPE const &>(*this), b);
}
UME_FUNC_ATTRIB DERIVED_MASK_TYPE operator!= (bool b) const {
return cmpne(b);
}
// HLAND
UME_FUNC_ATTRIB bool hland() const {
UME_EMULATION_WARNING();
return SCALAR_EMULATION::reduceLogicalAnd<DERIVED_MASK_TYPE>(static_cast<DERIVED_MASK_TYPE const &>(*this));
}
// HLOR
UME_FUNC_ATTRIB bool hlor() const {
UME_EMULATION_WARNING();
return SCALAR_EMULATION::reduceLogicalOr<DERIVED_MASK_TYPE>(static_cast<DERIVED_MASK_TYPE const &>(*this));
}
// HLXOR
UME_FUNC_ATTRIB bool hlxor() const {
UME_EMULATION_WARNING();
return SCALAR_EMULATION::reduceLogicalXor<DERIVED_MASK_TYPE>(static_cast<DERIVED_MASK_TYPE const &>(*this));
}
// CMPEV
UME_FUNC_ATTRIB bool cmpe(DERIVED_MASK_TYPE const & mask) const {
UME_EMULATION_WARNING();
return SCALAR_EMULATION::isExact<DERIVED_MASK_TYPE>(static_cast<DERIVED_MASK_TYPE const &>(*this), mask);
}
// CMPES
UME_FUNC_ATTRIB bool cmpe(bool b) const {
UME_EMULATION_WARNING();
return SCALAR_EMULATION::isExact<DERIVED_MASK_TYPE>(static_cast<DERIVED_MASK_TYPE const &>(*this), DERIVED_MASK_TYPE(b));
}
};
// **********************************************************************
// *
// * Declaration of IntermediateMask class
// *
// * This class is a helper class used in masked version of
// * operator[]. This object is not copyable and can only be created
// * from its vector type (VEC_TYPE) for temporary use.
// *
// **********************************************************************
template<class VEC_TYPE, class SCALAR_TYPE, class MASK_TYPE>
class IntermediateMask {
public:
// MASSIGNV
UME_FUNC_ATTRIB void operator=(VEC_TYPE const & vecRhs) const {
mVecRef.assign(mMaskRef, vecRhs);
}
// MASSIGNS
UME_FUNC_ATTRIB void operator=(SCALAR_TYPE scalarRhs) const {
mVecRef.assign(mMaskRef, scalarRhs);
}
// MADDVA
UME_FUNC_ATTRIB void operator+=(VEC_TYPE const & vecRhs) const {
mVecRef.adda(mMaskRef, vecRhs);
}
// MADDSA
UME_FUNC_ATTRIB void operator+=(SCALAR_TYPE scalarRhs) const {
mVecRef.adda(mMaskRef, scalarRhs);
}
// MSUBVA
UME_FUNC_ATTRIB void operator-= (VEC_TYPE const & vecRhs) const {
mVecRef.suba(mMaskRef, vecRhs);
}
// MSUBSA
UME_FUNC_ATTRIB void operator-=(SCALAR_TYPE scalarRhs) const {
mVecRef.suba(mMaskRef, scalarRhs);
}
// MMULVA
UME_FUNC_ATTRIB void operator*= (VEC_TYPE const & vecRhs) const {
mVecRef.mula(mMaskRef, vecRhs);
}
// MMULSA
UME_FUNC_ATTRIB void operator*=(SCALAR_TYPE scalarRhs) const {
mVecRef.mula(mMaskRef, scalarRhs);
}
// MDIVVA
UME_FUNC_ATTRIB void operator/= (VEC_TYPE const & vecRhs) const {
mVecRef.diva(mMaskRef, vecRhs);
}
// MDIVSA
UME_FUNC_ATTRIB void operator/=(SCALAR_TYPE scalarRhs) const {
mVecRef.diva(mMaskRef, scalarRhs);
}
// MBANDVA
UME_FUNC_ATTRIB void operator&= (VEC_TYPE const & vecRhs) const {
mVecRef.banda(mMaskRef, vecRhs);
}
// MBANDSA
UME_FUNC_ATTRIB void operator&=(SCALAR_TYPE scalarRhs) const {
mVecRef.banda(mMaskRef, scalarRhs);
}
// MBORVA
UME_FUNC_ATTRIB void operator|= (VEC_TYPE const & vecRhs) const {
mVecRef.bora(mMaskRef, vecRhs);
}
// MBORSA
UME_FUNC_ATTRIB void operator|=(SCALAR_TYPE scalarRhs) const {
mVecRef.bora(mMaskRef, scalarRhs);
}
// MBXORVA
UME_FUNC_ATTRIB void operator^= (VEC_TYPE const & vecRhs) const {
mVecRef.bxora(mMaskRef, vecRhs);
}
// MBXORSA
UME_FUNC_ATTRIB void operator^=(SCALAR_TYPE scalarRhs) const {
mVecRef.bxora(mMaskRef, scalarRhs);
}
// This object should be only constructible by the
// vector type using it.
IntermediateMask();
IntermediateMask(IntermediateMask const &);
IntermediateMask & operator= (IntermediateMask const &);
explicit IntermediateMask(uint32_t);
#ifndef __NVCC__
// NVCC has a problem handling this friendship relation.
// Make it public only when compiling CUDA
private:
friend VEC_TYPE;
#endif
UME_FUNC_ATTRIB explicit IntermediateMask(MASK_TYPE const & mask, VEC_TYPE & vec) : mMaskRef(mask), mVecRef(vec) {}
MASK_TYPE const & mMaskRef;
VEC_TYPE & mVecRef;
};
// **********************************************************************
// *
// * Declaration of IntermediateIndex class
// *
// * This class is a helper class used in assignment version of
// * operator[SCALAR]. This object is not copyable and can only be created
// * from its vector type (VEC_TYPE) for temporary use. It's purpose is
// * to allow LHS assignments to expressions of form:
// *
// * <vec>[index] <assignment_operator> <RHS scalar value>
// *
// **********************************************************************
template<class VEC_TYPE, class SCALAR_TYPE>
class IntermediateIndex {
public:
IntermediateIndex(IntermediateIndex const & x) : mVecRef_RW(x.mVecRef_RW), mIndexRef(x.mIndexRef) {}
IntermediateIndex & operator= (IntermediateIndex const & x) {
mVecRef_RW.insert(mIndexRef, x.mVecRef_RW.extract(x.mIndexRef));
return *this;
}
// MASSIGNS
UME_FUNC_ATTRIB void operator= (SCALAR_TYPE scalarRhs) {
mVecRef_RW.insert(mIndexRef, scalarRhs);
}
UME_FUNC_ATTRIB void operator+= (SCALAR_TYPE scalarRhs) {
mVecRef_RW.insert(mIndexRef, mVecRef_RW[mIndexRef] + scalarRhs);
}
UME_FUNC_ATTRIB void operator-= (SCALAR_TYPE scalarRhs) {
mVecRef_RW.insert(mIndexRef, mVecRef_RW[mIndexRef] - scalarRhs);
}
UME_FUNC_ATTRIB void operator*= (SCALAR_TYPE scalarRhs) {
mVecRef_RW.insert(mIndexRef, mVecRef_RW[mIndexRef] * scalarRhs);
}
UME_FUNC_ATTRIB void operator/= (SCALAR_TYPE scalarRhs) {
mVecRef_RW.insert(mIndexRef, mVecRef_RW[mIndexRef] / scalarRhs);
}
UME_FUNC_ATTRIB void operator%= (SCALAR_TYPE scalarRhs) {
mVecRef_RW.insert(mIndexRef, mVecRef_RW[mIndexRef] % scalarRhs);
}
UME_FUNC_ATTRIB void operator&= (SCALAR_TYPE scalarRhs) {
mVecRef_RW.insert(mIndexRef, mVecRef_RW[mIndexRef] & scalarRhs);
}
UME_FUNC_ATTRIB void operator|= (SCALAR_TYPE scalarRhs) {
mVecRef_RW.insert(mIndexRef, mVecRef_RW[mIndexRef] | scalarRhs);
}
UME_FUNC_ATTRIB void operator^= (SCALAR_TYPE scalarRhs) {
mVecRef_RW.insert(mIndexRef, mVecRef_RW[mIndexRef] ^ scalarRhs);
}
UME_FUNC_ATTRIB void operator<<= (SCALAR_TYPE scalarRhs) {
mVecRef_RW.insert(mIndexRef, mVecRef_RW[mIndexRef] << scalarRhs);
}
UME_FUNC_ATTRIB void operator>>= (SCALAR_TYPE scalarRhs) {
mVecRef_RW.insert(mIndexRef, mVecRef_RW[mIndexRef] >> scalarRhs);
}
UME_FUNC_ATTRIB operator SCALAR_TYPE() const { return mVecRef_RW.extract(mIndexRef); }
// Comparison operators accept any type of scalar to allow mixing
// scalar types.
template<
typename T,
typename = typename std::enable_if<std::is_fundamental<T>::value, void*>::type
>
UME_FUNC_ATTRIB bool operator==(
T const & rhs) const {
return mVecRef_RW.extract(mIndexRef) == SCALAR_TYPE(rhs);
}
UME_FUNC_ATTRIB bool operator== (IntermediateIndex const & x) const {
return mVecRef_RW.extract(mIndexRef) ==
x.mVecRef_RW.extract(x.mIndexRef);
}
template<typename T>
UME_FUNC_ATTRIB bool operator!=(T const & rhs) const {
return mVecRef_RW.extract(mIndexRef) != SCALAR_TYPE(rhs);
}
UME_FUNC_ATTRIB bool operator!= (IntermediateIndex const & x) const {
return mVecRef_RW.extract(mIndexRef) !=
x.mVecRef_RW.extract(x.mIndexRef);
}
template<typename T>
UME_FUNC_ATTRIB SCALAR_TYPE operator+ (T const & x) const {
return mVecRef_RW.extract(mIndexRef) + SCALAR_TYPE(x);
}
UME_FUNC_ATTRIB SCALAR_TYPE operator+ (IntermediateIndex const & x) const {
return mVecRef_RW.extract(mIndexRef) +
x.mVecRef_RW.extract(x.mIndexRef);
}
template<typename T>
UME_FUNC_ATTRIB SCALAR_TYPE operator- (T const & x) const {
return mVecRef_RW.extract(mIndexRef) - SCALAR_TYPE(x);
}
UME_FUNC_ATTRIB SCALAR_TYPE operator- (IntermediateIndex const & x) const {
return mVecRef_RW.extract(mIndexRef) -
x.mVecRef_RW.extract(x.mIndexRef);
}
template<typename T>
UME_FUNC_ATTRIB SCALAR_TYPE operator* (T const & x) const {
return mVecRef_RW.extract(mIndexRef) * SCALAR_TYPE(x);
}
UME_FUNC_ATTRIB SCALAR_TYPE operator* (IntermediateIndex const & x) const {
return mVecRef_RW.extract(mIndexRef) *
x.mVecRef_RW.extract(x.mIndexRef);
}
template<typename T>
UME_FUNC_ATTRIB SCALAR_TYPE operator/ (T const & x) const {
return mVecRef_RW.extract(mIndexRef) / SCALAR_TYPE(x);
}
UME_FUNC_ATTRIB SCALAR_TYPE operator/ (IntermediateIndex const & x) const {
return mVecRef_RW.extract(mIndexRef) /
x.mVecRef_RW.extract(x.mIndexRef);
}
template<typename T>
UME_FUNC_ATTRIB SCALAR_TYPE operator% (T const & x) const {
return mVecRef_RW.extract(mIndexRef) % SCALAR_TYPE(x);
}
UME_FUNC_ATTRIB SCALAR_TYPE operator% (IntermediateIndex const & x) const {
return mVecRef_RW.extract(mIndexRef) %
x.mVecRef_RW.extract(x.mIndexRef);
}
template<typename T>
UME_FUNC_ATTRIB SCALAR_TYPE operator& (T const & x) const {
return mVecRef_RW.extract(mIndexRef) & SCALAR_TYPE(x);
}
UME_FUNC_ATTRIB SCALAR_TYPE operator& (IntermediateIndex const & x) const {
return mVecRef_RW.extract(mIndexRef) &
x.mVecRef_RW.extract(x.mIndexRef);
}
template<typename T>
UME_FUNC_ATTRIB SCALAR_TYPE operator| (T const & x) const {
return mVecRef_RW.extract(mIndexRef) | SCALAR_TYPE(x);
}
UME_FUNC_ATTRIB SCALAR_TYPE operator| (IntermediateIndex const & x) const {
return mVecRef_RW.extract(mIndexRef) |
x.mVecRef_RW.extract(x.mIndexRef);
}
template<typename T>
UME_FUNC_ATTRIB SCALAR_TYPE operator^ (T const & x) const {
return mVecRef_RW.extract(mIndexRef) ^ SCALAR_TYPE(x);
}
UME_FUNC_ATTRIB SCALAR_TYPE operator^ (IntermediateIndex const & x) const {
return mVecRef_RW.extract(mIndexRef) ^
x.mVecRef_RW.extract(x.mIndexRef);
}
template<typename T>
UME_FUNC_ATTRIB SCALAR_TYPE operator<< (T const & x) const {
return mVecRef_RW.extract(mIndexRef) << SCALAR_TYPE(x);
}
UME_FUNC_ATTRIB SCALAR_TYPE operator<< (IntermediateIndex const & x) const {
return mVecRef_RW.extract(mIndexRef) <<
x.mVecRef_RW.extract(x.mIndexRef);
}
template<typename T>
UME_FUNC_ATTRIB SCALAR_TYPE operator>> (T const & x) const {
return mVecRef_RW.extract(mIndexRef) >> SCALAR_TYPE(x);
}
UME_FUNC_ATTRIB SCALAR_TYPE operator>> (IntermediateIndex const & x) const {
return mVecRef_RW.extract(mIndexRef) >>
x.mVecRef_RW.extract(x.mIndexRef);
}
#ifndef __NVCC__
// NVCC has a problem handling this friendship relation.
// Make it public only when compiling CUDA
private:
friend VEC_TYPE;
#endif
// This object should be only constructible by the
// vector type using it.
IntermediateIndex() {}
UME_FUNC_ATTRIB explicit IntermediateIndex(uint32_t index, VEC_TYPE & vec) : mVecRef_RW(vec), mIndexRef(index) {}
VEC_TYPE & mVecRef_RW;
uint32_t mIndexRef;
};
// **********************************************************************
// *
// * Declaration of SIMDVecBaseInterface class
// *
// * This class should be used as a basic class for all integer and
// * floating point vector types. All vectors should implement interface
// * contained in SIMDVecBaseInterface. If the derived class does not
// * provide an overload for given operation, this class will default
// * to scalar emulation, thus providing interface coherence over
// * different plugins. This class should not be used directly in
// * plugins since it encapsulates only a common part of all vector
// * types. Plugins should use:
// * - "SIMDVecUnsignedInterface" for unsigned integer vectors,
// * - "SIMDVecSignedInterface" for signed integer vectors,
// * - "SIMDVecFloatInterface" for floating point vectors
// *
// **********************************************************************
// DERIVED_VEC_TYPE - this is a derived class to be used as a part of 'Curiously Recurring Design Pattern (CRTP)'
// SCALAR_TYPE - basic type of scalar elements packed in DERIVED_VEC_TYPE
// VEC_LEN - number of SIMD elements in vector
// MASK_TYPE - exact type of the mask to be used with this vector
template<class DERIVED_VEC_TYPE,
typename SCALAR_TYPE,
uint32_t VEC_LEN,
typename MASK_TYPE,
typename SWIZZLE_MASK_TYPE>
class SIMDVecBaseInterface
{
// Other vector types necessary for this class
typedef SIMDVecBaseInterface<
DERIVED_VEC_TYPE,
SCALAR_TYPE,
VEC_LEN,
MASK_TYPE,
SWIZZLE_MASK_TYPE> VEC_TYPE;
protected:
// Making destructor protected prohibits this class from being instantiated. Effectively this class can only be used as a base class.
UME_FUNC_ATTRIB ~SIMDVecBaseInterface() {};
public:
// TODO: can be marked as constexpr?
constexpr static uint32_t length() { return VEC_LEN; }
constexpr static uint32_t alignment() { return VEC_LEN*sizeof(SCALAR_TYPE); }
// ZERO-VEC
static DERIVED_VEC_TYPE zero() { return DERIVED_VEC_TYPE(SCALAR_TYPE(0)); }
// ONE-VEC
static DERIVED_VEC_TYPE one() { return DERIVED_VEC_TYPE(SCALAR_TYPE(1)); }
#include "utilities/ignore_warnings_push.h"
#include "utilities/ignore_warnings_unused_parameter.h"
// PREFETCH0
static UME_FUNC_ATTRIB void prefetch0(SCALAR_TYPE const *p) {
// DO NOTHING!
}
// PREFETCH1
static UME_FUNC_ATTRIB void prefetch1(SCALAR_TYPE const *p) {
// DO NOTHING!
}
// PREFETCH2
static UME_FUNC_ATTRIB void prefetch2(SCALAR_TYPE const *p) {
// DO NOTHING!
}
#include "utilities/ignore_warnings_pop.h"
// ASSIGNV
UME_FUNC_ATTRIB DERIVED_VEC_TYPE & assign (DERIVED_VEC_TYPE const & src) {
UME_EMULATION_WARNING();
return SCALAR_EMULATION::assign<DERIVED_VEC_TYPE> (static_cast<DERIVED_VEC_TYPE &>(*this), src);
}
UME_FUNC_ATTRIB DERIVED_VEC_TYPE & operator= (DERIVED_VEC_TYPE const & src) {
return assign(src);
}
// MASSIGNV
UME_FUNC_ATTRIB DERIVED_VEC_TYPE & assign (MASK_TYPE const & mask, DERIVED_VEC_TYPE const & src) {
UME_EMULATION_WARNING();
return SCALAR_EMULATION::assign<DERIVED_VEC_TYPE, MASK_TYPE> (mask, static_cast<DERIVED_VEC_TYPE &>(*this), src);
}
// ASSIGNS
UME_FUNC_ATTRIB DERIVED_VEC_TYPE & assign (SCALAR_TYPE value) {
UME_EMULATION_WARNING();
return SCALAR_EMULATION::assign<DERIVED_VEC_TYPE, SCALAR_TYPE> (static_cast<DERIVED_VEC_TYPE &>(*this), value);
}
UME_FUNC_ATTRIB DERIVED_VEC_TYPE & operator= (SCALAR_TYPE value) {
return assign(value);
}
// MASSIGNS
UME_FUNC_ATTRIB DERIVED_VEC_TYPE & assign (MASK_TYPE const & mask, SCALAR_TYPE value) {
UME_EMULATION_WARNING();
return SCALAR_EMULATION::assign<DERIVED_VEC_TYPE, SCALAR_TYPE, MASK_TYPE> (mask, static_cast<DERIVED_VEC_TYPE &>(*this), value);
}
// LOAD
UME_FUNC_ATTRIB DERIVED_VEC_TYPE & load (SCALAR_TYPE const *p) {
UME_EMULATION_WARNING();
return SCALAR_EMULATION::load<DERIVED_VEC_TYPE, SCALAR_TYPE> (static_cast<DERIVED_VEC_TYPE &>(*this), p);
}
// MLOAD
UME_FUNC_ATTRIB DERIVED_VEC_TYPE & load (MASK_TYPE const & mask, SCALAR_TYPE const * p) {
UME_EMULATION_WARNING();
return SCALAR_EMULATION::load<DERIVED_VEC_TYPE, SCALAR_TYPE, MASK_TYPE> (mask, static_cast<DERIVED_VEC_TYPE &>(*this), p);
}
// LOADA
UME_FUNC_ATTRIB DERIVED_VEC_TYPE & loada (SCALAR_TYPE const * p) {
UME_EMULATION_WARNING();
return SCALAR_EMULATION::loadAligned<DERIVED_VEC_TYPE, SCALAR_TYPE>(static_cast<DERIVED_VEC_TYPE &>(*this), p);
}
// MLOADA
UME_FUNC_ATTRIB DERIVED_VEC_TYPE & loada (MASK_TYPE const & mask, SCALAR_TYPE const *p) {
UME_EMULATION_WARNING();
return SCALAR_EMULATION::loadAligned<DERIVED_VEC_TYPE, SCALAR_TYPE, MASK_TYPE> (mask, static_cast<DERIVED_VEC_TYPE &>(*this), p);
}
// SLOAD
UME_FUNC_ATTRIB DERIVED_VEC_TYPE & sload(SCALAR_TYPE const *p) {
UME_EMULATION_WARNING();
return SCALAR_EMULATION::load<DERIVED_VEC_TYPE, SCALAR_TYPE>(static_cast<DERIVED_VEC_TYPE &>(*this), p);
}
// MSLOAD
UME_FUNC_ATTRIB DERIVED_VEC_TYPE & sload(MASK_TYPE const & mask, SCALAR_TYPE const *p) {
UME_EMULATION_WARNING();
return SCALAR_EMULATION::load<DERIVED_VEC_TYPE, SCALAR_TYPE, MASK_TYPE>(mask, static_cast<DERIVED_VEC_TYPE &>(*this), p);
}
// STORE
UME_FUNC_ATTRIB SCALAR_TYPE* store (SCALAR_TYPE* p) const {
UME_EMULATION_WARNING();
return SCALAR_EMULATION::store<DERIVED_VEC_TYPE, SCALAR_TYPE> (static_cast<DERIVED_VEC_TYPE const &>(*this), p);
}
// MSTORE
UME_FUNC_ATTRIB SCALAR_TYPE* store (MASK_TYPE const & mask, SCALAR_TYPE* p) const {
UME_EMULATION_WARNING();
return SCALAR_EMULATION::store<DERIVED_VEC_TYPE, SCALAR_TYPE, MASK_TYPE> (mask, static_cast<DERIVED_VEC_TYPE const &>(*this), p);
}
// STOREA
UME_FUNC_ATTRIB SCALAR_TYPE* storea (SCALAR_TYPE* p) const {
UME_EMULATION_WARNING();
return SCALAR_EMULATION::store<DERIVED_VEC_TYPE, SCALAR_TYPE> (static_cast<DERIVED_VEC_TYPE const &>(*this), p);
}
// MSTOREA
UME_FUNC_ATTRIB SCALAR_TYPE* storea (MASK_TYPE const & mask, SCALAR_TYPE* p) const {
UME_EMULATION_WARNING();
return SCALAR_EMULATION::store<DERIVED_VEC_TYPE, SCALAR_TYPE, MASK_TYPE> (mask, static_cast<DERIVED_VEC_TYPE const &>(*this), p);
}
// SSTORE
UME_FUNC_ATTRIB SCALAR_TYPE* sstore(SCALAR_TYPE *p) const {
UME_EMULATION_WARNING();
return SCALAR_EMULATION::store<DERIVED_VEC_TYPE, SCALAR_TYPE>(static_cast<DERIVED_VEC_TYPE const &>(*this), p);
}
// MSSTORE
UME_FUNC_ATTRIB SCALAR_TYPE* sstore(MASK_TYPE const & mask, SCALAR_TYPE *p) const {
UME_EMULATION_WARNING();
return SCALAR_EMULATION::store<DERIVED_VEC_TYPE, SCALAR_TYPE, MASK_TYPE>(mask, static_cast<DERIVED_VEC_TYPE const &>(*this), p);
}
// EXTRACT
// This method should be provided for all derived classes and cannot be defined
// as generic.
UME_FUNC_ATTRIB SCALAR_TYPE extract(uint32_t index) const;
// INSERT
// This method should be provided for all derived classes and cannot be defined
// as generic.
UME_FUNC_ATTRIB DERIVED_VEC_TYPE & insert(uint32_t index, SCALAR_TYPE value);
// BLENDV
UME_FUNC_ATTRIB DERIVED_VEC_TYPE blend (MASK_TYPE const & mask, DERIVED_VEC_TYPE const & b) const {
UME_EMULATION_WARNING();
return SCALAR_EMULATION::blend<DERIVED_VEC_TYPE, MASK_TYPE> (mask, static_cast<DERIVED_VEC_TYPE const &>(*this), b);
}
// BLENDS
UME_FUNC_ATTRIB DERIVED_VEC_TYPE blend (MASK_TYPE const & mask, SCALAR_TYPE b) const {
UME_EMULATION_WARNING();
return SCALAR_EMULATION::blend<DERIVED_VEC_TYPE, SCALAR_TYPE, MASK_TYPE> (mask, static_cast<DERIVED_VEC_TYPE const &>(*this), b);
}
// SWIZZLE
UME_FUNC_ATTRIB DERIVED_VEC_TYPE swizzle (SWIZZLE_MASK_TYPE const & sMask) const {