summaryrefslogblamecommitdiffstats
path: root/rwsdk/include/d3d8/rtintel.h
blob: c11329dfc168894966a4a9c73544a2c575da9de4 (plain) (tree)
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





















































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































                                                                                                                                                                 
/**
 * Intel specific support toolkit
 */

/**********************************************************************
 *
 * File :     rtintel.h
 *
 * Abstract : Intel specific support/emulation
 *
 **********************************************************************
 *
 * This file is a product of Criterion Software Ltd.
 *
 * This file is provided as is with no warranties of any kind and is
 * provided without any obligation on Criterion Software Ltd. or
 * Canon Inc. to assist in its use or modification.
 *
 * Criterion Software Ltd. will not, under any
 * circumstances, be liable for any lost revenue or other damages arising
 * from the use of this file.
 *
 * Copyright (c) 1998 Criterion Software Ltd.
 * All Rights Reserved.
 *
 * RenderWare is a trademark of Canon Inc.
 *
 ************************************************************************/

#ifndef RTINTEL_H
#define RTINTEL_H

/**
 * \defgroup rtintel RtIntel
 * \ingroup rttool
 *
 * Intel CPU Toolkit for RenderWare.
 */

/****************************************************************************
 Include files
 */

/*
 * Pick up
 *    typedef struct _rwResEntryTag RwResEntry;
 * from baresour.h (internal) / rwcore.h (external)
 */

/****************************************************************************
 Global Types
 */

#include "rtintel.rpe"         /* automatically generated header file */

#if (!defined(RW_FIXED_64))
typedef struct RwFixed64 RwFixed64;
struct RwFixed64
{
    RwInt32             msb;
    RwUInt32            lsb;
};

#define RW_FIXED_64
#endif /* (!defined(RW_FIXED_64)) */

#define doubleFromRwFixed64(x) \
 ( ((double)((x).msb))*((double)(1<<16))*((double)(1<<16)) \
 + ((double)((x).lsb)) )

#if (!defined(RPINTELTIMEFUNCTION))
typedef             RwBool(*RtIntelTimeFunction) (void *data);

#define RPINTELTIMEFUNCTION
#endif /* (!defined(RPINTELTIMEFUNCTION)) */

typedef struct RtIntelOverload RtIntelOverload;

typedef void        (*RwTransformFunction) (RwResEntry * repEntry);

struct RtIntelOverload
{
    rwMatrixMultFn      MatrixMultiplyFunction;
    rwVectorMultFn      VectorMultPointFunction;
    rwVectorMultFn      VectorMultVectorFunction;
    RwTransformFunction TransformFunction;
};

#if (defined(__ICL))
#define DEFINED__ICL " __ICL"
#define UNDEFINED__ICL ""
#else /* (defined(__ICL)) */
#define DEFINED__ICL ""
#define UNDEFINED__ICL " __ICL"
#endif /* (defined(__ICL)) */

#if (defined(_MSC_VER))

# pragma comment ( user, "comment:" __FILE__ "(" RW_STRINGIFY_EXPANDED(__LINE__) ") : " "DEFINED " DEFINED__ICL " ; UNDEFINED " UNDEFINED__ICL )
/* # pragma message (__FILE__ "(" RW_STRINGIFY_EXPANDED(__LINE__) ") : " "DEFINED " DEFINED__ICL " ; UNDEFINED " UNDEFINED__ICL ) */
/* # pragma comment ( user, "comment:" __FILE__ "(" RW_STRINGIFY_EXPANDED(__LINE__) ") : " "DEFINED " DEFINED__ICL " ; UNDEFINED " UNDEFINED__ICL ) */
#if (! (defined(__ICL) || defined(XBOX_DRVMODEL_H)) )
#pragma message (__DATE__ " " __TIME__ " " __FILE__ "(" RW_STRINGIFY_EXPANDED(__LINE__) ") : No MMX intrinsics - defaulting to software emulation")
#pragma message (__DATE__ " " __TIME__ " " __FILE__ "(" RW_STRINGIFY_EXPANDED(__LINE__) ") : No SSE intrinsics - defaulting to software emulation")
#pragma comment ( user, "comment:" __FILE__ "(" RW_STRINGIFY_EXPANDED(__LINE__) ") : No MMX intrinsics - defaulting to software emulation")
#endif /* (! (defined(__ICL) || defined(XBOX_DRVMODEL_H)) ) */
#endif /* (defined(_MSC_VER)) */

/*
 * MMX
 */

#if (defined(__ICL))

#if (!defined(MMINTRIN_H))
#include "mmintrin.h"
#define MMINTRIN_H
#endif /* (!defined(MMINTRIN_H)) */

#else /* (defined(__ICL)) */

#if (defined(_MSC_VER))

#if (!defined(__M64))
typedef __int64     Rt_m64;

#define __M64
#endif /* (!defined(__M64)) */

#else /* (defined(_MSC_VER)) -- e.g. __GNUC__ */

#if (!defined(__M64))

typedef RwInt64 Rt_m64;

#define __M64

#endif /* (!defined(__M64)) */

#endif /* (defined(_MSC_VER)) */

#endif /* (defined(__ICL)) */

/*
 * SSE
 */

/*
 * From
 * ccomp.pdf
 * 12 Intel C/C++ Compiler User's Guide
 *     for Win32 Systems With Katmai New Instruction Support
 * --------------------------------------------------------
 * Functionality Intrinsics Usage
 * You need only define one preprocessor symbol and include the header file
 * xmmintrin.h in your application to use the following functionality
 * intrinsics:
 * #define _MM_FUNCTIONALITY
 * #include "xmmintrin.h"
 * To encourage the compiler to inline the functionality intrinsic functions for
 * better performance, consider using the -Qip and -Qipo compiler switches.
 */

#if (defined(__ICL))

/* #define _MM2_FUNCTIONALITY */

/* #define _MM_FUNCTIONALITY */

/* #define _MM_NO_ABORT */

/* #define _MM_NO_ACCURACY */

/* #define _MM_NO_ALIGN_CHECK */

/* #define _MM_NO_INLINE */

/*
 * Undefine "or", since this is valid assembler; e.g. in
 * SDK10/include/xmm_func.h
 *                                                                              _asm                                                                            {
 *                push      eax
 *                fld       f
 *                fstcw     saved_cw
 *                mov       eax, saved_cw
 *                or        eax, 3072
 *                mov       new_cw, eax
 *                fldcw     new_cw
 *                fistp     ret
 *                fldcw     saved_cw
 *                pop       eax
 *                                                                              }
 */

#if (!defined(XMMINTRIN_H))
#include "xmmintrin.h"
#define XMMINTRIN_H
#endif /* (!defined(XMMINTRIN_H)) */

typedef __m64       Rt_m64;
typedef __m128      Rt_m128;

#if (450 <= __ICL)
#if (!defined(EMMINTRIN_H))
#include "emmintrin.h"
#define EMMINTRIN_H
typedef __m128d     Rt_m128d;
typedef __m128i     Rt_m128i;
#endif /* (!defined(EMMINTRIN_H)) */
#else /* (450 <= __ICL) */
typedef __m128      Rt_m128d;
typedef __m128      Rt_m128i;
#endif /* (450 <= __ICL) */

/*
 * Report SSE options as compiler messages and object file comments
 */

#ifdef _MM2_FUNCTIONALITY
#define DEFINED__MM2_FUNCTIONALITY " _MM2_FUNCTIONALITY"
#define UNDEFINED__MM2_FUNCTIONALITY ""
#else /* _MM2_FUNCTIONALITY */
#define DEFINED__MM2_FUNCTIONALITY ""
#define UNDEFINED__MM2_FUNCTIONALITY  " _MM2_FUNCTIONALITY"
#endif /* _MM2_FUNCTIONALITY */

#ifdef _MM_FUNCTIONALITY
#define DEFINED__MM_FUNCTIONALITY DEFINED__MM2_FUNCTIONALITY ## " _MM_FUNCTIONALITY"
#define UNDEFINED__MM_FUNCTIONALITY UNDEFINED__MM2_FUNCTIONALITY
#else /* _MM_FUNCTIONALITY */
#define DEFINED__MM_FUNCTIONALITY DEFINED__MM2_FUNCTIONALITY
#define UNDEFINED__MM_FUNCTIONALITY UNDEFINED__MM2_FUNCTIONALITY ## " _MM_FUNCTIONALITY"
#endif /* _MM_FUNCTIONALITY */

#ifdef _MM_NO_ABORT
#define DEFINED__MM_NO_ABORT DEFINED__MM_FUNCTIONALITY ## " _MM_NO_ABORT"
#define UNDEFINED__MM_NO_ABORT UNDEFINED__MM_FUNCTIONALITY
#else /* _MM_NO_ABORT */
#define DEFINED__MM_NO_ABORT DEFINED__MM_FUNCTIONALITY
#define UNDEFINED__MM_NO_ABORT UNDEFINED__MM_FUNCTIONALITY ## " _MM_NO_ABORT"
#endif /* _MM_NO_ABORT */

