aboutsummaryrefslogtreecommitdiff
path: root/include/psimd.h
blob: 1aa101434857593d3bdcb28dffb19288e664eda2 (plain)
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
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
#pragma once
#ifndef PSIMD_H
#define PSIMD_H

#if defined(__CUDA_ARCH__)
	/* CUDA compiler */
	#define PSIMD_INTRINSIC __forceinline__ __device__
#elif defined(__OPENCL_VERSION__)
	/* OpenCL compiler */
	#define PSIMD_INTRINSIC inline static
#elif defined(__INTEL_COMPILER)
	/* Intel compiler, even on Windows */
	#define PSIMD_INTRINSIC inline static __attribute__((__always_inline__))
#elif defined(__GNUC__)
	/* GCC-compatible compiler (gcc/clang/icc) */
	#define PSIMD_INTRINSIC inline static __attribute__((__always_inline__))
#elif defined(_MSC_VER)
	/* MSVC-compatible compiler (cl/icl/clang-cl) */
	#define PSIMD_INTRINSIC __forceinline static
#elif defined(__cplusplus)
	/* Generic C++ compiler */
	#define PSIMD_INTRINSIC inline static
#elif defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L)
	/* Generic C99 compiler */
	#define PSIMD_INTRINSIC inline static
#else
	/* Generic C compiler */
	#define PSIMD_INTRINSIC static
#endif

#if defined(__GNUC__)
	#if defined(__ARM_NEON__) || defined(__ARM_NEON)
		#include <arm_neon.h>
	#endif

	#if defined(__SSE2__)
		#include <emmintrin.h>
	#endif

	#if defined(__SSE3__)
		#include <pmmintrin.h>
	#endif

	#if defined(__SSSE3__)
		#include <tmmintrin.h>
	#endif

	#if defined(__SSE4_1__)
		#include <smmintrin.h>
	#endif

	#if defined(__SSE4_2__)
		#include <nmmintrin.h>
	#endif

	#if defined(__AVX__)
		#include <immintrin.h>
	#endif
#elif defined(_MSC_VER)
	#include <intrin.h>
#endif

#if defined(__cplusplus)
	#define PSIMD_CXX_SYNTAX
#elif defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 201112L)
	#define PSIMD_C11_SYNTAX
#elif defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L)
	#define PSIMD_C99_SYNTAX
#else
	#define PSIMD_C89_SYNTAX
#endif

#if defined(__cplusplus) && (__cplusplus >= 201103L)
	#include <cstddef>
	#include <cstdint>
#elif !defined(__OPENCL_VERSION__)
	#include <stddef.h>
	#include <stdint.h>
#endif

