summaryrefslogtreecommitdiffstats
path: root/src/gcc-3-intrinsics.patch
blob: 5fda900d149a1004da67a8748b625b24262c0c4a (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
# This file is part of MXE.
# See index.html for further information.

This patch has been taken from:
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56038

diff -Nur gcc-4.8.0.orig/gcc/config/i386/adxintrin.h gcc-4.8.0/gcc/config/i386/adxintrin.h
--- gcc-4.8.0.orig/gcc/config/i386/adxintrin.h	2013-01-11 07:38:27.000000000 +1100
+++ gcc-4.8.0/gcc/config/i386/adxintrin.h	2013-03-25 20:56:28.799283008 +1100
@@ -28,6 +28,10 @@
 #ifndef _ADXINTRIN_H_INCLUDED
 #define _ADXINTRIN_H_INCLUDED
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 extern __inline unsigned char
 __attribute__((__gnu_inline__, __always_inline__, __artificial__))
 _addcarryx_u32 (unsigned char __CF, unsigned int __X,
@@ -46,4 +50,8 @@
 }
 #endif
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif /* _ADXINTRIN_H_INCLUDED */
diff -Nur gcc-4.8.0.orig/gcc/config/i386/ammintrin.h gcc-4.8.0/gcc/config/i386/ammintrin.h
--- gcc-4.8.0.orig/gcc/config/i386/ammintrin.h	2013-01-11 07:38:27.000000000 +1100
+++ gcc-4.8.0/gcc/config/i386/ammintrin.h	2013-03-25 20:57:25.809281634 +1100
@@ -34,6 +34,10 @@
 /* We need definitions from the SSE3, SSE2 and SSE header files*/
 #include <pmmintrin.h>
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 extern __inline void __attribute__((__gnu_inline__, __always_inline__, __artificial__))
 _mm_stream_sd (double * __P, __m128d __Y)
 {
@@ -83,6 +87,10 @@
 				      (unsigned int)(I), (unsigned int)(L)))
 #endif
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif /* __SSE4A__ */
 
 #endif /* _AMMINTRIN_H_INCLUDED */
diff -Nur gcc-4.8.0.orig/gcc/config/i386/avx2intrin.h gcc-4.8.0/gcc/config/i386/avx2intrin.h
--- gcc-4.8.0.orig/gcc/config/i386/avx2intrin.h	2013-01-11 07:38:27.000000000 +1100
+++ gcc-4.8.0/gcc/config/i386/avx2intrin.h	2013-03-25 20:58:19.069280351 +1100
@@ -25,6 +25,10 @@
 # error "Never use <avx2intrin.h> directly; include <immintrin.h> instead."
 #endif
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 /* Sum absolute 8-bit integer difference of adjacent groups of 4
    byte integers in the first 2 operands.  Starting offsets within
    operands are determined by the 3rd mask operand.  */
@@ -1871,3 +1875,7 @@
 					   (__v4si)(__m128i)MASK,  \
 					   (int)SCALE)
 #endif  /* __OPTIMIZE__ */
+
+#ifdef __cplusplus
+}
+#endif
diff -Nur gcc-4.8.0.orig/gcc/config/i386/avxintrin.h gcc-4.8.0/gcc/config/i386/avxintrin.h
--- gcc-4.8.0.orig/gcc/config/i386/avxintrin.h	2013-01-11 07:38:27.000000000 +1100
+++ gcc-4.8.0/gcc/config/i386/avxintrin.h	2013-03-25 21:27:20.819238377 +1100
@@ -28,6 +28,10 @@
 # error "Never use <avxintrin.h> directly; include <immintrin.h> instead."
 #endif
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 /* Internal data types for implementing the intrinsics.  */
 typedef double __v4df __attribute__ ((__vector_size__ (32)));
 typedef float __v8sf __attribute__ ((__vector_size__ (32)));
@@ -1424,3 +1428,7 @@
 {
   return (__m256i) __builtin_ia32_si256_si ((__v4si)__A);
 }