#ifdef _MM_NO_ACCURACY
#define DEFINED__MM_NO_ACCURACY DEFINED__MM_NO_ABORT ## " _MM_NO_ACCURACY"
#define UNDEFINED__MM_NO_ACCURACY UNDEFINED__MM_NO_ABORT
#else /* _MM_NO_ACCURACY */
#define DEFINED__MM_NO_ACCURACY DEFINED__MM_NO_ABORT
#define UNDEFINED__MM_NO_ACCURACY UNDEFINED__MM_NO_ABORT ## " _MM_NO_ACCURACY"
#endif /* _MM_NO_ACCURACY */

#ifdef _MM_NO_ALIGN_CHECK
#define DEFINED__MM_NO_ALIGN_CHECK DEFINED__MM_NO_ACCURACY ## " _MM_NO_ALIGN_CHECK"
#define UNDEFINED__MM_NO_ALIGN_CHECK UNDEFINED__MM_NO_ACCURACY
#else /* _MM_NO_ALIGN_CHECK */
#define DEFINED__MM_NO_ALIGN_CHECK DEFINED__MM_NO_ACCURACY
#define UNDEFINED__MM_NO_ALIGN_CHECK UNDEFINED__MM_NO_ACCURACY ## " _MM_NO_ALIGN_CHECK"
#endif /* _MM_NO_ALIGN_CHECK */

#ifdef _MM_NO_INLINE
#define DEFINED__MM_NO_INLINE DEFINED__MM_NO_ALIGN_CHECK ## " _MM_NO_INLINE"
#define UNDEFINED__MM_NO_INLINE UNDEFINED__MM_NO_ALIGN_CHECK
#else /* _MM_NO_INLINE */
#define DEFINED__MM_NO_INLINE DEFINED__MM_NO_ALIGN_CHECK
#define UNDEFINED__MM_NO_INLINE UNDEFINED__MM_NO_ALIGN_CHECK ## " _MM_NO_INLINE"
#endif /* _MM_NO_INLINE */

#pragma comment ( user, "comment:" __DATE__" "  __TIME__ " - " __FILE__ ":" RW_STRINGIFY_EXPANDED(__LINE__) )
#pragma comment ( user, "comment:" "DEFINED  :" DEFINED__MM_NO_INLINE )
#pragma comment ( user, "comment:" "UNDEFINED:" UNDEFINED__MM_NO_INLINE )

#pragma message (__DATE__" "  __TIME__ " - " __FILE__ ":" RW_STRINGIFY_EXPANDED(__LINE__) )
#pragma message ("DEFINED  :" DEFINED__MM_NO_INLINE )
#pragma message ("UNDEFINED:" UNDEFINED__MM_NO_INLINE )

#else /* (defined(__ICL)) */

#define _MM_HINT_T0     1
#define _MM_HINT_T1     2
#define _MM_HINT_T2     3
#define _MM_HINT_NTA    0

#if (defined(__R5900__))
typedef RwInt128 Rt_m128;
#else /* (defined(__R5900__)) */
#if (!defined(_PAIR__M64))
struct Rt_m128
{
    Rt_m64              lo;
    Rt_m64              hi;
};
#define _PAIR__M64
typedef struct Rt_m128 Rt_m128;
#endif /* (!defined(_PAIR__M64)) */
#endif /* (defined(__R5900__)) */

typedef Rt_m128     Rt_m128d;
typedef Rt_m128     Rt_m128i;
#endif /* (defined(__ICL)) */

typedef struct RtIntelV4d RtIntelV4d;
struct RtIntelV4d
{
    RwReal              w;
    RwV3d               v3d;
};

typedef union _RpSSEOverlayM128 RpSSEOverlayM128;

union _RpSSEOverlayM128
{
    float               _f[4];
    RwInt32             _d[4];
    RwUInt32            ud[4];
    RwInt16             _w[8];
    RwUInt16            uw[8];
    RwInt8              _b[16];
    RwUInt8             ub[16];
    Rt_m64              m64[2];
    Rt_m128             m128;
    RtIntelV4d          v4d;
    RwSplitBits         bits[4];
};

typedef RpSSEOverlayM128 RpWNIOverlayM128;

typedef union _RpWNIOverlayM128d RpWNIOverlayM128d;

union _RpWNIOverlayM128d
{
    double              df[2];
    float               _f[4];
    RwInt32             _d[4];
    RwUInt32            ud[4];
    RwInt16             _w[8];
    RwUInt16            uw[8];
    RwInt8              _b[16];
    RwUInt8             ub[16];
    Rt_m64              m64[2];
    Rt_m128d            m128d;
    RtIntelV4d          v4d;
    RwSplitBits         bits[4];
};

typedef union _RpWNIOverlayM128i RpWNIOverlayM128i;

union _RpWNIOverlayM128i
{
    double              df[2];
    float               _f[4];
    RwInt32             _d[4];
    RwUInt32            ud[4];
    RwInt16             _w[8];
    RwUInt16            uw[8];
    RwInt8              _b[16];
    RwUInt8             ub[16];
    Rt_m64              m64[2];
    Rt_m128i            m128i;
    RtIntelV4d          v4d;
    RwSplitBits         bits[4];
};

#define RWUNALIGNED16BYTE(ptr) (0x0000000FUL & ((RwUInt32)(ptr)))

/*--- Plugin API Functions ---*/