#if defined(__GNUC__)
	#define PSIMD_HAVE_F64 0
	#define PSIMD_HAVE_F32 1
	#define PSIMD_HAVE_U8 1
	#define PSIMD_HAVE_S8 1
	#define PSIMD_HAVE_U16 1
	#define PSIMD_HAVE_S16 1
	#define PSIMD_HAVE_U32 1
	#define PSIMD_HAVE_S32 1
	#define PSIMD_HAVE_U64 0
	#define PSIMD_HAVE_S64 0

	typedef int8_t   psimd_s8  __attribute__((vector_size(16), aligned(1)));
	typedef uint8_t  psimd_u8  __attribute__((vector_size(16), aligned(1)));
	typedef int16_t  psimd_s16 __attribute__((vector_size(16), aligned(2)));
	typedef uint16_t psimd_u16 __attribute__((vector_size(16), aligned(2)));
	typedef int32_t  psimd_s32 __attribute__((vector_size(16), aligned(4)));
	typedef uint32_t psimd_u32 __attribute__((vector_size(16), aligned(4)));
	typedef float    psimd_f32 __attribute__((vector_size(16), aligned(4)));

	typedef struct {
		psimd_s8 lo;
		psimd_s8 hi;
	} psimd_s8x2;

	typedef struct {
		psimd_u8 lo;
		psimd_u8 hi;
	} psimd_u8x2;

	typedef struct {
		psimd_s16 lo;
		psimd_s16 hi;
	} psimd_s16x2;

	typedef struct {
		psimd_u16 lo;
		psimd_u16 hi;
	} psimd_u16x2;

	typedef struct {
		psimd_s32 lo;
		psimd_s32 hi;
	} psimd_s32x2;

	typedef struct {
		psimd_u32 lo;
		psimd_u32 hi;
	} psimd_u32x2;

	typedef struct {
		psimd_f32 lo;
		psimd_f32 hi;
	} psimd_f32x2;

	/* Bit casts */
	PSIMD_INTRINSIC psimd_u32x2 psimd_cast_s32x2_u32x2(psimd_s32x2 v) {
		return (psimd_u32x2) { .lo = (psimd_u32) v.lo, .hi = (psimd_u32) v.hi };
	}

	PSIMD_INTRINSIC psimd_f32x2 psimd_cast_s32x2_f32x2(psimd_s32x2 v) {
		return (psimd_f32x2) { .lo = (psimd_f32) v.lo, .hi = (psimd_f32) v.hi };
	}

	PSIMD_INTRINSIC psimd_s32x2 psimd_cast_u32x2_s32x2(psimd_u32x2 v) {
		return (psimd_s32x2) { .lo = (psimd_s32) v.lo, .hi = (psimd_s32) v.hi };
	}

	PSIMD_INTRINSIC psimd_f32x2 psimd_cast_u32x2_f32x2(psimd_u32x2 v) {
		return (psimd_f32x2) { .lo = (psimd_f32) v.lo, .hi = (psimd_f32) v.hi };
	}

	PSIMD_INTRINSIC psimd_s32x2 psimd_cast_f32x2_s32x2(psimd_f32x2 v) {
		return (psimd_s32x2) { .lo = (psimd_s32) v.lo, .hi = (psimd_s32) v.hi };
	}

	PSIMD_INTRINSIC psimd_u32x2 psimd_cast_f32x2_u32x2(psimd_f32x2 v) {
		return (psimd_u32x2) { .lo = (psimd_u32) v.lo, .hi = (psimd_u32) v.hi };
	}

	/* Swap */
	PSIMD_INTRINSIC void psimd_swap_s8(psimd_s8 a[1], psimd_s8 b[1]) {
		const psimd_s8 new_a = *b;
		const psimd_s8 new_b = *a;
		*a = new_a;
		*b = new_b;
	}

	PSIMD_INTRINSIC void psimd_swap_u8(psimd_u8 a[1], psimd_u8 b[1]) {
		const psimd_u8 new_a = *b;
		const psimd_u8 new_b = *a;
		*a = new_a;
		*b = new_b;
	}

	PSIMD_INTRINSIC void psimd_swap_s16(psimd_s16 a[1], psimd_s16 b[1]) {
		const psimd_s16 new_a = *b;
		const psimd_s16 new_b = *a;
		*a = new_a;
		*b = new_b;
	}

	PSIMD_INTRINSIC void psimd_swap_u16(psimd_u16 a[1], psimd_u16 b[1]) {
		const psimd_u16 new_a = *b;
		const psimd_u16 new_b = *a;
		*a = new_a;
		*b = new_b;
	}

	PSIMD_INTRINSIC void psimd_swap_s32(psimd_s32 a[1], psimd_s32 b[1]) {
		const psimd_s32 new_a = *b;
		const psimd_s32 new_b = *a;
		*a = new_a;
		*b = new_b;
	}

	PSIMD_INTRINSIC void psimd_swap_u32(psimd_u32 a[1], psimd_u32 b[1]) {
		const psimd_u32 new_a = *b;
		const psimd_u32 new_b = *a;
		*a = new_a;
		*b = new_b;
	}

	PSIMD_INTRINSIC void psimd_swap_f32(psimd_f32 a[1], psimd_f32 b[1]) {
		const psimd_f32 new_a = *b;
		const psimd_f32 new_b = *a;
		*a = new_a;
		*b = new_b;
	}

	/* Zero-initialization */
	PSIMD_INTRINSIC psimd_s8 psimd_zero_s8(void) {
		return (psimd_s8) { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
	}

	PSIMD_INTRINSIC psimd_u8 psimd_zero_u8(void) {
		return (psimd_u8) { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
	}

	PSIMD_INTRINSIC psimd_s16 psimd_zero_s16(void) {
		return (psimd_s16) { 0, 0, 0, 0, 0, 0, 0, 0 };
	}

	PSIMD_INTRINSIC psimd_u16 psimd_zero_u16(void) {
		return (psimd_u16) { 0, 0, 0, 0, 0, 0, 0, 0 };
	}

	PSIMD_INTRINSIC psimd_s32 psimd_zero_s32(void) {
		return (psimd_s32) { 0, 0, 0, 0 };
	}

	PSIMD_INTRINSIC psimd_u32 psimd_zero_u32(void) {
		return (psimd_u32) { 0, 0, 0, 0 };
	}

	PSIMD_INTRINSIC psimd_f32 psimd_zero_f32(void) {
		return (psimd_f32) { 0.0f, 0.0f, 0.0f, 0.0f };
	}

	/* Initialization to the same constant */
	PSIMD_INTRINSIC psimd_s8 psimd_splat_s8(int8_t c) {
		return (psimd_s8) { c, c, c, c, c, c, c, c, c, c, c, c, c, c, c, c };
	}

	PSIMD_INTRINSIC psimd_u8 psimd_splat_u8(uint8_t c) {
		return (psimd_u8) { c, c, c, c, c, c, c, c, c, c, c, c, c, c, c, c };
	}

	PSIMD_INTRINSIC psimd_s16 psimd_splat_s16(int16_t c) {
		return (psimd_s16) { c, c, c, c, c, c, c, c };
	}

	PSIMD_INTRINSIC psimd_u16 psimd_splat_u16(uint16_t c) {
		return (psimd_u16) { c, c, c, c, c, c, c, c };
	}

	PSIMD_INTRINSIC psimd_s32 psimd_splat_s32(int32_t c) {
		return (psimd_s32) { c, c, c, c };
	}

	PSIMD_INTRINSIC psimd_u32 psimd_splat_u32(uint32_t c) {
		return (psimd_u32) { c, c, c, c };
	}

	PSIMD_INTRINSIC psimd_f32 psimd_splat_f32(float c) {
		return (psimd_f32) { c, c, c, c };
	}

	/* Load vector */
	PSIMD_INTRINSIC psimd_s8 psimd_load_s8(const void* address) {
		return *((const psimd_s8*) address);
	}

	PSIMD_INTRINSIC psimd_u8 psimd_load_u8(const void* address) {
		return *((const psimd_u8*) address);
	}

	PSIMD_INTRINSIC psimd_s16 psimd_load_s16(const void* address) {
		return *((const psimd_s16*) address);
	}

	PSIMD_INTRINSIC psimd_u16 psimd_load_u16(const void* address) {
		return *((const psimd_u16*) address);
	}

	PSIMD_INTRINSIC psimd_s32 psimd_load_s32(const void* address) {
		return *((const psimd_s32*) address);
	}

	PSIMD_INTRINSIC psimd_u32 psimd_load_u32(const void* address) {
		return *((const psimd_u32*) address);
	}

	PSIMD_INTRINSIC psimd_f32 psimd_load_f32(const void* address) {
		return *((const psimd_f32*) address);
	}

	PSIMD_INTRINSIC psimd_s8 psimd_load_splat_s8(const void* address) {
		return psimd_splat_s8(*((const int8_t*) address));
	}

	PSIMD_INTRINSIC psimd_u8 psimd_load_splat_u8(const void* address) {
		return psimd_splat_u8(*((const uint8_t*) address));
	}

	PSIMD_INTRINSIC psimd_s16 psimd_load_splat_s16(const void* address) {
		return psimd_splat_s16(*((const int16_t*) address));
	}

	PSIMD_INTRINSIC psimd_u16 psimd_load_splat_u16(const void* address) {
		return psimd_splat_u16(*((const uint16_t*) address));
	}

	PSIMD_INTRINSIC psimd_s32 psimd_load_splat_s32(const void* address) {
		return psimd_splat_s32(*((const int32_t*) address));
	}

	PSIMD_INTRINSIC psimd_u32 psimd_load_splat_u32(const void* address) {
		return psimd_splat_u32(*((const uint32_t*) address));
	}

	PSIMD_INTRINSIC psimd_f32 psimd_load_splat_f32(const void* address) {
		return psimd_splat_f32(*((const float*) address));
	}

	PSIMD_INTRINSIC psimd_s32 psimd_load1_s32(const void* address) {
		return (psimd_s32) { *((const int32_t*) address), 0, 0, 0 };
	}

	PSIMD_INTRINSIC psimd_u32 psimd_load1_u32(const void* address) {
		return (psimd_u32) { *((const uint32_t*) address), 0, 0, 0 };
	}

	PSIMD_INTRINSIC psimd_f32 psimd_load1_f32(const void* address) {
		return (psimd_f32) { *((const float*) address), 0.0f, 0.0f, 0.0f };
	}

	PSIMD_INTRINSIC psimd_s32 psimd_load2_s32(const void* address) {
		const int32_t* address_s32 = (const int32_t*) address;
		return (psimd_s32) { address_s32[0], address_s32[1], 0, 0 };
	}

	PSIMD_INTRINSIC psimd_u32 psimd_load2_u32(const void* address) {
		const uint32_t* address_u32 = (const uint32_t*) address;
		return (psimd_u32) { address_u32[0], address_u32[1], 0, 0 };
	}

	PSIMD_INTRINSIC psimd_f32 psimd_load2_f32(const void* address) {
		const float* address_f32 = (const float*) address;
		return (psimd_f32) { address_f32[0], address_f32[1], 0.0f, 0.0f };
	}

	PSIMD_INTRINSIC psimd_s32 psimd_load3_s32(const void* address) {
		const int32_t* address_s32 = (const int32_t*) address;
		return (psimd_s32) { address_s32[0], address_s32[1], address_s32[2], 0 };
	}

	PSIMD_INTRINSIC psimd_u32 psimd_load3_u32(const void* address) {
		const uint32_t* address_u32 = (const uint32_t*) address;
		return (psimd_u32) { address_u32[0], address_u32[1], address_u32[2], 0 };
	}

	PSIMD_INTRINSIC psimd_f32 psimd_load3_f32(const void* address) {
		const float* address_f32 = (const float*) address;
		return (psimd_f32) { address_f32[0], address_f32[1], address_f32[2], 0.0f };
	}

	PSIMD_INTRINSIC psimd_s32 psimd_load4_s32(const void* address) {
		return psimd_load_s32(address);
	}

	PSIMD_INTRINSIC psimd_u32 psimd_load4_u32(const void* address) {
		return psimd_load_u32(address);
	}

	PSIMD_INTRINSIC psimd_f32 psimd_load4_f32(const void* address) {
		return psimd_load_f32(address);
	}

	PSIMD_INTRINSIC psimd_f32 psimd_load_stride2_f32(const void* address) {
		const psimd_f32 v0x1x = psimd_load_f32(address);
		const psimd_f32 vx2x3 = psimd_load_f32((const float*) address + 3);
		#if defined(__clang__)
			return __builtin_shufflevector(v0x1x, vx2x3, 0, 2, 5, 7);
		#else
			return __builtin_shuffle(v0x1x, vx2x3, (psimd_s32) { 0, 2, 5, 7 });
		#endif
	}

	PSIMD_INTRINSIC psimd_f32 psimd_load1_stride2_f32(const void* address) {
		return psimd_load_f32(address);
	}

	PSIMD_INTRINSIC psimd_f32 psimd_load2_stride2_f32(const void* address) {
		const float* address_f32 = (const float*) address;
		return (psimd_f32) { address_f32[0], address_f32[2], 0.0f, 0.0f };
	}

	PSIMD_INTRINSIC psimd_f32 psimd_load3_stride2_f32(const void* address) {
		const psimd_f32 v0x1x = psimd_load_f32(address);
		const psimd_f32 v2zzz = psimd_load1_f32((const float*) address + 2);
		#if defined(__clang__)
			return __builtin_shufflevector(v0x1x, v2zzz, 0, 2, 4, 6);
		#else
			return __builtin_shuffle(v0x1x, v2zzz, (psimd_s32) { 0, 2, 4, 6 });
		#endif
	}

	PSIMD_INTRINSIC psimd_f32 psimd_load4_stride2_f32(const void* address) {
		return psimd_load_stride2_f32(address);
	}

	PSIMD_INTRINSIC psimd_f32 psimd_load_stride_f32(const void* address, size_t stride) {
		const float* address0_f32 = (const float*) address;
		const float* address1_f32 = address0_f32 + stride;
		const float* address2_f32 = address1_f32 + stride;
		const float* address3_f32 = address2_f32 + stride;
		return (psimd_f32) { *address0_f32, *address1_f32, *address2_f32, *address3_f32 };
	}

	PSIMD_INTRINSIC psimd_f32 psimd_load1_stride_f32(const void* address, size_t stride) {
		return psimd_load1_f32(address);
	}

	PSIMD_INTRINSIC psimd_f32 psimd_load2_stride_f32(const void* address, size_t stride) {
		const float* address_f32 = (const float*) address;
		return (psimd_f32) { address_f32[0], address_f32[stride], 0.0f, 0.0f };
	}

	PSIMD_INTRINSIC psimd_f32 psimd_load3_stride_f32(const void* address, size_t stride) {
		const float* address0_f32 = (const float*) address;
		const float* address1_f32 = address0_f32 + stride;
		const float* address2_f32 = address1_f32 + stride;
		return (psimd_f32) { *address0_f32, *address1_f32, *address2_f32, 0.0f };
	}

	PSIMD_INTRINSIC psimd_f32 psimd_load4_stride_f32(const void* address, size_t stride) {
		return psimd_load_stride_f32(address, stride);
	}

	/* Store vector */
	PSIMD_INTRINSIC void psimd_store_s8(void* address, psimd_s8 value) {
		*((psimd_s8*) address) = value;
	}

	PSIMD_INTRINSIC void psimd_store_u8(void* address, psimd_u8 value) {
		*((psimd_u8*) address) = value;
	}

	PSIMD_INTRINSIC void psimd_store_s16(void* address, psimd_s16 value) {
		*((psimd_s16*) address) = value;
	}

	PSIMD_INTRINSIC void psimd_store_u16(void* address, psimd_u16 value) {
		*((psimd_u16*) address) = value;
	}

	PSIMD_INTRINSIC void psimd_store_s32(void* address, psimd_s32 value) {
		*((psimd_s32*) address) = value;
	}

	PSIMD_INTRINSIC void psimd_store_u32(void* address, psimd_u32 value) {
		*((psimd_u32*) address) = value;
	}

	PSIMD_INTRINSIC void psimd_store_f32(void* address, psimd_f32 value) {
		*((psimd_f32*) address) = value;
	}

	PSIMD_INTRINSIC void psimd_store1_s32(void* address, psimd_s32 value) {
		*((int32_t*) address) = value[0];
	}

	PSIMD_INTRINSIC void psimd_store1_u32(void* address, psimd_u32 value) {
		*((uint32_t*) address) = value[0];
	}

	PSIMD_INTRINSIC void psimd_store1_f32(void* address, psimd_f32 value) {
		*((float*) address) = value[0];
	}

	PSIMD_INTRINSIC void psimd_store2_s32(void* address, psimd_s32 value) {
		int32_t* address_s32 = (int32_t*) address;
		address_s32[0] = value[0];
		address_s32[1] = value[1];
	}

	PSIMD_INTRINSIC void psimd_store2_u32(void* address, psimd_u32 value) {
		uint32_t* address_u32 = (uint32_t*) address;
		address_u32[0] = value[0];
		address_u32[1] = value[1];
	}

	PSIMD_INTRINSIC void psimd_store2_f32(void* address, psimd_f32 value) {
		float* address_f32 = (float*) address;
		address_f32[0] = value[0];
		address_f32[1] = value[1];
	}

	PSIMD_INTRINSIC void psimd_store3_s32(void* address, psimd_s32 value) {
		int32_t* address_s32 = (int32_t*) address;
		address_s32[0] = value[0];
		address_s32[1] = value[1];
		address_s32[2] = value[2];
	}

	PSIMD_INTRINSIC void psimd_store3_u32(void* address, psimd_u32 value) {
		uint32_t* address_u32 = (uint32_t*) address;
		address_u32[0] = value[0];
		address_u32[1] = value[1];
		address_u32[2] = value[2];
	}

	PSIMD_INTRINSIC void psimd_store3_f32(void* address, psimd_f32 value) {
		float* address_f32 = (float*) address;
		address_f32[0] = value[0];
		address_f32[1] = value[1];
		address_f32[2] = value[2];
	}

	PSIMD_INTRINSIC void psimd_store4_s32(void* address, psimd_s32 value) {
		psimd_store_s32(address, value);
	}

	PSIMD_INTRINSIC void psimd_store4_u32(void* address, psimd_u32 value) {
		psimd_store_u32(address, value);
	}

	PSIMD_INTRINSIC void psimd_store4_f32(void* address, psimd_f32 value) {
		psimd_store_f32(address, value);
	}

	PSIMD_INTRINSIC void psimd_store_stride_f32(void* address, size_t stride, psimd_f32 value) {
		float* address0_f32 = (float*) address;
		float* address1_f32 = address0_f32 + stride;
		float* address2_f32 = address1_f32 + stride;
		float* address3_f32 = address2_f32 + stride;
		*address0_f32 = value[0];
		*address1_f32 = value[1];
		*address2_f32 = value[2];
		*address3_f32 = value[3];
	}

	PSIMD_INTRINSIC void psimd_store1_stride_f32(void* address, size_t stride, psimd_f32 value) {
		psimd_store1_f32(address, value);
	}

	PSIMD_INTRINSIC void psimd_store2_stride_f32(void* address, size_t stride, psimd_f32 value) {
		float* address_f32 = (float*) address;
		address_f32[0]      = value[0];
		address_f32[stride] = value[1];
	}

	PSIMD_INTRINSIC void psimd_store3_stride_f32(void* address, size_t stride, psimd_f32 value) {
		float* address0_f32 = (float*) address;
		float* address1_f32 = address0_f32 + stride;
		float* address2_f32 = address1_f32 + stride;
		*address0_f32 = value[0];
		*address1_f32 = value[1];
		*address2_f32 = value[2];
	}

	/* Vector addition */
	PSIMD_INTRINSIC psimd_s8 psimd_add_s8(psimd_s8 a, psimd_s8 b) {
		return a + b;
	}

	PSIMD_INTRINSIC psimd_u8 psimd_add_u8(psimd_u8 a, psimd_u8 b) {
		return a + b;
	}

	PSIMD_INTRINSIC psimd_s16 psimd_add_s16(psimd_s16 a, psimd_s16 b) {
		return a + b;
	}

	PSIMD_INTRINSIC psimd_u16 psimd_add_u16(psimd_u16 a, psimd_u16 b) {
		return a + b;
	}

	PSIMD_INTRINSIC psimd_s32 psimd_add_s32(psimd_s32 a, psimd_s32 b) {
		return a + b;
	}

	PSIMD_INTRINSIC psimd_u32 psimd_add_u32(psimd_u32 a, psimd_u32 b) {
		return a + b;
	}

	PSIMD_INTRINSIC psimd_f32 psimd_add_f32(psimd_f32 a, psimd_f32 b) {
		#if defined(__ARM_ARCH_7A__) && defined(__ARM_NEON__) && !defined(__FAST_MATH__)
			return (psimd_f32) vaddq_f32((float32x4_t) a, (float32x4_t) b);
		#else
			return a + b;
		#endif
	}

	/* Vector subtraction */
	PSIMD_INTRINSIC psimd_s8 psimd_sub_s8(psimd_s8 a, psimd_s8 b) {
		return a - b;
	}

	PSIMD_INTRINSIC psimd_u8 psimd_sub_u8(psimd_u8 a, psimd_u8 b) {
		return a - b;
	}

	PSIMD_INTRINSIC psimd_s16 psimd_sub_s16(psimd_s16 a, psimd_s16 b) {
		return a - b;
	}

	PSIMD_INTRINSIC psimd_u16 psimd_sub_u16(psimd_u16 a, psimd_u16 b) {
		return a - b;
	}

	PSIMD_INTRINSIC psimd_s32 psimd_sub_s32(psimd_s32 a, psimd_s32 b) {
		return a - b;
	}

	PSIMD_INTRINSIC psimd_u32 psimd_sub_u32(psimd_u32 a, psimd_u32 b) {
		return a - b;
	}

	PSIMD_INTRINSIC psimd_f32 psimd_sub_f32(psimd_f32 a, psimd_f32 b) {
		#if defined(__ARM_ARCH_7A__) && defined(__ARM_NEON__) && !defined(__FAST_MATH__)
			return (psimd_f32) vsubq_f32((float32x4_t) a, (float32x4_t) b);
		#else
			return a - b;
		#endif
	}

	/* Vector multiplication */
	PSIMD_INTRINSIC psimd_s8 psimd_mul_s8(psimd_s8 a, psimd_s8 b) {
		return a * b;
	}

	PSIMD_INTRINSIC psimd_u8 psimd_mul_u8(psimd_u8 a, psimd_u8 b) {
		return a * b;
	}

	PSIMD_INTRINSIC psimd_s16 psimd_mul_s16(psimd_s16 a, psimd_s16 b) {
		return a * b;
	}

	PSIMD_INTRINSIC psimd_u16 psimd_mul_u16(psimd_u16 a, psimd_u16 b) {
		return a * b;
	}

	PSIMD_INTRINSIC psimd_s32 psimd_mul_s32(psimd_s32 a, psimd_s32 b) {
		return a * b;
	}

	PSIMD_INTRINSIC psimd_u32 psimd_mul_u32(psimd_u32 a, psimd_u32 b) {
		return a * b;
	}

	PSIMD_INTRINSIC psimd_f32 psimd_mul_f32(psimd_f32 a, psimd_f32 b) {
		#if defined(__ARM_ARCH_7A__) && defined(__ARM_NEON__) && !defined(__FAST_MATH__)
			return (psimd_f32) vmulq_f32((float32x4_t) a, (float32x4_t) b);
		#else
			return a * b;
		#endif
	}

	/* Quasi-Fused Multiply-Add */
	PSIMD_INTRINSIC psimd_f32 psimd_qfma_f32(psimd_f32 a, psimd_f32 b, psimd_f32 c) {
		#if defined(__aarch64__) || defined(__ARM_NEON__) && defined(__ARM_FEATURE_FMA)
			return (psimd_f32) vfmaq_f32((float32x4_t) a, (float32x4_t) b, (float32x4_t) c);
		#elif (defined(__x86_64__) || defined(__i386__) || defined(__i686__)) && defined(__FMA__)
			return (psimd_f32) _mm_fmadd_ps((__m128) c, (__m128) a, (__m128) b);
		#elif (defined(__x86_64__) || defined(__i386__) || defined(__i686__)) && defined(__FMA4__)
			return (psimd_f32) _mm_macc_ps((__m128) c, (__m128) a, (__m128) b);
		#elif defined(__wasm__) && defined(__wasm_simd128__) && defined(__clang__)
			return (psimd_f32) __builtin_wasm_qfma_f32x4(a, b, c);
		#else
			return a + b * c;
		#endif
	}

	PSIMD_INTRINSIC psimd_f32 psimd_div_f32(psimd_f32 a, psimd_f32 b) {
		return a / b;
	}

	/* Vector and */
	PSIMD_INTRINSIC psimd_f32 psimd_andmask_f32(psimd_s32 mask, psimd_f32 v) {
		return (psimd_f32) (mask & (psimd_s32) v);
	}

	/* Vector and-not */
	PSIMD_INTRINSIC psimd_f32 psimd_andnotmask_f32(psimd_s32 mask, psimd_f32 v) {
		return (psimd_f32) (~mask & (psimd_s32) v);
	}

	/* Vector blend */
	PSIMD_INTRINSIC psimd_s8 psimd_blend_s8(psimd_s8 mask, psimd_s8 a, psimd_s8 b) {
		#if defined(__ARM_NEON__) || defined(__ARM_NEON)
			return (psimd_s8) vbslq_s8((uint8x16_t) mask, (int8x16_t) a, (int8x16_t) b);
		#elif defined(__wasm__) && defined(__wasm_simd128__) && defined(__clang__)
			return (psimd_s8) __builtin_wasm_bitselect(a, b, mask);
		#else
			return (mask & a) | (~mask & b);
		#endif
	}

	PSIMD_INTRINSIC psimd_u8 psimd_blend_u8(psimd_s8 mask, psimd_u8 a, psimd_u8 b) {
		#if defined(__ARM_NEON__) || defined(__ARM_NEON)
			return (psimd_u8) vbslq_u8((uint8x16_t) mask, (uint8x16_t) a, (uint8x16_t) b);
		#elif defined(__wasm__) && defined(__wasm_simd128__) && defined(__clang__)
			return (psimd_u8) __builtin_wasm_bitselect(a, b, mask);
		#else
			return (psimd_u8) ((mask & (psimd_s8) a) | (~mask & (psimd_s8) b));
		#endif
	}
	
	PSIMD_INTRINSIC psimd_s16 psimd_blend_s16(psimd_s16 mask, psimd_s16 a, psimd_s16 b) {
		#if defined(__ARM_NEON__) || defined(__ARM_NEON)
			return (psimd_s16) vbslq_s16((uint16x8_t) mask, (int16x8_t) a, (int16x8_t) b);
		#elif defined(__wasm__) && defined(__wasm_simd128__) && defined(__clang__)
			return (psimd_s16) __builtin_wasm_bitselect(a, b, mask);
		#else
			return (mask & a) | (~mask & b);
		#endif
	}

	PSIMD_INTRINSIC psimd_u16 psimd_blend_u16(psimd_s16 mask, psimd_u16 a, psimd_u16 b) {
		#if defined(__ARM_NEON__) || defined(__ARM_NEON)
			return (psimd_u16) vbslq_u16((uint16x8_t) mask, (uint16x8_t) a, (uint16x8_t) b);
		#elif defined(__wasm__) && defined(__wasm_simd128__) && defined(__clang__)
			return (psimd_u16) __builtin_wasm_bitselect(a, b, mask);
		#else
			return (psimd_u16) ((mask & (psimd_s16) a) | (~mask & (psimd_s16) b));
		#endif
	}
	
	PSIMD_INTRINSIC psimd_s32 psimd_blend_s32(psimd_s32 mask, psimd_s32 a, psimd_s32 b) {
		#if defined(__ARM_NEON__) || defined(__ARM_NEON)
			return (psimd_s32) vbslq_s32((uint32x4_t) mask, (int32x4_t) a, (int32x4_t) b);
		#elif defined(__wasm__) && defined(__wasm_simd128__) && defined(__clang__)
			return (psimd_s32) __builtin_wasm_bitselect(a, b, mask);
		#else
			return (mask & a) | (~mask & b);
		#endif
	}

	PSIMD_INTRINSIC psimd_u32 psimd_blend_u32(psimd_s32 mask, psimd_u32 a, psimd_u32 b) {
		#if defined(__ARM_NEON__) || defined(__ARM_NEON)
			return (psimd_u32) vbslq_u32((uint32x4_t) mask, (uint32x4_t) a, (uint32x4_t) b);
		#elif defined(__wasm__) && defined(__wasm_simd128__) && defined(__clang__)
			return (psimd_u32) __builtin_wasm_bitselect(a, b, mask);
		#else
			return (psimd_u32) ((mask & (psimd_s32) a) | (~mask & (psimd_s32) b));
		#endif
	}
	
	PSIMD_INTRINSIC psimd_f32 psimd_blend_f32(psimd_s32 mask, psimd_f32 a, psimd_f32 b) {
		#if defined(__ARM_NEON__) || defined(__ARM_NEON)
			return (psimd_f32) vbslq_f32((uint32x4_t) mask, (float32x4_t) a, (float32x4_t) b);
		#elif defined(__wasm__) && defined(__wasm_simd128__) && defined(__clang__)
			return (psimd_f32) __builtin_wasm_bitselect(a, b, mask);
		#else
			return (psimd_f32) ((mask & (psimd_s32) a) | (~mask & (psimd_s32) b));
		#endif
	}

	/* Vector blend on sign */
	PSIMD_INTRINSIC psimd_s8 psimd_signblend_s8(psimd_s8 x, psimd_s8 a, psimd_s8 b) {
		return psimd_blend_s8(x >> psimd_splat_s8(7), a, b);
	}

	PSIMD_INTRINSIC psimd_u8 psimd_signblend_u8(psimd_s8 x, psimd_u8 a, psimd_u8 b) {
		return psimd_blend_u8((x >> psimd_splat_s8(7)), a, b);
	}

	PSIMD_INTRINSIC psimd_s16 psimd_signblend_s16(psimd_s16 x, psimd_s16 a, psimd_s16 b) {
		return psimd_blend_s16(x >> psimd_splat_s16(15), a, b);
	}

	PSIMD_INTRINSIC psimd_u16 psimd_signblend_u16(psimd_s16 x, psimd_u16 a, psimd_u16 b) {
		return psimd_blend_u16((x >> psimd_splat_s16(15)), a, b);
	}

	PSIMD_INTRINSIC psimd_s32 psimd_signblend_s32(psimd_s32 x, psimd_s32 a, psimd_s32 b) {
		return psimd_blend_s32(x >> psimd_splat_s32(31), a, b);
	}

	PSIMD_INTRINSIC psimd_u32 psimd_signblend_u32(psimd_s32 x, psimd_u32 a, psimd_u32 b) {
		return psimd_blend_u32((x >> psimd_splat_s32(31)), a, b);
	}

	PSIMD_INTRINSIC psimd_f32 psimd_signblend_f32(psimd_f32 x, psimd_f32 a, psimd_f32 b) {
		const psimd_s32 mask = (psimd_s32) x >> psimd_splat_s32(31);
		return psimd_blend_f32(mask, a, b);
	}

	/* Vector absolute value */
	PSIMD_INTRINSIC psimd_f32 psimd_abs_f32(psimd_f32 v) {
		const psimd_s32 mask = (psimd_s32) psimd_splat_f32(-0.0f);
		return (psimd_f32) ((psimd_s32) v & ~mask);
	}

	/* Vector negation */
	PSIMD_INTRINSIC psimd_f32 psimd_neg_f32(psimd_f32 v) {
		const psimd_s32 mask = (psimd_s32) psimd_splat_f32(-0.0f);
		return (psimd_f32) ((psimd_s32) v ^ mask);
	}

	/* Vector maximum */
	PSIMD_INTRINSIC psimd_s8 psimd_max_s8(psimd_s8 a, psimd_s8 b) {
		#if defined(__ARM_NEON__) || defined(__ARM_NEON)
			return (psimd_s8) vmaxq_s8((int8x16_t) a, (int8x16_t) b);
		#else
			return psimd_blend_s8(a > b, a, b);
		#endif
	}

	PSIMD_INTRINSIC psimd_u8 psimd_max_u8(psimd_u8 a, psimd_u8 b) {
		#if defined(__ARM_NEON__) || defined(__ARM_NEON)
			return (psimd_u8) vmaxq_u8((uint8x16_t) a, (uint8x16_t) b);
		#else
			return psimd_blend_u8(a > b, a, b);
		#endif
	}

	PSIMD_INTRINSIC psimd_s16 psimd_max_s16(psimd_s16 a, psimd_s16 b) {
		#if defined(__ARM_NEON__) || defined(__ARM_NEON)
			return (psimd_s16) vmaxq_s16((int16x8_t) a, (int16x8_t) b);
		#else
			return psimd_blend_s16(a > b, a, b);
		#endif
	}

	PSIMD_INTRINSIC psimd_u16 psimd_max_u16(psimd_u16 a, psimd_u16 b) {
		#if defined(__ARM_NEON__) || defined(__ARM_NEON)
			return (psimd_u16) vmaxq_u16((uint16x8_t) a, (uint16x8_t) b);
		#else
			return psimd_blend_u16(a > b, a, b);
		#endif
	}

	PSIMD_INTRINSIC psimd_s32 psimd_max_s32(psimd_s32 a, psimd_s32 b) {
		#if defined(__ARM_NEON__) || defined(__ARM_NEON)
			return (psimd_s32) vmaxq_s32((int32x4_t) a, (int32x4_t) b);
		#else
			return psimd_blend_s32(a > b, a, b);
		#endif
	}

	PSIMD_INTRINSIC psimd_u32 psimd_max_u32(psimd_u32 a, psimd_u32 b) {
		#if defined(__ARM_NEON__) || defined(__ARM_NEON)
			return (psimd_u32) vmaxq_u32((uint32x4_t) a, (uint32x4_t) b);
		#else
			return psimd_blend_u32(a > b, a, b);
		#endif
	}

	PSIMD_INTRINSIC psimd_f32 psimd_max_f32(psimd_f32 a, psimd_f32 b) {
		#if defined(__ARM_NEON__) || defined(__ARM_NEON)
			return (psimd_f32) vmaxq_f32((float32x4_t) a, (float32x4_t) b);
		#elif defined(__wasm__) && defined(__wasm_simd128__) && defined(__clang__)
			return __builtin_wasm_max_f32x4(a, b);
		#else
			return psimd_blend_f32(a > b, a, b);
		#endif
	}

	/* Vector minimum */
	PSIMD_INTRINSIC psimd_s8 psimd_min_s8(psimd_s8 a, psimd_s8 b) {
		#if defined(__ARM_NEON__) || defined(__ARM_NEON)
			return (psimd_s8) vminq_s8((int8x16_t) a, (int8x16_t) b);
		#else
			return psimd_blend_s8(a < b, a, b);
		#endif
	}

	PSIMD_INTRINSIC psimd_u8 psimd_min_u8(psimd_u8 a, psimd_u8 b) {
		#if defined(__ARM_NEON__) || defined(__ARM_NEON)
			return (psimd_u8) vminq_u8((uint8x16_t) a, (uint8x16_t) b);
		#else
			return psimd_blend_u8(a < b, a, b);
		#endif
	}

	PSIMD_INTRINSIC psimd_s16 psimd_min_s16(psimd_s16 a, psimd_s16 b) {
		#if defined(__ARM_NEON__) || defined(__ARM_NEON)
			return (psimd_s16) vminq_s16((int16x8_t) a, (int16x8_t) b);
		#else
			return psimd_blend_s16(a < b, a, b);
		#endif
	}

	PSIMD_INTRINSIC psimd_u16 psimd_min_u16(psimd_u16 a, psimd_u16 b) {
		#if defined(__ARM_NEON__) || defined(__ARM_NEON)
			return (psimd_u16) vminq_u16((uint16x8_t) a, (uint16x8_t) b);
		#else
			return psimd_blend_u16(a < b, a, b);
		#endif
	}

	PSIMD_INTRINSIC psimd_s32 psimd_min_s32(psimd_s32 a, psimd_s32 b) {
		#if defined(__ARM_NEON__) || defined(__ARM_NEON)
			return (psimd_s32) vminq_s32((int32x4_t) a, (int32x4_t) b);
		#else
			return psimd_blend_s32(a < b, a, b);
		#endif
	}

	PSIMD_INTRINSIC psimd_u32 psimd_min_u32(psimd_u32 a, psimd_u32 b) {
		#if defined(__ARM_NEON__) || defined(__ARM_NEON)
			return (psimd_u32) vminq_u32((uint32x4_t) a, (uint32x4_t) b);
		#else
			return psimd_blend_u32(a < b, a, b);
		#endif
	}

	PSIMD_INTRINSIC psimd_f32 psimd_min_f32(psimd_f32 a, psimd_f32 b) {
		#if defined(__ARM_NEON__) || defined(__ARM_NEON)
			return (psimd_f32) vminq_f32((float32x4_t) a, (float32x4_t) b);
		#elif defined(__wasm__) && defined(__wasm_simd128__) && defined(__clang__)
			return __builtin_wasm_min_f32x4(a, b);
		#else
			return psimd_blend_f32(a < b, a, b);
		#endif
	}

	PSIMD_INTRINSIC psimd_f32 psimd_cvt_s32_f32(psimd_s32 v) {
		#if defined(__clang__)
			return __builtin_convertvector(v, psimd_f32);
		#elif defined(__ARM_NEON__) || defined(__ARM_NEON)
			return (psimd_f32) vcvtq_f32_s32((int32x4_t) v);
		#elif defined(__SSE2__)
			return (psimd_f32) _mm_cvtepi32_ps((__m128i) v);
		#else
			return (psimd_f32) { (float) v[0], (float) v[1], (float) v[2], (float) v[3] };
		#endif
	}

	/* Broadcast vector element */
	#if defined(__clang__)
		PSIMD_INTRINSIC psimd_f32 psimd_splat0_f32(psimd_f32 v) {
			return __builtin_shufflevector(v, v, 0, 0, 0, 0);
		}

		PSIMD_INTRINSIC psimd_f32 psimd_splat1_f32(psimd_f32 v) {
			return __builtin_shufflevector(v, v, 1, 1, 1, 1);
		}

		PSIMD_INTRINSIC psimd_f32 psimd_splat2_f32(psimd_f32 v) {
			return __builtin_shufflevector(v, v, 2, 2, 2, 2);
		}

		PSIMD_INTRINSIC psimd_f32 psimd_splat3_f32(psimd_f32 v) {
			return __builtin_shufflevector(v, v, 3, 3, 3, 3);
		}
	#else
		PSIMD_INTRINSIC psimd_f32 psimd_splat0_f32(psimd_f32 v) {
			return __builtin_shuffle(v, (psimd_s32) { 0, 0, 0, 0 });
		}

		PSIMD_INTRINSIC psimd_f32 psimd_splat1_f32(psimd_f32 v) {
			return __builtin_shuffle(v, (psimd_s32) { 1, 1, 1, 1 });
		}

		PSIMD_INTRINSIC psimd_f32 psimd_splat2_f32(psimd_f32 v) {
			return __builtin_shuffle(v, (psimd_s32) { 2, 2, 2, 2 });
		}

		PSIMD_INTRINSIC psimd_f32 psimd_splat3_f32(psimd_f32 v) {
			return __builtin_shuffle(v, (psimd_s32) { 3, 3, 3, 3 });
		}
	#endif

	/* Reversal of vector elements */
	#if defined(__clang__)
		PSIMD_INTRINSIC psimd_s8 psimd_reverse_s8(psimd_s8 v) {
			return __builtin_shufflevector(v, v, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0);
		}

		PSIMD_INTRINSIC psimd_u8 psimd_reverse_u8(psimd_u8 v) {
			return __builtin_shufflevector(v, v, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0);
		}

		PSIMD_INTRINSIC psimd_s16 psimd_reverse_s16(psimd_s16 v) {
			return __builtin_shufflevector(v, v, 7, 6, 5, 4, 3, 2, 1, 0);
		}

		PSIMD_INTRINSIC psimd_u16 psimd_reverse_u16(psimd_u16 v) {
			return __builtin_shufflevector(v, v, 7, 6, 5, 4, 3, 2, 1, 0);
		}

		PSIMD_INTRINSIC psimd_s32 psimd_reverse_s32(psimd_s32 v) {
			return __builtin_shufflevector(v, v, 3, 2, 1, 0);
		}

		PSIMD_INTRINSIC psimd_u32 psimd_reverse_u32(psimd_u32 v) {
			return __builtin_shufflevector(v, v, 3, 2, 1, 0);
		}

		PSIMD_INTRINSIC psimd_f32 psimd_reverse_f32(psimd_f32 v) {
			return __builtin_shufflevector(v, v, 3, 2, 1, 0);
		}
	#else
		PSIMD_INTRINSIC psimd_s8 psimd_reverse_s8(psimd_s8 v) {
			return __builtin_shuffle(v, (psimd_s8) { 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0 });
		}

		PSIMD_INTRINSIC psimd_u8 psimd_reverse_u8(psimd_u8 v) {
			return __builtin_shuffle(v, (psimd_s8) { 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0 });
		}

		PSIMD_INTRINSIC psimd_s16 psimd_reverse_s16(psimd_s16 v) {
			return __builtin_shuffle(v, (psimd_s16) { 7, 6, 5, 4, 3, 2, 1, 0 });
		}

		PSIMD_INTRINSIC psimd_u16 psimd_reverse_u16(psimd_u16 v) {
			return __builtin_shuffle(v, (psimd_s16) { 7, 6, 5, 4, 3, 2, 1, 0 });
		}

		PSIMD_INTRINSIC psimd_s32 psimd_reverse_s32(psimd_s32 v) {
			return __builtin_shuffle(v, (psimd_s32) { 3, 2, 1, 0 });
		}

		PSIMD_INTRINSIC psimd_u32 psimd_reverse_u32(psimd_u32 v) {
			return __builtin_shuffle(v, (psimd_s32) { 3, 2, 1, 0 });
		}

		PSIMD_INTRINSIC psimd_f32 psimd_reverse_f32(psimd_f32 v) {
			return __builtin_shuffle(v, (psimd_s32) { 3, 2, 1, 0 });
		}
	#endif

	/* Interleaving of vector elements */
	#if defined(__clang__)
		PSIMD_INTRINSIC psimd_s16 psimd_interleave_lo_s16(psimd_s16 a, psimd_s16 b) {
			return __builtin_shufflevector(a, b, 0, 8+0, 1, 8+1, 2, 8+2, 3, 8+3);
		}

		PSIMD_INTRINSIC psimd_s16 psimd_interleave_hi_s16(psimd_s16 a, psimd_s16 b) {
			return __builtin_shufflevector(a, b, 4, 8+4, 5, 8+5, 6, 8+6, 7, 8+7);
		}

		PSIMD_INTRINSIC psimd_u16 psimd_interleave_lo_u16(psimd_u16 a, psimd_u16 b) {
			return __builtin_shufflevector(a, b, 0, 8+0, 1, 8+1, 2, 8+2, 3, 8+3);
		}

		PSIMD_INTRINSIC psimd_u16 psimd_interleave_hi_u16(psimd_u16 a, psimd_u16 b) {
			return __builtin_shufflevector(a, b, 4, 8+4, 5, 8+5, 6, 8+6, 7, 8+7);
		}

		PSIMD_INTRINSIC psimd_s32 psimd_interleave_lo_s32(psimd_s32 a, psimd_s32 b) {
			return __builtin_shufflevector(a, b, 0, 4+0, 1, 4+1);
		}

		PSIMD_INTRINSIC psimd_s32 psimd_interleave_hi_s32(psimd_s32 a, psimd_s32 b) {
			return __builtin_shufflevector(a, b, 2, 4+2, 3, 4+3);
		}

		PSIMD_INTRINSIC psimd_u32 psimd_interleave_lo_u32(psimd_u32 a, psimd_u32 b) {
			return __builtin_shufflevector(a, b, 0, 4+0, 1, 4+1);
		}

		PSIMD_INTRINSIC psimd_u32 psimd_interleave_hi_u32(psimd_u32 a, psimd_u32 b) {
			return __builtin_shufflevector(a, b, 2, 4+2, 3, 4+3);
		}

		PSIMD_INTRINSIC psimd_f32 psimd_interleave_lo_f32(psimd_f32 a, psimd_f32 b) {
			return __builtin_shufflevector(a, b, 0, 4+0, 1, 4+1);
		}

		PSIMD_INTRINSIC psimd_f32 psimd_interleave_hi_f32(psimd_f32 a, psimd_f32 b) {
			return __builtin_shufflevector(a, b, 2, 4+2, 3, 4+3);
		}
	#else
		PSIMD_INTRINSIC psimd_s16 psimd_interleave_lo_s16(psimd_s16 a, psimd_s16 b) {
			return __builtin_shuffle(a, b, (psimd_s16) { 0, 8+0, 1, 8+1, 2, 8+2, 3, 8+3 });
		}

		PSIMD_INTRINSIC psimd_s16 psimd_interleave_hi_s16(psimd_s16 a, psimd_s16 b) {
			return __builtin_shuffle(a, b, (psimd_s16) { 4, 8+4, 5, 8+5, 6, 8+6, 7, 8+7 });
		}

		PSIMD_INTRINSIC psimd_u16 psimd_interleave_lo_u16(psimd_u16 a, psimd_u16 b) {
			return __builtin_shuffle(a, b, (psimd_s16) { 0, 8+0, 1, 8+1, 2, 8+2, 3, 8+3 });
		}

		PSIMD_INTRINSIC psimd_u16 psimd_interleave_hi_u16(psimd_u16 a, psimd_u16 b) {
			return __builtin_shuffle(a, b, (psimd_s16) { 4, 8+4, 5, 8+5, 6, 8+6, 7, 8+7 });
		}

		PSIMD_INTRINSIC psimd_s32 psimd_interleave_lo_s32(psimd_s32 a, psimd_s32 b) {
			return __builtin_shuffle(a, b, (psimd_s32) { 0, 4+0, 1, 4+1 });
		}

		PSIMD_INTRINSIC psimd_s32 psimd_interleave_hi_s32(psimd_s32 a, psimd_s32 b) {
			return __builtin_shuffle(a, b, (psimd_s32) { 2, 4+2, 3, 4+3 });
		}

		PSIMD_INTRINSIC psimd_u32 psimd_interleave_lo_u32(psimd_u32 a, psimd_u32 b) {
			return __builtin_shuffle(a, b, (psimd_s32) { 0, 4+0, 1, 4+1 });
		}

		PSIMD_INTRINSIC psimd_u32 psimd_interleave_hi_u32(psimd_u32 a, psimd_u32 b) {
			return __builtin_shuffle(a, b, (psimd_s32) { 2, 4+2, 3, 4+3 });
		}

		PSIMD_INTRINSIC psimd_f32 psimd_interleave_lo_f32(psimd_f32 a, psimd_f32 b) {
			return __builtin_shuffle(a, b, (psimd_s32) { 0, 4+0, 1, 4+1 });
		}

		PSIMD_INTRINSIC psimd_f32 psimd_interleave_hi_f32(psimd_f32 a, psimd_f32 b) {
			return __builtin_shuffle(a, b, (psimd_s32) { 2, 4+2, 3, 4+3 });
		}
	#endif

	/* Concatenation of low/high vector elements */
	#if defined(__clang__)
		PSIMD_INTRINSIC psimd_s16 psimd_concat_lo_s16(psimd_s16 a, psimd_s16 b) {
			return __builtin_shufflevector(a, b, 0, 1, 2, 3, 8+0, 8+1, 8+2, 8+3);
		}

		PSIMD_INTRINSIC psimd_s16 psimd_concat_hi_s16(psimd_s16 a, psimd_s16 b) {
			return __builtin_shufflevector(a, b, 4, 5, 6, 7, 8+4, 8+5, 8+6, 8+7);
		}

		PSIMD_INTRINSIC psimd_u16 psimd_concat_lo_u16(psimd_u16 a, psimd_u16 b) {
			return __builtin_shufflevector(a, b, 0, 1, 2, 3, 8+0, 8+1, 8+2, 8+3);
		}

		PSIMD_INTRINSIC psimd_u16 psimd_concat_hi_u16(psimd_u16 a, psimd_u16 b) {
			return __builtin_shufflevector(a, b, 4, 5, 6, 7, 8+4, 8+5, 8+6, 8+7);
		}

		PSIMD_INTRINSIC psimd_s32 psimd_concat_lo_s32(psimd_s32 a, psimd_s32 b) {
			return __builtin_shufflevector(a, b, 0, 1, 4+0, 4+1);
		}

		PSIMD_INTRINSIC psimd_s32 psimd_concat_hi_s32(psimd_s32 a, psimd_s32 b) {
			return __builtin_shufflevector(a, b, 2, 3, 4+2, 4+3);
		}

		PSIMD_INTRINSIC psimd_u32 psimd_concat_lo_u32(psimd_u32 a, psimd_u32 b) {
			return __builtin_shufflevector(a, b, 0, 1, 4+0, 4+1);
		}

		PSIMD_INTRINSIC psimd_u32 psimd_concat_hi_u32(psimd_u32 a, psimd_u32 b) {
			return __builtin_shufflevector(a, b, 2, 3, 4+2, 4+3);
		}

		PSIMD_INTRINSIC psimd_f32 psimd_concat_lo_f32(psimd_f32 a, psimd_f32 b) {
			return __builtin_shufflevector(a, b, 0, 1, 4+0, 4+1);
		}

		PSIMD_INTRINSIC psimd_f32 psimd_concat_hi_f32(psimd_f32 a, psimd_f32 b) {
			return __builtin_shufflevector(a, b, 2, 3, 4+2, 4+3);
		}
	#else
		PSIMD_INTRINSIC psimd_s16 psimd_concat_lo_s16(psimd_s16 a, psimd_s16 b) {
			return __builtin_shuffle(a, b, (psimd_s16) { 0, 1, 2, 3, 8+0, 8+1, 8+2, 8+3 });
		}

		PSIMD_INTRINSIC psimd_s16 psimd_concat_hi_s16(psimd_s16 a, psimd_s16 b) {
			return __builtin_shuffle(a, b, (psimd_s16) { 4, 5, 6, 7, 8+4, 8+5, 8+6, 8+7 });
		}

		PSIMD_INTRINSIC psimd_u16 psimd_concat_lo_u16(psimd_u16 a, psimd_u16 b) {
			return __builtin_shuffle(a, b, (psimd_s16) { 0, 1, 2, 3, 8+0, 8+1, 8+2, 8+3 });
		}

		PSIMD_INTRINSIC psimd_u16 psimd_concat_hi_u16(psimd_u16 a, psimd_u16 b) {
			return __builtin_shuffle(a, b, (psimd_s16) { 4, 5, 6, 7, 8+4, 8+5, 8+6, 8+7 });
		}

		PSIMD_INTRINSIC psimd_s32 psimd_concat_lo_s32(psimd_s32 a, psimd_s32 b) {
			return __builtin_shuffle(a, b, (psimd_s32) { 0, 1, 4+0, 4+1 });
		}

		PSIMD_INTRINSIC psimd_s32 psimd_concat_hi_s32(psimd_s32 a, psimd_s32 b) {
			return __builtin_shuffle(a, b, (psimd_s32) { 2, 3, 4+2, 4+3 });
		}

		PSIMD_INTRINSIC psimd_u32 psimd_concat_lo_u32(psimd_u32 a, psimd_u32 b) {
			return __builtin_shuffle(a, b, (psimd_s32) { 0, 1, 4+0, 4+1 });
		}

		PSIMD_INTRINSIC psimd_u32 psimd_concat_hi_u32(psimd_u32 a, psimd_u32 b) {
			return __builtin_shuffle(a, b, (psimd_s32) { 2, 3, 4+2, 4+3 });
		}

		PSIMD_INTRINSIC psimd_f32 psimd_concat_lo_f32(psimd_f32 a, psimd_f32 b) {
			return __builtin_shuffle(a, b, (psimd_s32) { 0, 1, 4+0, 4+1 });
		}

		PSIMD_INTRINSIC psimd_f32 psimd_concat_hi_f32(psimd_f32 a, psimd_f32 b) {
			return __builtin_shuffle(a, b, (psimd_s32) { 2, 3, 4+2, 4+3 });
		}
	#endif

	/* Concatenation of even/odd vector elements */
	#if defined(__clang__)
		PSIMD_INTRINSIC psimd_s8 psimd_concat_even_s8(psimd_s8 a, psimd_s8 b) {
			return __builtin_shufflevector(a, b,
				0, 2, 4, 6, 8, 10, 12, 14, 16+0, 16+2, 16+4, 16+6, 16+8, 16+10, 16+12, 16+14);
		}

		PSIMD_INTRINSIC psimd_s8 psimd_concat_odd_s8(psimd_s8 a, psimd_s8 b) {
			return __builtin_shufflevector(a, b,
				1, 3, 5, 7, 9, 11, 13, 15, 16+1, 16+3, 16+5, 16+7, 16+9, 16+11, 16+13, 16+15);
		}

		PSIMD_INTRINSIC psimd_u8 psimd_concat_even_u8(psimd_u8 a, psimd_u8 b) {
			return __builtin_shufflevector(a, b,
				0, 2, 4, 6, 8, 10, 12, 14, 16+0, 16+2, 16+4, 16+6, 16+8, 16+10, 16+12, 16+14);
		}

		PSIMD_INTRINSIC psimd_u8 psimd_concat_odd_u8(psimd_u8 a, psimd_u8 b) {
			return __builtin_shufflevector(a, b,
				1, 3, 5, 7, 9, 11, 13, 15, 16+1, 16+3, 16+5, 16+7, 16+9, 16+11, 16+13, 16+15);
		}

		PSIMD_INTRINSIC psimd_s16 psimd_concat_even_s16(psimd_s16 a, psimd_s16 b) {
			return __builtin_shufflevector(a, b, 0, 2, 4, 6, 8+0, 8+2, 8+4, 8+6);
		}

		PSIMD_INTRINSIC psimd_s16 psimd_concat_odd_s16(psimd_s16 a, psimd_s16 b) {
			return __builtin_shufflevector(a, b, 1, 3, 5, 7, 8+1, 8+3, 8+5, 8+7);
		}

		PSIMD_INTRINSIC psimd_u16 psimd_concat_even_u16(psimd_u16 a, psimd_u16 b) {
			return __builtin_shufflevector(a, b, 0, 2, 4, 6, 8+0, 8+2, 8+4, 8+6);
		}

		PSIMD_INTRINSIC psimd_u16 psimd_concat_odd_u16(psimd_u16 a, psimd_u16 b) {
			return __builtin_shufflevector(a, b, 1, 3, 5, 7, 8+1, 8+3, 8+5, 8+7);
		}

		PSIMD_INTRINSIC psimd_s32 psimd_concat_even_s32(psimd_s32 a, psimd_s32 b) {
			return __builtin_shufflevector(a, b, 0, 2, 4+0, 4+2);
		}

		PSIMD_INTRINSIC psimd_s32 psimd_concat_odd_s32(psimd_s32 a, psimd_s32 b) {
			return __builtin_shufflevector(a, b, 1, 3, 4+1, 4+3);
		}

		PSIMD_INTRINSIC psimd_u32 psimd_concat_even_u32(psimd_u32 a, psimd_u32 b) {
			return __builtin_shufflevector(a, b, 0, 2, 4+0, 4+2);
		}

		PSIMD_INTRINSIC psimd_u32 psimd_concat_odd_u32(psimd_u32 a, psimd_u32 b) {
			return __builtin_shufflevector(a, b, 1, 3, 4+1, 4+3);
		}

		PSIMD_INTRINSIC psimd_f32 psimd_concat_even_f32(psimd_f32 a, psimd_f32 b) {
			return __builtin_shufflevector(a, b, 0, 2, 4+0, 4+2);
		}

		PSIMD_INTRINSIC psimd_f32 psimd_concat_odd_f32(psimd_f32 a, psimd_f32 b) {
			return __builtin_shufflevector(a, b, 1, 3, 4+1, 4+3);
		}
	#else
		PSIMD_INTRINSIC psimd_s8 psimd_concat_even_s8(psimd_s8 a, psimd_s8 b) {
			return __builtin_shuffle(a, b,
				(psimd_s8) { 0, 2, 4, 6, 8, 10, 12, 14, 16+0, 16+2, 16+4, 16+6, 16+8, 16+10, 16+12, 16+14 });
		}

		PSIMD_INTRINSIC psimd_s8 psimd_concat_odd_s8(psimd_s8 a, psimd_s8 b) {
			return __builtin_shuffle(a, b,
				(psimd_s8) { 1, 3, 5, 7, 9, 11, 13, 15, 16+1, 16+3, 16+5, 16+7, 16+9, 16+11, 16+13, 16+15 });
		}

		PSIMD_INTRINSIC psimd_u8 psimd_concat_even_u8(psimd_u8 a, psimd_u8 b) {
			return __builtin_shuffle(a, b,
				(psimd_s8) { 0, 2, 4, 6, 8, 10, 12, 14, 16+0, 16+2, 16+4, 16+6, 16+8, 16+10, 16+12, 16+14 });
		}

		PSIMD_INTRINSIC psimd_u8 psimd_concat_odd_u8(psimd_u8 a, psimd_u8 b) {
			return __builtin_shuffle(a, b,
				(psimd_s8) { 1, 3, 5, 7, 9, 11, 13, 15, 16+1, 16+3, 16+5, 16+7, 16+9, 16+11, 16+13, 16+15 });
		}

		PSIMD_INTRINSIC psimd_s16 psimd_concat_even_s16(psimd_s16 a, psimd_s16 b) {
			return __builtin_shuffle(a, b, (psimd_s16) { 0, 2, 4, 6, 8+0, 8+2, 8+4, 8+6 });
		}

		PSIMD_INTRINSIC psimd_s16 psimd_concat_odd_s16(psimd_s16 a, psimd_s16 b) {
			return __builtin_shuffle(a, b, (psimd_s16) { 1, 3, 5, 7, 8+1, 8+3, 8+5, 8+7 });
		}

		PSIMD_INTRINSIC psimd_u16 psimd_concat_even_u16(psimd_u16 a, psimd_u16 b) {
			return __builtin_shuffle(a, b, (psimd_s16) { 0, 2, 4, 6, 8+0, 8+2, 8+4, 8+6 });
		}

		PSIMD_INTRINSIC psimd_u16 psimd_concat_odd_u16(psimd_u16 a, psimd_u16 b) {
			return __builtin_shuffle(a, b, (psimd_s16) { 1, 3, 5, 7, 8+1, 8+3, 8+5, 8+7 });
		}

		PSIMD_INTRINSIC psimd_s32 psimd_concat_even_s32(psimd_s32 a, psimd_s32 b) {
			return __builtin_shuffle(a, b, (psimd_s32) { 0, 2, 4+0, 4+2 });
		}

		PSIMD_INTRINSIC psimd_s32 psimd_concat_odd_s32(psimd_s32 a, psimd_s32 b) {
			return __builtin_shuffle(a, b, (psimd_s32) { 1, 3, 4+1, 4+3 });
		}

		PSIMD_INTRINSIC psimd_u32 psimd_concat_even_u32(psimd_u32 a, psimd_u32 b) {
			return __builtin_shuffle(a, b, (psimd_s32) { 0, 2, 4+0, 4+2 });
		}

		PSIMD_INTRINSIC psimd_u32 psimd_concat_odd_u32(psimd_u32 a, psimd_u32 b) {
			return __builtin_shuffle(a, b, (psimd_s32) { 1, 3, 4+1, 4+3 });
		}

		PSIMD_INTRINSIC psimd_f32 psimd_concat_even_f32(psimd_f32 a, psimd_f32 b) {
			return __builtin_shuffle(a, b, (psimd_s32) { 0, 2, 4+0, 4+2 });
		}

		PSIMD_INTRINSIC psimd_f32 psimd_concat_odd_f32(psimd_f32 a, psimd_f32 b) {
			return __builtin_shuffle(a, b, (psimd_s32) { 1, 3, 4+1, 4+3 });
		}
	#endif

	/* Vector reduce */
	#if defined(__clang__)
		PSIMD_INTRINSIC psimd_f32 psimd_allreduce_sum_f32(psimd_f32 v) {
			const psimd_f32 temp = v + __builtin_shufflevector(v, v, 2, 3, 0, 1);
			return temp + __builtin_shufflevector(temp, temp, 1, 0, 3, 2);
		}

		PSIMD_INTRINSIC psimd_f32 psimd_allreduce_max_f32(psimd_f32 v) {
			const psimd_f32 temp = psimd_max_f32(v, __builtin_shufflevector(v, v, 2, 3, 0, 1));
			return psimd_max_f32(temp, __builtin_shufflevector(temp, temp, 1, 0, 3, 2));
		}

		PSIMD_INTRINSIC psimd_f32 psimd_allreduce_min_f32(psimd_f32 v) {
			const psimd_f32 temp = psimd_min_f32(v, __builtin_shufflevector(v, v, 2, 3, 0, 1));
			return psimd_min_f32(temp, __builtin_shufflevector(temp, temp, 1, 0, 3, 2));
		}

		PSIMD_INTRINSIC float psimd_reduce_sum_f32(psimd_f32 v) {
			const psimd_f32 temp = v + __builtin_shufflevector(v, v, 2, 3, -1, -1);
			const psimd_f32 result = temp + __builtin_shufflevector(temp, temp, 1, -1, -1, -1);
			return result[0];
		}

		PSIMD_INTRINSIC float psimd_reduce_max_f32(psimd_f32 v) {
			const psimd_f32 temp = psimd_max_f32(v, __builtin_shufflevector(v, v, 2, 3, -1, -1));
			const psimd_f32 result = psimd_max_f32(temp, __builtin_shufflevector(temp, temp, 1, -1, -1, -1));
			return result[0];
		}

		PSIMD_INTRINSIC float psimd_reduce_min_f32(psimd_f32 v) {
			const psimd_f32 temp = psimd_min_f32(v, __builtin_shufflevector(v, v, 2, 3, -1, -1));
			const psimd_f32 result = psimd_min_f32(temp, __builtin_shufflevector(temp, temp, 1, -1, -1, -1));
			return result[0];
		}
	#else
		PSIMD_INTRINSIC psimd_f32 psimd_allreduce_sum_f32(psimd_f32 v) {
			const psimd_f32 temp = v + __builtin_shuffle(v, (psimd_s32) { 2, 3, 0, 1 });
			return temp + __builtin_shuffle(temp, (psimd_s32) { 1, 0, 3, 2 });
		}

		PSIMD_INTRINSIC psimd_f32 psimd_allreduce_max_f32(psimd_f32 v) {
			const psimd_f32 temp = psimd_max_f32(v, __builtin_shuffle(v, (psimd_s32) { 2, 3, 0, 1 }));
			return psimd_max_f32(temp, __builtin_shuffle(temp, (psimd_s32) { 1, 0, 3, 2 }));
		}

		PSIMD_INTRINSIC psimd_f32 psimd_allreduce_min_f32(psimd_f32 v) {
			const psimd_f32 temp = psimd_min_f32(v, __builtin_shuffle(v, (psimd_s32) { 2, 3, 0, 1 }));
			return psimd_min_f32(temp, __builtin_shuffle(temp, (psimd_s32) { 1, 0, 3, 2 }));
		}

		PSIMD_INTRINSIC float psimd_reduce_sum_f32(psimd_f32 v) {
			const psimd_f32 result = psimd_allreduce_sum_f32(v);
			return result[0];
		}

		PSIMD_INTRINSIC float psimd_reduce_max_f32(psimd_f32 v) {
			const psimd_f32 result = psimd_allreduce_max_f32(v);
			return result[0];
		}

		PSIMD_INTRINSIC float psimd_reduce_min_f32(psimd_f32 v) {
			const psimd_f32 result = psimd_allreduce_min_f32(v);
			return result[0];
		}
	#endif
#endif

#endif /* PSIMD_H */