+
+#ifdef __cplusplus
+}
+#endif
diff -Nur gcc-4.8.0.orig/gcc/config/i386/bmi2intrin.h gcc-4.8.0/gcc/config/i386/bmi2intrin.h
--- gcc-4.8.0.orig/gcc/config/i386/bmi2intrin.h	2013-01-11 07:38:27.000000000 +1100
+++ gcc-4.8.0/gcc/config/i386/bmi2intrin.h	2013-03-25 20:58:50.845946252 +1100
@@ -32,6 +32,10 @@
 #ifndef _BMI2INTRIN_H_INCLUDED
 #define _BMI2INTRIN_H_INCLUDED
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 extern __inline unsigned int
 __attribute__((__gnu_inline__, __always_inline__, __artificial__))
 _bzhi_u32 (unsigned int __X, unsigned int __Y)
@@ -99,4 +103,8 @@
 
 #endif /* !__x86_64__  */
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif /* _BMI2INTRIN_H_INCLUDED */
diff -Nur gcc-4.8.0.orig/gcc/config/i386/bmiintrin.h gcc-4.8.0/gcc/config/i386/bmiintrin.h
--- gcc-4.8.0.orig/gcc/config/i386/bmiintrin.h	2013-01-11 07:38:27.000000000 +1100
+++ gcc-4.8.0/gcc/config/i386/bmiintrin.h	2013-03-25 20:59:19.032612239 +1100
@@ -32,6 +32,10 @@
 #ifndef _BMIINTRIN_H_INCLUDED
 #define _BMIINTRIN_H_INCLUDED
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 extern __inline unsigned short __attribute__((__gnu_inline__, __always_inline__, __artificial__))
 __tzcnt_u16 (unsigned short __X)
 {
@@ -116,4 +120,8 @@
 
 #endif /* __x86_64__  */
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif /* _BMIINTRIN_H_INCLUDED */
diff -Nur gcc-4.8.0.orig/gcc/config/i386/cpuid.h gcc-4.8.0/gcc/config/i386/cpuid.h
--- gcc-4.8.0.orig/gcc/config/i386/cpuid.h	2013-01-11 07:38:27.000000000 +1100
+++ gcc-4.8.0/gcc/config/i386/cpuid.h	2013-03-25 19:28:56.476076250 +1100
@@ -21,6 +21,10 @@
  * <http://www.gnu.org/licenses/>.
  */
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 /* %ecx */
 #define bit_SSE3	(1 << 0)
 #define bit_PCLMUL	(1 << 1)
@@ -266,3 +270,8 @@
   __cpuid (__level, *__eax, *__ebx, *__ecx, *__edx);
   return 1;
 }
+
+#ifdef __cplusplus
+}
+#endif
+
diff -Nur gcc-4.8.0.orig/gcc/config/i386/emmintrin.h gcc-4.8.0/gcc/config/i386/emmintrin.h
--- gcc-4.8.0.orig/gcc/config/i386/emmintrin.h	2013-01-11 07:38:27.000000000 +1100
+++ gcc-4.8.0/gcc/config/i386/emmintrin.h	2013-03-25 19:28:56.476076250 +1100
@@ -34,6 +34,10 @@
 /* We need definitions from the SSE header files*/
 #include <xmmintrin.h>
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 /* SSE2 */
 typedef double __v2df __attribute__ ((__vector_size__ (16)));
 typedef long long __v2di __attribute__ ((__vector_size__ (16)));
@@ -1515,6 +1519,10 @@
   return (__m128d) __A;
 }
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif /* __SSE2__  */
 
 #endif /* _EMMINTRIN_H_INCLUDED */