#ifdef    __cplusplus
extern              "C"
{
#endif                          /* __cplusplus */

/*
 * MMX
 */

/* General support intrinsics */
extern void         Rt_m_empty(void);
extern Rt_m64       Rt_m_from_int(int i);
extern int          Rt_m_to_int(Rt_m64 m);
extern Rt_m64       Rt_m_packsswb(Rt_m64 m1, Rt_m64 m2);
extern Rt_m64       Rt_m_packssdw(Rt_m64 m1, Rt_m64 m2);
extern Rt_m64       Rt_m_packuswb(Rt_m64 m1, Rt_m64 m2);
extern Rt_m64       Rt_m_punpckhbw(Rt_m64 m1, Rt_m64 m2);
extern Rt_m64       Rt_m_punpckhwd(Rt_m64 m1, Rt_m64 m2);
extern Rt_m64       Rt_m_punpckhdq(Rt_m64 m1, Rt_m64 m2);
extern Rt_m64       Rt_m_punpcklbw(Rt_m64 m1, Rt_m64 m2);
extern Rt_m64       Rt_m_punpcklwd(Rt_m64 m1, Rt_m64 m2);
extern Rt_m64       Rt_m_punpckldq(Rt_m64 m1, Rt_m64 m2);

/* Packed arithmetic intrinsics */
extern Rt_m64       Rt_m_paddb(Rt_m64 m1, Rt_m64 m2);
extern Rt_m64       Rt_m_paddw(Rt_m64 m1, Rt_m64 m2);
extern Rt_m64       Rt_m_paddd(Rt_m64 m1, Rt_m64 m2);
extern Rt_m64       Rt_m_paddsb(Rt_m64 m1, Rt_m64 m2);
extern Rt_m64       Rt_m_paddsw(Rt_m64 m1, Rt_m64 m2);
extern Rt_m64       Rt_m_paddusb(Rt_m64 m1, Rt_m64 m2);
extern Rt_m64       Rt_m_paddusw(Rt_m64 m1, Rt_m64 m2);
extern Rt_m64       Rt_m_psubb(Rt_m64 m1, Rt_m64 m2);
extern Rt_m64       Rt_m_psubw(Rt_m64 m1, Rt_m64 m2);
extern Rt_m64       Rt_m_psubd(Rt_m64 m1, Rt_m64 m2);
extern Rt_m64       Rt_m_psubsb(Rt_m64 m1, Rt_m64 m2);
extern Rt_m64       Rt_m_psubsw(Rt_m64 m1, Rt_m64 m2);
extern Rt_m64       Rt_m_psubusb(Rt_m64 m1, Rt_m64 m2);
extern Rt_m64       Rt_m_psubusw(Rt_m64 m1, Rt_m64 m2);
extern Rt_m64       Rt_m_pmaddwd(Rt_m64 m1, Rt_m64 m2);
extern Rt_m64       Rt_m_pmulhw(Rt_m64 m1, Rt_m64 m2);
extern Rt_m64       Rt_m_pmullw(Rt_m64 m1, Rt_m64 m2);

/* Shift intrinsics */
extern Rt_m64       Rt_m_psllw(Rt_m64 m, Rt_m64 count);
extern Rt_m64       Rt_m_psllwi(Rt_m64 m, int count);
extern Rt_m64       Rt_m_pslld(Rt_m64 m, Rt_m64 count);
extern Rt_m64       Rt_m_pslldi(Rt_m64 m, int count);
extern Rt_m64       Rt_m_psllq(Rt_m64 m, Rt_m64 count);
extern Rt_m64       Rt_m_psllqi(Rt_m64 m, int count);
extern Rt_m64       Rt_m_psraw(Rt_m64 m, Rt_m64 count);
extern Rt_m64       Rt_m_psrawi(Rt_m64 m, int count);
extern Rt_m64       Rt_m_psrad(Rt_m64 m, Rt_m64 count);
extern Rt_m64       Rt_m_psradi(Rt_m64 m, int count);
extern Rt_m64       Rt_m_psrlw(Rt_m64 m, Rt_m64 count);
extern Rt_m64       Rt_m_psrlwi(Rt_m64 m, int count);
extern Rt_m64       Rt_m_psrld(Rt_m64 m, Rt_m64 count);
extern Rt_m64       Rt_m_psrldi(Rt_m64 m, int count);
extern Rt_m64       Rt_m_psrlq(Rt_m64 m, Rt_m64 count);
extern Rt_m64       Rt_m_psrlqi(Rt_m64 m, int count);

/* Logical intrinsics */
extern Rt_m64       Rt_m_pand(Rt_m64 m1, Rt_m64 m2);
extern Rt_m64       Rt_m_pandn(Rt_m64 m1, Rt_m64 m2);
extern Rt_m64       Rt_m_por(Rt_m64 m1, Rt_m64 m2);
extern Rt_m64       Rt_m_pxor(Rt_m64 m1, Rt_m64 m2);

/* Comparision intrinsics */
extern Rt_m64       Rt_m_pcmpeqb(Rt_m64 m1, Rt_m64 m2);
extern Rt_m64       Rt_m_pcmpeqw(Rt_m64 m1, Rt_m64 m2);
extern Rt_m64       Rt_m_pcmpeqd(Rt_m64 m1, Rt_m64 m2);
extern Rt_m64       Rt_m_pcmpgtb(Rt_m64 m1, Rt_m64 m2);
extern Rt_m64       Rt_m_pcmpgtw(Rt_m64 m1, Rt_m64 m2);
extern Rt_m64       Rt_m_pcmpgtd(Rt_m64 m1, Rt_m64 m2);

/*
 * SSE
 */

/*
 * Arithmetic Operations
 */

extern Rt_m128      Rt_mm_add_ss(Rt_m128 a, Rt_m128 b) /* ADDSS */ ;
extern Rt_m128      Rt_mm_add_ps(Rt_m128 a, Rt_m128 b) /* ADDPS */ ;
extern Rt_m128      Rt_mm_sub_ss(Rt_m128 a, Rt_m128 b) /* SUBSS */ ;
extern Rt_m128      Rt_mm_sub_ps(Rt_m128 a, Rt_m128 b) /* SUBPS */ ;
extern Rt_m128      Rt_mm_mul_ss(Rt_m128 a, Rt_m128 b) /* MULSS */ ;
extern Rt_m128      Rt_mm_mul_ps(Rt_m128 a, Rt_m128 b) /* MULPS */ ;
extern Rt_m128      Rt_mm_div_ss(Rt_m128 a, Rt_m128 b) /* DIVSS */ ;
extern Rt_m128      Rt_mm_div_ps(Rt_m128 a, Rt_m128 b) /* DIVPS */ ;
extern Rt_m128      Rt_mm_sqrt_ss(Rt_m128 a) /* SQRTSS */ ;
extern Rt_m128      Rt_mm_sqrt_ps(Rt_m128 a) /* SQRTPS */ ;
extern Rt_m128      Rt_mm_rcp_ss(Rt_m128 a) /* RCPSS */ ;
extern Rt_m128      Rt_mm_rcp_ps(Rt_m128 a) /* RCPPS */ ;
extern Rt_m128      Rt_mm_rsqrt_ss(Rt_m128 a) /* RSQRTSS */ ;
extern Rt_m128      Rt_mm_rsqrt_ps(Rt_m128 a) /* RSQRTPS */ ;
extern Rt_m128      Rt_mm_min_ss(Rt_m128 a, Rt_m128 b) /* MINSS */ ;
extern Rt_m128      Rt_mm_min_ps(Rt_m128 a, Rt_m128 b) /* MINPS */ ;
extern Rt_m128      Rt_mm_max_ss(Rt_m128 a, Rt_m128 b) /* MAXSS */ ;
extern Rt_m128      Rt_mm_max_ps(Rt_m128 a, Rt_m128 b) /* MAXPS */ ;

/*
 * Logical Operations
 */

extern Rt_m128      Rt_mm_and_ps(Rt_m128 a, Rt_m128 b) /* ANDPS */ ;
extern Rt_m128      Rt_mm_andnot_ps(Rt_m128 a,
                                    Rt_m128 b) /* ANDNPS */ ;
extern Rt_m128      Rt_mm_or_ps(Rt_m128 a, Rt_m128 b) /* ORPS */ ;
extern Rt_m128      Rt_mm_xor_ps(Rt_m128 a, Rt_m128 b) /* XORPS */ ;

/*
 * Comparisons
 */

extern Rt_m128      Rt_mm_cmpeq_ss(Rt_m128 a,
                                   Rt_m128 b) /* CMPEQSS */ ;
extern Rt_m128      Rt_mm_cmpeq_ps(Rt_m128 a,
                                   Rt_m128 b) /* CMPEQPS */ ;
extern Rt_m128      Rt_mm_cmplt_ss(Rt_m128 a,
                                   Rt_m128 b) /* CMPLTSS */ ;
extern Rt_m128      Rt_mm_cmplt_ps(Rt_m128 a,
                                   Rt_m128 b) /* CMPLTPS */ ;
extern Rt_m128      Rt_mm_cmple_ss(Rt_m128 a,
                                   Rt_m128 b) /* CMPLESS */ ;
extern Rt_m128      Rt_mm_cmple_ps(Rt_m128 a,
                                   Rt_m128 b) /* CMPLEPS */ ;
extern Rt_m128      Rt_mm_cmpgt_ss(Rt_m128 a, Rt_m128 b) /* CMPLTSS        r */
                   ;
extern Rt_m128      Rt_mm_cmpgt_ps(Rt_m128 a, Rt_m128 b) /* CMPLTPS        r */
                   ;
extern Rt_m128      Rt_mm_cmpge_ss(Rt_m128 a, Rt_m128 b) /* CMPLESS        r */
                   ;
extern Rt_m128      Rt_mm_cmpge_ps(Rt_m128 a, Rt_m128 b) /* CMPLEPS        r */
                   ;
extern Rt_m128      Rt_mm_cmpneq_ss(Rt_m128 a,
                                    Rt_m128 b) /* CMPNEQSS */ ;
extern Rt_m128      Rt_mm_cmpneq_ps(Rt_m128 a,
                                    Rt_m128 b) /* CMPNEQPS */ ;
extern Rt_m128      Rt_mm_cmpnlt_ss(Rt_m128 a,
                                    Rt_m128 b) /* CMPNLTSS */ ;
extern Rt_m128      Rt_mm_cmpnlt_ps(Rt_m128 a,
                                    Rt_m128 b) /* CMPNLTPS */ ;
extern Rt_m128      Rt_mm_cmpnle_ss(Rt_m128 a,
                                    Rt_m128 b) /* CMPNLESS */ ;
extern Rt_m128      Rt_mm_cmpnle_ps(Rt_m128 a,
                                    Rt_m128 b) /* CMPNLEPS */ ;
extern Rt_m128      Rt_mm_cmpngt_ss(Rt_m128 a, Rt_m128 b)
    /* CMPNLTSS       r */ ;
extern Rt_m128      Rt_mm_cmpngt_ps(Rt_m128 a, Rt_m128 b)
    /* CMPNLTPS       r */ ;
extern Rt_m128      Rt_mm_cmpnge_ss(Rt_m128 a, Rt_m128 b)
    /* CMPNLESS       r */ ;
extern Rt_m128      Rt_mm_cmpnge_ps(Rt_m128 a, Rt_m128 b)
    /* CMPNLEPS       r */ ;
extern Rt_m128      Rt_mm_cmpord_ss(Rt_m128 a,
                                    Rt_m128 b) /* CMPORDSS */ ;
extern Rt_m128      Rt_mm_cmpord_ps(Rt_m128 a,
                                    Rt_m128 b) /* CMPORDPS */ ;
extern Rt_m128      Rt_mm_cmpunord_ss(Rt_m128 a,
                                      Rt_m128 b) /* CMPUNORDSS */ ;
extern Rt_m128      Rt_mm_cmpunord_ps(Rt_m128 a,
                                      Rt_m128 b) /* CMPUNORDPS */ ;
extern int          Rt_mm_comieq_ss(Rt_m128 a,
                                    Rt_m128 b) /* COMISS */ ;
extern int          Rt_mm_comilt_ss(Rt_m128 a,
                                    Rt_m128 b) /* COMISS */ ;
extern int          Rt_mm_comile_ss(Rt_m128 a,
                                    Rt_m128 b) /* COMISS */ ;
extern int          Rt_mm_comigt_ss(Rt_m128 a,
                                    Rt_m128 b) /* COMISS */ ;
extern int          Rt_mm_comige_ss(Rt_m128 a,
                                    Rt_m128 b) /* COMISS */ ;
extern int          Rt_mm_comineq_ss(Rt_m128 a,
                                     Rt_m128 b) /* COMISS */ ;
extern int          Rt_mm_ucomieq_ss(Rt_m128 a,
                                     Rt_m128 b) /* UCOMISS */ ;
extern int          Rt_mm_ucomilt_ss(Rt_m128 a,
                                     Rt_m128 b) /* UCOMISS */ ;
extern int          Rt_mm_ucomile_ss(Rt_m128 a,
                                     Rt_m128 b) /* UCOMISS */ ;
extern int          Rt_mm_ucomigt_ss(Rt_m128 a,
                                     Rt_m128 b) /* UCOMISS */ ;
extern int          Rt_mm_ucomige_ss(Rt_m128 a,
                                     Rt_m128 b) /* UCOMISS */ ;
extern int          Rt_mm_ucomineq_ss(Rt_m128 a,
                                      Rt_m128 b) /* UCOMISS */ ;

/*
 * Conversion Operations
 */

extern int          Rt_mm_cvt_ss2si(Rt_m128 a) /* CVTSS2SI */ ;
extern Rt_m64       Rt_mm_cvt_ps2pi(Rt_m128 a) /* CVTPS2PI */ ;
extern int          Rt_mm_cvtt_ss2si(Rt_m128 a) /* CVTTSS2SI */ ;
extern Rt_m64       Rt_mm_cvtt_ps2pi(Rt_m128 a) /* CVTTPS2PI */ ;
extern Rt_m128      Rt_mm_cvt_si2ss(Rt_m128 a,
                                    int b) /* CVTSI2SS */ ;
extern Rt_m128      Rt_mm_cvt_pi2ps(Rt_m128 a,
                                    Rt_m64 b) /* CVTPI2PS */ ;

/*
 *     Miscellaneous
 */

extern Rt_m128      Rt_mm_shuffle_ps(Rt_m128 a, Rt_m128 b,
                                     int i) /* SHUFPS */ ;
extern Rt_m128      Rt_mm_unpackhi_ps(Rt_m128 a,
                                      Rt_m128 b) /* UNPCKHPS */ ;
extern Rt_m128      Rt_mm_unpacklo_ps(Rt_m128 a,
                                      Rt_m128 b) /* UNPCKLPS */ ;
extern Rt_m128      Rt_mm_loadh_pi(Rt_m128 a, Rt_m64 * p) /* MOVHPS         reg, mem */
                   ;
extern void         Rt_mm_storeh_pi(Rt_m64 * p, Rt_m128 a) /* MOVHPS         mem, reg */
                   ;
extern Rt_m128      Rt_mm_movehl_ps(Rt_m128 a,
                                    Rt_m128 b) /* MOVHLPS */ ;
extern Rt_m128      Rt_mm_movelh_ps(Rt_m128 a,
                                    Rt_m128 b) /* MOVLHPS */ ;
extern Rt_m128      Rt_mm_loadl_pi(Rt_m128 a, Rt_m64 * p)
    /* MOVLPS         reg,    mem */ ;
extern void         Rt_mm_storel_pi(Rt_m64 * p, Rt_m128 a) /* MOVLPS         mem, reg */
                   ;
extern int          Rt_mm_movemask_ps(Rt_m128 a) /* MOVMSKPS */ ;
extern unsigned int Rt_mm_getcsr(void) /* STMXCSR */ ;
extern void         Rt_mm_setcsr(unsigned int i) /* LDMXCSR */ ;

/*
 * Load Operations
 */

extern Rt_m128      Rt_mm_load_ss(float *p) /* MOVSS */ ;
extern Rt_m128      Rt_mm_load_ps1(float *p) /* MOVSS + shuffling */
                   ;
extern Rt_m128      Rt_mm_load_ps(float *p) /* MOVAPS */ ;
extern Rt_m128      Rt_mm_loadu_ps(float *p) /* MOVUPS */ ;
extern Rt_m128      Rt_mm_loadr_ps(float *p)
    /* MOVAPS + shuffling  */ ;

/*
 * Set Operations
 */

extern Rt_m128      Rt_mm_set_ss(float w) /* (composite) */ ;
extern Rt_m128      Rt_mm_set_ps1(float w) /* (composite) */ ;
extern Rt_m128      Rt_mm_set_ps(float z, float y, float x,
                                 float w) /* (composite) */ ;
extern Rt_m128      Rt_mm_setr_ps(float z, float y, float x,
                                  float w) /* (composite) */ ;
extern Rt_m128      Rt_mm_setzero_ps(void) /* (composite) */ ;

/*
 * Store Operations
 */

extern void         Rt_mm_store_ss(float *p,
                                   Rt_m128 a) /* MOVSS */ ;
extern void         Rt_mm_store_ps1(float *p, Rt_m128 a)
    /* MOVSS + shuffling */ ;
extern void         Rt_mm_store_ps(float *p,
                                   Rt_m128 a) /* MOVAPS */ ;
extern void         Rt_mm_storeu_ps(float *p,
                                    Rt_m128 a) /* MOVUPS */ ;
extern void         Rt_mm_storer_ps(float *p, Rt_m128 a)
    /* MOVAPS + shuffling */ ;
extern Rt_m128      Rt_mm_move_ss(Rt_m128 a,
                                  Rt_m128 b) /* MOVSS */ ;

/*
 * Integer Intrinsics
 */

extern int          Rt_m_pextrw(Rt_m64 a, int n) /* PEXTRW */ ;
extern Rt_m64       Rt_m_pinsrw(Rt_m64 a, int d,
                                int n) /* PINSRW */ ;
extern Rt_m64       Rt_m_pmaxsw(Rt_m64 a, Rt_m64 b) /* PMAXSW */ ;
extern Rt_m64       Rt_m_pmaxub(Rt_m64 a, Rt_m64 b) /* PMAXUB */ ;
extern Rt_m64       Rt_m_pminsw(Rt_m64 a, Rt_m64 b) /* PMINSW */ ;
extern Rt_m64       Rt_m_pminub(Rt_m64 a, Rt_m64 b) /* PMINUB */ ;
extern int          Rt_m_pmovmskb(Rt_m64 a) /* PMOVMSKB */ ;
extern Rt_m64       Rt_m_pmulhuw(Rt_m64 a, Rt_m64 b) /* PMULHUW */ ;
extern Rt_m64       Rt_m_pshufw(Rt_m64 a, int n) /* PSHUFW */ ;
extern void         Rt_m_lwmaskmovq(Rt_m64 d, Rt_m64 n,
                                    char *p) /* MASKMOVQ */ ;

/*
 * Cacheability Support
 */

extern void         Rt_mm_prefetch(char *p, int i) /* PREFETCH */ ;
extern void         Rt_mm_stream_pi(Rt_m64 * p,
                                    Rt_m64 a) /* MOVNTQ */ ;
extern void         Rt_mm_stream_ps(float *p,
                                    Rt_m128 a) /* MOVNTPS */ ;
extern void         Rt_mm_sfence(void) /* SFENCE */ ;

/*
 * WNI
 */

/* Arithmetic Operations  */

extern Rt_m128d     Rt_mm_add_sd(Rt_m128d a, Rt_m128d b);
extern Rt_m128d     Rt_mm_add_pd(Rt_m128d a, Rt_m128d b);
extern Rt_m128d     Rt_mm_div_sd(Rt_m128d a, Rt_m128d b);
extern Rt_m128d     Rt_mm_div_pd(Rt_m128d a, Rt_m128d b);
extern Rt_m128d     Rt_mm_max_sd(Rt_m128d a, Rt_m128d b);
extern Rt_m128d     Rt_mm_max_pd(Rt_m128d a, Rt_m128d b);
extern Rt_m128d     Rt_mm_min_sd(Rt_m128d a, Rt_m128d b);
extern Rt_m128d     Rt_mm_min_pd(Rt_m128d a, Rt_m128d b);
extern Rt_m128d     Rt_mm_mul_sd(Rt_m128d a, Rt_m128d b);
extern Rt_m128d     Rt_mm_mul_pd(Rt_m128d a, Rt_m128d b);
extern Rt_m128d     Rt_mm_sqrt_sd(Rt_m128d a, Rt_m128d b);
extern Rt_m128d     Rt_mm_sqrt_pd(Rt_m128d a);
extern Rt_m128d     Rt_mm_sub_sd(Rt_m128d a, Rt_m128d b);
extern Rt_m128d     Rt_mm_sub_pd(Rt_m128d a, Rt_m128d b);
extern Rt_m128d     Rt_mm_andnot_pd(Rt_m128d a, Rt_m128d b);
extern Rt_m128d     Rt_mm_and_pd(Rt_m128d a, Rt_m128d b);
extern Rt_m128d     Rt_mm_or_pd(Rt_m128d a, Rt_m128d b);
extern Rt_m128d     Rt_mm_xor_pd(Rt_m128d a, Rt_m128d b);

/* Comparisons */

extern Rt_m128d     Rt_mm_cmpeq_pd(Rt_m128d a, Rt_m128d b);
extern Rt_m128d     Rt_mm_cmplt_pd(Rt_m128d a, Rt_m128d b);
extern Rt_m128d     Rt_mm_cmple_pd(Rt_m128d a, Rt_m128d b);
extern Rt_m128d     Rt_mm_cmpgt_pd(Rt_m128d a, Rt_m128d b);
extern Rt_m128d     Rt_mm_cmpge_pd(Rt_m128d a, Rt_m128d b);
extern Rt_m128d     Rt_mm_cmpord_pd(Rt_m128d a, Rt_m128d b);
extern Rt_m128d     Rt_mm_cmpunord_pd(Rt_m128d a, Rt_m128d b);
extern Rt_m128d     Rt_mm_cmpneq_pd(Rt_m128d a, Rt_m128d b);
extern Rt_m128d     Rt_mm_cmpnlt_pd(Rt_m128d a, Rt_m128d b);
extern Rt_m128d     Rt_mm_cmpnle_pd(Rt_m128d a, Rt_m128d b);
extern Rt_m128d     Rt_mm_cmpngt_pd(Rt_m128d a, Rt_m128d b);
extern Rt_m128d     Rt_mm_cmpnge_pd(Rt_m128d a, Rt_m128d b);
extern Rt_m128d     Rt_mm_cmpeq_sd(Rt_m128d a, Rt_m128d b);
extern Rt_m128d     Rt_mm_cmplt_sd(Rt_m128d a, Rt_m128d b);
extern Rt_m128d     Rt_mm_cmple_sd(Rt_m128d a, Rt_m128d b);
extern Rt_m128d     Rt_mm_cmpgt_sd(Rt_m128d a, Rt_m128d b);
extern Rt_m128d     Rt_mm_cmpge_sd(Rt_m128d a, Rt_m128d b);
extern Rt_m128d     Rt_mm_cmpord_sd(Rt_m128d a, Rt_m128d b);
extern Rt_m128d     Rt_mm_cmpunord_sd(Rt_m128d a, Rt_m128d b);
extern Rt_m128d     Rt_mm_cmpneq_sd(Rt_m128d a, Rt_m128d b);
extern Rt_m128d     Rt_mm_cmpnlt_sd(Rt_m128d a, Rt_m128d b);
extern Rt_m128d     Rt_mm_cmpnle_sd(Rt_m128d a, Rt_m128d b);
extern Rt_m128d     Rt_mm_cmpngt_sd(Rt_m128d a, Rt_m128d b);
extern Rt_m128d     Rt_mm_cmpnge_sd(Rt_m128d a, Rt_m128d b);
extern int          Rt_mm_comieq_sd(Rt_m128d a, Rt_m128d b);
extern int          Rt_mm_comilt_sd(Rt_m128d a, Rt_m128d b);
extern int          Rt_mm_comile_sd(Rt_m128d a, Rt_m128d b);
extern int          Rt_mm_comigt_sd(Rt_m128d a, Rt_m128d b);
extern int          Rt_mm_comige_sd(Rt_m128d a, Rt_m128d b);
extern int          Rt_mm_comineq_sd(Rt_m128d a, Rt_m128d b);
extern int          Rt_mm_ucomieq_sd(Rt_m128d a, Rt_m128d b);
extern int          Rt_mm_ucomilt_sd(Rt_m128d a, Rt_m128d b);
extern int          Rt_mm_ucomile_sd(Rt_m128d a, Rt_m128d b);
extern int          Rt_mm_ucomigt_sd(Rt_m128d a, Rt_m128d b);
extern int          Rt_mm_ucomige_sd(Rt_m128d a, Rt_m128d b);
extern int          Rt_mm_ucomineq_sd(Rt_m128d a, Rt_m128d b);

/* Conversion Operations  */

extern Rt_m128      Rt_mm_cvtpd_ps(Rt_m128d a);
extern Rt_m128d     Rt_mm_cvtps_pd(Rt_m128 a);
extern Rt_m128d     Rt_mm_cvtepi32_pd(Rt_m128i a);
extern Rt_m128i     Rt_mm_cvtpd_epi32(Rt_m128d a);
extern int          Rt_mm_cvtsd_si32(Rt_m128d a);
extern Rt_m128      Rt_mm_cvtsd_ss(Rt_m128 a, Rt_m128d b);
extern Rt_m128d     Rt_mm_cvtsi32_sd(Rt_m128d a, int b);
extern Rt_m128d     Rt_mm_cvtss_sd(Rt_m128d a, Rt_m128 b);
extern Rt_m128i     Rt_mm_cvttpd_epi32(Rt_m128d a);
extern int          Rt_mm_cvttsd_si32(Rt_m128d a);
extern Rt_m128      Rt_mm_cvtepi32_ps(Rt_m128i a);
extern Rt_m128i     Rt_mm_cvtps_epi32(Rt_m128 a);
extern Rt_m128i     Rt_mm_cvttps_epi32(Rt_m128 a);
extern Rt_m64       Rt_mm_cvtpd_pi32(Rt_m128d a);
extern Rt_m64       Rt_mm_cvttpd_pi32(Rt_m128d a);
extern Rt_m128d     Rt_mm_cvtpi32_pd(Rt_m64 a);

/* Miscellaneous Operations  */

extern Rt_m128d     Rt_mm_unpackhi_pd(Rt_m128d a, Rt_m128d b);
extern Rt_m128d     Rt_mm_unpacklo_pd(Rt_m128d a, Rt_m128d b);
extern int          Rt_mm_movemask_pd(Rt_m128d a);
extern Rt_m128d     Rt_mm_shuffle_pd(Rt_m128d a, Rt_m128d b, int i);
extern Rt_m128d     Rt_mm_load_pd(const double *p);
extern Rt_m128d     Rt_mm_load1_pd(const double *p);
extern Rt_m128d     Rt_mm_loadr_pd(const double *p);
extern Rt_m128d     Rt_mm_loadu_pd(const double *p);
extern Rt_m128d     Rt_mm_load_sd(const double *p);
extern Rt_m128d     Rt_mm_loadh_pd(Rt_m128d a, const double *p);
extern Rt_m128d     Rt_mm_loadl_pd(Rt_m128d a, const double *p);
extern Rt_m128d     Rt_mm_set_sd(double w);
extern Rt_m128d     Rt_mm_set1_pd(double w);
extern Rt_m128d     Rt_mm_set_pd(double w, double x);
extern Rt_m128d     Rt_mm_setr_pd(double w, double x);
extern Rt_m128d     Rt_mm_setzero_pd(void);
extern Rt_m128d     Rt_mm_move_sd(Rt_m128d a, Rt_m128d b);
extern void         Rt_mm_stream_pd(double *p, Rt_m128d a);
extern void         Rt_mm_store_sd(double *p, Rt_m128d a);
extern void         Rt_mm_store1_pd(double *p, Rt_m128d a);
extern void         Rt_mm_store_pd(double *p, Rt_m128d a);
extern void         Rt_mm_storeu_pd(double *p, Rt_m128d a);
extern void         Rt_mm_storer_pd(double *p, Rt_m128d a);
extern void         Rt_mm_storeh_pd(double *p, Rt_m128d a);
extern void         Rt_mm_storel_pd(double *p, Rt_m128d a);
extern Rt_m128i     Rt_mm_add_epi8(Rt_m128i a, Rt_m128i b);
extern Rt_m128i     Rt_mm_add_epi16(Rt_m128i a, Rt_m128i b);
extern Rt_m128i     Rt_mm_add_epi32(Rt_m128i a, Rt_m128i b);
extern Rt_m64       Rt_mm_add_si64(Rt_m64 a, Rt_m64 b);
extern Rt_m128i     Rt_mm_add_epi64(Rt_m128i a, Rt_m128i b);
extern Rt_m128i     Rt_mm_adds_epi8(Rt_m128i a, Rt_m128i b);
extern Rt_m128i     Rt_mm_adds_epi16(Rt_m128i a, Rt_m128i b);
extern Rt_m128i     Rt_mm_adds_epu8(Rt_m128i a, Rt_m128i b);
extern Rt_m128i     Rt_mm_adds_epu16(Rt_m128i a, Rt_m128i b);
extern Rt_m128i     Rt_mm_avg_epu8(Rt_m128i a, Rt_m128i b);
extern Rt_m128i     Rt_mm_avg_epu16(Rt_m128i a, Rt_m128i b);
extern Rt_m128i     Rt_mm_madd_epi16(Rt_m128i a, Rt_m128i b);
extern Rt_m128i     Rt_mm_max_epi16(Rt_m128i a, Rt_m128i b);
extern Rt_m128i     Rt_mm_max_epu8(Rt_m128i a, Rt_m128i b);
extern Rt_m128i     Rt_mm_min_epi16(Rt_m128i a, Rt_m128i b);
extern Rt_m128i     Rt_mm_min_epu8(Rt_m128i a, Rt_m128i b);
extern Rt_m128i     Rt_mm_mulhi_epi16(Rt_m128i a, Rt_m128i b);
extern Rt_m128i     Rt_mm_mulhi_epu16(Rt_m128i a, Rt_m128i b);
extern Rt_m128i     Rt_mm_mullo_epi16(Rt_m128i a, Rt_m128i b);
extern Rt_m64       Rt_mm_mul_su32(Rt_m64 a, Rt_m64 b);
extern Rt_m128i     Rt_mm_mul_epu32(Rt_m128i a, Rt_m128i b);
extern Rt_m128i     Rt_mm_sad_epu8(Rt_m128i a, Rt_m128i b);
extern Rt_m128i     Rt_mm_sub_epi8(Rt_m128i a, Rt_m128i b);
extern Rt_m128i     Rt_mm_sub_epi16(Rt_m128i a, Rt_m128i b);
extern Rt_m128i     Rt_mm_sub_epi32(Rt_m128i a, Rt_m128i b);
extern Rt_m64       Rt_mm_sub_si64(Rt_m64 a, Rt_m64 b);
extern Rt_m128i     Rt_mm_sub_epi64(Rt_m128i a, Rt_m128i b);
extern Rt_m128i     Rt_mm_subs_epi8(Rt_m128i a, Rt_m128i b);
extern Rt_m128i     Rt_mm_subs_epi16(Rt_m128i a, Rt_m128i b);
extern Rt_m128i     Rt_mm_subs_epu8(Rt_m128i a, Rt_m128i b);
extern Rt_m128i     Rt_mm_subs_epu16(Rt_m128i a, Rt_m128i b);
extern Rt_m128i     Rt_mm_and_si128(Rt_m128i a, Rt_m128i b);
extern Rt_m128i     Rt_mm_andnot_si128(Rt_m128i a, Rt_m128i b);
extern Rt_m128i     Rt_mm_or_si128(Rt_m128i a, Rt_m128i b);
extern Rt_m128i     Rt_mm_xor_si128(Rt_m128i a, Rt_m128i b);
extern Rt_m128i     Rt_mm_slli_si128(Rt_m128i a, int imm);
extern Rt_m128i     Rt_mm_slli_epi16(Rt_m128i a, int count);
extern Rt_m128i     Rt_mm_sll_epi16(Rt_m128i a, Rt_m128i count);
extern Rt_m128i     Rt_mm_slli_epi32(Rt_m128i a, int count);
extern Rt_m128i     Rt_mm_sll_epi32(Rt_m128i a, Rt_m128i count);
extern Rt_m128i     Rt_mm_slli_epi64(Rt_m128i a, int count);
extern Rt_m128i     Rt_mm_sll_epi64(Rt_m128i a, Rt_m128i count);
extern Rt_m128i     Rt_mm_srai_epi16(Rt_m128i a, int count);
extern Rt_m128i     Rt_mm_sra_epi16(Rt_m128i a, Rt_m128i count);
extern Rt_m128i     Rt_mm_srai_epi32(Rt_m128i a, int count);
extern Rt_m128i     Rt_mm_sra_epi32(Rt_m128i a, Rt_m128i count);
extern Rt_m128i     Rt_mm_srli_si128(Rt_m128i a, int imm);
extern Rt_m128i     Rt_mm_srli_epi16(Rt_m128i a, int count);
extern Rt_m128i     Rt_mm_srl_epi16(Rt_m128i a, Rt_m128i count);
extern Rt_m128i     Rt_mm_srli_epi32(Rt_m128i a, int count);
extern Rt_m128i     Rt_mm_srl_epi32(Rt_m128i a, Rt_m128i count);
extern Rt_m128i     Rt_mm_srli_epi64(Rt_m128i a, int count);
extern Rt_m128i     Rt_mm_srl_epi64(Rt_m128i a, Rt_m128i count);
extern Rt_m128i     Rt_mm_cmpeq_epi8(Rt_m128i a, Rt_m128i b);
extern Rt_m128i     Rt_mm_cmpeq_epi16(Rt_m128i a, Rt_m128i b);
extern Rt_m128i     Rt_mm_cmpeq_epi32(Rt_m128i a, Rt_m128i b);
extern Rt_m128i     Rt_mm_cmpgt_epi8(Rt_m128i a, Rt_m128i b);
extern Rt_m128i     Rt_mm_cmpgt_epi16(Rt_m128i a, Rt_m128i b);
extern Rt_m128i     Rt_mm_cmpgt_epi32(Rt_m128i a, Rt_m128i b);
extern Rt_m128i     Rt_mm_cmplt_epi8(Rt_m128i a, Rt_m128i b);
extern Rt_m128i     Rt_mm_cmplt_epi16(Rt_m128i a, Rt_m128i b);
extern Rt_m128i     Rt_mm_cmplt_epi32(Rt_m128i a, Rt_m128i b);
extern Rt_m128i     Rt_mm_cvtsi32_si128(int a);
extern int          Rt_mm_cvtsi128_si32(Rt_m128i a);

/* Miscellaneous Operations  */

extern Rt_m64       Rt_mm_movepi64_pi64(Rt_m128i a);
extern Rt_m128i     Rt_mm_movpi64_epi64(Rt_m64 a);
extern Rt_m128i     Rt_mm_move_epi64(Rt_m128i a);
extern Rt_m128i     Rt_mm_packs_epi16(Rt_m128i a, Rt_m128i b);
extern Rt_m128i     Rt_mm_packs_epi32(Rt_m128i a, Rt_m128i b);
extern Rt_m128i     Rt_mm_packus_epi16(Rt_m128i a, Rt_m128i b);
extern int          Rt_mm_extract_epi16(Rt_m128i a, int imm);
extern Rt_m128i     Rt_mm_insert_epi16(Rt_m128i a, int b, int imm);
extern int          Rt_mm_movemask_epi8(Rt_m128i a);
extern Rt_m128i     Rt_mm_shuffle_epi32(Rt_m128i a, int imm);
extern Rt_m128i     Rt_mm_shufflehi_epi16(Rt_m128i a, int imm);
extern Rt_m128i     Rt_mm_shufflelo_epi16(Rt_m128i a, int imm);
extern Rt_m128i     Rt_mm_unpackhi_epi8(Rt_m128i a, Rt_m128i b);
extern Rt_m128i     Rt_mm_unpackhi_epi16(Rt_m128i a, Rt_m128i b);
extern Rt_m128i     Rt_mm_unpackhi_epi32(Rt_m128i a, Rt_m128i b);
extern Rt_m128i     Rt_mm_unpackhi_epi64(Rt_m128i a, Rt_m128i b);
extern Rt_m128i     Rt_mm_unpacklo_epi8(Rt_m128i a, Rt_m128i b);
extern Rt_m128i     Rt_mm_unpacklo_epi16(Rt_m128i a, Rt_m128i b);
extern Rt_m128i     Rt_mm_unpacklo_epi32(Rt_m128i a, Rt_m128i b);
extern Rt_m128i     Rt_mm_unpacklo_epi64(Rt_m128i a, Rt_m128i b);
extern Rt_m128i     Rt_mm_loadl_epi64(Rt_m128i const *p);
extern Rt_m128i     Rt_mm_load_si128(const Rt_m128i * p);
extern Rt_m128i     Rt_mm_loadu_si128(const Rt_m128i * p);
extern Rt_m128i     Rt_mm_set_epi64(Rt_m64 q1, Rt_m64 q0);
extern Rt_m128i     Rt_mm_set_epi32(int i3, int i2, int i1, int i0);
extern              Rt_m128i
    Rt_mm_set_epi16(short w7, short w6,
                    short w5, short w4, short w3, short w2,
                    short w1, short w0);
extern Rt_m128i     Rt_mm_set_epi8(char b15, char b14,
                                   char b13, char b12,
                                   char b11, char b10,
                                   char b9, char b8,
                                   char b7, char b6,
                                   char b5, char b4,
                                   char b3, char b2,
                                   char b1, char b0);
extern Rt_m128i     Rt_mm_set1_epi64(Rt_m64 q);
extern Rt_m128i     Rt_mm_set1_epi32(int i);
extern Rt_m128i     Rt_mm_set1_epi16(short w);
extern Rt_m128i     Rt_mm_set1_epi8(char b);
extern Rt_m128i     Rt_mm_setr_epi64(Rt_m64 q0, Rt_m64 q1);
extern Rt_m128i     Rt_mm_setr_epi32(int i0, int i1, int i2,
                                     int i3);
extern Rt_m128i     Rt_mm_setr_epi16(short w0, short w1,
                                     short w2, short w3,
                                     short w4, short w5,
                                     short w6, short w7);
extern Rt_m128i     Rt_mm_setr_epi8(char b0, char b1,
                                    char b2, char b3,
                                    char b4, char b5,
                                    char b6, char b7,
                                    char b8, char b9,
                                    char b10, char b11,
                                    char b12, char b13,
                                    char b14, char b15);
extern Rt_m128i     Rt_mm_setzero_si128(void);

/* Store Operations  */

extern void         Rt_mm_store_si128(Rt_m128i * p, Rt_m128i a);
extern void         Rt_mm_storeu_si128(Rt_m128i * p, Rt_m128i a);
extern void         Rt_mm_maskmoveu_si128(Rt_m128i s, Rt_m128i n,
                                          char *p);
extern void         Rt_mm_storel_epi64(Rt_m128i * p, Rt_m128i a);
extern void         Rt_mm_stream_si128(Rt_m128i * p, Rt_m128i a);
extern void         Rt_mm_stream_si32(int *p, int a);
extern void         Rt_mm_clflush(void const *p);
extern void         Rt_mm_lfence(void);
extern void         Rt_mm_mfence(void);

/*
 * API
 */
extern RwUInt32     RtIntelRDTSC(void);
extern RwUInt32     RtIntelToggleEFLAGS(int mask);
extern RwUInt32     RtIntelCPUID(RwUInt32 level, 
                                 void *pb, void *pc, void *pd);
extern RwUInt32     RtIntelHaveCPUID(void);
extern RwUInt32     RtIntelHaveRDTSC(void);
extern RwUInt32     RtIntelHaveMMX(void);
extern RwUInt32     RtIntelHaveSSE(void);
extern RwUInt32     RtIntelHaveWNI(void);
extern RwUInt32     RtIntelCpuType(void);

extern RwBool       RtIntelStartTiming(void * data);
extern RwBool       RtIntelStopTiming(void *data);
extern RwBool       RtIntelTime(RwFixed64 * result,
                                RtIntelTimeFunction func,
                                void *data);

extern RwBool       RtIntelPluginAttach(void);

extern RtIntelOverload *_rtIntelOverloadGetHandle(void);

extern RxNodeDefinition *RxNodeDefinitionGetSSETransformCSL(void);


#ifdef    __cplusplus
}
#endif                          /* __cplusplus */

/*
 * LEGACY-SUPPORT -- e.g.
 * rwsdk/driver/d3d/baintd3d.c
 * is locked at time of writing
 */

#define RpIntelRDTSC()                  RtIntelRDTSC()
#define RpIntelToggleEFLAGS(_mask)      RtIntelToggleEFLAGS(_mask)
#define RpIntelCPUID(_level, _pb, _pc, _pd) \
                                        RtIntelCPUID(_level, _pb, _pc, _pd)
#define RpIntelHaveCPUID()              RtIntelHaveCPUID()
#define RpIntelHaveRDTSC()              RtIntelHaveRDTSC()
#define RpIntelHaveMMX()                RtIntelHaveMMX()
#define RpIntelHaveSSE()                RtIntelHaveSSE()
#define RpIntelHaveWNI()                RtIntelHaveWNI()
#define RpIntelCpuType()                RtIntelCpuType()
#define RpIntelStartTiming(_data)       RtIntelStartTiming(_data)
#define RpIntelStopTiming(_data)        RtIntelStopTiming(_data)
#define RpIntelTime(_result, _func, _data) \
                                        RtIntelTime(_result, _func, _data)
#define RpIntelPluginAttach()           RtIntelPluginAttach()
#define RpNodeDefinitionGetSSETransformCSL() \
                               RxNodeDefinitionGetSSETransformCSL()