diff -Nur gcc-4.8.0.orig/gcc/config/i386/f16cintrin.h gcc-4.8.0/gcc/config/i386/f16cintrin.h
--- gcc-4.8.0.orig/gcc/config/i386/f16cintrin.h	2013-01-11 07:38:27.000000000 +1100
+++ gcc-4.8.0/gcc/config/i386/f16cintrin.h	2013-03-25 21:00:27.905943912 +1100
@@ -32,6 +32,10 @@
 #ifndef _F16CINTRIN_H_INCLUDED
 #define _F16CINTRIN_H_INCLUDED
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 extern __inline float __attribute__((__gnu_inline__, __always_inline__, __artificial__))
 _cvtsh_ss (unsigned short __S)
 {
@@ -88,5 +92,9 @@
   ((__m128i) __builtin_ia32_vcvtps2ph256 ((__v8sf)(__m256) A, (int) (I)))
 #endif /* __OPTIMIZE */
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif /* _F16CINTRIN_H_INCLUDED */
 #endif /* __F16C__ */
diff -Nur gcc-4.8.0.orig/gcc/config/i386/fma4intrin.h gcc-4.8.0/gcc/config/i386/fma4intrin.h
--- gcc-4.8.0.orig/gcc/config/i386/fma4intrin.h	2013-01-11 07:38:27.000000000 +1100
+++ gcc-4.8.0/gcc/config/i386/fma4intrin.h	2013-03-25 19:28:56.479409583 +1100
@@ -35,6 +35,10 @@
 /* We need definitions from the SSE4A, SSE3, SSE2 and SSE header files.  */
 #include <ammintrin.h>
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 /* 128b Floating point multiply/add type instructions.  */
 extern __inline __m128 __attribute__((__gnu_inline__, __always_inline__, __artificial__))
 _mm_macc_ps (__m128 __A, __m128 __B, __m128 __C)
@@ -231,6 +235,10 @@
   return (__m256d) __builtin_ia32_vfmaddsubpd256 ((__v4df)__A, (__v4df)__B, -(__v4df)__C);
 }
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif
 
 #endif
diff -Nur gcc-4.8.0.orig/gcc/config/i386/fmaintrin.h gcc-4.8.0/gcc/config/i386/fmaintrin.h
--- gcc-4.8.0.orig/gcc/config/i386/fmaintrin.h	2013-01-11 07:38:27.000000000 +1100
+++ gcc-4.8.0/gcc/config/i386/fmaintrin.h	2013-03-25 21:01:36.072608935 +1100
@@ -32,6 +32,10 @@
 # error "FMA instruction set not enabled"
 #else
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 extern __inline __m128d
 __attribute__((__gnu_inline__, __always_inline__, __artificial__))
 _mm_fmadd_pd (__m128d __A, __m128d __B, __m128d __C)
@@ -292,6 +296,10 @@
                                                 -(__v8sf)__C);
 }
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif
 
 #endif
diff -Nur gcc-4.8.0.orig/gcc/config/i386/fxsrintrin.h gcc-4.8.0/gcc/config/i386/fxsrintrin.h
--- gcc-4.8.0.orig/gcc/config/i386/fxsrintrin.h	2013-01-11 07:38:27.000000000 +1100
+++ gcc-4.8.0/gcc/config/i386/fxsrintrin.h	2013-03-25 21:02:02.299274971 +1100
@@ -28,6 +28,10 @@
 #ifndef _FXSRINTRIN_H_INCLUDED
 #define _FXSRINTRIN_H_INCLUDED
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 extern __inline void
 __attribute__((__gnu_inline__, __always_inline__, __artificial__))
 _fxsave (void *__P)