typedef RtIntelOverload RwIntelOverload;
typedef RtIntelOverload RpIntelOverload;

#define _rwIntelOverloadGetHandle()     _rtIntelOverloadGetHandle()
#define _rpIntelOverloadGetHandle()     _rtIntelOverloadGetHandle()
#define RwIntelHaveSSE()                RtIntelHaveSSE()
#define RpIntelHaveSSE()                RtIntelHaveSSE()

#if (defined(RWEMULATEINTELSIMD) || !defined(__ICL))

/*
 * MMX
 */

/* General support intrinsics */
#define     _m_empty()                  Rt_m_empty()
#define     _m_from_int(i)              Rt_m_from_int(i)
#define     _m_to_int(m)                Rt_m_to_int(m)
#define     _m_packsswb(m1, m2)         Rt_m_packsswb(m1, m2)
#define     _m_packssdw(m1, m2)         Rt_m_packssdw(m1, m2)
#define     _m_packuswb(m1, m2)         Rt_m_packuswb(m1, m2)
#define     _m_punpckhbw(m1, m2)        Rt_m_punpckhbw(m1, m2)
#define     _m_punpckhwd(m1, m2)        Rt_m_punpckhwd(m1, m2)
#define     _m_punpckhdq(m1, m2)        Rt_m_punpckhdq(m1, m2)
#define     _m_punpcklbw(m1, m2)        Rt_m_punpcklbw(m1, m2)
#define     _m_punpcklwd(m1, m2)        Rt_m_punpcklwd(m1, m2)
#define     _m_punpckldq(m1, m2)        Rt_m_punpckldq(m1, m2)

/* Packed arithmetic intrinsics */
#define     _m_paddb(m1, m2)            Rt_m_paddb(m1, m2)
#define     _m_paddw(m1, m2)            Rt_m_paddw(m1, m2)
#define     _m_paddd(m1, m2)            Rt_m_paddd(m1, m2)
#define     _m_paddsb(m1, m2)           Rt_m_paddsb(m1, m2)
#define     _m_paddsw(m1, m2)           Rt_m_paddsw(m1, m2)
#define     _m_paddusb(m1, m2)          Rt_m_paddusb(m1, m2)
#define     _m_paddusw(m1, m2)          Rt_m_paddusw(m1, m2)
#define     _m_psubb(m1, m2)            Rt_m_psubb(m1, m2)
#define     _m_psubw(m1, m2)            Rt_m_psubw(m1, m2)
#define     _m_psubd(m1, m2)            Rt_m_psubd(m1, m2)
#define     _m_psubsb(m1, m2)           Rt_m_psubsb(m1, m2)
#define     _m_psubsw(m1, m2)           Rt_m_psubsw(m1, m2)
#define     _m_psubusb(m1, m2)          Rt_m_psubusb(m1, m2)
#define     _m_psubusw(m1, m2)          Rt_m_psubusw(m1, m2)
#define     _m_pmaddwd(m1, m2)          Rt_m_pmaddwd(m1, m2)
#define     _m_pmulhw(m1, m2)           Rt_m_pmulhw(m1, m2)
#define     _m_pmullw(m1, m2)           Rt_m_pmullw(m1, m2)