@@ -58,4 +62,8 @@
 }
 #endif
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif /* _FXSRINTRIN_H_INCLUDED */
diff -Nur gcc-4.8.0.orig/gcc/config/i386/gmm_malloc.h gcc-4.8.0/gcc/config/i386/gmm_malloc.h
--- gcc-4.8.0.orig/gcc/config/i386/gmm_malloc.h	2013-01-11 07:38:27.000000000 +1100
+++ gcc-4.8.0/gcc/config/i386/gmm_malloc.h	2013-03-25 19:28:56.479409583 +1100
@@ -27,6 +27,10 @@
 #include <stdlib.h>
 #include <errno.h>
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 static __inline__ void* 
 _mm_malloc (size_t size, size_t align)
 {
@@ -71,4 +75,8 @@
     free (((void **) aligned_ptr) [-1]);
 }
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif /* _MM_MALLOC_H_INCLUDED */
diff -Nur gcc-4.8.0.orig/gcc/config/i386/ia32intrin.h gcc-4.8.0/gcc/config/i386/ia32intrin.h
--- gcc-4.8.0.orig/gcc/config/i386/ia32intrin.h	2013-01-11 07:38:27.000000000 +1100
+++ gcc-4.8.0/gcc/config/i386/ia32intrin.h	2013-03-25 21:30:01.905901162 +1100
@@ -25,6 +25,10 @@
 # error "Never use <ia32intrin.h> directly; include <x86intrin.h> instead."
 #endif
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 /* 32bit bsf */
 extern __inline int
 __attribute__((__gnu_inline__, __always_inline__, __artificial__))
@@ -240,3 +244,7 @@
 #define _rotwr(a,b)		__rorw((a), (b))
 #define _rotl(a,b)		__rold((a), (b))
 #define _rotr(a,b)		__rord((a), (b))
+
+#ifdef __cplusplus
+}
+#endif
diff -Nur gcc-4.8.0.orig/gcc/config/i386/immintrin.h gcc-4.8.0/gcc/config/i386/immintrin.h
--- gcc-4.8.0.orig/gcc/config/i386/immintrin.h	2013-01-11 07:38:27.000000000 +1100
+++ gcc-4.8.0/gcc/config/i386/immintrin.h	2013-03-25 21:11:37.879261100 +1100
@@ -88,6 +88,10 @@
 #include <xtestintrin.h>
 #endif
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 #ifdef __RDRND__
 extern __inline int
 __attribute__((__gnu_inline__, __always_inline__, __artificial__))
@@ -173,4 +177,8 @@
 #endif /* __RDRND__ */
 #endif /* __x86_64__  */
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif /* _IMMINTRIN_H_INCLUDED */
diff -Nur gcc-4.8.0.orig/gcc/config/i386/lwpintrin.h gcc-4.8.0/gcc/config/i386/lwpintrin.h
--- gcc-4.8.0.orig/gcc/config/i386/lwpintrin.h	2013-01-11 07:38:27.000000000 +1100
+++ gcc-4.8.0/gcc/config/i386/lwpintrin.h	2013-03-25 19:28:56.479409583 +1100
@@ -32,6 +32,10 @@
 # error "LWP instruction set not enabled"
 #else
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 extern __inline void __attribute__((__gnu_inline__, __always_inline__, __artificial__))
 __llwpcb (void *pcbAddress)
 {
@@ -95,6 +99,10 @@
 #endif
 #endif
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif /* __LWP__ */
 
 #endif /* _LWPINTRIN_H_INCLUDED */
diff -Nur gcc-4.8.0.orig/gcc/config/i386/lzcntintrin.h gcc-4.8.0/gcc/config/i386/lzcntintrin.h
--- gcc-4.8.0.orig/gcc/config/i386/lzcntintrin.h	2013-01-11 07:38:27.000000000 +1100
+++ gcc-4.8.0/gcc/config/i386/lzcntintrin.h	2013-03-25 21:12:40.285926264 +1100
@@ -32,6 +32,10 @@
 #ifndef _LZCNTINTRIN_H_INCLUDED
 #define _LZCNTINTRIN_H_INCLUDED
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 extern __inline unsigned short __attribute__((__gnu_inline__, __always_inline__, __artificial__))
 __lzcnt16 (unsigned short __X)
 {
@@ -64,4 +68,8 @@
 }
 #endif
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif /* _LZCNTINTRIN_H_INCLUDED */
diff -Nur gcc-4.8.0.orig/gcc/config/i386/mm3dnow.h gcc-4.8.0/gcc/config/i386/mm3dnow.h
--- gcc-4.8.0.orig/gcc/config/i386/mm3dnow.h	2013-01-11 07:38:27.000000000 +1100
+++ gcc-4.8.0/gcc/config/i386/mm3dnow.h	2013-03-25 19:28:56.482742915 +1100
@@ -32,6 +32,10 @@
 #include <mmintrin.h>
 #include <prfchwintrin.h>
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 extern __inline void __attribute__((__gnu_inline__, __always_inline__, __artificial__))
 _m_femms (void)
 {
@@ -205,6 +209,11 @@
 }
 
 #endif /* __3dNOW_A__ */
+
+#ifdef __cplusplus
+}
+#endif
+
 #endif /* __3dNOW__ */
 
 #endif /* _MM3DNOW_H_INCLUDED */
diff -Nur gcc-4.8.0.orig/gcc/config/i386/mmintrin.h gcc-4.8.0/gcc/config/i386/mmintrin.h
--- gcc-4.8.0.orig/gcc/config/i386/mmintrin.h	2013-01-11 07:38:27.000000000 +1100
+++ gcc-4.8.0/gcc/config/i386/mmintrin.h	2013-03-25 19:28:56.482742915 +1100
@@ -30,6 +30,11 @@
 #ifndef __MMX__
 # error "MMX instruction set not enabled"
 #else
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 /* The Intel API is flexible enough that we must allow aliasing with other
    vector types, and their scalar components.  */
 typedef int __m64 __attribute__ ((__vector_size__ (8), __may_alias__));
@@ -916,5 +921,9 @@
   return _mm_set_pi8 (__b, __b, __b, __b, __b, __b, __b, __b);
 }
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif /* __MMX__ */
 #endif /* _MMINTRIN_H_INCLUDED */
diff -Nur gcc-4.8.0.orig/gcc/config/i386/pmm_malloc.h gcc-4.8.0/gcc/config/i386/pmm_malloc.h
--- gcc-4.8.0.orig/gcc/config/i386/pmm_malloc.h	2013-01-11 07:38:27.000000000 +1100
+++ gcc-4.8.0/gcc/config/i386/pmm_malloc.h	2013-03-25 19:28:56.482742915 +1100
@@ -34,6 +34,10 @@
 extern "C" int posix_memalign (void **, size_t, size_t) throw ();
 #endif
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 static __inline void *
 _mm_malloc (size_t size, size_t alignment)
 {
@@ -54,4 +58,8 @@
   free (ptr);
 }
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif /* _MM_MALLOC_H_INCLUDED */
diff -Nur gcc-4.8.0.orig/gcc/config/i386/pmmintrin.h gcc-4.8.0/gcc/config/i386/pmmintrin.h
--- gcc-4.8.0.orig/gcc/config/i386/pmmintrin.h	2013-01-11 07:38:27.000000000 +1100
+++ gcc-4.8.0/gcc/config/i386/pmmintrin.h	2013-03-25 19:28:56.482742915 +1100
@@ -34,6 +34,10 @@
 /* We need definitions from the SSE2 and SSE header files*/
 #include <emmintrin.h>
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 /* Additional bits in the MXCSR.  */
 #define _MM_DENORMALS_ZERO_MASK		0x0040
 #define _MM_DENORMALS_ZERO_ON		0x0040
@@ -122,6 +126,10 @@
   __builtin_ia32_mwait (__E, __H);
 }
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif /* __SSE3__ */
 
 #endif /* _PMMINTRIN_H_INCLUDED */