/* Shift intrinsics */
#define     _m_psllw(m, count)          Rt_m_psllw(m, count)
#define     _m_psllwi(m, count)         Rt_m_psllwi(m, count)
#define     _m_pslld(m, count)          Rt_m_pslld(m, count)
#define     _m_pslldi(m, count)         Rt_m_pslldi(m, count)
#define     _m_psllq(m, count)          Rt_m_psllq(m, count)
#define     _m_psllqi(m, count)         Rt_m_psllqi(m, count)
#define     _m_psraw(m, count)          Rt_m_psraw(m, count)
#define     _m_psrawi(m, count)         Rt_m_psrawi(m, count)
#define     _m_psrad(m, count)          Rt_m_psrad(m, count)
#define     _m_psradi(m, count)         Rt_m_psradi(m, count)
#define     _m_psrlw(m, count)          Rt_m_psrlw(m, count)
#define     _m_psrlwi(m, count)         Rt_m_psrlwi(m, count)
#define     _m_psrld(m, count)          Rt_m_psrld(m, count)
#define     _m_psrldi(m, count)         Rt_m_psrldi(m, count)
#define     _m_psrlq(m, count)          Rt_m_psrlq(m, count)
#define     _m_psrlqi(m, count)         Rt_m_psrlqi(m, count)

/* Logical intrinsics */
#define     _m_pand(m1, m2)             Rt_m_pand(m1, m2)
#define     _m_pandn(m1, m2)            Rt_m_pandn(m1, m2)
#define     _m_por(m1, m2)              Rt_m_por(m1, m2)
#define     _m_pxor(m1, m2)             Rt_m_pxor(m1, m2)

/* Comparison intrinsics */
#define     _m_pcmpeqb(m1, m2)          Rt_m_pcmpeqb(m1, m2)
#define     _m_pcmpeqw(m1, m2)          Rt_m_pcmpeqw(m1, m2)
#define     _m_pcmpeqd(m1, m2)          Rt_m_pcmpeqd(m1, m2)
#define     _m_pcmpgtb(m1, m2)          Rt_m_pcmpgtb(m1, m2)
#define     _m_pcmpgtw(m1, m2)          Rt_m_pcmpgtw(m1, m2)
#define     _m_pcmpgtd(m1, m2)          Rt_m_pcmpgtd(m1, m2)

/*
 * SSE
 */

/*
 * Arithmetic Operations
 */

#define _mm_add_ss(a, b)                 Rt_mm_add_ss(a, b)
#define _mm_add_ps(a, b)                 Rt_mm_add_ps(a, b)
#define _mm_sub_ss(a, b)                 Rt_mm_sub_ss(a, b)
#define _mm_sub_ps(a, b)                 Rt_mm_sub_ps(a, b)
#define _mm_mul_ss(a, b)                 Rt_mm_mul_ss(a, b)
#define _mm_mul_ps(a, b)                 Rt_mm_mul_ps(a, b)
#define _mm_div_ss(a, b)                 Rt_mm_div_ss(a, b)
#define _mm_div_ps(a, b)                 Rt_mm_div_ps(a, b)
#define _mm_sqrt_ss(a)                   Rt_mm_sqrt_ss(a)
#define _mm_sqrt_ps(a)                   Rt_mm_sqrt_ps(a)
#define _mm_rcp_ss(a)                    Rt_mm_rcp_ss(a)
#define _mm_rcp_ps(a)                    Rt_mm_rcp_ps(a)
#define _mm_rsqrt_ss(a)                  Rt_mm_rsqrt_ss(a)
#define _mm_rsqrt_ps(a)                  Rt_mm_rsqrt_ps(a)
#define _mm_min_ss(a, b)                 Rt_mm_min_ss(a, b)
#define _mm_min_ps(a, b)                 Rt_mm_min_ps(a, b)
#define _mm_max_ss(a, b)                 Rt_mm_max_ss(a, b)
#define _mm_max_ps(a, b)                 Rt_mm_max_ps(a, b)