diff -Nur gcc-4.8.0.orig/gcc/config/i386/popcntintrin.h gcc-4.8.0/gcc/config/i386/popcntintrin.h
--- gcc-4.8.0.orig/gcc/config/i386/popcntintrin.h	2013-01-11 07:38:27.000000000 +1100
+++ gcc-4.8.0/gcc/config/i386/popcntintrin.h	2013-03-25 19:28:56.482742915 +1100
@@ -28,6 +28,10 @@
 #ifndef _POPCNTINTRIN_H_INCLUDED
 #define _POPCNTINTRIN_H_INCLUDED
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 /* Calculate a number of bits set to 1.  */
 extern __inline int __attribute__((__gnu_inline__, __always_inline__, __artificial__))
 _mm_popcnt_u32 (unsigned int __X)
@@ -43,4 +47,8 @@
 }
 #endif
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif /* _POPCNTINTRIN_H_INCLUDED */
diff -Nur gcc-4.8.0.orig/gcc/config/i386/prfchwintrin.h gcc-4.8.0/gcc/config/i386/prfchwintrin.h
--- gcc-4.8.0.orig/gcc/config/i386/prfchwintrin.h	2013-01-11 07:38:27.000000000 +1100
+++ gcc-4.8.0/gcc/config/i386/prfchwintrin.h	2013-03-25 21:13:57.149257744 +1100
@@ -33,10 +33,18 @@
 #ifndef _PRFCHWINTRIN_H_INCLUDED
 #define _PRFCHWINTRIN_H_INCLUDED
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 extern __inline void __attribute__((__gnu_inline__, __always_inline__, __artificial__))
 _m_prefetchw (void *__P)
 {
   __builtin_prefetch (__P, 1, 3 /* _MM_HINT_T0 */);
 }
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif /* _PRFCHWINTRIN_H_INCLUDED */
diff -Nur gcc-4.8.0.orig/gcc/config/i386/rdseedintrin.h gcc-4.8.0/gcc/config/i386/rdseedintrin.h
--- gcc-4.8.0.orig/gcc/config/i386/rdseedintrin.h	2013-01-11 07:38:27.000000000 +1100
+++ gcc-4.8.0/gcc/config/i386/rdseedintrin.h	2013-03-25 21:14:16.099257288 +1100
@@ -32,6 +32,10 @@
 #ifndef _RDSEEDINTRIN_H_INCLUDED
 #define _RDSEEDINTRIN_H_INCLUDED
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 extern __inline int
 __attribute__((__gnu_inline__, __always_inline__, __artificial__))
 _rdseed16_step (unsigned short *p)
@@ -55,4 +59,8 @@
 }
 #endif
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif /* _RDSEEDINTRIN_H_INCLUDED */
diff -Nur gcc-4.8.0.orig/gcc/config/i386/rtmintrin.h gcc-4.8.0/gcc/config/i386/rtmintrin.h
--- gcc-4.8.0.orig/gcc/config/i386/rtmintrin.h	2013-01-11 07:38:27.000000000 +1100
+++ gcc-4.8.0/gcc/config/i386/rtmintrin.h	2013-03-25 21:23:20.389244172 +1100
@@ -32,6 +32,10 @@
 #ifndef _RTMINTRIN_H_INCLUDED
 #define _RTMINTRIN_H_INCLUDED
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 #define _XBEGIN_STARTED		(~0u)
 #define _XABORT_EXPLICIT	(1 << 0)
 #define _XABORT_RETRY		(1 << 1)
@@ -74,4 +78,8 @@
 #define _xabort(N)  __builtin_ia32_xabort (N)
 #endif /* __OPTIMIZE__ */
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif /* _RTMINTRIN_H_INCLUDED */
diff -Nur gcc-4.8.0.orig/gcc/config/i386/smmintrin.h gcc-4.8.0/gcc/config/i386/smmintrin.h
--- gcc-4.8.0.orig/gcc/config/i386/smmintrin.h	2013-01-11 07:38:27.000000000 +1100
+++ gcc-4.8.0/gcc/config/i386/smmintrin.h	2013-03-25 19:28:56.486076248 +1100
@@ -35,6 +35,10 @@
    files.  */
 #include <tmmintrin.h>
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 /* Rounding mode macros. */
 #define _MM_FROUND_TO_NEAREST_INT	0x00
 #define _MM_FROUND_TO_NEG_INF		0x01
@@ -825,6 +829,10 @@
 
 #endif /* __SSE4_2__ */
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif /* __SSE4_1__ */
 
 #endif /* _SMMINTRIN_H_INCLUDED */
diff -Nur gcc-4.8.0.orig/gcc/config/i386/tbmintrin.h gcc-4.8.0/gcc/config/i386/tbmintrin.h
--- gcc-4.8.0.orig/gcc/config/i386/tbmintrin.h	2013-01-11 07:38:27.000000000 +1100
+++ gcc-4.8.0/gcc/config/i386/tbmintrin.h	2013-03-25 21:24:08.535909678 +1100
@@ -32,6 +32,10 @@
 #ifndef _TBMINTRIN_H_INCLUDED
 #define _TBMINTRIN_H_INCLUDED
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 #ifdef __OPTIMIZE__
 extern __inline unsigned int __attribute__((__gnu_inline__, __always_inline__, __artificial__))
 __bextri_u32 (unsigned int __X, const unsigned int __I)
@@ -169,4 +173,9 @@
 
 
 #endif /* __x86_64__  */
+
+#ifdef __cplusplus
+}
+#endif
+
 #endif /* _TBMINTRIN_H_INCLUDED */
diff -Nur gcc-4.8.0.orig/gcc/config/i386/tmmintrin.h gcc-4.8.0/gcc/config/i386/tmmintrin.h
--- gcc-4.8.0.orig/gcc/config/i386/tmmintrin.h	2013-01-11 07:38:27.000000000 +1100
+++ gcc-4.8.0/gcc/config/i386/tmmintrin.h	2013-03-25 19:28:56.486076248 +1100
@@ -34,6 +34,10 @@
 /* We need definitions from the SSE3, SSE2 and SSE header files*/
 #include <pmmintrin.h>
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 extern __inline __m128i __attribute__((__gnu_inline__, __always_inline__, __artificial__))
 _mm_hadd_epi16 (__m128i __X, __m128i __Y)
 {
@@ -239,6 +243,10 @@
   return (__m64) __builtin_ia32_pabsd ((__v2si)__X);
 }
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif /* __SSSE3__ */
 
 #endif /* _TMMINTRIN_H_INCLUDED */
diff -Nur gcc-4.8.0.orig/gcc/config/i386/wmmintrin.h gcc-4.8.0/gcc/config/i386/wmmintrin.h
--- gcc-4.8.0.orig/gcc/config/i386/wmmintrin.h	2013-01-11 07:38:27.000000000 +1100
+++ gcc-4.8.0/gcc/config/i386/wmmintrin.h	2013-03-25 21:34:25.419228145 +1100
@@ -34,6 +34,10 @@
 # error "AES/PCLMUL instructions not enabled"
 #else
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 /* AES */
 
 #ifdef __AES__
@@ -115,6 +119,10 @@
 #endif
 #endif  /* __PCLMUL__  */
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif /* __AES__/__PCLMUL__ */
 
 #endif /* _WMMINTRIN_H_INCLUDED */
diff -Nur gcc-4.8.0.orig/gcc/config/i386/xmmintrin.h gcc-4.8.0/gcc/config/i386/xmmintrin.h
--- gcc-4.8.0.orig/gcc/config/i386/xmmintrin.h	2013-01-11 07:38:27.000000000 +1100
+++ gcc-4.8.0/gcc/config/i386/xmmintrin.h	2013-03-25 19:28:56.486076248 +1100
@@ -37,6 +37,10 @@
 /* Get _mm_malloc () and _mm_free ().  */
 #include <mm_malloc.h>
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 /* The Intel API is flexible enough that we must allow aliasing with other
    vector types, and their scalar components.  */
 typedef float __m128 __attribute__ ((__vector_size__ (16), __may_alias__));