/*
 * Logical Operations
 */

#define _mm_and_ps(a, b)                 Rt_mm_and_ps(a, b)
#define _mm_andnot_ps(a, b)              Rt_mm_andnot_ps(a, b)
#define _mm_or_ps(a, b)                  Rt_mm_or_ps(a, b)
#define _mm_xor_ps(a, b)                 Rt_mm_xor_ps(a, b)

/*
 * Comparisons
 */

#define _mm_cmpeq_ss(a, b)               Rt_mm_cmpeq_ss(a, b)
#define _mm_cmpeq_ps(a, b)               Rt_mm_cmpeq_ps(a, b)
#define _mm_cmplt_ss(a, b)               Rt_mm_cmplt_ss(a, b)
#define _mm_cmplt_ps(a, b)               Rt_mm_cmplt_ps(a, b)
#define _mm_cmple_ss(a, b)               Rt_mm_cmple_ss(a, b)
#define _mm_cmple_ps(a, b)               Rt_mm_cmple_ps(a, b)
#define _mm_cmpgt_ss(a, b)               Rt_mm_cmpgt_ss(a, b)
#define _mm_cmpgt_ps(a, b)               Rt_mm_cmpgt_ps(a, b)
#define _mm_cmpge_ss(a, b)               Rt_mm_cmpge_ss(a, b)
#define _mm_cmpge_ps(a, b)               Rt_mm_cmpge_ps(a, b)
#define _mm_cmpneq_ss(a, b)              Rt_mm_cmpneq_ss(a, b)
#define _mm_cmpneq_ps(a, b)              Rt_mm_cmpneq_ps(a, b)
#define _mm_cmpnlt_ss(a, b)              Rt_mm_cmpnlt_ss(a, b)
#define _mm_cmpnlt_ps(a, b)              Rt_mm_cmpnlt_ps(a, b)
#define _mm_cmpnle_ss(a, b)              Rt_mm_cmpnle_ss(a, b)
#define _mm_cmpnle_ps(a, b)              Rt_mm_cmpnle_ps(a, b)
#define _mm_cmpngt_ss(a, b)              Rt_mm_cmpngt_ss(a, b)
#define _mm_cmpngt_ps(a, b)              Rt_mm_cmpngt_ps(a, b)
#define _mm_cmpnge_ss(a, b)              Rt_mm_cmpnge_ss(a, b)
#define _mm_cmpnge_ps(a, b)              Rt_mm_cmpnge_ps(a, b)
#define _mm_cmpord_ss(a, b)              Rt_mm_cmpord_ss(a, b)
#define _mm_cmpord_ps(a, b)              Rt_mm_cmpord_ps(a, b)
#define _mm_cmpunord_ss(a, b)            Rt_mm_cmpunord_ss(a, b)
#define _mm_cmpunord_ps(a, b)            Rt_mm_cmpunord_ps(a, b)
#define _mm_comieq_ss(a, b)              Rt_mm_comieq_ss(a, b)
#define _mm_comilt_ss(a, b)              Rt_mm_comilt_ss(a, b)
#define _mm_comile_ss(a, b)              Rt_mm_comile_ss(a, b)
#define _mm_comigt_ss(a, b)              Rt_mm_comigt_ss(a, b)
#define _mm_comige_ss(a, b)              Rt_mm_comige_ss(a, b)
#define _mm_comineq_ss(a, b)             Rt_mm_comineq_ss(a, b)
#define _mm_ucomieq_ss(a, b)             Rt_mm_ucomieq_ss(a, b)
#define _mm_ucomilt_ss(a, b)             Rt_mm_ucomilt_ss(a, b)
#define _mm_ucomile_ss(a, b)             Rt_mm_ucomile_ss(a, b)
#define _mm_ucomigt_ss(a, b)             Rt_mm_ucomigt_ss(a, b)
#define _mm_ucomige_ss(a, b)             Rt_mm_ucomige_ss(a, b)
#define _mm_ucomineq_ss(a, b)            Rt_mm_ucomineq_ss(a, b)

/*
 * Conversion Operations
 */

#define _mm_cvt_ss2si(a)                 Rt_mm_cvt_ss2si(a)
#define _mm_cvt_ps2pi(a)                 Rt_mm_cvt_ps2pi(a)
#define _mm_cvtt_ss2si(a)                Rt_mm_cvtt_ss2si(a)
#define _mm_cvtt_ps2pi(a)                Rt_mm_cvtt_ps2pi(a)
#define _mm_cvt_si2ss(a, b)              Rt_mm_cvt_si2ss(a, b)
#define _mm_cvt_pi2ps(a, b)              Rt_mm_cvt_pi2ps(a, b)

/*
 *     Miscellaneous
 */

#define _mm_shuffle_ps(a, b, i)          Rt_mm_shuffle_ps(a, b, i)
#define _mm_unpackhi_ps(a, b)            Rt_mm_unpackhi_ps(a, b)
#define _mm_unpacklo_ps(a, b)            Rt_mm_unpacklo_ps(a, b)
#define _mm_loadh_pi(a, p)               Rt_mm_loadh_pi(a, p)
#define _mm_storeh_pi(p, a)              Rt_mm_storeh_pi(p, a)
#define _mm_movehl_ps(a, b)              Rt_mm_movehl_ps(a, b)
#define _mm_movelh_ps(a, b)              Rt_mm_movelh_ps(a, b)
#define _mm_loadl_pi(a, p)               Rt_mm_loadl_pi(a, p)
#define _mm_storel_pi(p, a)              Rt_mm_storel_pi(p, a)
#define _mm_movemask_ps(a)               Rt_mm_movemask_ps(a)
#define _mm_getcsr()                     Rt_mm_getcsr()
#define _mm_setcsr(i)                    Rt_mm_setcsr(i)

/*
 *Load Operations
 */

#define _mm_load_ss(p)                  Rt_mm_load_ss(p)
#define _mm_load_ps1(p)                 Rt_mm_load_ps1(p)
#define _mm_load_ps(p)                  Rt_mm_load_ps(p)
#define _mm_loadu_ps(p)                 Rt_mm_loadu_ps(p)
#define _mm_loadr_ps(p)                 Rt_mm_loadr_ps(p)

/*
 * Set Operations
 */

#define _mm_set_ss(w)                   Rt_mm_set_ss(w)
#define _mm_set_ps1(w)                  Rt_mm_set_ps1(w)
#define _mm_set_ps(z, y, x, w)          Rt_mm_set_ps(z, y, x, w)
#define _mm_setr_ps(z, y, x, w)         Rt_mm_setr_ps(z, y, x, w)
#define _mm_setzero_ps()                Rt_mm_setzero_ps()

/*
 * Store Operations
 */

#define _mm_store_ss(p, a)              Rt_mm_store_ss(p, a)
#define _mm_store_ps1(p, a)             Rt_mm_store_ps1(p, a)
#define _mm_store_ps(p, a)              Rt_mm_store_ps(p, a)
#define _mm_storeu_ps(p, a)             Rt_mm_storeu_ps(p, a)
#define _mm_storer_ps(p, a)             Rt_mm_storer_ps(p, a)
#define _mm_move_ss(a, b)               Rt_mm_move_ss(a, b)

/*
 * Integer Intrinsics
 */

#define _m_pextrw(a, n)                 Rt_m_pextrw(a, n)
#define _m_pinsrw(a, d, n)              Rt_m_pinsrw(a, d, n)
#define _m_pmaxsw(a, b)                 Rt_m_pmaxsw(a, b)
#define _m_pmaxub(a, b)                 Rt_m_pmaxub(a, b)
#define _m_pminsw(a, b)                 Rt_m_pminsw(a, b)
#define _m_pminub(a, b)                 Rt_m_pminub(a, b)
#define _m_pmovmskb(a)                  Rt_m_pmovmskb(a)
#define _m_pmulhuw(a, b)                Rt_m_pmulhuw(a, b)
#define _m_pshufw(a, n)                 Rt_m_pshufw(a, n)
#define _m_lwmaskmovq(d, n, p)          Rt_m_lwmaskmovq(d, n, p)

/*
 * Cacheability Support
 */

#define _mm_prefetch(p, i)              Rt_mm_prefetch(p, i)
#define _mm_stream_pi(p, a)             Rt_mm_stream_pi(p, a)
#define _mm_stream_ps(p, a)             Rt_mm_stream_ps(p, a)
#define _mm_sfence()                    Rt_mm_sfence()

#endif /* (defined(RWEMULATEINTELSIMD) || !defined(__ICL)) */

#endif /* RTINTEL_H */