@@ -1241,6 +1245,10 @@
   (row3) = __builtin_ia32_movhlps (__t3, __t2);				\
 } while (0)
 
+#ifdef __cplusplus
+}
+#endif
+
 /* For backward source compatibility.  */
 #ifdef __SSE2__
 # include <emmintrin.h>
diff -Nur gcc-4.8.0.orig/gcc/config/i386/xopintrin.h gcc-4.8.0/gcc/config/i386/xopintrin.h
--- gcc-4.8.0.orig/gcc/config/i386/xopintrin.h	2013-01-11 07:38:27.000000000 +1100
+++ gcc-4.8.0/gcc/config/i386/xopintrin.h	2013-03-25 19:28:56.489409581 +1100
@@ -34,6 +34,10 @@
 
 #include <fma4intrin.h>
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 /* Integer multiply/add intructions. */
 extern __inline __m128i __attribute__((__gnu_inline__, __always_inline__, __artificial__))
 _mm_maccs_epi16(__m128i __A, __m128i __B, __m128i __C)
@@ -830,6 +834,10 @@
  					  (int)(I)))
 #endif /* __OPTIMIZE__ */
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif /* __XOP__ */
 
 #endif /* _XOPMMINTRIN_H_INCLUDED */
diff -Nur gcc-4.8.0.orig/gcc/config/i386/xsaveintrin.h gcc-4.8.0/gcc/config/i386/xsaveintrin.h
--- gcc-4.8.0.orig/gcc/config/i386/xsaveintrin.h	2013-01-11 07:38:27.000000000 +1100
+++ gcc-4.8.0/gcc/config/i386/xsaveintrin.h	2013-03-25 21:24:35.619242359 +1100
@@ -28,6 +28,10 @@
 #ifndef _XSAVEINTRIN_H_INCLUDED
 #define _XSAVEINTRIN_H_INCLUDED
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 extern __inline void
 __attribute__((__gnu_inline__, __always_inline__, __artificial__))
 _xsave (void *__P, long long __M)
@@ -58,4 +62,8 @@
 }
 #endif
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif /* _XSAVEINTRIN_H_INCLUDED */
diff -Nur gcc-4.8.0.orig/gcc/config/i386/xsaveoptintrin.h gcc-4.8.0/gcc/config/i386/xsaveoptintrin.h
--- gcc-4.8.0.orig/gcc/config/i386/xsaveoptintrin.h	2013-01-11 07:38:27.000000000 +1100
+++ gcc-4.8.0/gcc/config/i386/xsaveoptintrin.h	2013-03-25 21:24:56.469241856 +1100
@@ -28,6 +28,10 @@
 #ifndef _XSAVEOPTINTRIN_H_INCLUDED
 #define _XSAVEOPTINTRIN_H_INCLUDED
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 extern __inline void
 __attribute__((__gnu_inline__, __always_inline__, __artificial__))
 _xsaveopt (void *__P, long long __M)
@@ -44,4 +48,8 @@
 }
 #endif
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif /* _XSAVEOPTINTRIN_H_INCLUDED */
diff -Nur gcc-4.8.0.orig/gcc/config/i386/xtestintrin.h gcc-4.8.0/gcc/config/i386/xtestintrin.h
--- gcc-4.8.0.orig/gcc/config/i386/xtestintrin.h	2013-01-11 07:38:27.000000000 +1100
+++ gcc-4.8.0/gcc/config/i386/xtestintrin.h	2013-03-25 21:25:26.389241134 +1100
@@ -32,6 +32,10 @@
 #ifndef _XTESTINTRIN_H_INCLUDED
 #define _XTESTINTRIN_H_INCLUDED
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 /* Return non-zero if the instruction executes inside an RTM or HLE code
    region.  Return zero otherwise.   */
 extern __inline int
@@ -41,4 +45,8 @@
   return __builtin_ia32_xtest ();
 }
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif /* _XTESTINTRIN_H_INCLUDED */