~ubuntu-branches/debian/sid/gcc-4.8/sid

« back to all changes in this revision

Viewing changes to .svn/pristine/91/91bcafb3e1f5d0933efdf7126f3aaa8144e275e7.svn-base

  • Committer: Package Import Robot
  • Author(s): Matthias Klose
  • Date: 2014-12-19 19:48:34 UTC
  • Revision ID: package-import@ubuntu.com-20141219194834-4dz1q7rrn5pad823
Tags: 4.8.4-1
* GCC 4.8.4 release.
  - Fix PR target/61407 (darwin), PR middle-end/58624 (ice),
    PR sanitizer/64265 (wrong code).
* Require recent binutils to pass go test failures.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
# DP: Changes from the ibm/gcc-4_8-branch (20131125)
 
2
 
 
3
LANG=C svn diff svn://gcc.gnu.org/svn/gcc/branches/gcc-4_8-branch@204974 \
 
4
    svn://gcc.gnu.org/svn/gcc/branches/ibm/gcc-4_8-branch@205351 \
 
5
 | filterdiff --remove-timestamps --addoldprefix=a/src/ --addnewprefix=b/src/
 
6
 
 
7
--- a/src/libitm/configure
 
8
+++ b/src/libitm/configure
 
9
@@ -7270,7 +7270,7 @@
 
10
   rm -rf conftest*
 
11
   ;;
 
12
 
 
13
-x86_64-*kfreebsd*-gnu|x86_64-*linux*|ppc*-*linux*|powerpc*-*linux*| \
 
14
+x86_64-*kfreebsd*-gnu|x86_64-*linux*|powerpc*-*linux*| \
 
15
 s390*-*linux*|s390*-*tpf*|sparc*-*linux*)
 
16
   # Find out which ABI we are using.
 
17
   echo 'int i;' > conftest.$ac_ext
 
18
@@ -7295,7 +7295,10 @@
 
19
                ;;
 
20
            esac
 
21
            ;;
 
22
-         ppc64-*linux*|powerpc64-*linux*)
 
23
+         powerpc64le-*linux*)
 
24
+           LD="${LD-ld} -m elf32lppclinux"
 
25
+           ;;
 
26
+         powerpc64-*linux*)
 
27
            LD="${LD-ld} -m elf32ppclinux"
 
28
            ;;
 
29
          s390x-*linux*)
 
30
@@ -7314,7 +7317,10 @@
 
31
          x86_64-*linux*)
 
32
            LD="${LD-ld} -m elf_x86_64"
 
33
            ;;
 
34
-         ppc*-*linux*|powerpc*-*linux*)
 
35
+         powerpcle-*linux*)
 
36
+           LD="${LD-ld} -m elf64lppc"
 
37
+           ;;
 
38
+         powerpc-*linux*)
 
39
            LD="${LD-ld} -m elf64ppc"
 
40
            ;;
 
41
          s390*-*linux*|s390*-*tpf*)
 
42
@@ -11779,7 +11785,7 @@
 
43
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
 
44
   lt_status=$lt_dlunknown
 
45
   cat > conftest.$ac_ext <<_LT_EOF
 
46
-#line 11782 "configure"
 
47
+#line 11788 "configure"
 
48
 #include "confdefs.h"
 
49
 
 
50
 #if HAVE_DLFCN_H
 
51
@@ -11885,7 +11891,7 @@
 
52
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
 
53
   lt_status=$lt_dlunknown
 
54
   cat > conftest.$ac_ext <<_LT_EOF
 
55
-#line 11888 "configure"
 
56
+#line 11894 "configure"
 
57
 #include "confdefs.h"
 
58
 
 
59
 #if HAVE_DLFCN_H
 
60
@@ -17401,7 +17407,44 @@
 
61
 esac
 
62
 LIBITM_CHECK_AS_HTM
 
63
 
 
64
+case "${target_cpu}" in
 
65
+powerpc*)
 
66
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking if the assembler supports HTM" >&5
 
67
+$as_echo_n "checking if the assembler supports HTM... " >&6; }
 
68
+if test "${libitm_cv_as_htm+set}" = set; then :
 
69
+  $as_echo_n "(cached) " >&6
 
70
+else
 
71
 
 
72
+    cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 
73
+/* end confdefs.h.  */
 
74
+
 
75
+int
 
76
+main ()
 
77
+{
 
78
+asm("tbegin. 0; tend. 0");
 
79
+  ;
 
80
+  return 0;
 
81
+}
 
82
+_ACEOF
 
83
+if ac_fn_c_try_compile "$LINENO"; then :
 
84
+  libitm_cv_as_htm=yes
 
85
+else
 
86
+  libitm_cv_as_htm=no
 
87
+fi
 
88
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
 
89
+
 
90
+fi
 
91
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $libitm_cv_as_htm" >&5
 
92
+$as_echo "$libitm_cv_as_htm" >&6; }
 
93
+  if test x$libitm_cv_as_htm = xyes; then
 
94
+
 
95
+$as_echo "#define HAVE_AS_HTM 1" >>confdefs.h
 
96
+
 
97
+  fi
 
98
+  ;;
 
99
+esac
 
100
+
 
101
+
 
102
   { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether weak refs work like ELF" >&5
 
103
 $as_echo_n "checking whether weak refs work like ELF... " >&6; }
 
104
 if test "${ac_cv_have_elf_style_weakref+set}" = set; then :
 
105
--- a/src/libitm/ChangeLog.ibm
 
106
+++ b/src/libitm/ChangeLog.ibm
 
107
@@ -0,0 +1,31 @@
 
108
+2013-11-15  Ulrich Weigand  <Ulrich.Weigand@de.ibm.com>
 
109
+
 
110
+       Backport from mainline r204808:
 
111
+
 
112
+       2013-11-14  Ulrich Weigand  <Ulrich.Weigand@de.ibm.com>
 
113
+
 
114
+       * config/powerpc/sjlj.S [__powerpc64__ && _CALL_ELF == 2]:
 
115
+       (FUNC): Define ELFv2 variant.
 
116
+       (END): Likewise.
 
117
+       (HIDDEN): Likewise.
 
118
+       (CALL): Likewise.
 
119
+       (BASE): Likewise.
 
120
+       (LR_SAVE): Likewise.
 
121
+
 
122
+2013-07-15  Peter Bergner  <bergner@vnet.ibm.com>
 
123
+
 
124
+       Backport from mainline
 
125
+       2013-07-15  Peter Bergner  <bergner@vnet.ibm.com>
 
126
+
 
127
+        * acinclude.m4 (LIBITM_CHECK_AS_HTM): New.
 
128
+        * configure.ac: Use it.
 
129
+       (AC_CHECK_HEADERS): Check for sys/auxv.h.
 
130
+       (AC_CHECK_FUNCS): Check for getauxval.
 
131
+        * config.h.in, configure: Rebuild.
 
132
+       * configure.tgt (target_cpu): Add -mhtm to XCFLAGS.
 
133
+       * config/powerpc/target.h: Include sys/auxv.h and htmintrin.h.
 
134
+       (USE_HTM_FASTPATH): Define.
 
135
+       (_TBEGIN_STARTED, _TBEGIN_INDETERMINATE, _TBEGIN_PERSISTENT,
 
136
+       _HTM_RETRIES) New macros.
 
137
+       (htm_abort, htm_abort_should_retry, htm_available, htm_begin, htm_init,
 
138
+       htm_begin_success, htm_commit, htm_transaction_active): New functions.
 
139
--- a/src/libitm/configure.tgt
 
140
+++ b/src/libitm/configure.tgt
 
141
@@ -47,7 +47,10 @@
 
142
 # work out any special compilation flags as necessary.
 
143
 case "${target_cpu}" in
 
144
   alpha*)              ARCH=alpha ;;
 
145
-  rs6000 | powerpc*)   ARCH=powerpc ;;
 
146
+  rs6000 | powerpc*)
 
147
+       XCFLAGS="${XCFLAGS} -mhtm"
 
148
+       ARCH=powerpc
 
149
+       ;;
 
150
 
 
151
   arm*)                ARCH=arm ;;
 
152
 
 
153
--- a/src/libitm/config/powerpc/sjlj.S
 
154
+++ b/src/libitm/config/powerpc/sjlj.S
 
155
@@ -26,8 +26,27 @@
 
156
 
 
157
 #include "asmcfi.h"
 
158
 
 
159
-#if defined(__powerpc64__) && defined(__ELF__)
 
160
+#if defined(__powerpc64__) && _CALL_ELF == 2
 
161
 .macro FUNC name
 
162
+        .globl  \name
 
163
+        .type   \name, @function
 
164
+\name:
 
165
+0:     addis 2,12,(.TOC.-0b)@ha
 
166
+       addi 2,2,(.TOC.-0b)@l
 
167
+       .localentry \name, . - \name
 
168
+.endm
 
169
+.macro END name
 
170
+       .size   \name, . - \name
 
171
+.endm
 
172
+.macro HIDDEN name
 
173
+       .hidden \name
 
174
+.endm
 
175
+.macro CALL name
 
176
+       bl      \name
 
177
+       nop
 
178
+.endm
 
179
+#elif defined(__powerpc64__) && defined(__ELF__)
 
180
+.macro FUNC name
 
181
         .globl  \name, .\name
 
182
         .section ".opd","aw"
 
183
         .align  3
 
184
@@ -117,6 +136,9 @@
 
185
 #if defined(_CALL_AIXDESC)
 
186
 # define BASE          6*WS
 
187
 # define LR_SAVE       2*WS
 
188
+#elif _CALL_ELF == 2
 
189
+# define BASE          6*WS
 
190
+# define LR_SAVE       2*WS
 
191
 #elif defined(_CALL_SYSV)
 
192
 # define BASE          2*WS
 
193
 # define LR_SAVE       1*WS
 
194
--- a/src/libitm/config/powerpc/target.h
 
195
+++ b/src/libitm/config/powerpc/target.h
 
196
@@ -22,6 +22,10 @@
 
197
    see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
 
198
    <http://www.gnu.org/licenses/>.  */
 
199
 
 
200
+#ifdef HAVE_SYS_AUXV_H
 
201
+#include <sys/auxv.h>
 
202
+#endif
 
203
+
 
204
 namespace GTM HIDDEN {
 
205
 
 
206
 typedef int v128 __attribute__((vector_size(16), may_alias, aligned(16)));
 
207
@@ -55,4 +59,82 @@
 
208
   __asm volatile ("" : : : "memory");
 
209
 }
 
210
 
 
211
+// Use HTM if it is supported by the system.
 
212
+// See gtm_thread::begin_transaction for how these functions are used.
 
213
+#if defined (__linux__) \
 
214
+    && defined (HAVE_AS_HTM) \
 
215
+    && defined (HAVE_GETAUXVAL) \
 
216
+    && defined (AT_HWCAP2) \
 
217
+    && defined (PPC_FEATURE2_HAS_HTM)
 
218
+
 
219
+#include <htmintrin.h>
 
220
+
 
221
+#define USE_HTM_FASTPATH
 
222
+
 
223
+#define _TBEGIN_STARTED       0
 
224
+#define _TBEGIN_INDETERMINATE 1
 
225
+#define _TBEGIN_PERSISTENT    2
 
226
+
 
227
+/* Number of retries for transient failures.  */
 
228
+#define _HTM_RETRIES 10
 
229
+
 
230
+static inline bool
 
231
+htm_available (void)
 
232
+{
 
233
+  return (getauxval (AT_HWCAP2) & PPC_FEATURE2_HAS_HTM) ? true : false;
 
234
+}
 
235
+
 
236
+static inline uint32_t
 
237
+htm_init (void)
 
238
+{
 
239
+  // Maximum number of times we try to execute a transaction
 
240
+  // as a HW transaction.
 
241
+  return htm_available () ? _HTM_RETRIES : 0;
 
242
+}
 
243
+
 
244
+static inline uint32_t
 
245
+htm_begin (void)
 
246
+{
 
247
+  if (__builtin_expect (__builtin_tbegin (0), 1))
 
248
+    return _TBEGIN_STARTED;
 
249
+
 
250
+  if (_TEXASRU_FAILURE_PERSISTENT (__builtin_get_texasru ()))
 
251
+    return _TBEGIN_PERSISTENT;
 
252
+
 
253
+  return _TBEGIN_INDETERMINATE;
 
254
+}
 
255
+
 
256
+static inline bool
 
257
+htm_begin_success (uint32_t begin_ret)
 
258
+{
 
259
+  return begin_ret == _TBEGIN_STARTED;
 
260
+}
 
261
+
 
262
+static inline void
 
263
+htm_commit (void)
 
264
+{
 
265
+  __builtin_tend (0);
 
266
+}
 
267
+
 
268
+static inline void
 
269
+htm_abort (void)
 
270
+{
 
271
+  __builtin_tabort (0);
 
272
+}
 
273
+
 
274
+static inline bool
 
275
+htm_abort_should_retry (uint32_t begin_ret)
 
276
+{
 
277
+  return begin_ret != _TBEGIN_PERSISTENT;
 
278
+}
 
279
+
 
280
+/* Returns true iff a hardware transaction is currently being executed.  */
 
281
+static inline bool
 
282
+htm_transaction_active (void)
 
283
+{
 
284
+  return (_HTM_STATE (__builtin_ttest ()) == _HTM_TRANSACTIONAL);
 
285
+}
 
286
+
 
287
+#endif
 
288
+
 
289
 } // namespace GTM
 
290
--- a/src/libitm/acinclude.m4
 
291
+++ b/src/libitm/acinclude.m4
 
292
@@ -134,6 +134,20 @@
 
293
   ;;
 
294
 esac])
 
295
 
 
296
+dnl Check if as supports HTM instructions.
 
297
+AC_DEFUN([LIBITM_CHECK_AS_HTM], [
 
298
+case "${target_cpu}" in
 
299
+powerpc*)
 
300
+  AC_CACHE_CHECK([if the assembler supports HTM], libitm_cv_as_htm, [
 
301
+    AC_TRY_COMPILE([], [asm("tbegin. 0; tend. 0");],
 
302
+                  [libitm_cv_as_htm=yes], [libitm_cv_as_htm=no])
 
303
+  ])
 
304
+  if test x$libitm_cv_as_htm = xyes; then
 
305
+    AC_DEFINE(HAVE_AS_HTM, 1, [Define to 1 if the assembler supports HTM.])
 
306
+  fi
 
307
+  ;;
 
308
+esac])
 
309
+
 
310
 sinclude(../libtool.m4)
 
311
 dnl The lines below arrange for aclocal not to bring an installed
 
312
 dnl libtool.m4 into aclocal.m4, while still arranging for automake to
 
313
--- a/src/libtool.m4
 
314
+++ b/src/libtool.m4
 
315
@@ -1220,7 +1220,7 @@
 
316
   rm -rf conftest*
 
317
   ;;
 
318
 
 
319
-x86_64-*kfreebsd*-gnu|x86_64-*linux*|ppc*-*linux*|powerpc*-*linux*| \
 
320
+x86_64-*kfreebsd*-gnu|x86_64-*linux*|powerpc*-*linux*| \
 
321
 s390*-*linux*|s390*-*tpf*|sparc*-*linux*)
 
322
   # Find out which ABI we are using.
 
323
   echo 'int i;' > conftest.$ac_ext
 
324
@@ -1241,7 +1241,10 @@
 
325
                ;;
 
326
            esac
 
327
            ;;
 
328
-         ppc64-*linux*|powerpc64-*linux*)
 
329
+         powerpc64le-*linux*)
 
330
+           LD="${LD-ld} -m elf32lppclinux"
 
331
+           ;;
 
332
+         powerpc64-*linux*)
 
333
            LD="${LD-ld} -m elf32ppclinux"
 
334
            ;;
 
335
          s390x-*linux*)
 
336
@@ -1260,7 +1263,10 @@
 
337
          x86_64-*linux*)
 
338
            LD="${LD-ld} -m elf_x86_64"
 
339
            ;;
 
340
-         ppc*-*linux*|powerpc*-*linux*)
 
341
+         powerpcle-*linux*)
 
342
+           LD="${LD-ld} -m elf64lppc"
 
343
+           ;;
 
344
+         powerpc-*linux*)
 
345
            LD="${LD-ld} -m elf64ppc"
 
346
            ;;
 
347
          s390*-*linux*|s390*-*tpf*)
 
348
--- a/src/libgomp/configure
 
349
+++ b/src/libgomp/configure
 
350
@@ -6580,7 +6580,7 @@
 
351
   rm -rf conftest*
 
352
   ;;
 
353
 
 
354
-x86_64-*kfreebsd*-gnu|x86_64-*linux*|ppc*-*linux*|powerpc*-*linux*| \
 
355
+x86_64-*kfreebsd*-gnu|x86_64-*linux*|powerpc*-*linux*| \
 
356
 s390*-*linux*|s390*-*tpf*|sparc*-*linux*)
 
357
   # Find out which ABI we are using.
 
358
   echo 'int i;' > conftest.$ac_ext
 
359
@@ -6605,7 +6605,10 @@
 
360
                ;;
 
361
            esac
 
362
            ;;
 
363
-         ppc64-*linux*|powerpc64-*linux*)
 
364
+         powerpc64le-*linux*)
 
365
+           LD="${LD-ld} -m elf32lppclinux"
 
366
+           ;;
 
367
+         powerpc64-*linux*)
 
368
            LD="${LD-ld} -m elf32ppclinux"
 
369
            ;;
 
370
          s390x-*linux*)
 
371
@@ -6624,7 +6627,10 @@
 
372
          x86_64-*linux*)
 
373
            LD="${LD-ld} -m elf_x86_64"
 
374
            ;;
 
375
-         ppc*-*linux*|powerpc*-*linux*)
 
376
+         powerpcle-*linux*)
 
377
+           LD="${LD-ld} -m elf64lppc"
 
378
+           ;;
 
379
+         powerpc-*linux*)
 
380
            LD="${LD-ld} -m elf64ppc"
 
381
            ;;
 
382
          s390*-*linux*|s390*-*tpf*)
 
383
@@ -11088,7 +11094,7 @@
 
384
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
 
385
   lt_status=$lt_dlunknown
 
386
   cat > conftest.$ac_ext <<_LT_EOF
 
387
-#line 11091 "configure"
 
388
+#line 11097 "configure"
 
389
 #include "confdefs.h"
 
390
 
 
391
 #if HAVE_DLFCN_H
 
392
@@ -11194,7 +11200,7 @@
 
393
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
 
394
   lt_status=$lt_dlunknown
 
395
   cat > conftest.$ac_ext <<_LT_EOF
 
396
-#line 11197 "configure"
 
397
+#line 11203 "configure"
 
398
 #include "confdefs.h"
 
399
 
 
400
 #if HAVE_DLFCN_H
 
401
--- a/src/libquadmath/configure
 
402
+++ b/src/libquadmath/configure
 
403
@@ -6248,7 +6248,7 @@
 
404
   rm -rf conftest*
 
405
   ;;
 
406
 
 
407
-x86_64-*kfreebsd*-gnu|x86_64-*linux*|ppc*-*linux*|powerpc*-*linux*| \
 
408
+x86_64-*kfreebsd*-gnu|x86_64-*linux*|powerpc*-*linux*| \
 
409
 s390*-*linux*|s390*-*tpf*|sparc*-*linux*)
 
410
   # Find out which ABI we are using.
 
411
   echo 'int i;' > conftest.$ac_ext
 
412
@@ -6273,7 +6273,10 @@
 
413
                ;;
 
414
            esac
 
415
            ;;
 
416
-         ppc64-*linux*|powerpc64-*linux*)
 
417
+         powerpc64le-*linux*)
 
418
+           LD="${LD-ld} -m elf32lppclinux"
 
419
+           ;;
 
420
+         powerpc64-*linux*)
 
421
            LD="${LD-ld} -m elf32ppclinux"
 
422
            ;;
 
423
          s390x-*linux*)
 
424
@@ -6292,7 +6295,10 @@
 
425
          x86_64-*linux*)
 
426
            LD="${LD-ld} -m elf_x86_64"
 
427
            ;;
 
428
-         ppc*-*linux*|powerpc*-*linux*)
 
429
+         powerpcle-*linux*)
 
430
+           LD="${LD-ld} -m elf64lppc"
 
431
+           ;;
 
432
+         powerpc-*linux*)
 
433
            LD="${LD-ld} -m elf64ppc"
 
434
            ;;
 
435
          s390*-*linux*|s390*-*tpf*)
 
436
@@ -10521,7 +10527,7 @@
 
437
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
 
438
   lt_status=$lt_dlunknown
 
439
   cat > conftest.$ac_ext <<_LT_EOF
 
440
-#line 10524 "configure"
 
441
+#line 10530 "configure"
 
442
 #include "confdefs.h"
 
443
 
 
444
 #if HAVE_DLFCN_H
 
445
@@ -10627,7 +10633,7 @@
 
446
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
 
447
   lt_status=$lt_dlunknown
 
448
   cat > conftest.$ac_ext <<_LT_EOF
 
449
-#line 10630 "configure"
 
450
+#line 10636 "configure"
 
451
 #include "confdefs.h"
 
452
 
 
453
 #if HAVE_DLFCN_H
 
454
--- a/src/libsanitizer/configure
 
455
+++ b/src/libsanitizer/configure
 
456
@@ -6604,7 +6604,7 @@
 
457
   rm -rf conftest*
 
458
   ;;
 
459
 
 
460
-x86_64-*kfreebsd*-gnu|x86_64-*linux*|ppc*-*linux*|powerpc*-*linux*| \
 
461
+x86_64-*kfreebsd*-gnu|x86_64-*linux*|powerpc*-*linux*| \
 
462
 s390*-*linux*|s390*-*tpf*|sparc*-*linux*)
 
463
   # Find out which ABI we are using.
 
464
   echo 'int i;' > conftest.$ac_ext
 
465
@@ -6629,7 +6629,10 @@
 
466
                ;;
 
467
            esac
 
468
            ;;
 
469
-         ppc64-*linux*|powerpc64-*linux*)
 
470
+         powerpc64le-*linux*)
 
471
+           LD="${LD-ld} -m elf32lppclinux"
 
472
+           ;;
 
473
+         powerpc64-*linux*)
 
474
            LD="${LD-ld} -m elf32ppclinux"
 
475
            ;;
 
476
          s390x-*linux*)
 
477
@@ -6648,7 +6651,10 @@
 
478
          x86_64-*linux*)
 
479
            LD="${LD-ld} -m elf_x86_64"
 
480
            ;;
 
481
-         ppc*-*linux*|powerpc*-*linux*)
 
482
+         powerpcle-*linux*)
 
483
+           LD="${LD-ld} -m elf64lppc"
 
484
+           ;;
 
485
+         powerpc-*linux*)
 
486
            LD="${LD-ld} -m elf64ppc"
 
487
            ;;
 
488
          s390*-*linux*|s390*-*tpf*)
 
489
@@ -11111,7 +11117,7 @@
 
490
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
 
491
   lt_status=$lt_dlunknown
 
492
   cat > conftest.$ac_ext <<_LT_EOF
 
493
-#line 11114 "configure"
 
494
+#line 11120 "configure"
 
495
 #include "confdefs.h"
 
496
 
 
497
 #if HAVE_DLFCN_H
 
498
@@ -11217,7 +11223,7 @@
 
499
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
 
500
   lt_status=$lt_dlunknown
 
501
   cat > conftest.$ac_ext <<_LT_EOF
 
502
-#line 11220 "configure"
 
503
+#line 11226 "configure"
 
504
 #include "confdefs.h"
 
505
 
 
506
 #if HAVE_DLFCN_H
 
507
--- a/src/zlib/configure
 
508
+++ b/src/zlib/configure
 
509
@@ -5853,7 +5853,7 @@
 
510
   rm -rf conftest*
 
511
   ;;
 
512
 
 
513
-x86_64-*kfreebsd*-gnu|x86_64-*linux*|ppc*-*linux*|powerpc*-*linux*| \
 
514
+x86_64-*kfreebsd*-gnu|x86_64-*linux*|powerpc*-*linux*| \
 
515
 s390*-*linux*|s390*-*tpf*|sparc*-*linux*)
 
516
   # Find out which ABI we are using.
 
517
   echo 'int i;' > conftest.$ac_ext
 
518
@@ -5878,7 +5878,10 @@
 
519
                ;;
 
520
            esac
 
521
            ;;
 
522
-         ppc64-*linux*|powerpc64-*linux*)
 
523
+         powerpc64le-*linux*)
 
524
+           LD="${LD-ld} -m elf32lppclinux"
 
525
+           ;;
 
526
+         powerpc64-*linux*)
 
527
            LD="${LD-ld} -m elf32ppclinux"
 
528
            ;;
 
529
          s390x-*linux*)
 
530
@@ -5897,7 +5900,10 @@
 
531
          x86_64-*linux*)
 
532
            LD="${LD-ld} -m elf_x86_64"
 
533
            ;;
 
534
-         ppc*-*linux*|powerpc*-*linux*)
 
535
+         powerpcle-*linux*)
 
536
+           LD="${LD-ld} -m elf64lppc"
 
537
+           ;;
 
538
+         powerpc-*linux*)
 
539
            LD="${LD-ld} -m elf64ppc"
 
540
            ;;
 
541
          s390*-*linux*|s390*-*tpf*)
 
542
@@ -10394,7 +10400,7 @@
 
543
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
 
544
   lt_status=$lt_dlunknown
 
545
   cat > conftest.$ac_ext <<_LT_EOF
 
546
-#line 10397 "configure"
 
547
+#line 10403 "configure"
 
548
 #include "confdefs.h"
 
549
 
 
550
 #if HAVE_DLFCN_H
 
551
@@ -10500,7 +10506,7 @@
 
552
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
 
553
   lt_status=$lt_dlunknown
 
554
   cat > conftest.$ac_ext <<_LT_EOF
 
555
-#line 10503 "configure"
 
556
+#line 10509 "configure"
 
557
 #include "confdefs.h"
 
558
 
 
559
 #if HAVE_DLFCN_H
 
560
--- a/src/libstdc++-v3/configure
 
561
+++ b/src/libstdc++-v3/configure
 
562
@@ -7111,7 +7111,7 @@
 
563
   rm -rf conftest*
 
564
   ;;
 
565
 
 
566
-x86_64-*kfreebsd*-gnu|x86_64-*linux*|ppc*-*linux*|powerpc*-*linux*| \
 
567
+x86_64-*kfreebsd*-gnu|x86_64-*linux*|powerpc*-*linux*| \
 
568
 s390*-*linux*|s390*-*tpf*|sparc*-*linux*)
 
569
   # Find out which ABI we are using.
 
570
   echo 'int i;' > conftest.$ac_ext
 
571
@@ -7136,7 +7136,10 @@
 
572
                ;;
 
573
            esac
 
574
            ;;
 
575
-         ppc64-*linux*|powerpc64-*linux*)
 
576
+         powerpc64le-*linux*)
 
577
+           LD="${LD-ld} -m elf32lppclinux"
 
578
+           ;;
 
579
+         powerpc64-*linux*)
 
580
            LD="${LD-ld} -m elf32ppclinux"
 
581
            ;;
 
582
          s390x-*linux*)
 
583
@@ -7155,7 +7158,10 @@
 
584
          x86_64-*linux*)
 
585
            LD="${LD-ld} -m elf_x86_64"
 
586
            ;;
 
587
-         ppc*-*linux*|powerpc*-*linux*)
 
588
+         powerpcle-*linux*)
 
589
+           LD="${LD-ld} -m elf64lppc"
 
590
+           ;;
 
591
+         powerpc-*linux*)
 
592
            LD="${LD-ld} -m elf64ppc"
 
593
            ;;
 
594
          s390*-*linux*|s390*-*tpf*)
 
595
@@ -11513,7 +11519,7 @@
 
596
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
 
597
   lt_status=$lt_dlunknown
 
598
   cat > conftest.$ac_ext <<_LT_EOF
 
599
-#line 11516 "configure"
 
600
+#line 11522 "configure"
 
601
 #include "confdefs.h"
 
602
 
 
603
 #if HAVE_DLFCN_H
 
604
@@ -11619,7 +11625,7 @@
 
605
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
 
606
   lt_status=$lt_dlunknown
 
607
   cat > conftest.$ac_ext <<_LT_EOF
 
608
-#line 11622 "configure"
 
609
+#line 11628 "configure"
 
610
 #include "confdefs.h"
 
611
 
 
612
 #if HAVE_DLFCN_H
 
613
@@ -15033,7 +15039,7 @@
 
614
     #
 
615
     # Fake what AC_TRY_COMPILE does.  XXX Look at redoing this new-style.
 
616
     cat > conftest.$ac_ext << EOF
 
617
-#line 15036 "configure"
 
618
+#line 15042 "configure"
 
619
 struct S { ~S(); };
 
620
 void bar();
 
621
 void foo()
 
622
@@ -15383,7 +15389,7 @@
 
623
   # Fake what AC_TRY_COMPILE does.
 
624
 
 
625
     cat > conftest.$ac_ext << EOF
 
626
-#line 15386 "configure"
 
627
+#line 15392 "configure"
 
628
 int main()
 
629
 {
 
630
   typedef bool atomic_type;
 
631
@@ -15418,7 +15424,7 @@
 
632
     rm -f conftest*
 
633
 
 
634
     cat > conftest.$ac_ext << EOF
 
635
-#line 15421 "configure"
 
636
+#line 15427 "configure"
 
637
 int main()
 
638
 {
 
639
   typedef short atomic_type;
 
640
@@ -15453,7 +15459,7 @@
 
641
     rm -f conftest*
 
642
 
 
643
     cat > conftest.$ac_ext << EOF
 
644
-#line 15456 "configure"
 
645
+#line 15462 "configure"
 
646
 int main()
 
647
 {
 
648
   // NB: _Atomic_word not necessarily int.
 
649
@@ -15489,7 +15495,7 @@
 
650
     rm -f conftest*
 
651
 
 
652
     cat > conftest.$ac_ext << EOF
 
653
-#line 15492 "configure"
 
654
+#line 15498 "configure"
 
655
 int main()
 
656
 {
 
657
   typedef long long atomic_type;
 
658
@@ -15568,7 +15574,7 @@
 
659
   # unnecessary for this test.
 
660
 
 
661
     cat > conftest.$ac_ext << EOF
 
662
-#line 15571 "configure"
 
663
+#line 15577 "configure"
 
664
 int main()
 
665
 {
 
666
   _Decimal32 d1;
 
667
@@ -15610,7 +15616,7 @@
 
668
   # unnecessary for this test.
 
669
 
 
670
     cat > conftest.$ac_ext << EOF
 
671
-#line 15613 "configure"
 
672
+#line 15619 "configure"
 
673
 template<typename T1, typename T2>
 
674
   struct same
 
675
   { typedef T2 type; };
 
676
@@ -15644,7 +15650,7 @@
 
677
     rm -f conftest*
 
678
 
 
679
     cat > conftest.$ac_ext << EOF
 
680
-#line 15647 "configure"
 
681
+#line 15653 "configure"
 
682
 template<typename T1, typename T2>
 
683
   struct same
 
684
   { typedef T2 type; };
 
685
--- a/src/libstdc++-v3/scripts/extract_symvers.in
 
686
+++ b/src/libstdc++-v3/scripts/extract_symvers.in
 
687
@@ -53,6 +53,7 @@
 
688
   # present on Solaris.
 
689
   ${readelf} ${lib} |\
 
690
   sed -e 's/ \[<other>: [A-Fa-f0-9]*\] //' -e '/\.dynsym/,/^$/p;d' |\
 
691
+  sed -e 's/ \[<localentry>: [0-9]*\] //' |\
 
692
   egrep -v ' (LOCAL|UND) ' |\
 
693
   egrep -v ' (_DYNAMIC|_GLOBAL_OFFSET_TABLE_|_PROCEDURE_LINKAGE_TABLE_|_edata|_end|_etext)$' |\
 
694
   sed -e 's/ <processor specific>: / <processor_specific>:_/g' |\
 
695
--- a/src/libstdc++-v3/ChangeLog.ibm
 
696
+++ b/src/libstdc++-v3/ChangeLog.ibm
 
697
@@ -0,0 +1,19 @@
 
698
+2013-11-15  Ulrich Weigand  <Ulrich.Weigand@de.ibm.com>
 
699
+
 
700
+       Backport from mainline r204808:
 
701
+
 
702
+       2013-11-14  Ulrich Weigand  <Ulrich.Weigand@de.ibm.com>
 
703
+
 
704
+       * scripts/extract_symvers.in: Ignore <localentry: > fields
 
705
+       in readelf --symbols output.
 
706
+
 
707
+2013-08-04  Peter Bergner  <bergner@vnet.ibm.com>
 
708
+
 
709
+        Backport from mainline
 
710
+       2013-08-01  Fabien Chêne  <fabien@gcc.gnu.org>
 
711
+
 
712
+       PR c++/54537
 
713
+       * include/tr1/cmath: Remove pow(double,double) overload, remove a
 
714
+       duplicated comment about DR 550. Add a comment to explain the issue.
 
715
+       * testsuite/tr1/8_c_compatibility/cmath/pow_cmath.cc: New.
 
716
+
 
717
--- a/src/libstdc++-v3/include/tr1/cmath
 
718
+++ b/src/libstdc++-v3/include/tr1/cmath
 
719
@@ -846,10 +846,6 @@
 
720
     nexttoward(_Tp __x, long double __y)
 
721
     { return __builtin_nexttoward(__x, __y); }
 
722
 
 
723
-  // DR 550. What should the return type of pow(float,int) be?
 
724
-  // NB: C++0x and TR1 != C++03.
 
725
-  //   using std::pow;
 
726
-
 
727
   inline float
 
728
   remainder(float __x, float __y)
 
729
   { return __builtin_remainderf(__x, __y); }
 
730
@@ -985,10 +981,19 @@
 
731
 
 
732
   // DR 550. What should the return type of pow(float,int) be?
 
733
   // NB: C++0x and TR1 != C++03.
 
734
-  inline double
 
735
-  pow(double __x, double __y)
 
736
-  { return std::pow(__x, __y); }
 
737
 
 
738
+  // The std::tr1::pow(double, double) overload cannot be provided
 
739
+  // here, because it would clash with ::pow(double,double) declared
 
740
+  // in <math.h>, if <tr1/math.h> is included at the same time (raised
 
741
+  // by the fix of PR c++/54537). It is not possible either to use the
 
742
+  // using-declaration 'using ::pow;' here, because if the user code
 
743
+  // has a 'using std::pow;', it would bring the pow(*,int) averloads
 
744
+  // in the tr1 namespace, which is undesirable. Consequently, the
 
745
+  // solution is to forward std::tr1::pow(double,double) to
 
746
+  // std::pow(double,double) via the templatized version below. See
 
747
+  // the discussion about this issue here:
 
748
+  // http://gcc.gnu.org/ml/gcc-patches/2012-09/msg01278.html
 
749
+
 
750
   inline float
 
751
   pow(float __x, float __y)
 
752
   { return std::pow(__x, __y); }
 
753
--- a/src/libstdc++-v3/testsuite/tr1/8_c_compatibility/cmath/pow_cmath.cc
 
754
+++ b/src/libstdc++-v3/testsuite/tr1/8_c_compatibility/cmath/pow_cmath.cc
 
755
@@ -0,0 +1,33 @@
 
756
+// { dg-do compile }
 
757
+
 
758
+// Copyright (C) 2013 Free Software Foundation, Inc.
 
759
+//
 
760
+// This file is part of the GNU ISO C++ Library.  This library is free
 
761
+// software; you can redistribute it and/or modify it under the
 
762
+// terms of the GNU General Public License as published by the
 
763
+// Free Software Foundation; either version 3, or (at your option)
 
764
+// any later version.
 
765
+
 
766
+// This library is distributed in the hope that it will be useful,
 
767
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
 
768
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
769
+// GNU General Public License for more details.
 
770
+
 
771
+// You should have received a copy of the GNU General Public License along
 
772
+// with this library; see the file COPYING3.  If not see
 
773
+// <http://www.gnu.org/licenses/>.
 
774
+
 
775
+#include <cmath>
 
776
+using std::pow;
 
777
+#include <tr1/cmath>
 
778
+#include <testsuite_tr1.h>
 
779
+
 
780
+void 
 
781
+test01()
 
782
+{
 
783
+  using namespace __gnu_test;
 
784
+
 
785
+  float x = 2080703.375F;
 
786
+  check_ret_type<float>(std::pow(x, 2));
 
787
+  check_ret_type<double>(std::tr1::pow(x, 2));
 
788
+}
 
789
--- a/src/libmudflap/configure
 
790
+++ b/src/libmudflap/configure
 
791
@@ -6377,7 +6377,7 @@
 
792
   rm -rf conftest*
 
793
   ;;
 
794
 
 
795
-x86_64-*kfreebsd*-gnu|x86_64-*linux*|ppc*-*linux*|powerpc*-*linux*| \
 
796
+x86_64-*kfreebsd*-gnu|x86_64-*linux*|powerpc*-*linux*| \
 
797
 s390*-*linux*|s390*-*tpf*|sparc*-*linux*)
 
798
   # Find out which ABI we are using.
 
799
   echo 'int i;' > conftest.$ac_ext
 
800
@@ -6402,7 +6402,10 @@
 
801
                ;;
 
802
            esac
 
803
            ;;
 
804
-         ppc64-*linux*|powerpc64-*linux*)
 
805
+         powerpc64le-*linux*)
 
806
+           LD="${LD-ld} -m elf32lppclinux"
 
807
+           ;;
 
808
+         powerpc64-*linux*)
 
809
            LD="${LD-ld} -m elf32ppclinux"
 
810
            ;;
 
811
          s390x-*linux*)
 
812
@@ -6421,7 +6424,10 @@
 
813
          x86_64-*linux*)
 
814
            LD="${LD-ld} -m elf_x86_64"
 
815
            ;;
 
816
-         ppc*-*linux*|powerpc*-*linux*)
 
817
+         powerpcle-*linux*)
 
818
+           LD="${LD-ld} -m elf64lppc"
 
819
+           ;;
 
820
+         powerpc-*linux*)
 
821
            LD="${LD-ld} -m elf64ppc"
 
822
            ;;
 
823
          s390*-*linux*|s390*-*tpf*)
 
824
@@ -10615,7 +10621,7 @@
 
825
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
 
826
   lt_status=$lt_dlunknown
 
827
   cat > conftest.$ac_ext <<_LT_EOF
 
828
-#line 10618 "configure"
 
829
+#line 10624 "configure"
 
830
 #include "confdefs.h"
 
831
 
 
832
 #if HAVE_DLFCN_H
 
833
@@ -10721,7 +10727,7 @@
 
834
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
 
835
   lt_status=$lt_dlunknown
 
836
   cat > conftest.$ac_ext <<_LT_EOF
 
837
-#line 10724 "configure"
 
838
+#line 10730 "configure"
 
839
 #include "confdefs.h"
 
840
 
 
841
 #if HAVE_DLFCN_H
 
842
--- a/src/boehm-gc/configure
 
843
+++ b/src/boehm-gc/configure
 
844
@@ -6770,7 +6770,7 @@
 
845
   rm -rf conftest*
 
846
   ;;
 
847
 
 
848
-x86_64-*kfreebsd*-gnu|x86_64-*linux*|ppc*-*linux*|powerpc*-*linux*| \
 
849
+x86_64-*kfreebsd*-gnu|x86_64-*linux*|powerpc*-*linux*| \
 
850
 s390*-*linux*|s390*-*tpf*|sparc*-*linux*)
 
851
   # Find out which ABI we are using.
 
852
   echo 'int i;' > conftest.$ac_ext
 
853
@@ -6795,7 +6795,10 @@
 
854
                ;;
 
855
            esac
 
856
            ;;
 
857
-         ppc64-*linux*|powerpc64-*linux*)
 
858
+         powerpc64le-*linux*)
 
859
+           LD="${LD-ld} -m elf32lppclinux"
 
860
+           ;;
 
861
+         powerpc64-*linux*)
 
862
            LD="${LD-ld} -m elf32ppclinux"
 
863
            ;;
 
864
          s390x-*linux*)
 
865
@@ -6814,7 +6817,10 @@
 
866
          x86_64-*linux*)
 
867
            LD="${LD-ld} -m elf_x86_64"
 
868
            ;;
 
869
-         ppc*-*linux*|powerpc*-*linux*)
 
870
+         powerpcle-*linux*)
 
871
+           LD="${LD-ld} -m elf64lppc"
 
872
+           ;;
 
873
+         powerpc-*linux*)
 
874
            LD="${LD-ld} -m elf64ppc"
 
875
            ;;
 
876
          s390*-*linux*|s390*-*tpf*)
 
877
@@ -11312,7 +11318,7 @@
 
878
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
 
879
   lt_status=$lt_dlunknown
 
880
   cat > conftest.$ac_ext <<_LT_EOF
 
881
-#line 11315 "configure"
 
882
+#line 11321 "configure"
 
883
 #include "confdefs.h"
 
884
 
 
885
 #if HAVE_DLFCN_H
 
886
@@ -11418,7 +11424,7 @@
 
887
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
 
888
   lt_status=$lt_dlunknown
 
889
   cat > conftest.$ac_ext <<_LT_EOF
 
890
-#line 11421 "configure"
 
891
+#line 11427 "configure"
 
892
 #include "confdefs.h"
 
893
 
 
894
 #if HAVE_DLFCN_H
 
895
--- a/src/lto-plugin/configure
 
896
+++ b/src/lto-plugin/configure
 
897
@@ -6044,7 +6044,7 @@
 
898
   rm -rf conftest*
 
899
   ;;
 
900
 
 
901
-x86_64-*kfreebsd*-gnu|x86_64-*linux*|ppc*-*linux*|powerpc*-*linux*| \
 
902
+x86_64-*kfreebsd*-gnu|x86_64-*linux*|powerpc*-*linux*| \
 
903
 s390*-*linux*|s390*-*tpf*|sparc*-*linux*)
 
904
   # Find out which ABI we are using.
 
905
   echo 'int i;' > conftest.$ac_ext
 
906
@@ -6069,7 +6069,10 @@
 
907
                ;;
 
908
            esac
 
909
            ;;
 
910
-         ppc64-*linux*|powerpc64-*linux*)
 
911
+         powerpc64le-*linux*)
 
912
+           LD="${LD-ld} -m elf32lppclinux"
 
913
+           ;;
 
914
+         powerpc64-*linux*)
 
915
            LD="${LD-ld} -m elf32ppclinux"
 
916
            ;;
 
917
          s390x-*linux*)
 
918
@@ -6088,7 +6091,10 @@
 
919
          x86_64-*linux*)
 
920
            LD="${LD-ld} -m elf_x86_64"
 
921
            ;;
 
922
-         ppc*-*linux*|powerpc*-*linux*)
 
923
+         powerpcle-*linux*)
 
924
+           LD="${LD-ld} -m elf64lppc"
 
925
+           ;;
 
926
+         powerpc-*linux*)
 
927
            LD="${LD-ld} -m elf64ppc"
 
928
            ;;
 
929
          s390*-*linux*|s390*-*tpf*)
 
930
@@ -10552,7 +10558,7 @@
 
931
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
 
932
   lt_status=$lt_dlunknown
 
933
   cat > conftest.$ac_ext <<_LT_EOF
 
934
-#line 10555 "configure"
 
935
+#line 10561 "configure"
 
936
 #include "confdefs.h"
 
937
 
 
938
 #if HAVE_DLFCN_H
 
939
@@ -10658,7 +10664,7 @@
 
940
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
 
941
   lt_status=$lt_dlunknown
 
942
   cat > conftest.$ac_ext <<_LT_EOF
 
943
-#line 10661 "configure"
 
944
+#line 10667 "configure"
 
945
 #include "confdefs.h"
 
946
 
 
947
 #if HAVE_DLFCN_H
 
948
--- a/src/libatomic/configure
 
949
+++ b/src/libatomic/configure
 
950
@@ -6505,7 +6505,7 @@
 
951
   rm -rf conftest*
 
952
   ;;
 
953
 
 
954
-x86_64-*kfreebsd*-gnu|x86_64-*linux*|ppc*-*linux*|powerpc*-*linux*| \
 
955
+x86_64-*kfreebsd*-gnu|x86_64-*linux*|powerpc*-*linux*| \
 
956
 s390*-*linux*|s390*-*tpf*|sparc*-*linux*)
 
957
   # Find out which ABI we are using.
 
958
   echo 'int i;' > conftest.$ac_ext
 
959
@@ -6530,7 +6530,10 @@
 
960
                ;;
 
961
            esac
 
962
            ;;
 
963
-         ppc64-*linux*|powerpc64-*linux*)
 
964
+         powerpc64le-*linux*)
 
965
+           LD="${LD-ld} -m elf32lppclinux"
 
966
+           ;;
 
967
+         powerpc64-*linux*)
 
968
            LD="${LD-ld} -m elf32ppclinux"
 
969
            ;;
 
970
          s390x-*linux*)
 
971
@@ -6549,7 +6552,10 @@
 
972
          x86_64-*linux*)
 
973
            LD="${LD-ld} -m elf_x86_64"
 
974
            ;;
 
975
-         ppc*-*linux*|powerpc*-*linux*)
 
976
+         powerpcle-*linux*)
 
977
+           LD="${LD-ld} -m elf64lppc"
 
978
+           ;;
 
979
+         powerpc-*linux*)
 
980
            LD="${LD-ld} -m elf64ppc"
 
981
            ;;
 
982
          s390*-*linux*|s390*-*tpf*)
 
983
@@ -11013,7 +11019,7 @@
 
984
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
 
985
   lt_status=$lt_dlunknown
 
986
   cat > conftest.$ac_ext <<_LT_EOF
 
987
-#line 11016 "configure"
 
988
+#line 11022 "configure"
 
989
 #include "confdefs.h"
 
990
 
 
991
 #if HAVE_DLFCN_H
 
992
@@ -11119,7 +11125,7 @@
 
993
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
 
994
   lt_status=$lt_dlunknown
 
995
   cat > conftest.$ac_ext <<_LT_EOF
 
996
-#line 11122 "configure"
 
997
+#line 11128 "configure"
 
998
 #include "confdefs.h"
 
999
 
 
1000
 #if HAVE_DLFCN_H
 
1001
--- a/src/libbacktrace/configure
 
1002
+++ b/src/libbacktrace/configure
 
1003
@@ -6842,7 +6842,7 @@
 
1004
   rm -rf conftest*
 
1005
   ;;
 
1006
 
 
1007
-x86_64-*kfreebsd*-gnu|x86_64-*linux*|ppc*-*linux*|powerpc*-*linux*| \
 
1008
+x86_64-*kfreebsd*-gnu|x86_64-*linux*|powerpc*-*linux*| \
 
1009
 s390*-*linux*|s390*-*tpf*|sparc*-*linux*)
 
1010
   # Find out which ABI we are using.
 
1011
   echo 'int i;' > conftest.$ac_ext
 
1012
@@ -6867,7 +6867,10 @@
 
1013
                ;;
 
1014
            esac
 
1015
            ;;
 
1016
-         ppc64-*linux*|powerpc64-*linux*)
 
1017
+         powerpc64le-*linux*)
 
1018
+           LD="${LD-ld} -m elf32lppclinux"
 
1019
+           ;;
 
1020
+         powerpc64-*linux*)
 
1021
            LD="${LD-ld} -m elf32ppclinux"
 
1022
            ;;
 
1023
          s390x-*linux*)
 
1024
@@ -6886,7 +6889,10 @@
 
1025
          x86_64-*linux*)
 
1026
            LD="${LD-ld} -m elf_x86_64"
 
1027
            ;;
 
1028
-         ppc*-*linux*|powerpc*-*linux*)
 
1029
+         powerpcle-*linux*)
 
1030
+           LD="${LD-ld} -m elf64lppc"
 
1031
+           ;;
 
1032
+         powerpc-*linux*)
 
1033
            LD="${LD-ld} -m elf64ppc"
 
1034
            ;;
 
1035
          s390*-*linux*|s390*-*tpf*)
 
1036
@@ -11081,7 +11087,7 @@
 
1037
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
 
1038
   lt_status=$lt_dlunknown
 
1039
   cat > conftest.$ac_ext <<_LT_EOF
 
1040
-#line 11084 "configure"
 
1041
+#line 11090 "configure"
 
1042
 #include "confdefs.h"
 
1043
 
 
1044
 #if HAVE_DLFCN_H
 
1045
@@ -11187,7 +11193,7 @@
 
1046
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
 
1047
   lt_status=$lt_dlunknown
 
1048
   cat > conftest.$ac_ext <<_LT_EOF
 
1049
-#line 11190 "configure"
 
1050
+#line 11196 "configure"
 
1051
 #include "confdefs.h"
 
1052
 
 
1053
 #if HAVE_DLFCN_H
 
1054
--- a/src/libjava/libltdl/configure
 
1055
+++ b/src/libjava/libltdl/configure
 
1056
@@ -4806,7 +4806,7 @@
 
1057
   rm -rf conftest*
 
1058
   ;;
 
1059
 
 
1060
-x86_64-*linux*|ppc*-*linux*|powerpc*-*linux*|s390*-*linux*|sparc*-*linux*)
 
1061
+x86_64-*linux*|powerpc*-*linux*|s390*-*linux*|sparc*-*linux*)
 
1062
   # Find out which ABI we are using.
 
1063
   echo 'int i;' > conftest.$ac_ext
 
1064
   if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5
 
1065
@@ -4820,7 +4820,10 @@
 
1066
         x86_64-*linux*)
 
1067
           LD="${LD-ld} -m elf_i386"
 
1068
           ;;
 
1069
-        ppc64-*linux*|powerpc64-*linux*)
 
1070
+        powerpc64le-*linux*)
 
1071
+          LD="${LD-ld} -m elf32lppclinux"
 
1072
+          ;;
 
1073
+        powerpc64-*linux*)
 
1074
           LD="${LD-ld} -m elf32ppclinux"
 
1075
           ;;
 
1076
         s390x-*linux*)
 
1077
@@ -4836,7 +4839,10 @@
 
1078
         x86_64-*linux*)
 
1079
           LD="${LD-ld} -m elf_x86_64"
 
1080
           ;;
 
1081
-        ppc*-*linux*|powerpc*-*linux*)
 
1082
+        powerpcle-*linux*)
 
1083
+          LD="${LD-ld} -m elf64lppc"
 
1084
+          ;;
 
1085
+        powerpc-*linux*)
 
1086
           LD="${LD-ld} -m elf64ppc"
 
1087
           ;;
 
1088
         s390*-*linux*)
 
1089
@@ -6456,11 +6462,11 @@
 
1090
    -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \
 
1091
    -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
 
1092
    -e 's:$: $lt_compiler_flag:'`
 
1093
-   (eval echo "\"\$as_me:6459: $lt_compile\"" >&5)
 
1094
+   (eval echo "\"\$as_me:6465: $lt_compile\"" >&5)
 
1095
    (eval "$lt_compile" 2>conftest.err)
 
1096
    ac_status=$?
 
1097
    cat conftest.err >&5
 
1098
-   echo "$as_me:6463: \$? = $ac_status" >&5
 
1099
+   echo "$as_me:6469: \$? = $ac_status" >&5
 
1100
    if (exit $ac_status) && test -s "$ac_outfile"; then
 
1101
      # The compiler can only warn and ignore the option if not recognized
 
1102
      # So say no if there are warnings other than the usual output.
 
1103
@@ -6718,11 +6724,11 @@
 
1104
    -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \
 
1105
    -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
 
1106
    -e 's:$: $lt_compiler_flag:'`
 
1107
-   (eval echo "\"\$as_me:6721: $lt_compile\"" >&5)
 
1108
+   (eval echo "\"\$as_me:6727: $lt_compile\"" >&5)
 
1109
    (eval "$lt_compile" 2>conftest.err)
 
1110
    ac_status=$?
 
1111
    cat conftest.err >&5
 
1112
-   echo "$as_me:6725: \$? = $ac_status" >&5
 
1113
+   echo "$as_me:6731: \$? = $ac_status" >&5
 
1114
    if (exit $ac_status) && test -s "$ac_outfile"; then
 
1115
      # The compiler can only warn and ignore the option if not recognized
 
1116
      # So say no if there are warnings other than the usual output.
 
1117
@@ -6780,11 +6786,11 @@
 
1118
    -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \
 
1119
    -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
 
1120
    -e 's:$: $lt_compiler_flag:'`
 
1121
-   (eval echo "\"\$as_me:6783: $lt_compile\"" >&5)
 
1122
+   (eval echo "\"\$as_me:6789: $lt_compile\"" >&5)
 
1123
    (eval "$lt_compile" 2>out/conftest.err)
 
1124
    ac_status=$?
 
1125
    cat out/conftest.err >&5
 
1126
-   echo "$as_me:6787: \$? = $ac_status" >&5
 
1127
+   echo "$as_me:6793: \$? = $ac_status" >&5
 
1128
    if (exit $ac_status) && test -s out/conftest2.$ac_objext
 
1129
    then
 
1130
      # The compiler can only warn and ignore the option if not recognized
 
1131
@@ -8099,7 +8105,7 @@
 
1132
   libsuff=
 
1133
   case "$host_cpu" in
 
1134
   x86_64*|s390x*|powerpc64*)
 
1135
-    echo '#line 8102 "configure"' > conftest.$ac_ext
 
1136
+    echo '#line 8108 "configure"' > conftest.$ac_ext
 
1137
     if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5
 
1138
   (eval $ac_compile) 2>&5
 
1139
   ac_status=$?
 
1140
@@ -8652,7 +8658,7 @@
 
1141
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
 
1142
   lt_status=$lt_dlunknown
 
1143
   cat > conftest.$ac_ext <<EOF
 
1144
-#line 8655 "configure"
 
1145
+#line 8661 "configure"
 
1146
 #include "confdefs.h"
 
1147
 
 
1148
 #if HAVE_DLFCN_H
 
1149
@@ -8750,7 +8756,7 @@
 
1150
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
 
1151
   lt_status=$lt_dlunknown
 
1152
   cat > conftest.$ac_ext <<EOF
 
1153
-#line 8753 "configure"
 
1154
+#line 8759 "configure"
 
1155
 #include "confdefs.h"
 
1156
 
 
1157
 #if HAVE_DLFCN_H
 
1158
@@ -10591,7 +10597,7 @@
 
1159
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
 
1160
   lt_status=$lt_dlunknown
 
1161
   cat > conftest.$ac_ext <<EOF
 
1162
-#line 10594 "configure"
 
1163
+#line 10600 "configure"
 
1164
 #include "confdefs.h"
 
1165
 
 
1166
 #if HAVE_DLFCN_H
 
1167
--- a/src/libjava/libltdl/acinclude.m4
 
1168
+++ b/src/libjava/libltdl/acinclude.m4
 
1169
@@ -519,7 +519,7 @@
 
1170
   rm -rf conftest*
 
1171
   ;;
 
1172
 
 
1173
-x86_64-*linux*|ppc*-*linux*|powerpc*-*linux*|s390*-*linux*|sparc*-*linux*)
 
1174
+x86_64-*linux*|powerpc*-*linux*|s390*-*linux*|sparc*-*linux*)
 
1175
   # Find out which ABI we are using.
 
1176
   echo 'int i;' > conftest.$ac_ext
 
1177
   if AC_TRY_EVAL(ac_compile); then
 
1178
@@ -529,7 +529,10 @@
 
1179
         x86_64-*linux*)
 
1180
           LD="${LD-ld} -m elf_i386"
 
1181
           ;;
 
1182
-        ppc64-*linux*|powerpc64-*linux*)
 
1183
+        powerpc64le-*linux*)
 
1184
+          LD="${LD-ld} -m elf32lppclinux"
 
1185
+          ;;
 
1186
+        powerpc64-*linux*)
 
1187
           LD="${LD-ld} -m elf32ppclinux"
 
1188
           ;;
 
1189
         s390x-*linux*)
 
1190
@@ -545,7 +548,10 @@
 
1191
         x86_64-*linux*)
 
1192
           LD="${LD-ld} -m elf_x86_64"
 
1193
           ;;
 
1194
-        ppc*-*linux*|powerpc*-*linux*)
 
1195
+        powerpcle-*linux*)
 
1196
+          LD="${LD-ld} -m elf64lppc"
 
1197
+          ;;
 
1198
+        powerpc-*linux*)
 
1199
           LD="${LD-ld} -m elf64ppc"
 
1200
           ;;
 
1201
         s390*-*linux*)
 
1202
--- a/src/libjava/classpath/configure
 
1203
+++ b/src/libjava/classpath/configure
 
1204
@@ -7577,7 +7577,7 @@
 
1205
   rm -rf conftest*
 
1206
   ;;
 
1207
 
 
1208
-x86_64-*kfreebsd*-gnu|x86_64-*linux*|ppc*-*linux*|powerpc*-*linux*| \
 
1209
+x86_64-*kfreebsd*-gnu|x86_64-*linux*|powerpc*-*linux*| \
 
1210
 s390*-*linux*|s390*-*tpf*|sparc*-*linux*)
 
1211
   # Find out which ABI we are using.
 
1212
   echo 'int i;' > conftest.$ac_ext
 
1213
@@ -7602,7 +7602,10 @@
 
1214
                ;;
 
1215
            esac
 
1216
            ;;
 
1217
-         ppc64-*linux*|powerpc64-*linux*)
 
1218
+         powerpc64le-*linux*)
 
1219
+           LD="${LD-ld} -m elf32lppclinux"
 
1220
+           ;;
 
1221
+         powerpc64-*linux*)
 
1222
            LD="${LD-ld} -m elf32ppclinux"
 
1223
            ;;
 
1224
          s390x-*linux*)
 
1225
@@ -7621,7 +7624,10 @@
 
1226
          x86_64-*linux*)
 
1227
            LD="${LD-ld} -m elf_x86_64"
 
1228
            ;;
 
1229
-         ppc*-*linux*|powerpc*-*linux*)
 
1230
+         powerpcle-*linux*)
 
1231
+           LD="${LD-ld} -m elf64lppc"
 
1232
+           ;;
 
1233
+         powerpc-*linux*)
 
1234
            LD="${LD-ld} -m elf64ppc"
 
1235
            ;;
 
1236
          s390*-*linux*|s390*-*tpf*)
 
1237
@@ -11820,7 +11826,7 @@
 
1238
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
 
1239
   lt_status=$lt_dlunknown
 
1240
   cat > conftest.$ac_ext <<_LT_EOF
 
1241
-#line 11823 "configure"
 
1242
+#line 11829 "configure"
 
1243
 #include "confdefs.h"
 
1244
 
 
1245
 #if HAVE_DLFCN_H
 
1246
@@ -11926,7 +11932,7 @@
 
1247
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
 
1248
   lt_status=$lt_dlunknown
 
1249
   cat > conftest.$ac_ext <<_LT_EOF
 
1250
-#line 11929 "configure"
 
1251
+#line 11935 "configure"
 
1252
 #include "confdefs.h"
 
1253
 
 
1254
 #if HAVE_DLFCN_H
 
1255
@@ -25300,7 +25306,7 @@
 
1256
 JAVA_TEST=Object.java
 
1257
 CLASS_TEST=Object.class
 
1258
 cat << \EOF > $JAVA_TEST
 
1259
-/* #line 25303 "configure" */
 
1260
+/* #line 25309 "configure" */
 
1261
 package java.lang;
 
1262
 
 
1263
 public class Object
 
1264
@@ -25393,7 +25399,7 @@
 
1265
 if uudecode$EXEEXT Test.uue; then
 
1266
         ac_cv_prog_uudecode_base64=yes
 
1267
 else
 
1268
-        echo "configure: 25396: uudecode had trouble decoding base 64 file 'Test.uue'" >&5
 
1269
+        echo "configure: 25402: uudecode had trouble decoding base 64 file 'Test.uue'" >&5
 
1270
         echo "configure: failed file was:" >&5
 
1271
         cat Test.uue >&5
 
1272
         ac_cv_prog_uudecode_base64=no
 
1273
@@ -25421,7 +25427,7 @@
 
1274
 CLASS_TEST=Test.class
 
1275
 TEST=Test
 
1276
 cat << \EOF > $JAVA_TEST
 
1277
-/* [#]line 25424 "configure" */
 
1278
+/* [#]line 25430 "configure" */
 
1279
 public class Test {
 
1280
 public static void main (String args[]) {
 
1281
         System.exit (0);
 
1282
@@ -25629,7 +25635,7 @@
 
1283
   JAVA_TEST=Test.java
 
1284
   CLASS_TEST=Test.class
 
1285
   cat << \EOF > $JAVA_TEST
 
1286
-  /* #line 25632 "configure" */
 
1287
+  /* #line 25638 "configure" */
 
1288
   public class Test
 
1289
   {
 
1290
     public static void main(String args)
 
1291
--- a/src/libjava/configure
 
1292
+++ b/src/libjava/configure
 
1293
@@ -8842,7 +8842,7 @@
 
1294
   rm -rf conftest*
 
1295
   ;;
 
1296
 
 
1297
-x86_64-*kfreebsd*-gnu|x86_64-*linux*|ppc*-*linux*|powerpc*-*linux*| \
 
1298
+x86_64-*kfreebsd*-gnu|x86_64-*linux*|powerpc*-*linux*| \
 
1299
 s390*-*linux*|s390*-*tpf*|sparc*-*linux*)
 
1300
   # Find out which ABI we are using.
 
1301
   echo 'int i;' > conftest.$ac_ext
 
1302
@@ -8867,7 +8867,10 @@
 
1303
                ;;
 
1304
            esac
 
1305
            ;;
 
1306
-         ppc64-*linux*|powerpc64-*linux*)
 
1307
+         powerpc64le-*linux*)
 
1308
+           LD="${LD-ld} -m elf32lppclinux"
 
1309
+           ;;
 
1310
+         powerpc64-*linux*)
 
1311
            LD="${LD-ld} -m elf32ppclinux"
 
1312
            ;;
 
1313
          s390x-*linux*)
 
1314
@@ -8886,7 +8889,10 @@
 
1315
          x86_64-*linux*)
 
1316
            LD="${LD-ld} -m elf_x86_64"
 
1317
            ;;
 
1318
-         ppc*-*linux*|powerpc*-*linux*)
 
1319
+         powerpcle-*linux*)
 
1320
+           LD="${LD-ld} -m elf64lppc"
 
1321
+           ;;
 
1322
+         powerpc-*linux*)
 
1323
            LD="${LD-ld} -m elf64ppc"
 
1324
            ;;
 
1325
          s390*-*linux*|s390*-*tpf*)
 
1326
@@ -13382,7 +13388,7 @@
 
1327
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
 
1328
   lt_status=$lt_dlunknown
 
1329
   cat > conftest.$ac_ext <<_LT_EOF
 
1330
-#line 13385 "configure"
 
1331
+#line 13391 "configure"
 
1332
 #include "confdefs.h"
 
1333
 
 
1334
 #if HAVE_DLFCN_H
 
1335
@@ -13488,7 +13494,7 @@
 
1336
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
 
1337
   lt_status=$lt_dlunknown
 
1338
   cat > conftest.$ac_ext <<_LT_EOF
 
1339
-#line 13491 "configure"
 
1340
+#line 13497 "configure"
 
1341
 #include "confdefs.h"
 
1342
 
 
1343
 #if HAVE_DLFCN_H
 
1344
@@ -19483,7 +19489,7 @@
 
1345
   enableval=$enable_sjlj_exceptions; :
 
1346
 else
 
1347
   cat > conftest.$ac_ext << EOF
 
1348
-#line 19486 "configure"
 
1349
+#line 19492 "configure"
 
1350
 struct S { ~S(); };
 
1351
 void bar();
 
1352
 void foo()
 
1353
--- a/src/libgcc/config/rs6000/tramp.S
 
1354
+++ b/src/libgcc/config/rs6000/tramp.S
 
1355
@@ -116,4 +116,70 @@
 
1356
 
 
1357
 #endif
 
1358
 
 
1359
+#elif _CALL_ELF == 2
 
1360
+       .type   trampoline_initial,@object
 
1361
+       .align  3
 
1362
+trampoline_initial:
 
1363
+       ld      r11,.Lchain(r12)
 
1364
+       ld      r12,.Lfunc(r12)
 
1365
+       mtctr   r12
 
1366
+       bctr
 
1367
+.Lfunc = .-trampoline_initial
 
1368
+       .quad   0                       /* will be replaced with function address */
 
1369
+.Lchain = .-trampoline_initial
 
1370
+       .quad   0                       /* will be replaced with static chain */
 
1371
+
 
1372
+trampoline_size = .-trampoline_initial
 
1373
+       .size   trampoline_initial,trampoline_size
 
1374
+
 
1375
+
 
1376
+/* R3 = stack address to store trampoline */
 
1377
+/* R4 = length of trampoline area */
 
1378
+/* R5 = function address */
 
1379
+/* R6 = static chain */
 
1380
+
 
1381
+       .pushsection ".toc","aw"
 
1382
+.LC0:
 
1383
+       .quad   trampoline_initial-8
 
1384
+       .popsection
 
1385
+
 
1386
+FUNC_START(__trampoline_setup)
 
1387
+       addis 7,2,.LC0@toc@ha
 
1388
+       ld 7,.LC0@toc@l(7)      /* trampoline address -8 */
 
1389
+
 
1390
+       li      r8,trampoline_size      /* verify that the trampoline is big enough */
 
1391
+       cmpw    cr1,r8,r4
 
1392
+       srwi    r4,r4,3         /* # doublewords to move */
 
1393
+       addi    r9,r3,-8        /* adjust pointer for stdu */
 
1394
+       mtctr   r4
 
1395
+       blt     cr1,.Labort
 
1396
+
 
1397
+       /* Copy the instructions to the stack */
 
1398
+.Lmove:
 
1399
+       ldu     r10,8(r7)
 
1400
+       stdu    r10,8(r9)
 
1401
+       bdnz    .Lmove
 
1402
+
 
1403
+       /* Store correct function and static chain */
 
1404
+       std     r5,.Lfunc(r3)
 
1405
+       std     r6,.Lchain(r3)
 
1406
+
 
1407
+       /* Now flush both caches */
 
1408
+       mtctr   r4
 
1409
+.Lcache:
 
1410
+       icbi    0,r3
 
1411
+       dcbf    0,r3
 
1412
+       addi    r3,r3,8
 
1413
+       bdnz    .Lcache
 
1414
+
 
1415
+       /* Finally synchronize things & return */
 
1416
+       sync
 
1417
+       isync
 
1418
+       blr
 
1419
+
 
1420
+.Labort:
 
1421
+       bl      JUMP_TARGET(abort)
 
1422
+       nop
 
1423
+FUNC_END(__trampoline_setup)
 
1424
+
 
1425
 #endif
 
1426
--- a/src/libgcc/config/rs6000/linux-unwind.h
 
1427
+++ b/src/libgcc/config/rs6000/linux-unwind.h
 
1428
@@ -24,9 +24,19 @@
 
1429
 
 
1430
 #define R_LR           65
 
1431
 #define R_CR2          70
 
1432
+#define R_CR3          71
 
1433
+#define R_CR4          72
 
1434
 #define R_VR0          77
 
1435
 #define R_VRSAVE       109
 
1436
 
 
1437
+#ifdef __powerpc64__
 
1438
+#if _CALL_ELF == 2
 
1439
+#define TOC_SAVE_SLOT  24
 
1440
+#else
 
1441
+#define TOC_SAVE_SLOT  40
 
1442
+#endif
 
1443
+#endif
 
1444
+
 
1445
 struct gcc_vregs
 
1446
 {
 
1447
   __attribute__ ((vector_size (16))) int vr[32];
 
1448
@@ -107,6 +117,8 @@
 
1449
     }
 
1450
   else if (pc[1] == 0x380000AC)
 
1451
     {
 
1452
+#if _CALL_ELF != 2
 
1453
+      /* These old kernel versions never supported ELFv2.  */
 
1454
       /* This works for 2.4 kernels, but not for 2.6 kernels with vdso
 
1455
         because pc isn't pointing into the stack.  Can be removed when
 
1456
         no one is running 2.4.19 or 2.4.20, the first two ppc64
 
1457
@@ -121,6 +133,7 @@
 
1458
       if ((long) frame24->puc != -21 * 8)
 
1459
        return frame24->puc->regs;
 
1460
       else
 
1461
+#endif
 
1462
        {
 
1463
          /* This works for 2.4.21 and later kernels.  */
 
1464
          struct rt_sigframe {
 
1465
@@ -185,6 +198,7 @@
 
1466
 {
 
1467
   struct gcc_regs *regs = get_regs (context);
 
1468
   struct gcc_vregs *vregs;
 
1469
+  long cr_offset;
 
1470
   long new_cfa;
 
1471
   int i;
 
1472
 
 
1473
@@ -206,11 +220,21 @@
 
1474
       fs->regs.reg[i].loc.offset = (long) &regs->gpr[i] - new_cfa;
 
1475
     }
 
1476
 
 
1477
+  /* The CR is saved in the low 32 bits of regs->ccr.  */
 
1478
+  cr_offset = (long) &regs->ccr - new_cfa;
 
1479
+#ifndef __LITTLE_ENDIAN__
 
1480
+  cr_offset += sizeof (long) - 4;
 
1481
+#endif
 
1482
+  /* In the ELFv1 ABI, CR2 stands in for the whole CR.  */
 
1483
   fs->regs.reg[R_CR2].how = REG_SAVED_OFFSET;
 
1484
-  /* CR? regs are always 32-bit and PPC is big-endian, so in 64-bit
 
1485
-     libgcc loc.offset needs to point to the low 32 bits of regs->ccr.  */
 
1486
-  fs->regs.reg[R_CR2].loc.offset = (long) &regs->ccr - new_cfa
 
1487
-                                  + sizeof (long) - 4;
 
1488
+  fs->regs.reg[R_CR2].loc.offset = cr_offset;
 
1489
+#if _CALL_ELF == 2
 
1490
+  /* In the ELFv2 ABI, every CR field has a separate CFI entry.  */
 
1491
+  fs->regs.reg[R_CR3].how = REG_SAVED_OFFSET;
 
1492
+  fs->regs.reg[R_CR3].loc.offset = cr_offset;
 
1493
+  fs->regs.reg[R_CR4].how = REG_SAVED_OFFSET;
 
1494
+  fs->regs.reg[R_CR4].loc.offset = cr_offset;
 
1495
+#endif
 
1496
 
 
1497
   fs->regs.reg[R_LR].how = REG_SAVED_OFFSET;
 
1498
   fs->regs.reg[R_LR].loc.offset = (long) &regs->link - new_cfa;
 
1499
@@ -294,9 +318,13 @@
 
1500
         figure out if it was saved.  The big problem here is that the
 
1501
         code that does the save/restore is generated by the linker, so
 
1502
         we have no good way to determine at compile time what to do.  */
 
1503
-      if (pc[0] == 0xF8410028
 
1504
+      if (pc[0] == 0xF8410000 + TOC_SAVE_SLOT
 
1505
+#if _CALL_ELF != 2
 
1506
+         /* The ELFv2 linker never generates the old PLT stub form.  */
 
1507
          || ((pc[0] & 0xFFFF0000) == 0x3D820000
 
1508
-             && pc[1] == 0xF8410028))
 
1509
+             && pc[1] == 0xF8410000 + TOC_SAVE_SLOT)
 
1510
+#endif
 
1511
+         )
 
1512
        {
 
1513
          /* We are in a plt call stub or r2 adjusting long branch stub,
 
1514
             before r2 has been saved.  Keep REG_UNSAVED.  */
 
1515
@@ -305,18 +333,21 @@
 
1516
        {
 
1517
          unsigned int *insn
 
1518
            = (unsigned int *) _Unwind_GetGR (context, R_LR);
 
1519
-         if (insn && *insn == 0xE8410028)
 
1520
-           _Unwind_SetGRPtr (context, 2, context->cfa + 40);
 
1521
+         if (insn && *insn == 0xE8410000 + TOC_SAVE_SLOT)
 
1522
+           _Unwind_SetGRPtr (context, 2, context->cfa + TOC_SAVE_SLOT);
 
1523
+#if _CALL_ELF != 2
 
1524
+         /* ELFv2 does not use this function pointer call sequence.  */
 
1525
          else if (pc[0] == 0x4E800421
 
1526
-                  && pc[1] == 0xE8410028)
 
1527
+                  && pc[1] == 0xE8410000 + TOC_SAVE_SLOT)
 
1528
            {
 
1529
              /* We are at the bctrl instruction in a call via function
 
1530
                 pointer.  gcc always emits the load of the new R2 just
 
1531
                 before the bctrl so this is the first and only place
 
1532
                 we need to use the stored R2.  */
 
1533
              _Unwind_Word sp = _Unwind_GetGR (context, 1);
 
1534
-             _Unwind_SetGRPtr (context, 2, (void *)(sp + 40));
 
1535
+             _Unwind_SetGRPtr (context, 2, (void *)(sp + TOC_SAVE_SLOT));
 
1536
            }
 
1537
+#endif
 
1538
        }
 
1539
     }
 
1540
 #endif
 
1541
--- a/src/libgcc/ChangeLog.ibm
 
1542
+++ b/src/libgcc/ChangeLog.ibm
 
1543
@@ -0,0 +1,38 @@
 
1544
+2013-11-15  Ulrich Weigand  <Ulrich.Weigand@de.ibm.com>
 
1545
+
 
1546
+       Backport from mainline r204808:
 
1547
+
 
1548
+       2013-11-14  Ulrich Weigand  <Ulrich.Weigand@de.ibm.com>
 
1549
+                   Alan Modra  <amodra@gmail.com>
 
1550
+
 
1551
+       * config/rs6000/linux-unwind.h (TOC_SAVE_SLOT): Define.
 
1552
+       (frob_update_context): Use it.
 
1553
+
 
1554
+       2013-11-14  Ulrich Weigand  <Ulrich.Weigand@de.ibm.com>
 
1555
+                   Alan Modra  <amodra@gmail.com>
 
1556
+
 
1557
+       * config/rs6000/tramp.S [__powerpc64__ && _CALL_ELF == 2]:
 
1558
+       (trampoline_initial): Provide ELFv2 variant.
 
1559
+       (__trampoline_setup): Likewise.
 
1560
+
 
1561
+       * config/rs6000/linux-unwind.h (frob_update_context): Do not
 
1562
+       check for AIX indirect function call sequence if _CALL_ELF == 2.
 
1563
+
 
1564
+       2013-11-14  Ulrich Weigand  <Ulrich.Weigand@de.ibm.com>
 
1565
+                   Alan Modra  <amodra@gmail.com>
 
1566
+
 
1567
+       * config/rs6000/linux-unwind.h (get_regs): Do not support
 
1568
+       old kernel versions if _CALL_ELF == 2.
 
1569
+       (frob_update_context): Do not support PLT stub variants only
 
1570
+       generated by old linkers if _CALL_ELF == 2.
 
1571
+
 
1572
+2013-11-15  Ulrich Weigand  <Ulrich.Weigand@de.ibm.com>
 
1573
+
 
1574
+       Backport from mainline r204800:
 
1575
+
 
1576
+       2013-11-14  Ulrich Weigand  <Ulrich.Weigand@de.ibm.com>
 
1577
+                   Alan Modra  <amodra@gmail.com>
 
1578
+
 
1579
+       * config/rs6000/linux-unwind.h (ppc_fallback_frame_state): Correct
 
1580
+       location of CR save area for 64-bit little-endian systems.
 
1581
+
 
1582
--- a/src/config.guess
 
1583
+++ b/src/config.guess
 
1584
@@ -1,10 +1,8 @@
 
1585
 #! /bin/sh
 
1586
 # Attempt to guess a canonical system name.
 
1587
-#   Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
 
1588
-#   2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010,
 
1589
-#   2011, 2012, 2013 Free Software Foundation, Inc.
 
1590
+#   Copyright 1992-2013 Free Software Foundation, Inc.
 
1591
 
 
1592
-timestamp='2012-12-30'
 
1593
+timestamp='2013-06-10'
 
1594
 
 
1595
 # This file is free software; you can redistribute it and/or modify it
 
1596
 # under the terms of the GNU General Public License as published by
 
1597
@@ -52,9 +50,7 @@
 
1598
 GNU config.guess ($timestamp)
 
1599
 
 
1600
 Originally written by Per Bothner.
 
1601
-Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
 
1602
-2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011,
 
1603
-2012, 2013 Free Software Foundation, Inc.
 
1604
+Copyright 1992-2013 Free Software Foundation, Inc.
 
1605
 
 
1606
 This is free software; see the source for copying conditions.  There is NO
 
1607
 warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
 
1608
@@ -136,6 +132,27 @@
 
1609
 UNAME_SYSTEM=`(uname -s) 2>/dev/null`  || UNAME_SYSTEM=unknown
 
1610
 UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown
 
1611
 
 
1612
+case "${UNAME_SYSTEM}" in
 
1613
+Linux|GNU|GNU/*)
 
1614
+       # If the system lacks a compiler, then just pick glibc.
 
1615
+       # We could probably try harder.
 
1616
+       LIBC=gnu
 
1617
+
 
1618
+       eval $set_cc_for_build
 
1619
+       cat <<-EOF > $dummy.c
 
1620
+       #include <features.h>
 
1621
+       #if defined(__UCLIBC__)
 
1622
+       LIBC=uclibc
 
1623
+       #elif defined(__dietlibc__)
 
1624
+       LIBC=dietlibc
 
1625
+       #else
 
1626
+       LIBC=gnu
 
1627
+       #endif
 
1628
+       EOF
 
1629
+       eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^LIBC'`
 
1630
+       ;;
 
1631
+esac
 
1632
+
 
1633
 # Note: order is significant - the case branches are not exclusive.
 
1634
 
 
1635
 case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
 
1636
@@ -857,21 +874,21 @@
 
1637
        exit ;;
 
1638
     *:GNU:*:*)
 
1639
        # the GNU system
 
1640
-       echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'`
 
1641
+       echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-${LIBC}`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'`
 
1642
        exit ;;
 
1643
     *:GNU/*:*:*)
 
1644
        # other systems with GNU libc and userland
 
1645
-       echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-gnu
 
1646
+       echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-${LIBC}
 
1647
        exit ;;
 
1648
     i*86:Minix:*:*)
 
1649
        echo ${UNAME_MACHINE}-pc-minix
 
1650
        exit ;;
 
1651
     aarch64:Linux:*:*)
 
1652
-       echo ${UNAME_MACHINE}-unknown-linux-gnu
 
1653
+       echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
 
1654
        exit ;;
 
1655
     aarch64_be:Linux:*:*)
 
1656
        UNAME_MACHINE=aarch64_be
 
1657
-       echo ${UNAME_MACHINE}-unknown-linux-gnu
 
1658
+       echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
 
1659
        exit ;;
 
1660
     alpha:Linux:*:*)
 
1661
        case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in
 
1662
@@ -884,59 +901,54 @@
 
1663
          EV68*) UNAME_MACHINE=alphaev68 ;;
 
1664
        esac
 
1665
        objdump --private-headers /bin/sh | grep -q ld.so.1
 
1666
-       if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi
 
1667
-       echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC}
 
1668
+       if test "$?" = 0 ; then LIBC="gnulibc1" ; fi
 
1669
+       echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
 
1670
        exit ;;
 
1671
+    arc:Linux:*:* | arceb:Linux:*:*)
 
1672
+       echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
 
1673
+       exit ;;
 
1674
     arm*:Linux:*:*)
 
1675
        eval $set_cc_for_build
 
1676
        if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \
 
1677
            | grep -q __ARM_EABI__
 
1678
        then
 
1679
-           echo ${UNAME_MACHINE}-unknown-linux-gnu
 
1680
+           echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
 
1681
        else
 
1682
            if echo __ARM_PCS_VFP | $CC_FOR_BUILD -E - 2>/dev/null \
 
1683
                | grep -q __ARM_PCS_VFP
 
1684
            then
 
1685
-               echo ${UNAME_MACHINE}-unknown-linux-gnueabi
 
1686
+               echo ${UNAME_MACHINE}-unknown-linux-${LIBC}eabi
 
1687
            else
 
1688
-               echo ${UNAME_MACHINE}-unknown-linux-gnueabihf
 
1689
+               echo ${UNAME_MACHINE}-unknown-linux-${LIBC}eabihf
 
1690
            fi
 
1691
        fi
 
1692
        exit ;;
 
1693
     avr32*:Linux:*:*)
 
1694
-       echo ${UNAME_MACHINE}-unknown-linux-gnu
 
1695
+       echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
 
1696
        exit ;;
 
1697
     cris:Linux:*:*)
 
1698
-       echo ${UNAME_MACHINE}-axis-linux-gnu
 
1699
+       echo ${UNAME_MACHINE}-axis-linux-${LIBC}
 
1700
        exit ;;
 
1701
     crisv32:Linux:*:*)
 
1702
-       echo ${UNAME_MACHINE}-axis-linux-gnu
 
1703
+       echo ${UNAME_MACHINE}-axis-linux-${LIBC}
 
1704
        exit ;;
 
1705
     frv:Linux:*:*)
 
1706
-       echo ${UNAME_MACHINE}-unknown-linux-gnu
 
1707
+       echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
 
1708
        exit ;;
 
1709
     hexagon:Linux:*:*)
 
1710
-       echo ${UNAME_MACHINE}-unknown-linux-gnu
 
1711
+       echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
 
1712
        exit ;;
 
1713
     i*86:Linux:*:*)
 
1714
-       LIBC=gnu
 
1715
-       eval $set_cc_for_build
 
1716
-       sed 's/^        //' << EOF >$dummy.c
 
1717
-       #ifdef __dietlibc__
 
1718
-       LIBC=dietlibc
 
1719
-       #endif
 
1720
-EOF
 
1721
-       eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^LIBC'`
 
1722
-       echo "${UNAME_MACHINE}-pc-linux-${LIBC}"
 
1723
+       echo ${UNAME_MACHINE}-pc-linux-${LIBC}
 
1724
        exit ;;
 
1725
     ia64:Linux:*:*)
 
1726
-       echo ${UNAME_MACHINE}-unknown-linux-gnu
 
1727
+       echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
 
1728
        exit ;;
 
1729
     m32r*:Linux:*:*)
 
1730
-       echo ${UNAME_MACHINE}-unknown-linux-gnu
 
1731
+       echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
 
1732
        exit ;;
 
1733
     m68*:Linux:*:*)
 
1734
-       echo ${UNAME_MACHINE}-unknown-linux-gnu
 
1735
+       echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
 
1736
        exit ;;
 
1737
     mips:Linux:*:* | mips64:Linux:*:*)
 
1738
        eval $set_cc_for_build
 
1739
@@ -955,54 +967,63 @@
 
1740
        #endif
 
1741
 EOF
 
1742
        eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^CPU'`
 
1743
-       test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; }
 
1744
+       test x"${CPU}" != x && { echo "${CPU}-unknown-linux-${LIBC}"; exit; }
 
1745
        ;;
 
1746
+    or1k:Linux:*:*)
 
1747
+       echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
 
1748
+       exit ;;
 
1749
     or32:Linux:*:*)
 
1750
-       echo ${UNAME_MACHINE}-unknown-linux-gnu
 
1751
+       echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
 
1752
        exit ;;
 
1753
     padre:Linux:*:*)
 
1754
-       echo sparc-unknown-linux-gnu
 
1755
+       echo sparc-unknown-linux-${LIBC}
 
1756
        exit ;;
 
1757
     parisc64:Linux:*:* | hppa64:Linux:*:*)
 
1758
-       echo hppa64-unknown-linux-gnu
 
1759
+       echo hppa64-unknown-linux-${LIBC}
 
1760
        exit ;;
 
1761
     parisc:Linux:*:* | hppa:Linux:*:*)
 
1762
        # Look for CPU level
 
1763
        case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in
 
1764
-         PA7*) echo hppa1.1-unknown-linux-gnu ;;
 
1765
-         PA8*) echo hppa2.0-unknown-linux-gnu ;;
 
1766
-         *)    echo hppa-unknown-linux-gnu ;;
 
1767
+         PA7*) echo hppa1.1-unknown-linux-${LIBC} ;;
 
1768
+         PA8*) echo hppa2.0-unknown-linux-${LIBC} ;;
 
1769
+         *)    echo hppa-unknown-linux-${LIBC} ;;
 
1770
        esac
 
1771
        exit ;;
 
1772
     ppc64:Linux:*:*)
 
1773
-       echo powerpc64-unknown-linux-gnu
 
1774
+       echo powerpc64-unknown-linux-${LIBC}
 
1775
        exit ;;
 
1776
     ppc:Linux:*:*)
 
1777
-       echo powerpc-unknown-linux-gnu
 
1778
+       echo powerpc-unknown-linux-${LIBC}
 
1779
        exit ;;
 
1780
+    ppc64le:Linux:*:*)
 
1781
+       echo powerpc64le-unknown-linux-${LIBC}
 
1782
+       exit ;;
 
1783
+    ppcle:Linux:*:*)
 
1784
+       echo powerpcle-unknown-linux-${LIBC}
 
1785
+       exit ;;
 
1786
     s390:Linux:*:* | s390x:Linux:*:*)
 
1787
-       echo ${UNAME_MACHINE}-ibm-linux
 
1788
+       echo ${UNAME_MACHINE}-ibm-linux-${LIBC}
 
1789
        exit ;;
 
1790
     sh64*:Linux:*:*)
 
1791
-       echo ${UNAME_MACHINE}-unknown-linux-gnu
 
1792
+       echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
 
1793
        exit ;;
 
1794
     sh*:Linux:*:*)
 
1795
-       echo ${UNAME_MACHINE}-unknown-linux-gnu
 
1796
+       echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
 
1797
        exit ;;
 
1798
     sparc:Linux:*:* | sparc64:Linux:*:*)
 
1799
-       echo ${UNAME_MACHINE}-unknown-linux-gnu
 
1800
+       echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
 
1801
        exit ;;
 
1802
     tile*:Linux:*:*)
 
1803
-       echo ${UNAME_MACHINE}-unknown-linux-gnu
 
1804
+       echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
 
1805
        exit ;;
 
1806
     vax:Linux:*:*)
 
1807
-       echo ${UNAME_MACHINE}-dec-linux-gnu
 
1808
+       echo ${UNAME_MACHINE}-dec-linux-${LIBC}
 
1809
        exit ;;
 
1810
     x86_64:Linux:*:*)
 
1811
-       echo ${UNAME_MACHINE}-unknown-linux-gnu
 
1812
+       echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
 
1813
        exit ;;
 
1814
     xtensa*:Linux:*:*)
 
1815
-       echo ${UNAME_MACHINE}-unknown-linux-gnu
 
1816
+       echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
 
1817
        exit ;;
 
1818
     i*86:DYNIX/ptx:4*:*)
 
1819
        # ptx 4.0 does uname -s correctly, with DYNIX/ptx in there.
 
1820
@@ -1235,19 +1256,21 @@
 
1821
        exit ;;
 
1822
     *:Darwin:*:*)
 
1823
        UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown
 
1824
-       case $UNAME_PROCESSOR in
 
1825
-           i386)
 
1826
-               eval $set_cc_for_build
 
1827
-               if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then
 
1828
-                 if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \
 
1829
-                     (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \
 
1830
-                     grep IS_64BIT_ARCH >/dev/null
 
1831
-                 then
 
1832
-                     UNAME_PROCESSOR="x86_64"
 
1833
-                 fi
 
1834
-               fi ;;
 
1835
-           unknown) UNAME_PROCESSOR=powerpc ;;
 
1836
-       esac
 
1837
+       eval $set_cc_for_build
 
1838
+       if test "$UNAME_PROCESSOR" = unknown ; then
 
1839
+           UNAME_PROCESSOR=powerpc
 
1840
+       fi
 
1841
+       if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then
 
1842
+           if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \
 
1843
+               (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \
 
1844
+               grep IS_64BIT_ARCH >/dev/null
 
1845
+           then
 
1846
+               case $UNAME_PROCESSOR in
 
1847
+                   i386) UNAME_PROCESSOR=x86_64 ;;
 
1848
+                   powerpc) UNAME_PROCESSOR=powerpc64 ;;
 
1849
+               esac
 
1850
+           fi
 
1851
+       fi
 
1852
        echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE}
 
1853
        exit ;;
 
1854
     *:procnto*:*:* | *:QNX:[0123456789]*:*)
 
1855
--- a/src/gcc/configure
 
1856
+++ b/src/gcc/configure
 
1857
@@ -13590,7 +13590,7 @@
 
1858
   rm -rf conftest*
 
1859
   ;;
 
1860
 
 
1861
-x86_64-*kfreebsd*-gnu|x86_64-*linux*|ppc*-*linux*|powerpc*-*linux*| \
 
1862
+x86_64-*kfreebsd*-gnu|x86_64-*linux*|powerpc*-*linux*| \
 
1863
 s390*-*linux*|s390*-*tpf*|sparc*-*linux*)
 
1864
   # Find out which ABI we are using.
 
1865
   echo 'int i;' > conftest.$ac_ext
 
1866
@@ -13615,7 +13615,10 @@
 
1867
                ;;
 
1868
            esac
 
1869
            ;;
 
1870
-         ppc64-*linux*|powerpc64-*linux*)
 
1871
+         powerpc64le-*linux*)
 
1872
+           LD="${LD-ld} -m elf32lppclinux"
 
1873
+           ;;
 
1874
+         powerpc64-*linux*)
 
1875
            LD="${LD-ld} -m elf32ppclinux"
 
1876
            ;;
 
1877
          s390x-*linux*)
 
1878
@@ -13634,7 +13637,10 @@
 
1879
          x86_64-*linux*)
 
1880
            LD="${LD-ld} -m elf_x86_64"
 
1881
            ;;
 
1882
-         ppc*-*linux*|powerpc*-*linux*)
 
1883
+         powerpcle-*linux*)
 
1884
+           LD="${LD-ld} -m elf64lppc"
 
1885
+           ;;
 
1886
+         powerpc-*linux*)
 
1887
            LD="${LD-ld} -m elf64ppc"
 
1888
            ;;
 
1889
          s390*-*linux*|s390*-*tpf*)
 
1890
--- a/src/gcc/builtins.c
 
1891
+++ b/src/gcc/builtins.c
 
1892
@@ -5846,6 +5846,9 @@
 
1893
   switch (fcode)
 
1894
     {
 
1895
     CASE_FLT_FN (BUILT_IN_FABS):
 
1896
+    case BUILT_IN_FABSD32:
 
1897
+    case BUILT_IN_FABSD64:
 
1898
+    case BUILT_IN_FABSD128:
 
1899
       target = expand_builtin_fabs (exp, target, subtarget);
 
1900
       if (target)
 
1901
        return target;
 
1902
@@ -10298,6 +10301,9 @@
 
1903
       return fold_builtin_strlen (loc, type, arg0);
 
1904
 
 
1905
     CASE_FLT_FN (BUILT_IN_FABS):
 
1906
+    case BUILT_IN_FABSD32:
 
1907
+    case BUILT_IN_FABSD64:
 
1908
+    case BUILT_IN_FABSD128:
 
1909
       return fold_builtin_fabs (loc, arg0, type);
 
1910
 
 
1911
     case BUILT_IN_ABS:
 
1912
--- a/src/gcc/testsuite/gcc.target/powerpc/ppc-target-2.c
 
1913
+++ b/src/gcc/testsuite/gcc.target/powerpc/ppc-target-2.c
 
1914
@@ -5,8 +5,7 @@
 
1915
 /* { dg-final { scan-assembler-times "fabs" 3 } } */
 
1916
 /* { dg-final { scan-assembler-times "fnabs" 3 } } */
 
1917
 /* { dg-final { scan-assembler-times "fsel" 3 } } */
 
1918
-/* { dg-final { scan-assembler-times "fcpsgn" 3 } } */
 
1919
-/* { dg-final { scan-assembler-times "xscpsgndp" 1 } } */
 
1920
+/* { dg-final { scan-assembler-times "fcpsgn\|xscpsgndp" 4 } } */
 
1921
 
 
1922
 /* fabs/fnabs/fsel */
 
1923
 double normal1 (double a, double b) { return __builtin_copysign (a, b); }
 
1924
--- a/src/gcc/testsuite/gcc.target/powerpc/p8vector-builtin-1.c
 
1925
+++ b/src/gcc/testsuite/gcc.target/powerpc/p8vector-builtin-1.c
 
1926
@@ -0,0 +1,65 @@
 
1927
+/* { dg-do compile { target { powerpc*-*-* } } } */
 
1928
+/* { dg-skip-if "" { powerpc*-*-darwin* } { "*" } { "" } } */
 
1929
+/* { dg-require-effective-target powerpc_p8vector_ok } */
 
1930
+/* { dg-options "-mcpu=power8 -O2 -ftree-vectorize -fvect-cost-model -fno-unroll-loops -fno-unroll-all-loops" } */
 
1931
+
 
1932
+#ifndef TYPE
 
1933
+#define TYPE long long
 
1934
+#endif
 
1935
+
 
1936
+#ifndef SIGN_TYPE
 
1937
+#define SIGN_TYPE signed TYPE
 
1938
+#endif
 
1939
+
 
1940
+#ifndef UNS_TYPE
 
1941
+#define UNS_TYPE unsigned TYPE
 
1942
+#endif
 
1943
+
 
1944
+typedef vector SIGN_TYPE v_sign;
 
1945
+typedef vector UNS_TYPE  v_uns;
 
1946
+
 
1947
+v_sign sign_add (v_sign a, v_sign b)
 
1948
+{
 
1949
+  return a + b;
 
1950
+}
 
1951
+
 
1952
+v_sign sign_sub (v_sign a, v_sign b)
 
1953
+{
 
1954
+  return a - b;
 
1955
+}
 
1956
+
 
1957
+v_sign sign_shift_left (v_sign a, v_sign b)
 
1958
+{
 
1959
+  return a << b;
 
1960
+}
 
1961
+
 
1962
+v_sign sign_shift_right (v_sign a, v_sign b)
 
1963
+{
 
1964
+  return a >> b;
 
1965
+}
 
1966
+
 
1967
+v_uns uns_add (v_uns a, v_uns b)
 
1968
+{
 
1969
+  return a + b;
 
1970
+}
 
1971
+
 
1972
+v_uns uns_sub (v_uns a, v_uns b)
 
1973
+{
 
1974
+  return a - b;
 
1975
+}
 
1976
+
 
1977
+v_uns uns_shift_left (v_uns a, v_uns b)
 
1978
+{
 
1979
+  return a << b;
 
1980
+}
 
1981
+
 
1982
+v_uns uns_shift_right (v_uns a, v_uns b)
 
1983
+{
 
1984
+  return a >> b;
 
1985
+}
 
1986
+
 
1987
+/* { dg-final { scan-assembler-times "vaddudm" 2 } } */
 
1988
+/* { dg-final { scan-assembler-times "vsubudm" 2 } } */
 
1989
+/* { dg-final { scan-assembler-times "vsld"    2 } } */
 
1990
+/* { dg-final { scan-assembler-times "vsrad"   1 } } */
 
1991
+/* { dg-final { scan-assembler-times "vsrd"    1 } } */
 
1992
--- a/src/gcc/testsuite/gcc.target/powerpc/p8vector-vectorize-1.c
 
1993
+++ b/src/gcc/testsuite/gcc.target/powerpc/p8vector-vectorize-1.c
 
1994
@@ -0,0 +1,200 @@
 
1995
+/* { dg-do compile { target { powerpc*-*-* } } } */
 
1996
+/* { dg-skip-if "" { powerpc*-*-darwin* } { "*" } { "" } } */
 
1997
+/* { dg-require-effective-target powerpc_p8vector_ok } */
 
1998
+/* { dg-options "-mcpu=power8 -O2 -ftree-vectorize -fvect-cost-model -fno-unroll-loops -fno-unroll-all-loops" } */
 
1999
+
 
2000
+#ifndef SIZE
 
2001
+#define SIZE 1024
 
2002
+#endif
 
2003
+
 
2004
+#ifndef ALIGN
 
2005
+#define ALIGN 32
 
2006
+#endif
 
2007
+
 
2008
+#ifndef TYPE
 
2009
+#define TYPE long long
 
2010
+#endif
 
2011
+
 
2012
+#ifndef SIGN_TYPE
 
2013
+#define SIGN_TYPE signed TYPE
 
2014
+#endif
 
2015
+
 
2016
+#ifndef UNS_TYPE
 
2017
+#define UNS_TYPE unsigned TYPE
 
2018
+#endif
 
2019
+
 
2020
+#define ALIGN_ATTR __attribute__((__aligned__(ALIGN)))
 
2021
+
 
2022
+SIGN_TYPE      sa[SIZE] ALIGN_ATTR;
 
2023
+SIGN_TYPE      sb[SIZE] ALIGN_ATTR;
 
2024
+SIGN_TYPE      sc[SIZE] ALIGN_ATTR;
 
2025
+
 
2026
+UNS_TYPE       ua[SIZE] ALIGN_ATTR;
 
2027
+UNS_TYPE       ub[SIZE] ALIGN_ATTR;
 
2028
+UNS_TYPE       uc[SIZE] ALIGN_ATTR;
 
2029
+
 
2030
+void
 
2031
+sign_add (void)
 
2032
+{
 
2033
+  unsigned long i;
 
2034
+
 
2035
+  for (i = 0; i < SIZE; i++)
 
2036
+    sa[i] = sb[i] + sc[i];
 
2037
+}
 
2038
+
 
2039
+void
 
2040
+sign_sub (void)
 
2041
+{
 
2042
+  unsigned long i;
 
2043
+
 
2044
+  for (i = 0; i < SIZE; i++)
 
2045
+    sa[i] = sb[i] - sc[i];
 
2046
+}
 
2047
+
 
2048
+void
 
2049
+sign_shift_left (void)
 
2050
+{
 
2051
+  unsigned long i;
 
2052
+
 
2053
+  for (i = 0; i < SIZE; i++)
 
2054
+    sa[i] = sb[i] << sc[i];
 
2055
+}
 
2056
+
 
2057
+void
 
2058
+sign_shift_right (void)
 
2059
+{
 
2060
+  unsigned long i;
 
2061
+
 
2062
+  for (i = 0; i < SIZE; i++)
 
2063
+    sa[i] = sb[i] >> sc[i];
 
2064
+}
 
2065
+
 
2066
+void
 
2067
+sign_max (void)
 
2068
+{
 
2069
+  unsigned long i;
 
2070
+
 
2071
+  for (i = 0; i < SIZE; i++)
 
2072
+    sa[i] = (sb[i] > sc[i]) ? sb[i] : sc[i];
 
2073
+}
 
2074
+
 
2075
+void
 
2076
+sign_min (void)
 
2077
+{
 
2078
+  unsigned long i;
 
2079
+
 
2080
+  for (i = 0; i < SIZE; i++)
 
2081
+    sa[i] = (sb[i] < sc[i]) ? sb[i] : sc[i];
 
2082
+}
 
2083
+
 
2084
+void
 
2085
+sign_abs (void)
 
2086
+{
 
2087
+  unsigned long i;
 
2088
+
 
2089
+  for (i = 0; i < SIZE; i++)
 
2090
+    sa[i] = (sb[i] < 0) ? -sb[i] : sb[i];      /* xor, vsubudm, vmaxsd.  */
 
2091
+}
 
2092
+
 
2093
+void
 
2094
+sign_eq (SIGN_TYPE val1, SIGN_TYPE val2)
 
2095
+{
 
2096
+  unsigned long i;
 
2097
+
 
2098
+  for (i = 0; i < SIZE; i++)
 
2099
+    sa[i] = (sb[i] == sc[i]) ? val1 : val2;
 
2100
+}
 
2101
+
 
2102
+void
 
2103
+sign_lt (SIGN_TYPE val1, SIGN_TYPE val2)
 
2104
+{
 
2105
+  unsigned long i;
 
2106
+
 
2107
+  for (i = 0; i < SIZE; i++)
 
2108
+    sa[i] = (sb[i] < sc[i]) ? val1 : val2;
 
2109
+}
 
2110
+
 
2111
+void
 
2112
+uns_add (void)
 
2113
+{
 
2114
+  unsigned long i;
 
2115
+
 
2116
+  for (i = 0; i < SIZE; i++)
 
2117
+    ua[i] = ub[i] + uc[i];
 
2118
+}
 
2119
+
 
2120
+void
 
2121
+uns_sub (void)
 
2122
+{
 
2123
+  unsigned long i;
 
2124
+
 
2125
+  for (i = 0; i < SIZE; i++)
 
2126
+    ua[i] = ub[i] - uc[i];
 
2127
+}
 
2128
+
 
2129
+void
 
2130
+uns_shift_left (void)
 
2131
+{
 
2132
+  unsigned long i;
 
2133
+
 
2134
+  for (i = 0; i < SIZE; i++)
 
2135
+    ua[i] = ub[i] << uc[i];
 
2136
+}
 
2137
+
 
2138
+void
 
2139
+uns_shift_right (void)
 
2140
+{
 
2141
+  unsigned long i;
 
2142
+
 
2143
+  for (i = 0; i < SIZE; i++)
 
2144
+    ua[i] = ub[i] >> uc[i];
 
2145
+}
 
2146
+
 
2147
+void
 
2148
+uns_max (void)
 
2149
+{
 
2150
+  unsigned long i;
 
2151
+
 
2152
+  for (i = 0; i < SIZE; i++)
 
2153
+    ua[i] = (ub[i] > uc[i]) ? ub[i] : uc[i];
 
2154
+}
 
2155
+
 
2156
+void
 
2157
+uns_min (void)
 
2158
+{
 
2159
+  unsigned long i;
 
2160
+
 
2161
+  for (i = 0; i < SIZE; i++)
 
2162
+    ua[i] = (ub[i] < uc[i]) ? ub[i] : uc[i];
 
2163
+}
 
2164
+
 
2165
+void
 
2166
+uns_eq (UNS_TYPE val1, UNS_TYPE val2)
 
2167
+{
 
2168
+  unsigned long i;
 
2169
+
 
2170
+  for (i = 0; i < SIZE; i++)
 
2171
+    ua[i] = (ub[i] == uc[i]) ? val1 : val2;
 
2172
+}
 
2173
+
 
2174
+void
 
2175
+uns_lt (UNS_TYPE val1, UNS_TYPE val2)
 
2176
+{
 
2177
+  unsigned long i;
 
2178
+
 
2179
+  for (i = 0; i < SIZE; i++)
 
2180
+    ua[i] = (ub[i] < uc[i]) ? val1 : val2;
 
2181
+}
 
2182
+
 
2183
+/* { dg-final { scan-assembler-times "\[\t \]vaddudm\[\t \]"  2 } } */
 
2184
+/* { dg-final { scan-assembler-times "\[\t \]vsubudm\[\t \]"  3 } } */
 
2185
+/* { dg-final { scan-assembler-times "\[\t \]vmaxsd\[\t \]"   2 } } */
 
2186
+/* { dg-final { scan-assembler-times "\[\t \]vmaxud\[\t \]"   1 } } */
 
2187
+/* { dg-final { scan-assembler-times "\[\t \]vminsd\[\t \]"   1 } } */
 
2188
+/* { dg-final { scan-assembler-times "\[\t \]vminud\[\t \]"   1 } } */
 
2189
+/* { dg-final { scan-assembler-times "\[\t \]vsld\[\t \]"     2 } } */
 
2190
+/* { dg-final { scan-assembler-times "\[\t \]vsrad\[\t \]"    1 } } */
 
2191
+/* { dg-final { scan-assembler-times "\[\t \]vsrd\[\t \]"     1 } } */
 
2192
+/* { dg-final { scan-assembler-times "\[\t \]vcmpequd\[\t \]" 2 } } */
 
2193
+/* { dg-final { scan-assembler-times "\[\t \]vcmpgtsd\[\t \]" 1 } } */
 
2194
+/* { dg-final { scan-assembler-times "\[\t \]vcmpgtud\[\t \]" 1 } } */
 
2195
--- a/src/gcc/testsuite/gcc.target/powerpc/pr57744.c
 
2196
+++ b/src/gcc/testsuite/gcc.target/powerpc/pr57744.c
 
2197
@@ -0,0 +1,39 @@
 
2198
+/* { dg-do run { target { powerpc*-*-* && lp64 } } } */
 
2199
+/* { dg-skip-if "" { powerpc*-*-darwin* } { "*" } { "" } } */
 
2200
+/* { dg-require-effective-target powerpc_p8vector_ok } */
 
2201
+/* { dg-options "-mcpu=power8 -O3" } */
 
2202
+
 
2203
+void abort (void);
 
2204
+
 
2205
+typedef unsigned U_16 __attribute__((mode(TI)));
 
2206
+
 
2207
+extern int libat_compare_exchange_16 (U_16 *, U_16 *, U_16, int, int)
 
2208
+  __attribute__((__noinline__));
 
2209
+
 
2210
+/* PR 57744: lqarx/stqcx needs even/odd register pairs.  The assembler will
 
2211
+   complain if the compiler gets an odd/even register pair.  Create a function
 
2212
+   which has the 16 byte compare and exchange instructions, but don't actually
 
2213
+   execute it, so that we can detect these failures on older machines. */
 
2214
+
 
2215
+int
 
2216
+libat_compare_exchange_16 (U_16 *mptr, U_16 *eptr, U_16 newval,
 
2217
+         int smodel, int fmodel __attribute__((unused)))
 
2218
+{
 
2219
+  if (((smodel) == 0))
 
2220
+    return __atomic_compare_exchange_n (mptr, eptr, newval, 0, 0, 0);
 
2221
+  else if (((smodel) != 5))
 
2222
+    return __atomic_compare_exchange_n (mptr, eptr, newval, 0, 4, 0);
 
2223
+  else
 
2224
+    return __atomic_compare_exchange_n (mptr, eptr, newval, 0, 5, 0);
 
2225
+}
 
2226
+
 
2227
+U_16 a = 1, b = 1, c = -2;
 
2228
+volatile int do_test = 0;
 
2229
+
 
2230
+int main (void)
 
2231
+{
 
2232
+  if (do_test && !libat_compare_exchange_16 (&a, &b, c, 0, 0))
 
2233
+    abort ();
 
2234
+
 
2235
+  return 0;
 
2236
+}
 
2237
--- a/src/gcc/testsuite/gcc.target/powerpc/recip-1.c
 
2238
+++ b/src/gcc/testsuite/gcc.target/powerpc/recip-1.c
 
2239
@@ -3,8 +3,8 @@
 
2240
 /* { dg-options "-O2 -mrecip -ffast-math -mcpu=power6" } */
 
2241
 /* { dg-final { scan-assembler-times "frsqrte" 2 } } */
 
2242
 /* { dg-final { scan-assembler-times "fmsub" 2 } } */
 
2243
-/* { dg-final { scan-assembler-times "fmul" 8 } } */
 
2244
-/* { dg-final { scan-assembler-times "fnmsub" 4 } } */
 
2245
+/* { dg-final { scan-assembler-times "fmul" 6 } } */
 
2246
+/* { dg-final { scan-assembler-times "fnmsub" 3 } } */
 
2247
 
 
2248
 double
 
2249
 rsqrt_d (double a)
 
2250
--- a/src/gcc/testsuite/gcc.target/powerpc/darwin-longlong.c
 
2251
+++ b/src/gcc/testsuite/gcc.target/powerpc/darwin-longlong.c
 
2252
@@ -11,7 +11,11 @@
 
2253
     int  i[2];
 
2254
   } ud;
 
2255
   ud.ll = in;
 
2256
+#ifdef __LITTLE_ENDIAN__
 
2257
+  return ud.i[1];
 
2258
+#else
 
2259
   return ud.i[0];
 
2260
+#endif
 
2261
 }
 
2262
 
 
2263
 int main()
 
2264
--- a/src/gcc/testsuite/gcc.target/powerpc/bool2-p8.c
 
2265
+++ b/src/gcc/testsuite/gcc.target/powerpc/bool2-p8.c
 
2266
@@ -0,0 +1,32 @@
 
2267
+/* { dg-do compile { target { powerpc*-*-* } } } */
 
2268
+/* { dg-skip-if "" { powerpc*-*-darwin* } { "*" } { "" } } */
 
2269
+/* { dg-require-effective-target powerpc_p8vector_ok } */
 
2270
+/* { dg-options "-O2 -mcpu=power8" } */
 
2271
+/* { dg-final { scan-assembler-not "\[ \t\]and "     } } */
 
2272
+/* { dg-final { scan-assembler-not "\[ \t\]or "      } } */
 
2273
+/* { dg-final { scan-assembler-not "\[ \t\]xor "     } } */
 
2274
+/* { dg-final { scan-assembler-not "\[ \t\]nor "     } } */
 
2275
+/* { dg-final { scan-assembler-not "\[ \t\]eqv "     } } */
 
2276
+/* { dg-final { scan-assembler-not "\[ \t\]andc "    } } */
 
2277
+/* { dg-final { scan-assembler-not "\[ \t\]orc "     } } */
 
2278
+/* { dg-final { scan-assembler-not "\[ \t\]nand "    } } */
 
2279
+/* { dg-final { scan-assembler-not "\[ \t\]vand "    } } */
 
2280
+/* { dg-final { scan-assembler-not "\[ \t\]vandc "   } } */
 
2281
+/* { dg-final { scan-assembler-not "\[ \t\]vor "     } } */
 
2282
+/* { dg-final { scan-assembler-not "\[ \t\]vxor "    } } */
 
2283
+/* { dg-final { scan-assembler-not "\[ \t\]vnor "    } } */
 
2284
+/* { dg-final { scan-assembler     "\[ \t\]xxland "  } } */
 
2285
+/* { dg-final { scan-assembler     "\[ \t\]xxlor "   } } */
 
2286
+/* { dg-final { scan-assembler     "\[ \t\]xxlxor "  } } */
 
2287
+/* { dg-final { scan-assembler     "\[ \t\]xxlnor "  } } */
 
2288
+/* { dg-final { scan-assembler     "\[ \t\]xxlandc " } } */
 
2289
+/* { dg-final { scan-assembler     "\[ \t\]xxleqv "  } } */
 
2290
+/* { dg-final { scan-assembler     "\[ \t\]xxlorc "  } } */
 
2291
+/* { dg-final { scan-assembler     "\[ \t\]xxlnand " } } */
 
2292
+
 
2293
+#ifndef TYPE
 
2294
+typedef int v4si __attribute__ ((vector_size (16)));
 
2295
+#define TYPE v4si
 
2296
+#endif
 
2297
+
 
2298
+#include "bool2.h"
 
2299
--- a/src/gcc/testsuite/gcc.target/powerpc/mmfpgpr.c
 
2300
+++ b/src/gcc/testsuite/gcc.target/powerpc/mmfpgpr.c
 
2301
@@ -0,0 +1,22 @@
 
2302
+/* { dg-do compile { target { powerpc*-*-* && lp64 } } } */
 
2303
+/* { dg-skip-if "" { powerpc*-*-darwin* } { "*" } { "" } } */
 
2304
+/* { dg-require-effective-target powerpc_vsx_ok } */
 
2305
+/* { dg-options "-O2 -mcpu=power6x -mmfpgpr" } */
 
2306
+/* { dg-final { scan-assembler "mffgpr" } } */
 
2307
+/* { dg-final { scan-assembler "mftgpr" } } */
 
2308
+
 
2309
+/* Test that we generate the instructions to move between the GPR and FPR
 
2310
+   registers under power6x.  */
 
2311
+
 
2312
+extern long return_long (void);
 
2313
+extern double return_double (void);
 
2314
+
 
2315
+double return_double2 (void)
 
2316
+{
 
2317
+  return (double) return_long ();
 
2318
+}
 
2319
+
 
2320
+long return_long2 (void)
 
2321
+{
 
2322
+  return (long) return_double ();
 
2323
+}
 
2324
--- a/src/gcc/testsuite/gcc.target/powerpc/direct-move-vint1.c
 
2325
+++ b/src/gcc/testsuite/gcc.target/powerpc/direct-move-vint1.c
 
2326
@@ -0,0 +1,14 @@
 
2327
+/* { dg-do compile { target { powerpc*-*-linux* && lp64 } } } */
 
2328
+/* { dg-skip-if "" { powerpc*-*-darwin* } { "*" } { "" } } */
 
2329
+/* { dg-skip-if "" { powerpc*-*-*spe* } { "*" } { "" } } */
 
2330
+/* { dg-require-effective-target powerpc_p8vector_ok } */
 
2331
+/* { dg-options "-mcpu=power8 -O2" } */
 
2332
+/* { dg-final { scan-assembler "mtvsrd" } } */
 
2333
+/* { dg-final { scan-assembler "mfvsrd" } } */
 
2334
+
 
2335
+/* Check code generation for direct move for vector types.  */
 
2336
+
 
2337
+#define TYPE vector int
 
2338
+#define VSX_REG_ATTR "wa"
 
2339
+
 
2340
+#include "direct-move.h"
 
2341
--- a/src/gcc/testsuite/gcc.target/powerpc/bool2-av.c
 
2342
+++ b/src/gcc/testsuite/gcc.target/powerpc/bool2-av.c
 
2343
@@ -0,0 +1,32 @@
 
2344
+/* { dg-do compile { target { powerpc*-*-* } } } */
 
2345
+/* { dg-skip-if "" { powerpc*-*-darwin* } { "*" } { "" } } */
 
2346
+/* { dg-require-effective-target powerpc_altivec_ok } */
 
2347
+/* { dg-options "-O2 -mcpu=power6 -maltivec" } */
 
2348
+/* { dg-final { scan-assembler-not "\[ \t\]and "     } } */
 
2349
+/* { dg-final { scan-assembler-not "\[ \t\]or "      } } */
 
2350
+/* { dg-final { scan-assembler-not "\[ \t\]xor "     } } */
 
2351
+/* { dg-final { scan-assembler-not "\[ \t\]nor "     } } */
 
2352
+/* { dg-final { scan-assembler-not "\[ \t\]andc "    } } */
 
2353
+/* { dg-final { scan-assembler-not "\[ \t\]eqv "     } } */
 
2354
+/* { dg-final { scan-assembler-not "\[ \t\]orc "     } } */
 
2355
+/* { dg-final { scan-assembler-not "\[ \t\]nand "    } } */
 
2356
+/* { dg-final { scan-assembler     "\[ \t\]vand "    } } */
 
2357
+/* { dg-final { scan-assembler     "\[ \t\]vandc "   } } */
 
2358
+/* { dg-final { scan-assembler     "\[ \t\]vor "     } } */
 
2359
+/* { dg-final { scan-assembler     "\[ \t\]vxor "    } } */
 
2360
+/* { dg-final { scan-assembler     "\[ \t\]vnor "    } } */
 
2361
+/* { dg-final { scan-assembler-not "\[ \t\]xxland "  } } */
 
2362
+/* { dg-final { scan-assembler-not "\[ \t\]xxlor "   } } */
 
2363
+/* { dg-final { scan-assembler-not "\[ \t\]xxlxor "  } } */
 
2364
+/* { dg-final { scan-assembler-not "\[ \t\]xxlnor "  } } */
 
2365
+/* { dg-final { scan-assembler-not "\[ \t\]xxlandc " } } */
 
2366
+/* { dg-final { scan-assembler-not "\[ \t\]xxleqv "  } } */
 
2367
+/* { dg-final { scan-assembler-not "\[ \t\]xxlorc "  } } */
 
2368
+/* { dg-final { scan-assembler-not "\[ \t\]xxlnand " } } */
 
2369
+
 
2370
+#ifndef TYPE
 
2371
+typedef int v4si __attribute__ ((vector_size (16)));
 
2372
+#define TYPE v4si
 
2373
+#endif
 
2374
+
 
2375
+#include "bool2.h"
 
2376
--- a/src/gcc/testsuite/gcc.target/powerpc/pr43154.c
 
2377
+++ b/src/gcc/testsuite/gcc.target/powerpc/pr43154.c
 
2378
@@ -1,5 +1,6 @@
 
2379
 /* { dg-do compile { target { powerpc*-*-* } } } */
 
2380
 /* { dg-skip-if "" { powerpc*-*-darwin* } { "*" } { "" } } */
 
2381
+/* { dg-skip-if "" { powerpc*le-*-* } { "*" } { "" } } */
 
2382
 /* { dg-require-effective-target powerpc_vsx_ok } */
 
2383
 /* { dg-options "-O2 -mcpu=power7" } */
 
2384
 
 
2385
--- a/src/gcc/testsuite/gcc.target/powerpc/pr59054.c
 
2386
+++ b/src/gcc/testsuite/gcc.target/powerpc/pr59054.c
 
2387
@@ -0,0 +1,9 @@
 
2388
+/* { dg-do compile { target { powerpc*-*-* && lp64 } } } */
 
2389
+/* { dg-skip-if "" { powerpc*-*-darwin* } { "*" } { "" } } */
 
2390
+/* { dg-require-effective-target powerpc_vsx_ok } */
 
2391
+/* { dg-options "-mcpu=power7 -O0 -m64" } */
 
2392
+
 
2393
+long foo (void) { return 0; }
 
2394
+
 
2395
+/* { dg-final { scan-assembler-not "xxlor" } } */
 
2396
+/* { dg-final { scan-assembler-not "stfd" } } */
 
2397
--- a/src/gcc/testsuite/gcc.target/powerpc/p8vector-builtin-2.c
 
2398
+++ b/src/gcc/testsuite/gcc.target/powerpc/p8vector-builtin-2.c
 
2399
@@ -0,0 +1,204 @@
 
2400
+/* { dg-do compile { target { powerpc*-*-* } } } */
 
2401
+/* { dg-skip-if "" { powerpc*-*-darwin* } { "*" } { "" } } */
 
2402
+/* { dg-require-effective-target powerpc_p8vector_ok } */
 
2403
+/* { dg-options "-mcpu=power8 -O2 -ftree-vectorize -fvect-cost-model -fno-unroll-loops -fno-unroll-all-loops" } */
 
2404
+
 
2405
+#include <altivec.h>
 
2406
+
 
2407
+typedef vector long long               v_sign;
 
2408
+typedef vector unsigned long long      v_uns;
 
2409
+typedef vector bool long long          v_bool;
 
2410
+
 
2411
+v_sign sign_add_1 (v_sign a, v_sign b)
 
2412
+{
 
2413
+  return __builtin_altivec_vaddudm (a, b);
 
2414
+}
 
2415
+
 
2416
+v_sign sign_add_2 (v_sign a, v_sign b)
 
2417
+{
 
2418
+  return vec_add (a, b);
 
2419
+}
 
2420
+
 
2421
+v_sign sign_add_3 (v_sign a, v_sign b)
 
2422
+{
 
2423
+  return vec_vaddudm (a, b);
 
2424
+}
 
2425
+
 
2426
+v_sign sign_sub_1 (v_sign a, v_sign b)
 
2427
+{
 
2428
+  return __builtin_altivec_vsubudm (a, b);
 
2429
+}
 
2430
+
 
2431
+v_sign sign_sub_2 (v_sign a, v_sign b)
 
2432
+{
 
2433
+  return vec_sub (a, b);
 
2434
+}
 
2435
+
 
2436
+
 
2437
+v_sign sign_sub_3 (v_sign a, v_sign b)
 
2438
+{
 
2439
+  return vec_vsubudm (a, b);
 
2440
+}
 
2441
+
 
2442
+v_sign sign_min_1 (v_sign a, v_sign b)
 
2443
+{
 
2444
+  return __builtin_altivec_vminsd (a, b);
 
2445
+}
 
2446
+
 
2447
+v_sign sign_min_2 (v_sign a, v_sign b)
 
2448
+{
 
2449
+  return vec_min (a, b);
 
2450
+}
 
2451
+
 
2452
+v_sign sign_min_3 (v_sign a, v_sign b)
 
2453
+{
 
2454
+  return vec_vminsd (a, b);
 
2455
+}
 
2456
+
 
2457
+v_sign sign_max_1 (v_sign a, v_sign b)
 
2458
+{
 
2459
+  return __builtin_altivec_vmaxsd (a, b);
 
2460
+}
 
2461
+
 
2462
+v_sign sign_max_2 (v_sign a, v_sign b)
 
2463
+{
 
2464
+  return vec_max (a, b);
 
2465
+}
 
2466
+
 
2467
+v_sign sign_max_3 (v_sign a, v_sign b)
 
2468
+{
 
2469
+  return vec_vmaxsd (a, b);
 
2470
+}
 
2471
+
 
2472
+v_sign sign_abs (v_sign a)
 
2473
+{
 
2474
+  return vec_abs (a);          /* xor, vsubudm, vmaxsd.  */
 
2475
+}
 
2476
+
 
2477
+v_bool sign_eq (v_sign a, v_sign b)
 
2478
+{
 
2479
+  return vec_cmpeq (a, b);
 
2480
+}
 
2481
+
 
2482
+v_bool sign_lt (v_sign a, v_sign b)
 
2483
+{
 
2484
+  return vec_cmplt (a, b);
 
2485
+}
 
2486
+
 
2487
+v_uns uns_add_2 (v_uns a, v_uns b)
 
2488
+{
 
2489
+  return vec_add (a, b);
 
2490
+}
 
2491
+
 
2492
+v_uns uns_add_3 (v_uns a, v_uns b)
 
2493
+{
 
2494
+  return vec_vaddudm (a, b);
 
2495
+}
 
2496
+
 
2497
+v_uns uns_sub_2 (v_uns a, v_uns b)
 
2498
+{
 
2499
+  return vec_sub (a, b);
 
2500
+}
 
2501
+
 
2502
+v_uns uns_sub_3 (v_uns a, v_uns b)
 
2503
+{
 
2504
+  return vec_vsubudm (a, b);
 
2505
+}
 
2506
+
 
2507
+v_uns uns_min_2 (v_uns a, v_uns b)
 
2508
+{
 
2509
+  return vec_min (a, b);
 
2510
+}
 
2511
+
 
2512
+v_uns uns_min_3 (v_uns a, v_uns b)
 
2513
+{
 
2514
+  return vec_vminud (a, b);
 
2515
+}
 
2516
+
 
2517
+v_uns uns_max_2 (v_uns a, v_uns b)
 
2518
+{
 
2519
+  return vec_max (a, b);
 
2520
+}
 
2521
+
 
2522
+v_uns uns_max_3 (v_uns a, v_uns b)
 
2523
+{
 
2524
+  return vec_vmaxud (a, b);
 
2525
+}
 
2526
+
 
2527
+v_bool uns_eq (v_uns a, v_uns b)
 
2528
+{
 
2529
+  return vec_cmpeq (a, b);
 
2530
+}
 
2531
+
 
2532
+v_bool uns_lt (v_uns a, v_uns b)
 
2533
+{
 
2534
+  return vec_cmplt (a, b);
 
2535
+}
 
2536
+
 
2537
+v_sign sign_rl_1 (v_sign a, v_sign b)
 
2538
+{
 
2539
+  return __builtin_altivec_vrld (a, b);
 
2540
+}
 
2541
+
 
2542
+v_sign sign_rl_2 (v_sign a, v_uns b)
 
2543
+{
 
2544
+  return vec_rl (a, b);
 
2545
+}
 
2546
+
 
2547
+v_uns uns_rl_2 (v_uns a, v_uns b)
 
2548
+{
 
2549
+  return vec_rl (a, b);
 
2550
+}
 
2551
+
 
2552
+v_sign sign_sl_1 (v_sign a, v_sign b)
 
2553
+{
 
2554
+  return __builtin_altivec_vsld (a, b);
 
2555
+}
 
2556
+
 
2557
+v_sign sign_sl_2 (v_sign a, v_uns b)
 
2558
+{
 
2559
+  return vec_sl (a, b);
 
2560
+}
 
2561
+
 
2562
+v_sign sign_sl_3 (v_sign a, v_uns b)
 
2563
+{
 
2564
+  return vec_vsld (a, b);
 
2565
+}
 
2566
+
 
2567
+v_uns uns_sl_2 (v_uns a, v_uns b)
 
2568
+{
 
2569
+  return vec_sl (a, b);
 
2570
+}
 
2571
+
 
2572
+v_uns uns_sl_3 (v_uns a, v_uns b)
 
2573
+{
 
2574
+  return vec_vsld (a, b);
 
2575
+}
 
2576
+
 
2577
+v_sign sign_sra_1 (v_sign a, v_sign b)
 
2578
+{
 
2579
+  return __builtin_altivec_vsrad (a, b);
 
2580
+}
 
2581
+
 
2582
+v_sign sign_sra_2 (v_sign a, v_uns b)
 
2583
+{
 
2584
+  return vec_sra (a, b);
 
2585
+}
 
2586
+
 
2587
+v_sign sign_sra_3 (v_sign a, v_uns b)
 
2588
+{
 
2589
+  return vec_vsrad (a, b);
 
2590
+}
 
2591
+
 
2592
+/* { dg-final { scan-assembler-times "vaddudm"         5 } } */
 
2593
+/* { dg-final { scan-assembler-times "vsubudm"         6 } } */
 
2594
+/* { dg-final { scan-assembler-times "vmaxsd"          4 } } */
 
2595
+/* { dg-final { scan-assembler-times "vminsd"          3 } } */
 
2596
+/* { dg-final { scan-assembler-times "vmaxud"          2 } } */
 
2597
+/* { dg-final { scan-assembler-times "vminud"          2 } } */
 
2598
+/* { dg-final { scan-assembler-times "vcmpequd" 2 } } */
 
2599
+/* { dg-final { scan-assembler-times "vcmpgtsd" 1 } } */
 
2600
+/* { dg-final { scan-assembler-times "vcmpgtud" 1 } } */
 
2601
+/* { dg-final { scan-assembler-times "vrld"     3 } } */
 
2602
+/* { dg-final { scan-assembler-times "vsld"     5 } } */
 
2603
+/* { dg-final { scan-assembler-times "vsrad"    3 } } */
 
2604
--- a/src/gcc/testsuite/gcc.target/powerpc/p8vector-vectorize-2.c
 
2605
+++ b/src/gcc/testsuite/gcc.target/powerpc/p8vector-vectorize-2.c
 
2606
@@ -0,0 +1,30 @@
 
2607
+/* { dg-do compile { target { powerpc*-*-* } } } */
 
2608
+/* { dg-skip-if "" { powerpc*-*-darwin* } { "*" } { "" } } */
 
2609
+/* { dg-require-effective-target powerpc_p8vector_ok } */
 
2610
+/* { dg-options "-mcpu=power8 -O2 -ftree-vectorize -fvect-cost-model" } */
 
2611
+
 
2612
+#include <stddef.h>
 
2613
+
 
2614
+#ifndef SIZE
 
2615
+#define SIZE 1024
 
2616
+#endif
 
2617
+
 
2618
+#ifndef ALIGN
 
2619
+#define ALIGN 32
 
2620
+#endif
 
2621
+
 
2622
+#define ALIGN_ATTR __attribute__((__aligned__(ALIGN)))
 
2623
+
 
2624
+long long sign_ll[SIZE]        ALIGN_ATTR;
 
2625
+int      sign_i [SIZE] ALIGN_ATTR;
 
2626
+
 
2627
+void copy_int_to_long_long (void)
 
2628
+{
 
2629
+  size_t i;
 
2630
+
 
2631
+  for (i = 0; i < SIZE; i++)
 
2632
+    sign_ll[i] = sign_i[i];
 
2633
+}
 
2634
+
 
2635
+/* { dg-final { scan-assembler "vupkhsw" } } */
 
2636
+/* { dg-final { scan-assembler "vupklsw" } } */
 
2637
--- a/src/gcc/testsuite/gcc.target/powerpc/altivec-perm-3.c
 
2638
+++ b/src/gcc/testsuite/gcc.target/powerpc/altivec-perm-3.c
 
2639
@@ -0,0 +1,23 @@
 
2640
+/* { dg-do compile } */
 
2641
+/* { dg-require-effective-target powerpc_altivec_ok } */
 
2642
+/* { dg-skip-if "" { powerpc*le-*-* } { "*" } { "" } } */
 
2643
+/* { dg-options "-O -maltivec -mno-vsx" } */
 
2644
+
 
2645
+typedef unsigned char V __attribute__((vector_size(16)));
 
2646
+
 
2647
+V p2(V x, V y)
 
2648
+{
 
2649
+  return __builtin_shuffle(x, y,
 
2650
+       (V){ 1,  3,  5,  7,  9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29, 31 });
 
2651
+
 
2652
+}
 
2653
+
 
2654
+V p4(V x, V y)
 
2655
+{
 
2656
+  return __builtin_shuffle(x, y,
 
2657
+       (V){ 2,  3,  6,  7, 10, 11, 14, 15, 18, 19, 22, 23, 26, 27, 30, 31 });
 
2658
+}
 
2659
+
 
2660
+/* { dg-final { scan-assembler-not "vperm" } } */
 
2661
+/* { dg-final { scan-assembler "vpkuhum" } } */
 
2662
+/* { dg-final { scan-assembler "vpkuwum" } } */
 
2663
--- a/src/gcc/testsuite/gcc.target/powerpc/pr58673-1.c
 
2664
+++ b/src/gcc/testsuite/gcc.target/powerpc/pr58673-1.c
 
2665
@@ -0,0 +1,78 @@
 
2666
+/* { dg-do compile { target { powerpc*-*-* && lp64 } } } */
 
2667
+/* { dg-skip-if "" { powerpc*-*-darwin* } { "*" } { "" } } */
 
2668
+/* { dg-require-effective-target powerpc_p8vector_ok } */
 
2669
+/* { dg-options "-mcpu=power8 -m64 -O1" } */
 
2670
+
 
2671
+enum typecode
 
2672
+{
 
2673
+  QIcode, QUcode, HIcode, HUcode, SIcode, SUcode, DIcode, DUcode, SFcode,
 
2674
+    DFcode, XFcode, Pcode, Tcode, LAST_AND_UNUSED_TYPECODE
 
2675
+};
 
2676
+enum bytecode_opcode
 
2677
+{
 
2678
+  neverneverland, drop, duplicate, over, setstackSI, adjstackSI, constQI,
 
2679
+    constHI, constSI, constDI, constSF, constDF, constXF, constP, loadQI,
 
2680
+    loadHI, loadSI, loadDI, loadSF, loadDF, loadXF, loadP, storeQI, storeHI,
 
2681
+    storeSI, storeDI, storeSF, storeDF, storeXF, storeP, storeBLK, clearBLK,
 
2682
+    addconstPSI, newlocalSI, localP, argP, convertQIHI, convertHISI,
 
2683
+    convertSIDI, convertQISI, convertQUHU, convertHUSU, convertSUDU,
 
2684
+    convertQUSU, convertSFDF, convertDFXF, convertHIQI, convertSIHI,
 
2685
+    convertDISI, convertSIQI, convertSUQU, convertDFSF, convertXFDF,
 
2686
+    convertSISF, convertSIDF, convertSIXF, convertSUSF, convertSUDF,
 
2687
+    convertSUXF, convertDISF, convertDIDF, convertDIXF, convertDUSF,
 
2688
+    convertDUDF, convertDUXF, convertSFSI, convertDFSI, convertXFSI,
 
2689
+    convertSFSU, convertDFSU, convertXFSU, convertSFDI, convertDFDI,
 
2690
+    convertXFDI, convertSFDU, convertDFDU, convertXFDU, convertPSI,
 
2691
+    convertSIP, convertSIT, convertDIT, convertSFT, convertDFT, convertXFT,
 
2692
+    convertPT, zxloadBI, sxloadBI, sstoreBI, addSI, addDI, addSF, addDF,
 
2693
+    addXF, addPSI, subSI, subDI, subSF, subDF, subXF, subPP, mulSI, mulDI,
 
2694
+    mulSU, mulDU, mulSF, mulDF, mulXF, divSI, divDI, divSU, divDU, divSF,
 
2695
+    divDF, divXF, modSI, modDI, modSU, modDU, andSI, andDI, iorSI, iorDI,
 
2696
+    xorSI, xorDI, lshiftSI, lshiftSU, lshiftDI, lshiftDU, rshiftSI, rshiftSU,
 
2697
+    rshiftDI, rshiftDU, ltSI, ltSU, ltDI, ltDU, ltSF, ltDF, ltXF, ltP, leSI,
 
2698
+    leSU, leDI, leDU, leSF, leDF, leXF, leP, geSI, geSU, geDI, geDU, geSF,
 
2699
+    geDF, geXF, geP, gtSI, gtSU, gtDI, gtDU, gtSF, gtDF, gtXF, gtP, eqSI,
 
2700
+    eqDI, eqSF, eqDF, eqXF, eqP, neSI, neDI, neSF, neDF, neXF, neP, negSI,
 
2701
+    negDI, negSF, negDF, negXF, notSI, notDI, notT, predecQI, predecHI,
 
2702
+    predecSI, predecDI, predecP, predecSF, predecDF, predecXF, predecBI,
 
2703
+    preincQI, preincHI, preincSI, preincDI, preincP, preincSF, preincDF,
 
2704
+    preincXF, preincBI, postdecQI, postdecHI, postdecSI, postdecDI, postdecP,
 
2705
+    postdecSF, postdecDF, postdecXF, postdecBI, postincQI, postincHI,
 
2706
+    postincSI, postincDI, postincP, postincSF, postincDF, postincXF,
 
2707
+    postincBI, xjumpif, xjumpifnot, jump, jumpP, caseSI, caseSU, caseDI,
 
2708
+    caseDU, call, returnP, ret, linenote, LAST_AND_UNUSED_OPCODE
 
2709
+};
 
2710
+struct binary_operator
 
2711
+{
 
2712
+  enum bytecode_opcode opcode;
 
2713
+  enum typecode arg0;
 
2714
+};
 
2715
+static struct conversion_recipe
 
2716
+{
 
2717
+  unsigned char *opcodes;
 
2718
+  int cost;
 
2719
+}
 
2720
+conversion_recipe[((int) LAST_AND_UNUSED_TYPECODE)][((int)
 
2721
+                                                    LAST_AND_UNUSED_TYPECODE)];
 
2722
+static struct conversion_recipe
 
2723
+deduce_conversion (from, to)
 
2724
+     enum typecode from, to;
 
2725
+{
 
2726
+  (conversion_recipe[(int) from][(int) to].
 
2727
+   opcodes ? 0 : (conversion_recipe[(int) from][(int) to] =
 
2728
+                 deduce_conversion (from, to), 0));
 
2729
+}
 
2730
+
 
2731
+void
 
2732
+bc_expand_binary_operation (optab, resulttype, arg0, arg1)
 
2733
+     struct binary_operator optab[];
 
2734
+{
 
2735
+  int i, besti, cost, bestcost;
 
2736
+  enum typecode resultcode, arg0code;
 
2737
+  for (i = 0; optab[i].opcode != -1; ++i)
 
2738
+    {
 
2739
+      (conversion_recipe[(int) arg0code][(int) optab[i].arg0].
 
2740
+       opcodes ? 0 : (conversion_recipe[(int) arg0code][(int) optab[i].arg0] =
 
2741
+                     deduce_conversion (arg0code, optab[i].arg0), 0));
 
2742
+    }
 
2743
+}
 
2744
--- a/src/gcc/testsuite/gcc.target/powerpc/no-r11-1.c
 
2745
+++ b/src/gcc/testsuite/gcc.target/powerpc/no-r11-1.c
 
2746
@@ -1,5 +1,6 @@
 
2747
 /* { dg-do compile { target { powerpc*-*-* && lp64 } } } */
 
2748
 /* { dg-skip-if "" { *-*-darwin* } { "*" } { "" } } */
 
2749
+/* { dg-skip-if "" { powerpc_elfv2 } { "*" } { "" } } */
 
2750
 /* { dg-options "-O2 -mno-pointers-to-nested-functions" } */
 
2751
 
 
2752
 int
 
2753
--- a/src/gcc/testsuite/gcc.target/powerpc/p8vector-fp.c
 
2754
+++ b/src/gcc/testsuite/gcc.target/powerpc/p8vector-fp.c
 
2755
@@ -0,0 +1,139 @@
 
2756
+/* { dg-do compile { target { powerpc*-*-* } } } */
 
2757
+/* { dg-skip-if "" { powerpc*-*-darwin* } { "*" } { "" } } */
 
2758
+/* { dg-require-effective-target powerpc_p8vector_ok } */
 
2759
+/* { dg-options "-mcpu=power8 -O2 -mupper-regs-df -mupper-regs-sf -fno-math-errno" } */
 
2760
+
 
2761
+float abs_sf (float *p)
 
2762
+{
 
2763
+  float f = *p;
 
2764
+  __asm__ ("# reg %x0" : "+v" (f));
 
2765
+  return __builtin_fabsf (f);
 
2766
+}
 
2767
+
 
2768
+float nabs_sf (float *p)
 
2769
+{
 
2770
+  float f = *p;
 
2771
+  __asm__ ("# reg %x0" : "+v" (f));
 
2772
+  return - __builtin_fabsf (f);
 
2773
+}
 
2774
+
 
2775
+float neg_sf (float *p)
 
2776
+{
 
2777
+  float f = *p;
 
2778
+  __asm__ ("# reg %x0" : "+v" (f));
 
2779
+  return - f;
 
2780
+}
 
2781
+
 
2782
+float add_sf (float *p, float *q)
 
2783
+{
 
2784
+  float f1 = *p;
 
2785
+  float f2 = *q;
 
2786
+  __asm__ ("# reg %x0, %x1" : "+v" (f1), "+v" (f2));
 
2787
+  return f1 + f2;
 
2788
+}
 
2789
+
 
2790
+float sub_sf (float *p, float *q)
 
2791
+{
 
2792
+  float f1 = *p;
 
2793
+  float f2 = *q;
 
2794
+  __asm__ ("# reg %x0, %x1" : "+v" (f1), "+v" (f2));
 
2795
+  return f1 - f2;
 
2796
+}
 
2797
+
 
2798
+float mul_sf (float *p, float *q)
 
2799
+{
 
2800
+  float f1 = *p;
 
2801
+  float f2 = *q;
 
2802
+  __asm__ ("# reg %x0, %x1" : "+v" (f1), "+v" (f2));
 
2803
+  return f1 * f2;
 
2804
+}
 
2805
+
 
2806
+float div_sf (float *p, float *q)
 
2807
+{
 
2808
+  float f1 = *p;
 
2809
+  float f2 = *q;
 
2810
+  __asm__ ("# reg %x0, %x1" : "+v" (f1), "+v" (f2));
 
2811
+  return f1 / f2;
 
2812
+}
 
2813
+
 
2814
+float sqrt_sf (float *p)
 
2815
+{
 
2816
+  float f = *p;
 
2817
+  __asm__ ("# reg %x0" : "+v" (f));
 
2818
+  return __builtin_sqrtf (f);
 
2819
+}
 
2820
+
 
2821
+
 
2822
+double abs_df (double *p)
 
2823
+{
 
2824
+  double d = *p;
 
2825
+  __asm__ ("# reg %x0" : "+v" (d));
 
2826
+  return __builtin_fabs (d);
 
2827
+}
 
2828
+
 
2829
+double nabs_df (double *p)
 
2830
+{
 
2831
+  double d = *p;
 
2832
+  __asm__ ("# reg %x0" : "+v" (d));
 
2833
+  return - __builtin_fabs (d);
 
2834
+}
 
2835
+
 
2836
+double neg_df (double *p)
 
2837
+{
 
2838
+  double d = *p;
 
2839
+  __asm__ ("# reg %x0" : "+v" (d));
 
2840
+  return - d;
 
2841
+}
 
2842
+
 
2843
+double add_df (double *p, double *q)
 
2844
+{
 
2845
+  double d1 = *p;
 
2846
+  double d2 = *q;
 
2847
+  __asm__ ("# reg %x0, %x1" : "+v" (d1), "+v" (d2));
 
2848
+  return d1 + d2;
 
2849
+}
 
2850
+
 
2851
+double sub_df (double *p, double *q)
 
2852
+{
 
2853
+  double d1 = *p;
 
2854
+  double d2 = *q;
 
2855
+  __asm__ ("# reg %x0, %x1" : "+v" (d1), "+v" (d2));
 
2856
+  return d1 - d2;
 
2857
+}
 
2858
+
 
2859
+double mul_df (double *p, double *q)
 
2860
+{
 
2861
+  double d1 = *p;
 
2862
+  double d2 = *q;
 
2863
+  __asm__ ("# reg %x0, %x1" : "+v" (d1), "+v" (d2));
 
2864
+  return d1 * d2;
 
2865
+}
 
2866
+
 
2867
+double div_df (double *p, double *q)
 
2868
+{
 
2869
+  double d1 = *p;
 
2870
+  double d2 = *q;
 
2871
+  __asm__ ("# reg %x0, %x1" : "+v" (d1), "+v" (d2));
 
2872
+  return d1 / d2;
 
2873
+}
 
2874
+
 
2875
+double sqrt_df (float *p)
 
2876
+{
 
2877
+  double d = *p;
 
2878
+  __asm__ ("# reg %x0" : "+v" (d));
 
2879
+  return __builtin_sqrt (d);
 
2880
+}
 
2881
+
 
2882
+/* { dg-final { scan-assembler "xsabsdp"  } } */
 
2883
+/* { dg-final { scan-assembler "xsadddp"  } } */
 
2884
+/* { dg-final { scan-assembler "xsaddsp"  } } */
 
2885
+/* { dg-final { scan-assembler "xsdivdp"  } } */
 
2886
+/* { dg-final { scan-assembler "xsdivsp"  } } */
 
2887
+/* { dg-final { scan-assembler "xsmuldp"  } } */
 
2888
+/* { dg-final { scan-assembler "xsmulsp"  } } */
 
2889
+/* { dg-final { scan-assembler "xsnabsdp" } } */
 
2890
+/* { dg-final { scan-assembler "xsnegdp"  } } */
 
2891
+/* { dg-final { scan-assembler "xssqrtdp" } } */
 
2892
+/* { dg-final { scan-assembler "xssqrtsp" } } */
 
2893
+/* { dg-final { scan-assembler "xssubdp"  } } */
 
2894
+/* { dg-final { scan-assembler "xssubsp"  } } */
 
2895
--- a/src/gcc/testsuite/gcc.target/powerpc/direct-move-vint2.c
 
2896
+++ b/src/gcc/testsuite/gcc.target/powerpc/direct-move-vint2.c
 
2897
@@ -0,0 +1,13 @@
 
2898
+/* { dg-do run { target { powerpc*-*-linux* && lp64 } } } */
 
2899
+/* { dg-skip-if "" { powerpc*-*-darwin* } { "*" } { "" } } */
 
2900
+/* { dg-skip-if "" { powerpc*-*-*spe* } { "*" } { "" } } */
 
2901
+/* { dg-require-effective-target p8vector_hw } */
 
2902
+/* { dg-options "-mcpu=power8 -O2" } */
 
2903
+
 
2904
+/* Check whether we get the right bits for direct move at runtime.  */
 
2905
+
 
2906
+#define TYPE vector int
 
2907
+#define DO_MAIN
 
2908
+#define VSX_REG_ATTR "wa"
 
2909
+
 
2910
+#include "direct-move.h"
 
2911
--- a/src/gcc/testsuite/gcc.target/powerpc/bool3-p7.c
 
2912
+++ b/src/gcc/testsuite/gcc.target/powerpc/bool3-p7.c
 
2913
@@ -0,0 +1,37 @@
 
2914
+/* { dg-do compile { target { powerpc*-*-* && lp64 } } } */
 
2915
+/* { dg-skip-if "" { powerpc*-*-darwin* } { "*" } { "" } } */
 
2916
+/* { dg-require-effective-target powerpc_vsx_ok } */
 
2917
+/* { dg-options "-O2 -mcpu=power7" } */
 
2918
+/* { dg-final { scan-assembler    "\[ \t\]and "     } } */
 
2919
+/* { dg-final { scan-assembler    "\[ \t\]or "      } } */
 
2920
+/* { dg-final { scan-assembler    "\[ \t\]xor "     } } */
 
2921
+/* { dg-final { scan-assembler    "\[ \t\]nor "     } } */
 
2922
+/* { dg-final { scan-assembler    "\[ \t\]andc "    } } */
 
2923
+/* { dg-final { scan-assembler-not "\[ \t\]vand "    } } */
 
2924
+/* { dg-final { scan-assembler-not "\[ \t\]vandc "   } } */
 
2925
+/* { dg-final { scan-assembler-not "\[ \t\]vor "     } } */
 
2926
+/* { dg-final { scan-assembler-not "\[ \t\]vxor "    } } */
 
2927
+/* { dg-final { scan-assembler-not "\[ \t\]vnor "    } } */
 
2928
+/* { dg-final { scan-assembler-not "\[ \t\]xxland "  } } */
 
2929
+/* { dg-final { scan-assembler-not "\[ \t\]xxlor "   } } */
 
2930
+/* { dg-final { scan-assembler-not "\[ \t\]xxlxor "  } } */
 
2931
+/* { dg-final { scan-assembler-not "\[ \t\]xxlnor "  } } */
 
2932
+/* { dg-final { scan-assembler-not "\[ \t\]xxlandc " } } */
 
2933
+/* { dg-final { scan-assembler-not "\[ \t\]xxleqv "  } } */
 
2934
+/* { dg-final { scan-assembler-not "\[ \t\]xxlorc "  } } */
 
2935
+/* { dg-final { scan-assembler-not "\[ \t\]xxlnand " } } */
 
2936
+
 
2937
+/* On power7, for 128-bit types, ORC/ANDC/EQV might not show up, since the
 
2938
+   vector unit doesn't support these, so the appropriate combine patterns may
 
2939
+   not be generated.  */
 
2940
+
 
2941
+#ifndef TYPE
 
2942
+#ifdef _ARCH_PPC64
 
2943
+#define TYPE __int128_t
 
2944
+#else
 
2945
+typedef int v4si __attribute__ ((vector_size (16)));
 
2946
+#define TYPE v4si
 
2947
+#endif
 
2948
+#endif
 
2949
+
 
2950
+#include "bool3.h"
 
2951
--- a/src/gcc/testsuite/gcc.target/powerpc/p8vector-builtin-3.c
 
2952
+++ b/src/gcc/testsuite/gcc.target/powerpc/p8vector-builtin-3.c
 
2953
@@ -0,0 +1,104 @@
 
2954
+/* { dg-do compile { target { powerpc*-*-* } } } */
 
2955
+/* { dg-skip-if "" { powerpc*-*-darwin* } { "*" } { "" } } */
 
2956
+/* { dg-require-effective-target powerpc_p8vector_ok } */
 
2957
+/* { dg-options "-mcpu=power8 -O3 -ftree-vectorize -fvect-cost-model" } */
 
2958
+
 
2959
+#include <altivec.h>
 
2960
+
 
2961
+typedef vector long long               vll_sign;
 
2962
+typedef vector unsigned long long      vll_uns;
 
2963
+typedef vector bool long long          vll_bool;
 
2964
+
 
2965
+typedef vector int                     vi_sign;
 
2966
+typedef vector unsigned int            vi_uns;
 
2967
+typedef vector bool int                        vi_bool;
 
2968
+
 
2969
+typedef vector short                   vs_sign;
 
2970
+typedef vector unsigned short          vs_uns;
 
2971
+typedef vector bool short              vs_bool;
 
2972
+
 
2973
+typedef vector signed char             vc_sign;
 
2974
+typedef vector unsigned char           vc_uns;
 
2975
+typedef vector bool char               vc_bool;
 
2976
+
 
2977
+
 
2978
+vi_sign vi_pack_1 (vll_sign a, vll_sign b)
 
2979
+{
 
2980
+  return __builtin_altivec_vpkudum (a, b);
 
2981
+}
 
2982
+
 
2983
+vi_sign vi_pack_2 (vll_sign a, vll_sign b)
 
2984
+{
 
2985
+  return vec_pack (a, b);
 
2986
+}
 
2987
+
 
2988
+vi_sign vi_pack_3 (vll_sign a, vll_sign b)
 
2989
+{
 
2990
+  return vec_vpkudum (a, b);
 
2991
+}
 
2992
+
 
2993
+vs_sign vs_pack_1 (vi_sign a, vi_sign b)
 
2994
+{
 
2995
+  return __builtin_altivec_vpkuwum (a, b);
 
2996
+}
 
2997
+
 
2998
+vs_sign vs_pack_2 (vi_sign a, vi_sign b)
 
2999
+{
 
3000
+  return vec_pack (a, b);
 
3001
+}
 
3002
+
 
3003
+vs_sign vs_pack_3 (vi_sign a, vi_sign b)
 
3004
+{
 
3005
+  return vec_vpkuwum (a, b);
 
3006
+}
 
3007
+
 
3008
+vc_sign vc_pack_1 (vs_sign a, vs_sign b)
 
3009
+{
 
3010
+  return __builtin_altivec_vpkuhum (a, b);
 
3011
+}
 
3012
+
 
3013
+vc_sign vc_pack_2 (vs_sign a, vs_sign b)
 
3014
+{
 
3015
+  return vec_pack (a, b);
 
3016
+}
 
3017
+
 
3018
+vc_sign vc_pack_3 (vs_sign a, vs_sign b)
 
3019
+{
 
3020
+  return vec_vpkuhum (a, b);
 
3021
+}
 
3022
+
 
3023
+vll_sign vll_unpack_hi_1 (vi_sign a)
 
3024
+{
 
3025
+  return __builtin_altivec_vupkhsw (a);
 
3026
+}
 
3027
+
 
3028
+vll_sign vll_unpack_hi_2 (vi_sign a)
 
3029
+{
 
3030
+  return vec_unpackh (a);
 
3031
+}
 
3032
+
 
3033
+vll_sign vll_unpack_hi_3 (vi_sign a)
 
3034
+{
 
3035
+  return __builtin_vec_vupkhsw (a);
 
3036
+}
 
3037
+
 
3038
+vll_sign vll_unpack_lo_1 (vi_sign a)
 
3039
+{
 
3040
+  return vec_vupklsw (a);
 
3041
+}
 
3042
+
 
3043
+vll_sign vll_unpack_lo_2 (vi_sign a)
 
3044
+{
 
3045
+  return vec_unpackl (a);
 
3046
+}
 
3047
+
 
3048
+vll_sign vll_unpack_lo_3 (vi_sign a)
 
3049
+{
 
3050
+  return vec_vupklsw (a);
 
3051
+}
 
3052
+
 
3053
+/* { dg-final { scan-assembler-times "vpkudum" 3 } } */
 
3054
+/* { dg-final { scan-assembler-times "vpkuwum" 3 } } */
 
3055
+/* { dg-final { scan-assembler-times "vpkuhum" 3 } } */
 
3056
+/* { dg-final { scan-assembler-times "vupklsw" 3 } } */
 
3057
+/* { dg-final { scan-assembler-times "vupkhsw" 3 } } */
 
3058
--- a/src/gcc/testsuite/gcc.target/powerpc/p8vector-vectorize-3.c
 
3059
+++ b/src/gcc/testsuite/gcc.target/powerpc/p8vector-vectorize-3.c
 
3060
@@ -0,0 +1,29 @@
 
3061
+/* { dg-do compile { target { powerpc*-*-* } } } */
 
3062
+/* { dg-skip-if "" { powerpc*-*-darwin* } { "*" } { "" } } */
 
3063
+/* { dg-require-effective-target powerpc_p8vector_ok } */
 
3064
+/* { dg-options "-mcpu=power8 -O2 -ftree-vectorize -fvect-cost-model" } */
 
3065
+
 
3066
+#include <stddef.h>
 
3067
+
 
3068
+#ifndef SIZE
 
3069
+#define SIZE 1024
 
3070
+#endif
 
3071
+
 
3072
+#ifndef ALIGN
 
3073
+#define ALIGN 32
 
3074
+#endif
 
3075
+
 
3076
+#define ALIGN_ATTR __attribute__((__aligned__(ALIGN)))
 
3077
+
 
3078
+long long sign_ll[SIZE]        ALIGN_ATTR;
 
3079
+int      sign_i [SIZE] ALIGN_ATTR;
 
3080
+
 
3081
+void copy_long_long_to_int (void)
 
3082
+{
 
3083
+  size_t i;
 
3084
+
 
3085
+  for (i = 0; i < SIZE; i++)
 
3086
+    sign_i[i] = sign_ll[i];
 
3087
+}
 
3088
+
 
3089
+/* { dg-final { scan-assembler "vpkudum" } } */
 
3090
--- a/src/gcc/testsuite/gcc.target/powerpc/direct-move.h
 
3091
+++ b/src/gcc/testsuite/gcc.target/powerpc/direct-move.h
 
3092
@@ -0,0 +1,187 @@
 
3093
+/* Test functions for direct move support.  */
 
3094
+
 
3095
+
 
3096
+#ifndef VSX_REG_ATTR
 
3097
+#define VSX_REG_ATTR "wa"
 
3098
+#endif
 
3099
+
 
3100
+void __attribute__((__noinline__))
 
3101
+copy (TYPE *a, TYPE *b)
 
3102
+{
 
3103
+  *b = *a;
 
3104
+}
 
3105
+
 
3106
+#ifndef NO_GPR
 
3107
+void __attribute__((__noinline__))
 
3108
+load_gpr (TYPE *a, TYPE *b)
 
3109
+{
 
3110
+  TYPE c = *a;
 
3111
+  __asm__ ("# gpr, reg = %0" : "+b" (c));
 
3112
+  *b = c;
 
3113
+}
 
3114
+#endif
 
3115
+
 
3116
+#ifndef NO_FPR
 
3117
+void __attribute__((__noinline__))
 
3118
+load_fpr (TYPE *a, TYPE *b)
 
3119
+{
 
3120
+  TYPE c = *a;
 
3121
+  __asm__ ("# fpr, reg = %0" : "+d" (c));
 
3122
+  *b = c;
 
3123
+}
 
3124
+#endif
 
3125
+
 
3126
+#ifndef NO_ALTIVEC
 
3127
+void __attribute__((__noinline__))
 
3128
+load_altivec (TYPE *a, TYPE *b)
 
3129
+{
 
3130
+  TYPE c = *a;
 
3131
+  __asm__ ("# altivec, reg = %0" : "+v" (c));
 
3132
+  *b = c;
 
3133
+}
 
3134
+#endif
 
3135
+
 
3136
+#ifndef NO_VSX
 
3137
+void __attribute__((__noinline__))
 
3138
+load_vsx (TYPE *a, TYPE *b)
 
3139
+{
 
3140
+  TYPE c = *a;
 
3141
+  __asm__ ("# vsx, reg = %x0" : "+" VSX_REG_ATTR (c));
 
3142
+  *b = c;
 
3143
+}
 
3144
+#endif
 
3145
+
 
3146
+#ifndef NO_GPR_TO_VSX
 
3147
+void __attribute__((__noinline__))
 
3148
+load_gpr_to_vsx (TYPE *a, TYPE *b)
 
3149
+{
 
3150
+  TYPE c = *a;
 
3151
+  TYPE d;
 
3152
+  __asm__ ("# gpr, reg = %0" : "+b" (c));
 
3153
+  d = c;
 
3154
+  __asm__ ("# vsx, reg = %x0" : "+" VSX_REG_ATTR (d));
 
3155
+  *b = d;
 
3156
+}
 
3157
+#endif
 
3158
+
 
3159
+#ifndef NO_VSX_TO_GPR
 
3160
+void __attribute__((__noinline__))
 
3161
+load_vsx_to_gpr (TYPE *a, TYPE *b)
 
3162
+{
 
3163
+  TYPE c = *a;
 
3164
+  TYPE d;
 
3165
+  __asm__ ("# vsx, reg = %x0" : "+" VSX_REG_ATTR (c));
 
3166
+  d = c;
 
3167
+  __asm__ ("# gpr, reg = %0" : "+b" (d));
 
3168
+  *b = d;
 
3169
+}
 
3170
+#endif
 
3171
+
 
3172
+#ifdef DO_MAIN
 
3173
+typedef void (fn_type (TYPE *, TYPE *));
 
3174
+
 
3175
+struct test_struct {
 
3176
+  fn_type *func;
 
3177
+  const char *name;
 
3178
+};
 
3179
+
 
3180
+const struct test_struct test_functions[] = {
 
3181
+  { copy,              "copy"            },
 
3182
+#ifndef NO_GPR
 
3183
+  { load_gpr,          "load_gpr"        },
 
3184
+#endif
 
3185
+#ifndef NO_FPR
 
3186
+  { load_fpr,          "load_fpr"        },
 
3187
+#endif
 
3188
+#ifndef NO_ALTIVEC
 
3189
+  { load_altivec,      "load_altivec"    },
 
3190
+#endif
 
3191
+#ifndef NO_VSX
 
3192
+  { load_vsx,          "load_vsx"        },
 
3193
+#endif
 
3194
+#ifndef NO_GPR_TO_VSX
 
3195
+  { load_gpr_to_vsx,   "load_gpr_to_vsx" },
 
3196
+#endif
 
3197
+#ifndef NO_VSX_TO_GPR
 
3198
+  { load_vsx_to_gpr,   "load_vsx_to_gpr" },
 
3199
+#endif
 
3200
+};
 
3201
+
 
3202
+/* Test a given value for each of the functions.  */
 
3203
+void __attribute__((__noinline__))
 
3204
+test_value (TYPE a)
 
3205
+{
 
3206
+  size_t i;
 
3207
+
 
3208
+  for (i = 0; i < sizeof (test_functions) / sizeof (test_functions[0]); i++)
 
3209
+    {
 
3210
+      TYPE b;
 
3211
+
 
3212
+      test_functions[i].func (&a, &b);
 
3213
+      if (memcmp ((void *)&a, (void *)&b, sizeof (TYPE)) != 0)
 
3214
+       abort ();
 
3215
+    }
 
3216
+}
 
3217
+
 
3218
+/* Main program.  */
 
3219
+int
 
3220
+main (void)
 
3221
+{
 
3222
+  size_t i;
 
3223
+  long j;
 
3224
+  union {
 
3225
+    TYPE value;
 
3226
+    unsigned char bytes[sizeof (TYPE)];
 
3227
+  } u;
 
3228
+
 
3229
+#if IS_INT
 
3230
+  TYPE value = (TYPE)-5;
 
3231
+  for (i = 0; i < 12; i++)
 
3232
+    {
 
3233
+      test_value (value);
 
3234
+      value++;
 
3235
+    }
 
3236
+
 
3237
+  for (i = 0; i < 8*sizeof (TYPE); i++)
 
3238
+    test_value (((TYPE)1) << i);
 
3239
+
 
3240
+#elif IS_UNS
 
3241
+  TYPE value = (TYPE)0;
 
3242
+  for (i = 0; i < 10; i++)
 
3243
+    {
 
3244
+      test_value (value);
 
3245
+      test_value (~ value);
 
3246
+      value++;
 
3247
+    }
 
3248
+
 
3249
+  for (i = 0; i < 8*sizeof (TYPE); i++)
 
3250
+    test_value (((TYPE)1) << i);
 
3251
+
 
3252
+#elif IS_FLOAT
 
3253
+  TYPE value = (TYPE)-5;
 
3254
+  for (i = 0; i < 12; i++)
 
3255
+    {
 
3256
+      test_value (value);
 
3257
+      value++;
 
3258
+    }
 
3259
+
 
3260
+  test_value ((TYPE)3.1415926535);
 
3261
+  test_value ((TYPE)1.23456);
 
3262
+  test_value ((TYPE)(-0.0));
 
3263
+  test_value ((TYPE)NAN);
 
3264
+  test_value ((TYPE)+INFINITY);
 
3265
+  test_value ((TYPE)-INFINITY);
 
3266
+#else
 
3267
+
 
3268
+  for (j = 0; j < 10; j++)
 
3269
+    {
 
3270
+      for (i = 0; i < sizeof (TYPE); i++)
 
3271
+       u.bytes[i] = (unsigned char) (random () >> 4);
 
3272
+
 
3273
+      test_value (u.value);
 
3274
+    }
 
3275
+#endif
 
3276
+
 
3277
+  return 0;
 
3278
+}
 
3279
+#endif
 
3280
--- a/src/gcc/testsuite/gcc.target/powerpc/sd-vsx.c
 
3281
+++ b/src/gcc/testsuite/gcc.target/powerpc/sd-vsx.c
 
3282
@@ -0,0 +1,20 @@
 
3283
+/* { dg-do compile { target { powerpc*-*-* } } } */
 
3284
+/* { dg-skip-if "" { powerpc*-*-darwin* } { "*" } { "" } } */
 
3285
+/* { dg-require-effective-target powerpc_vsx_ok } */
 
3286
+/* { dg-options "-O2 -mcpu=power7 -mhard-dfp" } */
 
3287
+/* { dg-final { scan-assembler-times "lfiwzx" 2 } } */
 
3288
+/* { dg-final { scan-assembler-times "stfiwx" 1 } } */
 
3289
+/* { dg-final { scan-assembler-not   "lfd"      } } */
 
3290
+/* { dg-final { scan-assembler-not   "stfd"     } } */
 
3291
+/* { dg-final { scan-assembler-times "dctdp"  2 } } */
 
3292
+/* { dg-final { scan-assembler-times "dadd"   1 } } */
 
3293
+/* { dg-final { scan-assembler-times "drsp"   1 } } */
 
3294
+
 
3295
+/* Test that power7 can directly load/store SDmode variables without using a
 
3296
+   bounce buffer.  */
 
3297
+_Decimal32 a;
 
3298
+
 
3299
+void inc_dec32 (void)
 
3300
+{
 
3301
+  a += (_Decimal32) 1.0;
 
3302
+}
 
3303
--- a/src/gcc/testsuite/gcc.target/powerpc/pr58673-2.c
 
3304
+++ b/src/gcc/testsuite/gcc.target/powerpc/pr58673-2.c
 
3305
@@ -0,0 +1,217 @@
 
3306
+/* { dg-do compile { target { powerpc*-*-* && lp64 } } } */
 
3307
+/* { dg-skip-if "" { powerpc*-*-darwin* } { "*" } { "" } } */
 
3308
+/* { dg-require-effective-target powerpc_p8vector_ok } */
 
3309
+/* { dg-options "-mcpu=power8 -O3 -m64 -funroll-loops" } */
 
3310
+
 
3311
+#include <stddef.h>
 
3312
+#include <stdlib.h>
 
3313
+#include <math.h>
 
3314
+#include <string.h>
 
3315
+
 
3316
+typedef long unsigned int size_t;
 
3317
+typedef struct _IO_FILE FILE;
 
3318
+typedef float real;
 
3319
+typedef real rvec[3];
 
3320
+typedef real matrix[3][3];
 
3321
+typedef real tensor[3][3];
 
3322
+enum
 
3323
+{
 
3324
+  F_BONDS, F_G96BONDS, F_MORSE, F_CUBICBONDS, F_CONNBONDS, F_HARMONIC,
 
3325
+    F_ANGLES, F_G96ANGLES, F_PDIHS, F_RBDIHS, F_IDIHS, F_LJ14, F_COUL14, F_LJ,
 
3326
+    F_BHAM, F_LJLR, F_DISPCORR, F_SR, F_LR, F_WPOL, F_POSRES, F_DISRES,
 
3327
+    F_DISRESVIOL, F_ORIRES, F_ORIRESDEV, F_ANGRES, F_ANGRESZ, F_SHAKE,
 
3328
+    F_SHAKENC, F_SETTLE, F_DUMMY2, F_DUMMY3, F_DUMMY3FD, F_DUMMY3FAD,
 
3329
+    F_DUMMY3OUT, F_DUMMY4FD, F_EQM, F_EPOT, F_EKIN, F_ETOT, F_TEMP, F_PRES,
 
3330
+    F_DVDL, F_DVDLKIN, F_NRE
 
3331
+};
 
3332
+typedef union
 
3333
+{
 
3334
+  struct
 
3335
+  {
 
3336
+  }
 
3337
+  bham;
 
3338
+  struct
 
3339
+  {
 
3340
+    real rA, krA, rB, krB;
 
3341
+  }
 
3342
+  harmonic;
 
3343
+}
 
3344
+t_iparams;
 
3345
+typedef struct
 
3346
+{
 
3347
+  t_iparams *iparams;
 
3348
+}
 
3349
+t_idef;
 
3350
+typedef struct
 
3351
+{
 
3352
+}
 
3353
+t_inputrec;
 
3354
+typedef struct
 
3355
+{
 
3356
+}
 
3357
+t_commrec;
 
3358
+typedef struct
 
3359
+{
 
3360
+}
 
3361
+t_forcerec;
 
3362
+typedef struct
 
3363
+{
 
3364
+}
 
3365
+t_mdatoms;
 
3366
+typedef struct
 
3367
+{
 
3368
+}
 
3369
+t_filenm;
 
3370
+enum
 
3371
+{
 
3372
+  eoPres, eoEpot, eoVir, eoDist, eoMu, eoForce, eoFx, eoFy, eoFz, eoPx, eoPy,
 
3373
+    eoPz, eoPolarizability, eoDipole, eoObsNR, eoMemory =
 
3374
+    eoObsNR, eoInter, eoUseVirial, eoNR
 
3375
+};
 
3376
+extern char *eoNames[eoNR];
 
3377
+typedef struct
 
3378
+{
 
3379
+  int bPrint;
 
3380
+}
 
3381
+t_coupl_LJ;
 
3382
+typedef struct
 
3383
+{
 
3384
+  int eObs;
 
3385
+  t_iparams xi;
 
3386
+}
 
3387
+t_coupl_iparams;
 
3388
+typedef struct
 
3389
+{
 
3390
+  real act_value[eoObsNR];
 
3391
+  real av_value[eoObsNR];
 
3392
+  real ref_value[eoObsNR];
 
3393
+  int bObsUsed[eoObsNR];
 
3394
+  int nLJ, nBU, nQ, nIP;
 
3395
+  t_coupl_LJ *tcLJ;
 
3396
+}
 
3397
+t_coupl_rec;
 
3398
+static void
 
3399
+pr_ff (t_coupl_rec * tcr, real time, t_idef * idef, t_commrec * cr, int nfile,
 
3400
+       t_filenm fnm[])
 
3401
+{
 
3402
+  static FILE *prop;
 
3403
+  static FILE **out = ((void *) 0);
 
3404
+  static FILE **qq = ((void *) 0);
 
3405
+  static FILE **ip = ((void *) 0);
 
3406
+  char buf[256];
 
3407
+  char *leg[] = {
 
3408
+    "C12", "C6"
 
3409
+  };
 
3410
+  char **raleg;
 
3411
+  int i, j, index;
 
3412
+  if ((prop == ((void *) 0)) && (out == ((void *) 0)) && (qq == ((void *) 0))
 
3413
+      && (ip == ((void *) 0)))
 
3414
+    {
 
3415
+      for (i = j = 0; (i < eoObsNR); i++)
 
3416
+       {
 
3417
+         if (tcr->bObsUsed[i])
 
3418
+           {
 
3419
+             raleg[j++] =
 
3420
+               (__extension__
 
3421
+                (__builtin_constant_p (eoNames[i])
 
3422
+                 && ((size_t) (const void *) ((eoNames[i]) + 1) -
 
3423
+                     (size_t) (const void *) (eoNames[i]) ==
 
3424
+                     1) ? (((const char *) (eoNames[i]))[0] ==
 
3425
+                           '\0' ? (char *) calloc ((size_t) 1,
 
3426
+                                                   (size_t) 1) : (
 
3427
+                                                                          {
 
3428
+                                                                          size_t
 
3429
+                                                                          __len
 
3430
+                                                                          =
 
3431
+                                                                          strlen
 
3432
+                                                                          (eoNames
 
3433
+                                                                           [i])
 
3434
+                                                                          +
 
3435
+                                                                          1;
 
3436
+                                                                          char
 
3437
+                                                                          *__retval
 
3438
+                                                                          =
 
3439
+                                                                          (char
 
3440
+                                                                           *)
 
3441
+                                                                          malloc
 
3442
+                                                                          (__len);
 
3443
+                                                                          __retval;}
 
3444
+           )):     __strdup (eoNames[i])));
 
3445
+             raleg[j++] =
 
3446
+               (__extension__
 
3447
+                (__builtin_constant_p (buf)
 
3448
+                 && ((size_t) (const void *) ((buf) + 1) -
 
3449
+                     (size_t) (const void *) (buf) ==
 
3450
+                     1) ? (((const char *) (buf))[0] ==
 
3451
+                           '\0' ? (char *) calloc ((size_t) 1,
 
3452
+                                                   (size_t) 1) : (
 
3453
+                                                                          {
 
3454
+                                                                          size_t
 
3455
+                                                                          __len
 
3456
+                                                                          =
 
3457
+                                                                          strlen
 
3458
+                                                                          (buf)
 
3459
+                                                                          +
 
3460
+                                                                          1;
 
3461
+                                                                          char
 
3462
+                                                                          *__retval
 
3463
+                                                                          =
 
3464
+                                                                          (char
 
3465
+                                                                           *)
 
3466
+                                                                          malloc
 
3467
+                                                                          (__len);
 
3468
+                                                                          __retval;}
 
3469
+           )):     __strdup (buf)));
 
3470
+           }
 
3471
+       }
 
3472
+      if (tcr->nLJ)
 
3473
+       {
 
3474
+         for (i = 0; (i < tcr->nLJ); i++)
 
3475
+           {
 
3476
+             if (tcr->tcLJ[i].bPrint)
 
3477
+               {
 
3478
+                 xvgr_legend (out[i], (sizeof (leg) / sizeof ((leg)[0])),
 
3479
+                              leg);
 
3480
+               }
 
3481
+           }
 
3482
+       }
 
3483
+    }
 
3484
+}
 
3485
+
 
3486
+void
 
3487
+do_coupling (FILE * log, int nfile, t_filenm fnm[], t_coupl_rec * tcr, real t,
 
3488
+            int step, real ener[], t_forcerec * fr, t_inputrec * ir,
 
3489
+            int bMaster, t_mdatoms * md, t_idef * idef, real mu_aver,
 
3490
+            int nmols, t_commrec * cr, matrix box, tensor virial,
 
3491
+            tensor pres, rvec mu_tot, rvec x[], rvec f[], int bDoIt)
 
3492
+{
 
3493
+  int i, j, ati, atj, atnr2, type, ftype;
 
3494
+  real deviation[eoObsNR], prdev[eoObsNR], epot0, dist, rmsf;
 
3495
+  real ff6, ff12, ffa, ffb, ffc, ffq, factor, dt, mu_ind;
 
3496
+  int bTest, bPrint;
 
3497
+  t_coupl_iparams *tip;
 
3498
+  if (bPrint)
 
3499
+    {
 
3500
+      pr_ff (tcr, t, idef, cr, nfile, fnm);
 
3501
+    }
 
3502
+  for (i = 0; (i < eoObsNR); i++)
 
3503
+    {
 
3504
+      deviation[i] =
 
3505
+       calc_deviation (tcr->av_value[i], tcr->act_value[i],
 
3506
+                       tcr->ref_value[i]);
 
3507
+      prdev[i] = tcr->ref_value[i] - tcr->act_value[i];
 
3508
+    }
 
3509
+  if (bPrint)
 
3510
+    pr_dev (tcr, t, prdev, cr, nfile, fnm);
 
3511
+  for (i = 0; (i < atnr2); i++)
 
3512
+    {
 
3513
+      factor = dt * deviation[tip->eObs];
 
3514
+      switch (ftype)
 
3515
+       {
 
3516
+       case F_BONDS:
 
3517
+         if (fabs (tip->xi.harmonic.krA) > 1.2e-38)
 
3518
+           idef->iparams[type].harmonic.krA *=
 
3519
+             (1 + factor / tip->xi.harmonic.krA);
 
3520
+       }
 
3521
+    }
 
3522
+}
 
3523
--- a/src/gcc/testsuite/gcc.target/powerpc/atomic-p7.c
 
3524
+++ b/src/gcc/testsuite/gcc.target/powerpc/atomic-p7.c
 
3525
@@ -0,0 +1,207 @@
 
3526
+/* { dg-do compile { target { powerpc*-*-* && lp64 } } } */
 
3527
+/* { dg-skip-if "" { powerpc*-*-darwin* } { "*" } { "" } } */
 
3528
+/* { dg-require-effective-target powerpc_vsx_ok } */
 
3529
+/* { dg-options "-mcpu=power7 -O2" } */
 
3530
+/* { dg-final { scan-assembler-not "lbarx" } } */
 
3531
+/* { dg-final { scan-assembler-not "lharx" } } */
 
3532
+/* { dg-final { scan-assembler-times "lwarx" 18 } } */
 
3533
+/* { dg-final { scan-assembler-times "ldarx" 6 } } */
 
3534
+/* { dg-final { scan-assembler-not "lqarx" } } */
 
3535
+/* { dg-final { scan-assembler-not "stbcx" } } */
 
3536
+/* { dg-final { scan-assembler-not "sthcx" } } */
 
3537
+/* { dg-final { scan-assembler-times "stwcx" 18 } } */
 
3538
+/* { dg-final { scan-assembler-times "stdcx" 6 } } */
 
3539
+/* { dg-final { scan-assembler-not "stqcx" } } */
 
3540
+/* { dg-final { scan-assembler-times "bl __atomic" 6 } } */
 
3541
+/* { dg-final { scan-assembler-times "isync" 12 } } */
 
3542
+/* { dg-final { scan-assembler-times "lwsync" 8 } } */
 
3543
+/* { dg-final { scan-assembler-not "mtvsrd" } } */
 
3544
+/* { dg-final { scan-assembler-not "mtvsrwa" } } */
 
3545
+/* { dg-final { scan-assembler-not "mtvsrwz" } } */
 
3546
+/* { dg-final { scan-assembler-not "mfvsrd" } } */
 
3547
+/* { dg-final { scan-assembler-not "mfvsrwz" } } */
 
3548
+
 
3549
+/* Test for the byte atomic operations on power8 using lbarx/stbcx.  */
 
3550
+char
 
3551
+char_fetch_add_relaxed (char *ptr, int value)
 
3552
+{
 
3553
+  return __atomic_fetch_add (ptr, value, __ATOMIC_RELAXED);
 
3554
+}
 
3555
+
 
3556
+char
 
3557
+char_fetch_sub_consume (char *ptr, int value)
 
3558
+{
 
3559
+  return __atomic_fetch_sub (ptr, value, __ATOMIC_CONSUME);
 
3560
+}
 
3561
+
 
3562
+char
 
3563
+char_fetch_and_acquire (char *ptr, int value)
 
3564
+{
 
3565
+  return __atomic_fetch_and (ptr, value, __ATOMIC_ACQUIRE);
 
3566
+}
 
3567
+
 
3568
+char
 
3569
+char_fetch_ior_release (char *ptr, int value)
 
3570
+{
 
3571
+  return __atomic_fetch_or (ptr, value, __ATOMIC_RELEASE);
 
3572
+}
 
3573
+
 
3574
+char
 
3575
+char_fetch_xor_acq_rel (char *ptr, int value)
 
3576
+{
 
3577
+  return __atomic_fetch_xor (ptr, value, __ATOMIC_ACQ_REL);
 
3578
+}
 
3579
+
 
3580
+char
 
3581
+char_fetch_nand_seq_cst (char *ptr, int value)
 
3582
+{
 
3583
+  return __atomic_fetch_nand (ptr, value, __ATOMIC_SEQ_CST);
 
3584
+}
 
3585
+
 
3586
+/* Test for the half word atomic operations on power8 using lharx/sthcx.  */
 
3587
+short
 
3588
+short_fetch_add_relaxed (short *ptr, int value)
 
3589
+{
 
3590
+  return __atomic_fetch_add (ptr, value, __ATOMIC_RELAXED);
 
3591
+}
 
3592
+
 
3593
+short
 
3594
+short_fetch_sub_consume (short *ptr, int value)
 
3595
+{
 
3596
+  return __atomic_fetch_sub (ptr, value, __ATOMIC_CONSUME);
 
3597
+}
 
3598
+
 
3599
+short
 
3600
+short_fetch_and_acquire (short *ptr, int value)
 
3601
+{
 
3602
+  return __atomic_fetch_and (ptr, value, __ATOMIC_ACQUIRE);
 
3603
+}
 
3604
+
 
3605
+short
 
3606
+short_fetch_ior_release (short *ptr, int value)
 
3607
+{
 
3608
+  return __atomic_fetch_or (ptr, value, __ATOMIC_RELEASE);
 
3609
+}
 
3610
+
 
3611
+short
 
3612
+short_fetch_xor_acq_rel (short *ptr, int value)
 
3613
+{
 
3614
+  return __atomic_fetch_xor (ptr, value, __ATOMIC_ACQ_REL);
 
3615
+}
 
3616
+
 
3617
+short
 
3618
+short_fetch_nand_seq_cst (short *ptr, int value)
 
3619
+{
 
3620
+  return __atomic_fetch_nand (ptr, value, __ATOMIC_SEQ_CST);
 
3621
+}
 
3622
+
 
3623
+/* Test for the word atomic operations on power8 using lwarx/stwcx.  */
 
3624
+int
 
3625
+int_fetch_add_relaxed (int *ptr, int value)
 
3626
+{
 
3627
+  return __atomic_fetch_add (ptr, value, __ATOMIC_RELAXED);
 
3628
+}
 
3629
+
 
3630
+int
 
3631
+int_fetch_sub_consume (int *ptr, int value)
 
3632
+{
 
3633
+  return __atomic_fetch_sub (ptr, value, __ATOMIC_CONSUME);
 
3634
+}
 
3635
+
 
3636
+int
 
3637
+int_fetch_and_acquire (int *ptr, int value)
 
3638
+{
 
3639
+  return __atomic_fetch_and (ptr, value, __ATOMIC_ACQUIRE);
 
3640
+}
 
3641
+
 
3642
+int
 
3643
+int_fetch_ior_release (int *ptr, int value)
 
3644
+{
 
3645
+  return __atomic_fetch_or (ptr, value, __ATOMIC_RELEASE);
 
3646
+}
 
3647
+
 
3648
+int
 
3649
+int_fetch_xor_acq_rel (int *ptr, int value)
 
3650
+{
 
3651
+  return __atomic_fetch_xor (ptr, value, __ATOMIC_ACQ_REL);
 
3652
+}
 
3653
+
 
3654
+int
 
3655
+int_fetch_nand_seq_cst (int *ptr, int value)
 
3656
+{
 
3657
+  return __atomic_fetch_nand (ptr, value, __ATOMIC_SEQ_CST);
 
3658
+}
 
3659
+
 
3660
+/* Test for the double word atomic operations on power8 using ldarx/stdcx.  */
 
3661
+long
 
3662
+long_fetch_add_relaxed (long *ptr, long value)
 
3663
+{
 
3664
+  return __atomic_fetch_add (ptr, value, __ATOMIC_RELAXED);
 
3665
+}
 
3666
+
 
3667
+long
 
3668
+long_fetch_sub_consume (long *ptr, long value)
 
3669
+{
 
3670
+  return __atomic_fetch_sub (ptr, value, __ATOMIC_CONSUME);
 
3671
+}
 
3672
+
 
3673
+long
 
3674
+long_fetch_and_acquire (long *ptr, long value)
 
3675
+{
 
3676
+  return __atomic_fetch_and (ptr, value, __ATOMIC_ACQUIRE);
 
3677
+}
 
3678
+
 
3679
+long
 
3680
+long_fetch_ior_release (long *ptr, long value)
 
3681
+{
 
3682
+  return __atomic_fetch_or (ptr, value, __ATOMIC_RELEASE);
 
3683
+}
 
3684
+
 
3685
+long
 
3686
+long_fetch_xor_acq_rel (long *ptr, long value)
 
3687
+{
 
3688
+  return __atomic_fetch_xor (ptr, value, __ATOMIC_ACQ_REL);
 
3689
+}
 
3690
+
 
3691
+long
 
3692
+long_fetch_nand_seq_cst (long *ptr, long value)
 
3693
+{
 
3694
+  return __atomic_fetch_nand (ptr, value, __ATOMIC_SEQ_CST);
 
3695
+}
 
3696
+
 
3697
+/* Test for the quad word atomic operations on power8 using ldarx/stdcx.  */
 
3698
+__int128_t
 
3699
+quad_fetch_add_relaxed (__int128_t *ptr, __int128_t value)
 
3700
+{
 
3701
+  return __atomic_fetch_add (ptr, value, __ATOMIC_RELAXED);
 
3702
+}
 
3703
+
 
3704
+__int128_t
 
3705
+quad_fetch_sub_consume (__int128_t *ptr, __int128_t value)
 
3706
+{
 
3707
+  return __atomic_fetch_sub (ptr, value, __ATOMIC_CONSUME);
 
3708
+}
 
3709
+
 
3710
+__int128_t
 
3711
+quad_fetch_and_acquire (__int128_t *ptr, __int128_t value)
 
3712
+{
 
3713
+  return __atomic_fetch_and (ptr, value, __ATOMIC_ACQUIRE);
 
3714
+}
 
3715
+
 
3716
+__int128_t
 
3717
+quad_fetch_ior_release (__int128_t *ptr, __int128_t value)
 
3718
+{
 
3719
+  return __atomic_fetch_or (ptr, value, __ATOMIC_RELEASE);
 
3720
+}
 
3721
+
 
3722
+__int128_t
 
3723
+quad_fetch_xor_acq_rel (__int128_t *ptr, __int128_t value)
 
3724
+{
 
3725
+  return __atomic_fetch_xor (ptr, value, __ATOMIC_ACQ_REL);
 
3726
+}
 
3727
+
 
3728
+__int128_t
 
3729
+quad_fetch_nand_seq_cst (__int128_t *ptr, __int128_t value)
 
3730
+{
 
3731
+  return __atomic_fetch_nand (ptr, value, __ATOMIC_SEQ_CST);
 
3732
+}
 
3733
--- a/src/gcc/testsuite/gcc.target/powerpc/recip-3.c
 
3734
+++ b/src/gcc/testsuite/gcc.target/powerpc/recip-3.c
 
3735
@@ -1,14 +1,14 @@
 
3736
 /* { dg-do compile { target { { powerpc*-*-* } && { ! powerpc*-apple-darwin* } } } } */
 
3737
 /* { dg-require-effective-target powerpc_fprs } */
 
3738
 /* { dg-options "-O2 -mrecip -ffast-math -mcpu=power7" } */
 
3739
-/* { dg-final { scan-assembler-times "xsrsqrtedp" 1 } } */
 
3740
+/* { dg-final { scan-assembler-times "xsrsqrtedp\|frsqrte\ " 1 } } */
 
3741
 /* { dg-final { scan-assembler-times "xsmsub.dp\|fmsub\ " 1 } } */
 
3742
-/* { dg-final { scan-assembler-times "xsmuldp" 4 } } */
 
3743
+/* { dg-final { scan-assembler-times "xsmuldp\|fmul\ " 4 } } */
 
3744
 /* { dg-final { scan-assembler-times "xsnmsub.dp\|fnmsub\ " 2 } } */
 
3745
-/* { dg-final { scan-assembler-times "frsqrtes" 1 } } */
 
3746
-/* { dg-final { scan-assembler-times "fmsubs" 1 } } */
 
3747
-/* { dg-final { scan-assembler-times "fmuls" 4 } } */
 
3748
-/* { dg-final { scan-assembler-times "fnmsubs" 2 } } */
 
3749
+/* { dg-final { scan-assembler-times "xsrsqrtesp\|frsqrtes" 1 } } */
 
3750
+/* { dg-final { scan-assembler-times "xsmsub.sp\|fmsubs" 1 } } */
 
3751
+/* { dg-final { scan-assembler-times "xsmulsp\|fmuls" 2 } } */
 
3752
+/* { dg-final { scan-assembler-times "xsnmsub.sp\|fnmsubs" 1 } } */
 
3753
 
 
3754
 double
 
3755
 rsqrt_d (double a)
 
3756
--- a/src/gcc/testsuite/gcc.target/powerpc/no-r11-2.c
 
3757
+++ b/src/gcc/testsuite/gcc.target/powerpc/no-r11-2.c
 
3758
@@ -1,5 +1,6 @@
 
3759
 /* { dg-do compile { target { powerpc*-*-* && lp64 } } } */
 
3760
 /* { dg-skip-if "" { *-*-darwin* } { "*" } { "" } } */
 
3761
+/* { dg-skip-if "" { powerpc_elfv2 } { "*" } { "" } } */
 
3762
 /* { dg-options "-O2 -mpointers-to-nested-functions" } */
 
3763
 
 
3764
 int
 
3765
--- a/src/gcc/testsuite/gcc.target/powerpc/p8vector-ldst.c
 
3766
+++ b/src/gcc/testsuite/gcc.target/powerpc/p8vector-ldst.c
 
3767
@@ -0,0 +1,42 @@
 
3768
+/* { dg-do compile { target { powerpc*-*-* } } } */
 
3769
+/* { dg-skip-if "" { powerpc*-*-darwin* } { "*" } { "" } } */
 
3770
+/* { dg-require-effective-target powerpc_p8vector_ok } */
 
3771
+/* { dg-options "-mcpu=power8 -O2 -mupper-regs-df -mupper-regs-sf" } */
 
3772
+
 
3773
+float load_sf (float *p)
 
3774
+{
 
3775
+  float f = *p;
 
3776
+  __asm__ ("# reg %x0" : "+v" (f));
 
3777
+  return f;
 
3778
+}
 
3779
+
 
3780
+double load_df (double *p)
 
3781
+{
 
3782
+  double d = *p;
 
3783
+  __asm__ ("# reg %x0" : "+v" (d));
 
3784
+  return d;
 
3785
+}
 
3786
+
 
3787
+double load_dfsf (float *p)
 
3788
+{
 
3789
+  double d = (double) *p;
 
3790
+  __asm__ ("# reg %x0" : "+v" (d));
 
3791
+  return d;
 
3792
+}
 
3793
+
 
3794
+void store_sf (float *p, float f)
 
3795
+{
 
3796
+  __asm__ ("# reg %x0" : "+v" (f));
 
3797
+  *p = f;
 
3798
+}
 
3799
+
 
3800
+void store_df (double *p, double d)
 
3801
+{
 
3802
+  __asm__ ("# reg %x0" : "+v" (d));
 
3803
+  *p = d;
 
3804
+}
 
3805
+
 
3806
+/* { dg-final { scan-assembler "lxsspx"  } } */
 
3807
+/* { dg-final { scan-assembler "lxsdx"   } } */
 
3808
+/* { dg-final { scan-assembler "stxsspx" } } */
 
3809
+/* { dg-final { scan-assembler "stxsdx"  } } */
 
3810
--- a/src/gcc/testsuite/gcc.target/powerpc/bool3-p8.c
 
3811
+++ b/src/gcc/testsuite/gcc.target/powerpc/bool3-p8.c
 
3812
@@ -0,0 +1,36 @@
 
3813
+/* { dg-do compile { target { powerpc*-*-* && lp64 } } } */
 
3814
+/* { dg-skip-if "" { powerpc*-*-darwin* } { "*" } { "" } } */
 
3815
+/* { dg-require-effective-target powerpc_p8vector_ok } */
 
3816
+/* { dg-options "-O2 -mcpu=power8" } */
 
3817
+/* { dg-final { scan-assembler    "\[ \t\]and "     } } */
 
3818
+/* { dg-final { scan-assembler    "\[ \t\]or "      } } */
 
3819
+/* { dg-final { scan-assembler    "\[ \t\]xor "     } } */
 
3820
+/* { dg-final { scan-assembler    "\[ \t\]nor "     } } */
 
3821
+/* { dg-final { scan-assembler    "\[ \t\]andc "    } } */
 
3822
+/* { dg-final { scan-assembler    "\[ \t\]eqv "     } } */
 
3823
+/* { dg-final { scan-assembler    "\[ \t\]orc "     } } */
 
3824
+/* { dg-final { scan-assembler    "\[ \t\]nand "    } } */
 
3825
+/* { dg-final { scan-assembler-not "\[ \t\]vand "    } } */
 
3826
+/* { dg-final { scan-assembler-not "\[ \t\]vandc "   } } */
 
3827
+/* { dg-final { scan-assembler-not "\[ \t\]vor "     } } */
 
3828
+/* { dg-final { scan-assembler-not "\[ \t\]vxor "    } } */
 
3829
+/* { dg-final { scan-assembler-not "\[ \t\]vnor "    } } */
 
3830
+/* { dg-final { scan-assembler-not "\[ \t\]xxland "  } } */
 
3831
+/* { dg-final { scan-assembler-not "\[ \t\]xxlor "   } } */
 
3832
+/* { dg-final { scan-assembler-not "\[ \t\]xxlxor "  } } */
 
3833
+/* { dg-final { scan-assembler-not "\[ \t\]xxlnor "  } } */
 
3834
+/* { dg-final { scan-assembler-not "\[ \t\]xxlandc " } } */
 
3835
+/* { dg-final { scan-assembler-not "\[ \t\]xxleqv "  } } */
 
3836
+/* { dg-final { scan-assembler-not "\[ \t\]xxlorc "  } } */
 
3837
+/* { dg-final { scan-assembler-not "\[ \t\]xxlnand " } } */
 
3838
+
 
3839
+#ifndef TYPE
 
3840
+#ifdef _ARCH_PPC64
 
3841
+#define TYPE __int128_t
 
3842
+#else
 
3843
+typedef int v4si __attribute__ ((vector_size (16)));
 
3844
+#define TYPE v4si
 
3845
+#endif
 
3846
+#endif
 
3847
+
 
3848
+#include "bool3.h"
 
3849
--- a/src/gcc/testsuite/gcc.target/powerpc/htm-xl-intrin-1.c
 
3850
+++ b/src/gcc/testsuite/gcc.target/powerpc/htm-xl-intrin-1.c
 
3851
@@ -0,0 +1,32 @@
 
3852
+/* This checks the availability of the XL compiler intrinsics for
 
3853
+   transactional execution with the expected prototypes.  */
 
3854
+
 
3855
+/* { dg-do compile { target { powerpc*-*-* } } } */
 
3856
+/* { dg-skip-if "" { powerpc*-*-darwin* } { "*" } { "" } } */
 
3857
+/* { dg-require-effective-target powerpc_htm_ok } */
 
3858
+/* { dg-options "-O2 -mhtm" } */
 
3859
+
 
3860
+#include <htmxlintrin.h>
 
3861
+
 
3862
+void
 
3863
+foo (void *TM_buff, long *result, unsigned char *code)
 
3864
+{
 
3865
+  *result++ = __TM_simple_begin ();
 
3866
+  *result++ = __TM_begin (TM_buff);
 
3867
+  *result++ = __TM_end ();
 
3868
+  __TM_abort ();
 
3869
+  __TM_named_abort (*code);
 
3870
+  __TM_resume ();
 
3871
+  __TM_suspend ();
 
3872
+  *result++ = __TM_is_user_abort (TM_buff);
 
3873
+  *result++ = __TM_is_named_user_abort (TM_buff, code);
 
3874
+  *result++ = __TM_is_illegal (TM_buff);
 
3875
+  *result++ = __TM_is_footprint_exceeded (TM_buff);
 
3876
+  *result++ = __TM_nesting_depth (TM_buff);
 
3877
+  *result++ = __TM_is_nested_too_deep (TM_buff);
 
3878
+  *result++ = __TM_is_conflict (TM_buff);
 
3879
+  *result++ = __TM_is_failure_persistent (TM_buff);
 
3880
+  *result++ = __TM_failure_address (TM_buff);
 
3881
+  *result++ = __TM_failure_code (TM_buff);
 
3882
+}
 
3883
+
 
3884
--- a/src/gcc/testsuite/gcc.target/powerpc/p8vector-builtin-4.c
 
3885
+++ b/src/gcc/testsuite/gcc.target/powerpc/p8vector-builtin-4.c
 
3886
@@ -0,0 +1,249 @@
 
3887
+/* { dg-do compile { target { powerpc*-*-* } } } */
 
3888
+/* { dg-skip-if "" { powerpc*-*-darwin* } { "*" } { "" } } */
 
3889
+/* { dg-require-effective-target powerpc_p8vector_ok } */
 
3890
+/* { dg-options "-mcpu=power8 -O3 -ftree-vectorize -fvect-cost-model" } */
 
3891
+
 
3892
+#include <altivec.h>
 
3893
+
 
3894
+typedef vector long long               vll_sign;
 
3895
+typedef vector unsigned long long      vll_uns;
 
3896
+typedef vector bool long long          vll_bool;
 
3897
+
 
3898
+typedef vector int                     vi_sign;
 
3899
+typedef vector unsigned int            vi_uns;
 
3900
+typedef vector bool int                        vi_bool;
 
3901
+
 
3902
+typedef vector short                   vs_sign;
 
3903
+typedef vector unsigned short          vs_uns;
 
3904
+typedef vector bool short              vs_bool;
 
3905
+
 
3906
+typedef vector signed char             vc_sign;
 
3907
+typedef vector unsigned char           vc_uns;
 
3908
+typedef vector bool char               vc_bool;
 
3909
+
 
3910
+vll_sign vll_clz_1 (vll_sign a)
 
3911
+{
 
3912
+  return __builtin_altivec_vclzd (a);
 
3913
+}
 
3914
+
 
3915
+vll_sign vll_clz_2 (vll_sign a)
 
3916
+{
 
3917
+  return vec_vclz (a);
 
3918
+}
 
3919
+
 
3920
+vll_sign vll_clz_3 (vll_sign a)
 
3921
+{
 
3922
+  return vec_vclzd (a);
 
3923
+}
 
3924
+
 
3925
+vll_uns vll_clz_4 (vll_uns a)
 
3926
+{
 
3927
+  return vec_vclz (a);
 
3928
+}
 
3929
+
 
3930
+vll_uns vll_clz_5 (vll_uns a)
 
3931
+{
 
3932
+  return vec_vclzd (a);
 
3933
+}
 
3934
+
 
3935
+vi_sign vi_clz_1 (vi_sign a)
 
3936
+{
 
3937
+  return __builtin_altivec_vclzw (a);
 
3938
+}
 
3939
+
 
3940
+vi_sign vi_clz_2 (vi_sign a)
 
3941
+{
 
3942
+  return vec_vclz (a);
 
3943
+}
 
3944
+
 
3945
+vi_sign vi_clz_3 (vi_sign a)
 
3946
+{
 
3947
+  return vec_vclzw (a);
 
3948
+}
 
3949
+
 
3950
+vi_uns vi_clz_4 (vi_uns a)
 
3951
+{
 
3952
+  return vec_vclz (a);
 
3953
+}
 
3954
+
 
3955
+vi_uns vi_clz_5 (vi_uns a)
 
3956
+{
 
3957
+  return vec_vclzw (a);
 
3958
+}
 
3959
+
 
3960
+vs_sign vs_clz_1 (vs_sign a)
 
3961
+{
 
3962
+  return __builtin_altivec_vclzh (a);
 
3963
+}
 
3964
+
 
3965
+vs_sign vs_clz_2 (vs_sign a)
 
3966
+{
 
3967
+  return vec_vclz (a);
 
3968
+}
 
3969
+
 
3970
+vs_sign vs_clz_3 (vs_sign a)
 
3971
+{
 
3972
+  return vec_vclzh (a);
 
3973
+}
 
3974
+
 
3975
+vs_uns vs_clz_4 (vs_uns a)
 
3976
+{
 
3977
+  return vec_vclz (a);
 
3978
+}
 
3979
+
 
3980
+vs_uns vs_clz_5 (vs_uns a)
 
3981
+{
 
3982
+  return vec_vclzh (a);
 
3983
+}
 
3984
+
 
3985
+vc_sign vc_clz_1 (vc_sign a)
 
3986
+{
 
3987
+  return __builtin_altivec_vclzb (a);
 
3988
+}
 
3989
+
 
3990
+vc_sign vc_clz_2 (vc_sign a)
 
3991
+{
 
3992
+  return vec_vclz (a);
 
3993
+}
 
3994
+
 
3995
+vc_sign vc_clz_3 (vc_sign a)
 
3996
+{
 
3997
+  return vec_vclzb (a);
 
3998
+}
 
3999
+
 
4000
+vc_uns vc_clz_4 (vc_uns a)
 
4001
+{
 
4002
+  return vec_vclz (a);
 
4003
+}
 
4004
+
 
4005
+vc_uns vc_clz_5 (vc_uns a)
 
4006
+{
 
4007
+  return vec_vclzb (a);
 
4008
+}
 
4009
+
 
4010
+vll_sign vll_popcnt_1 (vll_sign a)
 
4011
+{
 
4012
+  return __builtin_altivec_vpopcntd (a);
 
4013
+}
 
4014
+
 
4015
+vll_sign vll_popcnt_2 (vll_sign a)
 
4016
+{
 
4017
+  return vec_vpopcnt (a);
 
4018
+}
 
4019
+
 
4020
+vll_sign vll_popcnt_3 (vll_sign a)
 
4021
+{
 
4022
+  return vec_vpopcntd (a);
 
4023
+}
 
4024
+
 
4025
+vll_uns vll_popcnt_4 (vll_uns a)
 
4026
+{
 
4027
+  return vec_vpopcnt (a);
 
4028
+}
 
4029
+
 
4030
+vll_uns vll_popcnt_5 (vll_uns a)
 
4031
+{
 
4032
+  return vec_vpopcntd (a);
 
4033
+}
 
4034
+
 
4035
+vi_sign vi_popcnt_1 (vi_sign a)
 
4036
+{
 
4037
+  return __builtin_altivec_vpopcntw (a);
 
4038
+}
 
4039
+
 
4040
+vi_sign vi_popcnt_2 (vi_sign a)
 
4041
+{
 
4042
+  return vec_vpopcnt (a);
 
4043
+}
 
4044
+
 
4045
+vi_sign vi_popcnt_3 (vi_sign a)
 
4046
+{
 
4047
+  return vec_vpopcntw (a);
 
4048
+}
 
4049
+
 
4050
+vi_uns vi_popcnt_4 (vi_uns a)
 
4051
+{
 
4052
+  return vec_vpopcnt (a);
 
4053
+}
 
4054
+
 
4055
+vi_uns vi_popcnt_5 (vi_uns a)
 
4056
+{
 
4057
+  return vec_vpopcntw (a);
 
4058
+}
 
4059
+
 
4060
+vs_sign vs_popcnt_1 (vs_sign a)
 
4061
+{
 
4062
+  return __builtin_altivec_vpopcnth (a);
 
4063
+}
 
4064
+
 
4065
+vs_sign vs_popcnt_2 (vs_sign a)
 
4066
+{
 
4067
+  return vec_vpopcnt (a);
 
4068
+}
 
4069
+
 
4070
+vs_sign vs_popcnt_3 (vs_sign a)
 
4071
+{
 
4072
+  return vec_vpopcnth (a);
 
4073
+}
 
4074
+
 
4075
+vs_uns vs_popcnt_4 (vs_uns a)
 
4076
+{
 
4077
+  return vec_vpopcnt (a);
 
4078
+}
 
4079
+
 
4080
+vs_uns vs_popcnt_5 (vs_uns a)
 
4081
+{
 
4082
+  return vec_vpopcnth (a);
 
4083
+}
 
4084
+
 
4085
+vc_sign vc_popcnt_1 (vc_sign a)
 
4086
+{
 
4087
+  return __builtin_altivec_vpopcntb (a);
 
4088
+}
 
4089
+
 
4090
+vc_sign vc_popcnt_2 (vc_sign a)
 
4091
+{
 
4092
+  return vec_vpopcnt (a);
 
4093
+}
 
4094
+
 
4095
+vc_sign vc_popcnt_3 (vc_sign a)
 
4096
+{
 
4097
+  return vec_vpopcntb (a);
 
4098
+}
 
4099
+
 
4100
+vc_uns vc_popcnt_4 (vc_uns a)
 
4101
+{
 
4102
+  return vec_vpopcnt (a);
 
4103
+}
 
4104
+
 
4105
+vc_uns vc_popcnt_5 (vc_uns a)
 
4106
+{
 
4107
+  return vec_vpopcntb (a);
 
4108
+}
 
4109
+
 
4110
+vc_uns vc_gbb_1 (vc_uns a)
 
4111
+{
 
4112
+  return __builtin_altivec_vgbbd (a);
 
4113
+}
 
4114
+
 
4115
+vc_sign vc_gbb_2 (vc_sign a)
 
4116
+{
 
4117
+  return vec_vgbbd (a);
 
4118
+}
 
4119
+
 
4120
+vc_uns vc_gbb_3 (vc_uns a)
 
4121
+{
 
4122
+  return vec_vgbbd (a);
 
4123
+}
 
4124
+
 
4125
+/* { dg-final { scan-assembler-times "vclzd"   5 } } */
 
4126
+/* { dg-final { scan-assembler-times "vclzw"   5 } } */
 
4127
+/* { dg-final { scan-assembler-times "vclzh"   5 } } */
 
4128
+/* { dg-final { scan-assembler-times "vclzb"   5 } } */
 
4129
+
 
4130
+/* { dg-final { scan-assembler-times "vpopcntd" 5 } } */
 
4131
+/* { dg-final { scan-assembler-times "vpopcntw" 5 } } */
 
4132
+/* { dg-final { scan-assembler-times "vpopcnth" 5 } } */
 
4133
+/* { dg-final { scan-assembler-times "vpopcntb" 5 } } */
 
4134
+
 
4135
+/* { dg-final { scan-assembler-times "vgbbd"    3 } } */
 
4136
--- a/src/gcc/testsuite/gcc.target/powerpc/bool3-av.c
 
4137
+++ b/src/gcc/testsuite/gcc.target/powerpc/bool3-av.c
 
4138
@@ -0,0 +1,37 @@
 
4139
+/* { dg-do compile { target { powerpc*-*-* && lp64 } } } */
 
4140
+/* { dg-skip-if "" { powerpc*-*-darwin* } { "*" } { "" } } */
 
4141
+/* { dg-require-effective-target powerpc_altivec_ok } */
 
4142
+/* { dg-options "-O2 -mcpu=power6 -mabi=altivec -maltivec -mno-vsx" } */
 
4143
+/* { dg-final { scan-assembler    "\[ \t\]and "     } } */
 
4144
+/* { dg-final { scan-assembler    "\[ \t\]or "      } } */
 
4145
+/* { dg-final { scan-assembler    "\[ \t\]xor "     } } */
 
4146
+/* { dg-final { scan-assembler    "\[ \t\]nor "     } } */
 
4147
+/* { dg-final { scan-assembler    "\[ \t\]andc "    } } */
 
4148
+/* { dg-final { scan-assembler-not "\[ \t\]vand "    } } */
 
4149
+/* { dg-final { scan-assembler-not "\[ \t\]vandc "   } } */
 
4150
+/* { dg-final { scan-assembler-not "\[ \t\]vor "     } } */
 
4151
+/* { dg-final { scan-assembler-not "\[ \t\]vxor "    } } */
 
4152
+/* { dg-final { scan-assembler-not "\[ \t\]vnor "    } } */
 
4153
+/* { dg-final { scan-assembler-not "\[ \t\]xxland "  } } */
 
4154
+/* { dg-final { scan-assembler-not "\[ \t\]xxlor "   } } */
 
4155
+/* { dg-final { scan-assembler-not "\[ \t\]xxlxor "  } } */
 
4156
+/* { dg-final { scan-assembler-not "\[ \t\]xxlnor "  } } */
 
4157
+/* { dg-final { scan-assembler-not "\[ \t\]xxlandc " } } */
 
4158
+/* { dg-final { scan-assembler-not "\[ \t\]xxleqv "  } } */
 
4159
+/* { dg-final { scan-assembler-not "\[ \t\]xxlorc "  } } */
 
4160
+/* { dg-final { scan-assembler-not "\[ \t\]xxlnand " } } */
 
4161
+
 
4162
+/* On altivec, for 128-bit types, ORC/ANDC/EQV might not show up, since the
 
4163
+   vector unit doesn't support these, so the appropriate combine patterns may
 
4164
+   not be generated.  */
 
4165
+
 
4166
+#ifndef TYPE
 
4167
+#ifdef _ARCH_PPC64
 
4168
+#define TYPE __int128_t
 
4169
+#else
 
4170
+typedef int v4si __attribute__ ((vector_size (16)));
 
4171
+#define TYPE v4si
 
4172
+#endif
 
4173
+#endif
 
4174
+
 
4175
+#include "bool3.h"
 
4176
--- a/src/gcc/testsuite/gcc.target/powerpc/p8vector-vectorize-4.c
 
4177
+++ b/src/gcc/testsuite/gcc.target/powerpc/p8vector-vectorize-4.c
 
4178
@@ -0,0 +1,69 @@
 
4179
+/* { dg-do compile { target { powerpc*-*-* } } } */
 
4180
+/* { dg-skip-if "" { powerpc*-*-darwin* } { "*" } { "" } } */
 
4181
+/* { dg-require-effective-target powerpc_p8vector_ok } */
 
4182
+/* { dg-options "-mcpu=power8 -O2 -ftree-vectorize -fvect-cost-model -fno-unroll-loops -fno-unroll-all-loops" } */
 
4183
+
 
4184
+#ifndef SIZE
 
4185
+#define SIZE 1024
 
4186
+#endif
 
4187
+
 
4188
+#ifndef ALIGN
 
4189
+#define ALIGN 32
 
4190
+#endif
 
4191
+
 
4192
+#define ALIGN_ATTR __attribute__((__aligned__(ALIGN)))
 
4193
+
 
4194
+#define DO_BUILTIN(PREFIX, TYPE, CLZ, POPCNT)                          \
 
4195
+TYPE PREFIX ## _a[SIZE] ALIGN_ATTR;                                    \
 
4196
+TYPE PREFIX ## _b[SIZE] ALIGN_ATTR;                                    \
 
4197
+                                                                       \
 
4198
+void                                                                   \
 
4199
+PREFIX ## _clz (void)                                                  \
 
4200
+{                                                                      \
 
4201
+  unsigned long i;                                                     \
 
4202
+                                                                       \
 
4203
+  for (i = 0; i < SIZE; i++)                                           \
 
4204
+    PREFIX ## _a[i] = CLZ (PREFIX ## _b[i]);                           \
 
4205
+}                                                                      \
 
4206
+                                                                       \
 
4207
+void                                                                   \
 
4208
+PREFIX ## _popcnt (void)                                               \
 
4209
+{                                                                      \
 
4210
+  unsigned long i;                                                     \
 
4211
+                                                                       \
 
4212
+  for (i = 0; i < SIZE; i++)                                           \
 
4213
+    PREFIX ## _a[i] = POPCNT (PREFIX ## _b[i]);                                \
 
4214
+}
 
4215
+
 
4216
+#if !defined(DO_LONG_LONG) && !defined(DO_LONG) && !defined(DO_INT) && !defined(DO_SHORT) && !defined(DO_CHAR)
 
4217
+#define DO_INT 1
 
4218
+#endif
 
4219
+
 
4220
+#if DO_LONG_LONG
 
4221
+/* At the moment, only int is auto vectorized.  */
 
4222
+DO_BUILTIN (sll, long long,            __builtin_clzll, __builtin_popcountll)
 
4223
+DO_BUILTIN (ull, unsigned long long,   __builtin_clzll, __builtin_popcountll)
 
4224
+#endif
 
4225
+
 
4226
+#if defined(_ARCH_PPC64) && DO_LONG
 
4227
+DO_BUILTIN (sl,  long,                 __builtin_clzl,  __builtin_popcountl)
 
4228
+DO_BUILTIN (ul,  unsigned long,                __builtin_clzl,  __builtin_popcountl)
 
4229
+#endif
 
4230
+
 
4231
+#if DO_INT
 
4232
+DO_BUILTIN (si,  int,                  __builtin_clz,   __builtin_popcount)
 
4233
+DO_BUILTIN (ui,  unsigned int,         __builtin_clz,   __builtin_popcount)
 
4234
+#endif
 
4235
+
 
4236
+#if DO_SHORT
 
4237
+DO_BUILTIN (ss,  short,                        __builtin_clz,   __builtin_popcount)
 
4238
+DO_BUILTIN (us,  unsigned short,       __builtin_clz,   __builtin_popcount)
 
4239
+#endif
 
4240
+
 
4241
+#if DO_CHAR
 
4242
+DO_BUILTIN (sc,  signed char,          __builtin_clz,   __builtin_popcount)
 
4243
+DO_BUILTIN (uc,  unsigned char,                __builtin_clz,   __builtin_popcount)
 
4244
+#endif
 
4245
+
 
4246
+/* { dg-final { scan-assembler-times "vclzw"     2 } } */
 
4247
+/* { dg-final { scan-assembler-times "vpopcntw"  2 } } */
 
4248
--- a/src/gcc/testsuite/gcc.target/powerpc/pr57949-1.c
 
4249
+++ b/src/gcc/testsuite/gcc.target/powerpc/pr57949-1.c
 
4250
@@ -0,0 +1,20 @@
 
4251
+/* { dg-do compile { target { powerpc64*-*-* && lp64 } } } */
 
4252
+/* { dg-skip-if "" { powerpc*-*-darwin* } { "*" } { "" } } */
 
4253
+/* { dg-skip-if "" { powerpc_elfv2 } { "*" } { "" } } */
 
4254
+/* { dg-options "-O2 -mcpu=power7 -mno-compat-align-parm" } */
 
4255
+
 
4256
+/* Verify that vs is 16-byte aligned with -mcompat-align-parm.  */
 
4257
+
 
4258
+typedef float v4sf __attribute__ ((vector_size (16)));
 
4259
+struct s { long m; v4sf v; };
 
4260
+long n;
 
4261
+v4sf ve;
 
4262
+
 
4263
+void pr57949 (long d1, long d2, long d3, long d4, long d5, long d6,
 
4264
+             long d7, long d8, long d9, struct s vs) {
 
4265
+  n = vs.m;
 
4266
+  ve = vs.v;
 
4267
+}
 
4268
+
 
4269
+/* { dg-final { scan-assembler "li \.\*,144" } } */
 
4270
+/* { dg-final { scan-assembler "ld \.\*,128\\(1\\)" } } */
 
4271
--- a/src/gcc/testsuite/gcc.target/powerpc/atomic-p8.c
 
4272
+++ b/src/gcc/testsuite/gcc.target/powerpc/atomic-p8.c
 
4273
@@ -0,0 +1,237 @@
 
4274
+/* { dg-do compile { target { powerpc*-*-* && lp64 } } } */
 
4275
+/* { dg-skip-if "" { powerpc*-*-darwin* } { "*" } { "" } } */
 
4276
+/* { dg-require-effective-target powerpc_p8vector_ok } */
 
4277
+/* { dg-options "-mcpu=power8 -O2" } */
 
4278
+/* { dg-final { scan-assembler-times "lbarx" 7 } } */
 
4279
+/* { dg-final { scan-assembler-times "lharx" 7 } } */
 
4280
+/* { dg-final { scan-assembler-times "lwarx" 7 } } */
 
4281
+/* { dg-final { scan-assembler-times "ldarx" 7 } } */
 
4282
+/* { dg-final { scan-assembler-times "lqarx" 7 } } */
 
4283
+/* { dg-final { scan-assembler-times "stbcx" 7 } } */
 
4284
+/* { dg-final { scan-assembler-times "sthcx" 7 } } */
 
4285
+/* { dg-final { scan-assembler-times "stwcx" 7 } } */
 
4286
+/* { dg-final { scan-assembler-times "stdcx" 7 } } */
 
4287
+/* { dg-final { scan-assembler-times "stqcx" 7 } } */
 
4288
+/* { dg-final { scan-assembler-not "bl __atomic" } } */
 
4289
+/* { dg-final { scan-assembler-times "isync" 20 } } */
 
4290
+/* { dg-final { scan-assembler-times "lwsync" 10 } } */
 
4291
+/* { dg-final { scan-assembler-not "mtvsrd" } } */
 
4292
+/* { dg-final { scan-assembler-not "mtvsrwa" } } */
 
4293
+/* { dg-final { scan-assembler-not "mtvsrwz" } } */
 
4294
+/* { dg-final { scan-assembler-not "mfvsrd" } } */
 
4295
+/* { dg-final { scan-assembler-not "mfvsrwz" } } */
 
4296
+
 
4297
+/* Test for the byte atomic operations on power8 using lbarx/stbcx.  */
 
4298
+char
 
4299
+char_fetch_add_relaxed (char *ptr, int value)
 
4300
+{
 
4301
+  return __atomic_fetch_add (ptr, value, __ATOMIC_RELAXED);
 
4302
+}
 
4303
+
 
4304
+char
 
4305
+char_fetch_sub_consume (char *ptr, int value)
 
4306
+{
 
4307
+  return __atomic_fetch_sub (ptr, value, __ATOMIC_CONSUME);
 
4308
+}
 
4309
+
 
4310
+char
 
4311
+char_fetch_and_acquire (char *ptr, int value)
 
4312
+{
 
4313
+  return __atomic_fetch_and (ptr, value, __ATOMIC_ACQUIRE);
 
4314
+}
 
4315
+
 
4316
+char
 
4317
+char_fetch_ior_release (char *ptr, int value)
 
4318
+{
 
4319
+  return __atomic_fetch_or (ptr, value, __ATOMIC_RELEASE);
 
4320
+}
 
4321
+
 
4322
+char
 
4323
+char_fetch_xor_acq_rel (char *ptr, int value)
 
4324
+{
 
4325
+  return __atomic_fetch_xor (ptr, value, __ATOMIC_ACQ_REL);
 
4326
+}
 
4327
+
 
4328
+char
 
4329
+char_fetch_nand_seq_cst (char *ptr, int value)
 
4330
+{
 
4331
+  return __atomic_fetch_nand (ptr, value, __ATOMIC_SEQ_CST);
 
4332
+}
 
4333
+
 
4334
+void
 
4335
+char_val_compare_and_swap (char *p, int i, int j, char *q)
 
4336
+{
 
4337
+  *q = __sync_val_compare_and_swap (p, i, j);
 
4338
+}
 
4339
+
 
4340
+/* Test for the half word atomic operations on power8 using lharx/sthcx.  */
 
4341
+short
 
4342
+short_fetch_add_relaxed (short *ptr, int value)
 
4343
+{
 
4344
+  return __atomic_fetch_add (ptr, value, __ATOMIC_RELAXED);
 
4345
+}
 
4346
+
 
4347
+short
 
4348
+short_fetch_sub_consume (short *ptr, int value)
 
4349
+{
 
4350
+  return __atomic_fetch_sub (ptr, value, __ATOMIC_CONSUME);
 
4351
+}
 
4352
+
 
4353
+short
 
4354
+short_fetch_and_acquire (short *ptr, int value)
 
4355
+{
 
4356
+  return __atomic_fetch_and (ptr, value, __ATOMIC_ACQUIRE);
 
4357
+}
 
4358
+
 
4359
+short
 
4360
+short_fetch_ior_release (short *ptr, int value)
 
4361
+{
 
4362
+  return __atomic_fetch_or (ptr, value, __ATOMIC_RELEASE);
 
4363
+}
 
4364
+
 
4365
+short
 
4366
+short_fetch_xor_acq_rel (short *ptr, int value)
 
4367
+{
 
4368
+  return __atomic_fetch_xor (ptr, value, __ATOMIC_ACQ_REL);
 
4369
+}
 
4370
+
 
4371
+short
 
4372
+short_fetch_nand_seq_cst (short *ptr, int value)
 
4373
+{
 
4374
+  return __atomic_fetch_nand (ptr, value, __ATOMIC_SEQ_CST);
 
4375
+}
 
4376
+
 
4377
+void
 
4378
+short_val_compare_and_swap (short *p, int i, int j, short *q)
 
4379
+{
 
4380
+  *q = __sync_val_compare_and_swap (p, i, j);
 
4381
+}
 
4382
+
 
4383
+/* Test for the word atomic operations on power8 using lwarx/stwcx.  */
 
4384
+int
 
4385
+int_fetch_add_relaxed (int *ptr, int value)
 
4386
+{
 
4387
+  return __atomic_fetch_add (ptr, value, __ATOMIC_RELAXED);
 
4388
+}
 
4389
+
 
4390
+int
 
4391
+int_fetch_sub_consume (int *ptr, int value)
 
4392
+{
 
4393
+  return __atomic_fetch_sub (ptr, value, __ATOMIC_CONSUME);
 
4394
+}
 
4395
+
 
4396
+int
 
4397
+int_fetch_and_acquire (int *ptr, int value)
 
4398
+{
 
4399
+  return __atomic_fetch_and (ptr, value, __ATOMIC_ACQUIRE);
 
4400
+}
 
4401
+
 
4402
+int
 
4403
+int_fetch_ior_release (int *ptr, int value)
 
4404
+{
 
4405
+  return __atomic_fetch_or (ptr, value, __ATOMIC_RELEASE);
 
4406
+}
 
4407
+
 
4408
+int
 
4409
+int_fetch_xor_acq_rel (int *ptr, int value)
 
4410
+{
 
4411
+  return __atomic_fetch_xor (ptr, value, __ATOMIC_ACQ_REL);
 
4412
+}
 
4413
+
 
4414
+int
 
4415
+int_fetch_nand_seq_cst (int *ptr, int value)
 
4416
+{
 
4417
+  return __atomic_fetch_nand (ptr, value, __ATOMIC_SEQ_CST);
 
4418
+}
 
4419
+
 
4420
+void
 
4421
+int_val_compare_and_swap (int *p, int i, int j, int *q)
 
4422
+{
 
4423
+  *q = __sync_val_compare_and_swap (p, i, j);
 
4424
+}
 
4425
+
 
4426
+/* Test for the double word atomic operations on power8 using ldarx/stdcx.  */
 
4427
+long
 
4428
+long_fetch_add_relaxed (long *ptr, long value)
 
4429
+{
 
4430
+  return __atomic_fetch_add (ptr, value, __ATOMIC_RELAXED);
 
4431
+}
 
4432
+
 
4433
+long
 
4434
+long_fetch_sub_consume (long *ptr, long value)
 
4435
+{
 
4436
+  return __atomic_fetch_sub (ptr, value, __ATOMIC_CONSUME);
 
4437
+}
 
4438
+
 
4439
+long
 
4440
+long_fetch_and_acquire (long *ptr, long value)
 
4441
+{
 
4442
+  return __atomic_fetch_and (ptr, value, __ATOMIC_ACQUIRE);
 
4443
+}
 
4444
+
 
4445
+long
 
4446
+long_fetch_ior_release (long *ptr, long value)
 
4447
+{
 
4448
+  return __atomic_fetch_or (ptr, value, __ATOMIC_RELEASE);
 
4449
+}
 
4450
+
 
4451
+long
 
4452
+long_fetch_xor_acq_rel (long *ptr, long value)
 
4453
+{
 
4454
+  return __atomic_fetch_xor (ptr, value, __ATOMIC_ACQ_REL);
 
4455
+}
 
4456
+
 
4457
+long
 
4458
+long_fetch_nand_seq_cst (long *ptr, long value)
 
4459
+{
 
4460
+  return __atomic_fetch_nand (ptr, value, __ATOMIC_SEQ_CST);
 
4461
+}
 
4462
+
 
4463
+void
 
4464
+long_val_compare_and_swap (long *p, long i, long j, long *q)
 
4465
+{
 
4466
+  *q = __sync_val_compare_and_swap (p, i, j);
 
4467
+}
 
4468
+
 
4469
+/* Test for the quad word atomic operations on power8 using ldarx/stdcx.  */
 
4470
+__int128_t
 
4471
+quad_fetch_add_relaxed (__int128_t *ptr, __int128_t value)
 
4472
+{
 
4473
+  return __atomic_fetch_add (ptr, value, __ATOMIC_RELAXED);
 
4474
+}
 
4475
+
 
4476
+__int128_t
 
4477
+quad_fetch_sub_consume (__int128_t *ptr, __int128_t value)
 
4478
+{
 
4479
+  return __atomic_fetch_sub (ptr, value, __ATOMIC_CONSUME);
 
4480
+}
 
4481
+
 
4482
+__int128_t
 
4483
+quad_fetch_and_acquire (__int128_t *ptr, __int128_t value)
 
4484
+{
 
4485
+  return __atomic_fetch_and (ptr, value, __ATOMIC_ACQUIRE);
 
4486
+}
 
4487
+
 
4488
+__int128_t
 
4489
+quad_fetch_ior_release (__int128_t *ptr, __int128_t value)
 
4490
+{
 
4491
+  return __atomic_fetch_or (ptr, value, __ATOMIC_RELEASE);
 
4492
+}
 
4493
+
 
4494
+__int128_t
 
4495
+quad_fetch_xor_acq_rel (__int128_t *ptr, __int128_t value)
 
4496
+{
 
4497
+  return __atomic_fetch_xor (ptr, value, __ATOMIC_ACQ_REL);
 
4498
+}
 
4499
+
 
4500
+__int128_t
 
4501
+quad_fetch_nand_seq_cst (__int128_t *ptr, __int128_t value)
 
4502
+{
 
4503
+  return __atomic_fetch_nand (ptr, value, __ATOMIC_SEQ_CST);
 
4504
+}
 
4505
+
 
4506
+void
 
4507
+quad_val_compare_and_swap (__int128_t *p, __int128_t i, __int128_t j, __int128_t *q)
 
4508
+{
 
4509
+  *q = __sync_val_compare_and_swap (p, i, j);
 
4510
+}
 
4511
--- a/src/gcc/testsuite/gcc.target/powerpc/sd-pwr6.c
 
4512
+++ b/src/gcc/testsuite/gcc.target/powerpc/sd-pwr6.c
 
4513
@@ -0,0 +1,19 @@
 
4514
+/* { dg-do compile { target { powerpc*-*-* } } } */
 
4515
+/* { dg-skip-if "" { powerpc*-*-darwin* } { "*" } { "" } } */
 
4516
+/* { dg-require-effective-target powerpc_vsx_ok } */
 
4517
+/* { dg-options "-O2 -mcpu=power6 -mhard-dfp" } */
 
4518
+/* { dg-final { scan-assembler-not   "lfiwzx"   } } */
 
4519
+/* { dg-final { scan-assembler-times "lfd"    2 } } */
 
4520
+/* { dg-final { scan-assembler-times "dctdp"  2 } } */
 
4521
+/* { dg-final { scan-assembler-times "dadd"   1 } } */
 
4522
+/* { dg-final { scan-assembler-times "drsp"   1 } } */
 
4523
+
 
4524
+/* Test that for power6 we need to use a bounce buffer on the stack to load
 
4525
+   SDmode variables because the power6 does not have a way to directly load
 
4526
+   32-bit values from memory.  */
 
4527
+_Decimal32 a;
 
4528
+
 
4529
+void inc_dec32 (void)
 
4530
+{
 
4531
+  a += (_Decimal32) 1.0;
 
4532
+}
 
4533
--- a/src/gcc/testsuite/gcc.target/powerpc/recip-4.c
 
4534
+++ b/src/gcc/testsuite/gcc.target/powerpc/recip-4.c
 
4535
@@ -7,8 +7,8 @@
 
4536
 /* { dg-final { scan-assembler-times "xvnmsub.dp" 2 } } */
 
4537
 /* { dg-final { scan-assembler-times "xvrsqrtesp" 1 } } */
 
4538
 /* { dg-final { scan-assembler-times "xvmsub.sp" 1 } } */
 
4539
-/* { dg-final { scan-assembler-times "xvmulsp" 4 } } */
 
4540
-/* { dg-final { scan-assembler-times "xvnmsub.sp" 2 } } */
 
4541
+/* { dg-final { scan-assembler-times "xvmulsp" 2 } } */
 
4542
+/* { dg-final { scan-assembler-times "xvnmsub.sp" 1 } } */
 
4543
 
 
4544
 #define SIZE 1024
 
4545
 
 
4546
--- a/src/gcc/testsuite/gcc.target/powerpc/no-r11-3.c
 
4547
+++ b/src/gcc/testsuite/gcc.target/powerpc/no-r11-3.c
 
4548
@@ -1,5 +1,6 @@
 
4549
 /* { dg-do compile { target { powerpc*-*-* && lp64 } } } */
 
4550
 /* { dg-skip-if "" { *-*-darwin* } { "*" } { "" } } */
 
4551
+/* { dg-skip-if "" { powerpc_elfv2 } { "*" } { "" } } */
 
4552
 /* { dg-options "-O2 -mno-pointers-to-nested-functions" } */
 
4553
 
 
4554
 extern void ext_call (int (func) (void));
 
4555
--- a/src/gcc/testsuite/gcc.target/powerpc/crypto-builtin-1.c
 
4556
+++ b/src/gcc/testsuite/gcc.target/powerpc/crypto-builtin-1.c
 
4557
@@ -0,0 +1,130 @@
 
4558
+/* { dg-do compile { target { powerpc*-*-* } } } */
 
4559
+/* { dg-skip-if "" { powerpc*-*-darwin* } { "*" } { "" } } */
 
4560
+/* { dg-require-effective-target powerpc_p8vector_ok } */
 
4561
+/* { dg-options "-mcpu=power8 -O2 -ftree-vectorize -fvect-cost-model -fno-unroll-loops -fno-unroll-all-loops" } */
 
4562
+
 
4563
+typedef vector unsigned long long      crypto_t;
 
4564
+typedef vector unsigned long long      v2di_t;
 
4565
+typedef vector unsigned int            v4si_t;
 
4566
+typedef vector unsigned short          v8hi_t;
 
4567
+typedef vector unsigned char           v16qi_t;
 
4568
+
 
4569
+crypto_t crpyto1 (crypto_t a)
 
4570
+{
 
4571
+  return __builtin_crypto_vsbox (a);
 
4572
+}
 
4573
+
 
4574
+crypto_t crypto2 (crypto_t a, crypto_t b)
 
4575
+{
 
4576
+  return __builtin_crypto_vcipher (a, b);
 
4577
+}
 
4578
+
 
4579
+crypto_t crypto3 (crypto_t a, crypto_t b)
 
4580
+{
 
4581
+  return __builtin_crypto_vcipherlast (a, b);
 
4582
+}
 
4583
+
 
4584
+crypto_t crypto4 (crypto_t a, crypto_t b)
 
4585
+{
 
4586
+  return __builtin_crypto_vncipher (a, b);
 
4587
+}
 
4588
+
 
4589
+crypto_t crypto5 (crypto_t a, crypto_t b)
 
4590
+{
 
4591
+  return __builtin_crypto_vncipherlast (a, b);
 
4592
+}
 
4593
+
 
4594
+v16qi_t crypto6a (v16qi_t a, v16qi_t b, v16qi_t c)
 
4595
+{
 
4596
+  return __builtin_crypto_vpermxor (a, b, c);
 
4597
+}
 
4598
+
 
4599
+v8hi_t crypto6b (v8hi_t a, v8hi_t b, v8hi_t c)
 
4600
+{
 
4601
+  return __builtin_crypto_vpermxor (a, b, c);
 
4602
+}
 
4603
+
 
4604
+v4si_t crypto6c (v4si_t a, v4si_t b, v4si_t c)
 
4605
+{
 
4606
+  return __builtin_crypto_vpermxor (a, b, c);
 
4607
+}
 
4608
+
 
4609
+v2di_t crypto6d (v2di_t a, v2di_t b, v2di_t c)
 
4610
+{
 
4611
+  return __builtin_crypto_vpermxor (a, b, c);
 
4612
+}
 
4613
+
 
4614
+v16qi_t crypto7a (v16qi_t a, v16qi_t b)
 
4615
+{
 
4616
+  return __builtin_crypto_vpmsumb (a, b);
 
4617
+}
 
4618
+
 
4619
+v16qi_t crypto7b (v16qi_t a, v16qi_t b)
 
4620
+{
 
4621
+  return __builtin_crypto_vpmsum (a, b);
 
4622
+}
 
4623
+
 
4624
+v8hi_t crypto7c (v8hi_t a, v8hi_t b)
 
4625
+{
 
4626
+  return __builtin_crypto_vpmsumh (a, b);
 
4627
+}
 
4628
+
 
4629
+v8hi_t crypto7d (v8hi_t a, v8hi_t b)
 
4630
+{
 
4631
+  return __builtin_crypto_vpmsum (a, b);
 
4632
+}
 
4633
+
 
4634
+v4si_t crypto7e (v4si_t a, v4si_t b)
 
4635
+{
 
4636
+  return __builtin_crypto_vpmsumw (a, b);
 
4637
+}
 
4638
+
 
4639
+v4si_t crypto7f (v4si_t a, v4si_t b)
 
4640
+{
 
4641
+  return __builtin_crypto_vpmsum (a, b);
 
4642
+}
 
4643
+
 
4644
+v2di_t crypto7g (v2di_t a, v2di_t b)
 
4645
+{
 
4646
+  return __builtin_crypto_vpmsumd (a, b);
 
4647
+}
 
4648
+
 
4649
+v2di_t crypto7h (v2di_t a, v2di_t b)
 
4650
+{
 
4651
+  return __builtin_crypto_vpmsum (a, b);
 
4652
+}
 
4653
+
 
4654
+v2di_t crypto8a (v2di_t a)
 
4655
+{
 
4656
+  return __builtin_crypto_vshasigmad (a, 0, 8);
 
4657
+}
 
4658
+
 
4659
+v2di_t crypto8b (v2di_t a)
 
4660
+{
 
4661
+  return __builtin_crypto_vshasigma (a, 0, 8);
 
4662
+}
 
4663
+
 
4664
+v4si_t crypto8c (v4si_t a)
 
4665
+{
 
4666
+  return __builtin_crypto_vshasigmaw (a, 1, 15);
 
4667
+}
 
4668
+
 
4669
+v4si_t crypto8d (v4si_t a)
 
4670
+{
 
4671
+  return __builtin_crypto_vshasigma (a, 1, 15);
 
4672
+}
 
4673
+
 
4674
+/* Note space is used after the instruction so that vcipherlast does not match
 
4675
+   vcipher.  */
 
4676
+/* { dg-final { scan-assembler-times "vcipher "      1 } } */
 
4677
+/* { dg-final { scan-assembler-times "vcipherlast "  1 } } */
 
4678
+/* { dg-final { scan-assembler-times "vncipher "     1 } } */
 
4679
+/* { dg-final { scan-assembler-times "vncipherlast " 1 } } */
 
4680
+/* { dg-final { scan-assembler-times "vpermxor "     4 } } */
 
4681
+/* { dg-final { scan-assembler-times "vpmsumb "      2 } } */
 
4682
+/* { dg-final { scan-assembler-times "vpmsumd "      2 } } */
 
4683
+/* { dg-final { scan-assembler-times "vpmsumh "      2 } } */
 
4684
+/* { dg-final { scan-assembler-times "vpmsumw "      2 } } */
 
4685
+/* { dg-final { scan-assembler-times "vsbox "        1 } } */
 
4686
+/* { dg-final { scan-assembler-times "vshasigmad "   2 } } */
 
4687
+/* { dg-final { scan-assembler-times "vshasigmaw "   2 } } */
 
4688
--- a/src/gcc/testsuite/gcc.target/powerpc/pr42747.c
 
4689
+++ b/src/gcc/testsuite/gcc.target/powerpc/pr42747.c
 
4690
@@ -5,4 +5,4 @@
 
4691
 
 
4692
 double foo (double x) { return __builtin_sqrt (x); }
 
4693
 
 
4694
-/* { dg-final { scan-assembler "xssqrtdp" } } */
 
4695
+/* { dg-final { scan-assembler "xssqrtdp\|fsqrt" } } */
 
4696
--- a/src/gcc/testsuite/gcc.target/powerpc/dfp-dd-2.c
 
4697
+++ b/src/gcc/testsuite/gcc.target/powerpc/dfp-dd-2.c
 
4698
@@ -0,0 +1,26 @@
 
4699
+/* Test generation of DFP instructions for POWER6.  */
 
4700
+/* { dg-do compile { target { powerpc*-*-linux* && powerpc_fprs } } } */
 
4701
+/* { dg-options "-std=gnu99 -O1 -mcpu=power6" } */
 
4702
+
 
4703
+/* { dg-final { scan-assembler-times "fneg" 1 } } */
 
4704
+/* { dg-final { scan-assembler-times "fabs" 1 } } */
 
4705
+/* { dg-final { scan-assembler-times "fnabs" 1 } } */
 
4706
+/* { dg-final { scan-assembler-times "fmr" 0 } } */
 
4707
+
 
4708
+_Decimal64
 
4709
+func1 (_Decimal64 a, _Decimal64 b)
 
4710
+{
 
4711
+  return -b;
 
4712
+}
 
4713
+
 
4714
+_Decimal64
 
4715
+func2 (_Decimal64 a, _Decimal64 b)
 
4716
+{
 
4717
+  return __builtin_fabsd64 (b);
 
4718
+}
 
4719
+
 
4720
+_Decimal64
 
4721
+func3 (_Decimal64 a, _Decimal64 b)
 
4722
+{
 
4723
+  return - __builtin_fabsd64 (b);
 
4724
+}
 
4725
--- a/src/gcc/testsuite/gcc.target/powerpc/direct-move-float1.c
 
4726
+++ b/src/gcc/testsuite/gcc.target/powerpc/direct-move-float1.c
 
4727
@@ -0,0 +1,18 @@
 
4728
+/* { dg-do compile { target { powerpc*-*-linux* && lp64 } } } */
 
4729
+/* { dg-skip-if "" { powerpc*-*-darwin* } { "*" } { "" } } */
 
4730
+/* { dg-skip-if "" { powerpc*-*-*spe* } { "*" } { "" } } */
 
4731
+/* { dg-require-effective-target powerpc_p8vector_ok } */
 
4732
+/* { dg-options "-mcpu=power8 -O2" } */
 
4733
+/* { dg-final { scan-assembler "mtvsrd" } } */
 
4734
+/* { dg-final { scan-assembler "mfvsrd" } } */
 
4735
+/* { dg-final { scan-assembler "xscvdpspn" } } */
 
4736
+/* { dg-final { scan-assembler "xscvspdpn" } } */
 
4737
+
 
4738
+/* Check code generation for direct move for float types.  */
 
4739
+
 
4740
+#define TYPE float
 
4741
+#define IS_FLOAT 1
 
4742
+#define NO_ALTIVEC 1
 
4743
+#define VSX_REG_ATTR "ww"
 
4744
+
 
4745
+#include "direct-move.h"
 
4746
--- a/src/gcc/testsuite/gcc.target/powerpc/dfp-td-2.c
 
4747
+++ b/src/gcc/testsuite/gcc.target/powerpc/dfp-td-2.c
 
4748
@@ -0,0 +1,29 @@
 
4749
+/* Test generation of DFP instructions for POWER6.  */
 
4750
+/* { dg-do compile { target { powerpc*-*-linux* && powerpc_fprs } } } */
 
4751
+/* { dg-options "-std=gnu99 -O1 -mcpu=power6" } */
 
4752
+
 
4753
+/* { dg-final { scan-assembler-times "fneg" 1 } } */
 
4754
+/* { dg-final { scan-assembler-times "fabs" 1 } } */
 
4755
+/* { dg-final { scan-assembler-times "fnabs" 1 } } */
 
4756
+/* { dg-final { scan-assembler-times "fmr" 0 } } */
 
4757
+
 
4758
+/* These tests verify we only generate fneg, fabs and fnabs
 
4759
+   instructions and no fmr's since these are done in place.  */
 
4760
+
 
4761
+_Decimal128
 
4762
+func1 (_Decimal128 a)
 
4763
+{
 
4764
+  return -a;
 
4765
+}
 
4766
+
 
4767
+_Decimal128
 
4768
+func2 (_Decimal128 a)
 
4769
+{
 
4770
+  return __builtin_fabsd128 (a);
 
4771
+}
 
4772
+
 
4773
+_Decimal128
 
4774
+func3 (_Decimal128 a)
 
4775
+{
 
4776
+  return - __builtin_fabsd128 (a);
 
4777
+}
 
4778
--- a/src/gcc/testsuite/gcc.target/powerpc/p8vector-builtin-5.c
 
4779
+++ b/src/gcc/testsuite/gcc.target/powerpc/p8vector-builtin-5.c
 
4780
@@ -0,0 +1,105 @@
 
4781
+/* { dg-do compile { target { powerpc*-*-* } } } */
 
4782
+/* { dg-skip-if "" { powerpc*-*-darwin* } { "*" } { "" } } */
 
4783
+/* { dg-require-effective-target powerpc_p8vector_ok } */
 
4784
+/* { dg-options "-mcpu=power8 -O2 -ftree-vectorize -fvect-cost-model -fno-unroll-loops -fno-unroll-all-loops" } */
 
4785
+
 
4786
+#include <altivec.h>
 
4787
+
 
4788
+#ifndef SIZE
 
4789
+#define SIZE 1024
 
4790
+#endif
 
4791
+
 
4792
+#ifndef ALIGN
 
4793
+#define ALIGN 32
 
4794
+#endif
 
4795
+
 
4796
+#ifndef ATTR_ALIGN
 
4797
+#define ATTR_ALIGN __attribute__((__aligned__(ALIGN)))
 
4798
+#endif
 
4799
+
 
4800
+#define DOIT(TYPE, PREFIX)                                             \
 
4801
+TYPE PREFIX ## _eqv_builtin (TYPE a, TYPE b)                           \
 
4802
+{                                                                      \
 
4803
+  return vec_eqv (a, b);                                               \
 
4804
+}                                                                      \
 
4805
+                                                                       \
 
4806
+TYPE PREFIX ## _eqv_arith (TYPE a, TYPE b)                             \
 
4807
+{                                                                      \
 
4808
+  return ~(a ^ b);                                                     \
 
4809
+}                                                                      \
 
4810
+                                                                       \
 
4811
+TYPE PREFIX ## _nand_builtin (TYPE a, TYPE b)                          \
 
4812
+{                                                                      \
 
4813
+  return vec_nand (a, b);                                              \
 
4814
+}                                                                      \
 
4815
+                                                                       \
 
4816
+TYPE PREFIX ## _nand_arith1 (TYPE a, TYPE b)                           \
 
4817
+{                                                                      \
 
4818
+  return ~(a & b);                                                     \
 
4819
+}                                                                      \
 
4820
+                                                                       \
 
4821
+TYPE PREFIX ## _nand_arith2 (TYPE a, TYPE b)                           \
 
4822
+{                                                                      \
 
4823
+  return (~a) | (~b);                                                  \
 
4824
+}                                                                      \
 
4825
+                                                                       \
 
4826
+TYPE PREFIX ## _orc_builtin (TYPE a, TYPE b)                           \
 
4827
+{                                                                      \
 
4828
+  return vec_orc (a, b);                                               \
 
4829
+}                                                                      \
 
4830
+                                                                       \
 
4831
+TYPE PREFIX ## _orc_arith1 (TYPE a, TYPE b)                            \
 
4832
+{                                                                      \
 
4833
+  return (~ a) | b;                                                    \
 
4834
+}                                                                      \
 
4835
+                                                                       \
 
4836
+TYPE PREFIX ## _orc_arith2 (TYPE a, TYPE b)                            \
 
4837
+{                                                                      \
 
4838
+  return a | (~ b);                                                    \
 
4839
+}
 
4840
+
 
4841
+#define DOIT_FLOAT(TYPE, PREFIX)                                       \
 
4842
+TYPE PREFIX ## _eqv_builtin (TYPE a, TYPE b)                           \
 
4843
+{                                                                      \
 
4844
+  return vec_eqv (a, b);                                               \
 
4845
+}                                                                      \
 
4846
+                                                                       \
 
4847
+TYPE PREFIX ## _nand_builtin (TYPE a, TYPE b)                          \
 
4848
+{                                                                      \
 
4849
+  return vec_nand (a, b);                                              \
 
4850
+}                                                                      \
 
4851
+                                                                       \
 
4852
+TYPE PREFIX ## _orc_builtin (TYPE a, TYPE b)                           \
 
4853
+{                                                                      \
 
4854
+  return vec_orc (a, b);                                               \
 
4855
+}
 
4856
+
 
4857
+typedef vector signed char             sign_char_vec;
 
4858
+typedef vector short                   sign_short_vec;
 
4859
+typedef vector int                     sign_int_vec;
 
4860
+typedef vector long long               sign_llong_vec;
 
4861
+
 
4862
+typedef vector unsigned char           uns_char_vec;
 
4863
+typedef vector unsigned short          uns_short_vec;
 
4864
+typedef vector unsigned int            uns_int_vec;
 
4865
+typedef vector unsigned long long      uns_llong_vec;
 
4866
+
 
4867
+typedef vector float                   float_vec;
 
4868
+typedef vector double                  double_vec;
 
4869
+
 
4870
+DOIT(sign_char_vec,    sign_char)
 
4871
+DOIT(sign_short_vec,   sign_short)
 
4872
+DOIT(sign_int_vec,     sign_int)
 
4873
+DOIT(sign_llong_vec,   sign_llong)
 
4874
+
 
4875
+DOIT(uns_char_vec,     uns_char)
 
4876
+DOIT(uns_short_vec,    uns_short)
 
4877
+DOIT(uns_int_vec,      uns_int)
 
4878
+DOIT(uns_llong_vec,    uns_llong)
 
4879
+
 
4880
+DOIT_FLOAT(float_vec,  float)
 
4881
+DOIT_FLOAT(double_vec, double)
 
4882
+
 
4883
+/* { dg-final { scan-assembler-times "xxleqv"  18 } } */
 
4884
+/* { dg-final { scan-assembler-times "xxlnand" 26 } } */
 
4885
+/* { dg-final { scan-assembler-times "xxlorc"  26 } } */
 
4886
--- a/src/gcc/testsuite/gcc.target/powerpc/p8vector-vectorize-5.c
 
4887
+++ b/src/gcc/testsuite/gcc.target/powerpc/p8vector-vectorize-5.c
 
4888
@@ -0,0 +1,87 @@
 
4889
+/* { dg-do compile { target { powerpc*-*-* } } } */
 
4890
+/* { dg-skip-if "" { powerpc*-*-darwin* } { "*" } { "" } } */
 
4891
+/* { dg-require-effective-target powerpc_p8vector_ok } */
 
4892
+/* { dg-options "-mcpu=power8 -O2 -ftree-vectorize -fvect-cost-model -fno-unroll-loops -fno-unroll-all-loops" } */
 
4893
+
 
4894
+#ifndef SIZE
 
4895
+#define SIZE 1024
 
4896
+#endif
 
4897
+
 
4898
+#ifndef ALIGN
 
4899
+#define ALIGN 32
 
4900
+#endif
 
4901
+
 
4902
+#ifndef ATTR_ALIGN
 
4903
+#define ATTR_ALIGN __attribute__((__aligned__(ALIGN)))
 
4904
+#endif
 
4905
+
 
4906
+#ifndef TYPE
 
4907
+#define TYPE unsigned int
 
4908
+#endif
 
4909
+
 
4910
+TYPE in1  [SIZE] ATTR_ALIGN;
 
4911
+TYPE in2  [SIZE] ATTR_ALIGN;
 
4912
+TYPE eqv  [SIZE] ATTR_ALIGN;
 
4913
+TYPE nand1[SIZE] ATTR_ALIGN;
 
4914
+TYPE nand2[SIZE] ATTR_ALIGN;
 
4915
+TYPE orc1 [SIZE] ATTR_ALIGN;
 
4916
+TYPE orc2 [SIZE] ATTR_ALIGN;
 
4917
+
 
4918
+void
 
4919
+do_eqv (void)
 
4920
+{
 
4921
+  unsigned long i;
 
4922
+
 
4923
+  for (i = 0; i < SIZE; i++)
 
4924
+    {
 
4925
+      eqv[i] = ~(in1[i] ^ in2[i]);
 
4926
+    }
 
4927
+}
 
4928
+
 
4929
+void
 
4930
+do_nand1 (void)
 
4931
+{
 
4932
+  unsigned long i;
 
4933
+
 
4934
+  for (i = 0; i < SIZE; i++)
 
4935
+    {
 
4936
+      nand1[i] = ~(in1[i] & in2[i]);
 
4937
+    }
 
4938
+}
 
4939
+
 
4940
+void
 
4941
+do_nand2 (void)
 
4942
+{
 
4943
+  unsigned long i;
 
4944
+
 
4945
+  for (i = 0; i < SIZE; i++)
 
4946
+    {
 
4947
+      nand2[i] = (~in1[i]) | (~in2[i]);
 
4948
+    }
 
4949
+}
 
4950
+
 
4951
+void
 
4952
+do_orc1 (void)
 
4953
+{
 
4954
+  unsigned long i;
 
4955
+
 
4956
+  for (i = 0; i < SIZE; i++)
 
4957
+    {
 
4958
+      orc1[i] = (~in1[i]) | in2[i];
 
4959
+    }
 
4960
+}
 
4961
+
 
4962
+void
 
4963
+do_orc2 (void)
 
4964
+{
 
4965
+  unsigned long i;
 
4966
+
 
4967
+  for (i = 0; i < SIZE; i++)
 
4968
+    {
 
4969
+      orc1[i] = in1[i] | (~in2[i]);
 
4970
+    }
 
4971
+}
 
4972
+
 
4973
+/* { dg-final { scan-assembler-times "xxleqv"  1 } } */
 
4974
+/* { dg-final { scan-assembler-times "xxlnand" 2 } } */
 
4975
+/* { dg-final { scan-assembler-times "xxlorc"  2 } } */
 
4976
--- a/src/gcc/testsuite/gcc.target/powerpc/pr57949-2.c
 
4977
+++ b/src/gcc/testsuite/gcc.target/powerpc/pr57949-2.c
 
4978
@@ -0,0 +1,20 @@
 
4979
+/* { dg-do compile { target { powerpc64*-*-* && lp64 } } } */
 
4980
+/* { dg-skip-if "" { powerpc*-*-darwin* } { "*" } { "" } } */
 
4981
+/* { dg-skip-if "" { powerpc_elfv2 } { "*" } { "" } } */
 
4982
+/* { dg-options "-O2 -mcpu=power7" } */
 
4983
+
 
4984
+/* Verify that vs is not 16-byte aligned in the absence of -mno-compat-align-parm.  */
 
4985
+
 
4986
+typedef float v4sf __attribute__ ((vector_size (16)));
 
4987
+struct s { long m; v4sf v; };
 
4988
+long n;
 
4989
+v4sf ve;
 
4990
+
 
4991
+void pr57949 (long d1, long d2, long d3, long d4, long d5, long d6,
 
4992
+             long d7, long d8, long d9, struct s vs) {
 
4993
+  n = vs.m;
 
4994
+  ve = vs.v;
 
4995
+}
 
4996
+
 
4997
+/* { dg-final { scan-assembler "ld .\*,136\\(1\\)" } } */
 
4998
+/* { dg-final { scan-assembler "ld .\*,120\\(1\\)" } } */
 
4999
--- a/src/gcc/testsuite/gcc.target/powerpc/recip-5.c
 
5000
+++ b/src/gcc/testsuite/gcc.target/powerpc/recip-5.c
 
5001
@@ -4,8 +4,16 @@
 
5002
 /* { dg-options "-O3 -ftree-vectorize -mrecip=all -ffast-math -mcpu=power7 -fno-unroll-loops" } */
 
5003
 /* { dg-final { scan-assembler-times "xvredp" 4 } } */
 
5004
 /* { dg-final { scan-assembler-times "xvresp" 5 } } */
 
5005
-/* { dg-final { scan-assembler-times "xsredp" 2 } } */
 
5006
-/* { dg-final { scan-assembler-times "fres" 2 } } */
 
5007
+/* { dg-final { scan-assembler-times "xsredp\|fre\ " 2 } } */
 
5008
+/* { dg-final { scan-assembler-times "xsresp\|fres" 2 } } */
 
5009
+/* { dg-final { scan-assembler-times "xsmulsp\|fmuls" 2 } } */
 
5010
+/* { dg-final { scan-assembler-times "xsnmsub.sp\|fnmsubs" 2 } } */
 
5011
+/* { dg-final { scan-assembler-times "xsmuldp\|fmul\ " 2 } } */
 
5012
+/* { dg-final { scan-assembler-times "xsnmsub.dp\|fnmsub\ " 4 } } */
 
5013
+/* { dg-final { scan-assembler-times "xvmulsp" 7 } } */
 
5014
+/* { dg-final { scan-assembler-times "xvnmsub.sp" 5 } } */
 
5015
+/* { dg-final { scan-assembler-times "xvmuldp" 6 } } */
 
5016
+/* { dg-final { scan-assembler-times "xvnmsub.dp" 8 } } */
 
5017
 
 
5018
 #include <altivec.h>
 
5019
 
 
5020
--- a/src/gcc/testsuite/gcc.target/powerpc/ppc64-abi-1.c
 
5021
+++ b/src/gcc/testsuite/gcc.target/powerpc/ppc64-abi-1.c
 
5022
@@ -89,8 +89,10 @@
 
5023
   long a1;
 
5024
   long a2;
 
5025
   long a3;
 
5026
+#if _CALL_ELF != 2
 
5027
   long a4;
 
5028
   long a5;
 
5029
+#endif
 
5030
   parm_t slot[100];
 
5031
 } stack_frame_t;
 
5032
 
 
5033
--- a/src/gcc/testsuite/gcc.target/powerpc/direct-move-float2.c
 
5034
+++ b/src/gcc/testsuite/gcc.target/powerpc/direct-move-float2.c
 
5035
@@ -0,0 +1,15 @@
 
5036
+/* { dg-do run { target { powerpc*-*-linux* && lp64 } } } */
 
5037
+/* { dg-skip-if "" { powerpc*-*-darwin* } { "*" } { "" } } */
 
5038
+/* { dg-skip-if "" { powerpc*-*-*spe* } { "*" } { "" } } */
 
5039
+/* { dg-require-effective-target p8vector_hw } */
 
5040
+/* { dg-options "-mcpu=power8 -O2" } */
 
5041
+
 
5042
+/* Check whether we get the right bits for direct move at runtime.  */
 
5043
+
 
5044
+#define TYPE float
 
5045
+#define IS_FLOAT 1
 
5046
+#define NO_ALTIVEC 1
 
5047
+#define DO_MAIN
 
5048
+#define VSX_REG_ATTR "ww"
 
5049
+
 
5050
+#include "direct-move.h"
 
5051
--- a/src/gcc/testsuite/gcc.target/powerpc/direct-move-double1.c
 
5052
+++ b/src/gcc/testsuite/gcc.target/powerpc/direct-move-double1.c
 
5053
@@ -0,0 +1,16 @@
 
5054
+/* { dg-do compile { target { powerpc*-*-linux* && lp64 } } } */
 
5055
+/* { dg-skip-if "" { powerpc*-*-darwin* } { "*" } { "" } } */
 
5056
+/* { dg-skip-if "" { powerpc*-*-*spe* } { "*" } { "" } } */
 
5057
+/* { dg-require-effective-target powerpc_p8vector_ok } */
 
5058
+/* { dg-options "-mcpu=power8 -O2" } */
 
5059
+/* { dg-final { scan-assembler "mtvsrd" } } */
 
5060
+/* { dg-final { scan-assembler "mfvsrd" } } */
 
5061
+
 
5062
+/* Check code generation for direct move for double types.  */
 
5063
+
 
5064
+#define TYPE double
 
5065
+#define IS_FLOAT 1
 
5066
+#define NO_ALTIVEC 1
 
5067
+#define VSX_REG_ATTR "ws"
 
5068
+
 
5069
+#include "direct-move.h"
 
5070
--- a/src/gcc/testsuite/gcc.target/powerpc/dfp-td-3.c
 
5071
+++ b/src/gcc/testsuite/gcc.target/powerpc/dfp-td-3.c
 
5072
@@ -0,0 +1,29 @@
 
5073
+/* Test generation of DFP instructions for POWER6.  */
 
5074
+/* { dg-do compile { target { powerpc*-*-linux* && powerpc_fprs } } } */
 
5075
+/* { dg-options "-std=gnu99 -O1 -mcpu=power6" } */
 
5076
+
 
5077
+/* { dg-final { scan-assembler-times "fneg" 1 } } */
 
5078
+/* { dg-final { scan-assembler-times "fabs" 1 } } */
 
5079
+/* { dg-final { scan-assembler-times "fnabs" 1 } } */
 
5080
+/* { dg-final { scan-assembler-times "fmr" 3 } } */
 
5081
+
 
5082
+/* These tests verify we generate fneg, fabs and fnabs and
 
5083
+   associated fmr's since these are not done in place.  */
 
5084
+
 
5085
+_Decimal128
 
5086
+func1 (_Decimal128 a, _Decimal128 b)
 
5087
+{
 
5088
+  return -b;
 
5089
+}
 
5090
+
 
5091
+_Decimal128
 
5092
+func2 (_Decimal128 a, _Decimal128 b)
 
5093
+{
 
5094
+  return __builtin_fabsd128 (b);
 
5095
+}
 
5096
+
 
5097
+_Decimal128
 
5098
+func3 (_Decimal128 a, _Decimal128 b)
 
5099
+{
 
5100
+  return - __builtin_fabsd128 (b);
 
5101
+}
 
5102
--- a/src/gcc/testsuite/gcc.target/powerpc/p8vector-builtin-6.c
 
5103
+++ b/src/gcc/testsuite/gcc.target/powerpc/p8vector-builtin-6.c
 
5104
@@ -0,0 +1,10 @@
 
5105
+/* { dg-do compile { target { powerpc*-*-* } } } */
 
5106
+/* { dg-skip-if "" { powerpc*-*-darwin* } { "*" } { "" } } */
 
5107
+/* { dg-require-effective-target powerpc_p8vector_ok } */
 
5108
+/* { dg-options "-mcpu=power8 -O2" } */
 
5109
+
 
5110
+vector float dbl_to_float_p8 (double x) { return __builtin_vsx_xscvdpspn (x); }
 
5111
+double float_to_dbl_p8 (vector float x) { return __builtin_vsx_xscvspdpn (x); }
 
5112
+
 
5113
+/* { dg-final { scan-assembler "xscvdpspn" } } */
 
5114
+/* { dg-final { scan-assembler "xscvspdpn" } } */
 
5115
--- a/src/gcc/testsuite/gcc.target/powerpc/vsx-builtin-3.c
 
5116
+++ b/src/gcc/testsuite/gcc.target/powerpc/vsx-builtin-3.c
 
5117
@@ -16,9 +16,9 @@
 
5118
 /* { dg-final { scan-assembler "xvrspiz" } } */
 
5119
 /* { dg-final { scan-assembler "xsrdpi" } } */
 
5120
 /* { dg-final { scan-assembler "xsrdpic" } } */
 
5121
-/* { dg-final { scan-assembler "xsrdpim" } } */
 
5122
-/* { dg-final { scan-assembler "xsrdpip" } } */
 
5123
-/* { dg-final { scan-assembler "xsrdpiz" } } */
 
5124
+/* { dg-final { scan-assembler "xsrdpim\|frim" } } */
 
5125
+/* { dg-final { scan-assembler "xsrdpip\|frip" } } */
 
5126
+/* { dg-final { scan-assembler "xsrdpiz\|friz" } } */
 
5127
 /* { dg-final { scan-assembler "xsmaxdp" } } */
 
5128
 /* { dg-final { scan-assembler "xsmindp" } } */
 
5129
 /* { dg-final { scan-assembler "xxland" } } */
 
5130
--- a/src/gcc/testsuite/gcc.target/powerpc/htm-builtin-1.c
 
5131
+++ b/src/gcc/testsuite/gcc.target/powerpc/htm-builtin-1.c
 
5132
@@ -0,0 +1,51 @@
 
5133
+/* { dg-do compile { target { powerpc*-*-* } } } */
 
5134
+/* { dg-skip-if "" { powerpc*-*-darwin* } { "*" } { "" } } */
 
5135
+/* { dg-require-effective-target powerpc_htm_ok } */
 
5136
+/* { dg-options "-O2 -mhtm" } */
 
5137
+
 
5138
+/* { dg-final { scan-assembler-times "tbegin\\." 1 } } */
 
5139
+/* { dg-final { scan-assembler-times "tend\\." 2 } } */
 
5140
+/* { dg-final { scan-assembler-times "tabort\\." 2 } } */
 
5141
+/* { dg-final { scan-assembler-times "tabortdc\\." 1 } } */
 
5142
+/* { dg-final { scan-assembler-times "tabortdci\\." 1 } } */
 
5143
+/* { dg-final { scan-assembler-times "tabortwc\\." 1 } } */
 
5144
+/* { dg-final { scan-assembler-times "tabortwci\\." 2 } } */
 
5145
+/* { dg-final { scan-assembler-times "tcheck\\." 1 } } */
 
5146
+/* { dg-final { scan-assembler-times "trechkpt\\." 1 } } */
 
5147
+/* { dg-final { scan-assembler-times "treclaim\\." 1 } } */
 
5148
+/* { dg-final { scan-assembler-times "tsr\\." 3 } } */
 
5149
+/* { dg-final { scan-assembler-times "mfspr" 4 } } */
 
5150
+/* { dg-final { scan-assembler-times "mtspr" 4 } } */
 
5151
+
 
5152
+void use_builtins (long *p, char code, long *a, long *b)
 
5153
+{
 
5154
+  p[0] = __builtin_tbegin (0);
 
5155
+  p[1] = __builtin_tend (0);
 
5156
+  p[2] = __builtin_tendall ();
 
5157
+  p[3] = __builtin_tabort (0);
 
5158
+  p[4] = __builtin_tabort (code);
 
5159
+
 
5160
+  p[5] = __builtin_tabortdc (0xf, a[5], b[5]);
 
5161
+  p[6] = __builtin_tabortdci (0xf, a[6], 13);
 
5162
+  p[7] = __builtin_tabortwc (0xf, a[7], b[7]);
 
5163
+  p[8] = __builtin_tabortwci (0xf, a[8], 13);
 
5164
+
 
5165
+  p[9] = __builtin_tcheck (5);
 
5166
+  p[10] = __builtin_trechkpt ();
 
5167
+  p[11] = __builtin_treclaim (0);
 
5168
+  p[12] = __builtin_tresume ();
 
5169
+  p[13] = __builtin_tsuspend ();
 
5170
+  p[14] = __builtin_tsr (0);
 
5171
+  p[15] = __builtin_ttest (); /* This expands to a tabortwci.  */
 
5172
+
 
5173
+
 
5174
+  p[16] = __builtin_get_texasr ();
 
5175
+  p[17] = __builtin_get_texasru ();
 
5176
+  p[18] = __builtin_get_tfhar ();
 
5177
+  p[19] = __builtin_get_tfiar ();
 
5178
+
 
5179
+  __builtin_set_texasr (a[20]);
 
5180
+  __builtin_set_texasru (a[21]);
 
5181
+  __builtin_set_tfhar (a[22]);
 
5182
+  __builtin_set_tfiar (a[23]);
 
5183
+}
 
5184
--- a/src/gcc/testsuite/gcc.target/powerpc/bool.c
 
5185
+++ b/src/gcc/testsuite/gcc.target/powerpc/bool.c
 
5186
@@ -0,0 +1,14 @@
 
5187
+/* { dg-do compile { target { powerpc*-*-* } } } */
 
5188
+/* { dg-options "-O2" } */
 
5189
+/* { dg-final { scan-assembler "eqv" } } */
 
5190
+/* { dg-final { scan-assembler "nand" } } */
 
5191
+/* { dg-final { scan-assembler "nor" } } */
 
5192
+
 
5193
+#ifndef TYPE
 
5194
+#define TYPE unsigned long
 
5195
+#endif
 
5196
+
 
5197
+TYPE op1 (TYPE a, TYPE b) { return ~(a ^ b); } /* eqv */
 
5198
+TYPE op2 (TYPE a, TYPE b) { return ~(a & b); } /* nand */
 
5199
+TYPE op3 (TYPE a, TYPE b) { return ~(a | b); } /* nor */
 
5200
+
 
5201
--- a/src/gcc/testsuite/gcc.target/powerpc/bool2-p5.c
 
5202
+++ b/src/gcc/testsuite/gcc.target/powerpc/bool2-p5.c
 
5203
@@ -0,0 +1,32 @@
 
5204
+/* { dg-do compile { target { powerpc*-*-* } } } */
 
5205
+/* { dg-skip-if "" { powerpc*-*-darwin* } { "*" } { "" } } */
 
5206
+/* { dg-require-effective-target powerpc_altivec_ok } */
 
5207
+/* { dg-options "-O2 -mcpu=power5 -mabi=altivec -mno-altivec -mno-vsx" } */
 
5208
+/* { dg-final { scan-assembler    "\[ \t\]and "     } } */
 
5209
+/* { dg-final { scan-assembler    "\[ \t\]or "      } } */
 
5210
+/* { dg-final { scan-assembler    "\[ \t\]xor "     } } */
 
5211
+/* { dg-final { scan-assembler    "\[ \t\]nor "     } } */
 
5212
+/* { dg-final { scan-assembler    "\[ \t\]andc "    } } */
 
5213
+/* { dg-final { scan-assembler    "\[ \t\]eqv "     } } */
 
5214
+/* { dg-final { scan-assembler    "\[ \t\]orc "     } } */
 
5215
+/* { dg-final { scan-assembler    "\[ \t\]nand "    } } */
 
5216
+/* { dg-final { scan-assembler-not "\[ \t\]vand "    } } */
 
5217
+/* { dg-final { scan-assembler-not "\[ \t\]vandc "   } } */
 
5218
+/* { dg-final { scan-assembler-not "\[ \t\]vor "     } } */
 
5219
+/* { dg-final { scan-assembler-not "\[ \t\]vxor "    } } */
 
5220
+/* { dg-final { scan-assembler-not "\[ \t\]vnor "    } } */
 
5221
+/* { dg-final { scan-assembler-not "\[ \t\]xxland "  } } */
 
5222
+/* { dg-final { scan-assembler-not "\[ \t\]xxlor "   } } */
 
5223
+/* { dg-final { scan-assembler-not "\[ \t\]xxlxor "  } } */
 
5224
+/* { dg-final { scan-assembler-not "\[ \t\]xxlnor "  } } */
 
5225
+/* { dg-final { scan-assembler-not "\[ \t\]xxlandc " } } */
 
5226
+/* { dg-final { scan-assembler-not "\[ \t\]xxleqv "  } } */
 
5227
+/* { dg-final { scan-assembler-not "\[ \t\]xxlorc "  } } */
 
5228
+/* { dg-final { scan-assembler-not "\[ \t\]xxlnand " } } */
 
5229
+
 
5230
+#ifndef TYPE
 
5231
+typedef int v4si __attribute__ ((vector_size (16)));
 
5232
+#define TYPE v4si
 
5233
+#endif
 
5234
+
 
5235
+#include "bool2.h"
 
5236
--- a/src/gcc/testsuite/gcc.target/powerpc/fusion.c
 
5237
+++ b/src/gcc/testsuite/gcc.target/powerpc/fusion.c
 
5238
@@ -0,0 +1,24 @@
 
5239
+/* { dg-do compile { target { powerpc*-*-* } } } */
 
5240
+/* { dg-skip-if "" { powerpc*-*-darwin* } { "*" } { "" } } */
 
5241
+/* { dg-skip-if "" { powerpc*le-*-* } { "*" } { "" } } */
 
5242
+/* { dg-require-effective-target powerpc_p8vector_ok } */
 
5243
+/* { dg-options "-mcpu=power7 -mtune=power8 -O3" } */
 
5244
+
 
5245
+#define LARGE 0x12345
 
5246
+
 
5247
+int fusion_uchar (unsigned char *p){ return p[LARGE]; }
 
5248
+int fusion_schar (signed char *p){ return p[LARGE]; }
 
5249
+int fusion_ushort (unsigned short *p){ return p[LARGE]; }
 
5250
+int fusion_short (short *p){ return p[LARGE]; }
 
5251
+int fusion_int (int *p){ return p[LARGE]; }
 
5252
+unsigned fusion_uns (unsigned *p){ return p[LARGE]; }
 
5253
+
 
5254
+vector double fusion_vector (vector double *p) { return p[2]; }
 
5255
+
 
5256
+/* { dg-final { scan-assembler-times "gpr load fusion"    6 } } */
 
5257
+/* { dg-final { scan-assembler-times "vector load fusion" 1 } } */
 
5258
+/* { dg-final { scan-assembler-times "lbz"                2 } } */
 
5259
+/* { dg-final { scan-assembler-times "extsb"              1 } } */
 
5260
+/* { dg-final { scan-assembler-times "lhz"                2 } } */
 
5261
+/* { dg-final { scan-assembler-times "extsh"              1 } } */
 
5262
+/* { dg-final { scan-assembler-times "lwz"                2 } } */
 
5263
--- a/src/gcc/testsuite/gcc.target/powerpc/ppc64-abi-2.c
 
5264
+++ b/src/gcc/testsuite/gcc.target/powerpc/ppc64-abi-2.c
 
5265
@@ -107,8 +107,10 @@
 
5266
   long a1;
 
5267
   long a2;
 
5268
   long a3;
 
5269
+#if _CALL_ELF != 2
 
5270
   long a4;
 
5271
   long a5;
 
5272
+#endif
 
5273
   parm_t slot[100];
 
5274
 } stack_frame_t;
 
5275
 
 
5276
@@ -119,6 +121,12 @@
 
5277
   vector int v;
 
5278
 } vector_int_t;
 
5279
 
 
5280
+#ifdef __LITTLE_ENDIAN__
 
5281
+#define MAKE_SLOT(x, y) ((long)x | ((long)y << 32))
 
5282
+#else
 
5283
+#define MAKE_SLOT(x, y) ((long)y | ((long)x << 32))
 
5284
+#endif
 
5285
+
 
5286
 /* Paramter passing.
 
5287
    s : gpr 3
 
5288
    v : vpr 2
 
5289
@@ -226,8 +234,8 @@
 
5290
   sp = __builtin_frame_address(0);
 
5291
   sp = sp->backchain;
 
5292
   
 
5293
-  if (sp->slot[2].l != 0x100000002ULL
 
5294
-      || sp->slot[4].l != 0x500000006ULL)
 
5295
+  if (sp->slot[2].l != MAKE_SLOT (1, 2)
 
5296
+      || sp->slot[4].l !=  MAKE_SLOT (5, 6))
 
5297
     abort();
 
5298
 }
 
5299
 
 
5300
@@ -268,8 +276,8 @@
 
5301
   sp = __builtin_frame_address(0);
 
5302
   sp = sp->backchain;
 
5303
   
 
5304
-  if (sp->slot[4].l != 0x100000002ULL
 
5305
-      || sp->slot[6].l != 0x500000006ULL)
 
5306
+  if (sp->slot[4].l != MAKE_SLOT (1, 2)
 
5307
+      || sp->slot[6].l !=  MAKE_SLOT (5, 6))
 
5308
     abort();
 
5309
 }
 
5310
 
 
5311
@@ -296,8 +304,8 @@
 
5312
   sp = __builtin_frame_address(0);
 
5313
   sp = sp->backchain;
 
5314
   
 
5315
-  if (sp->slot[4].l != 0x100000002ULL
 
5316
-      || sp->slot[6].l != 0x500000006ULL)
 
5317
+  if (sp->slot[4].l != MAKE_SLOT (1, 2)
 
5318
+      || sp->slot[6].l !=  MAKE_SLOT (5, 6))
 
5319
     abort();
 
5320
 }
 
5321
 
 
5322
--- a/src/gcc/testsuite/gcc.target/powerpc/direct-move-long1.c
 
5323
+++ b/src/gcc/testsuite/gcc.target/powerpc/direct-move-long1.c
 
5324
@@ -0,0 +1,16 @@
 
5325
+/* { dg-do compile { target { powerpc*-*-linux* && lp64 } } } */
 
5326
+/* { dg-skip-if "" { powerpc*-*-darwin* } { "*" } { "" } } */
 
5327
+/* { dg-skip-if "" { powerpc*-*-*spe* } { "*" } { "" } } */
 
5328
+/* { dg-require-effective-target powerpc_p8vector_ok } */
 
5329
+/* { dg-options "-mcpu=power8 -O2" } */
 
5330
+/* { dg-final { scan-assembler "mtvsrd" } } */
 
5331
+/* { dg-final { scan-assembler "mfvsrd" } } */
 
5332
+
 
5333
+/* Check code generation for direct move for long types.  */
 
5334
+
 
5335
+#define TYPE long
 
5336
+#define IS_INT 1
 
5337
+#define NO_ALTIVEC 1
 
5338
+#define VSX_REG_ATTR "d"
 
5339
+
 
5340
+#include "direct-move.h"
 
5341
--- a/src/gcc/testsuite/gcc.target/powerpc/direct-move-double2.c
 
5342
+++ b/src/gcc/testsuite/gcc.target/powerpc/direct-move-double2.c
 
5343
@@ -0,0 +1,15 @@
 
5344
+/* { dg-do run { target { powerpc*-*-linux* && lp64 } } } */
 
5345
+/* { dg-skip-if "" { powerpc*-*-darwin* } { "*" } { "" } } */
 
5346
+/* { dg-skip-if "" { powerpc*-*-*spe* } { "*" } { "" } } */
 
5347
+/* { dg-require-effective-target p8vector_hw } */
 
5348
+/* { dg-options "-mcpu=power8 -O2" } */
 
5349
+
 
5350
+/* Check whether we get the right bits for direct move at runtime.  */
 
5351
+
 
5352
+#define TYPE double
 
5353
+#define IS_FLOAT 1
 
5354
+#define NO_ALTIVEC 1
 
5355
+#define DO_MAIN
 
5356
+#define VSX_REG_ATTR "ws"
 
5357
+
 
5358
+#include "direct-move.h"
 
5359
--- a/src/gcc/testsuite/gcc.target/powerpc/p8vector-builtin-7.c
 
5360
+++ b/src/gcc/testsuite/gcc.target/powerpc/p8vector-builtin-7.c
 
5361
@@ -0,0 +1,32 @@
 
5362
+/* { dg-do compile { target { powerpc*-*-* } } } */
 
5363
+/* { dg-skip-if "" { powerpc*-*-darwin* } { "*" } { "" } } */
 
5364
+/* { dg-require-effective-target powerpc_p8vector_ok } */
 
5365
+/* { dg-options "-mcpu=power8 -O2" } */
 
5366
+
 
5367
+#include <altivec.h>
 
5368
+
 
5369
+typedef vector int             v_sign;
 
5370
+typedef vector unsigned int    v_uns;
 
5371
+
 
5372
+v_sign even_sign (v_sign a, v_sign b)
 
5373
+{
 
5374
+  return vec_vmrgew (a, b);
 
5375
+}
 
5376
+
 
5377
+v_uns even_uns (v_uns a, v_uns b)
 
5378
+{
 
5379
+  return vec_vmrgew (a, b);
 
5380
+}
 
5381
+
 
5382
+v_sign odd_sign (v_sign a, v_sign b)
 
5383
+{
 
5384
+  return vec_vmrgow (a, b);
 
5385
+}
 
5386
+
 
5387
+v_uns odd_uns (v_uns a, v_uns b)
 
5388
+{
 
5389
+  return vec_vmrgow (a, b);
 
5390
+}
 
5391
+
 
5392
+/* { dg-final { scan-assembler-times "vmrgew" 2 } } */
 
5393
+/* { dg-final { scan-assembler-times "vmrgow" 2 } } */
 
5394
--- a/src/gcc/testsuite/gcc.target/powerpc/bool2.h
 
5395
+++ b/src/gcc/testsuite/gcc.target/powerpc/bool2.h
 
5396
@@ -0,0 +1,29 @@
 
5397
+/* Test various logical operations.  */
 
5398
+
 
5399
+TYPE arg1 (TYPE p, TYPE q) { return p & q; }           /* AND  */
 
5400
+TYPE arg2 (TYPE p, TYPE q) { return p | q; }           /* OR   */
 
5401
+TYPE arg3 (TYPE p, TYPE q) { return p ^ q; }           /* XOR  */
 
5402
+TYPE arg4 (TYPE p)        { return ~ p; }              /* NOR  */
 
5403
+TYPE arg5 (TYPE p, TYPE q) { return ~(p & q); }                /* NAND */
 
5404
+TYPE arg6 (TYPE p, TYPE q) { return ~(p | q); }                /* NOR  */
 
5405
+TYPE arg7 (TYPE p, TYPE q) { return ~(p ^ q); }                /* EQV  */
 
5406
+TYPE arg8 (TYPE p, TYPE q) { return (~p) & q; }                /* ANDC */
 
5407
+TYPE arg9 (TYPE p, TYPE q) { return (~p) | q; }                /* ORC  */
 
5408
+TYPE arg10(TYPE p, TYPE q) { return (~p) ^ q; }                /* EQV  */
 
5409
+TYPE arg11(TYPE p, TYPE q) { return p & (~q); }                /* ANDC */
 
5410
+TYPE arg12(TYPE p, TYPE q) { return p | (~q); }                /* ORC  */
 
5411
+TYPE arg13(TYPE p, TYPE q) { return p ^ (~q); }                /* EQV  */
 
5412
+
 
5413
+void ptr1 (TYPE *p) { p[0] = p[1] & p[2]; }            /* AND  */
 
5414
+void ptr2 (TYPE *p) { p[0] = p[1] | p[2]; }            /* OR   */
 
5415
+void ptr3 (TYPE *p) { p[0] = p[1] ^ p[2]; }            /* XOR  */
 
5416
+void ptr4 (TYPE *p) { p[0] = ~p[1]; }                  /* NOR  */
 
5417
+void ptr5 (TYPE *p) { p[0] = ~(p[1] & p[2]); }         /* NAND */
 
5418
+void ptr6 (TYPE *p) { p[0] = ~(p[1] | p[2]); }         /* NOR  */
 
5419
+void ptr7 (TYPE *p) { p[0] = ~(p[1] ^ p[2]); }         /* EQV  */
 
5420
+void ptr8 (TYPE *p) { p[0] = ~(p[1]) & p[2]; }         /* ANDC */
 
5421
+void ptr9 (TYPE *p) { p[0] = (~p[1]) | p[2]; }         /* ORC  */
 
5422
+void ptr10(TYPE *p) { p[0] = (~p[1]) ^ p[2]; }         /* EQV  */
 
5423
+void ptr11(TYPE *p) { p[0] = p[1] & (~p[2]); }         /* ANDC */
 
5424
+void ptr12(TYPE *p) { p[0] = p[1] | (~p[2]); }         /* ORC  */
 
5425
+void ptr13(TYPE *p) { p[0] = p[1] ^ (~p[2]); }         /* EQV  */
 
5426
--- a/src/gcc/testsuite/gcc.target/powerpc/pr48258-1.c
 
5427
+++ b/src/gcc/testsuite/gcc.target/powerpc/pr48258-1.c
 
5428
@@ -1,5 +1,6 @@
 
5429
 /* { dg-do compile } */
 
5430
 /* { dg-skip-if "" { powerpc*-*-darwin* } { "*" } { "" } } */
 
5431
+/* { dg-skip-if "" { powerpc*le-*-* } { "*" } { "" } } */
 
5432
 /* { dg-require-effective-target powerpc_vsx_ok } */
 
5433
 /* { dg-options "-O3 -mcpu=power7 -mabi=altivec -ffast-math -fno-unroll-loops" } */
 
5434
 /* { dg-final { scan-assembler-times "xvaddsp" 3 } } */
 
5435
--- a/src/gcc/testsuite/gcc.target/powerpc/ppc64-abi-dfp-1.c
 
5436
+++ b/src/gcc/testsuite/gcc.target/powerpc/ppc64-abi-dfp-1.c
 
5437
@@ -33,15 +33,27 @@
 
5438
 
 
5439
 
 
5440
 /* Wrapper to save the GPRs and FPRs and then jump to the real function.  */
 
5441
+#if _CALL_ELF != 2
 
5442
+#define FUNC_START(NAME)                                               \
 
5443
+       "\t.globl\t" NAME "\n\t"                                        \
 
5444
+         ".section \".opd\",\"aw\"\n\t"                                        \
 
5445
+         ".align 3\n"                                                  \
 
5446
+         NAME ":\n\t"                                                  \
 
5447
+         ".quad .L." NAME ",.TOC.@tocbase,0\n\t"                       \
 
5448
+         ".text\n\t"                                                   \
 
5449
+         ".type " NAME ", @function\n"                                 \
 
5450
+         ".L." NAME ":\n\t"
 
5451
+#else
 
5452
+#define FUNC_START(NAME)                                               \
 
5453
+       "\t.globl\t" NAME "\n\t"                                        \
 
5454
+         ".text\n\t"                                                   \
 
5455
+         NAME ":\n"                                                    \
 
5456
+       "0:\taddis 2,12,(.TOC.-0b)@ha\n\t"                              \
 
5457
+       "addi 2,2,(.TOC.-0b)@l\n\t"                                     \
 
5458
+       ".localentry " NAME ",.-" NAME "\n\t"
 
5459
+#endif
 
5460
 #define WRAPPER(NAME)                                                  \
 
5461
-__asm__ ("\t.globl\t" #NAME "_asm\n\t"                                 \
 
5462
-        ".section \".opd\",\"aw\"\n\t"                                 \
 
5463
-        ".align 3\n"                                                   \
 
5464
-        #NAME "_asm:\n\t"                                              \
 
5465
-        ".quad .L." #NAME "_asm,.TOC.@tocbase,0\n\t"                   \
 
5466
-        ".text\n\t"                                                    \
 
5467
-        ".type " #NAME "_asm, @function\n"                             \
 
5468
-        ".L." #NAME "_asm:\n\t"                                        \
 
5469
+__asm__ (FUNC_START (#NAME "_asm")                                     \
 
5470
         "ld 11,gparms@got(2)\n\t"                                      \
 
5471
         "std 3,0(11)\n\t"                                              \
 
5472
         "std 4,8(11)\n\t"                                              \
 
5473
@@ -75,8 +87,10 @@
 
5474
   long a1;
 
5475
   long a2;
 
5476
   long a3;
 
5477
+#if _CALL_ELF != 2
 
5478
   long a4;
 
5479
   long a5;
 
5480
+#endif
 
5481
   unsigned long slot[100];
 
5482
 } stack_frame_t;
 
5483
 
 
5484
--- a/src/gcc/testsuite/gcc.target/powerpc/direct-move-long2.c
 
5485
+++ b/src/gcc/testsuite/gcc.target/powerpc/direct-move-long2.c
 
5486
@@ -0,0 +1,15 @@
 
5487
+/* { dg-do run { target { powerpc*-*-linux* && lp64 } } } */
 
5488
+/* { dg-skip-if "" { powerpc*-*-darwin* } { "*" } { "" } } */
 
5489
+/* { dg-skip-if "" { powerpc*-*-*spe* } { "*" } { "" } } */
 
5490
+/* { dg-require-effective-target p8vector_hw } */
 
5491
+/* { dg-options "-mcpu=power8 -O2" } */
 
5492
+
 
5493
+/* Check whether we get the right bits for direct move at runtime.  */
 
5494
+
 
5495
+#define TYPE long
 
5496
+#define IS_INT 1
 
5497
+#define NO_ALTIVEC 1
 
5498
+#define DO_MAIN
 
5499
+#define VSX_REG_ATTR "d"
 
5500
+
 
5501
+#include "direct-move.h"
 
5502
--- a/src/gcc/testsuite/gcc.target/powerpc/vsx-float0.c
 
5503
+++ b/src/gcc/testsuite/gcc.target/powerpc/vsx-float0.c
 
5504
@@ -0,0 +1,16 @@
 
5505
+/* { dg-do compile { target { powerpc*-*-* } } } */
 
5506
+/* { dg-skip-if "" { powerpc*-*-darwin* } { "*" } { "" } } */
 
5507
+/* { dg-require-effective-target powerpc_vsx_ok } */
 
5508
+/* { dg-options "-O2 -mcpu=power7" } */
 
5509
+/* { dg-final { scan-assembler "xxlxor" } } */
 
5510
+
 
5511
+/* Test that we generate xxlor to clear a SFmode register.  */
 
5512
+
 
5513
+float sum (float *p, unsigned long n)
 
5514
+{
 
5515
+  float sum = 0.0f;    /* generate xxlxor instead of load */
 
5516
+  while (n-- > 0)
 
5517
+    sum += *p++;
 
5518
+
 
5519
+  return sum;
 
5520
+}
 
5521
--- a/src/gcc/testsuite/gcc.target/powerpc/ppc-target-1.c
 
5522
+++ b/src/gcc/testsuite/gcc.target/powerpc/ppc-target-1.c
 
5523
@@ -5,8 +5,7 @@
 
5524
 /* { dg-final { scan-assembler-times "fabs" 3 } } */
 
5525
 /* { dg-final { scan-assembler-times "fnabs" 3 } } */
 
5526
 /* { dg-final { scan-assembler-times "fsel" 3 } } */
 
5527
-/* { dg-final { scan-assembler-times "fcpsgn" 3 } } */
 
5528
-/* { dg-final { scan-assembler-times "xscpsgndp" 1 } } */
 
5529
+/* { dg-final { scan-assembler-times "fcpsgn\|xscpsgndp" 4 } } */
 
5530
 
 
5531
 double normal1 (double, double);
 
5532
 double power5  (double, double) __attribute__((__target__("cpu=power5")));
 
5533
--- a/src/gcc/testsuite/gcc.target/powerpc/bool3.h
 
5534
+++ b/src/gcc/testsuite/gcc.target/powerpc/bool3.h
 
5535
@@ -0,0 +1,186 @@
 
5536
+/* Test forcing 128-bit logical types into GPR registers.  */
 
5537
+
 
5538
+#if defined(NO_ASM)
 
5539
+#define FORCE_REG1(X)
 
5540
+#define FORCE_REG2(X,Y)
 
5541
+
 
5542
+#else
 
5543
+#if defined(USE_ALTIVEC)
 
5544
+#define REG_CLASS "+v"
 
5545
+#define PRINT_REG1 "# altivec reg %0"
 
5546
+#define PRINT_REG2 "# altivec reg %0, %1"
 
5547
+
 
5548
+#elif defined(USE_FPR)
 
5549
+#define REG_CLASS "+d"
 
5550
+#define PRINT_REG1 "# fpr reg %0"
 
5551
+#define PRINT_REG2 "# fpr reg %0, %1"
 
5552
+
 
5553
+#elif defined(USE_VSX)
 
5554
+#define REG_CLASS "+wa"
 
5555
+#define PRINT_REG1 "# vsx reg %x0"
 
5556
+#define PRINT_REG2 "# vsx reg %x0, %x1"
 
5557
+
 
5558
+#else
 
5559
+#define REG_CLASS "+r"
 
5560
+#define PRINT_REG1 "# gpr reg %0"
 
5561
+#define PRINT_REG2 "# gpr reg %0, %1"
 
5562
+#endif
 
5563
+
 
5564
+#define FORCE_REG1(X) __asm__ (PRINT_REG1 : REG_CLASS (X))
 
5565
+#define FORCE_REG2(X,Y) __asm__ (PRINT_REG2 : REG_CLASS (X), REG_CLASS (Y))
 
5566
+#endif
 
5567
+
 
5568
+void ptr1 (TYPE *p)
 
5569
+{
 
5570
+  TYPE a = p[1];
 
5571
+  TYPE b = p[2];
 
5572
+  TYPE c;
 
5573
+
 
5574
+  FORCE_REG2 (a, b);
 
5575
+  c = a & b;                                   /* AND */
 
5576
+  FORCE_REG1 (c);
 
5577
+  p[0] = c;
 
5578
+}
 
5579
+
 
5580
+void ptr2 (TYPE *p)
 
5581
+{
 
5582
+  TYPE a = p[1];
 
5583
+  TYPE b = p[2];
 
5584
+  TYPE c;
 
5585
+
 
5586
+  FORCE_REG2 (a, b);
 
5587
+  c = a | b;                                   /* OR */
 
5588
+  FORCE_REG1 (c);
 
5589
+  p[0] = c;
 
5590
+}
 
5591
+
 
5592
+void ptr3 (TYPE *p)
 
5593
+{
 
5594
+  TYPE a = p[1];
 
5595
+  TYPE b = p[2];
 
5596
+  TYPE c;
 
5597
+
 
5598
+  FORCE_REG2 (a, b);
 
5599
+  c = a ^ b;                                   /* XOR */
 
5600
+  FORCE_REG1 (c);
 
5601
+  p[0] = c;
 
5602
+}
 
5603
+
 
5604
+void ptr4 (TYPE *p)
 
5605
+{
 
5606
+  TYPE a = p[1];
 
5607
+  TYPE b;
 
5608
+
 
5609
+  FORCE_REG1 (a);
 
5610
+  b = ~a;                                      /* NOR */
 
5611
+  FORCE_REG1 (b);
 
5612
+  p[0] = b;
 
5613
+}
 
5614
+
 
5615
+void ptr5 (TYPE *p)
 
5616
+{
 
5617
+  TYPE a = p[1];
 
5618
+  TYPE b = p[2];
 
5619
+  TYPE c;
 
5620
+
 
5621
+  FORCE_REG2 (a, b);
 
5622
+  c = ~(a & b);                                           /* NAND */
 
5623
+  FORCE_REG1 (c);
 
5624
+  p[0] = c;
 
5625
+}
 
5626
+
 
5627
+void ptr6 (TYPE *p)
 
5628
+{
 
5629
+  TYPE a = p[1];
 
5630
+  TYPE b = p[2];
 
5631
+  TYPE c;
 
5632
+
 
5633
+  FORCE_REG2 (a, b);
 
5634
+  c = ~(a | b);                                           /* AND */
 
5635
+  FORCE_REG1 (c);
 
5636
+  p[0] = c;
 
5637
+}
 
5638
+
 
5639
+void ptr7 (TYPE *p)
 
5640
+{
 
5641
+  TYPE a = p[1];
 
5642
+  TYPE b = p[2];
 
5643
+  TYPE c;
 
5644
+
 
5645
+  FORCE_REG2 (a, b);
 
5646
+  c = ~(a ^ b);                                           /* EQV */
 
5647
+  FORCE_REG1 (c);
 
5648
+  p[0] = c;
 
5649
+}
 
5650
+
 
5651
+void ptr8 (TYPE *p)
 
5652
+{
 
5653
+  TYPE a = p[1];
 
5654
+  TYPE b = p[2];
 
5655
+  TYPE c;
 
5656
+
 
5657
+  FORCE_REG2 (a, b);
 
5658
+  c = (~a) & b;                                           /* ANDC */
 
5659
+  FORCE_REG1 (c);
 
5660
+  p[0] = c;
 
5661
+}
 
5662
+
 
5663
+void ptr9 (TYPE *p)
 
5664
+{
 
5665
+  TYPE a = p[1];
 
5666
+  TYPE b = p[2];
 
5667
+  TYPE c;
 
5668
+
 
5669
+  FORCE_REG2 (a, b);
 
5670
+  c = (~a) | b;                                           /* ORC */
 
5671
+  FORCE_REG1 (c);
 
5672
+  p[0] = c;
 
5673
+}
 
5674
+
 
5675
+void ptr10 (TYPE *p)
 
5676
+{
 
5677
+  TYPE a = p[1];
 
5678
+  TYPE b = p[2];
 
5679
+  TYPE c;
 
5680
+
 
5681
+  FORCE_REG2 (a, b);
 
5682
+  c = (~a) ^ b;                                           /* EQV */
 
5683
+  FORCE_REG1 (c);
 
5684
+  p[0] = c;
 
5685
+}
 
5686
+
 
5687
+void ptr11 (TYPE *p)
 
5688
+{
 
5689
+  TYPE a = p[1];
 
5690
+  TYPE b = p[2];
 
5691
+  TYPE c;
 
5692
+
 
5693
+  FORCE_REG2 (a, b);
 
5694
+  c = a & (~b);                                           /* ANDC */
 
5695
+  FORCE_REG1 (c);
 
5696
+  p[0] = c;
 
5697
+}
 
5698
+
 
5699
+void ptr12 (TYPE *p)
 
5700
+{
 
5701
+  TYPE a = p[1];
 
5702
+  TYPE b = p[2];
 
5703
+  TYPE c;
 
5704
+
 
5705
+  FORCE_REG2 (a, b);
 
5706
+  c = a | (~b);                                           /* ORC */
 
5707
+  FORCE_REG1 (c);
 
5708
+  p[0] = c;
 
5709
+}
 
5710
+
 
5711
+void ptr13 (TYPE *p)
 
5712
+{
 
5713
+  TYPE a = p[1];
 
5714
+  TYPE b = p[2];
 
5715
+  TYPE c;
 
5716
+
 
5717
+  FORCE_REG2 (a, b);
 
5718
+  c = a ^ (~b);                                           /* AND */
 
5719
+  FORCE_REG1 (c);
 
5720
+  p[0] = c;
 
5721
+}
 
5722
--- a/src/gcc/testsuite/gcc.target/powerpc/altivec-perm-1.c
 
5723
+++ b/src/gcc/testsuite/gcc.target/powerpc/altivec-perm-1.c
 
5724
@@ -19,19 +19,6 @@
 
5725
   return __builtin_shuffle(x, (V){ 4,5,6,7, 4,5,6,7, 4,5,6,7, 4,5,6,7, });
 
5726
 }
 
5727
 
 
5728
-V p2(V x, V y)
 
5729
-{
 
5730
-  return __builtin_shuffle(x, y,
 
5731
-       (V){ 1,  3,  5,  7,  9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29, 31 });
 
5732
-
 
5733
-}
 
5734
-
 
5735
-V p4(V x, V y)
 
5736
-{
 
5737
-  return __builtin_shuffle(x, y,
 
5738
-       (V){ 2,  3,  6,  7, 10, 11, 14, 15, 18, 19, 22, 23, 26, 27, 30, 31 });
 
5739
-}
 
5740
-
 
5741
 V h1(V x, V y)
 
5742
 {
 
5743
   return __builtin_shuffle(x, y,
 
5744
@@ -72,5 +59,3 @@
 
5745
 /* { dg-final { scan-assembler "vspltb" } } */
 
5746
 /* { dg-final { scan-assembler "vsplth" } } */
 
5747
 /* { dg-final { scan-assembler "vspltw" } } */
 
5748
-/* { dg-final { scan-assembler "vpkuhum" } } */
 
5749
-/* { dg-final { scan-assembler "vpkuwum" } } */
 
5750
--- a/src/gcc/testsuite/gcc.target/powerpc/bool2-p7.c
 
5751
+++ b/src/gcc/testsuite/gcc.target/powerpc/bool2-p7.c
 
5752
@@ -0,0 +1,31 @@
 
5753
+/* { dg-do compile { target { powerpc*-*-* } } } */
 
5754
+/* { dg-skip-if "" { powerpc*-*-darwin* } { "*" } { "" } } */
 
5755
+/* { dg-require-effective-target powerpc_vsx_ok } */
 
5756
+/* { dg-options "-O2 -mcpu=power7" } */
 
5757
+/* { dg-final { scan-assembler-not "\[ \t\]and "     } } */
 
5758
+/* { dg-final { scan-assembler-not "\[ \t\]or "      } } */
 
5759
+/* { dg-final { scan-assembler-not "\[ \t\]xor "     } } */
 
5760
+/* { dg-final { scan-assembler-not "\[ \t\]nor "     } } */
 
5761
+/* { dg-final { scan-assembler-not "\[ \t\]eqv "     } } */
 
5762
+/* { dg-final { scan-assembler-not "\[ \t\]andc "    } } */
 
5763
+/* { dg-final { scan-assembler-not "\[ \t\]orc "     } } */
 
5764
+/* { dg-final { scan-assembler-not "\[ \t\]nand "    } } */
 
5765
+/* { dg-final { scan-assembler-not "\[ \t\]vand "    } } */
 
5766
+/* { dg-final { scan-assembler-not "\[ \t\]vor "     } } */
 
5767
+/* { dg-final { scan-assembler-not "\[ \t\]vxor "    } } */
 
5768
+/* { dg-final { scan-assembler-not "\[ \t\]vnor "    } } */
 
5769
+/* { dg-final { scan-assembler     "\[ \t\]xxland "  } } */
 
5770
+/* { dg-final { scan-assembler     "\[ \t\]xxlor "   } } */
 
5771
+/* { dg-final { scan-assembler     "\[ \t\]xxlxor "  } } */
 
5772
+/* { dg-final { scan-assembler     "\[ \t\]xxlnor "  } } */
 
5773
+/* { dg-final { scan-assembler     "\[ \t\]xxlandc " } } */
 
5774
+/* { dg-final { scan-assembler-not "\[ \t\]xxleqv "  } } */
 
5775
+/* { dg-final { scan-assembler-not "\[ \t\]xxlorc "  } } */
 
5776
+/* { dg-final { scan-assembler-not "\[ \t\]xxlnand " } } */
 
5777
+
 
5778
+#ifndef TYPE
 
5779
+typedef int v4si __attribute__ ((vector_size (16)));
 
5780
+#define TYPE v4si
 
5781
+#endif
 
5782
+
 
5783
+#include "bool2.h"
 
5784
--- a/src/gcc/testsuite/ChangeLog.ibm
 
5785
+++ b/src/gcc/testsuite/ChangeLog.ibm
 
5786
@@ -0,0 +1,389 @@
 
5787
+2013-11-22  Michael Meissner  <meissner@linux.vnet.ibm.com>
 
5788
+
 
5789
+       Backport from mainline
 
5790
+       2013-11-22  Michael Meissner  <meissner@linux.vnet.ibm.com>
 
5791
+
 
5792
+       PR target/59054
 
5793
+       * gcc.target/powerpc/direct-move.h (VSX_REG_ATTR): Allow test to
 
5794
+       specify an appropriate register class for VSX operations.
 
5795
+       (load_vsx): Use it.
 
5796
+       (load_gpr_to_vsx): Likewise.
 
5797
+       (load_vsx_to_gpr): Likewise.
 
5798
+       * gcc.target/powerpc/direct-move-vint1.c: Use an appropriate
 
5799
+       register class for VSX registers that the type can handle.  Remove
 
5800
+       checks for explicit number of instructions generated, just check
 
5801
+       if the instruction is generated.
 
5802
+       * gcc.target/powerpc/direct-move-vint2.c: Likewise.
 
5803
+       * gcc.target/powerpc/direct-move-float1.c: Likewise.
 
5804
+       * gcc.target/powerpc/direct-move-float2.c: Likewise.
 
5805
+       * gcc.target/powerpc/direct-move-double1.c: Likewise.
 
5806
+       * gcc.target/powerpc/direct-move-double2.c: Likewise.
 
5807
+       * gcc.target/powerpc/direct-move-long1.c: Likewise.
 
5808
+       * gcc.target/powerpc/direct-move-long2.c: Likewise.
 
5809
+
 
5810
+       * gcc.target/powerpc/bool3-av.c: Limit to 64-bit mode for now.
 
5811
+       * gcc.target/powerpc/bool3-p7.c: Likewise.
 
5812
+       * gcc.target/powerpc/bool3-p8.c: Likewise.
 
5813
+
 
5814
+       * gcc.target/powerpc/p8vector-ldst.c: Just check that the
 
5815
+       appropriate instructions are generated, don't check the count.
 
5816
+
 
5817
+       2013-11-12  Michael Meissner  <meissner@linux.vnet.ibm.com>
 
5818
+
 
5819
+       PR target/59054
 
5820
+       * gcc.target/powerpc/pr59054.c: New test.
 
5821
+
 
5822
+2013-11-20  Bill Schmidt  <wschmidt@linux.vnet.ibm.com>
 
5823
+
 
5824
+       Backport from mainline r205146
 
5825
+       2013-11-20  Bill Schmidt  <wschmidt@linux.vnet.ibm.com>
 
5826
+
 
5827
+       * gcc.target/powerpc/pr48258-1.c: Skip for little endian.
 
5828
+
 
5829
+2013-11-20  Ulrich Weigand  <Ulrich.Weigand@de.ibm.com>
 
5830
+
 
5831
+       Backport from mainline r205106:
 
5832
+
 
5833
+       2013-11-20  Ulrich Weigand  <Ulrich.Weigand@de.ibm.com>
 
5834
+
 
5835
+       * gcc.target/powerpc/darwin-longlong.c (msw): Make endian-safe.
 
5836
+
 
5837
+2013-11-19  Ulrich Weigand  <Ulrich.Weigand@de.ibm.com>
 
5838
+
 
5839
+       Backport from mainline r205046:
 
5840
+
 
5841
+       2013-11-19  Ulrich Weigand  <Ulrich.Weigand@de.ibm.com>
 
5842
+
 
5843
+       * gcc.target/powerpc/ppc64-abi-2.c (MAKE_SLOT): New macro to
 
5844
+       construct parameter slot value in endian-independent way.
 
5845
+       (fcevv, fciievv, fcvevv): Use it.
 
5846
+
 
5847
+2013-11-15  Bill Schmidt  <wschmidt@linux.vnet.ibm.com>
 
5848
+
 
5849
+       Backport from mainline r204862
 
5850
+       2013-11-15  Bill Schmidt  <wschmidt@linux.vnet.ibm.com>
 
5851
+
 
5852
+       * gcc.dg/vmx/3b-15.c: Revise for little endian.
 
5853
+
 
5854
+2013-11-15  Ulrich Weigand  <Ulrich.Weigand@de.ibm.com>
 
5855
+
 
5856
+       Backport from mainline r204808:
 
5857
+
 
5858
+       2013-11-14  Ulrich Weigand  <Ulrich.Weigand@de.ibm.com>
 
5859
+
 
5860
+       * gcc.target/powerpc/ppc64-abi-1.c (stack_frame_t): Remove
 
5861
+       compiler and linker field if _CALL_ELF == 2.
 
5862
+       * gcc.target/powerpc/ppc64-abi-2.c (stack_frame_t): Likewise.
 
5863
+       * gcc.target/powerpc/ppc64-abi-dfp-1.c (stack_frame_t): Likewise.
 
5864
+       * gcc.dg/stack-usage-1.c (SIZE): Update value for _CALL_ELF == 2.
 
5865
+
 
5866
+       2013-11-14  Ulrich Weigand  <Ulrich.Weigand@de.ibm.com>
 
5867
+
 
5868
+       * gcc.target/powerpc/ppc64-abi-dfp-1.c (FUNC_START): New macro.
 
5869
+       (WRAPPER): Use it.
 
5870
+       * gcc.target/powerpc/no-r11-1.c: Skip on powerpc_elfv2.
 
5871
+       * gcc.target/powerpc/no-r11-2.c: Skip on powerpc_elfv2.
 
5872
+       * gcc.target/powerpc/no-r11-3.c: Skip on powerpc_elfv2.
 
5873
+
 
5874
+       2013-11-14  Ulrich Weigand  <Ulrich.Weigand@de.ibm.com>
 
5875
+
 
5876
+       * lib/target-supports.exp (check_effective_target_powerpc_elfv2):
 
5877
+       New function.
 
5878
+       * gcc.target/powerpc/pr57949-1.c: Disable for powerpc_elfv2.
 
5879
+       * gcc.target/powerpc/pr57949-2.c: Likewise.
 
5880
+
 
5881
+2013-11-15  Ulrich Weigand  <Ulrich.Weigand@de.ibm.com>
 
5882
+
 
5883
+       Backport from mainline r204799:
 
5884
+
 
5885
+       2013-11-14  Ulrich Weigand  <Ulrich.Weigand@de.ibm.com>
 
5886
+
 
5887
+       * g++.dg/eh/ppc64-sighandle-cr.C: New test.
 
5888
+
 
5889
+2013-11-15  Ulrich Weigand  <Ulrich.Weigand@de.ibm.com>
 
5890
+
 
5891
+       Backport from mainline r201750.
 
5892
+       Note: Default setting of -mcompat-align-parm inverted!
 
5893
+
 
5894
+       2013-08-14  Bill Schmidt  <wschmidt@linux.vnet.ibm.com>
 
5895
+
 
5896
+       PR target/57949
 
5897
+       * gcc.target/powerpc/pr57949-1.c: New.
 
5898
+       * gcc.target/powerpc/pr57949-2.c: New.
 
5899
+
 
5900
+2013-11-15  Ulrich Weigand  <Ulrich.Weigand@de.ibm.com>
 
5901
+
 
5902
+       Backport from mainline r201040 and r201929:
 
5903
+
 
5904
+       2013-08-22  Michael Meissner  <meissner@linux.vnet.ibm.com>
 
5905
+
 
5906
+       * gcc.target/powerpc/pr57744.c: Declare abort.
 
5907
+
 
5908
+       2013-07-18  Pat Haugen  <pthaugen@us.ibm.com>
 
5909
+
 
5910
+       * gcc.target/powerpc/pr57744.c: Fix typo.
 
5911
+
 
5912
+2013-11-10  Bill Schmidt  <wschmidt@linux.vnet.ibm.com>
 
5913
+
 
5914
+       Backport from mainline r204321
 
5915
+       2013-11-02  Bill Schmidt  <wschmidt@vnet.linux.ibm.com>
 
5916
+
 
5917
+       * gcc.dg/vmx/vec-set.c: New.
 
5918
+
 
5919
+2013-11-10  Bill Schmidt  <wschmidt@linux.vnet.ibm.com>
 
5920
+
 
5921
+       Backport from mainline r204138
 
5922
+       2013-10-28  Bill Schmidt  <wschmidt@linux.vnet.ibm.com>
 
5923
+
 
5924
+       * gcc.dg/vmx/gcc-bug-i.c: Add little endian variant.
 
5925
+       * gcc.dg/vmx/eg-5.c: Likewise.
 
5926
+
 
5927
+2013-11-08  Bill Schmidt  <wschmidt@linux.vnet.ibm.com>
 
5928
+
 
5929
+       Backport from mainline r203930
 
5930
+       2013-10-22  Bill Schmidt  <wschmidt@vnet.ibm.com>
 
5931
+
 
5932
+       * gcc.target/powerpc/altivec-perm-1.c: Move the two vector pack
 
5933
+       tests into...
 
5934
+       * gcc.target/powerpc/altivec-perm-3.c: ...this new test, which is
 
5935
+       restricted to big-endian targets.
 
5936
+
 
5937
+2013-11-08  Bill Schmidt  <wschmidt@linux.vnet.ibm.com>
 
5938
+
 
5939
+       Backport from mainline r203246
 
5940
+       2013-10-07  Bill Schmidt  <wschmidt@linux.vnet.ibm.com>
 
5941
+
 
5942
+       * gcc.target/powerpc/pr43154.c: Skip for ppc64 little endian.
 
5943
+       * gcc.target/powerpc/fusion.c: Likewise.
 
5944
+
 
5945
+2013-10-21  Bill Schmidt  <wschmidt@linux.vnet.ibm.com>
 
5946
+
 
5947
+       Backport from mainline
 
5948
+       2013-04-05  Bill Schmidt  <wschmidt@linux.vnet.ibm.com>
 
5949
+
 
5950
+       PR target/56843
 
5951
+       * gcc.target/powerpc/recip-1.c: Modify expected output.
 
5952
+       * gcc.target/powerpc/recip-3.c: Likewise.
 
5953
+       * gcc.target/powerpc/recip-4.c: Likewise.
 
5954
+       * gcc.target/powerpc/recip-5.c: Add expected output for iterations.
 
5955
+
 
5956
+2013-10-17  Michael Meissner  <meissner@linux.vnet.ibm.com>
 
5957
+
 
5958
+       Back port from mainline
 
5959
+       2013-10-03  Michael Meissner  <meissner@linux.vnet.ibm.com>
 
5960
+
 
5961
+       * gcc.target/powerpc/p8vector-fp.c: New test for floating point
 
5962
+       scalar operations when using -mupper-regs-sf and -mupper-regs-df.
 
5963
+       * gcc.target/powerpc/ppc-target-1.c: Update tests to allow either
 
5964
+       VSX scalar operations or the traditional floating point form of
 
5965
+       the instruction.
 
5966
+       * gcc.target/powerpc/ppc-target-2.c: Likewise.
 
5967
+       * gcc.target/powerpc/recip-3.c: Likewise.
 
5968
+       * gcc.target/powerpc/recip-5.c: Likewise.
 
5969
+       * gcc.target/powerpc/pr72747.c: Likewise.
 
5970
+       * gcc.target/powerpc/vsx-builtin-3.c: Likewise.
 
5971
+
 
5972
+       Back port from mainline
 
5973
+       2013-09-27  Michael Meissner  <meissner@linux.vnet.ibm.com>
 
5974
+
 
5975
+       * gcc.target/powerpc/p8vector-ldst.c: New test for -mupper-regs-sf
 
5976
+       and -mupper-regs-df.
 
5977
+
 
5978
+       Back port from mainline
 
5979
+       2013-10-17  Michael Meissner  <meissner@linux.vnet.ibm.com>
 
5980
+
 
5981
+       PR target/58673
 
5982
+       * gcc.target/powerpc/pr58673-1.c: New file to test whether
 
5983
+       -mquad-word + -mno-vsx-timode causes errors.
 
5984
+       * gcc.target/powerpc/pr58673-2.c: Likewise.
 
5985
+
 
5986
+2013-08-19  Peter Bergner  <bergner@vnet.ibm.com>
 
5987
+
 
5988
+       Back port from mainline
 
5989
+       2013-08-19  Peter Bergner  <bergner@vnet.ibm.com>
 
5990
+
 
5991
+       * gcc.target/powerpc/dfp-dd-2.c: New test.
 
5992
+       * gcc.target/powerpc/dfp-td-2.c: Likewise.
 
5993
+       * gcc.target/powerpc/dfp-td-3.c: Likewise.
 
5994
+
 
5995
+2013-08-16  Michael Meissner  <meissner@linux.vnet.ibm.com>
 
5996
+
 
5997
+       Backport from trunk.
 
5998
+       2013-07-23  Michael Meissner  <meissner@linux.vnet.ibm.com>
 
5999
+
 
6000
+       * gcc.target/powerpc/bool2.h: New file, test the code generation
 
6001
+       of logical operations for power5, altivec, power7, and power8 systems.
 
6002
+       * gcc.target/powerpc/bool2-p5.c: Likewise.
 
6003
+       * gcc.target/powerpc/bool2-av.c: Likewise.
 
6004
+       * gcc.target/powerpc/bool2-p7.c: Likewise.
 
6005
+       * gcc.target/powerpc/bool2-p8.c: Likewise.
 
6006
+       * gcc.target/powerpc/bool3.h: Likewise.
 
6007
+       * gcc.target/powerpc/bool3-av.c: Likewise.
 
6008
+       * gcc.target/powerpc/bool2-p7.c: Likewise.
 
6009
+       * gcc.target/powerpc/bool2-p8.c: Likewise.
 
6010
+
 
6011
+2013-08-16  Michael Meissner  <meissner@linux.vnet.ibm.com>
 
6012
+
 
6013
+       Backport from trunk.
 
6014
+       2013-07-31  Michael Meissner  <meissner@linux.vnet.ibm.com>
 
6015
+
 
6016
+       * gcc.target/powerpc/fusion.c: New file, test power8 fusion support.
 
6017
+
 
6018
+2013-08-05  Michael Meissner  <meissner@linux.vnet.ibm.com>
 
6019
+
 
6020
+       Back port from mainline:
 
6021
+       2013-06-06  Michael Meissner  <meissner@linux.vnet.ibm.com>
 
6022
+                   Pat Haugen <pthaugen@us.ibm.com>
 
6023
+                   Peter Bergner <bergner@vnet.ibm.com>
 
6024
+
 
6025
+       * lib/target-supports.exp (check_p8vector_hw_available) Add power8
 
6026
+       support.
 
6027
+       (check_effective_target_powerpc_p8vector_ok): Likewise.
 
6028
+       (is-effective-target): Likewise.
 
6029
+       (check_vect_support_and_set_flags): Likewise.
 
6030
+
 
6031
+2013-08-04  Peter Bergner  <bergner@vnet.ibm.com>
 
6032
+
 
6033
+       Back port from mainline
 
6034
+       2013-08-01  Fabien Chêne  <fabien@gcc.gnu.org>
 
6035
+                   Peter Bergner  <bergner@vnet.ibm.com>
 
6036
+
 
6037
+       PR c++/54537
 
6038
+       * g++.dg/overload/using3.C: New.
 
6039
+       * g++.dg/overload/using2.C: Adjust.
 
6040
+       * g++.dg/lookup/using9.C: Likewise.
 
6041
+
 
6042
+2013-07-31  Michael Meissner  <meissner@linux.vnet.ibm.com>
 
6043
+
 
6044
+       Back port from mainline
 
6045
+       2013-07-31  Michael Meissner  <meissner@linux.vnet.ibm.com>
 
6046
+
 
6047
+       * gcc.target/powerpc/fusion.c: New file, test power8 fusion
 
6048
+       support.
 
6049
+
 
6050
+2013-07-15  Peter Bergner  <bergner@vnet.ibm.com>
 
6051
+
 
6052
+       Back port from mainline
 
6053
+       2013-07-15  Peter Bergner  <bergner@vnet.ibm.com>
 
6054
+
 
6055
+        * lib/target-supports.exp (check_effective_target_powerpc_htm_ok): New
 
6056
+        function to test if HTM is available.
 
6057
+       * gcc.target/powerpc/htm-xl-intrin-1.c: New test.
 
6058
+       * gcc.target/powerpc/htm-builtin-1.c: New test.
 
6059
+
 
6060
+2013-06-28  Michael Meissner  <meissner@linux.vnet.ibm.com>
 
6061
+
 
6062
+       Back port from the trunk
 
6063
+       2013-06-28  Michael Meissner  <meissner@linux.vnet.ibm.com>
 
6064
+
 
6065
+       PR target/57744
 
6066
+       * gcc.target/powerpc/pr57744.c: New test to make sure lqarx and
 
6067
+       stqcx. get even registers.
 
6068
+
 
6069
+2013-06-12  Michael Meissner  <meissner@linux.vnet.ibm.com>
 
6070
+
 
6071
+       Back port from the trunk
 
6072
+
 
6073
+       2013-06-12  Michael Meissner  <meissner@linux.vnet.ibm.com>
 
6074
+                   Pat Haugen <pthaugen@us.ibm.com>
 
6075
+                   Peter Bergner <bergner@vnet.ibm.com>
 
6076
+
 
6077
+       * gcc.target/powerpc/atomic-p7.c: New file, add tests for atomic
 
6078
+       load/store instructions on power7, power8.
 
6079
+       * gcc.target/powerpc/atomic-p8.c: Likewise.
 
6080
+
 
6081
+2013-06-11  Michael Meissner  <meissner@linux.vnet.ibm.com>
 
6082
+
 
6083
+       Back port from the trunk
 
6084
+
 
6085
+       2013-06-11  Michael Meissner  <meissner@linux.vnet.ibm.com>
 
6086
+                   Pat Haugen <pthaugen@us.ibm.com>
 
6087
+                   Peter Bergner <bergner@vnet.ibm.com>
 
6088
+
 
6089
+       * gcc.target/powerpc/atomic-p7.c: New file, add tests for atomic
 
6090
+       load/store instructions on power7, power8.
 
6091
+       * gcc.target/powerpc/atomic-p8.c: Likewise.
 
6092
+
 
6093
+       Back port from the trunk
 
6094
+
 
6095
+       2013-06-10  Michael Meissner  <meissner@linux.vnet.ibm.com>
 
6096
+                   Pat Haugen <pthaugen@us.ibm.com>
 
6097
+                   Peter Bergner <bergner@vnet.ibm.com>
 
6098
+
 
6099
+       * gcc.target/powerpc/direct-move-vint1.c: New tests for power8
 
6100
+       direct move instructions.
 
6101
+       * gcc.target/powerpc/direct-move-vint2.c: Likewise.
 
6102
+       * gcc.target/powerpc/direct-move.h: Likewise.
 
6103
+       * gcc.target/powerpc/direct-move-float1.c: Likewise.
 
6104
+       * gcc.target/powerpc/direct-move-float2.c: Likewise.
 
6105
+       * gcc.target/powerpc/direct-move-double1.c: Likewise.
 
6106
+       * gcc.target/powerpc/direct-move-double2.c: Likewise.
 
6107
+       * gcc.target/powerpc/direct-move-long1.c: Likewise.
 
6108
+       * gcc.target/powerpc/direct-move-long2.c: Likewise.
 
6109
+
 
6110
+2013-06-06  Michael Meissner  <meissner@linux.vnet.ibm.com>
 
6111
+
 
6112
+       Backport from the trunk
 
6113
+
 
6114
+       2013-06-06  Michael Meissner  <meissner@linux.vnet.ibm.com>
 
6115
+                   Pat Haugen <pthaugen@us.ibm.com>
 
6116
+                   Peter Bergner <bergner@vnet.ibm.com>
 
6117
+
 
6118
+       * gcc.target/powerpc/p8vector-builtin-1.c: New test to test
 
6119
+       power8 builtin functions.
 
6120
+       * gcc/testsuite/gcc.target/powerpc/p8vector-builtin-2.c: Likewise.
 
6121
+       * gcc/testsuite/gcc.target/powerpc/p8vector-builtin-3.c: Likewise.
 
6122
+       * gcc/testsuite/gcc.target/powerpc/p8vector-builtin-4.c: Likewise.
 
6123
+       * gcc/testsuite/gcc.target/powerpc/p8vector-builtin-5.c: Likewise.
 
6124
+       * gcc/testsuite/gcc.target/powerpc/p8vector-builtin-6.c: Likewise.
 
6125
+       * gcc/testsuite/gcc.target/powerpc/p8vector-builtin-7.c: Likewise.
 
6126
+       * gcc/testsuite/gcc.target/powerpc/p8vector-vectorize-1.c: New
 
6127
+       tests to test power8 auto-vectorization.
 
6128
+       * gcc/testsuite/gcc.target/powerpc/p8vector-vectorize-2.c: Likewise.
 
6129
+       * gcc/testsuite/gcc.target/powerpc/p8vector-vectorize-3.c: Likewise.
 
6130
+       * gcc/testsuite/gcc.target/powerpc/p8vector-vectorize-4.c: Likewise.
 
6131
+       * gcc/testsuite/gcc.target/powerpc/p8vector-vectorize-5.c: Likewise.
 
6132
+
 
6133
+       * gcc.target/powerpc/crypto-builtin-1.c: Use effective target
 
6134
+       powerpc_p8vector_ok instead of powerpc_vsx_ok.
 
6135
+
 
6136
+       * gcc.target/powerpc/bool.c: New file, add eqv, nand, nor tests.
 
6137
+
 
6138
+       * lib/target-supports.exp (check_p8vector_hw_available) Add power8
 
6139
+       support.
 
6140
+       (check_effective_target_powerpc_p8vector_ok): Likewise.
 
6141
+       (is-effective-target): Likewise.
 
6142
+       (check_vect_support_and_set_flags): Likewise.
 
6143
+
 
6144
+2013-06-06  Peter Bergner  <bergner@vnet.ibm.com>
 
6145
+
 
6146
+       Backport from trunk
 
6147
+
 
6148
+       2013-05-22  Michael Meissner  <meissner@linux.vnet.ibm.com>
 
6149
+                   Pat Haugen <pthaugen@us.ibm.com>
 
6150
+                   Peter Bergner <bergner@vnet.ibm.com>
 
6151
+
 
6152
+       * gcc.target/powerpc/crypto-builtin-1.c: New file, test for power8
 
6153
+       crypto builtins.
 
6154
+
 
6155
+2013-05-06  Michael Meissner  <meissner@linux.vnet.ibm.com>
 
6156
+
 
6157
+       Backport from trunk
 
6158
+       2013-05-03  Michael Meissner  <meissner@linux.vnet.ibm.com>
 
6159
+
 
6160
+       PR target/57150
 
6161
+       * gcc.target/powerpc/pr57150.c: New file.
 
6162
+
 
6163
+2013-03-20  Michael Meissner  <meissner@linux.vnet.ibm.com>
 
6164
+
 
6165
+       Backport from mainline
 
6166
+       2013-03-20  Michael Meissner  <meissner@linux.vnet.ibm.com>
 
6167
+
 
6168
+       * gcc.target/powerpc/mmfpgpr.c: New test.
 
6169
+       * gcc.target/powerpc/sd-vsx.c: Likewise.
 
6170
+       * gcc.target/powerpc/sd-pwr6.c: Likewise.
 
6171
+       * gcc.target/powerpc/vsx-float0.c: Likewise.
 
6172
+
 
6173
+2013-03-20  Michael Meissner  <meissner@linux.vnet.ibm.com>
 
6174
+
 
6175
+       Clone branch from gcc-4_8-branch, subversion id 196835.
 
6176
--- a/src/gcc/testsuite/lib/target-supports.exp
 
6177
+++ b/src/gcc/testsuite/lib/target-supports.exp
 
6178
@@ -1311,6 +1311,32 @@
 
6179
     return 0
 
6180
 }
 
6181
 
 
6182
+# Return 1 if the target supports executing power8 vector instructions, 0
 
6183
+# otherwise.  Cache the result.
 
6184
+
 
6185
+proc check_p8vector_hw_available { } {
 
6186
+    return [check_cached_effective_target p8vector_hw_available {
 
6187
+       # Some simulators are known to not support VSX/power8 instructions.
 
6188
+       # For now, disable on Darwin
 
6189
+       if { [istarget powerpc-*-eabi] || [istarget powerpc*-*-eabispe] || [istarget *-*-darwin*]} {
 
6190
+           expr 0
 
6191
+       } else {
 
6192
+           set options "-mpower8-vector"
 
6193
+           check_runtime_nocache p8vector_hw_available {
 
6194
+               int main()
 
6195
+               {
 
6196
+               #ifdef __MACH__
 
6197
+                 asm volatile ("xxlorc vs0,vs0,vs0");
 
6198
+               #else
 
6199
+                 asm volatile ("xxlorc 0,0,0");
 
6200
+               #endif
 
6201
+                 return 0;
 
6202
+               }
 
6203
+           } $options
 
6204
+       }
 
6205
+    }]
 
6206
+}
 
6207
+
 
6208
 # Return 1 if the target supports executing VSX instructions, 0
 
6209
 # otherwise.  Cache the result.
 
6210
 
 
6211
@@ -2672,6 +2698,33 @@
 
6212
     }
 
6213
 }
 
6214
 
 
6215
+# Return 1 if this is a PowerPC target supporting -mpower8-vector
 
6216
+
 
6217
+proc check_effective_target_powerpc_p8vector_ok { } {
 
6218
+    if { ([istarget powerpc*-*-*]
 
6219
+         && ![istarget powerpc-*-linux*paired*])
 
6220
+        || [istarget rs6000-*-*] } {
 
6221
+       # AltiVec is not supported on AIX before 5.3.
 
6222
+       if { [istarget powerpc*-*-aix4*]
 
6223
+            || [istarget powerpc*-*-aix5.1*] 
 
6224
+            || [istarget powerpc*-*-aix5.2*] } {
 
6225
+           return 0
 
6226
+       }
 
6227
+       return [check_no_compiler_messages powerpc_p8vector_ok object {
 
6228
+           int main (void) {
 
6229
+#ifdef __MACH__
 
6230
+               asm volatile ("xxlorc vs0,vs0,vs0");
 
6231
+#else
 
6232
+               asm volatile ("xxlorc 0,0,0");
 
6233
+#endif
 
6234
+               return 0;
 
6235
+           }
 
6236
+       } "-mpower8-vector"]
 
6237
+    } else {
 
6238
+       return 0
 
6239
+    }
 
6240
+}
 
6241
+
 
6242
 # Return 1 if this is a PowerPC target supporting -mvsx
 
6243
 
 
6244
 proc check_effective_target_powerpc_vsx_ok { } {
 
6245
@@ -2699,6 +2752,27 @@
 
6246
     }
 
6247
 }
 
6248
 
 
6249
+# Return 1 if this is a PowerPC target supporting -mhtm
 
6250
+
 
6251
+proc check_effective_target_powerpc_htm_ok { } {
 
6252
+    if { ([istarget powerpc*-*-*]
 
6253
+         && ![istarget powerpc-*-linux*paired*])
 
6254
+        || [istarget rs6000-*-*] } {
 
6255
+       # HTM is not supported on AIX yet.
 
6256
+       if { [istarget powerpc*-*-aix*] } {
 
6257
+           return 0
 
6258
+       }
 
6259
+       return [check_no_compiler_messages powerpc_htm_ok object {
 
6260
+           int main (void) {
 
6261
+               asm volatile ("tbegin. 0");
 
6262
+               return 0;
 
6263
+           }
 
6264
+       } "-mhtm"]
 
6265
+    } else {
 
6266
+       return 0
 
6267
+    }
 
6268
+}
 
6269
+
 
6270
 # Return 1 if this is a PowerPC target supporting -mcpu=cell.
 
6271
 
 
6272
 proc check_effective_target_powerpc_ppu_ok { } {
 
6273
@@ -2794,6 +2868,22 @@
 
6274
     }
 
6275
 }
 
6276
 
 
6277
+# Return 1 if this is a PowerPC target using the ELFv2 ABI.
 
6278
+
 
6279
+proc check_effective_target_powerpc_elfv2 { } {
 
6280
+    if { [istarget powerpc*-*-*] } {
 
6281
+       return [check_no_compiler_messages powerpc_elfv2 object {
 
6282
+           #if _CALL_ELF != 2
 
6283
+           #error not ELF v2 ABI
 
6284
+           #else
 
6285
+           int dummy;
 
6286
+           #endif
 
6287
+       }]
 
6288
+    } else {
 
6289
+       return 0
 
6290
+    }
 
6291
+}
 
6292
+
 
6293
 # Return 1 if this is a SPU target with a toolchain that
 
6294
 # supports automatic overlay generation.
 
6295
 
 
6296
@@ -4499,6 +4589,7 @@
 
6297
        switch $arg {
 
6298
          "vmx_hw"         { set selected [check_vmx_hw_available] }
 
6299
          "vsx_hw"         { set selected [check_vsx_hw_available] }
 
6300
+         "p8vector_hw"    { set selected [check_p8vector_hw_available] }
 
6301
          "ppc_recip_hw"   { set selected [check_ppc_recip_hw_available] }
 
6302
          "named_sections" { set selected [check_named_sections_available] }
 
6303
          "gc_sections"    { set selected [check_gc_sections_available] }
 
6304
@@ -4520,6 +4611,7 @@
 
6305
        switch $arg {
 
6306
          "vmx_hw"         { return 1 }
 
6307
          "vsx_hw"         { return 1 }
 
6308
+         "p8vector_hw"    { return 1 }
 
6309
          "ppc_recip_hw"   { return 1 }
 
6310
          "named_sections" { return 1 }
 
6311
          "gc_sections"    { return 1 }
 
6312
@@ -5077,7 +5169,9 @@
 
6313
         }
 
6314
 
 
6315
         lappend DEFAULT_VECTCFLAGS "-maltivec"
 
6316
-        if [check_vsx_hw_available] {
 
6317
+        if [check_p8vector_hw_available] {
 
6318
+            lappend DEFAULT_VECTCFLAGS "-mpower8-vector" "-mno-allow-movmisalign"
 
6319
+        } elseif [check_vsx_hw_available] {
 
6320
             lappend DEFAULT_VECTCFLAGS "-mvsx" "-mno-allow-movmisalign"
 
6321
         }
 
6322
 
 
6323
--- a/src/gcc/testsuite/gcc.dg/vmx/3b-15.c
 
6324
+++ b/src/gcc/testsuite/gcc.dg/vmx/3b-15.c
 
6325
@@ -3,7 +3,11 @@
 
6326
 vector unsigned char
 
6327
 f (vector unsigned char a, vector unsigned char b, vector unsigned char c)
 
6328
 {
 
6329
+#ifdef __BIG_ENDIAN__
 
6330
   return vec_perm(a,b,c); 
 
6331
+#else
 
6332
+  return vec_perm(b,a,c);
 
6333
+#endif
 
6334
 }
 
6335
 
 
6336
 static void test()
 
6337
@@ -12,8 +16,13 @@
 
6338
                                            8,9,10,11,12,13,14,15}),
 
6339
                     ((vector unsigned char){70,71,72,73,74,75,76,77,
 
6340
                                            78,79,80,81,82,83,84,85}),
 
6341
+#ifdef __BIG_ENDIAN__
 
6342
                     ((vector unsigned char){0x1,0x14,0x18,0x10,0x16,0x15,0x19,0x1a,
 
6343
                                            0x1c,0x1c,0x1c,0x12,0x8,0x1d,0x1b,0xe})),
 
6344
+#else
 
6345
+                     ((vector unsigned char){0x1e,0xb,0x7,0xf,0x9,0xa,0x6,0x5,
 
6346
+                                            0x3,0x3,0x3,0xd,0x17,0x2,0x4,0x11})),
 
6347
+#endif
 
6348
                   ((vector unsigned char){1,74,78,70,76,75,79,80,82,82,82,72,8,83,81,14})),
 
6349
        "f");
 
6350
 }
 
6351
--- a/src/gcc/testsuite/gcc.dg/vmx/vec-set.c
 
6352
+++ b/src/gcc/testsuite/gcc.dg/vmx/vec-set.c
 
6353
@@ -0,0 +1,14 @@
 
6354
+#include "harness.h"
 
6355
+
 
6356
+vector short
 
6357
+vec_set (short m)
 
6358
+{
 
6359
+  return (vector short){m, 0, 0, 0, 0, 0, 0, 0};
 
6360
+}
 
6361
+
 
6362
+static void test()
 
6363
+{
 
6364
+  check (vec_all_eq (vec_set (7),
 
6365
+                    ((vector short){7, 0, 0, 0, 0, 0, 0, 0})),
 
6366
+        "vec_set");
 
6367
+}
 
6368
--- a/src/gcc/testsuite/gcc.dg/vmx/gcc-bug-i.c
 
6369
+++ b/src/gcc/testsuite/gcc.dg/vmx/gcc-bug-i.c
 
6370
@@ -13,12 +13,27 @@
 
6371
 #define DO_INLINE __attribute__ ((always_inline))
 
6372
 #define DONT_INLINE __attribute__ ((noinline))
 
6373
 
 
6374
+#ifdef __LITTLE_ENDIAN__
 
6375
+static inline DO_INLINE int inline_me(vector signed short data)
 
6376
+{
 
6377
+  union {vector signed short v; signed short s[8];} u;
 
6378
+  signed short x;
 
6379
+  unsigned char x1, x2;
 
6380
+
 
6381
+  u.v = data;
 
6382
+  x = u.s[7];
 
6383
+  x1 = (x >> 8) & 0xff;
 
6384
+  x2 = x & 0xff;
 
6385
+  return ((x2 << 8) | x1);
 
6386
+}
 
6387
+#else
 
6388
 static inline DO_INLINE int inline_me(vector signed short data) 
 
6389
 {
 
6390
   union {vector signed short v; signed short s[8];} u;
 
6391
   u.v = data;
 
6392
   return u.s[7];
 
6393
 }
 
6394
+#endif
 
6395
 
 
6396
 static DONT_INLINE int foo(vector signed short data)
 
6397
 {
 
6398
--- a/src/gcc/testsuite/gcc.dg/vmx/eg-5.c
 
6399
+++ b/src/gcc/testsuite/gcc.dg/vmx/eg-5.c
 
6400
@@ -7,10 +7,17 @@
 
6401
   /* Set result to a vector of f32 0's */
 
6402
   vector float result = ((vector float){0.,0.,0.,0.});
 
6403
 
 
6404
+#ifdef __LITTLE_ENDIAN__
 
6405
+  result  = vec_madd (c0, vec_splat (v, 3), result);
 
6406
+  result  = vec_madd (c1, vec_splat (v, 2), result);
 
6407
+  result  = vec_madd (c2, vec_splat (v, 1), result);
 
6408
+  result  = vec_madd (c3, vec_splat (v, 0), result);
 
6409
+#else
 
6410
   result  = vec_madd (c0, vec_splat (v, 0), result);
 
6411
   result  = vec_madd (c1, vec_splat (v, 1), result);
 
6412
   result  = vec_madd (c2, vec_splat (v, 2), result);
 
6413
   result  = vec_madd (c3, vec_splat (v, 3), result);
 
6414
+#endif
 
6415
 
 
6416
   return result;
 
6417
 }
 
6418
--- a/src/gcc/testsuite/gcc.dg/stack-usage-1.c
 
6419
+++ b/src/gcc/testsuite/gcc.dg/stack-usage-1.c
 
6420
@@ -38,7 +38,11 @@
 
6421
 #  endif
 
6422
 #elif defined (__powerpc64__) || defined (__ppc64__) || defined (__POWERPC64__) \
 
6423
       || defined (__PPC64__)
 
6424
-#  define SIZE 180
 
6425
+#  if _CALL_ELF == 2
 
6426
+#     define SIZE 208
 
6427
+#  else
 
6428
+#     define SIZE 180
 
6429
+#  endif
 
6430
 #elif defined (__powerpc__) || defined (__PPC__) || defined (__ppc__) \
 
6431
       || defined (__POWERPC__) || defined (PPC) || defined (_IBMR2)
 
6432
 #  if defined (__ALTIVEC__)
 
6433
--- a/src/gcc/testsuite/g++.dg/lookup/using9.C
 
6434
+++ b/src/gcc/testsuite/g++.dg/lookup/using9.C
 
6435
@@ -21,11 +21,11 @@
 
6436
   f('h');
 
6437
   f(1);         // { dg-error "ambiguous" }
 
6438
   // { dg-message "candidate" "candidate note" { target *-*-* } 22 }
 
6439
-  void f(int);  // { dg-error "previous using declaration" }
 
6440
+  void f(int);  // { dg-error "previous declaration" }
 
6441
 }
 
6442
 
 
6443
 void m()
 
6444
 {
 
6445
   void f(int);
 
6446
-  using B::f;   // { dg-error "already declared" }
 
6447
+  using B::f;   // { dg-error "previous declaration" }
 
6448
 }
 
6449
--- a/src/gcc/testsuite/g++.dg/eh/ppc64-sighandle-cr.C
 
6450
+++ b/src/gcc/testsuite/g++.dg/eh/ppc64-sighandle-cr.C
 
6451
@@ -0,0 +1,54 @@
 
6452
+// { dg-do run { target { powerpc64*-*-linux* } } }
 
6453
+// { dg-options "-fexceptions -fnon-call-exceptions" }
 
6454
+
 
6455
+#include <signal.h>
 
6456
+#include <stdlib.h>
 
6457
+#include <fenv.h>
 
6458
+
 
6459
+#define SET_CR(R,V) __asm__ __volatile__ ("mtcrf %0,%1" : : "n" (1<<(7-R)), "r" (V<<(4*(7-R))) : "cr" #R)
 
6460
+#define GET_CR(R) ({ int tmp; __asm__ __volatile__ ("mfcr %0" : "=r" (tmp)); (tmp >> 4*(7-R)) & 15; })
 
6461
+
 
6462
+void sighandler (int signo, siginfo_t * si, void * uc)
 
6463
+{
 
6464
+  SET_CR(2, 3);
 
6465
+  SET_CR(3, 2);
 
6466
+  SET_CR(4, 1);
 
6467
+
 
6468
+  throw 0;
 
6469
+}
 
6470
+
 
6471
+float test (float a, float b) __attribute__ ((__noinline__));
 
6472
+float test (float a, float b)
 
6473
+{
 
6474
+  float x;
 
6475
+  asm ("mtcrf %1,%2" : "=f" (x) : "n" (1 << (7-3)), "r" (0), "0" (b) : "cr3");
 
6476
+  return a / x;
 
6477
+}
 
6478
+
 
6479
+int main ()
 
6480
+{
 
6481
+  struct sigaction sa;
 
6482
+  int status;
 
6483
+
 
6484
+  sa.sa_sigaction = sighandler;
 
6485
+  sa.sa_flags = SA_SIGINFO;
 
6486
+
 
6487
+  status = sigaction (SIGFPE, & sa, NULL);
 
6488
+
 
6489
+  feenableexcept (FE_DIVBYZERO);
 
6490
+
 
6491
+  SET_CR(2, 6);
 
6492
+  SET_CR(3, 9);
 
6493
+  SET_CR(4, 12);
 
6494
+
 
6495
+  try {
 
6496
+    test (1, 0);
 
6497
+  }
 
6498
+  catch (...) {
 
6499
+    return GET_CR(2) != 6 || GET_CR(3) != 9 || GET_CR(4) != 12;
 
6500
+  }
 
6501
+
 
6502
+  return 1;
 
6503
+}
 
6504
+
 
6505
+
 
6506
--- a/src/gcc/testsuite/g++.dg/overload/using3.C
 
6507
+++ b/src/gcc/testsuite/g++.dg/overload/using3.C
 
6508
@@ -0,0 +1,16 @@
 
6509
+// { dg-do compile }
 
6510
+
 
6511
+namespace a
 
6512
+{
 
6513
+  void f(int);
 
6514
+}
 
6515
+
 
6516
+namespace b
 
6517
+{
 
6518
+  void f(int); // { dg-message "previous" }
 
6519
+  void g()
 
6520
+  {
 
6521
+    f (3);
 
6522
+  }
 
6523
+  using a::f; // { dg-error "conflicts" }
 
6524
+}
 
6525
--- a/src/gcc/testsuite/g++.dg/overload/using2.C
 
6526
+++ b/src/gcc/testsuite/g++.dg/overload/using2.C
 
6527
@@ -45,7 +45,7 @@
 
6528
   extern "C" void exit (int) throw ();
 
6529
   extern "C" void *malloc (__SIZE_TYPE__) throw () __attribute__((malloc));
 
6530
 
 
6531
-  void abort (void) throw ();
 
6532
+  void abort (void) throw (); // { dg-message "previous" }
 
6533
   void _exit (int) throw (); // { dg-error "conflicts" "conflicts" }
 
6534
                              // { dg-message "void _exit" "_exit" { target *-*-* } 49 }
 
6535
 
 
6536
@@ -54,14 +54,14 @@
 
6537
                            // { dg-message "void C1" "C1" { target *-*-* } 53 }
 
6538
 
 
6539
   extern "C" void c2 (void) throw ();
 
6540
-  void C2 (void) throw ();
 
6541
+  void C2 (void) throw (); // { dg-message "previous" }
 
6542
 
 
6543
   int C3 (int) throw ();
 
6544
 
 
6545
 using std::malloc;
 
6546
-using std::abort; // { dg-error "already declared" }
 
6547
+using std::abort; // { dg-error "conflicts" }
 
6548
 using std::c2;
 
6549
-using std::C2; // { dg-error "already declared" }
 
6550
+using std::C2; // { dg-error "conflicts" }
 
6551
 
 
6552
 using std::c3; using other::c3;
 
6553
 using std::C3; using other::C3;
 
6554
--- a/src/gcc/cp/ChangeLog.ibm
 
6555
+++ b/src/gcc/cp/ChangeLog.ibm
 
6556
@@ -0,0 +1,11 @@
 
6557
+2013-08-04  Peter Bergner  <bergner@vnet.ibm.com>
 
6558
+
 
6559
+       Back port from mainline
 
6560
+       2013-08-01  Fabien Chêne  <fabien@gcc.gnu.org>
 
6561
+
 
6562
+       PR c++/54537
 
6563
+       * cp-tree.h: Check OVL_USED with OVERLOAD_CHECK.
 
6564
+       * name-lookup.c (do_nonmember_using_decl): Make sure we have an
 
6565
+       OVERLOAD before calling OVL_USED. Call diagnose_name_conflict
 
6566
+       instead of issuing an error without mentioning the conflicting
 
6567
+       declaration.
 
6568
--- a/src/gcc/cp/cp-tree.h
 
6569
+++ b/src/gcc/cp/cp-tree.h
 
6570
@@ -331,7 +331,7 @@
 
6571
 /* If set, this was imported in a using declaration.
 
6572
    This is not to confuse with being used somewhere, which
 
6573
    is not important for this node.  */
 
6574
-#define OVL_USED(NODE)         TREE_USED (NODE)
 
6575
+#define OVL_USED(NODE)         TREE_USED (OVERLOAD_CHECK (NODE))
 
6576
 /* If set, this OVERLOAD was created for argument-dependent lookup
 
6577
    and can be freed afterward.  */
 
6578
 #define OVL_ARG_DEPENDENT(NODE) TREE_LANG_FLAG_0 (OVERLOAD_CHECK (NODE))
 
6579
--- a/src/gcc/cp/name-lookup.c
 
6580
+++ b/src/gcc/cp/name-lookup.c
 
6581
@@ -2268,8 +2268,7 @@
 
6582
                  && compparms (TYPE_ARG_TYPES (TREE_TYPE (fn)),
 
6583
                                TYPE_ARG_TYPES (TREE_TYPE (decl)))
 
6584
                  && ! decls_match (fn, decl))
 
6585
-               error ("%q#D conflicts with previous using declaration %q#D",
 
6586
-                      decl, fn);
 
6587
+               diagnose_name_conflict (decl, fn);
 
6588
 
 
6589
              dup = duplicate_decls (decl, fn, is_friend);
 
6590
              /* If DECL was a redeclaration of FN -- even an invalid
 
6591
@@ -2501,7 +2500,7 @@
 
6592
                  if (new_fn == old_fn)
 
6593
                    /* The function already exists in the current namespace.  */
 
6594
                    break;
 
6595
-                 else if (OVL_USED (tmp1))
 
6596
+                 else if (TREE_CODE (tmp1) == OVERLOAD && OVL_USED (tmp1))
 
6597
                    continue; /* this is a using decl */
 
6598
                  else if (compparms (TYPE_ARG_TYPES (TREE_TYPE (new_fn)),
 
6599
                                      TYPE_ARG_TYPES (TREE_TYPE (old_fn))))
 
6600
@@ -2516,7 +2515,7 @@
 
6601
                        break;
 
6602
                      else
 
6603
                        {
 
6604
-                         error ("%qD is already declared in this scope", name);
 
6605
+                         diagnose_name_conflict (new_fn, old_fn);
 
6606
                          break;
 
6607
                        }
 
6608
                    }
 
6609
--- a/src/gcc/builtins.def
 
6610
+++ b/src/gcc/builtins.def
 
6611
@@ -252,6 +252,9 @@
 
6612
 DEF_LIB_BUILTIN        (BUILT_IN_FABS, "fabs", BT_FN_DOUBLE_DOUBLE, ATTR_CONST_NOTHROW_LEAF_LIST)
 
6613
 DEF_C99_C90RES_BUILTIN (BUILT_IN_FABSF, "fabsf", BT_FN_FLOAT_FLOAT, ATTR_CONST_NOTHROW_LEAF_LIST)
 
6614
 DEF_C99_C90RES_BUILTIN (BUILT_IN_FABSL, "fabsl", BT_FN_LONGDOUBLE_LONGDOUBLE, ATTR_CONST_NOTHROW_LEAF_LIST)
 
6615
+DEF_GCC_BUILTIN        (BUILT_IN_FABSD32, "fabsd32", BT_FN_DFLOAT32_DFLOAT32, ATTR_CONST_NOTHROW_LEAF_LIST)
 
6616
+DEF_GCC_BUILTIN        (BUILT_IN_FABSD64, "fabsd64", BT_FN_DFLOAT64_DFLOAT64, ATTR_CONST_NOTHROW_LEAF_LIST)
 
6617
+DEF_GCC_BUILTIN        (BUILT_IN_FABSD128, "fabsd128", BT_FN_DFLOAT128_DFLOAT128, ATTR_CONST_NOTHROW_LEAF_LIST)
 
6618
 DEF_C99_BUILTIN        (BUILT_IN_FDIM, "fdim", BT_FN_DOUBLE_DOUBLE_DOUBLE, ATTR_MATHFN_FPROUNDING_ERRNO)
 
6619
 DEF_C99_BUILTIN        (BUILT_IN_FDIMF, "fdimf", BT_FN_FLOAT_FLOAT_FLOAT, ATTR_MATHFN_FPROUNDING_ERRNO)
 
6620
 DEF_C99_BUILTIN        (BUILT_IN_FDIML, "fdiml", BT_FN_LONGDOUBLE_LONGDOUBLE_LONGDOUBLE, ATTR_MATHFN_FPROUNDING_ERRNO)
 
6621
--- a/src/gcc/expr.h
 
6622
+++ b/src/gcc/expr.h
 
6623
@@ -521,8 +521,8 @@
 
6624
                          rtx, int);
 
6625
 #endif
 
6626
 
 
6627
-extern void locate_and_pad_parm (enum machine_mode, tree, int, int, tree,
 
6628
-                                struct args_size *,
 
6629
+extern void locate_and_pad_parm (enum machine_mode, tree, int, int, int,
 
6630
+                                tree, struct args_size *,
 
6631
                                 struct locate_and_pad_arg_data *);
 
6632
 
 
6633
 /* Return the CODE_LABEL rtx for a LABEL_DECL, creating it if necessary.  */
 
6634
--- a/src/gcc/function.c
 
6635
+++ b/src/gcc/function.c
 
6636
@@ -2507,6 +2507,7 @@
 
6637
     }
 
6638
 
 
6639
   locate_and_pad_parm (data->promoted_mode, data->passed_type, in_regs,
 
6640
+                      all->reg_parm_stack_space,
 
6641
                       entry_parm ? data->partial : 0, current_function_decl,
 
6642
                       &all->stack_args_size, &data->locate);
 
6643
 
 
6644
@@ -3485,11 +3486,7 @@
 
6645
   /* Adjust function incoming argument size for alignment and
 
6646
      minimum length.  */
 
6647
 
 
6648
-#ifdef REG_PARM_STACK_SPACE
 
6649
-  crtl->args.size = MAX (crtl->args.size,
 
6650
-                                   REG_PARM_STACK_SPACE (fndecl));
 
6651
-#endif
 
6652
-
 
6653
+  crtl->args.size = MAX (crtl->args.size, all.reg_parm_stack_space);
 
6654
   crtl->args.size = CEIL_ROUND (crtl->args.size,
 
6655
                                           PARM_BOUNDARY / BITS_PER_UNIT);
 
6656
 
 
6657
@@ -3693,6 +3690,9 @@
 
6658
    IN_REGS is nonzero if the argument will be passed in registers.  It will
 
6659
    never be set if REG_PARM_STACK_SPACE is not defined.
 
6660
 
 
6661
+   REG_PARM_STACK_SPACE is the number of bytes of stack space reserved
 
6662
+   for arguments which are passed in registers.
 
6663
+
 
6664
    FNDECL is the function in which the argument was defined.
 
6665
 
 
6666
    There are two types of rounding that are done.  The first, controlled by
 
6667
@@ -3713,19 +3713,16 @@
 
6668
 
 
6669
 void
 
6670
 locate_and_pad_parm (enum machine_mode passed_mode, tree type, int in_regs,
 
6671
-                    int partial, tree fndecl ATTRIBUTE_UNUSED,
 
6672
+                    int reg_parm_stack_space, int partial,
 
6673
+                    tree fndecl ATTRIBUTE_UNUSED,
 
6674
                     struct args_size *initial_offset_ptr,
 
6675
                     struct locate_and_pad_arg_data *locate)
 
6676
 {
 
6677
   tree sizetree;
 
6678
   enum direction where_pad;
 
6679
   unsigned int boundary, round_boundary;
 
6680
-  int reg_parm_stack_space = 0;
 
6681
   int part_size_in_regs;
 
6682
 
 
6683
-#ifdef REG_PARM_STACK_SPACE
 
6684
-  reg_parm_stack_space = REG_PARM_STACK_SPACE (fndecl);
 
6685
-
 
6686
   /* If we have found a stack parm before we reach the end of the
 
6687
      area reserved for registers, skip that area.  */
 
6688
   if (! in_regs)
 
6689
@@ -3743,7 +3740,6 @@
 
6690
            initial_offset_ptr->constant = reg_parm_stack_space;
 
6691
        }
 
6692
     }
 
6693
-#endif /* REG_PARM_STACK_SPACE */
 
6694
 
 
6695
   part_size_in_regs = (reg_parm_stack_space == 0 ? partial : 0);
 
6696
 
 
6697
@@ -3806,11 +3802,7 @@
 
6698
 
 
6699
   locate->slot_offset.constant += part_size_in_regs;
 
6700
 
 
6701
-  if (!in_regs
 
6702
-#ifdef REG_PARM_STACK_SPACE
 
6703
-      || REG_PARM_STACK_SPACE (fndecl) > 0
 
6704
-#endif
 
6705
-     )
 
6706
+  if (!in_regs || reg_parm_stack_space > 0)
 
6707
     pad_to_arg_alignment (&locate->slot_offset, boundary,
 
6708
                          &locate->alignment_pad);
 
6709
 
 
6710
@@ -3830,11 +3822,7 @@
 
6711
     pad_below (&locate->offset, passed_mode, sizetree);
 
6712
 
 
6713
 #else /* !ARGS_GROW_DOWNWARD */
 
6714
-  if (!in_regs
 
6715
-#ifdef REG_PARM_STACK_SPACE
 
6716
-      || REG_PARM_STACK_SPACE (fndecl) > 0
 
6717
-#endif
 
6718
-      )
 
6719
+  if (!in_regs || reg_parm_stack_space > 0)
 
6720
     pad_to_arg_alignment (initial_offset_ptr, boundary,
 
6721
                          &locate->alignment_pad);
 
6722
   locate->slot_offset = *initial_offset_ptr;
 
6723
@@ -5093,6 +5081,7 @@
 
6724
             amount.  BLKmode results are handled using the group load/store
 
6725
             machinery.  */
 
6726
          if (TYPE_MODE (TREE_TYPE (decl_result)) != BLKmode
 
6727
+             && REG_P (real_decl_rtl)
 
6728
              && targetm.calls.return_in_msb (TREE_TYPE (decl_result)))
 
6729
            {
 
6730
              emit_move_insn (gen_rtx_REG (GET_MODE (decl_rtl),
 
6731
--- a/src/gcc/ChangeLog.ibm
 
6732
+++ b/src/gcc/ChangeLog.ibm
 
6733
@@ -0,0 +1,2429 @@
 
6734
+2013-11-24  Bill Schmidt  <wschmidt@linux.vnet.ibm.com>
 
6735
+
 
6736
+       Backport from mainline r205333
 
6737
+       2013-11-24  Bill Schmidt  <wschmidt@linux.vnet.ibm.com>
 
6738
+
 
6739
+       * config/rs6000/rs6000.c (rs6000_expand_vec_perm_const_1): Correct
 
6740
+       for little endian.
 
6741
+
 
6742
+2013-11-23  Alan Modra  <amodra@gmail.com>
 
6743
+
 
6744
+       Apply mainline r205299.
 
6745
+       * config/rs6000/vsx.md (fusion peepholes): Disable when !TARGET_VSX.
 
6746
+
 
6747
+2013-11-22  Michael Meissner  <meissner@linux.vnet.ibm.com>
 
6748
+
 
6749
+       Backport from mainline
 
6750
+       2013-11-12  Michael Meissner  <meissner@linux.vnet.ibm.com>
 
6751
+
 
6752
+       PR target/59054
 
6753
+       * config/rs6000/rs6000.md (movdi_internal32): Eliminate
 
6754
+       constraints that would allow DImode into the traditional Altivec
 
6755
+       registers, but cause undesirable code generation when loading 0 as
 
6756
+       a constant.
 
6757
+       (movdi_internal64): Likewise.
 
6758
+       (cmp<mode>_fpr): Do not use %x for CR register output.
 
6759
+       (extendsfdf2_fpr): Fix constraints when -mallow-upper-df and
 
6760
+       -mallow-upper-sf debug switches are used.
 
6761
+
 
6762
+2013-11-21  Bill Schmidt  <wschmidt@linux.vnet.ibm.com>
 
6763
+
 
6764
+       Backport from mainline r205241
 
6765
+       2013-11-21  Bill Schmidt  <wschmidt@vnet.ibm.com>
 
6766
+
 
6767
+       * config/rs6000/vector.md (vec_pack_trunc_v2df): Revert previous
 
6768
+       little endian change.
 
6769
+       (vec_pack_sfix_trunc_v2df): Likewise.
 
6770
+       (vec_pack_ufix_trunc_v2df): Likewise.
 
6771
+       * config/rs6000/rs6000.c (rs6000_expand_interleave): Correct
 
6772
+       double checking of endianness.
 
6773
+
 
6774
+2013-11-21  Peter Bergner  <bergner@vnet.ibm.com>
 
6775
+
 
6776
+       Backport from mainline r205233.
 
6777
+       2013-11-21  Peter Bergner  <bergner@vnet.ibm.com>
 
6778
+
 
6779
+       * doc/extend.texi: Document htm builtins.
 
6780
+
 
6781
+2013-11-20  Bill Schmidt  <wschmidt@linux.vnet.ibm.com>
 
6782
+
 
6783
+       Backport from mainline r205146
 
6784
+       2013-11-20  Bill Schmidt  <wschmidt@linux.vnet.ibm.com>
 
6785
+
 
6786
+       * config/rs6000/vsx.md (vsx_set_<mode>): Adjust for little endian.
 
6787
+       (vsx_extract_<mode>): Likewise.
 
6788
+       (*vsx_extract_<mode>_one_le): New LE variant on
 
6789
+       *vsx_extract_<mode>_zero.
 
6790
+       (vsx_extract_v4sf): Adjust for little endian.
 
6791
+
 
6792
+2013-11-20  Ulrich Weigand  <Ulrich.Weigand@de.ibm.com>
 
6793
+
 
6794
+       Backport from mainline r205123:
 
6795
+
 
6796
+       2013-11-20  Ulrich Weigand  <Ulrich.Weigand@de.ibm.com>
 
6797
+
 
6798
+       * config/rs6000/rs6000.c (rs6000_cannot_change_mode_class): Do not
 
6799
+       allow subregs of TDmode in FPRs of smaller size in little-endian.
 
6800
+       (rs6000_split_multireg_move): When splitting an access to TDmode
 
6801
+       in FPRs, do not use simplify_gen_subreg.
 
6802
+
 
6803
+2013-11-19  Bill Schmidt  <wschmidt@linux.vnet.ibm.com>
 
6804
+
 
6805
+       Backport from mainline r205080
 
6806
+       2013-11-19  Bill Schmidt  <wschmidt@linux.vnet.ibm.com>
 
6807
+
 
6808
+       * config/rs6000/rs6000.c (altivec_expand_vec_perm_const): Adjust
 
6809
+       V16QI vector splat case for little endian.
 
6810
+
 
6811
+2013-11-20  Alan Modra  <amodra@gmail.com>
 
6812
+
 
6813
+       Apply mainline r205060.
 
6814
+       * config/rs6000/sysv4.h (CC1_ENDIAN_LITTLE_SPEC): Define as empty.
 
6815
+       * config/rs6000/rs6000.c (rs6000_option_override_internal): Default
 
6816
+       to strict alignment on older processors when little-endian.
 
6817
+       * config/rs6000/linux64.h (PROCESSOR_DEFAULT64): Default to power8
 
6818
+       for ELFv2.
 
6819
+
 
6820
+2013-11-19  Ulrich Weigand  <Ulrich.Weigand@de.ibm.com>
 
6821
+
 
6822
+       Backport from mainline r205045:
 
6823
+
 
6824
+       2013-11-19  Ulrich Weigand  <Ulrich.Weigand@de.ibm.com>
 
6825
+
 
6826
+       * config/rs6000/vector.md ("mov<mode>"): Do not call
 
6827
+       rs6000_emit_le_vsx_move to move into or out of GPRs.
 
6828
+       * config/rs6000/rs6000.c (rs6000_emit_le_vsx_move): Assert
 
6829
+       source and destination are not GPR hard regs.
 
6830
+
 
6831
+2013-11-18  Peter Bergner  <bergner@vnet.ibm.com>
 
6832
+
 
6833
+       Merge up to 204974.
 
6834
+       * REVISION: Update subversion id.
 
6835
+
 
6836
+2013-11-17  Ulrich Weigand  <Ulrich.Weigand@de.ibm.com>
 
6837
+
 
6838
+       Backport from mainline r204927:
 
6839
+
 
6840
+       2013-11-17  Ulrich Weigand  <Ulrich.Weigand@de.ibm.com>
 
6841
+
 
6842
+       * config/rs6000/rs6000.c (rs6000_emit_move): Use low word of
 
6843
+       sdmode_stack_slot also in little-endian mode.
 
6844
+
 
6845
+2013-11-17  Bill Schmidt  <wschmidt@linux.vnet.ibm.com>
 
6846
+
 
6847
+       Backport from mainline r204920
 
6848
+       2011-11-17  Bill Schmidt  <wschmidt@linux.vnet.ibm.com>
 
6849
+
 
6850
+       * config/rs6000/rs6000.c (rs6000_frame_related): Add split_reg
 
6851
+       parameter and use it in REG_FRAME_RELATED_EXPR note.
 
6852
+       (emit_frame_save): Call rs6000_frame_related with extra NULL_RTX
 
6853
+       parameter.
 
6854
+       (rs6000_emit_prologue): Likewise, but for little endian VSX
 
6855
+       stores, pass the source register of the store instead.
 
6856
+
 
6857
+2013-11-15  Bill Schmidt  <wschmidt@linux.vnet.ibm.com>
 
6858
+
 
6859
+       Backport from mainline r204862
 
6860
+       2013-11-15  Bill Schmidt  <wschmidt@linux.vnet.ibm.com>
 
6861
+
 
6862
+       * config/rs6000/altivec.md (UNSPEC_VPERM_X, UNSPEC_VPERM_UNS_X):
 
6863
+       Remove.
 
6864
+       (altivec_vperm_<mode>): Revert earlier little endian change.
 
6865
+       (*altivec_vperm_<mode>_internal): Remove.
 
6866
+       (altivec_vperm_<mode>_uns): Revert earlier little endian change.
 
6867
+       (*altivec_vperm_<mode>_uns_internal): Remove.
 
6868
+       * config/rs6000/vector.md (vec_realign_load_<mode>): Revise
 
6869
+       commentary.
 
6870
+
 
6871
+2013-11-15  Ulrich Weigand  <Ulrich.Weigand@de.ibm.com>
 
6872
+
 
6873
+       Backport from mainline r204842:
 
6874
+
 
6875
+       2013-11-15  Ulrich Weigand  <Ulrich.Weigand@de.ibm.com>
 
6876
+
 
6877
+       * doc/invoke.texi (-mabi=elfv1, -mabi=elfv2): Document.
 
6878
+
 
6879
+2013-11-15  Ulrich Weigand  <Ulrich.Weigand@de.ibm.com>
 
6880
+
 
6881
+       Backport from mainline r204809:
 
6882
+
 
6883
+       2013-11-14  Ulrich Weigand  <Ulrich.Weigand@de.ibm.com>
 
6884
+
 
6885
+       * config/rs6000/sysv4le.h (LINUX64_DEFAULT_ABI_ELFv2): Define.
 
6886
+
 
6887
+2013-11-15  Ulrich Weigand  <Ulrich.Weigand@de.ibm.com>
 
6888
+
 
6889
+       Backport from mainline r204808:
 
6890
+
 
6891
+       2013-11-14  Ulrich Weigand  <Ulrich.Weigand@de.ibm.com>
 
6892
+                   Alan Modra  <amodra@gmail.com>
 
6893
+
 
6894
+       * config/rs6000/rs6000.h (RS6000_SAVE_AREA): Handle ABI_ELFv2.
 
6895
+       (RS6000_SAVE_TOC): Remove.
 
6896
+       (RS6000_TOC_SAVE_SLOT): New macro.
 
6897
+       * config/rs6000/rs6000.c (rs6000_parm_offset): New function.
 
6898
+       (rs6000_parm_start): Use it.
 
6899
+       (rs6000_function_arg_advance_1): Likewise.
 
6900
+       (rs6000_emit_prologue): Use RS6000_TOC_SAVE_SLOT.
 
6901
+       (rs6000_emit_epilogue): Likewise.
 
6902
+       (rs6000_call_aix): Likewise.
 
6903
+       (rs6000_output_function_prologue): Do not save/restore r11
 
6904
+       around calling _mcount for ABI_ELFv2.
 
6905
+
 
6906
+       2013-11-14  Ulrich Weigand  <Ulrich.Weigand@de.ibm.com>
 
6907
+                   Alan Modra  <amodra@gmail.com>
 
6908
+
 
6909
+       * config/rs6000/rs6000-protos.h (rs6000_reg_parm_stack_space):
 
6910
+       Add prototype.
 
6911
+       * config/rs6000/rs6000.h (RS6000_REG_SAVE): Remove.
 
6912
+       (REG_PARM_STACK_SPACE): Call rs6000_reg_parm_stack_space.
 
6913
+       * config/rs6000/rs6000.c (rs6000_parm_needs_stack): New function.
 
6914
+       (rs6000_function_parms_need_stack): Likewise.
 
6915
+       (rs6000_reg_parm_stack_space): Likewise.
 
6916
+       (rs6000_function_arg): Do not replace BLKmode by Pmode when
 
6917
+       returning a register argument.
 
6918
+
 
6919
+       2013-11-14  Ulrich Weigand  <Ulrich.Weigand@de.ibm.com>
 
6920
+                   Michael Gschwind  <mkg@us.ibm.com>
 
6921
+
 
6922
+       * config/rs6000/rs6000.h (FP_ARG_MAX_RETURN): New macro.
 
6923
+       (ALTIVEC_ARG_MAX_RETURN): Likewise.
 
6924
+       (FUNCTION_VALUE_REGNO_P): Use them.
 
6925
+       * config/rs6000/rs6000.c (TARGET_RETURN_IN_MSB): Define.
 
6926
+       (rs6000_return_in_msb): New function.
 
6927
+       (rs6000_return_in_memory): Handle ELFv2 homogeneous aggregates.
 
6928
+       Handle aggregates of up to 16 bytes for ELFv2.
 
6929
+       (rs6000_function_value): Handle ELFv2 homogeneous aggregates.
 
6930
+
 
6931
+       2013-11-14  Ulrich Weigand  <Ulrich.Weigand@de.ibm.com>
 
6932
+                   Michael Gschwind  <mkg@us.ibm.com>
 
6933
+
 
6934
+       * config/rs6000/rs6000.h (AGGR_ARG_NUM_REG): Define.
 
6935
+       * config/rs6000/rs6000.c (rs6000_aggregate_candidate): New function.
 
6936
+       (rs6000_discover_homogeneous_aggregate): Likewise.
 
6937
+       (rs6000_function_arg_boundary): Handle homogeneous aggregates.
 
6938
+       (rs6000_function_arg_advance_1): Likewise.
 
6939
+       (rs6000_function_arg): Likewise.
 
6940
+       (rs6000_arg_partial_bytes): Likewise.
 
6941
+       (rs6000_psave_function_arg): Handle BLKmode arguments.
 
6942
+
 
6943
+       2013-11-14  Ulrich Weigand  <Ulrich.Weigand@de.ibm.com>
 
6944
+                   Michael Gschwind  <mkg@us.ibm.com>
 
6945
+
 
6946
+       * config/rs6000/rs6000.h (AGGR_ARG_NUM_REG): Define.
 
6947
+       * config/rs6000/rs6000.c (rs6000_aggregate_candidate): New function.
 
6948
+       (rs6000_discover_homogeneous_aggregate): Likewise.
 
6949
+       (rs6000_function_arg_boundary): Handle homogeneous aggregates.
 
6950
+       (rs6000_function_arg_advance_1): Likewise.
 
6951
+       (rs6000_function_arg): Likewise.
 
6952
+       (rs6000_arg_partial_bytes): Likewise.
 
6953
+       (rs6000_psave_function_arg): Handle BLKmode arguments.
 
6954
+
 
6955
+       2013-11-14  Ulrich Weigand  <Ulrich.Weigand@de.ibm.com>
 
6956
+
 
6957
+       * config/rs6000/rs6000.c (machine_function): New member
 
6958
+       r2_setup_needed.
 
6959
+       (rs6000_emit_prologue): Set r2_setup_needed if necessary.
 
6960
+       (rs6000_output_mi_thunk): Set r2_setup_needed.
 
6961
+       (rs6000_output_function_prologue): Output global entry point
 
6962
+       prologue and local entry point marker if needed for ABI_ELFv2.
 
6963
+       Output -mprofile-kernel code here.
 
6964
+       (output_function_profiler): Do not output -mprofile-kernel
 
6965
+       code here; moved to rs6000_output_function_prologue.
 
6966
+       (rs6000_file_start): Output ".abiversion 2" for ABI_ELFv2.
 
6967
+
 
6968
+       (rs6000_emit_move): Do not handle dot symbols for ABI_ELFv2.
 
6969
+       (rs6000_output_function_entry): Likewise.
 
6970
+       (rs6000_assemble_integer): Likewise.
 
6971
+       (rs6000_elf_encode_section_info): Likewise.
 
6972
+       (rs6000_elf_declare_function_name): Do not create dot symbols
 
6973
+       or .opd section for ABI_ELFv2.
 
6974
+
 
6975
+       (rs6000_trampoline_size): Update for ABI_ELFv2 trampolines.
 
6976
+       (rs6000_trampoline_init): Likewise.
 
6977
+       (rs6000_elf_file_end): Call file_end_indicate_exec_stack
 
6978
+       for ABI_ELFv2.
 
6979
+
 
6980
+       (rs6000_call_aix): Handle ELFv2 indirect calls.  Do not check
 
6981
+       for function descriptors in ABI_ELFv2.
 
6982
+
 
6983
+       * config/rs6000/rs6000.md ("*call_indirect_aix<mode>"): Support
 
6984
+       on ABI_AIX only, not ABI_ELFv2.
 
6985
+       ("*call_value_indirect_aix<mode>"): Likewise.
 
6986
+       ("*call_indirect_elfv2<mode>"): New pattern.
 
6987
+       ("*call_value_indirect_elfv2<mode>"): Likewise.
 
6988
+
 
6989
+       * config/rs6000/predicates.md ("symbol_ref_operand"): Do not
 
6990
+       check for function descriptors in ABI_ELFv2.
 
6991
+       ("current_file_function_operand"): Likewise.
 
6992
+
 
6993
+       * config/rs6000/ppc-asm.h [__powerpc64__ && _CALL_ELF == 2]:
 
6994
+       (toc): Undefine.
 
6995
+       (FUNC_NAME): Define ELFv2 variant.
 
6996
+       (JUMP_TARGET): Likewise.
 
6997
+       (FUNC_START): Likewise.
 
6998
+       (HIDDEN_FUNC): Likewise.
 
6999
+       (FUNC_END): Likeiwse.
 
7000
+
 
7001
+       2013-11-14  Ulrich Weigand  <Ulrich.Weigand@de.ibm.com>
 
7002
+
 
7003
+       * config.gcc [powerpc*-*-* | rs6000-*-*]: Support --with-abi=elfv1
 
7004
+       and --with-abi=elfv2.
 
7005
+       * config/rs6000/option-defaults.h (OPTION_DEFAULT_SPECS): Add "abi".
 
7006
+       * config/rs6000/rs6000.opt (mabi=elfv1): New option.
 
7007
+       (mabi=elfv2): Likewise.
 
7008
+       * config/rs6000/rs6000-opts.h (enum rs6000_abi): Add ABI_ELFv2.
 
7009
+       * config/rs6000/linux64.h (DEFAULT_ABI): Do not hard-code to AIX_ABI
 
7010
+       if !RS6000_BI_ARCH.
 
7011
+       (ELFv2_ABI_CHECK): New macro.
 
7012
+       (SUBSUBTARGET_OVERRIDE_OPTIONS): Use it to decide whether to set
 
7013
+       rs6000_current_abi to ABI_AIX or ABI_ELFv2.
 
7014
+       (GLIBC_DYNAMIC_LINKER64): Support ELFv2 ld.so version.
 
7015
+       * config/rs6000/rs6000-c.c (rs6000_cpu_cpp_builtins): Predefine
 
7016
+       _CALL_ELF and __STRUCT_PARM_ALIGN__ if appropriate.
 
7017
+
 
7018
+       * config/rs6000/rs6000.c (rs6000_debug_reg_global): Handle ABI_ELFv2.
 
7019
+       (debug_stack_info): Likewise.
 
7020
+       (rs6000_file_start): Treat ABI_ELFv2 the same as ABI_AIX.
 
7021
+       (rs6000_legitimize_tls_address): Likewise.
 
7022
+       (rs6000_conditional_register_usage): Likewise.
 
7023
+       (rs6000_emit_move): Likewise.
 
7024
+       (init_cumulative_args): Likewise.
 
7025
+       (rs6000_function_arg_advance_1): Likewise.
 
7026
+       (rs6000_function_arg): Likewise.
 
7027
+       (rs6000_arg_partial_bytes): Likewise.
 
7028
+       (rs6000_output_function_entry): Likewise.
 
7029
+       (rs6000_assemble_integer): Likewise.
 
7030
+       (rs6000_savres_strategy): Likewise.
 
7031
+       (rs6000_stack_info): Likewise.
 
7032
+       (rs6000_function_ok_for_sibcall): Likewise.
 
7033
+       (rs6000_emit_load_toc_table): Likewise.
 
7034
+       (rs6000_savres_routine_name): Likewise.
 
7035
+       (ptr_regno_for_savres): Likewise.
 
7036
+       (rs6000_emit_prologue): Likewise.
 
7037
+       (rs6000_emit_epilogue): Likewise.
 
7038
+       (rs6000_output_function_epilogue): Likewise.
 
7039
+       (output_profile_hook): Likewise.
 
7040
+       (output_function_profiler): Likewise.
 
7041
+       (rs6000_trampoline_size): Likewise.
 
7042
+       (rs6000_trampoline_init): Likewise.
 
7043
+       (rs6000_elf_output_toc_section_asm_op): Likewise.
 
7044
+       (rs6000_elf_encode_section_info): Likewise.
 
7045
+       (rs6000_elf_reloc_rw_mask): Likewise.
 
7046
+       (rs6000_elf_declare_function_name): Likewise.
 
7047
+       (rs6000_function_arg_boundary): Treat ABI_ELFv2 the same as ABI_AIX,
 
7048
+       except that rs6000_compat_align_parm is always assumed false.
 
7049
+       (rs6000_gimplify_va_arg): Likewise.
 
7050
+       (rs6000_call_aix): Update comment.
 
7051
+       (rs6000_sibcall_aix): Likewise.
 
7052
+       * config/rs6000/rs6000.md ("tls_gd_aix<TLSmode:tls_abi_suffix>"):
 
7053
+       Treat ABI_ELFv2 the same as ABI_AIX.
 
7054
+       ("*tls_gd_call_aix<TLSmode:tls_abi_suffix>"): Likewise.
 
7055
+       ("tls_ld_aix<TLSmode:tls_abi_suffix>"): Likewise.
 
7056
+       ("*tls_ld_call_aix<TLSmode:tls_abi_suffix>"): Likewise.
 
7057
+       ("load_toc_aix_si"): Likewise.
 
7058
+       ("load_toc_aix_di"): Likewise.
 
7059
+       ("call"): Likewise.
 
7060
+       ("call_value"): Likewise.
 
7061
+       ("*call_local_aix<mode>"): Likewise.
 
7062
+       ("*call_value_local_aix<mode>"): Likewise.
 
7063
+       ("*call_nonlocal_aix<mode>"): Likewise.
 
7064
+       ("*call_value_nonlocal_aix<mode>"): Likewise.
 
7065
+       ("*call_indirect_aix<mode>"): Likewise.
 
7066
+       ("*call_value_indirect_aix<mode>"): Likewise.
 
7067
+       ("sibcall"): Likewise.
 
7068
+       ("sibcall_value"): Likewise.
 
7069
+       ("*sibcall_aix<mode>"): Likewise.
 
7070
+       ("*sibcall_value_aix<mode>"): Likewise.
 
7071
+       * config/rs6000/predicates.md ("symbol_ref_operand"): Likewise.
 
7072
+       ("current_file_function_operand"): Likewise.
 
7073
+
 
7074
+2013-11-15  Ulrich Weigand  <Ulrich.Weigand@de.ibm.com>
 
7075
+
 
7076
+       Backport from mainline r204807:
 
7077
+
 
7078
+       2013-11-14  Ulrich Weigand  <Ulrich.Weigand@de.ibm.com>
 
7079
+
 
7080
+       * config/rs6000/rs6000.c (rs6000_arg_partial_bytes): Simplify logic
 
7081
+       by making use of the fact that for vector / floating point arguments
 
7082
+       passed both in VRs/FPRs and in the fixed parameter area, the partial
 
7083
+       bytes mechanism is in fact not used.
 
7084
+
 
7085
+2013-11-15  Ulrich Weigand  <Ulrich.Weigand@de.ibm.com>
 
7086
+
 
7087
+       Backport from mainline r204806:
 
7088
+
 
7089
+       2013-11-14  Ulrich Weigand  <Ulrich.Weigand@de.ibm.com>
 
7090
+
 
7091
+       * config/rs6000/rs6000.c (rs6000_psave_function_arg): New function.
 
7092
+       (rs6000_finish_function_arg): Likewise.
 
7093
+       (rs6000_function_arg): Use rs6000_psave_function_arg and
 
7094
+       rs6000_finish_function_arg to handle both vector and floating
 
7095
+       point arguments that are also passed in GPRs / the stack.
 
7096
+
 
7097
+2013-11-15  Ulrich Weigand  <Ulrich.Weigand@de.ibm.com>
 
7098
+
 
7099
+       Backport from mainline r204805:
 
7100
+
 
7101
+       2013-11-14  Ulrich Weigand  <Ulrich.Weigand@de.ibm.com>
 
7102
+
 
7103
+       * config/rs6000/rs6000.c (USE_FP_FOR_ARG_P): Remove TYPE argument.
 
7104
+       (USE_ALTIVEC_FOR_ARG_P): Likewise.
 
7105
+       (rs6000_darwin64_record_arg_advance_recurse): Update uses.
 
7106
+       (rs6000_function_arg_advance_1):Likewise.
 
7107
+       (rs6000_darwin64_record_arg_recurse): Likewise.
 
7108
+       (rs6000_function_arg): Likewise.
 
7109
+       (rs6000_arg_partial_bytes): Likewise.
 
7110
+
 
7111
+2013-11-15  Ulrich Weigand  <Ulrich.Weigand@de.ibm.com>
 
7112
+
 
7113
+       Backport from mainline r204804:
 
7114
+
 
7115
+       2013-11-14  Ulrich Weigand  <Ulrich.Weigand@de.ibm.com>
 
7116
+
 
7117
+       * config/rs6000/rs6000.c (rs6000_option_override_internal): Replace
 
7118
+       "DEFAULT_ABI != ABI_AIX" test by testing for ABI_V4 or ABI_DARWIN.
 
7119
+       (rs6000_savres_strategy): Likewise.
 
7120
+       (rs6000_return_addr): Likewise.
 
7121
+       (rs6000_emit_load_toc_table): Replace "DEFAULT_ABI != ABI_AIX" by
 
7122
+       testing for ABI_V4 (since ABI_DARWIN is impossible here).
 
7123
+       (rs6000_emit_prologue): Likewise.
 
7124
+       (legitimate_lo_sum_address_p): Simplify DEFAULT_ABI test.
 
7125
+       (rs6000_elf_declare_function_name): Remove duplicated test.
 
7126
+       * config/rs6000/rs6000.md ("load_toc_v4_PIC_1"): Explicitly test
 
7127
+       for ABI_V4 (instead of "DEFAULT_ABI != ABI_AIX" test).
 
7128
+       ("load_toc_v4_PIC_1_normal"): Likewise.
 
7129
+       ("load_toc_v4_PIC_1_476"): Likewise.
 
7130
+       ("load_toc_v4_PIC_1b"): Likewise.
 
7131
+       ("load_toc_v4_PIC_1b_normal"): Likewise.
 
7132
+       ("load_toc_v4_PIC_1b_476"): Likewise.
 
7133
+       ("load_toc_v4_PIC_2"): Likewise.
 
7134
+       ("load_toc_v4_PIC_3b"): Likewise.
 
7135
+       ("load_toc_v4_PIC_3c"): Likewise.
 
7136
+       * config/rs6000/rs6000.h (RS6000_REG_SAVE): Simplify DEFAULT_ABI test.
 
7137
+       (RS6000_SAVE_AREA): Likewise.
 
7138
+       (FP_ARG_MAX_REG): Likewise.
 
7139
+       (RETURN_ADDRESS_OFFSET): Likewise.
 
7140
+       * config/rs6000/sysv.h (TARGET_TOC): Test for ABI_V4 instead
 
7141
+       of ABI_AIX.
 
7142
+       (SUBTARGET_OVERRIDE_OPTIONS): Likewise.
 
7143
+       (MINIMAL_TOC_SECTION_ASM_OP): Likewise.
 
7144
+
 
7145
+2013-11-15  Ulrich Weigand  <Ulrich.Weigand@de.ibm.com>
 
7146
+
 
7147
+       Backport from mainline r204803:
 
7148
+
 
7149
+       2013-11-14  Ulrich Weigand  <Ulrich.Weigand@de.ibm.com>
 
7150
+
 
7151
+       * config/rs6000/rs6000.c (rs6000_call_indirect_aix): Rename to ...
 
7152
+       (rs6000_call_aix): ... this.  Handle both direct and indirect calls.
 
7153
+       Create call insn directly instead of via various gen_... routines.
 
7154
+       Mention special registers used by the call in CALL_INSN_FUNCTION_USAGE.
 
7155
+       (rs6000_sibcall_aix): New function.
 
7156
+       * config/rs6000/rs6000.md (TOC_SAVE_OFFSET_32BIT): Remove.
 
7157
+       (TOC_SAVE_OFFSET_64BIT): Likewise.
 
7158
+       (AIX_FUNC_DESC_TOC_32BIT): Likewise.
 
7159
+       (AIX_FUNC_DESC_TOC_64BIT): Likewise.
 
7160
+       (AIX_FUNC_DESC_SC_32BIT): Likewise.
 
7161
+       (AIX_FUNC_DESC_SC_64BIT): Likewise.
 
7162
+       ("call" expander): Call rs6000_call_aix.
 
7163
+       ("call_value" expander): Likewise.
 
7164
+       ("call_indirect_aix<ptrsize>"): Replace this pattern ...
 
7165
+       ("call_indirect_aix<ptrsize>_nor11"): ... and this pattern ...
 
7166
+       ("*call_indirect_aix<mode>"): ... by this insn pattern.
 
7167
+       ("call_value_indirect_aix<ptrsize>"): Replace this pattern ...
 
7168
+       ("call_value_indirect_aix<ptrsize>_nor11"): ... and this pattern ...
 
7169
+       ("*call_value_indirect_aix<mode>"): ... by this insn pattern.
 
7170
+       ("*call_nonlocal_aix32", "*call_nonlocal_aix64"): Replace by ...
 
7171
+       ("*call_nonlocal_aix<mode>"): ... this pattern.
 
7172
+       ("*call_value_nonlocal_aix32", "*call_value_nonlocal_aix64"): Replace
 
7173
+       ("*call_value_nonlocal_aix<mode>"): ... by this pattern.
 
7174
+       ("*call_local_aix<mode>"): New insn pattern.
 
7175
+       ("*call_value_local_aix<mode>"): Likewise.
 
7176
+       ("sibcall" expander): Call rs6000_sibcall_aix.
 
7177
+       ("sibcall_value" expander): Likewise.  Move earlier in file.
 
7178
+       ("*sibcall_nonlocal_aix<mode>"): Replace by ...
 
7179
+       ("*sibcall_aix<mode>"): ... this pattern.
 
7180
+       ("*sibcall_value_nonlocal_aix<mode>"): Replace by ...
 
7181
+       ("*sibcall_value_aix<mode>"): ... this pattern.
 
7182
+       * config/rs6000/rs6000-protos.h (rs6000_call_indirect_aix): Remove.
 
7183
+       (rs6000_call_aix): Add prototype.
 
7184
+       (rs6000_sibcall_aix): Likewise.
 
7185
+
 
7186
+2013-11-15  Ulrich Weigand  <Ulrich.Weigand@de.ibm.com>
 
7187
+
 
7188
+       Backport from mainline r204799:
 
7189
+
 
7190
+       2013-11-14  Ulrich Weigand  <Ulrich.Weigand@de.ibm.com>
 
7191
+
 
7192
+       * config/rs6000/rs6000.c (rs6000_emit_prologue): Do not place a
 
7193
+       RTX_FRAME_RELATED_P marker on the UNSPEC_MOVESI_FROM_CR insn.
 
7194
+       Instead, add USEs of all modified call-saved CR fields to the
 
7195
+       insn storing the result to the stack slot, and provide an
 
7196
+       appropriate REG_FRAME_RELATED_EXPR for that insn.
 
7197
+       * config/rs6000/rs6000.md ("*crsave"): New insn pattern.
 
7198
+       * config/rs6000/predicates.md ("crsave_operation"): New predicate.
 
7199
+
 
7200
+2013-11-15  Ulrich Weigand  <Ulrich.Weigand@de.ibm.com>
 
7201
+
 
7202
+       Backport from mainline r204798:
 
7203
+
 
7204
+       2013-11-14  Ulrich Weigand  <Ulrich.Weigand@de.ibm.com>
 
7205
+                   Alan Modra  <amodra@gmail.com>
 
7206
+
 
7207
+       * function.c (assign_parms): Use all.reg_parm_stack_space instead
 
7208
+       of re-evaluating REG_PARM_STACK_SPACE target macro.
 
7209
+       (locate_and_pad_parm): New parameter REG_PARM_STACK_SPACE.  Use it
 
7210
+       instead of evaluating target macro REG_PARM_STACK_SPACE every time.
 
7211
+       (assign_parm_find_entry_rtl): Update call.
 
7212
+       * calls.c (initialize_argument_information): Update call.
 
7213
+       (emit_library_call_value_1): Likewise.
 
7214
+       * expr.h (locate_and_pad_parm): Update prototype.
 
7215
+
 
7216
+2013-11-15  Ulrich Weigand  <Ulrich.Weigand@de.ibm.com>
 
7217
+
 
7218
+       Backport from mainline r204797:
 
7219
+
 
7220
+       2013-11-14  Ulrich Weigand  <Ulrich.Weigand@de.ibm.com>
 
7221
+
 
7222
+       * calls.c (store_unaligned_arguments_into_pseudos): Skip PARALLEL
 
7223
+       arguments.
 
7224
+
 
7225
+2013-11-15  Ulrich Weigand  <Ulrich.Weigand@de.ibm.com>
 
7226
+
 
7227
+       Backport from mainline r197003:
 
7228
+
 
7229
+       2013-03-23  Eric Botcazou  <ebotcazou@adacore.com>
 
7230
+
 
7231
+       * calls.c (expand_call): Add missing guard to code handling return
 
7232
+       of non-BLKmode structures in MSB.
 
7233
+       * function.c (expand_function_end): Likewise.
 
7234
+
 
7235
+2013-11-15  Ulrich Weigand  <Ulrich.Weigand@de.ibm.com>
 
7236
+
 
7237
+       Backport from mainline r201750.
 
7238
+       Note: Default setting of -mcompat-align-parm inverted!
 
7239
+
 
7240
+       2013-08-14  Bill Schmidt  <wschmidt@linux.vnet.ibm.com>
 
7241
+
 
7242
+       PR target/57949
 
7243
+       * doc/invoke.texi: Add documentation of mcompat-align-parm
 
7244
+       option.
 
7245
+       * config/rs6000/rs6000.opt: Add mcompat-align-parm option.
 
7246
+       * config/rs6000/rs6000.c (rs6000_function_arg_boundary): For AIX
 
7247
+       and Linux, correct BLKmode alignment when 128-bit alignment is
 
7248
+       required and compatibility flag is not set.
 
7249
+       (rs6000_gimplify_va_arg): For AIX and Linux, honor specified
 
7250
+       alignment for zero-size arguments when compatibility flag is not
 
7251
+       set.
 
7252
+
 
7253
+2013-11-12  Bill Schmidt  <wschmidt@linux.vnet.ibm.com>
 
7254
+
 
7255
+       * configure: Regenerate.
 
7256
+
 
7257
+2013-11-10  Bill Schmidt  <wschmidt@linux.vnet.ibm.com>
 
7258
+
 
7259
+       Backport from mainline r204441
 
7260
+       2013-11-05  Bill Schmidt  <wschmidt@linux.vnet.ibm.com>
 
7261
+
 
7262
+       * config/rs6000/rs6000.c (rs6000_option_override_internal):
 
7263
+       Remove restriction against use of VSX instructions when generating
 
7264
+       code for little endian mode.
 
7265
+
 
7266
+2013-11-10  Bill Schmidt  <wschmidt@linux.vnet.ibm.com>
 
7267
+
 
7268
+       Backport from mainline r204440
 
7269
+       2013-11-05  Bill Schmidt  <wschmidt@linux.vnet.ibm.com>
 
7270
+
 
7271
+       * config/rs6000/altivec.md (mulv4si3): Ensure we generate vmulouh
 
7272
+       for both big and little endian.
 
7273
+       (mulv8hi3): Swap input operands for merge high and merge low
 
7274
+       instructions for little endian.
 
7275
+
 
7276
+2013-11-10  Bill Schmidt  <wschmidt@linux.vnet.ibm.com>
 
7277
+
 
7278
+       Backport from mainline r204439
 
7279
+       2013-11-05  Bill Schmidt  <wschmidt@linux.vnet.ibm.com>
 
7280
+
 
7281
+       * config/rs6000/altivec.md (vec_widen_umult_even_v16qi): Change
 
7282
+       define_insn to define_expand that uses even patterns for big
 
7283
+       endian and odd patterns for little endian.
 
7284
+       (vec_widen_smult_even_v16qi): Likewise.
 
7285
+       (vec_widen_umult_even_v8hi): Likewise.
 
7286
+       (vec_widen_smult_even_v8hi): Likewise.
 
7287
+       (vec_widen_umult_odd_v16qi): Likewise.
 
7288
+       (vec_widen_smult_odd_v16qi): Likewise.
 
7289
+       (vec_widen_umult_odd_v8hi): Likewise.
 
7290
+       (vec_widen_smult_odd_v8hi): Likewise.
 
7291
+       (altivec_vmuleub): New define_insn.
 
7292
+       (altivec_vmuloub): Likewise.
 
7293
+       (altivec_vmulesb): Likewise.
 
7294
+       (altivec_vmulosb): Likewise.
 
7295
+       (altivec_vmuleuh): Likewise.
 
7296
+       (altivec_vmulouh): Likewise.
 
7297
+       (altivec_vmulesh): Likewise.
 
7298
+       (altivec_vmulosh): Likewise.
 
7299
+
 
7300
+2013-11-10  Bill Schmidt  <wschmidt@linux.vnet.ibm.com>
 
7301
+
 
7302
+       Backport from mainline r204395
 
7303
+       2013-11-05  Bill Schmidt  <wschmidt@linux.vnet.ibm.com>
 
7304
+
 
7305
+       * config/rs6000/vector.md (vec_pack_sfix_trunc_v2df): Adjust for
 
7306
+       little endian.
 
7307
+       (vec_pack_ufix_trunc_v2df): Likewise.
 
7308
+
 
7309
+2013-11-10  Bill Schmidt  <wschmidt@linux.vnet.ibm.com>
 
7310
+
 
7311
+       Backport from mainline r204363
 
7312
+       2013-11-04  Bill Schmidt  <wschmidt@linux.vnet.ibm.com>
 
7313
+
 
7314
+       * config/rs6000/altivec.md (vec_widen_umult_hi_v16qi): Swap
 
7315
+       arguments to merge instruction for little endian.
 
7316
+       (vec_widen_umult_lo_v16qi): Likewise.
 
7317
+       (vec_widen_smult_hi_v16qi): Likewise.
 
7318
+       (vec_widen_smult_lo_v16qi): Likewise.
 
7319
+       (vec_widen_umult_hi_v8hi): Likewise.
 
7320
+       (vec_widen_umult_lo_v8hi): Likewise.
 
7321
+       (vec_widen_smult_hi_v8hi): Likewise.
 
7322
+       (vec_widen_smult_lo_v8hi): Likewise.
 
7323
+
 
7324
+2013-11-10  Bill Schmidt  <wschmidt@linux.vnet.ibm.com>
 
7325
+
 
7326
+       Backport from mainline r204350
 
7327
+       2013-11-04  Bill Schmidt  <wschmidt@linux.vnet.ibm.com>
 
7328
+
 
7329
+       * config/rs6000/vsx.md (*vsx_le_perm_store_<mode> for VSX_D):
 
7330
+       Replace the define_insn_and_split with a define_insn and two
 
7331
+       define_splits, with the split after reload re-permuting the source
 
7332
+       register to its original value.
 
7333
+       (*vsx_le_perm_store_<mode> for VSX_W): Likewise.
 
7334
+       (*vsx_le_perm_store_v8hi): Likewise.
 
7335
+       (*vsx_le_perm_store_v16qi): Likewise.
 
7336
+
 
7337
+2013-11-10  Bill Schmidt  <wschmidt@linux.vnet.ibm.com>
 
7338
+
 
7339
+       Backport from mainline r204321
 
7340
+       2013-11-04  Bill Schmidt  <wschmidt@linux.vnet.ibm.com>
 
7341
+
 
7342
+       * config/rs6000/vector.md (vec_pack_trunc_v2df):  Adjust for
 
7343
+       little endian.
 
7344
+
 
7345
+2013-11-10  Bill Schmidt  <wschmidt@linux.vnet.ibm.com>
 
7346
+
 
7347
+       Backport from mainline r204321
 
7348
+       2013-11-02  Bill Schmidt  <wschmidt@vnet.linux.ibm.com>
 
7349
+
 
7350
+       * config/rs6000/rs6000.c (rs6000_expand_vector_set): Adjust for
 
7351
+       little endian.
 
7352
+
 
7353
+2013-11-10  Bill Schmidt  <wschmidt@linux.vnet.ibm.com>
 
7354
+
 
7355
+       Backport from mainline r203980
 
7356
+       2013-10-23  Bill Schmidt  <wschmidt@linux.vnet.ibm.com>
 
7357
+
 
7358
+       * config/rs6000/altivec.md (mulv8hi3): Adjust for little endian.
 
7359
+
 
7360
+2013-11-08  Bill Schmidt  <wschmidt@linux.vnet.ibm.com>
 
7361
+
 
7362
+       Backport from mainline r203930
 
7363
+       2013-10-22  Bill Schmidt  <wschmidt@vnet.ibm.com>
 
7364
+
 
7365
+       * config/rs6000/rs6000.c (altivec_expand_vec_perm_const): Reverse
 
7366
+       meaning of merge-high and merge-low masks for little endian; avoid
 
7367
+       use of vector-pack masks for little endian for mismatched modes.
 
7368
+
 
7369
+2013-11-08  Bill Schmidt  <wschmidt@linux.vnet.ibm.com>
 
7370
+
 
7371
+       Backport from mainline r203877
 
7372
+       2013-10-20  Bill Schmidt  <wschmidt@linux.vnet.ibm.com>
 
7373
+
 
7374
+       * config/rs6000/altivec.md (vec_unpacku_hi_v16qi): Adjust for
 
7375
+       little endian.
 
7376
+       (vec_unpacku_hi_v8hi): Likewise.
 
7377
+       (vec_unpacku_lo_v16qi): Likewise.
 
7378
+       (vec_unpacku_lo_v8hi): Likewise.
 
7379
+
 
7380
+2013-11-08  Bill Schmidt  <wschmidt@linux.vnet.ibm.com>
 
7381
+
 
7382
+       Backport from mainline r203863
 
7383
+       2013-10-19  Bill Schmidt  <wschmidt@linux.vnet.ibm.com>
 
7384
+
 
7385
+       * config/rs6000/rs6000.c (vspltis_constant): Make sure we check
 
7386
+       all elements for both endian flavors.
 
7387
+
 
7388
+2013-11-08  Bill Schmidt  <wschmidt@linux.vnet.ibm.com>
 
7389
+
 
7390
+       Backport from mainline r203714
 
7391
+       2013-10-16  Bill Schmidt  <wschmidt@linux.vnet.ibm.com>
 
7392
+
 
7393
+       * gcc/config/rs6000/vector.md (vec_unpacks_hi_v4sf): Correct for
 
7394
+       endianness.
 
7395
+       (vec_unpacks_lo_v4sf): Likewise.
 
7396
+       (vec_unpacks_float_hi_v4si): Likewise.
 
7397
+       (vec_unpacks_float_lo_v4si): Likewise.
 
7398
+       (vec_unpacku_float_hi_v4si): Likewise.
 
7399
+       (vec_unpacku_float_lo_v4si): Likewise.
 
7400
+
 
7401
+2013-11-08  Bill Schmidt  <wschmidt@linux.vnet.ibm.com>
 
7402
+
 
7403
+       Backport from mainline r203713
 
7404
+       2013-10-16  Bill Schmidt  <wschmidt@linux.vnet.ibm.com>
 
7405
+
 
7406
+       * config/rs6000/vsx.md (vsx_concat_<mode>): Adjust output for LE.
 
7407
+       (vsx_concat_v2sf): Likewise.
 
7408
+
 
7409
+2013-11-08  Bill Schmidt  <wschmidt@linux.vnet.ibm.com>
 
7410
+
 
7411
+       Backport from mainline r203458
 
7412
+       2013-10-11  Bill Schmidt  <wschmidt@linux.vnet.ibm.com>
 
7413
+
 
7414
+       * config/rs6000/vsx.md (*vsx_le_perm_load_v2di): Generalize to
 
7415
+       handle vector float as well.
 
7416
+       (*vsx_le_perm_load_v4si): Likewise.
 
7417
+       (*vsx_le_perm_store_v2di): Likewise.
 
7418
+       (*vsx_le_perm_store_v4si): Likewise.
 
7419
+
 
7420
+2013-11-08  Bill Schmidt  <wschmidt@linux.vnet.ibm.com>
 
7421
+
 
7422
+       Backport from mainline r203457
 
7423
+       2013-10-11  Bill Schmidt  <wschmidt@linux.vnet.ibm.com>
 
7424
+
 
7425
+       * config/rs6000/vector.md (vec_realign_load<mode>): Generate vperm
 
7426
+       directly to circumvent subtract from splat{31} workaround.
 
7427
+       * config/rs6000/rs6000-protos.h (altivec_expand_vec_perm_le): New
 
7428
+       prototype.
 
7429
+       * config/rs6000/rs6000.c (altivec_expand_vec_perm_le): New.
 
7430
+       * config/rs6000/altivec.md (define_c_enum "unspec"): Add
 
7431
+       UNSPEC_VPERM_X and UNSPEC_VPERM_UNS_X.
 
7432
+       (altivec_vperm_<mode>): Convert to define_insn_and_split to
 
7433
+       separate big and little endian logic.
 
7434
+       (*altivec_vperm_<mode>_internal): New define_insn.
 
7435
+       (altivec_vperm_<mode>_uns): Convert to define_insn_and_split to
 
7436
+       separate big and little endian logic.
 
7437
+       (*altivec_vperm_<mode>_uns_internal): New define_insn.
 
7438
+       (vec_permv16qi): Add little endian logic.
 
7439
+
 
7440
+2013-11-08  Bill Schmidt  <wschmidt@linux.vnet.ibm.com>
 
7441
+
 
7442
+       Backport from mainline r203247
 
7443
+       2013-10-07  Bill Schmidt  <wschmidt@linux.vnet.ibm.com>
 
7444
+
 
7445
+       * config/rs6000/rs6000.c (altivec_expand_vec_perm_const_le): New.
 
7446
+       (altivec_expand_vec_perm_const): Call it.
 
7447
+
 
7448
+2013-11-08  Bill Schmidt  <wschmidt@linux.vnet.ibm.com>
 
7449
+
 
7450
+       Backport from mainline r203246
 
7451
+       2013-10-07  Bill Schmidt  <wschmidt@linux.vnet.ibm.com>
 
7452
+
 
7453
+       * config/rs6000/vector.md (mov<mode>): Emit permuted move
 
7454
+       sequences for LE VSX loads and stores at expand time.
 
7455
+       * config/rs6000/rs6000-protos.h (rs6000_emit_le_vsx_move): New
 
7456
+       prototype.
 
7457
+       * config/rs6000/rs6000.c (rs6000_const_vec): New.
 
7458
+       (rs6000_gen_le_vsx_permute): New.
 
7459
+       (rs6000_gen_le_vsx_load): New.
 
7460
+       (rs6000_gen_le_vsx_store): New.
 
7461
+       (rs6000_gen_le_vsx_move): New.
 
7462
+       * config/rs6000/vsx.md (*vsx_le_perm_load_v2di): New.
 
7463
+       (*vsx_le_perm_load_v4si): New.
 
7464
+       (*vsx_le_perm_load_v8hi): New.
 
7465
+       (*vsx_le_perm_load_v16qi): New.
 
7466
+       (*vsx_le_perm_store_v2di): New.
 
7467
+       (*vsx_le_perm_store_v4si): New.
 
7468
+       (*vsx_le_perm_store_v8hi): New.
 
7469
+       (*vsx_le_perm_store_v16qi): New.
 
7470
+       (*vsx_xxpermdi2_le_<mode>): New.
 
7471
+       (*vsx_xxpermdi4_le_<mode>): New.
 
7472
+       (*vsx_xxpermdi8_le_V8HI): New.
 
7473
+       (*vsx_xxpermdi16_le_V16QI): New.
 
7474
+       (*vsx_lxvd2x2_le_<mode>): New.
 
7475
+       (*vsx_lxvd2x4_le_<mode>): New.
 
7476
+       (*vsx_lxvd2x8_le_V8HI): New.
 
7477
+       (*vsx_lxvd2x16_le_V16QI): New.
 
7478
+       (*vsx_stxvd2x2_le_<mode>): New.
 
7479
+       (*vsx_stxvd2x4_le_<mode>): New.
 
7480
+       (*vsx_stxvd2x8_le_V8HI): New.
 
7481
+       (*vsx_stxvd2x16_le_V16QI): New.
 
7482
+
 
7483
+2013-11-08  Bill Schmidt  <wschmidt@linux.vnet.ibm.com>
 
7484
+
 
7485
+       Backport from mainline r201235
 
7486
+       2013-07-24  Bill Schmidt  <wschmidt@linux.ibm.com>
 
7487
+                   Anton Blanchard <anton@au1.ibm.com>
 
7488
+
 
7489
+       * config/rs6000/altivec.md (altivec_vpkpx): Handle little endian.
 
7490
+       (altivec_vpks<VI_char>ss): Likewise.
 
7491
+       (altivec_vpks<VI_char>us): Likewise.
 
7492
+       (altivec_vpku<VI_char>us): Likewise.
 
7493
+       (altivec_vpku<VI_char>um): Likewise.
 
7494
+
 
7495
+2013-11-08  Bill Schmidt  <wschmidt@linux.vnet.ibm.com>
 
7496
+
 
7497
+       Backport from mainline r201208
 
7498
+       2013-07-24  Bill Schmidt  <wschmidt@vnet.linux.ibm.com>
 
7499
+                   Anton Blanchard <anton@au1.ibm.com>
 
7500
+
 
7501
+       * config/rs6000/vector.md (vec_realign_load_<mode>): Reorder input
 
7502
+       operands to vperm for little endian.
 
7503
+       * config/rs6000/rs6000.c (rs6000_expand_builtin): Use lvsr instead
 
7504
+       of lvsl to create the control mask for a vperm for little endian.
 
7505
+
 
7506
+2013-11-08  Bill Schmidt  <wschmidt@linux.vnet.ibm.com>
 
7507
+
 
7508
+       Backport from mainline r201195
 
7509
+       2013-07-23  Bill Schmidt  <wschmidt@linux.vnet.ibm.com>
 
7510
+                   Anton Blanchard <anton@au1.ibm.com>
 
7511
+
 
7512
+       * config/rs6000/rs6000.c (altivec_expand_vec_perm_const): Reverse
 
7513
+       two operands for little-endian.
 
7514
+
 
7515
+2013-11-08  Bill Schmidt  <wschmidt@linux.vnet.ibm.com>
 
7516
+
 
7517
+       Backport from mainline r201193
 
7518
+       2013-07-23  Bill Schmidt  <wschmidt@linux.vnet.ibm.com>
 
7519
+                   Anton Blanchard <anton@au1.ibm.com>
 
7520
+
 
7521
+       * config/rs6000/rs6000.c (altivec_expand_vec_perm_const): Correct
 
7522
+       selection of field for vector splat in little endian mode.
 
7523
+
 
7524
+2013-11-08  Bill Schmidt  <wschmidt@linux.vnet.ibm.com>
 
7525
+
 
7526
+       Backport from mainline r201149
 
7527
+       2013-07-22  Bill Schmidt  <wschmidt@vnet.linux.ibm.com>
 
7528
+                   Anton Blanchard <anton@au1.ibm.com>
 
7529
+
 
7530
+       * config/rs6000/rs6000.c (rs6000_expand_vector_init): Fix
 
7531
+       endianness when selecting field to splat.
 
7532
+
 
7533
+2013-10-21  Bill Schmidt  <wschmidt@linux.vnet.ibm.com>
 
7534
+
 
7535
+       Backport from mainline
 
7536
+       2013-04-05  Bill Schmidt  <wschmidt@linux.vnet.ibm.com>
 
7537
+
 
7538
+       PR target/56843
 
7539
+       * config/rs6000/rs6000.c (rs6000_emit_swdiv_high_precision): Remove.
 
7540
+       (rs6000_emit_swdiv_low_precision): Remove.
 
7541
+       (rs6000_emit_swdiv): Rewrite to handle between one and four
 
7542
+       iterations of Newton-Raphson generally; modify required number of
 
7543
+       iterations for some cases.
 
7544
+       * config/rs6000/rs6000.h (RS6000_RECIP_HIGH_PRECISION_P): Remove.
 
7545
+
 
7546
+2013-10-17  Michael Meissner  <meissner@linux.vnet.ibm.com>
 
7547
+
 
7548
+       Backport from mainline
 
7549
+       2013-10-17  Michael Meissner  <meissner@linux.vnet.ibm.com>
 
7550
+
 
7551
+       * config/rs6000/rs6000.c (enum rs6000_reload_reg_type): Add new
 
7552
+       fields to the reg_addr array that describes the valid addressing
 
7553
+       mode for any register, general purpose registers, floating point
 
7554
+       registers, and Altivec registers.
 
7555
+       (FIRST_RELOAD_REG_CLASS): Likewise.
 
7556
+       (LAST_RELOAD_REG_CLASS): Likewise.
 
7557
+       (struct reload_reg_map_type): Likewise.
 
7558
+       (reload_reg_map_type): Likewise.
 
7559
+       (RELOAD_REG_VALID): Likewise.
 
7560
+       (RELOAD_REG_MULTIPLE): Likewise.
 
7561
+       (RELOAD_REG_INDEXED): Likewise.
 
7562
+       (RELOAD_REG_OFFSET): Likewise.
 
7563
+       (RELOAD_REG_PRE_INCDEC): Likewise.
 
7564
+       (RELOAD_REG_PRE_MODIFY): Likewise.
 
7565
+       (reg_addr): Likewise.
 
7566
+       (mode_supports_pre_incdec_p): New helper functions to say whether
 
7567
+       a given mode supports PRE_INC, PRE_DEC, and PRE_MODIFY.
 
7568
+       (mode_supports_pre_modify_p): Likewise.
 
7569
+       (rs6000_debug_vector_unit): Rearrange the -mdebug=reg output to
 
7570
+       print the valid address mode bits for each mode.
 
7571
+       (rs6000_debug_print_mode): Likewise.
 
7572
+       (rs6000_debug_reg_global): Likewise.
 
7573
+       (rs6000_setup_reg_addr_masks): New function to set up the address
 
7574
+       mask bits for each type.
 
7575
+       (rs6000_init_hard_regno_mode_ok): Use memset to clear arrays.
 
7576
+       Call rs6000_setup_reg_addr_masks to set up the address mask bits.
 
7577
+       (rs6000_legitimate_address_p): Use mode_supports_pre_incdec_p and
 
7578
+       mode_supports_pre_modify_p to determine if PRE_INC, PRE_DEC, and
 
7579
+       PRE_MODIFY are supported.
 
7580
+       (rs6000_output_move_128bit): Change to use {src,dest}_vmx_p for altivec
 
7581
+       registers, instead of {src,dest}_av_p.
 
7582
+       (rs6000_print_options_internal): Tweak the debug output slightly.
 
7583
+
 
7584
+       Backport from mainline
 
7585
+       2013-10-03  Michael Meissner  <meissner@linux.vnet.ibm.com>
 
7586
+
 
7587
+       * config/rs6000/rs6000-builtin.def (XSRDPIM): Use floatdf2,
 
7588
+       ceildf2, btruncdf2, instead of vsx_* name.
 
7589
+
 
7590
+       * config/rs6000/vsx.md (vsx_add<mode>3): Change arithmetic
 
7591
+       iterators to only do V2DF and V4SF here.  Move the DF code to
 
7592
+       rs6000.md where it is combined with SF mode.  Replace <VSv> with
 
7593
+       just 'v' since only vector operations are handled with these insns
 
7594
+       after moving the DF support to rs6000.md.
 
7595
+       (vsx_sub<mode>3): Likewise.
 
7596
+       (vsx_mul<mode>3): Likewise.
 
7597
+       (vsx_div<mode>3): Likewise.
 
7598
+       (vsx_fre<mode>2): Likewise.
 
7599
+       (vsx_neg<mode>2): Likewise.
 
7600
+       (vsx_abs<mode>2): Likewise.
 
7601
+       (vsx_nabs<mode>2): Likewise.
 
7602
+       (vsx_smax<mode>3): Likewise.
 
7603
+       (vsx_smin<mode>3): Likewise.
 
7604
+       (vsx_sqrt<mode>2): Likewise.
 
7605
+       (vsx_rsqrte<mode>2): Likewise.
 
7606
+       (vsx_fms<mode>4): Likewise.
 
7607
+       (vsx_nfma<mode>4): Likewise.
 
7608
+       (vsx_copysign<mode>3): Likewise.
 
7609
+       (vsx_btrunc<mode>2): Likewise.
 
7610
+       (vsx_floor<mode>2): Likewise.
 
7611
+       (vsx_ceil<mode>2): Likewise.
 
7612
+       (vsx_smaxsf3): Delete scalar ops that were moved to rs6000.md.
 
7613
+       (vsx_sminsf3): Likewise.
 
7614
+       (vsx_fmadf4): Likewise.
 
7615
+       (vsx_fmsdf4): Likewise.
 
7616
+       (vsx_nfmadf4): Likewise.
 
7617
+       (vsx_nfmsdf4): Likewise.
 
7618
+       (vsx_cmpdf_internal1): Likewise.
 
7619
+
 
7620
+       * config/rs6000/rs6000.h (TARGET_SF_SPE): Define macros to make it
 
7621
+       simpler to select whether a target has SPE or traditional floating
 
7622
+       point support in iterators.
 
7623
+       (TARGET_DF_SPE): Likewise.
 
7624
+       (TARGET_SF_FPR): Likewise.
 
7625
+       (TARGET_DF_FPR): Likewise.
 
7626
+       (TARGET_SF_INSN): Macros to say whether floating point support
 
7627
+       exists for a given operation for expanders.
 
7628
+       (TARGET_DF_INSN): Likewise.
 
7629
+
 
7630
+       * config/rs6000/rs6000.c (Ftrad): New mode attributes to allow
 
7631
+       combining of SF/DF mode operations, using both traditional and VSX
 
7632
+       registers.
 
7633
+       (Fvsx): Likewise.
 
7634
+       (Ff): Likewise.
 
7635
+       (Fv): Likewise.
 
7636
+       (Fs): Likewise.
 
7637
+       (Ffre): Likewise.
 
7638
+       (FFRE): Likewise.
 
7639
+       (abs<mode>2): Combine SF/DF modes using traditional floating point
 
7640
+       instructions.  Add support for using the upper DF registers with
 
7641
+       VSX support, and SF registers with power8-vector support.  Update
 
7642
+       expanders for operations supported by both the SPE and traditional
 
7643
+       floating point units.
 
7644
+       (abs<mode>2_fpr): Likewise.
 
7645
+       (nabs<mode>2): Likewise.
 
7646
+       (nabs<mode>2_fpr): Likewise.
 
7647
+       (neg<mode>2): Likewise.
 
7648
+       (neg<mode>2_fpr): Likewise.
 
7649
+       (add<mode>3): Likewise.
 
7650
+       (add<mode>3_fpr): Likewise.
 
7651
+       (sub<mode>3): Likewise.
 
7652
+       (sub<mode>3_fpr): Likewise.
 
7653
+       (mul<mode>3): Likewise.
 
7654
+       (mul<mode>3_fpr): Likewise.
 
7655
+       (div<mode>3): Likewise.
 
7656
+       (div<mode>3_fpr): Likewise.
 
7657
+       (sqrt<mode>3): Likewise.
 
7658
+       (sqrt<mode>3_fpr): Likewise.
 
7659
+       (fre<Fs>): Likewise.
 
7660
+       (rsqrt<mode>2): Likewise.
 
7661
+       (cmp<mode>_fpr): Likewise.
 
7662
+       (smax<mode>3): Likewise.
 
7663
+       (smin<mode>3): Likewise.
 
7664
+       (smax<mode>3_vsx): Likewise.
 
7665
+       (smin<mode>3_vsx): Likewise.
 
7666
+       (negsf2): Delete SF operations that are merged with DF.
 
7667
+       (abssf2): Likewise.
 
7668
+       (addsf3): Likewise.
 
7669
+       (subsf3): Likewise.
 
7670
+       (mulsf3): Likewise.
 
7671
+       (divsf3): Likewise.
 
7672
+       (fres): Likewise.
 
7673
+       (fmasf4_fpr): Likewise.
 
7674
+       (fmssf4_fpr): Likewise.
 
7675
+       (nfmasf4_fpr): Likewise.
 
7676
+       (nfmssf4_fpr): Likewise.
 
7677
+       (sqrtsf2): Likewise.
 
7678
+       (rsqrtsf_internal1): Likewise.
 
7679
+       (smaxsf3): Likewise.
 
7680
+       (sminsf3): Likewise.
 
7681
+       (cmpsf_internal1): Likewise.
 
7682
+       (copysign<mode>3_fcpsgn): Add VSX/power8-vector support.
 
7683
+       (negdf2): Delete DF operations that are merged with SF.
 
7684
+       (absdf2): Likewise.
 
7685
+       (nabsdf2): Likewise.
 
7686
+       (adddf3): Likewise.
 
7687
+       (subdf3): Likewise.
 
7688
+       (muldf3): Likewise.
 
7689
+       (divdf3): Likewise.
 
7690
+       (fred): Likewise.
 
7691
+       (rsqrtdf_internal1): Likewise.
 
7692
+       (fmadf4_fpr): Likewise.
 
7693
+       (fmsdf4_fpr): Likewise.
 
7694
+       (nfmadf4_fpr): Likewise.
 
7695
+       (nfmsdf4_fpr): Likewise.
 
7696
+       (sqrtdf2): Likewise.
 
7697
+       (smaxdf3): Likewise.
 
7698
+       (smindf3): Likewise.
 
7699
+       (cmpdf_internal1): Likewise.
 
7700
+       (lrint<mode>di2): Use TARGET_<MODE>_FPR macro.
 
7701
+       (btrunc<mode>2): Delete separate expander, and combine with the
 
7702
+       insn and add VSX instruction support.  Use TARGET_<MODE>_FPR.
 
7703
+       (btrunc<mode>2_fpr): Likewise.
 
7704
+       (ceil<mode>2): Likewise.
 
7705
+       (ceil<mode>2_fpr): Likewise.
 
7706
+       (floor<mode>2): Likewise.
 
7707
+       (floor<mode>2_fpr): Likewise.
 
7708
+       (fma<mode>4_fpr): Combine SF and DF fused multiply/add support.
 
7709
+       Add support for using the upper registers with VSX and
 
7710
+       power8-vector.  Move insns to be closer to the define_expands. On
 
7711
+       VSX systems, prefer the traditional form of FMA over the VSX
 
7712
+       version, since the traditional form allows the target not to
 
7713
+       overlap with the inputs.
 
7714
+       (fms<mode>4_fpr): Likewise.
 
7715
+       (nfma<mode>4_fpr): Likewise.
 
7716
+       (nfms<mode>4_fpr): Likewise.
 
7717
+
 
7718
+       Backport from mainline
 
7719
+       2013-09-27  Michael Meissner  <meissner@linux.vnet.ibm.com>
 
7720
+
 
7721
+       * config/rs6000/rs6000.c (rs6000_hard_regno_mode_ok): Allow
 
7722
+       DFmode, DImode, and SFmode in the upper VSX registers based on the
 
7723
+       -mupper-regs-{df,sf} flags.  Fix wu constraint to be ALTIVEC_REGS
 
7724
+       if -mpower8-vector.  Combine -mvsx-timode handling with the rest
 
7725
+       of the VSX register handling.
 
7726
+
 
7727
+       * config/rs6000/rs6000.md (f32_lv): Use %x0 for VSX regsters.
 
7728
+       (f32_sv): Likewise.
 
7729
+       (zero_extendsidi2_lfiwzx): Add support for loading into the
 
7730
+       Altivec registers with -mpower8-vector.  Use wu/wv constraints to
 
7731
+       only do VSX memory options on Altivec registers.
 
7732
+       (extendsidi2_lfiwax): Likewise.
 
7733
+       (extendsfdf2_fpr): Likewise.
 
7734
+       (mov<mode>_hardfloat, SF/SD modes): Likewise.
 
7735
+       (mov<mode>_hardfloat32, DF/DD modes): Likewise.
 
7736
+       (mov<mode>_hardfloat64, DF/DD modes): Likewise.
 
7737
+       (movdi_internal64): Likewise.
 
7738
+
 
7739
+       Backport from mainline
 
7740
+       2013-09-23  Michael Meissner  <meissner@linux.vnet.ibm.com>
 
7741
+
 
7742
+       * config/rs6000/rs6000.c (rs6000_vector_reload): Delete, combine
 
7743
+       reload helper function arrays into a single array reg_addr.
 
7744
+       (reload_fpr_gpr): Likewise.
 
7745
+       (reload_gpr_vsx): Likewise.
 
7746
+       (reload_vsx_gpr): Likewise.
 
7747
+       (struct rs6000_reg_addr): Likewise.
 
7748
+       (reg_addr): Likewise.
 
7749
+       (rs6000_debug_reg_global): Change rs6000_vector_reload,
 
7750
+       reload_fpr_gpr, reload_gpr_vsx, reload_vsx_gpr uses to reg_addr.
 
7751
+       (rs6000_init_hard_regno_mode_ok): Likewise.
 
7752
+       (rs6000_secondary_reload_direct_move): Likewise.
 
7753
+       (rs6000_secondary_reload): Likewise.
 
7754
+
 
7755
+       * config/rs6000/rs6000.h (enum r6000_reg_class_enum): Add new
 
7756
+       constraints: wu, ww, and wy.  Repurpose wv constraint added during
 
7757
+       power8 changes.  Put wg constraint in alphabetical order.
 
7758
+
 
7759
+       * config/rs6000/rs6000.opt (-mvsx-scalar-float): New debug switch
 
7760
+       for future work to add ISA 2.07 VSX single precision support.
 
7761
+       (-mvsx-scalar-double): Change default from -1 to 1, update
 
7762
+       documentation comment.
 
7763
+       (-mvsx-scalar-memory): Rename debug switch to -mupper-regs-df.
 
7764
+       (-mupper-regs-df): New debug switch to control whether DF values
 
7765
+       can go in the traditional Altivec registers.
 
7766
+       (-mupper-regs-sf): New debug switch to control whether SF values
 
7767
+       can go in the traditional Altivec registers.
 
7768
+
 
7769
+       * config/rs6000/rs6000.c (rs6000_debug_reg_global): Print wu, ww,
 
7770
+       and wy constraints.
 
7771
+       (rs6000_init_hard_regno_mode_ok): Use ssize_t instead of int for
 
7772
+       loop variables.  Rename -mvsx-scalar-memory to -mupper-regs-df.
 
7773
+       Add new constraints, wu/ww/wy.  Repurpose wv constraint.
 
7774
+       (rs6000_debug_legitimate_address_p): Print if we are running
 
7775
+       before, during, or after reload.
 
7776
+       (rs6000_secondary_reload): Add a comment.
 
7777
+       (rs6000_opt_masks): Add -mupper-regs-df, -mupper-regs-sf.
 
7778
+
 
7779
+       * config/rs6000/constraints.md (wa constraint): Sort w<x>
 
7780
+       constraints.  Update documentation string.
 
7781
+       (wd constraint): Likewise.
 
7782
+       (wf constraint): Likewise.
 
7783
+       (wg constraint): Likewise.
 
7784
+       (wn constraint): Likewise.
 
7785
+       (ws constraint): Likewise.
 
7786
+       (wt constraint): Likewise.
 
7787
+       (wx constraint): Likewise.
 
7788
+       (wz constraint): Likewise.
 
7789
+       (wu constraint): New constraint for ISA 2.07 SFmode scalar
 
7790
+       instructions.
 
7791
+       (ww constraint): Likewise.
 
7792
+       (wy constraint): Likewise.
 
7793
+       (wv constraint): Repurpose ISA 2.07 constraint that did not use in
 
7794
+       the previous submissions.
 
7795
+       * doc/md.texi (PowerPC and IBM RS6000): Likewise.
 
7796
+
 
7797
+       Backport from mainline
 
7798
+       2013-10-17  Michael Meissner  <meissner@linux.vnet.ibm.com>
 
7799
+
 
7800
+       PR target/58673
 
7801
+       * config/rs6000/rs6000.c (rs6000_legitimate_address_p): Only
 
7802
+       restrict TImode addresses to single indirect registers if both
 
7803
+       -mquad-memory and -mvsx-timode are used.
 
7804
+       (rs6000_output_move_128bit): Use quad_load_store_p to determine if
 
7805
+       we should emit load/store quad.  Remove using %y for quad memory
 
7806
+       addresses.
 
7807
+
 
7808
+       * config/rs6000/rs6000.md (mov<mode>_ppc64, TI/PTImode): Add
 
7809
+       constraints to allow load/store quad on machines where TImode is
 
7810
+       not allowed in VSX registers.  Use 'n' instead of 'F' constraint
 
7811
+       for TImode to load integer constants.
 
7812
+
 
7813
+2013-10-02  Michael Meissner  <meissner@linux.vnet.ibm.com>
 
7814
+
 
7815
+       Backport from mainline
 
7816
+       2013-10-02  Michael Meissner  <meissner@linux.vnet.ibm.com>
 
7817
+
 
7818
+       PR target/58587
 
7819
+       * config/rs6000/rs6000-cpus.def (ISA_2_6_MASKS_SERVER): Turn off
 
7820
+       setting -mvsx-timode by default until the underlying problem is
 
7821
+       fixed.
 
7822
+       (RS6000_CPU, power7 defaults): Likewise.
 
7823
+
 
7824
+2013-08-19  Peter Bergner  <bergner@vnet.ibm.com>
 
7825
+
 
7826
+       Backport from mainline
 
7827
+       2013-08-19  Peter Bergner  <bergner@vnet.ibm.com>
 
7828
+                   Jakub Jelinek  <jakub@redhat.com>
 
7829
+
 
7830
+       * builtins.def (BUILT_IN_FABSD32): New DFP ABS builtin.
 
7831
+       (BUILT_IN_FABSD64): Likewise.
 
7832
+       (BUILT_IN_FABSD128): Likewise.
 
7833
+       * builtins.c (expand_builtin): Add support for
 
7834
+       new DFP ABS builtins.
 
7835
+       (fold_builtin_1): Likewise.
 
7836
+       * config/rs6000/dfp.md
 
7837
+       (*negtd2_fpr): Handle
 
7838
+       non-overlapping destination
 
7839
+       and source operands.
 
7840
+       (*abstd2_fpr):
 
7841
+       Likewise.
 
7842
+       (*nabstd2_fpr):
 
7843
+       Likewise.
 
7844
+
 
7845
+2013-08-16  Michael Meissner  <meissner@linux.vnet.ibm.com>
 
7846
+
 
7847
+       Backport from trunk
 
7848
+       2013-08-16  Michael Meissner  <meissner@linux.vnet.ibm.com>
 
7849
+
 
7850
+       PR target/58160
 
7851
+       * config/rs6000/predicates.md (fusion_gpr_mem_load): Allow the
 
7852
+       memory rtx to contain ZERO_EXTEND and SIGN_EXTEND.
 
7853
+
 
7854
+       * config/rs6000/rs6000-protos.h (fusion_gpr_load_p): Pass operands
 
7855
+       array instead of each individual operand as a separate argument.
 
7856
+       (emit_fusion_gpr_load): Likewise.
 
7857
+       (expand_fusion_gpr_load): Add new function declaration.
 
7858
+
 
7859
+       * config/rs6000/rs6000.c (fusion_gpr_load_p): Change the calling
 
7860
+       signature to have the operands passed as an array, instead of as
 
7861
+       separate arguments.  Allow ZERO_EXTEND to be in the memory
 
7862
+       address, and also SIGN_EXTEND if -mpower8-fusion-sign.  Do not
 
7863
+       depend on the register live/dead flags when peepholes are run.
 
7864
+       (expand_fusion_gpr_load): New function to be called from the
 
7865
+       peephole2 pass, to change the register that addis sets to be the
 
7866
+       target register.
 
7867
+       (emit_fusion_gpr_load): Change the calling signature to have the
 
7868
+       operands passed as an array, instead of as separate arguments.
 
7869
+       Allow ZERO_EXTEND to be in the memory address, and also
 
7870
+       SIGN_EXTEND if -mpower8-fusion-sign.
 
7871
+
 
7872
+       * config/rs6000/rs6000.md (UNSPEC_FUSION_GPR): Delete unused
 
7873
+       unspec enumeration.
 
7874
+       (power8 fusion peephole/peephole2): Rework the fusion peepholes to
 
7875
+       adjust the register addis loads up in the peephole2 pass.  Do not
 
7876
+       depend on the register live/dead state when the peephole pass is
 
7877
+       done.
 
7878
+
 
7879
+       Backport from trunk
 
7880
+       2013-07-23  Michael Meissner  <meissner@linux.vnet.ibm.com>
 
7881
+
 
7882
+       * config/rs6000/vector.md (xor<mode>3): Move 128-bit boolean
 
7883
+       expanders to rs6000.md.
 
7884
+       (ior<mode>3): Likewise.
 
7885
+       (and<mode>3): Likewise.
 
7886
+       (one_cmpl<mode>2): Likewise.
 
7887
+       (nor<mode>3): Likewise.
 
7888
+       (andc<mode>3): Likewise.
 
7889
+       (eqv<mode>3): Likewise.
 
7890
+       (nand<mode>3): Likewise.
 
7891
+       (orc<mode>3): Likewise.
 
7892
+
 
7893
+       * config/rs6000/rs6000-protos.h (rs6000_split_logical): New
 
7894
+       declaration.
 
7895
+
 
7896
+       * config/rs6000/rs6000.c (rs6000_split_logical_inner): Add support
 
7897
+       to split multi-word logical operations.
 
7898
+       (rs6000_split_logical_di): Likewise.
 
7899
+       (rs6000_split_logical): Likewise.
 
7900
+
 
7901
+       * config/rs6000/vsx.md (VSX_L2): Delete, no longer used.
 
7902
+       (vsx_and<mode>3_32bit): Move 128-bit logical insns to rs6000.md,
 
7903
+       and allow TImode operations in 32-bit.
 
7904
+       (vsx_and<mode>3_64bit): Likewise.
 
7905
+       (vsx_ior<mode>3_32bit): Likewise.
 
7906
+       (vsx_ior<mode>3_64bit): Likewise.
 
7907
+       (vsx_xor<mode>3_32bit): Likewise.
 
7908
+       (vsx_xor<mode>3_64bit): Likewise.
 
7909
+       (vsx_one_cmpl<mode>2_32bit): Likewise.
 
7910
+       (vsx_one_cmpl<mode>2_64bit): Likewise.
 
7911
+       (vsx_nor<mode>3_32bit): Likewise.
 
7912
+       (vsx_nor<mode>3_64bit): Likewise.
 
7913
+       (vsx_andc<mode>3_32bit): Likewise.
 
7914
+       (vsx_andc<mode>3_64bit): Likewise.
 
7915
+       (vsx_eqv<mode>3_32bit): Likewise.
 
7916
+       (vsx_eqv<mode>3_64bit): Likewise.
 
7917
+       (vsx_nand<mode>3_32bit): Likewise.
 
7918
+       (vsx_nand<mode>3_64bit): Likewise.
 
7919
+       (vsx_orc<mode>3_32bit): Likewise.
 
7920
+       (vsx_orc<mode>3_64bit): Likewise.
 
7921
+
 
7922
+       * config/rs6000/rs6000.h (VLOGICAL_REGNO_P): Always allow vector
 
7923
+       logical types in GPRs.
 
7924
+
 
7925
+       * config/rs6000/altivec.md (altivec_and<mode>3): Move 128-bit
 
7926
+       logical insns to rs6000.md, and allow TImode operations in
 
7927
+       32-bit.
 
7928
+       (altivec_ior<mode>3): Likewise.
 
7929
+       (altivec_xor<mode>3): Likewise.
 
7930
+       (altivec_one_cmpl<mode>2): Likewise.
 
7931
+       (altivec_nor<mode>3): Likewise.
 
7932
+       (altivec_andc<mode>3): Likewise.
 
7933
+
 
7934
+       * config/rs6000/rs6000.md (BOOL_128): New mode iterators and mode
 
7935
+       attributes for moving the 128-bit logical operations into
 
7936
+       rs6000.md.
 
7937
+       (BOOL_REGS_OUTPUT): Likewise.
 
7938
+       (BOOL_REGS_OP1): Likewise.
 
7939
+       (BOOL_REGS_OP2): Likewise.
 
7940
+       (BOOL_REGS_UNARY): Likewise.
 
7941
+       (BOOL_REGS_AND_CR0): Likewise.
 
7942
+       (one_cmpl<mode>2): Add support for DI logical operations on
 
7943
+       32-bit, splitting the operations to 32-bit.
 
7944
+       (anddi3): Likewise.
 
7945
+       (iordi3): Likewise.
 
7946
+       (xordi3): Likewise.
 
7947
+       (and<mode>3, 128-bit types): Rewrite 2013-06-06 logical operator
 
7948
+       changes to combine the 32/64-bit code, allow logical operations on
 
7949
+       TI mode in 32-bit, and to use similar match_operator patterns like
 
7950
+       scalar mode uses.  Combine the Altivec and VSX code for logical
 
7951
+       operations, and move it here.
 
7952
+       (ior<mode>3, 128-bit types): Likewise.
 
7953
+       (xor<mode>3, 128-bit types): Likewise.
 
7954
+       (one_cmpl<mode>3, 128-bit types): Likewise.
 
7955
+       (nor<mode>3, 128-bit types): Likewise.
 
7956
+       (andc<mode>3, 128-bit types): Likewise.
 
7957
+       (eqv<mode>3, 128-bit types): Likewise.
 
7958
+       (nand<mode>3, 128-bit types): Likewise.
 
7959
+       (orc<mode>3, 128-bit types): Likewise.
 
7960
+       (and<mode>3_internal): Likewise.
 
7961
+       (bool<mode>3_internal): Likewise.
 
7962
+       (boolc<mode>3_internal1): Likewise.
 
7963
+       (boolc<mode>3_internal2): Likewise.
 
7964
+       (boolcc<mode>3_internal1): Likewise.
 
7965
+       (boolcc<mode>3_internal2): Likewise.
 
7966
+       (eqv<mode>3_internal1): Likewise.
 
7967
+       (eqv<mode>3_internal2): Likewise.
 
7968
+       (one_cmpl1<mode>3_internal): Likewise.
 
7969
+
 
7970
+2013-07-31  Michael Meissner  <meissner@linux.vnet.ibm.com>
 
7971
+
 
7972
+       Backport from mainline
 
7973
+       2013-07-31  Michael Meissner  <meissner@linux.vnet.ibm.com>
 
7974
+
 
7975
+       * config/rs6000/predicates.md (fusion_gpr_addis): New predicates
 
7976
+       to support power8 load fusion.
 
7977
+       (fusion_gpr_mem_load): Likewise.
 
7978
+
 
7979
+       * config/rs6000/rs6000-modes.def (PTImode): Update a comment.
 
7980
+
 
7981
+       * config/rs6000/rs6000-protos.h (fusion_gpr_load_p): New
 
7982
+       declarations for power8 load fusion.
 
7983
+       (emit_fusion_gpr_load): Likewise.
 
7984
+
 
7985
+       * config/rs6000/rs6000.c (rs6000_option_override_internal): If
 
7986
+       tuning for power8, turn on fusion mode by default.  Turn on sign
 
7987
+       extending fusion mode if normal fusion mode is on, and we are at
 
7988
+       -O2 or -O3.
 
7989
+       (fusion_gpr_load_p): New function, return true if we can fuse an
 
7990
+       addis instruction with a dependent load to a GPR.
 
7991
+       (emit_fusion_gpr_load): Emit the instructions for power8 load
 
7992
+       fusion to GPRs.
 
7993
+
 
7994
+       * config/rs6000/vsx.md (VSX_M2): New iterator for fusion
 
7995
+       peepholes.
 
7996
+       (VSX load fusion peepholes): New peepholes to fuse together an
 
7997
+       addi instruction with a VSX load instruction.
 
7998
+
 
7999
+       * config/rs6000/rs6000.md (GPR load fusion peepholes): New
 
8000
+       peepholes to fuse an addis instruction with a load to a GPR base
 
8001
+       register.  If we are supporting sign extending fusions, convert
 
8002
+       sign extending loads to zero extending loads and add an explicit
 
8003
+       sign extension.
 
8004
+
 
8005
+2013-07-19  Pat Haugen <pthaugen@us.ibm.com>
 
8006
+
 
8007
+       Backport from mainline
 
8008
+       2013-07-18  Pat Haugen <pthaugen@us.ibm.com>
 
8009
+
 
8010
+       * config/rs6000/rs6000.c (rs6000_option_override_internal): Adjust flag
 
8011
+       interaction for new Power8 flags and VSX.
 
8012
+
 
8013
+2013-07-17  Peter Bergner  <bergner@vnet.ibm.com>
 
8014
+
 
8015
+       Backport from mainline
 
8016
+       2013-07-17  Iain Sandoe  <iain@codesourcery.com>
 
8017
+
 
8018
+       * config/rs6000/darwin.h (REGISTER_NAMES): Add HTM registers.
 
8019
+
 
8020
+2013-07-16  Peter Bergner  <bergner@vnet.ibm.com>
 
8021
+
 
8022
+       Merge up to 200989.
 
8023
+       * REVISION: Update subversion id.
 
8024
+
 
8025
+2013-07-16  Peter Bergner  <bergner@vnet.ibm.com>
 
8026
+
 
8027
+       Backport from mainline
 
8028
+       2013-07-16  Peter Bergner <bergner@vnet.ibm.com>
 
8029
+
 
8030
+       * config/rs6000/rs6000.c (rs6000_option_override_internal): Do not
 
8031
+       enable extra ISA flags with TARGET_HTM.
 
8032
+
 
8033
+       2013-07-16  Jakub Jelinek  <jakub@redhat.com>
 
8034
+                   Peter Bergner  <bergner@vnet.ibm.com>
 
8035
+
 
8036
+       * config/rs6000/rs6000.h (FIRST_PSEUDO_REGISTERS): Mention HTM
 
8037
+       registers in the comment.
 
8038
+       (DWARF_FRAME_REGISTERS): Subtract also the 3 HTM registers.
 
8039
+       (DWARF_REG_TO_UNWIND_COLUMN): Use DWARF_FRAME_REGISTERS
 
8040
+       rather than FIRST_PSEUDO_REGISTERS.
 
8041
+
 
8042
+2013-07-15  Peter Bergner  <bergner@vnet.ibm.com>
 
8043
+
 
8044
+       Backport from mainline
 
8045
+       2013-07-15  Peter Bergner  <bergner@vnet.ibm.com>
 
8046
+
 
8047
+       * config.gcc (powerpc*-*-*): Install htmintrin.h and htmxlintrin.h.
 
8048
+       * config/rs6000/t-rs6000 (MD_INCLUDES): Add htm.md.
 
8049
+       * config/rs6000/rs6000.opt: Add -mhtm option.
 
8050
+       * config/rs6000/rs6000-cpus.def (POWERPC_MASKS): Add OPTION_MASK_HTM.
 
8051
+       (ISA_2_7_MASKS_SERVER): Add OPTION_MASK_HTM.
 
8052
+       * config/rs6000/rs6000-c.c (rs6000_target_modify_macros): Define
 
8053
+       __HTM__ if the HTM instructions are available.
 
8054
+       * config/rs6000/predicates.md (u3bit_cint_operand, u10bit_cint_operand,
 
8055
+       htm_spr_reg_operand): New define_predicates.
 
8056
+       * config/rs6000/rs6000.md (define_attr "type"): Add htm.
 
8057
+       (TFHAR_REGNO, TFIAR_REGNO, TEXASR_REGNO): New define_constants.
 
8058
+       Include htm.md.
 
8059
+       * config/rs6000/rs6000-builtin.def (BU_HTM_0, BU_HTM_1, BU_HTM_2,
 
8060
+       BU_HTM_3, BU_HTM_SPR0, BU_HTM_SPR1): Add support macros for defining
 
8061
+       HTM builtin functions.
 
8062
+       * config/rs6000/rs6000.c (RS6000_BUILTIN_H): New macro.
 
8063
+       (rs6000_reg_names, alt_reg_names): Add HTM SPR register names.
 
8064
+       (rs6000_init_hard_regno_mode_ok): Add support for HTM instructions.
 
8065
+       (rs6000_builtin_mask_calculate): Likewise.
 
8066
+       (rs6000_option_override_internal): Likewise.
 
8067
+       (bdesc_htm): Add new HTM builtin support.
 
8068
+       (htm_spr_num): New function.
 
8069
+       (htm_spr_regno): Likewise.
 
8070
+       (rs6000_htm_spr_icode): Likewise.
 
8071
+       (htm_expand_builtin): Likewise.
 
8072
+       (htm_init_builtins): Likewise.
 
8073
+       (rs6000_expand_builtin): Add support for HTM builtin functions.
 
8074
+       (rs6000_init_builtins): Likewise.
 
8075
+       (rs6000_invalid_builtin, rs6000_opt_mask): Add support for -mhtm option.
 
8076
+       * config/rs6000/rs6000.h (ASM_CPU_SPEC): Add support for -mhtm.
 
8077
+       (TARGET_HTM, MASK_HTM): Define macros.
 
8078
+       (FIRST_PSEUDO_REGISTER): Adjust for new HTM SPR registers.
 
8079
+       (FIXED_REGISTERS): Likewise.
 
8080
+       (CALL_USED_REGISTERS): Likewise.
 
8081
+       (CALL_REALLY_USED_REGISTERS): Likewise.
 
8082
+       (REG_ALLOC_ORDER): Likewise.
 
8083
+       (enum reg_class): Likewise.
 
8084
+       (REG_CLASS_NAMES): Likewise.
 
8085
+       (REG_CLASS_CONTENTS): Likewise.
 
8086
+       (REGISTER_NAMES): Likewise.
 
8087
+       (ADDITIONAL_REGISTER_NAMES): Likewise.
 
8088
+       (RS6000_BTC_SPR, RS6000_BTC_VOID, RS6000_BTC_32BIT, RS6000_BTC_64BIT,
 
8089
+       RS6000_BTC_MISC_MASK, RS6000_BTM_HTM): New macros.
 
8090
+       (RS6000_BTM_COMMON): Add RS6000_BTM_HTM.
 
8091
+       * config/rs6000/htm.md: New file.
 
8092
+       * config/rs6000/htmintrin.h: New file.
 
8093
+       * config/rs6000/htmxlintrin.h: New file.
 
8094
+
 
8095
+2013-06-28  Michael Meissner  <meissner@linux.vnet.ibm.com>
 
8096
+
 
8097
+       Back port from the trunk
 
8098
+       2013-06-28  Michael Meissner  <meissner@linux.vnet.ibm.com>
 
8099
+
 
8100
+       PR target/57744
 
8101
+       * config/rs6000/rs6000.h (MODES_TIEABLE_P): Do not allow PTImode
 
8102
+       to tie with any other modes.  Eliminate Altivec vector mode tests,
 
8103
+       since these are a subset of ALTIVEC or VSX vector modes.  Simplify
 
8104
+       code, to return 0 if testing MODE2 for a condition, if we've
 
8105
+       already tested MODE1 for the same condition.
 
8106
+
 
8107
+2013-06-28  Pat Haugen <pthaugen@us.ibm.com>
 
8108
+
 
8109
+       * config/rs6000/rs6000.md (define_insn ""): Fix insn type.
 
8110
+
 
8111
+2013-06-26  Pat Haugen <pthaugen@us.ibm.com>
 
8112
+
 
8113
+       Back port from the trunk
 
8114
+       2013-06-26  Michael Meissner  <meissner@linux.vnet.ibm.com>
 
8115
+                   Pat Haugen <pthaugen@us.ibm.com>
 
8116
+                   Peter Bergner <bergner@vnet.ibm.com>
 
8117
+
 
8118
+       * config/rs6000/power8.md: New.
 
8119
+       * config/rs6000/rs6000-cpus.def (RS6000_CPU table): Adjust processor
 
8120
+       setting for power8 entry.
 
8121
+       * config/rs6000/t-rs6000 (MD_INCLUDES): Add power8.md.
 
8122
+       * config/rs6000/rs6000.c (is_microcoded_insn, is_cracked_insn): Adjust
 
8123
+       test for Power4/Power5 only.
 
8124
+       (insn_must_be_first_in_group, insn_must_be_last_in_group): Add Power8
 
8125
+       support.
 
8126
+       (force_new_group): Adjust comment.
 
8127
+       * config/rs6000/rs6000.md: Include power8.md.
 
8128
+
 
8129
+2013-06-14  Michael Meissner  <meissner@linux.vnet.ibm.com>
 
8130
+
 
8131
+       Back port from the trunk
 
8132
+       2013-06-14  Michael Meissner  <meissner@linux.vnet.ibm.com>
 
8133
+
 
8134
+       PR target/57615
 
8135
+       * config/rs6000/rs6000.md (mov<mode>_ppc64): Call
 
8136
+       rs6000_output_move_128bit to handle emitting quad memory
 
8137
+       operations.  Set attribute length to 8 bytes.
 
8138
+
 
8139
+2013-06-13  Michael Meissner  <meissner@linux.vnet.ibm.com>
 
8140
+
 
8141
+       Back port from the trunk
 
8142
+       2013-06-13  Michael Meissner  <meissner@linux.vnet.ibm.com>
 
8143
+
 
8144
+       * config/rs6000/rs6000.c (rs6000_option_override_internal): Move
 
8145
+       test for clearing quad memory on 32-bit later.
 
8146
+
 
8147
+2013-06-12  Michael Meissner  <meissner@linux.vnet.ibm.com>
 
8148
+
 
8149
+       Back port from the trunk
 
8150
+
 
8151
+       Backport from mainline
 
8152
+       2013-06-12  Michael Meissner  <meissner@linux.vnet.ibm.com>
 
8153
+                   Pat Haugen <pthaugen@us.ibm.com>
 
8154
+                   Peter Bergner <bergner@vnet.ibm.com>
 
8155
+
 
8156
+       * config/rs6000/rs6000.c (emit_load_locked): Add support for
 
8157
+       power8 byte, half-word, and quad-word atomic instructions.
 
8158
+       (emit_store_conditional): Likewise.
 
8159
+       (rs6000_expand_atomic_compare_and_swap): Likewise.
 
8160
+       (rs6000_expand_atomic_op): Likewise.
 
8161
+
 
8162
+       * config/rs6000/sync.md (larx): Add new modes for power8.
 
8163
+       (stcx): Likewise.
 
8164
+       (AINT): New mode iterator to include TImode as well as normal
 
8165
+       integer modes on power8.
 
8166
+       (fetchop_pred): Use int_reg_operand instead of gpc_reg_operand so
 
8167
+       that VSX registers are not considered.  Use AINT mode iterator
 
8168
+       instead of INT1 to allow inclusion of quad word atomic operations
 
8169
+       on power8.
 
8170
+       (load_locked<mode>): Likewise.
 
8171
+       (store_conditional<mode>): Likewise.
 
8172
+       (atomic_compare_and_swap<mode>): Likewise.
 
8173
+       (atomic_exchange<mode>): Likewise.
 
8174
+       (atomic_nand<mode>): Likewise.
 
8175
+       (atomic_fetch_<fetchop_name><mode>): Likewise.
 
8176
+       (atomic_nand_fetch<mode>): Likewise.
 
8177
+       (mem_thread_fence): Use gen_loadsync_<mode> instead of enumerating
 
8178
+       each type.
 
8179
+       (ATOMIC): On power8, add QImode, HImode modes.
 
8180
+       (load_locked<QHI:mode>_si): Varients of load_locked for QI/HI
 
8181
+       modes that promote to SImode.
 
8182
+       (load_lockedti): Convert TImode arguments to PTImode, so that we
 
8183
+       get a guaranteed even/odd register pair.
 
8184
+       (load_lockedpti): Likewise.
 
8185
+       (store_conditionalti): Likewise.
 
8186
+       (store_conditionalpti): Likewise.
 
8187
+
 
8188
+       * config/rs6000/rs6000.md (QHI): New mode iterator for power8
 
8189
+       atomic load/store instructions.
 
8190
+       (HSI): Likewise.
 
8191
+
 
8192
+2013-06-11  Michael Meissner  <meissner@linux.vnet.ibm.com>
 
8193
+
 
8194
+       Back port from the trunk
 
8195
+
 
8196
+       2013-06-11  Michael Meissner  <meissner@linux.vnet.ibm.com>
 
8197
+                   Pat Haugen <pthaugen@us.ibm.com>
 
8198
+                   Peter Bergner <bergner@vnet.ibm.com>
 
8199
+
 
8200
+       * config/rs6000/rs6000.c (emit_load_locked): Add support for
 
8201
+       power8 byte, half-word, and quad-word atomic instructions.
 
8202
+       (emit_store_conditional): Likewise.
 
8203
+       (rs6000_expand_atomic_compare_and_swap): Likewise.
 
8204
+       (rs6000_expand_atomic_op): Likewise.
 
8205
+
 
8206
+       * config/rs6000/sync.md (larx): Add new modes for power8.
 
8207
+       (stcx): Likewise.
 
8208
+       (AINT): New mode iterator to include TImode as well as normal
 
8209
+       integer modes on power8.
 
8210
+       (fetchop_pred): Use int_reg_operand instead of gpc_reg_operand so
 
8211
+       that VSX registers are not considered.  Use AINT mode iterator
 
8212
+       instead of INT1 to allow inclusion of quad word atomic operations
 
8213
+       on power8.
 
8214
+       (load_locked<mode>): Likewise.
 
8215
+       (store_conditional<mode>): Likewise.
 
8216
+       (atomic_compare_and_swap<mode>): Likewise.
 
8217
+       (atomic_exchange<mode>): Likewise.
 
8218
+       (atomic_nand<mode>): Likewise.
 
8219
+       (atomic_fetch_<fetchop_name><mode>): Likewise.
 
8220
+       (atomic_nand_fetch<mode>): Likewise.
 
8221
+       (mem_thread_fence): Use gen_loadsync_<mode> instead of enumerating
 
8222
+       each type.
 
8223
+       (ATOMIC): On power8, add QImode, HImode modes.
 
8224
+       (load_locked<QHI:mode>_si): Varients of load_locked for QI/HI
 
8225
+       modes that promote to SImode.
 
8226
+       (load_lockedti): Convert TImode arguments to PTImode, so that we
 
8227
+       get a guaranteed even/odd register pair.
 
8228
+       (load_lockedpti): Likewise.
 
8229
+       (store_conditionalti): Likewise.
 
8230
+       (store_conditionalpti): Likewise.
 
8231
+
 
8232
+       * config/rs6000/rs6000.md (QHI): New mode iterator for power8
 
8233
+       atomic load/store instructions.
 
8234
+       (HSI): Likewise.
 
8235
+
 
8236
+       PR target/57589
 
8237
+       * config/rs6000/driver-rs6000.c (elf_platform): Make buffer static
 
8238
+       to allow returning address to AT_PLATFORM name.
 
8239
+
 
8240
+       Back port from the trunk
 
8241
+
 
8242
+       2013-06-10  Michael Meissner  <meissner@linux.vnet.ibm.com>
 
8243
+                   Pat Haugen <pthaugen@us.ibm.com>
 
8244
+                   Peter Bergner <bergner@vnet.ibm.com>
 
8245
+
 
8246
+       * config/rs6000/vector.md (GPR move splitter): Do not split moves
 
8247
+       of vectors in GPRS if they are direct moves or quad word load or
 
8248
+       store moves.
 
8249
+
 
8250
+       * config/rs6000/rs6000-protos.h (rs6000_output_move_128bit): Add
 
8251
+       declaration.
 
8252
+       (direct_move_p): Likewise.
 
8253
+       (quad_load_store_p): Likewise.
 
8254
+
 
8255
+       * config/rs6000/rs6000.c (enum rs6000_reg_type): Simplify register
 
8256
+       classes into bins based on the physical register type.
 
8257
+       (reg_class_to_reg_type): Likewise.
 
8258
+       (IS_STD_REG_TYPE): Likewise.
 
8259
+       (IS_FP_VECT_REG_TYPE): Likewise.
 
8260
+       (reload_fpr_gpr): Arrays to determine what insn to use if we can
 
8261
+       use direct move instructions.
 
8262
+       (reload_gpr_vsx): Likewise.
 
8263
+       (reload_vsx_gpr): Likewise.
 
8264
+       (rs6000_init_hard_regno_mode_ok): Precalculate the register type
 
8265
+       information that is a simplification of register classes.  Also
 
8266
+       precalculate direct move reload helpers.
 
8267
+       (direct_move_p): New function to return true if the operation can
 
8268
+       be done as a direct move instruciton.
 
8269
+       (quad_load_store_p): New function to return true if the operation
 
8270
+       is a quad memory operation.
 
8271
+       (rs6000_legitimize_address): If quad memory, only allow register
 
8272
+       indirect for TImode addresses.
 
8273
+       (rs6000_legitimate_address_p): Likewise.
 
8274
+       (enum reload_reg_type): Delete, replace with rs6000_reg_type.
 
8275
+       (rs6000_reload_register_type): Likewise.
 
8276
+       (register_to_reg_type): Return register type.
 
8277
+       (rs6000_secondary_reload_simple_move): New helper function for
 
8278
+       secondary reload and secondary memory needed to identify anything
 
8279
+       that is a simple move, and does not need reloading.
 
8280
+       (rs6000_secondary_reload_direct_move): New helper function for
 
8281
+       secondary reload to identify cases that can be done with several
 
8282
+       instructions via the direct move instructions.
 
8283
+       (rs6000_secondary_reload_move): New helper function for secondary
 
8284
+       reload to identify moves between register types that can be done.
 
8285
+       (rs6000_secondary_reload): Add support for quad memory operations
 
8286
+       and for direct move.
 
8287
+       (rs6000_secondary_memory_needed): Likewise.
 
8288
+       (rs6000_debug_secondary_memory_needed): Change argument names.
 
8289
+       (rs6000_output_move_128bit): New function to return the move to
 
8290
+       use for 128-bit moves, including knowing about the various
 
8291
+       limitations of quad memory operations.
 
8292
+
 
8293
+       * config/rs6000/vsx.md (vsx_mov<mode>): Add support for quad
 
8294
+       memory operations.  call rs6000_output_move_128bit for the actual
 
8295
+       instruciton(s) to generate.
 
8296
+       (vsx_movti_64bit): Likewise.
 
8297
+
 
8298
+       * config/rs6000/rs6000.md (UNSPEC_P8V_FMRGOW): New unspec values.
 
8299
+       (UNSPEC_P8V_MTVSRWZ): Likewise.
 
8300
+       (UNSPEC_P8V_RELOAD_FROM_GPR): Likewise.
 
8301
+       (UNSPEC_P8V_MTVSRD): Likewise.
 
8302
+       (UNSPEC_P8V_XXPERMDI): Likewise.
 
8303
+       (UNSPEC_P8V_RELOAD_FROM_VSX): Likewise.
 
8304
+       (UNSPEC_FUSION_GPR): Likewise.
 
8305
+       (FMOVE128_GPR): New iterator for direct move.
 
8306
+       (f32_lv): New mode attribute for load/store of SFmode/SDmode
 
8307
+       values.
 
8308
+       (f32_sv): Likewise.
 
8309
+       (f32_dm): Likewise.
 
8310
+       (zero_extend<mode>di2_internal1): Add support for power8 32-bit
 
8311
+       loads and direct move instructions.
 
8312
+       (zero_extendsidi2_lfiwzx): Likewise.
 
8313
+       (extendsidi2_lfiwax): Likewise.
 
8314
+       (extendsidi2_nocell): Likewise.
 
8315
+       (floatsi<mode>2_lfiwax): Likewise.
 
8316
+       (lfiwax): Likewise.
 
8317
+       (floatunssi<mode>2_lfiwzx): Likewise.
 
8318
+       (lfiwzx): Likewise.
 
8319
+       (fix_trunc<mode>_stfiwx): Likewise.
 
8320
+       (fixuns_trunc<mode>_stfiwx): Likewise.
 
8321
+       (mov<mode>_hardfloat, 32-bit floating point): Likewise.
 
8322
+       (mov<move>_hardfloat64, 64-bit floating point): Likewise.
 
8323
+       (parity<mode>2_cmpb): Set length/type attr.
 
8324
+       (unnamed shift right patterns, mov<mode>_internal2): Change type attr
 
8325
+       for 'mr.' to fast_compare.
 
8326
+       (bpermd_<mode>): Change type attr to popcnt.
 
8327
+       (p8_fmrgow_<mode>): New insns for power8 direct move support.
 
8328
+       (p8_mtvsrwz_1): Likewise.
 
8329
+       (p8_mtvsrwz_2): Likewise.
 
8330
+       (reload_fpr_from_gpr<mode>): Likewise.
 
8331
+       (p8_mtvsrd_1): Likewise.
 
8332
+       (p8_mtvsrd_2): Likewise.
 
8333
+       (p8_xxpermdi_<mode>): Likewise.
 
8334
+       (reload_vsx_from_gpr<mode>): Likewise.
 
8335
+       (reload_vsx_from_gprsf): Likewise.
 
8336
+       (p8_mfvsrd_3_<mode>): LIkewise.
 
8337
+       (reload_gpr_from_vsx<mode>): Likewise.
 
8338
+       (reload_gpr_from_vsxsf): Likewise.
 
8339
+       (p8_mfvsrd_4_disf): Likewise.
 
8340
+       (multi-word GPR splits): Do not split direct moves or quad memory
 
8341
+       operations.
 
8342
+
 
8343
+2013-06-06  Michael Meissner  <meissner@linux.vnet.ibm.com>
 
8344
+
 
8345
+       Backport from the trunk
 
8346
+
 
8347
+       2013-06-06  Michael Meissner  <meissner@linux.vnet.ibm.com>
 
8348
+                   Pat Haugen <pthaugen@us.ibm.com>
 
8349
+                   Peter Bergner <bergner@vnet.ibm.com>
 
8350
+
 
8351
+       * doc/extend.texi (PowerPC AltiVec/VSX Built-in Functions):
 
8352
+       Document new power8 builtins.
 
8353
+
 
8354
+       * config/rs6000/vector.md (and<mode>3): Add a clobber/scratch of a
 
8355
+       condition code register, to allow 128-bit logical operations to be
 
8356
+       done in the VSX or GPR registers.
 
8357
+       (nor<mode>3): Use the canonical form for nor.
 
8358
+       (eqv<mode>3): Add expanders for power8 xxleqv, xxlnand, xxlorc,
 
8359
+       vclz*, and vpopcnt* vector instructions.
 
8360
+       (nand<mode>3): Likewise.
 
8361
+       (orc<mode>3): Likewise.
 
8362
+       (clz<mode>2): LIkewise.
 
8363
+       (popcount<mode>2): Likewise.
 
8364
+
 
8365
+       * config/rs6000/predicates.md (int_reg_operand): Rework tests so
 
8366
+       that only the GPRs are recognized.
 
8367
+
 
8368
+       * config/rs6000/rs6000-c.c (altivec_overloaded_builtins): Add
 
8369
+       support for new power8 builtins.
 
8370
+
 
8371
+       * config/rs6000/rs6000-builtin.def (xscvspdpn): Add new power8
 
8372
+       builtin functions.
 
8373
+       (xscvdpspn): Likewise.
 
8374
+       (vclz): Likewise.
 
8375
+       (vclzb): Likewise.
 
8376
+       (vclzh): Likewise.
 
8377
+       (vclzw): Likewise.
 
8378
+       (vclzd): Likewise.
 
8379
+       (vpopcnt): Likewise.
 
8380
+       (vpopcntb): Likewise.
 
8381
+       (vpopcnth): Likewise.
 
8382
+       (vpopcntw): Likewise.
 
8383
+       (vpopcntd): Likewise.
 
8384
+       (vgbbd): Likewise.
 
8385
+       (vmrgew): Likewise.
 
8386
+       (vmrgow): Likewise.
 
8387
+       (eqv): Likewise.
 
8388
+       (eqv_v16qi3): Likewise.
 
8389
+       (eqv_v8hi3): Likewise.
 
8390
+       (eqv_v4si3): Likewise.
 
8391
+       (eqv_v2di3): Likewise.
 
8392
+       (eqv_v4sf3): Likewise.
 
8393
+       (eqv_v2df3): Likewise.
 
8394
+       (nand): Likewise.
 
8395
+       (nand_v16qi3): Likewise.
 
8396
+       (nand_v8hi3): Likewise.
 
8397
+       (nand_v4si3): Likewise.
 
8398
+       (nand_v2di3): Likewise.
 
8399
+       (nand_v4sf3): Likewise.
 
8400
+       (nand_v2df3): Likewise.
 
8401
+       (orc): Likewise.
 
8402
+       (orc_v16qi3): Likewise.
 
8403
+       (orc_v8hi3): Likewise.
 
8404
+       (orc_v4si3): Likewise.
 
8405
+       (orc_v2di3): Likewise.
 
8406
+       (orc_v4sf3): Likewise.
 
8407
+       (orc_v2df3): Likewise.
 
8408
+
 
8409
+       * config/rs6000/rs6000.c (rs6000_option_override_internal): Only
 
8410
+       allow power8 quad mode in 64-bit.
 
8411
+       (rs6000_builtin_vectorized_function): Add support to vectorize
 
8412
+       ISA 2.07 count leading zeros, population count builtins.
 
8413
+       (rs6000_expand_vector_init): On ISA 2.07 use xscvdpspn to form
 
8414
+       V4SF vectors instead of xscvdpsp to avoid IEEE related traps.
 
8415
+       (builtin_function_type): Add vgbbd builtin function which takes an
 
8416
+       unsigned argument.
 
8417
+       (altivec_expand_vec_perm_const): Add support for new power8 merge
 
8418
+       instructions.
 
8419
+
 
8420
+       * config/rs6000/vsx.md (VSX_L2): New iterator for 128-bit types,
 
8421
+       that does not include TImdoe for use with 32-bit.
 
8422
+       (UNSPEC_VSX_CVSPDPN): Support for power8 xscvdpspn and xscvspdpn
 
8423
+       instructions.
 
8424
+       (UNSPEC_VSX_CVDPSPN): Likewise.
 
8425
+       (vsx_xscvdpspn): Likewise.
 
8426
+       (vsx_xscvspdpn): Likewise.
 
8427
+       (vsx_xscvdpspn_scalar): Likewise.
 
8428
+       (vsx_xscvspdpn_directmove): Likewise.
 
8429
+       (vsx_and<mode>3): Split logical operations into 32-bit and
 
8430
+       64-bit. Add support to do logical operations on TImode as well as
 
8431
+       VSX vector types.  Allow logical operations to be done in either
 
8432
+       VSX registers or in general purpose registers in 64-bit mode.  Add
 
8433
+       splitters if GPRs were used. For AND, add clobber of CCmode to
 
8434
+       allow use of ANDI on GPRs.  Rewrite nor to use the canonical RTL
 
8435
+       encoding.
 
8436
+       (vsx_and<mode>3_32bit): Likewise.
 
8437
+       (vsx_and<mode>3_64bit): Likewise.
 
8438
+       (vsx_ior<mode>3): Likewise.
 
8439
+       (vsx_ior<mode>3_32bit): Likewise.
 
8440
+       (vsx_ior<mode>3_64bit): Likewise.
 
8441
+       (vsx_xor<mode>3): Likewise.
 
8442
+       (vsx_xor<mode>3_32bit): Likewise.
 
8443
+       (vsx_xor<mode>3_64bit): Likewise.
 
8444
+       (vsx_one_cmpl<mode>2): Likewise.
 
8445
+       (vsx_one_cmpl<mode>2_32bit): Likewise.
 
8446
+       (vsx_one_cmpl<mode>2_64bit): Likewise.
 
8447
+       (vsx_nor<mode>3): Likewise.
 
8448
+       (vsx_nor<mode>3_32bit): Likewise.
 
8449
+       (vsx_nor<mode>3_64bit): Likewise.
 
8450
+       (vsx_andc<mode>3): Likewise.
 
8451
+       (vsx_andc<mode>3_32bit): Likewise.
 
8452
+       (vsx_andc<mode>3_64bit): Likewise.
 
8453
+       (vsx_eqv<mode>3_32bit): Add support for power8 xxleqv, xxlnand,
 
8454
+       and xxlorc instructions.
 
8455
+       (vsx_eqv<mode>3_64bit): Likewise.
 
8456
+       (vsx_nand<mode>3_32bit): Likewise.
 
8457
+       (vsx_nand<mode>3_64bit): Likewise.
 
8458
+       (vsx_orc<mode>3_32bit): Likewise.
 
8459
+       (vsx_orc<mode>3_64bit): Likewise.
 
8460
+
 
8461
+       * config/rs6000/rs6000.h (VLOGICAL_REGNO_P): Update comment.
 
8462
+
 
8463
+       * config/rs6000/altivec.md (UNSPEC_VGBBD): Add power8 vgbbd
 
8464
+       instruction.
 
8465
+       (p8_vmrgew): Add power8 vmrgew and vmrgow instructions.
 
8466
+       (p8_vmrgow): Likewise.
 
8467
+       (altivec_and<mode>3): Add clobber of CCmode to allow AND using
 
8468
+       GPRs to be split under VSX.
 
8469
+       (p8v_clz<mode>2): Add power8 count leading zero support.
 
8470
+       (p8v_popcount<mode>2): Add power8 population count support.
 
8471
+       (p8v_vgbbd): Add power8 gather bits by bytes by doubleword
 
8472
+       support.
 
8473
+
 
8474
+       * config/rs6000/rs6000.md (eqv<mode>3): Add support for powerp eqv
 
8475
+       instruction.
 
8476
+
 
8477
+       * config/rs6000/altivec.h (vec_eqv): Add defines to export power8
 
8478
+       builtin functions.
 
8479
+       (vec_nand): Likewise.
 
8480
+       (vec_vclz): Likewise.
 
8481
+       (vec_vclzb): Likewise.
 
8482
+       (vec_vclzd): Likewise.
 
8483
+       (vec_vclzh): Likewise.
 
8484
+       (vec_vclzw): Likewise.
 
8485
+       (vec_vgbbd): Likewise.
 
8486
+       (vec_vmrgew): Likewise.
 
8487
+       (vec_vmrgow): Likewise.
 
8488
+       (vec_vpopcnt): Likewise.
 
8489
+       (vec_vpopcntb): Likewise.
 
8490
+       (vec_vpopcntd): Likewise.
 
8491
+       (vec_vpopcnth): Likewise.
 
8492
+       (vec_vpopcntw): Likewise.
 
8493
+
 
8494
+2013-06-06  Peter Bergner  <bergner@vnet.ibm.com>
 
8495
+
 
8496
+       Merge up to 199753.
 
8497
+       * REVISION: Update subversion id.
 
8498
+
 
8499
+2013-06-06  Peter Bergner  <bergner@vnet.ibm.com>
 
8500
+
 
8501
+       Backport from trunk
 
8502
+
 
8503
+       2013-05-29  Michael Meissner  <meissner@linux.vnet.ibm.com>
 
8504
+                   Pat Haugen <pthaugen@us.ibm.com>
 
8505
+                   Peter Bergner <bergner@vnet.ibm.com>
 
8506
+
 
8507
+       * config/rs6000/vector.md (VEC_I): Add support for new power8 V2DI
 
8508
+       instructions.
 
8509
+       (VEC_A): Likewise.
 
8510
+       (VEC_C): Likewise.
 
8511
+       (vrotl<mode>3): Likewise.
 
8512
+       (vashl<mode>3): Likewise.
 
8513
+       (vlshr<mode>3): Likewise.
 
8514
+       (vashr<mode>3): Likewise.
 
8515
+
 
8516
+       * config/rs6000/rs6000-c.c (altivec_overloaded_builtins): Add
 
8517
+       support for power8 V2DI builtins.
 
8518
+
 
8519
+       * config/rs6000/rs6000-builtin.def (abs_v2di): Add support for
 
8520
+       power8 V2DI builtins.
 
8521
+       (vupkhsw): Likewise.
 
8522
+       (vupklsw): Likewise.
 
8523
+       (vaddudm): Likewise.
 
8524
+       (vminsd): Likewise.
 
8525
+       (vmaxsd): Likewise.
 
8526
+       (vminud): Likewise.
 
8527
+       (vmaxud): Likewise.
 
8528
+       (vpkudum): Likewise.
 
8529
+       (vpksdss): Likewise.
 
8530
+       (vpkudus): Likewise.
 
8531
+       (vpksdus): Likewise.
 
8532
+       (vrld): Likewise.
 
8533
+       (vsld): Likewise.
 
8534
+       (vsrd): Likewise.
 
8535
+       (vsrad): Likewise.
 
8536
+       (vsubudm): Likewise.
 
8537
+       (vcmpequd): Likewise.
 
8538
+       (vcmpgtsd): Likewise.
 
8539
+       (vcmpgtud): Likewise.
 
8540
+       (vcmpequd_p): Likewise.
 
8541
+       (vcmpgtsd_p): Likewise.
 
8542
+       (vcmpgtud_p): Likewise.
 
8543
+       (vupkhsw): Likewise.
 
8544
+       (vupklsw): Likewise.
 
8545
+       (vaddudm): Likewise.
 
8546
+       (vmaxsd): Likewise.
 
8547
+       (vmaxud): Likewise.
 
8548
+       (vminsd): Likewise.
 
8549
+       (vminud): Likewise.
 
8550
+       (vpksdss): Likewise.
 
8551
+       (vpksdus): Likewise.
 
8552
+       (vpkudum): Likewise.
 
8553
+       (vpkudus): Likewise.
 
8554
+       (vrld): Likewise.
 
8555
+       (vsld): Likewise.
 
8556
+       (vsrad): Likewise.
 
8557
+       (vsrd): Likewise.
 
8558
+       (vsubudm): Likewise.
 
8559
+
 
8560
+       * config/rs6000/rs6000.c (rs6000_init_hard_regno_mode_ok): Add
 
8561
+       support for power8 V2DI instructions.
 
8562
+
 
8563
+       * config/rs6000/altivec.md (UNSPEC_VPKUHUM): Add support for
 
8564
+       power8 V2DI instructions.  Combine pack and unpack insns to use an
 
8565
+       iterator for each mode.  Check whether a particular mode supports
 
8566
+       Altivec instructions instead of just checking TARGET_ALTIVEC.
 
8567
+       (UNSPEC_VPKUWUM): Likewise.
 
8568
+       (UNSPEC_VPKSHSS): Likewise.
 
8569
+       (UNSPEC_VPKSWSS): Likewise.
 
8570
+       (UNSPEC_VPKUHUS): Likewise.
 
8571
+       (UNSPEC_VPKSHUS): Likewise.
 
8572
+       (UNSPEC_VPKUWUS): Likewise.
 
8573
+       (UNSPEC_VPKSWUS): Likewise.
 
8574
+       (UNSPEC_VPACK_SIGN_SIGN_SAT): Likewise.
 
8575
+       (UNSPEC_VPACK_SIGN_UNS_SAT): Likewise.
 
8576
+       (UNSPEC_VPACK_UNS_UNS_SAT): Likewise.
 
8577
+       (UNSPEC_VPACK_UNS_UNS_MOD): Likewise.
 
8578
+       (UNSPEC_VUPKHSB): Likewise.
 
8579
+       (UNSPEC_VUNPACK_HI_SIGN): Likewise.
 
8580
+       (UNSPEC_VUNPACK_LO_SIGN): Likewise.
 
8581
+       (UNSPEC_VUPKHSH): Likewise.
 
8582
+       (UNSPEC_VUPKLSB): Likewise.
 
8583
+       (UNSPEC_VUPKLSH): Likewise.
 
8584
+       (VI2): Likewise.
 
8585
+       (VI_char): Likewise.
 
8586
+       (VI_scalar): Likewise.
 
8587
+       (VI_unit): Likewise.
 
8588
+       (VP): Likewise.
 
8589
+       (VP_small): Likewise.
 
8590
+       (VP_small_lc): Likewise.
 
8591
+       (VU_char): Likewise.
 
8592
+       (add<mode>3): Likewise.
 
8593
+       (altivec_vaddcuw): Likewise.
 
8594
+       (altivec_vaddu<VI_char>s): Likewise.
 
8595
+       (altivec_vadds<VI_char>s): Likewise.
 
8596
+       (sub<mode>3): Likewise.
 
8597
+       (altivec_vsubcuw): Likewise.
 
8598
+       (altivec_vsubu<VI_char>s): Likewise.
 
8599
+       (altivec_vsubs<VI_char>s): Likewise.
 
8600
+       (altivec_vavgs<VI_char>): Likewise.
 
8601
+       (altivec_vcmpbfp): Likewise.
 
8602
+       (altivec_eq<mode>): Likewise.
 
8603
+       (altivec_gt<mode>): Likewise.
 
8604
+       (altivec_gtu<mode>): Likewise.
 
8605
+       (umax<mode>3): Likewise.
 
8606
+       (smax<mode>3): Likewise.
 
8607
+       (umin<mode>3): Likewise.
 
8608
+       (smin<mode>3): Likewise.
 
8609
+       (altivec_vpkuhum): Likewise.
 
8610
+       (altivec_vpkuwum): Likewise.
 
8611
+       (altivec_vpkshss): Likewise.
 
8612
+       (altivec_vpkswss): Likewise.
 
8613
+       (altivec_vpkuhus): Likewise.
 
8614
+       (altivec_vpkshus): Likewise.
 
8615
+       (altivec_vpkuwus): Likewise.
 
8616
+       (altivec_vpkswus): Likewise.
 
8617
+       (altivec_vpks<VI_char>ss): Likewise.
 
8618
+       (altivec_vpks<VI_char>us): Likewise.
 
8619
+       (altivec_vpku<VI_char>us): Likewise.
 
8620
+       (altivec_vpku<VI_char>um): Likewise.
 
8621
+       (altivec_vrl<VI_char>): Likewise.
 
8622
+       (altivec_vsl<VI_char>): Likewise.
 
8623
+       (altivec_vsr<VI_char>): Likewise.
 
8624
+       (altivec_vsra<VI_char>): Likewise.
 
8625
+       (altivec_vsldoi_<mode>): Likewise.
 
8626
+       (altivec_vupkhsb): Likewise.
 
8627
+       (altivec_vupkhs<VU_char>): Likewise.
 
8628
+       (altivec_vupkls<VU_char>): Likewise.
 
8629
+       (altivec_vupkhsh): Likewise.
 
8630
+       (altivec_vupklsb): Likewise.
 
8631
+       (altivec_vupklsh): Likewise.
 
8632
+       (altivec_vcmpequ<VI_char>_p): Likewise.
 
8633
+       (altivec_vcmpgts<VI_char>_p): Likewise.
 
8634
+       (altivec_vcmpgtu<VI_char>_p): Likewise.
 
8635
+       (abs<mode>2): Likewise.
 
8636
+       (vec_unpacks_hi_v16qi): Likewise.
 
8637
+       (vec_unpacks_hi_v8hi): Likewise.
 
8638
+       (vec_unpacks_lo_v16qi): Likewise.
 
8639
+       (vec_unpacks_hi_<VP_small_lc>): Likewise.
 
8640
+       (vec_unpacks_lo_v8hi): Likewise.
 
8641
+       (vec_unpacks_lo_<VP_small_lc>): Likewise.
 
8642
+       (vec_pack_trunc_v8h): Likewise.
 
8643
+       (vec_pack_trunc_v4si): Likewise.
 
8644
+       (vec_pack_trunc_<mode>): Likewise.
 
8645
+
 
8646
+       * config/rs6000/altivec.h (vec_vaddudm): Add defines for power8
 
8647
+       V2DI builtins.
 
8648
+       (vec_vmaxsd): Likewise.
 
8649
+       (vec_vmaxud): Likewise.
 
8650
+       (vec_vminsd): Likewise.
 
8651
+       (vec_vminud): Likewise.
 
8652
+       (vec_vpksdss): Likewise.
 
8653
+       (vec_vpksdus): Likewise.
 
8654
+       (vec_vpkudum): Likewise.
 
8655
+       (vec_vpkudus): Likewise.
 
8656
+       (vec_vrld): Likewise.
 
8657
+       (vec_vsld): Likewise.
 
8658
+       (vec_vsrad): Likewise.
 
8659
+       (vec_vsrd): Likewise.
 
8660
+       (vec_vsubudm): Likewise.
 
8661
+       (vec_vupkhsw): Likewise.
 
8662
+       (vec_vupklsw): Likewise.
 
8663
+
 
8664
+       2013-05-22  Michael Meissner  <meissner@linux.vnet.ibm.com>
 
8665
+                   Pat Haugen <pthaugen@us.ibm.com>
 
8666
+                   Peter Bergner <bergner@vnet.ibm.com>
 
8667
+
 
8668
+       * doc/extend.texi (PowerPC AltiVec/VSX Built-in Functions): Add
 
8669
+       documentation for the power8 crypto builtins.
 
8670
+
 
8671
+       * config/rs6000/t-rs6000 (MD_INCLUDES): Add crypto.md.
 
8672
+
 
8673
+       * config/rs6000/rs6000-builtin.def (BU_P8V_AV_1): Add support
 
8674
+       macros for defining power8 builtin functions.
 
8675
+       (BU_P8V_AV_2): Likewise.
 
8676
+       (BU_P8V_AV_P): Likewise.
 
8677
+       (BU_P8V_VSX_1): Likewise.
 
8678
+       (BU_P8V_OVERLOAD_1): Likewise.
 
8679
+       (BU_P8V_OVERLOAD_2): Likewise.
 
8680
+       (BU_CRYPTO_1): Likewise.
 
8681
+       (BU_CRYPTO_2): Likewise.
 
8682
+       (BU_CRYPTO_3): Likewise.
 
8683
+       (BU_CRYPTO_OVERLOAD_1): Likewise.
 
8684
+       (BU_CRYPTO_OVERLOAD_2): Likewise.
 
8685
+       (XSCVSPDP): Fix typo, point to the correct instruction.
 
8686
+       (VCIPHER): Add power8 crypto builtins.
 
8687
+       (VCIPHERLAST): Likewise.
 
8688
+       (VNCIPHER): Likewise.
 
8689
+       (VNCIPHERLAST): Likewise.
 
8690
+       (VPMSUMB): Likewise.
 
8691
+       (VPMSUMH): Likewise.
 
8692
+       (VPMSUMW): Likewise.
 
8693
+       (VPERMXOR_V2DI): Likewise.
 
8694
+       (VPERMXOR_V4SI: Likewise.
 
8695
+       (VPERMXOR_V8HI: Likewise.
 
8696
+       (VPERMXOR_V16QI: Likewise.
 
8697
+       (VSHASIGMAW): Likewise.
 
8698
+       (VSHASIGMAD): Likewise.
 
8699
+       (VPMSUM): Likewise.
 
8700
+       (VPERMXOR): Likewise.
 
8701
+       (VSHASIGMA): Likewise.
 
8702
+
 
8703
+       * config/rs6000/rs6000-c.c (rs6000_target_modify_macros): Define
 
8704
+       __CRYPTO__ if the crypto instructions are available.
 
8705
+       (altivec_overloaded_builtins): Add support for overloaded power8
 
8706
+       builtins.
 
8707
+
 
8708
+       * config/rs6000/rs6000.c (rs6000_expand_ternop_builtin): Add
 
8709
+       support for power8 crypto builtins.
 
8710
+       (builtin_function_type): Likewise.
 
8711
+       (altivec_init_builtins): Add support for builtins that take vector
 
8712
+       long long (V2DI) arguments.
 
8713
+
 
8714
+       * config/rs6000/crypto.md: New file, define power8 crypto
 
8715
+       instructions.
 
8716
+
 
8717
+       2013-05-22  Michael Meissner  <meissner@linux.vnet.ibm.com>
 
8718
+                   Pat Haugen <pthaugen@us.ibm.com>
 
8719
+                   Peter Bergner <bergner@vnet.ibm.com>
 
8720
+
 
8721
+       * doc/invoke.texi (Option Summary): Add power8 options.
 
8722
+       (RS/6000 and PowerPC Options): Likewise.
 
8723
+
 
8724
+       * doc/md.texi (PowerPC and IBM RS6000 constraints): Update to use
 
8725
+       constraints.md instead of rs6000.h.  Reorder w* constraints.  Add
 
8726
+       wm, wn, wr documentation.
 
8727
+
 
8728
+       * gcc/config/rs6000/constraints.md (wm): New constraint for VSX
 
8729
+       registers if direct move instructions are enabled.
 
8730
+       (wn): New constraint for no registers.
 
8731
+       (wq): New constraint for quad word even GPR registers.
 
8732
+       (wr): New constraint if 64-bit instructions are enabled.
 
8733
+       (wv): New constraint if power8 vector instructions are enabled.
 
8734
+       (wQ): New constraint for quad word memory locations.
 
8735
+
 
8736
+       * gcc/config/rs6000/predicates.md (const_0_to_15_operand): New
 
8737
+       constraint for 0..15 for crypto instructions.
 
8738
+       (gpc_reg_operand): If VSX allow registers in VSX registers as well
 
8739
+       as GPR and floating point registers.
 
8740
+       (int_reg_operand): New predicate to match only GPR registers.
 
8741
+       (base_reg_operand): New predicate to match base registers.
 
8742
+       (quad_int_reg_operand): New predicate to match even GPR registers
 
8743
+       for quad memory operations.
 
8744
+       (vsx_reg_or_cint_operand): New predicate to allow vector logical
 
8745
+       operations in both GPR and VSX registers.
 
8746
+       (quad_memory_operand): New predicate for quad memory operations.
 
8747
+       (reg_or_indexed_operand): New predicate for direct move support.
 
8748
+
 
8749
+       * gcc/config/rs6000/rs6000-cpus.def (ISA_2_5_MASKS_EMBEDDED):
 
8750
+       Inherit from ISA_2_4_MASKS, not ISA_2_2_MASKS.
 
8751
+       (ISA_2_7_MASKS_SERVER): New mask for ISA 2.07 (i.e. power8).
 
8752
+       (POWERPC_MASKS): Add power8 options.
 
8753
+       (power8 cpu): Use ISA_2_7_MASKS_SERVER instead of specifying the
 
8754
+       various options.
 
8755
+
 
8756
+       * gcc/config/rs6000/rs6000-c.c (rs6000_target_modify_macros):
 
8757
+       Define _ARCH_PWR8 and __POWER8_VECTOR__ for power8.
 
8758
+
 
8759
+       * gcc/config/rs6000/rs6000.opt (-mvsx-timode): Add documentation.
 
8760
+       (-mpower8-fusion): New power8 options.
 
8761
+       (-mpower8-fusion-sign): Likewise.
 
8762
+       (-mpower8-vector): Likewise.
 
8763
+       (-mcrypto): Likewise.
 
8764
+       (-mdirect-move): Likewise.
 
8765
+       (-mquad-memory): Likewise.
 
8766
+
 
8767
+       * gcc/config/rs6000/rs6000.c (power8_cost): Initial definition for
 
8768
+       power8.
 
8769
+       (rs6000_hard_regno_mode_ok): Make PTImode only match even GPR
 
8770
+       registers.
 
8771
+       (rs6000_debug_reg_print): Print the base register class if
 
8772
+       -mdebug=reg.
 
8773
+       (rs6000_debug_vector_unit): Add p8_vector.
 
8774
+       (rs6000_debug_reg_global): If -mdebug=reg, print power8 constraint
 
8775
+       definitions.  Also print fusion state.
 
8776
+       (rs6000_init_hard_regno_mode_ok): Set up power8 constraints.
 
8777
+       (rs6000_builtin_mask_calculate): Add power8 builtin support.
 
8778
+       (rs6000_option_override_internal): Add support for power8.
 
8779
+       (rs6000_common_init_builtins): Add debugging for skipped builtins
 
8780
+       if -mdebug=builtin.
 
8781
+       (rs6000_adjust_cost): Add power8 support.
 
8782
+       (rs6000_issue_rate): Likewise.
 
8783
+       (insn_must_be_first_in_group): Likewise.
 
8784
+       (insn_must_be_last_in_group): Likewise.
 
8785
+       (force_new_group): Likewise.
 
8786
+       (rs6000_register_move_cost): Likewise.
 
8787
+       (rs6000_opt_masks): Likewise.
 
8788
+
 
8789
+       * config/rs6000/rs6000.h (ASM_CPU_POWER8_SPEC): If we don't have a
 
8790
+       power8 capable assembler, default to power7 options.
 
8791
+       (TARGET_DIRECT_MOVE): Likewise.
 
8792
+       (TARGET_CRYPTO): Likewise.
 
8793
+       (TARGET_P8_VECTOR): Likewise.
 
8794
+       (VECTOR_UNIT_P8_VECTOR_P): Define power8 vector support.
 
8795
+       (VECTOR_UNIT_VSX_OR_P8_VECTOR_P): Likewise.
 
8796
+       (VECTOR_MEM_P8_VECTOR_P): Likewise.
 
8797
+       (VECTOR_MEM_VSX_OR_P8_VECTOR_P): Likewise.
 
8798
+       (VECTOR_MEM_ALTIVEC_OR_VSX_P): Likewise.
 
8799
+       (TARGET_XSCVDPSPN): Likewise.
 
8800
+       (TARGET_XSCVSPDPN): Likewsie.
 
8801
+       (TARGET_SYNC_HI_QI): Likewise.
 
8802
+       (TARGET_SYNC_TI): Likewise.
 
8803
+       (MASK_CRYPTO): Likewise.
 
8804
+       (MASK_DIRECT_MOVE): Likewise.
 
8805
+       (MASK_P8_FUSION): Likewise.
 
8806
+       (MASK_P8_VECTOR): Likewise.
 
8807
+       (REG_ALLOC_ORDER): Move fr13 to be lower in priority so that the
 
8808
+       TFmode temporary used by some of the direct move instructions to
 
8809
+       get two FP temporary registers does not force creation of a stack
 
8810
+       frame.
 
8811
+       (VLOGICAL_REGNO_P): Allow vector logical operations in GPRs.
 
8812
+       (MODES_TIEABLE_P): Move the VSX tests above the Altivec tests so
 
8813
+       that any VSX registers are tieable, even if they are also an
 
8814
+       Altivec vector mode.
 
8815
+       (r6000_reg_class_enum): Add wm, wr, wv constraints.
 
8816
+       (RS6000_BTM_P8_VECTOR): Power8 builtin support.
 
8817
+       (RS6000_BTM_CRYPTO): Likewise.
 
8818
+       (RS6000_BTM_COMMON): Likewise.
 
8819
+
 
8820
+       * config/rs6000/rs6000.md (cpu attribute): Add power8.
 
8821
+       * config/rs6000/rs6000-opts.h (PROCESSOR_POWER8): Likewise.
 
8822
+       (enum rs6000_vector): Add power8 vector support.
 
8823
+
 
8824
+2013-05-06  Michael Meissner  <meissner@linux.vnet.ibm.com>
 
8825
+
 
8826
+       Merge up to 198656.
 
8827
+       * REVISION: Update subversion id.
 
8828
+
 
8829
+       Backport from trunk
 
8830
+       2013-05-03  Michael Meissner  <meissner@linux.vnet.ibm.com>
 
8831
+
 
8832
+       PR target/57150
 
8833
+       * config/rs6000/rs6000.h (HARD_REGNO_CALLER_SAVE_MODE): Use DFmode
 
8834
+       to save TFmode registers and DImode to save TImode registers for
 
8835
+       caller save operations.
 
8836
+       (HARD_REGNO_CALL_PART_CLOBBERED): TFmode and TDmode do not need to
 
8837
+       mark being partially clobbered since they only use the first
 
8838
+       double word.
 
8839
+
 
8840
+       * config/rs6000/rs6000.c (rs6000_init_hard_regno_mode_ok): TFmode
 
8841
+       and TDmode only use the upper 64-bits of each VSX register.
 
8842
+
 
8843
+2013-04-09  Michael Meissner  <meissner@linux.vnet.ibm.com>
 
8844
+
 
8845
+       Merge up to 197642.
 
8846
+       * REVISION: Update subversion id.
 
8847
+
 
8848
+2013-03-20  Michael Meissner  <meissner@linux.vnet.ibm.com>
 
8849
+
 
8850
+       Backport from mainline
 
8851
+       2013-03-20  Pat Haugen <pthaugen@us.ibm.com>
 
8852
+
 
8853
+       * config/rs6000/predicates.md (indexed_address, update_address_mem
 
8854
+       update_indexed_address_mem): New predicates.
 
8855
+       * config/rs6000/vsx.md (vsx_extract_<mode>_zero): Set correct "type"
 
8856
+       attribute for load/store instructions.
 
8857
+       * config/rs6000/dfp.md (movsd_store): Likewise.
 
8858
+       (movsd_load): Likewise.
 
8859
+       * config/rs6000/rs6000.md (zero_extend<mode>di2_internal1): Likewise.
 
8860
+       (unnamed HI->DI extend define_insn): Likewise.
 
8861
+       (unnamed SI->DI extend define_insn): Likewise.
 
8862
+       (unnamed QI->SI extend define_insn): Likewise.
 
8863
+       (unnamed QI->HI extend define_insn): Likewise.
 
8864
+       (unnamed HI->SI extend define_insn): Likewise.
 
8865
+       (unnamed HI->SI extend define_insn): Likewise.
 
8866
+       (extendsfdf2_fpr): Likewise.
 
8867
+       (movsi_internal1): Likewise.
 
8868
+       (movsi_internal1_single): Likewise.
 
8869
+       (movhi_internal): Likewise.
 
8870
+       (movqi_internal): Likewise.
 
8871
+       (movcc_internal1): Correct mnemonic for stw insn. Set correct "type"
 
8872
+       attribute for load/store instructions.
 
8873
+       (mov<mode>_hardfloat): Set correct "type" attribute for load/store
 
8874
+       instructions.
 
8875
+       (mov<mode>_softfloat): Likewise.
 
8876
+       (mov<mode>_hardfloat32): Likewise.
 
8877
+       (mov<mode>_hardfloat64): Likewise.
 
8878
+       (mov<mode>_softfloat64): Likewise.
 
8879
+       (movdi_internal32): Likewise.
 
8880
+       (movdi_internal64): Likewise.
 
8881
+       (probe_stack_<mode>): Likewise.
 
8882
+
 
8883
+       Backport from mainline
 
8884
+       2013-03-20  Michael Meissner  <meissner@linux.vnet.ibm.com>
 
8885
+
 
8886
+       * config/rs6000/vector.md (VEC_R): Add 32-bit integer, binary
 
8887
+       floating point, and decimal floating point to reload iterator.
 
8888
+
 
8889
+       * config/rs6000/constraints.md (wl constraint): New constraints to
 
8890
+       return FLOAT_REGS if certain options are used to reduce the number
 
8891
+       of separate patterns that exist in the file.
 
8892
+       (wx constraint): Likewise.
 
8893
+       (wz constraint): Likewise.
 
8894
+
 
8895
+       * config/rs6000/rs6000.c (rs6000_debug_reg_global): If
 
8896
+       -mdebug=reg, print wg, wl, wx, and wz constraints.
 
8897
+       (rs6000_init_hard_regno_mode_ok): Initialize new constraints.
 
8898
+       Initialize the reload functions for 64-bit binary/decimal floating
 
8899
+       point types.
 
8900
+       (reg_offset_addressing_ok_p): If we are on a power7 or later, use
 
8901
+       LFIWZX and STFIWX to load/store 32-bit decimal types, and don't
 
8902
+       create the buffer on the stack to overcome not having a 32-bit
 
8903
+       load and store.
 
8904
+       (rs6000_emit_move): Likewise.
 
8905
+       (rs6000_secondary_memory_needed_rtx): Likewise.
 
8906
+       (rs6000_alloc_sdmode_stack_slot): Likewise.
 
8907
+       (rs6000_preferred_reload_class): On VSX, we can create SFmode 0.0f
 
8908
+       via xxlxor, just like DFmode 0.0.
 
8909
+
 
8910
+       * config/rs6000/rs6000.h (TARGET_NO_SDMODE_STACK): New macro,
 
8911
+       define as 1 if we are running on a power7 or newer.
 
8912
+       (enum r6000_reg_class_enum): Add new constraints.
 
8913
+
 
8914
+       * config/rs6000/dfp.md (movsd): Delete, combine with binary
 
8915
+       floating point moves in rs6000.md.  Combine power6x (mfpgpr) moves
 
8916
+       with other moves by using conditional constraits (wg).  Use LFIWZX
 
8917
+       and STFIWX for loading SDmode on power7.  Use xxlxor to create
 
8918
+       0.0f.
 
8919
+       (movsd splitter): Likewise.
 
8920
+       (movsd_hardfloat): Likewise.
 
8921
+       (movsd_softfloat): Likewise.
 
8922
+
 
8923
+       * config/rs6000/rs6000.md (FMOVE32): New iterators to combine
 
8924
+       binary and decimal floating point moves.
 
8925
+       (fmove_ok): New attributes to combine binary and decimal floating
 
8926
+       point moves, and to combine power6x (mfpgpr) moves along normal
 
8927
+       floating moves.
 
8928
+       (real_value_to_target): Likewise.
 
8929
+       (f32_lr): Likewise.
 
8930
+       (f32_lm): Likewise.
 
8931
+       (f32_li): Likewise.
 
8932
+       (f32_sr): Likewise.
 
8933
+       (f32_sm): Likewise.
 
8934
+       (f32_si): Likewise.
 
8935
+       (movsf): Combine binary and decimal floating point moves.  Combine
 
8936
+       power6x (mfpgpr) moves with other moves by using conditional
 
8937
+       constraits (wg).  Use LFIWZX and STFIWX for loading SDmode on
 
8938
+       power7.
 
8939
+       (mov<mode> for SFmode/SDmode); Likewise.
 
8940
+       (SFmode/SDmode splitters): Likewise.
 
8941
+       (movsf_hardfloat): Likewise.
 
8942
+       (mov<mode>_hardfloat for SFmode/SDmode): Likewise.
 
8943
+       (movsf_softfloat): Likewise.
 
8944
+       (mov<mode>_softfloat for SFmode/SDmode): Likewise.
 
8945
+
 
8946
+       * doc/md.texi (PowerPC and IBM RS6000 constraints): Document wl,
 
8947
+       wx and wz constraints.
 
8948
+
 
8949
+       * config/rs6000/constraints.md (wg constraint): New constraint to
 
8950
+       return FLOAT_REGS if -mmfpgpr (power6x) was used.
 
8951
+
 
8952
+       * config/rs6000/rs6000.h (enum r6000_reg_class_enum): Add wg
 
8953
+       constraint.
 
8954
+
 
8955
+       * config/rs6000/rs6000.c (rs6000_debug_reg_global): If
 
8956
+       -mdebug=reg, print wg, wl, wx, and wz constraints.
 
8957
+       (rs6000_init_hard_regno_mode_ok): Initialize new constraints.
 
8958
+       Initialize the reload functions for 64-bit binary/decimal floating
 
8959
+       point types.
 
8960
+       (reg_offset_addressing_ok_p): If we are on a power7 or later, use
 
8961
+       LFIWZX and STFIWX to load/store 32-bit decimal types, and don't
 
8962
+       create the buffer on the stack to overcome not having a 32-bit
 
8963
+       load and store.
 
8964
+       (rs6000_emit_move): Likewise.
 
8965
+       (rs6000_secondary_memory_needed_rtx): Likewise.
 
8966
+       (rs6000_alloc_sdmode_stack_slot): Likewise.
 
8967
+       (rs6000_preferred_reload_class): On VSX, we can create SFmode 0.0f
 
8968
+       via xxlxor, just like DFmode 0.0.
 
8969
+
 
8970
+
 
8971
+       * config/rs6000/dfp.md (movdd): Delete, combine with binary
 
8972
+       floating point moves in rs6000.md.  Combine power6x (mfpgpr) moves
 
8973
+       with other moves by using conditional constraits (wg).  Use LFIWZX
 
8974
+       and STFIWX for loading SDmode on power7.
 
8975
+       (movdd splitters): Likewise.
 
8976
+       (movdd_hardfloat32): Likewise.
 
8977
+       (movdd_softfloat32): Likewise.
 
8978
+       (movdd_hardfloat64_mfpgpr): Likewise.
 
8979
+       (movdd_hardfloat64): Likewise.
 
8980
+       (movdd_softfloat64): Likewise.
 
8981
+
 
8982
+       * config/rs6000/rs6000.md (FMOVE64): New iterators to combine
 
8983
+       64-bit binary and decimal floating point moves.
 
8984
+       (FMOVE64X): Likewise.
 
8985
+       (movdf): Combine 64-bit binary and decimal floating point moves.
 
8986
+       Combine power6x (mfpgpr) moves with other moves by using
 
8987
+       conditional constraits (wg).
 
8988
+       (mov<mode> for DFmode/DDmode): Likewise.
 
8989
+       (DFmode/DDmode splitters): Likewise.
 
8990
+       (movdf_hardfloat32): Likewise.
 
8991
+       (mov<mode>_hardfloat32 for DFmode/DDmode): Likewise.
 
8992
+       (movdf_softfloat32): Likewise.
 
8993
+       (movdf_hardfloat64_mfpgpr): Likewise.
 
8994
+       (movdf_hardfloat64): Likewise.
 
8995
+       (mov<mode>_hardfloat64 for DFmode/DDmode): Likewise.
 
8996
+       (movdf_softfloat64): Likewise.
 
8997
+       (mov<mode>_softfloat64 for DFmode/DDmode): Likewise.
 
8998
+       (reload_<mode>_load): Move to later in the file so they aren't in
 
8999
+       the middle of the floating point move insns.
 
9000
+       (reload_<mode>_store): Likewise.
 
9001
+
 
9002
+       * doc/md.texi (PowerPC and IBM RS6000 constraints): Document wg
 
9003
+       constraint.
 
9004
+
 
9005
+       * config/rs6000/rs6000.c (rs6000_debug_reg_global): Print out wg
 
9006
+       constraint if -mdebug=reg.
 
9007
+       (rs6000_initi_hard_regno_mode_ok): Enable wg constraint if
 
9008
+       -mfpgpr.  Enable using dd reload support if needed.
 
9009
+
 
9010
+       * config/rs6000/dfp.md (movtd): Delete, combine with 128-bit
 
9011
+       binary and decimal floating point moves in rs6000.md.
 
9012
+       (movtd_internal): Likewise.
 
9013
+
 
9014
+       * config/rs6000/rs6000.md (FMOVE128): Combine 128-bit binary and
 
9015
+       decimal floating point moves.
 
9016
+       (movtf): Likewise.
 
9017
+       (movtf_internal): Likewise.
 
9018
+       (mov<mode>_internal, TDmode/TFmode): Likewise.
 
9019
+       (movtf_softfloat): Likewise.
 
9020
+       (mov<mode>_softfloat, TDmode/TFmode): Likewise.
 
9021
+
 
9022
+       * config/rs6000/rs6000.md (movdi_mfpgpr): Delete, combine with
 
9023
+       movdi_internal64, using wg constraint for move direct operations.
 
9024
+       (movdi_internal64): Likewise.
 
9025
+
 
9026
+       * config/rs6000/rs6000.c (rs6000_debug_reg_global): Print
 
9027
+       MODES_TIEABLE_P for selected modes.  Print the numerical value of
 
9028
+       the various virtual registers. Use GPR/FPR first/last values,
 
9029
+       instead of hard coding the register numbers.  Print which modes
 
9030
+       have reload functions registered.
 
9031
+       (rs6000_option_override_internal): If -mdebug=reg, trace the
 
9032
+       options settings before/after setting cpu, target and subtarget
 
9033
+       settings.
 
9034
+       (rs6000_secondary_reload_trace): Improve the RTL dump for
 
9035
+       -mdebug=addr and for secondary reload failures in
 
9036
+       rs6000_secondary_reload_inner.
 
9037
+       (rs6000_secondary_reload_fail): Likewise.
 
9038
+       (rs6000_secondary_reload_inner): Likewise.
 
9039
+
 
9040
+       * config/rs6000/rs6000.md (FIRST_GPR_REGNO): Add convenience
 
9041
+       macros for first/last GPR and FPR registers.
 
9042
+       (LAST_GPR_REGNO): Likewise.
 
9043
+       (FIRST_FPR_REGNO): Likewise.
 
9044
+       (LAST_FPR_REGNO): Likewise.
 
9045
+
 
9046
+       * config/rs6000/vector.md (mul<mode>3): Use the combined macro
 
9047
+       VECTOR_UNIT_ALTIVEC_OR_VSX_P instead of separate calls to
 
9048
+       VECTOR_UNIT_ALTIVEC_P and VECTOR_UNIT_VSX_P.
 
9049
+       (vcond<mode><mode>): Likewise.
 
9050
+       (vcondu<mode><mode>): Likewise.
 
9051
+       (vector_gtu<mode>): Likewise.
 
9052
+       (vector_gte<mode>): Likewise.
 
9053
+       (xor<mode>3): Don't allow logical operations on TImode in 32-bit
 
9054
+       to prevent the compiler from converting DImode operations to
 
9055
+       TImode.
 
9056
+       (ior<mode>3): Likewise.
 
9057
+       (and<mode>3): Likewise.
 
9058
+       (one_cmpl<mode>2): Likewise.
 
9059
+       (nor<mode>3): Likewise.
 
9060
+       (andc<mode>3): Likewise.
 
9061
+
 
9062
+       * config/rs6000/constraints.md (wt constraint): New constraint
 
9063
+       that returns VSX_REGS if TImode is allowed in VSX registers.
 
9064
+
 
9065
+       * config/rs6000/predicates.md (easy_fp_constant): 0.0f is an easy
 
9066
+       constant under VSX.
 
9067
+
 
9068
+       * config/rs6000/rs6000-modes.def (PTImode): Define, PTImode is
 
9069
+       similar to TImode, but it is restricted to being in the GPRs.
 
9070
+
 
9071
+       * config/rs6000/rs6000.opt (-mvsx-timode): New switch to allow
 
9072
+       TImode to occupy a single VSX register.
 
9073
+
 
9074
+       * config/rs6000/rs6000-cpus.def (ISA_2_6_MASKS_SERVER): Default to
 
9075
+       -mvsx-timode for power7/power8.
 
9076
+       (power7 cpu): Likewise.
 
9077
+       (power8 cpu): Likewise.
 
9078
+
 
9079
+       * config/rs6000/rs6000.c (rs6000_hard_regno_nregs_internal): Make
 
9080
+       sure that TFmode/TDmode take up two registers if they are ever
 
9081
+       allowed in the upper VSX registers.
 
9082
+       (rs6000_hard_regno_mode_ok): If -mvsx-timode, allow TImode in VSX
 
9083
+       registers.
 
9084
+       (rs6000_init_hard_regno_mode_ok): Likewise.
 
9085
+       (rs6000_debug_reg_global): Add debugging for PTImode and wt
 
9086
+       constraint.  Print if LRA is turned on.
 
9087
+       (rs6000_option_override_internal): Give an error if -mvsx-timode
 
9088
+       and VSX is not enabled.
 
9089
+       (invalid_e500_subreg): Handle PTImode, restricting it to GPRs.  If
 
9090
+       -mvsx-timode, restrict TImode to reg+reg addressing, and PTImode
 
9091
+       to reg+offset addressing.  Use PTImode when checking offset
 
9092
+       addresses for validity.
 
9093
+       (reg_offset_addressing_ok_p): Likewise.
 
9094
+       (rs6000_legitimate_offset_address_p): Likewise.
 
9095
+       (rs6000_legitimize_address): Likewise.
 
9096
+       (rs6000_legitimize_reload_address): Likewise.
 
9097
+       (rs6000_legitimate_address_p): Likewise.
 
9098
+       (rs6000_eliminate_indexed_memrefs): Likewise.
 
9099
+       (rs6000_emit_move): Likewise.
 
9100
+       (rs6000_secondary_reload): Likewise.
 
9101
+       (rs6000_secondary_reload_inner): Handle PTImode.  Allow 64-bit
 
9102
+       reloads to fpr registers to continue to use reg+offset addressing,
 
9103
+       but 64-bit reloads to altivec registers need reg+reg addressing.
 
9104
+       Drop test for PRE_MODIFY, since VSX loads/stores no longer support
 
9105
+       it.  Treat LO_SUM like a PLUS operation.
 
9106
+       (rs6000_secondary_reload_class): If type is 64-bit, prefer to use
 
9107
+       FLOAT_REGS instead of VSX_RGS to allow use of reg+offset
 
9108
+       addressing.
 
9109
+       (rs6000_cannot_change_mode_class): Do not allow TImode in VSX
 
9110
+       registers to share a register with a smaller sized type, since VSX
 
9111
+       puts scalars in the upper 64-bits.
 
9112
+       (print_operand): Add support for PTImode.
 
9113
+       (rs6000_register_move_cost): Use VECTOR_MEM_VSX_P instead of
 
9114
+       VECTOR_UNIT_VSX_P to catch types that can be loaded in VSX
 
9115
+       registers, but don't have arithmetic support.
 
9116
+       (rs6000_memory_move_cost): Add test for VSX.
 
9117
+       (rs6000_opt_masks): Add -mvsx-timode.
 
9118
+
 
9119
+       * config/rs6000/vsx.md (VSm): Change to use 64-bit aligned moves
 
9120
+       for TImode.
 
9121
+       (VSs): Likewise.
 
9122
+       (VSr): Use wt constraint for TImode.
 
9123
+       (VSv): Drop TImode support.
 
9124
+       (vsx_movti): Delete, replace with versions for 32-bit and 64-bit.
 
9125
+       (vsx_movti_64bit): Likewise.
 
9126
+       (vsx_movti_32bit): Likewise.
 
9127
+       (vec_store_<mode>): Use VSX iterator instead of vector iterator.
 
9128
+       (vsx_and<mode>3): Delete use of '?' constraint on inputs, just put
 
9129
+       one '?' on the appropriate output constraint.  Do not allow TImode
 
9130
+       logical operations on 32-bit systems.
 
9131
+       (vsx_ior<mode>3): Likewise.
 
9132
+       (vsx_xor<mode>3): Likewise.
 
9133
+       (vsx_one_cmpl<mode>2): Likewise.
 
9134
+       (vsx_nor<mode>3): Likewise.
 
9135
+       (vsx_andc<mode>3): Likewise.
 
9136
+       (vsx_concat_<mode>): Likewise.
 
9137
+       (vsx_xxpermdi_<mode>): Fix thinko for non V2DF/V2DI modes.
 
9138
+
 
9139
+       * config/rs6000/rs6000.h (MASK_VSX_TIMODE): Map from
 
9140
+       OPTION_MASK_VSX_TIMODE.
 
9141
+       (enum rs6000_reg_class_enum): Add RS6000_CONSTRAINT_wt.
 
9142
+       (STACK_SAVEAREA_MODE): Use PTImode instead of TImode.
 
9143
+
 
9144
+       * config/rs6000/rs6000.md (INT mode attribute): Add PTImode.
 
9145
+       (TI2 iterator): New iterator for TImode, PTImode.
 
9146
+       (wd mode attribute): Add values for vector types.
 
9147
+       (movti_string): Replace TI move operations with operations for
 
9148
+       TImode and PTImode.  Add support for TImode being allowed in VSX
 
9149
+       registers.
 
9150
+       (mov<mode>_string, TImode/PTImode): Likewise.
 
9151
+       (movti_ppc64): Likewise.
 
9152
+       (mov<mode>_ppc64, TImode/PTImode): Likewise.
 
9153
+       (TI mode splitters): Likewise.
 
9154
+
 
9155
+       * doc/md.texi (PowerPC and IBM RS6000 constraints): Document wt
 
9156
+       constraint.
 
9157
+
 
9158
+2013-03-20  Michael Meissner  <meissner@linux.vnet.ibm.com>
 
9159
+
 
9160
+       Clone branch from gcc-4_8-branch, subversion id 196835.
 
9161
+       * REVISION: New file, track subversion id.
 
9162
+
 
9163
--- a/src/gcc/calls.c
 
9164
+++ b/src/gcc/calls.c
 
9165
@@ -983,6 +983,7 @@
 
9166
 
 
9167
   for (i = 0; i < num_actuals; i++)
 
9168
     if (args[i].reg != 0 && ! args[i].pass_on_stack
 
9169
+       && GET_CODE (args[i].reg) != PARALLEL
 
9170
        && args[i].mode == BLKmode
 
9171
        && MEM_P (args[i].value)
 
9172
        && (MEM_ALIGN (args[i].value)
 
9173
@@ -1327,6 +1328,7 @@
 
9174
 #else
 
9175
                             args[i].reg != 0,
 
9176
 #endif
 
9177
+                            reg_parm_stack_space,
 
9178
                             args[i].pass_on_stack ? 0 : args[i].partial,
 
9179
                             fndecl, args_size, &args[i].locate);
 
9180
 #ifdef BLOCK_REG_PADDING
 
9181
@@ -3171,7 +3173,9 @@
 
9182
         group load/store machinery below.  */
 
9183
       if (!structure_value_addr
 
9184
          && !pcc_struct_value
 
9185
+         && TYPE_MODE (rettype) != VOIDmode
 
9186
          && TYPE_MODE (rettype) != BLKmode
 
9187
+         && REG_P (valreg)
 
9188
          && targetm.calls.return_in_msb (rettype))
 
9189
        {
 
9190
          if (shift_return_value (TYPE_MODE (rettype), false, valreg))
 
9191
@@ -3734,7 +3738,8 @@
 
9192
 #else
 
9193
                           argvec[count].reg != 0,
 
9194
 #endif
 
9195
-                          0, NULL_TREE, &args_size, &argvec[count].locate);
 
9196
+                          reg_parm_stack_space, 0,
 
9197
+                          NULL_TREE, &args_size, &argvec[count].locate);
 
9198
 
 
9199
       if (argvec[count].reg == 0 || argvec[count].partial != 0
 
9200
          || reg_parm_stack_space > 0)
 
9201
@@ -3821,7 +3826,7 @@
 
9202
 #else
 
9203
                               argvec[count].reg != 0,
 
9204
 #endif
 
9205
-                              argvec[count].partial,
 
9206
+                              reg_parm_stack_space, argvec[count].partial,
 
9207
                               NULL_TREE, &args_size, &argvec[count].locate);
 
9208
          args_size.constant += argvec[count].locate.size.constant;
 
9209
          gcc_assert (!argvec[count].locate.size.var);
 
9210
--- a/src/gcc/REVISION
 
9211
+++ b/src/gcc/REVISION
 
9212
@@ -0,0 +1 @@
 
9213
+[ibm/gcc-4_8-branch merged from gcc-4_8-branch, revision 204974]
 
9214
--- a/src/gcc/config.gcc
 
9215
+++ b/src/gcc/config.gcc
 
9216
@@ -420,7 +420,7 @@
 
9217
         ;;
 
9218
 powerpc*-*-*)
 
9219
        cpu_type=rs6000
 
9220
-       extra_headers="ppc-asm.h altivec.h spe.h ppu_intrinsics.h paired.h spu2vmx.h vec_types.h si2vmx.h"
 
9221
+       extra_headers="ppc-asm.h altivec.h spe.h ppu_intrinsics.h paired.h spu2vmx.h vec_types.h si2vmx.h htmintrin.h htmxlintrin.h"
 
9222
        need_64bit_hwint=yes
 
9223
        case x$with_cpu in
 
9224
            xpowerpc64|xdefault64|x6[23]0|x970|xG5|xpower[345678]|xpower6x|xrs64a|xcell|xa2|xe500mc64|xe5500|Xe6500)
 
9225
@@ -3494,7 +3494,7 @@
 
9226
                ;;
 
9227
 
 
9228
        powerpc*-*-* | rs6000-*-*)
 
9229
-               supported_defaults="cpu cpu_32 cpu_64 float tune tune_32 tune_64"
 
9230
+               supported_defaults="abi cpu cpu_32 cpu_64 float tune tune_32 tune_64"
 
9231
 
 
9232
                for which in cpu cpu_32 cpu_64 tune tune_32 tune_64; do
 
9233
                        eval "val=\$with_$which"
 
9234
@@ -3531,6 +3531,16 @@
 
9235
                                ;;
 
9236
                        esac
 
9237
                done
 
9238
+
 
9239
+               case "$with_abi" in
 
9240
+               "" | elfv1 | elfv2 )
 
9241
+                       #OK
 
9242
+                       ;;
 
9243
+               *)
 
9244
+                       echo "Unknown ABI used in --with-abi=$with_abi"
 
9245
+                       exit 1
 
9246
+                       ;;
 
9247
+               esac
 
9248
                ;;
 
9249
 
 
9250
        s390*-*-*)
 
9251
--- a/src/gcc/config/rs6000/power8.md
 
9252
+++ b/src/gcc/config/rs6000/power8.md
 
9253
@@ -0,0 +1,373 @@
 
9254
+;; Scheduling description for IBM POWER8 processor.
 
9255
+;; Copyright (C) 2013 Free Software Foundation, Inc.
 
9256
+;;
 
9257
+;; Contributed by Pat Haugen (pthaugen@us.ibm.com).
 
9258
+
 
9259
+;; This file is part of GCC.
 
9260
+;;
 
9261
+;; GCC is free software; you can redistribute it and/or modify it
 
9262
+;; under the terms of the GNU General Public License as published
 
9263
+;; by the Free Software Foundation; either version 3, or (at your
 
9264
+;; option) any later version.
 
9265
+;;
 
9266
+;; GCC is distributed in the hope that it will be useful, but WITHOUT
 
9267
+;; ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
 
9268
+;; or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public
 
9269
+;; License for more details.
 
9270
+;;
 
9271
+;; You should have received a copy of the GNU General Public License
 
9272
+;; along with GCC; see the file COPYING3.  If not see
 
9273
+;; <http://www.gnu.org/licenses/>.
 
9274
+
 
9275
+(define_automaton "power8fxu,power8lsu,power8vsu,power8misc")
 
9276
+
 
9277
+(define_cpu_unit "fxu0_power8,fxu1_power8" "power8fxu")
 
9278
+(define_cpu_unit "lu0_power8,lu1_power8" "power8lsu")
 
9279
+(define_cpu_unit "lsu0_power8,lsu1_power8" "power8lsu")
 
9280
+(define_cpu_unit "vsu0_power8,vsu1_power8" "power8vsu")
 
9281
+(define_cpu_unit "bpu_power8,cru_power8" "power8misc")
 
9282
+(define_cpu_unit "du0_power8,du1_power8,du2_power8,du3_power8,du4_power8,\
 
9283
+                 du5_power8,du6_power8"  "power8misc")
 
9284
+
 
9285
+
 
9286
+; Dispatch group reservations
 
9287
+(define_reservation "DU_any_power8"
 
9288
+                   "du0_power8|du1_power8|du2_power8|du3_power8|du4_power8|\
 
9289
+                    du5_power8")
 
9290
+
 
9291
+; 2-way Cracked instructions go in slots 0-1
 
9292
+;   (can also have a second in slots 3-4 if insns are adjacent)
 
9293
+(define_reservation "DU_cracked_power8"
 
9294
+                   "du0_power8+du1_power8")
 
9295
+
 
9296
+; Insns that are first in group
 
9297
+(define_reservation "DU_first_power8"
 
9298
+                   "du0_power8")
 
9299
+
 
9300
+; Insns that are first and last in group
 
9301
+(define_reservation "DU_both_power8"
 
9302
+                   "du0_power8+du1_power8+du2_power8+du3_power8+du4_power8+\
 
9303
+                    du5_power8+du6_power8")
 
9304
+
 
9305
+; Dispatch slots are allocated in order conforming to program order.
 
9306
+(absence_set "du0_power8" "du1_power8,du2_power8,du3_power8,du4_power8,\
 
9307
+             du5_power8,du6_power8")
 
9308
+(absence_set "du1_power8" "du2_power8,du3_power8,du4_power8,du5_power8,\
 
9309
+             du6_power8")
 
9310
+(absence_set "du2_power8" "du3_power8,du4_power8,du5_power8,du6_power8")
 
9311
+(absence_set "du3_power8" "du4_power8,du5_power8,du6_power8")
 
9312
+(absence_set "du4_power8" "du5_power8,du6_power8")
 
9313
+(absence_set "du5_power8" "du6_power8")
 
9314
+
 
9315
+
 
9316
+; Execution unit reservations
 
9317
+(define_reservation "FXU_power8"
 
9318
+                    "fxu0_power8|fxu1_power8")
 
9319
+
 
9320
+(define_reservation "LU_power8"
 
9321
+                    "lu0_power8|lu1_power8")
 
9322
+
 
9323
+(define_reservation "LSU_power8"
 
9324
+                    "lsu0_power8|lsu1_power8")
 
9325
+
 
9326
+(define_reservation "LU_or_LSU_power8"
 
9327
+                    "lu0_power8|lu1_power8|lsu0_power8|lsu1_power8")
 
9328
+
 
9329
+(define_reservation "VSU_power8"
 
9330
+                    "vsu0_power8|vsu1_power8")
 
9331
+
 
9332
+
 
9333
+; LS Unit
 
9334
+(define_insn_reservation "power8-load" 3
 
9335
+  (and (eq_attr "type" "load")
 
9336
+       (eq_attr "cpu" "power8"))
 
9337
+  "DU_any_power8,LU_or_LSU_power8")
 
9338
+
 
9339
+(define_insn_reservation "power8-load-update" 3
 
9340
+  (and (eq_attr "type" "load_u,load_ux")
 
9341
+       (eq_attr "cpu" "power8"))
 
9342
+  "DU_cracked_power8,LU_or_LSU_power8+FXU_power8")
 
9343
+
 
9344
+(define_insn_reservation "power8-load-ext" 3
 
9345
+  (and (eq_attr "type" "load_ext")
 
9346
+       (eq_attr "cpu" "power8"))
 
9347
+  "DU_cracked_power8,LU_or_LSU_power8,FXU_power8")
 
9348
+
 
9349
+(define_insn_reservation "power8-load-ext-update" 3
 
9350
+  (and (eq_attr "type" "load_ext_u,load_ext_ux")
 
9351
+       (eq_attr "cpu" "power8"))
 
9352
+  "DU_both_power8,LU_or_LSU_power8+FXU_power8,FXU_power8")
 
9353
+
 
9354
+(define_insn_reservation "power8-fpload" 5
 
9355
+  (and (eq_attr "type" "fpload,vecload")
 
9356
+       (eq_attr "cpu" "power8"))
 
9357
+  "DU_any_power8,LU_power8")
 
9358
+
 
9359
+(define_insn_reservation "power8-fpload-update" 5
 
9360
+  (and (eq_attr "type" "fpload_u,fpload_ux")
 
9361
+       (eq_attr "cpu" "power8"))
 
9362
+  "DU_cracked_power8,LU_power8+FXU_power8")
 
9363
+
 
9364
+(define_insn_reservation "power8-store" 5 ; store-forwarding latency
 
9365
+  (and (eq_attr "type" "store,store_u")
 
9366
+       (eq_attr "cpu" "power8"))
 
9367
+  "DU_any_power8,LSU_power8+LU_power8")
 
9368
+
 
9369
+(define_insn_reservation "power8-store-update-indexed" 5
 
9370
+  (and (eq_attr "type" "store_ux")
 
9371
+       (eq_attr "cpu" "power8"))
 
9372
+  "DU_cracked_power8,LSU_power8+LU_power8")
 
9373
+
 
9374
+(define_insn_reservation "power8-fpstore" 5
 
9375
+  (and (eq_attr "type" "fpstore")
 
9376
+       (eq_attr "cpu" "power8"))
 
9377
+  "DU_any_power8,LSU_power8+VSU_power8")
 
9378
+
 
9379
+(define_insn_reservation "power8-fpstore-update" 5
 
9380
+  (and (eq_attr "type" "fpstore_u,fpstore_ux")
 
9381
+       (eq_attr "cpu" "power8"))
 
9382
+  "DU_any_power8,LSU_power8+VSU_power8")
 
9383
+
 
9384
+(define_insn_reservation "power8-vecstore" 5
 
9385
+  (and (eq_attr "type" "vecstore")
 
9386
+       (eq_attr "cpu" "power8"))
 
9387
+  "DU_cracked_power8,LSU_power8+VSU_power8")
 
9388
+
 
9389
+(define_insn_reservation "power8-larx" 3
 
9390
+  (and (eq_attr "type" "load_l")
 
9391
+       (eq_attr "cpu" "power8"))
 
9392
+  "DU_both_power8,LU_or_LSU_power8")
 
9393
+
 
9394
+(define_insn_reservation "power8-stcx" 10
 
9395
+  (and (eq_attr "type" "store_c")
 
9396
+       (eq_attr "cpu" "power8"))
 
9397
+  "DU_both_power8,LSU_power8+LU_power8")
 
9398
+
 
9399
+(define_insn_reservation "power8-sync" 1
 
9400
+  (and (eq_attr "type" "sync,isync")
 
9401
+       (eq_attr "cpu" "power8"))
 
9402
+  "DU_both_power8,LSU_power8")
 
9403
+
 
9404
+
 
9405
+; FX Unit
 
9406
+(define_insn_reservation "power8-1cyc" 1
 
9407
+  (and (eq_attr "type" "integer,insert_word,insert_dword,shift,trap,\
 
9408
+                        var_shift_rotate,exts,isel")
 
9409
+       (eq_attr "cpu" "power8"))
 
9410
+  "DU_any_power8,FXU_power8")
 
9411
+
 
9412
+; Extra cycle to LU/LSU
 
9413
+(define_bypass 2 "power8-1cyc"
 
9414
+                "power8-load*,power8-fpload*,power8-store*,power8-fpstore*,\
 
9415
+                 power8-vecstore,power8-larx,power8-stcx")
 
9416
+;               "power8-load,power8-load-update,power8-load-ext,\
 
9417
+;                power8-load-ext-update,power8-fpload,power8-fpload-update,\
 
9418
+;                power8-store,power8-store-update,power8-store-update-indexed,\
 
9419
+;                power8-fpstore,power8-fpstore-update,power8-vecstore,\
 
9420
+;                power8-larx,power8-stcx")
 
9421
+
 
9422
+(define_insn_reservation "power8-2cyc" 2
 
9423
+  (and (eq_attr "type" "cntlz,popcnt")
 
9424
+       (eq_attr "cpu" "power8"))
 
9425
+  "DU_any_power8,FXU_power8")
 
9426
+
 
9427
+(define_insn_reservation "power8-two" 2
 
9428
+  (and (eq_attr "type" "two")
 
9429
+       (eq_attr "cpu" "power8"))
 
9430
+  "DU_any_power8+DU_any_power8,FXU_power8,FXU_power8")
 
9431
+
 
9432
+(define_insn_reservation "power8-three" 3
 
9433
+  (and (eq_attr "type" "three")
 
9434
+       (eq_attr "cpu" "power8"))
 
9435
+  "DU_any_power8+DU_any_power8+DU_any_power8,FXU_power8,FXU_power8,FXU_power8")
 
9436
+
 
9437
+; cmp - Normal compare insns
 
9438
+(define_insn_reservation "power8-cmp" 2
 
9439
+  (and (eq_attr "type" "cmp")
 
9440
+       (eq_attr "cpu" "power8"))
 
9441
+  "DU_any_power8,FXU_power8")
 
9442
+
 
9443
+; fast_compare : add./and./nor./etc
 
9444
+(define_insn_reservation "power8-fast-compare" 2
 
9445
+  (and (eq_attr "type" "fast_compare")
 
9446
+       (eq_attr "cpu" "power8"))
 
9447
+  "DU_any_power8,FXU_power8")
 
9448
+
 
9449
+; compare : rldicl./exts./etc
 
9450
+; delayed_compare : rlwinm./slwi./etc
 
9451
+; var_delayed_compare : rlwnm./slw./etc
 
9452
+(define_insn_reservation "power8-compare" 2
 
9453
+  (and (eq_attr "type" "compare,delayed_compare,var_delayed_compare")
 
9454
+       (eq_attr "cpu" "power8"))
 
9455
+  "DU_cracked_power8,FXU_power8,FXU_power8")
 
9456
+
 
9457
+; Extra cycle to LU/LSU
 
9458
+(define_bypass 3 "power8-fast-compare,power8-compare"
 
9459
+                "power8-load*,power8-fpload*,power8-store*,power8-fpstore*,\
 
9460
+                 power8-vecstore,power8-larx,power8-stcx")
 
9461
+
 
9462
+; 5 cycle CR latency 
 
9463
+(define_bypass 5 "power8-fast-compare,power8-compare"
 
9464
+                "power8-crlogical,power8-mfcr,power8-mfcrf,power8-branch")
 
9465
+
 
9466
+(define_insn_reservation "power8-mul" 4
 
9467
+  (and (eq_attr "type" "imul,imul2,imul3,lmul")
 
9468
+       (eq_attr "cpu" "power8"))
 
9469
+  "DU_any_power8,FXU_power8")
 
9470
+
 
9471
+(define_insn_reservation "power8-mul-compare" 4
 
9472
+  (and (eq_attr "type" "imul_compare,lmul_compare")
 
9473
+       (eq_attr "cpu" "power8"))
 
9474
+  "DU_cracked_power8,FXU_power8")
 
9475
+
 
9476
+; Extra cycle to LU/LSU
 
9477
+(define_bypass 5 "power8-mul,power8-mul-compare"
 
9478
+                "power8-load*,power8-fpload*,power8-store*,power8-fpstore*,\
 
9479
+                 power8-vecstore,power8-larx,power8-stcx")
 
9480
+
 
9481
+; 7 cycle CR latency 
 
9482
+(define_bypass 7 "power8-mul,power8-mul-compare"
 
9483
+                "power8-crlogical,power8-mfcr,power8-mfcrf,power8-branch")
 
9484
+
 
9485
+; FXU divides are not pipelined
 
9486
+(define_insn_reservation "power8-idiv" 37
 
9487
+  (and (eq_attr "type" "idiv")
 
9488
+       (eq_attr "cpu" "power8"))
 
9489
+  "DU_any_power8,fxu0_power8*37|fxu1_power8*37")
 
9490
+
 
9491
+(define_insn_reservation "power8-ldiv" 68
 
9492
+  (and (eq_attr "type" "ldiv")
 
9493
+       (eq_attr "cpu" "power8"))
 
9494
+  "DU_any_power8,fxu0_power8*68|fxu1_power8*68")
 
9495
+
 
9496
+(define_insn_reservation "power8-mtjmpr" 5
 
9497
+  (and (eq_attr "type" "mtjmpr")
 
9498
+       (eq_attr "cpu" "power8"))
 
9499
+  "DU_first_power8,FXU_power8")
 
9500
+
 
9501
+; Should differentiate between 1 cr field and > 1 since mtocrf is not microcode
 
9502
+(define_insn_reservation "power8-mtcr" 3
 
9503
+  (and (eq_attr "type" "mtcr")
 
9504
+       (eq_attr "cpu" "power8"))
 
9505
+  "DU_both_power8,FXU_power8")
 
9506
+
 
9507
+
 
9508
+; CR Unit
 
9509
+(define_insn_reservation "power8-mfjmpr" 5
 
9510
+  (and (eq_attr "type" "mfjmpr")
 
9511
+       (eq_attr "cpu" "power8"))
 
9512
+  "DU_first_power8,cru_power8+FXU_power8")
 
9513
+
 
9514
+(define_insn_reservation "power8-crlogical" 3
 
9515
+  (and (eq_attr "type" "cr_logical,delayed_cr")
 
9516
+       (eq_attr "cpu" "power8"))
 
9517
+  "DU_first_power8,cru_power8")
 
9518
+
 
9519
+(define_insn_reservation "power8-mfcr" 5
 
9520
+  (and (eq_attr "type" "mfcr")
 
9521
+       (eq_attr "cpu" "power8"))
 
9522
+  "DU_both_power8,cru_power8")
 
9523
+
 
9524
+(define_insn_reservation "power8-mfcrf" 3
 
9525
+  (and (eq_attr "type" "mfcrf")
 
9526
+       (eq_attr "cpu" "power8"))
 
9527
+  "DU_first_power8,cru_power8")
 
9528
+
 
9529
+
 
9530
+; BR Unit
 
9531
+; Branches take dispatch slot 7, but reserve any remaining prior slots to
 
9532
+; prevent other insns from grabbing them once this is assigned.
 
9533
+(define_insn_reservation "power8-branch" 3
 
9534
+  (and (eq_attr "type" "jmpreg,branch")
 
9535
+       (eq_attr "cpu" "power8"))
 
9536
+  "(du6_power8\
 
9537
+   |du5_power8+du6_power8\
 
9538
+   |du4_power8+du5_power8+du6_power8\
 
9539
+   |du3_power8+du4_power8+du5_power8+du6_power8\
 
9540
+   |du2_power8+du3_power8+du4_power8+du5_power8+du6_power8\
 
9541
+   |du1_power8+du2_power8+du3_power8+du4_power8+du5_power8+du6_power8\
 
9542
+   |du0_power8+du1_power8+du2_power8+du3_power8+du4_power8+du5_power8+\
 
9543
+    du6_power8),bpu_power8")
 
9544
+
 
9545
+; Branch updating LR/CTR feeding mf[lr|ctr]
 
9546
+(define_bypass 4 "power8-branch" "power8-mfjmpr")
 
9547
+
 
9548
+
 
9549
+; VS Unit (includes FP/VSX/VMX/DFP/Crypto)
 
9550
+(define_insn_reservation "power8-fp" 6
 
9551
+  (and (eq_attr "type" "fp,dmul")
 
9552
+       (eq_attr "cpu" "power8"))
 
9553
+  "DU_any_power8,VSU_power8")
 
9554
+
 
9555
+; Additional 3 cycles for any CR result
 
9556
+(define_bypass 9 "power8-fp" "power8-crlogical,power8-mfcr*,power8-branch")
 
9557
+
 
9558
+(define_insn_reservation "power8-fpcompare" 8
 
9559
+  (and (eq_attr "type" "fpcompare")
 
9560
+       (eq_attr "cpu" "power8"))
 
9561
+  "DU_any_power8,VSU_power8")
 
9562
+
 
9563
+(define_insn_reservation "power8-sdiv" 27
 
9564
+  (and (eq_attr "type" "sdiv")
 
9565
+       (eq_attr "cpu" "power8"))
 
9566
+  "DU_any_power8,VSU_power8")
 
9567
+
 
9568
+(define_insn_reservation "power8-ddiv" 33
 
9569
+  (and (eq_attr "type" "ddiv")
 
9570
+       (eq_attr "cpu" "power8"))
 
9571
+  "DU_any_power8,VSU_power8")
 
9572
+
 
9573
+(define_insn_reservation "power8-sqrt" 32
 
9574
+  (and (eq_attr "type" "ssqrt")
 
9575
+       (eq_attr "cpu" "power8"))
 
9576
+  "DU_any_power8,VSU_power8")
 
9577
+
 
9578
+(define_insn_reservation "power8-dsqrt" 44
 
9579
+  (and (eq_attr "type" "dsqrt")
 
9580
+       (eq_attr "cpu" "power8"))
 
9581
+  "DU_any_power8,VSU_power8")
 
9582
+
 
9583
+(define_insn_reservation "power8-vecsimple" 2
 
9584
+  (and (eq_attr "type" "vecperm,vecsimple,veccmp")
 
9585
+       (eq_attr "cpu" "power8"))
 
9586
+  "DU_any_power8,VSU_power8")
 
9587
+
 
9588
+(define_insn_reservation "power8-vecnormal" 6
 
9589
+  (and (eq_attr "type" "vecfloat,vecdouble")
 
9590
+       (eq_attr "cpu" "power8"))
 
9591
+  "DU_any_power8,VSU_power8")
 
9592
+
 
9593
+(define_bypass 7 "power8-vecnormal"
 
9594
+                "power8-vecsimple,power8-veccomplex,power8-fpstore*,\
 
9595
+                 power8-vecstore")
 
9596
+
 
9597
+(define_insn_reservation "power8-veccomplex" 7
 
9598
+  (and (eq_attr "type" "veccomplex")
 
9599
+       (eq_attr "cpu" "power8"))
 
9600
+  "DU_any_power8,VSU_power8")
 
9601
+
 
9602
+(define_insn_reservation "power8-vecfdiv" 25
 
9603
+  (and (eq_attr "type" "vecfdiv")
 
9604
+       (eq_attr "cpu" "power8"))
 
9605
+  "DU_any_power8,VSU_power8")
 
9606
+
 
9607
+(define_insn_reservation "power8-vecdiv" 31
 
9608
+  (and (eq_attr "type" "vecdiv")
 
9609
+       (eq_attr "cpu" "power8"))
 
9610
+  "DU_any_power8,VSU_power8")
 
9611
+
 
9612
+(define_insn_reservation "power8-mffgpr" 5
 
9613
+  (and (eq_attr "type" "mffgpr")
 
9614
+       (eq_attr "cpu" "power8"))
 
9615
+  "DU_any_power8,VSU_power8")
 
9616
+
 
9617
+(define_insn_reservation "power8-mftgpr" 6
 
9618
+  (and (eq_attr "type" "mftgpr")
 
9619
+       (eq_attr "cpu" "power8"))
 
9620
+  "DU_any_power8,VSU_power8")
 
9621
+
 
9622
+(define_insn_reservation "power8-crypto" 7
 
9623
+  (and (eq_attr "type" "crypto")
 
9624
+       (eq_attr "cpu" "power8"))
 
9625
+  "DU_any_power8,VSU_power8")
 
9626
+
 
9627
--- a/src/gcc/config/rs6000/vector.md
 
9628
+++ b/src/gcc/config/rs6000/vector.md
 
9629
@@ -24,13 +24,13 @@
 
9630
 
 
9631
 
 
9632
 ;; Vector int modes
 
9633
-(define_mode_iterator VEC_I [V16QI V8HI V4SI])
 
9634
+(define_mode_iterator VEC_I [V16QI V8HI V4SI V2DI])
 
9635
 
 
9636
 ;; Vector float modes
 
9637
 (define_mode_iterator VEC_F [V4SF V2DF])
 
9638
 
 
9639
 ;; Vector arithmetic modes
 
9640
-(define_mode_iterator VEC_A [V16QI V8HI V4SI V4SF V2DF])
 
9641
+(define_mode_iterator VEC_A [V16QI V8HI V4SI V2DI V4SF V2DF])
 
9642
 
 
9643
 ;; Vector modes that need alginment via permutes
 
9644
 (define_mode_iterator VEC_K [V16QI V8HI V4SI V4SF])
 
9645
@@ -45,7 +45,7 @@
 
9646
 (define_mode_iterator VEC_N [V4SI V4SF V2DI V2DF])
 
9647
 
 
9648
 ;; Vector comparison modes
 
9649
-(define_mode_iterator VEC_C [V16QI V8HI V4SI V4SF V2DF])
 
9650
+(define_mode_iterator VEC_C [V16QI V8HI V4SI V2DI V4SF V2DF])
 
9651
 
 
9652
 ;; Vector init/extract modes
 
9653
 (define_mode_iterator VEC_E [V16QI V8HI V4SI V2DI V4SF V2DF])
 
9654
@@ -54,7 +54,7 @@
 
9655
 (define_mode_iterator VEC_64 [V2DI V2DF])
 
9656
 
 
9657
 ;; Vector reload iterator
 
9658
-(define_mode_iterator VEC_R [V16QI V8HI V4SI V2DI V4SF V2DF DF TI])
 
9659
+(define_mode_iterator VEC_R [V16QI V8HI V4SI V2DI V4SF V2DF SF SD SI DF DD DI TI])
 
9660
 
 
9661
 ;; Base type from vector mode
 
9662
 (define_mode_attr VEC_base [(V16QI "QI")
 
9663
@@ -88,7 +88,8 @@
 
9664
                                 (smax "smax")])
 
9665
 
 
9666
 
 
9667
-;; Vector move instructions.
 
9668
+;; Vector move instructions.  Little-endian VSX loads and stores require
 
9669
+;; special handling to circumvent "element endianness."
 
9670
 (define_expand "mov<mode>"
 
9671
   [(set (match_operand:VEC_M 0 "nonimmediate_operand" "")
 
9672
        (match_operand:VEC_M 1 "any_operand" ""))]
 
9673
@@ -104,6 +105,16 @@
 
9674
               && !vlogical_operand (operands[1], <MODE>mode))
 
9675
        operands[1] = force_reg (<MODE>mode, operands[1]);
 
9676
     }
 
9677
+  if (!BYTES_BIG_ENDIAN
 
9678
+      && VECTOR_MEM_VSX_P (<MODE>mode)
 
9679
+      && <MODE>mode != TImode
 
9680
+      && !gpr_or_gpr_p (operands[0], operands[1])
 
9681
+      && (memory_operand (operands[0], <MODE>mode)
 
9682
+          ^ memory_operand (operands[1], <MODE>mode)))
 
9683
+    {
 
9684
+      rs6000_emit_le_vsx_move (operands[0], operands[1], <MODE>mode);
 
9685
+      DONE;
 
9686
+    }
 
9687
 })
 
9688
 
 
9689
 ;; Generic vector floating point load/store instructions.  These will match
 
9690
@@ -126,7 +137,9 @@
 
9691
         (match_operand:VEC_L 1 "input_operand" ""))]
 
9692
   "VECTOR_MEM_ALTIVEC_OR_VSX_P (<MODE>mode)
 
9693
    && reload_completed
 
9694
-   && gpr_or_gpr_p (operands[0], operands[1])"
 
9695
+   && gpr_or_gpr_p (operands[0], operands[1])
 
9696
+   && !direct_move_p (operands[0], operands[1])
 
9697
+   && !quad_load_store_p (operands[0], operands[1])"
 
9698
   [(pc)]
 
9699
 {
 
9700
   rs6000_split_multireg_move (operands[0], operands[1]);
 
9701
@@ -249,7 +262,7 @@
 
9702
   [(set (match_operand:VEC_F 0 "vfloat_operand" "")
 
9703
        (mult:VEC_F (match_operand:VEC_F 1 "vfloat_operand" "")
 
9704
                    (match_operand:VEC_F 2 "vfloat_operand" "")))]
 
9705
-  "VECTOR_UNIT_VSX_P (<MODE>mode) || VECTOR_UNIT_ALTIVEC_P (<MODE>mode)"
 
9706
+  "VECTOR_UNIT_ALTIVEC_OR_VSX_P (<MODE>mode)"
 
9707
 {
 
9708
   if (<MODE>mode == V4SFmode && VECTOR_UNIT_ALTIVEC_P (<MODE>mode))
 
9709
     {
 
9710
@@ -395,7 +408,7 @@
 
9711
                          (match_operand:VEC_I 5 "vint_operand" "")])
 
9712
         (match_operand:VEC_I 1 "vint_operand" "")
 
9713
         (match_operand:VEC_I 2 "vint_operand" "")))]
 
9714
-  "VECTOR_UNIT_ALTIVEC_P (<MODE>mode)"
 
9715
+  "VECTOR_UNIT_ALTIVEC_OR_VSX_P (<MODE>mode)"
 
9716
   "
 
9717
 {
 
9718
   if (rs6000_emit_vector_cond_expr (operands[0], operands[1], operands[2],
 
9719
@@ -451,7 +464,7 @@
 
9720
                          (match_operand:VEC_I 5 "vint_operand" "")])
 
9721
         (match_operand:VEC_I 1 "vint_operand" "")
 
9722
         (match_operand:VEC_I 2 "vint_operand" "")))]
 
9723
-  "VECTOR_UNIT_ALTIVEC_P (<MODE>mode)"
 
9724
+  "VECTOR_UNIT_ALTIVEC_OR_VSX_P (<MODE>mode)"
 
9725
   "
 
9726
 {
 
9727
   if (rs6000_emit_vector_cond_expr (operands[0], operands[1], operands[2],
 
9728
@@ -505,14 +518,14 @@
 
9729
   [(set (match_operand:VEC_I 0 "vint_operand" "")
 
9730
        (gtu:VEC_I (match_operand:VEC_I 1 "vint_operand" "")
 
9731
                   (match_operand:VEC_I 2 "vint_operand" "")))]
 
9732
-  "VECTOR_UNIT_ALTIVEC_P (<MODE>mode)"
 
9733
+  "VECTOR_UNIT_ALTIVEC_OR_VSX_P (<MODE>mode)"
 
9734
   "")
 
9735
 
 
9736
 (define_expand "vector_geu<mode>"
 
9737
   [(set (match_operand:VEC_I 0 "vint_operand" "")
 
9738
        (geu:VEC_I (match_operand:VEC_I 1 "vint_operand" "")
 
9739
                   (match_operand:VEC_I 2 "vint_operand" "")))]
 
9740
-  "VECTOR_UNIT_ALTIVEC_P (<MODE>mode)"
 
9741
+  "VECTOR_UNIT_ALTIVEC_OR_VSX_P (<MODE>mode)"
 
9742
   "")
 
9743
 
 
9744
 (define_insn_and_split "*vector_uneq<mode>"
 
9745
@@ -708,48 +721,19 @@
 
9746
   "")
 
9747
 
 
9748
 
 
9749
-;; Vector logical instructions
 
9750
-(define_expand "xor<mode>3"
 
9751
-  [(set (match_operand:VEC_L 0 "vlogical_operand" "")
 
9752
-        (xor:VEC_L (match_operand:VEC_L 1 "vlogical_operand" "")
 
9753
-                  (match_operand:VEC_L 2 "vlogical_operand" "")))]
 
9754
-  "VECTOR_MEM_ALTIVEC_OR_VSX_P (<MODE>mode)"
 
9755
-  "")
 
9756
+;; Vector count leading zeros
 
9757
+(define_expand "clz<mode>2"
 
9758
+  [(set (match_operand:VEC_I 0 "register_operand" "")
 
9759
+       (clz:VEC_I (match_operand:VEC_I 1 "register_operand" "")))]
 
9760
+  "TARGET_P8_VECTOR")
 
9761
 
 
9762
-(define_expand "ior<mode>3"
 
9763
-  [(set (match_operand:VEC_L 0 "vlogical_operand" "")
 
9764
-        (ior:VEC_L (match_operand:VEC_L 1 "vlogical_operand" "")
 
9765
-                  (match_operand:VEC_L 2 "vlogical_operand" "")))]
 
9766
-  "VECTOR_MEM_ALTIVEC_OR_VSX_P (<MODE>mode)"
 
9767
-  "")
 
9768
+;; Vector population count
 
9769
+(define_expand "popcount<mode>2"
 
9770
+  [(set (match_operand:VEC_I 0 "register_operand" "")
 
9771
+        (popcount:VEC_I (match_operand:VEC_I 1 "register_operand" "")))]
 
9772
+  "TARGET_P8_VECTOR")
 
9773
 
 
9774
-(define_expand "and<mode>3"
 
9775
-  [(set (match_operand:VEC_L 0 "vlogical_operand" "")
 
9776
-        (and:VEC_L (match_operand:VEC_L 1 "vlogical_operand" "")
 
9777
-                  (match_operand:VEC_L 2 "vlogical_operand" "")))]
 
9778
-  "VECTOR_MEM_ALTIVEC_OR_VSX_P (<MODE>mode)"
 
9779
-  "")
 
9780
-
 
9781
-(define_expand "one_cmpl<mode>2"
 
9782
-  [(set (match_operand:VEC_L 0 "vlogical_operand" "")
 
9783
-        (not:VEC_L (match_operand:VEC_L 1 "vlogical_operand" "")))]
 
9784
-  "VECTOR_MEM_ALTIVEC_OR_VSX_P (<MODE>mode)"
 
9785
-  "")
 
9786
-
 
9787
-(define_expand "nor<mode>3"
 
9788
-  [(set (match_operand:VEC_L 0 "vlogical_operand" "")
 
9789
-        (not:VEC_L (ior:VEC_L (match_operand:VEC_L 1 "vlogical_operand" "")
 
9790
-                             (match_operand:VEC_L 2 "vlogical_operand" ""))))]
 
9791
-  "VECTOR_MEM_ALTIVEC_OR_VSX_P (<MODE>mode)"
 
9792
-  "")
 
9793
-
 
9794
-(define_expand "andc<mode>3"
 
9795
-  [(set (match_operand:VEC_L 0 "vlogical_operand" "")
 
9796
-        (and:VEC_L (not:VEC_L (match_operand:VEC_L 2 "vlogical_operand" ""))
 
9797
-                  (match_operand:VEC_L 1 "vlogical_operand" "")))]
 
9798
-  "VECTOR_MEM_ALTIVEC_OR_VSX_P (<MODE>mode)"
 
9799
-  "")
 
9800
-
 
9801
+
 
9802
 ;; Same size conversions
 
9803
 (define_expand "float<VEC_int><mode>2"
 
9804
   [(set (match_operand:VEC_F 0 "vfloat_operand" "")
 
9805
@@ -889,7 +873,7 @@
 
9806
 {
 
9807
   rtx reg = gen_reg_rtx (V4SFmode);
 
9808
 
 
9809
-  rs6000_expand_interleave (reg, operands[1], operands[1], true);
 
9810
+  rs6000_expand_interleave (reg, operands[1], operands[1], BYTES_BIG_ENDIAN);
 
9811
   emit_insn (gen_vsx_xvcvspdp (operands[0], reg));
 
9812
   DONE;
 
9813
 })
 
9814
@@ -901,7 +885,7 @@
 
9815
 {
 
9816
   rtx reg = gen_reg_rtx (V4SFmode);
 
9817
 
 
9818
-  rs6000_expand_interleave (reg, operands[1], operands[1], false);
 
9819
+  rs6000_expand_interleave (reg, operands[1], operands[1], !BYTES_BIG_ENDIAN);
 
9820
   emit_insn (gen_vsx_xvcvspdp (operands[0], reg));
 
9821
   DONE;
 
9822
 })
 
9823
@@ -913,7 +897,7 @@
 
9824
 {
 
9825
   rtx reg = gen_reg_rtx (V4SImode);
 
9826
 
 
9827
-  rs6000_expand_interleave (reg, operands[1], operands[1], true);
 
9828
+  rs6000_expand_interleave (reg, operands[1], operands[1], BYTES_BIG_ENDIAN);
 
9829
   emit_insn (gen_vsx_xvcvsxwdp (operands[0], reg));
 
9830
   DONE;
 
9831
 })
 
9832
@@ -925,7 +909,7 @@
 
9833
 {
 
9834
   rtx reg = gen_reg_rtx (V4SImode);
 
9835
 
 
9836
-  rs6000_expand_interleave (reg, operands[1], operands[1], false);
 
9837
+  rs6000_expand_interleave (reg, operands[1], operands[1], !BYTES_BIG_ENDIAN);
 
9838
   emit_insn (gen_vsx_xvcvsxwdp (operands[0], reg));
 
9839
   DONE;
 
9840
 })
 
9841
@@ -937,7 +921,7 @@
 
9842
 {
 
9843
   rtx reg = gen_reg_rtx (V4SImode);
 
9844
 
 
9845
-  rs6000_expand_interleave (reg, operands[1], operands[1], true);
 
9846
+  rs6000_expand_interleave (reg, operands[1], operands[1], BYTES_BIG_ENDIAN);
 
9847
   emit_insn (gen_vsx_xvcvuxwdp (operands[0], reg));
 
9848
   DONE;
 
9849
 })
 
9850
@@ -949,7 +933,7 @@
 
9851
 {
 
9852
   rtx reg = gen_reg_rtx (V4SImode);
 
9853
 
 
9854
-  rs6000_expand_interleave (reg, operands[1], operands[1], false);
 
9855
+  rs6000_expand_interleave (reg, operands[1], operands[1], !BYTES_BIG_ENDIAN);
 
9856
   emit_insn (gen_vsx_xvcvuxwdp (operands[0], reg));
 
9857
   DONE;
 
9858
 })
 
9859
@@ -963,8 +947,19 @@
 
9860
    (match_operand:V16QI 3 "vlogical_operand" "")]
 
9861
   "VECTOR_MEM_ALTIVEC_OR_VSX_P (<MODE>mode)"
 
9862
 {
 
9863
-  emit_insn (gen_altivec_vperm_<mode> (operands[0], operands[1], operands[2],
 
9864
-                                      operands[3]));
 
9865
+  if (BYTES_BIG_ENDIAN)
 
9866
+    emit_insn (gen_altivec_vperm_<mode> (operands[0], operands[1],
 
9867
+                                        operands[2], operands[3]));
 
9868
+  else
 
9869
+    {
 
9870
+      /* We have changed lvsr to lvsl, so to complete the transformation
 
9871
+         of vperm for LE, we must swap the inputs.  */
 
9872
+      rtx unspec = gen_rtx_UNSPEC (<MODE>mode,
 
9873
+                                   gen_rtvec (3, operands[2],
 
9874
+                                              operands[1], operands[3]),
 
9875
+                                   UNSPEC_VPERM);
 
9876
+      emit_move_insn (operands[0], unspec);
 
9877
+    }
 
9878
   DONE;
 
9879
 })
 
9880
 
 
9881
@@ -1064,7 +1059,7 @@
 
9882
   [(set (match_operand:VEC_I 0 "vint_operand" "")
 
9883
        (rotate:VEC_I (match_operand:VEC_I 1 "vint_operand" "")
 
9884
                      (match_operand:VEC_I 2 "vint_operand" "")))]
 
9885
-  "TARGET_ALTIVEC"
 
9886
+  "VECTOR_UNIT_ALTIVEC_OR_VSX_P (<MODE>mode)"
 
9887
   "")
 
9888
 
 
9889
 ;; Expanders for arithmetic shift left on each vector element
 
9890
@@ -1072,7 +1067,7 @@
 
9891
   [(set (match_operand:VEC_I 0 "vint_operand" "")
 
9892
        (ashift:VEC_I (match_operand:VEC_I 1 "vint_operand" "")
 
9893
                      (match_operand:VEC_I 2 "vint_operand" "")))]
 
9894
-  "TARGET_ALTIVEC"
 
9895
+  "VECTOR_UNIT_ALTIVEC_OR_VSX_P (<MODE>mode)"
 
9896
   "")
 
9897
 
 
9898
 ;; Expanders for logical shift right on each vector element
 
9899
@@ -1080,7 +1075,7 @@
 
9900
   [(set (match_operand:VEC_I 0 "vint_operand" "")
 
9901
        (lshiftrt:VEC_I (match_operand:VEC_I 1 "vint_operand" "")
 
9902
                        (match_operand:VEC_I 2 "vint_operand" "")))]
 
9903
-  "TARGET_ALTIVEC"
 
9904
+  "VECTOR_UNIT_ALTIVEC_OR_VSX_P (<MODE>mode)"
 
9905
   "")
 
9906
 
 
9907
 ;; Expanders for arithmetic shift right on each vector element
 
9908
@@ -1088,7 +1083,7 @@
 
9909
   [(set (match_operand:VEC_I 0 "vint_operand" "")
 
9910
        (ashiftrt:VEC_I (match_operand:VEC_I 1 "vint_operand" "")
 
9911
                        (match_operand:VEC_I 2 "vint_operand" "")))]
 
9912
-  "TARGET_ALTIVEC"
 
9913
+  "VECTOR_UNIT_ALTIVEC_OR_VSX_P (<MODE>mode)"
 
9914
   "")
 
9915
 
 
9916
 ;; Vector reduction expanders for VSX
 
9917
--- a/src/gcc/config/rs6000/constraints.md
 
9918
+++ b/src/gcc/config/rs6000/constraints.md
 
9919
@@ -52,22 +52,62 @@
 
9920
   "@internal")
 
9921
 
 
9922
 ;; Use w as a prefix to add VSX modes
 
9923
-;; vector double (V2DF)
 
9924
+;; any VSX register
 
9925
+(define_register_constraint "wa" "rs6000_constraints[RS6000_CONSTRAINT_wa]"
 
9926
+  "Any VSX register if the -mvsx option was used or NO_REGS.")
 
9927
+
 
9928
 (define_register_constraint "wd" "rs6000_constraints[RS6000_CONSTRAINT_wd]"
 
9929
-  "@internal")
 
9930
+  "VSX vector register to hold vector double data or NO_REGS.")
 
9931
 
 
9932
-;; vector float (V4SF)
 
9933
 (define_register_constraint "wf" "rs6000_constraints[RS6000_CONSTRAINT_wf]"
 
9934
-  "@internal")
 
9935
+  "VSX vector register to hold vector float data or NO_REGS.")
 
9936
 
 
9937
-;; scalar double (DF)
 
9938
+(define_register_constraint "wg" "rs6000_constraints[RS6000_CONSTRAINT_wg]"
 
9939
+  "If -mmfpgpr was used, a floating point register or NO_REGS.")
 
9940
+
 
9941
+(define_register_constraint "wl" "rs6000_constraints[RS6000_CONSTRAINT_wl]"
 
9942
+  "Floating point register if the LFIWAX instruction is enabled or NO_REGS.")
 
9943
+
 
9944
+(define_register_constraint "wm" "rs6000_constraints[RS6000_CONSTRAINT_wm]"
 
9945
+  "VSX register if direct move instructions are enabled, or NO_REGS.")
 
9946
+
 
9947
+;; NO_REGs register constraint, used to merge mov{sd,sf}, since movsd can use
 
9948
+;; direct move directly, and movsf can't to move between the register sets.
 
9949
+;; There is a mode_attr that resolves to wm for SDmode and wn for SFmode
 
9950
+(define_register_constraint "wn" "NO_REGS" "No register (NO_REGS).")
 
9951
+
 
9952
+(define_register_constraint "wr" "rs6000_constraints[RS6000_CONSTRAINT_wr]"
 
9953
+  "General purpose register if 64-bit instructions are enabled or NO_REGS.")
 
9954
+
 
9955
 (define_register_constraint "ws" "rs6000_constraints[RS6000_CONSTRAINT_ws]"
 
9956
-  "@internal")
 
9957
+  "VSX vector register to hold scalar double values or NO_REGS.")
 
9958
 
 
9959
-;; any VSX register
 
9960
-(define_register_constraint "wa" "rs6000_constraints[RS6000_CONSTRAINT_wa]"
 
9961
-  "@internal")
 
9962
+(define_register_constraint "wt" "rs6000_constraints[RS6000_CONSTRAINT_wt]"
 
9963
+  "VSX vector register to hold 128 bit integer or NO_REGS.")
 
9964
 
 
9965
+(define_register_constraint "wu" "rs6000_constraints[RS6000_CONSTRAINT_wu]"
 
9966
+  "Altivec register to use for float/32-bit int loads/stores  or NO_REGS.")
 
9967
+
 
9968
+(define_register_constraint "wv" "rs6000_constraints[RS6000_CONSTRAINT_wv]"
 
9969
+  "Altivec register to use for double loads/stores  or NO_REGS.")
 
9970
+
 
9971
+(define_register_constraint "ww" "rs6000_constraints[RS6000_CONSTRAINT_ww]"
 
9972
+  "FP or VSX register to perform float operations under -mvsx or NO_REGS.")
 
9973
+
 
9974
+(define_register_constraint "wx" "rs6000_constraints[RS6000_CONSTRAINT_wx]"
 
9975
+  "Floating point register if the STFIWX instruction is enabled or NO_REGS.")
 
9976
+
 
9977
+(define_register_constraint "wy" "rs6000_constraints[RS6000_CONSTRAINT_wy]"
 
9978
+  "VSX vector register to hold scalar float values or NO_REGS.")
 
9979
+
 
9980
+(define_register_constraint "wz" "rs6000_constraints[RS6000_CONSTRAINT_wz]"
 
9981
+  "Floating point register if the LFIWZX instruction is enabled or NO_REGS.")
 
9982
+
 
9983
+;; Lq/stq validates the address for load/store quad
 
9984
+(define_memory_constraint "wQ"
 
9985
+  "Memory operand suitable for the load/store quad instructions"
 
9986
+  (match_operand 0 "quad_memory_operand"))
 
9987
+
 
9988
 ;; Altivec style load/store that ignores the bottom bits of the address
 
9989
 (define_memory_constraint "wZ"
 
9990
   "Indexed or indirect memory operand, ignoring the bottom 4 bits"
 
9991
--- a/src/gcc/config/rs6000/predicates.md
 
9992
+++ b/src/gcc/config/rs6000/predicates.md
 
9993
@@ -124,6 +124,11 @@
 
9994
   (and (match_code "const_int")
 
9995
        (match_test "INTVAL (op) >= -16 && INTVAL (op) <= 15")))
 
9996
 
 
9997
+;; Return 1 if op is a unsigned 3-bit constant integer.
 
9998
+(define_predicate "u3bit_cint_operand"
 
9999
+  (and (match_code "const_int")
 
10000
+       (match_test "INTVAL (op) >= 0 && INTVAL (op) <= 7")))
 
10001
+
 
10002
 ;; Return 1 if op is a unsigned 5-bit constant integer.
 
10003
 (define_predicate "u5bit_cint_operand"
 
10004
   (and (match_code "const_int")
 
10005
@@ -135,6 +140,11 @@
 
10006
   (and (match_code "const_int")
 
10007
        (match_test "INTVAL (op) >= -128 && INTVAL (op) <= 127")))
 
10008
 
 
10009
+;; Return 1 if op is a unsigned 10-bit constant integer.
 
10010
+(define_predicate "u10bit_cint_operand"
 
10011
+  (and (match_code "const_int")
 
10012
+       (match_test "INTVAL (op) >= 0 && INTVAL (op) <= 1023")))
 
10013
+
 
10014
 ;; Return 1 if op is a constant integer that can fit in a D field.
 
10015
 (define_predicate "short_cint_operand"
 
10016
   (and (match_code "const_int")
 
10017
@@ -166,6 +176,11 @@
 
10018
   (and (match_code "const_int")
 
10019
        (match_test "IN_RANGE (INTVAL (op), 2, 3)")))
 
10020
 
 
10021
+;; Match op = 0..15
 
10022
+(define_predicate "const_0_to_15_operand"
 
10023
+  (and (match_code "const_int")
 
10024
+       (match_test "IN_RANGE (INTVAL (op), 0, 15)")))
 
10025
+
 
10026
 ;; Return 1 if op is a register that is not special.
 
10027
 (define_predicate "gpc_reg_operand"
 
10028
   (match_operand 0 "register_operand")
 
10029
@@ -182,9 +197,95 @@
 
10030
   if (REGNO (op) >= ARG_POINTER_REGNUM && !CA_REGNO_P (REGNO (op)))
 
10031
     return 1;
 
10032
 
 
10033
+  if (TARGET_VSX && VSX_REGNO_P (REGNO (op)))
 
10034
+    return 1;
 
10035
+
 
10036
   return INT_REGNO_P (REGNO (op)) || FP_REGNO_P (REGNO (op));
 
10037
 })
 
10038
 
 
10039
+;; Return 1 if op is a general purpose register.  Unlike gpc_reg_operand, don't
 
10040
+;; allow floating point or vector registers.
 
10041
+(define_predicate "int_reg_operand"
 
10042
+  (match_operand 0 "register_operand")
 
10043
+{
 
10044
+  if ((TARGET_E500_DOUBLE || TARGET_SPE) && invalid_e500_subreg (op, mode))
 
10045
+    return 0;
 
10046
+
 
10047
+  if (GET_CODE (op) == SUBREG)
 
10048
+    op = SUBREG_REG (op);
 
10049
+
 
10050
+  if (!REG_P (op))
 
10051
+    return 0;
 
10052
+
 
10053
+  if (REGNO (op) >= FIRST_PSEUDO_REGISTER)
 
10054
+    return 1;
 
10055
+
 
10056
+  return INT_REGNO_P (REGNO (op));
 
10057
+})
 
10058
+
 
10059
+;; Like int_reg_operand, but only return true for base registers
 
10060
+(define_predicate "base_reg_operand"
 
10061
+  (match_operand 0 "int_reg_operand")
 
10062
+{
 
10063
+  if (GET_CODE (op) == SUBREG)
 
10064
+    op = SUBREG_REG (op);
 
10065
+
 
10066
+  if (!REG_P (op))
 
10067
+    return 0;
 
10068
+
 
10069
+  return (REGNO (op) != FIRST_GPR_REGNO);
 
10070
+})
 
10071
+
 
10072
+;; Return 1 if op is a HTM specific SPR register.
 
10073
+(define_predicate "htm_spr_reg_operand"
 
10074
+  (match_operand 0 "register_operand")
 
10075
+{
 
10076
+  if (!TARGET_HTM)
 
10077
+    return 0;
 
10078
+
 
10079
+  if (GET_CODE (op) == SUBREG)
 
10080
+    op = SUBREG_REG (op);
 
10081
+
 
10082
+  if (!REG_P (op))
 
10083
+    return 0;
 
10084
+
 
10085
+  switch (REGNO (op))
 
10086
+    {
 
10087
+      case TFHAR_REGNO:
 
10088
+      case TFIAR_REGNO:
 
10089
+      case TEXASR_REGNO:
 
10090
+       return 1;
 
10091
+      default:
 
10092
+       break;
 
10093
+    }
 
10094
+  
 
10095
+  /* Unknown SPR.  */
 
10096
+  return 0;
 
10097
+})
 
10098
+
 
10099
+;; Return 1 if op is a general purpose register that is an even register
 
10100
+;; which suitable for a load/store quad operation
 
10101
+(define_predicate "quad_int_reg_operand"
 
10102
+  (match_operand 0 "register_operand")
 
10103
+{
 
10104
+  HOST_WIDE_INT r;
 
10105
+
 
10106
+  if (!TARGET_QUAD_MEMORY)
 
10107
+    return 0;
 
10108
+
 
10109
+  if (GET_CODE (op) == SUBREG)
 
10110
+    op = SUBREG_REG (op);
 
10111
+
 
10112
+  if (!REG_P (op))
 
10113
+    return 0;
 
10114
+
 
10115
+  r = REGNO (op);
 
10116
+  if (r >= FIRST_PSEUDO_REGISTER)
 
10117
+    return 1;
 
10118
+
 
10119
+  return (INT_REGNO_P (r) && ((r & 1) == 0));
 
10120
+})
 
10121
+
 
10122
 ;; Return 1 if op is a register that is a condition register field.
 
10123
 (define_predicate "cc_reg_operand"
 
10124
   (match_operand 0 "register_operand")
 
10125
@@ -315,6 +416,11 @@
 
10126
                   && CONST_DOUBLE_HIGH (op) == 0")
 
10127
       (match_operand 0 "gpc_reg_operand"))))
 
10128
 
 
10129
+;; Like reg_or_logical_cint_operand, but allow vsx registers
 
10130
+(define_predicate "vsx_reg_or_cint_operand"
 
10131
+  (ior (match_operand 0 "vsx_register_operand")
 
10132
+       (match_operand 0 "reg_or_logical_cint_operand")))
 
10133
+
 
10134
 ;; Return 1 if operand is a CONST_DOUBLE that can be set in a register
 
10135
 ;; with no more than one instruction per word.
 
10136
 (define_predicate "easy_fp_constant"
 
10137
@@ -333,6 +439,11 @@
 
10138
       && mode != DImode)
 
10139
     return 1;
 
10140
 
 
10141
+  /* The constant 0.0 is easy under VSX.  */
 
10142
+  if ((mode == SFmode || mode == DFmode || mode == SDmode || mode == DDmode)
 
10143
+      && VECTOR_UNIT_VSX_P (DFmode) && op == CONST0_RTX (mode))
 
10144
+    return 1;
 
10145
+
 
10146
   if (DECIMAL_FLOAT_MODE_P (mode))
 
10147
     return 0;
 
10148
 
 
10149
@@ -521,6 +632,54 @@
 
10150
   (and (match_operand 0 "memory_operand")
 
10151
        (match_test "offsettable_nonstrict_memref_p (op)")))
 
10152
 
 
10153
+;; Return 1 if the operand is suitable for load/store quad memory.
 
10154
+(define_predicate "quad_memory_operand"
 
10155
+  (match_code "mem")
 
10156
+{
 
10157
+  rtx addr, op0, op1;
 
10158
+  int ret;
 
10159
+
 
10160
+  if (!TARGET_QUAD_MEMORY)
 
10161
+    ret = 0;
 
10162
+
 
10163
+  else if (!memory_operand (op, mode))
 
10164
+    ret = 0;
 
10165
+
 
10166
+  else if (GET_MODE_SIZE (GET_MODE (op)) != 16)
 
10167
+    ret = 0;
 
10168
+
 
10169
+  else if (MEM_ALIGN (op) < 128)
 
10170
+    ret = 0;
 
10171
+
 
10172
+  else
 
10173
+    {
 
10174
+      addr = XEXP (op, 0);
 
10175
+      if (int_reg_operand (addr, Pmode))
 
10176
+       ret = 1;
 
10177
+
 
10178
+      else if (GET_CODE (addr) != PLUS)
 
10179
+       ret = 0;
 
10180
+
 
10181
+      else
 
10182
+       {
 
10183
+         op0 = XEXP (addr, 0);
 
10184
+         op1 = XEXP (addr, 1);
 
10185
+         ret = (int_reg_operand (op0, Pmode)
 
10186
+                && GET_CODE (op1) == CONST_INT
 
10187
+                && IN_RANGE (INTVAL (op1), -32768, 32767)
 
10188
+                && (INTVAL (op1) & 15) == 0);
 
10189
+       }
 
10190
+    }
 
10191
+
 
10192
+  if (TARGET_DEBUG_ADDR)
 
10193
+    {
 
10194
+      fprintf (stderr, "\nquad_memory_operand, ret = %s\n", ret ? "true" : "false");
 
10195
+      debug_rtx (op);
 
10196
+    }
 
10197
+
 
10198
+  return ret;
 
10199
+})
 
10200
+
 
10201
 ;; Return 1 if the operand is an indexed or indirect memory operand.
 
10202
 (define_predicate "indexed_or_indirect_operand"
 
10203
   (match_code "mem")
 
10204
@@ -535,6 +694,19 @@
 
10205
   return indexed_or_indirect_address (op, mode);
 
10206
 })
 
10207
 
 
10208
+;; Like indexed_or_indirect_operand, but also allow a GPR register if direct
 
10209
+;; moves are supported.
 
10210
+(define_predicate "reg_or_indexed_operand"
 
10211
+  (match_code "mem,reg")
 
10212
+{
 
10213
+  if (MEM_P (op))
 
10214
+    return indexed_or_indirect_operand (op, mode);
 
10215
+  else if (TARGET_DIRECT_MOVE)
 
10216
+    return register_operand (op, mode);
 
10217
+  return
 
10218
+    0;
 
10219
+})
 
10220
+
 
10221
 ;; Return 1 if the operand is an indexed or indirect memory operand with an
 
10222
 ;; AND -16 in it, used to recognize when we need to switch to Altivec loads
 
10223
 ;; to realign loops instead of VSX (altivec silently ignores the bottom bits,
 
10224
@@ -560,6 +732,28 @@
 
10225
                        && REG_P (XEXP (op, 1)))")
 
10226
        (match_operand 0 "address_operand")))
 
10227
 
 
10228
+;; Return 1 if the operand is an index-form address.
 
10229
+(define_special_predicate "indexed_address"
 
10230
+  (match_test "(GET_CODE (op) == PLUS
 
10231
+               && REG_P (XEXP (op, 0))
 
10232
+               && REG_P (XEXP (op, 1)))"))
 
10233
+
 
10234
+;; Return 1 if the operand is a MEM with an update-form address. This may
 
10235
+;; also include update-indexed form.
 
10236
+(define_special_predicate "update_address_mem"
 
10237
+  (match_test "(MEM_P (op)
 
10238
+               && (GET_CODE (XEXP (op, 0)) == PRE_INC
 
10239
+                   || GET_CODE (XEXP (op, 0)) == PRE_DEC
 
10240
+                   || GET_CODE (XEXP (op, 0)) == PRE_MODIFY))"))
 
10241
+
 
10242
+;; Return 1 if the operand is a MEM with an update-indexed-form address. Note
 
10243
+;; that PRE_INC/PRE_DEC will always be non-indexed (i.e. non X-form) since the
 
10244
+;; increment is based on the mode size and will therefor always be a const.
 
10245
+(define_special_predicate "update_indexed_address_mem"
 
10246
+  (match_test "(MEM_P (op)
 
10247
+               && GET_CODE (XEXP (op, 0)) == PRE_MODIFY
 
10248
+               && indexed_address (XEXP (XEXP (op, 0), 1), mode))"))
 
10249
+
 
10250
 ;; Used for the destination of the fix_truncdfsi2 expander.
 
10251
 ;; If stfiwx will be used, the result goes to memory; otherwise,
 
10252
 ;; we're going to emit a store and a load of a subreg, so the dest is a
 
10253
@@ -883,7 +1077,8 @@
 
10254
   (and (match_code "symbol_ref")
 
10255
        (match_test "(DEFAULT_ABI != ABI_AIX || SYMBOL_REF_FUNCTION_P (op))
 
10256
                    && ((SYMBOL_REF_LOCAL_P (op)
 
10257
-                        && (DEFAULT_ABI != ABI_AIX
 
10258
+                        && ((DEFAULT_ABI != ABI_AIX
 
10259
+                             && DEFAULT_ABI != ABI_ELFv2)
 
10260
                             || !SYMBOL_REF_EXTERNAL_P (op)))
 
10261
                        || (op == XEXP (DECL_RTL (current_function_decl),
 
10262
                                                  0)))")))
 
10263
@@ -1364,6 +1559,26 @@
 
10264
   return 1;
 
10265
 })
 
10266
 
 
10267
+;; Return 1 if OP is valid for crsave insn, known to be a PARALLEL.
 
10268
+(define_predicate "crsave_operation"
 
10269
+  (match_code "parallel")
 
10270
+{
 
10271
+  int count = XVECLEN (op, 0);
 
10272
+  int i;
 
10273
+
 
10274
+  for (i = 1; i < count; i++)
 
10275
+    {
 
10276
+      rtx exp = XVECEXP (op, 0, i);
 
10277
+
 
10278
+      if (GET_CODE (exp) != USE
 
10279
+         || GET_CODE (XEXP (exp, 0)) != REG
 
10280
+         || GET_MODE (XEXP (exp, 0)) != CCmode
 
10281
+         || ! CR_REGNO_P (REGNO (XEXP (exp, 0))))
 
10282
+       return 0;
 
10283
+    }
 
10284
+  return 1;
 
10285
+})
 
10286
+
 
10287
 ;; Return 1 if OP is valid for lmw insn, known to be a PARALLEL.
 
10288
 (define_predicate "lmw_operation"
 
10289
   (match_code "parallel")
 
10290
@@ -1534,3 +1749,99 @@
 
10291
 
 
10292
   return GET_CODE (op) == UNSPEC && XINT (op, 1) == UNSPEC_TOCREL;
 
10293
 })
 
10294
+
 
10295
+;; Match the first insn (addis) in fusing the combination of addis and loads to
 
10296
+;; GPR registers on power8.
 
10297
+(define_predicate "fusion_gpr_addis"
 
10298
+  (match_code "const_int,high,plus")
 
10299
+{
 
10300
+  HOST_WIDE_INT value;
 
10301
+  rtx int_const;
 
10302
+
 
10303
+  if (GET_CODE (op) == HIGH)
 
10304
+    return 1;
 
10305
+
 
10306
+  if (CONST_INT_P (op))
 
10307
+    int_const = op;
 
10308
+
 
10309
+  else if (GET_CODE (op) == PLUS
 
10310
+          && base_reg_operand (XEXP (op, 0), Pmode)
 
10311
+          && CONST_INT_P (XEXP (op, 1)))
 
10312
+    int_const = XEXP (op, 1);
 
10313
+
 
10314
+  else
 
10315
+    return 0;
 
10316
+
 
10317
+  /* Power8 currently will only do the fusion if the top 11 bits of the addis
 
10318
+     value are all 1's or 0's.  */
 
10319
+  value = INTVAL (int_const);
 
10320
+  if ((value & (HOST_WIDE_INT)0xffff) != 0)
 
10321
+    return 0;
 
10322
+
 
10323
+  if ((value & (HOST_WIDE_INT)0xffff0000) == 0)
 
10324
+    return 0;
 
10325
+
 
10326
+  return (IN_RANGE (value >> 16, -32, 31));
 
10327
+})
 
10328
+
 
10329
+;; Match the second insn (lbz, lhz, lwz, ld) in fusing the combination of addis
 
10330
+;; and loads to GPR registers on power8.
 
10331
+(define_predicate "fusion_gpr_mem_load"
 
10332
+  (match_code "mem,sign_extend,zero_extend")
 
10333
+{
 
10334
+  rtx addr;
 
10335
+
 
10336
+  /* Handle sign/zero extend.  */
 
10337
+  if (GET_CODE (op) == ZERO_EXTEND
 
10338
+      || (TARGET_P8_FUSION_SIGN && GET_CODE (op) == SIGN_EXTEND))
 
10339
+    {
 
10340
+      op = XEXP (op, 0);
 
10341
+      mode = GET_MODE (op);
 
10342
+    }
 
10343
+
 
10344
+  if (!MEM_P (op))
 
10345
+    return 0;
 
10346
+
 
10347
+  switch (mode)
 
10348
+    {
 
10349
+    case QImode:
 
10350
+    case HImode:
 
10351
+    case SImode:
 
10352
+      break;
 
10353
+
 
10354
+    case DImode:
 
10355
+      if (!TARGET_POWERPC64)
 
10356
+       return 0;
 
10357
+      break;
 
10358
+
 
10359
+    default:
 
10360
+      return 0;
 
10361
+    }
 
10362
+
 
10363
+  addr = XEXP (op, 0);
 
10364
+  if (GET_CODE (addr) == PLUS)
 
10365
+    {
 
10366
+      rtx base = XEXP (addr, 0);
 
10367
+      rtx offset = XEXP (addr, 1);
 
10368
+
 
10369
+      return (base_reg_operand (base, GET_MODE (base))
 
10370
+             && satisfies_constraint_I (offset));
 
10371
+    }
 
10372
+
 
10373
+  else if (GET_CODE (addr) == LO_SUM)
 
10374
+    {
 
10375
+      rtx base = XEXP (addr, 0);
 
10376
+      rtx offset = XEXP (addr, 1);
 
10377
+
 
10378
+      if (!base_reg_operand (base, GET_MODE (base)))
 
10379
+       return 0;
 
10380
+
 
10381
+      else if (TARGET_XCOFF || (TARGET_ELF && TARGET_POWERPC64))
 
10382
+       return small_toc_ref (offset, GET_MODE (offset));
 
10383
+
 
10384
+      else if (TARGET_ELF && !TARGET_POWERPC64)
 
10385
+       return CONSTANT_P (offset);
 
10386
+    }
 
10387
+
 
10388
+  return 0;
 
10389
+})
 
10390
--- a/src/gcc/config/rs6000/ppc-asm.h
 
10391
+++ b/src/gcc/config/rs6000/ppc-asm.h
 
10392
@@ -256,7 +256,30 @@
 
10393
  * the real function with one or two leading periods respectively.
 
10394
  */
 
10395
 
 
10396
-#if defined (__powerpc64__)
 
10397
+#if defined(__powerpc64__) && _CALL_ELF == 2
 
10398
+
 
10399
+/* Defining "toc" above breaks @toc in assembler code.  */
 
10400
+#undef toc
 
10401
+
 
10402
+#define FUNC_NAME(name) GLUE(__USER_LABEL_PREFIX__,name)
 
10403
+#define JUMP_TARGET(name) FUNC_NAME(name)
 
10404
+#define FUNC_START(name) \
 
10405
+       .type FUNC_NAME(name),@function; \
 
10406
+       .globl FUNC_NAME(name); \
 
10407
+FUNC_NAME(name): \
 
10408
+0:     addis 2,12,(.TOC.-0b)@ha; \
 
10409
+       addi 2,2,(.TOC.-0b)@l; \
 
10410
+       .localentry FUNC_NAME(name),.-FUNC_NAME(name)
 
10411
+
 
10412
+#define HIDDEN_FUNC(name) \
 
10413
+  FUNC_START(name) \
 
10414
+  .hidden FUNC_NAME(name);
 
10415
+
 
10416
+#define FUNC_END(name) \
 
10417
+       .size FUNC_NAME(name),.-FUNC_NAME(name)
 
10418
+
 
10419
+#elif defined (__powerpc64__)
 
10420
+
 
10421
 #define FUNC_NAME(name) GLUE(.,name)
 
10422
 #define JUMP_TARGET(name) FUNC_NAME(name)
 
10423
 #define FUNC_START(name) \
 
10424
--- a/src/gcc/config/rs6000/htm.md
 
10425
+++ b/src/gcc/config/rs6000/htm.md
 
10426
@@ -0,0 +1,366 @@
 
10427
+;; Hardware Transactional Memory (HTM) patterns.
 
10428
+;; Copyright (C) 2013 Free Software Foundation, Inc.
 
10429
+;; Contributed by Peter Bergner <bergner@vnet.ibm.com>.
 
10430
+
 
10431
+;; This file is part of GCC.
 
10432
+
 
10433
+;; GCC is free software; you can redistribute it and/or modify it
 
10434
+;; under the terms of the GNU General Public License as published
 
10435
+;; by the Free Software Foundation; either version 3, or (at your
 
10436
+;; option) any later version.
 
10437
+
 
10438
+;; GCC is distributed in the hope that it will be useful, but WITHOUT
 
10439
+;; ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
 
10440
+;; or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public
 
10441
+;; License for more details.
 
10442
+
 
10443
+;; You should have received a copy of the GNU General Public License
 
10444
+;; along with GCC; see the file COPYING3.  If not see
 
10445
+;; <http://www.gnu.org/licenses/>.
 
10446
+
 
10447
+(define_constants
 
10448
+  [(TFHAR_SPR          128)
 
10449
+   (TFIAR_SPR          129)
 
10450
+   (TEXASR_SPR         130)
 
10451
+   (TEXASRU_SPR                131)
 
10452
+   (MAX_HTM_OPERANDS   4)
 
10453
+  ])
 
10454
+
 
10455
+;;
 
10456
+;; UNSPEC_VOLATILE usage
 
10457
+;;
 
10458
+
 
10459
+(define_c_enum "unspecv"
 
10460
+  [UNSPECV_HTM_TABORT
 
10461
+   UNSPECV_HTM_TABORTDC
 
10462
+   UNSPECV_HTM_TABORTDCI
 
10463
+   UNSPECV_HTM_TABORTWC
 
10464
+   UNSPECV_HTM_TABORTWCI
 
10465
+   UNSPECV_HTM_TBEGIN
 
10466
+   UNSPECV_HTM_TCHECK
 
10467
+   UNSPECV_HTM_TEND
 
10468
+   UNSPECV_HTM_TRECHKPT
 
10469
+   UNSPECV_HTM_TRECLAIM
 
10470
+   UNSPECV_HTM_TSR
 
10471
+   UNSPECV_HTM_MFSPR
 
10472
+   UNSPECV_HTM_MTSPR
 
10473
+  ])
 
10474
+
 
10475
+
 
10476
+(define_expand "tabort"
 
10477
+  [(set (match_dup 2)
 
10478
+       (unspec_volatile:CC [(match_operand:SI 1 "int_reg_operand" "")]
 
10479
+                           UNSPECV_HTM_TABORT))
 
10480
+   (set (match_dup 3)
 
10481
+       (eq:SI (match_dup 2)
 
10482
+              (const_int 0)))
 
10483
+   (set (match_operand:SI 0 "int_reg_operand" "")
 
10484
+       (minus:SI (const_int 1) (match_dup 3)))]
 
10485
+  "TARGET_HTM"
 
10486
+{
 
10487
+  operands[2] = gen_rtx_REG (CCmode, CR0_REGNO);
 
10488
+  operands[3] = gen_reg_rtx (SImode);
 
10489
+})
 
10490
+
 
10491
+(define_insn "*tabort_internal"
 
10492
+  [(set (match_operand:CC 1 "cc_reg_operand" "=x")
 
10493
+       (unspec_volatile:CC [(match_operand:SI 0 "int_reg_operand" "r")]
 
10494
+                           UNSPECV_HTM_TABORT))]
 
10495
+  "TARGET_HTM"
 
10496
+  "tabort. %0"
 
10497
+  [(set_attr "type" "htm")
 
10498
+   (set_attr "length" "4")])
 
10499
+
 
10500
+(define_expand "tabortdc"
 
10501
+  [(set (match_dup 4)
 
10502
+       (unspec_volatile:CC [(match_operand 1 "u5bit_cint_operand" "n")
 
10503
+                            (match_operand:SI 2 "gpc_reg_operand" "r")
 
10504
+                            (match_operand:SI 3 "gpc_reg_operand" "r")]
 
10505
+                           UNSPECV_HTM_TABORTDC))
 
10506
+   (set (match_dup 5)
 
10507
+       (eq:SI (match_dup 4)
 
10508
+              (const_int 0)))
 
10509
+   (set (match_operand:SI 0 "int_reg_operand" "")
 
10510
+       (minus:SI (const_int 1) (match_dup 5)))]
 
10511
+  "TARGET_HTM"
 
10512
+{
 
10513
+  operands[4] = gen_rtx_REG (CCmode, CR0_REGNO);
 
10514
+  operands[5] = gen_reg_rtx (SImode);
 
10515
+})
 
10516
+
 
10517
+(define_insn "*tabortdc_internal"
 
10518
+  [(set (match_operand:CC 3 "cc_reg_operand" "=x")
 
10519
+       (unspec_volatile:CC [(match_operand 0 "u5bit_cint_operand" "n")
 
10520
+                            (match_operand:SI 1 "gpc_reg_operand" "r")
 
10521
+                            (match_operand:SI 2 "gpc_reg_operand" "r")]
 
10522
+                           UNSPECV_HTM_TABORTDC))]
 
10523
+  "TARGET_HTM"
 
10524
+  "tabortdc. %0,%1,%2"
 
10525
+  [(set_attr "type" "htm")
 
10526
+   (set_attr "length" "4")])
 
10527
+
 
10528
+(define_expand "tabortdci"
 
10529
+  [(set (match_dup 4)
 
10530
+       (unspec_volatile:CC [(match_operand 1 "u5bit_cint_operand" "n")
 
10531
+                            (match_operand:SI 2 "gpc_reg_operand" "r")
 
10532
+                            (match_operand 3 "s5bit_cint_operand" "n")]
 
10533
+                           UNSPECV_HTM_TABORTDCI))
 
10534
+   (set (match_dup 5)
 
10535
+       (eq:SI (match_dup 4)
 
10536
+              (const_int 0)))
 
10537
+   (set (match_operand:SI 0 "int_reg_operand" "")
 
10538
+       (minus:SI (const_int 1) (match_dup 5)))]
 
10539
+  "TARGET_HTM"
 
10540
+{
 
10541
+  operands[4] = gen_rtx_REG (CCmode, CR0_REGNO);
 
10542
+  operands[5] = gen_reg_rtx (SImode);
 
10543
+})
 
10544
+
 
10545
+(define_insn "*tabortdci_internal"
 
10546
+  [(set (match_operand:CC 3 "cc_reg_operand" "=x")
 
10547
+       (unspec_volatile:CC [(match_operand 0 "u5bit_cint_operand" "n")
 
10548
+                            (match_operand:SI 1 "gpc_reg_operand" "r")
 
10549
+                            (match_operand 2 "s5bit_cint_operand" "n")]
 
10550
+                           UNSPECV_HTM_TABORTDCI))]
 
10551
+  "TARGET_HTM"
 
10552
+  "tabortdci. %0,%1,%2"
 
10553
+  [(set_attr "type" "htm")
 
10554
+   (set_attr "length" "4")])
 
10555
+
 
10556
+(define_expand "tabortwc"
 
10557
+  [(set (match_dup 4)
 
10558
+       (unspec_volatile:CC [(match_operand 1 "u5bit_cint_operand" "n")
 
10559
+                            (match_operand:SI 2 "gpc_reg_operand" "r")
 
10560
+                            (match_operand:SI 3 "gpc_reg_operand" "r")]
 
10561
+                           UNSPECV_HTM_TABORTWC))
 
10562
+   (set (match_dup 5)
 
10563
+       (eq:SI (match_dup 4)
 
10564
+              (const_int 0)))
 
10565
+   (set (match_operand:SI 0 "int_reg_operand" "")
 
10566
+       (minus:SI (const_int 1) (match_dup 5)))]
 
10567
+  "TARGET_HTM"
 
10568
+{
 
10569
+  operands[4] = gen_rtx_REG (CCmode, CR0_REGNO);
 
10570
+  operands[5] = gen_reg_rtx (SImode);
 
10571
+})
 
10572
+
 
10573
+(define_insn "*tabortwc_internal"
 
10574
+  [(set (match_operand:CC 3 "cc_reg_operand" "=x")
 
10575
+       (unspec_volatile:CC [(match_operand 0 "u5bit_cint_operand" "n")
 
10576
+                            (match_operand:SI 1 "gpc_reg_operand" "r")
 
10577
+                            (match_operand:SI 2 "gpc_reg_operand" "r")]
 
10578
+                           UNSPECV_HTM_TABORTWC))]
 
10579
+  "TARGET_HTM"
 
10580
+  "tabortwc. %0,%1,%2"
 
10581
+  [(set_attr "type" "htm")
 
10582
+   (set_attr "length" "4")])
 
10583
+
 
10584
+(define_expand "tabortwci"
 
10585
+  [(set (match_dup 4)
 
10586
+       (unspec_volatile:CC [(match_operand 1 "u5bit_cint_operand" "n")
 
10587
+                            (match_operand:SI 2 "gpc_reg_operand" "r")
 
10588
+                            (match_operand 3 "s5bit_cint_operand" "n")]
 
10589
+                           UNSPECV_HTM_TABORTWCI))
 
10590
+   (set (match_dup 5)
 
10591
+       (eq:SI (match_dup 4)
 
10592
+              (const_int 0)))
 
10593
+   (set (match_operand:SI 0 "int_reg_operand" "")
 
10594
+       (minus:SI (const_int 1) (match_dup 5)))]
 
10595
+  "TARGET_HTM"
 
10596
+{
 
10597
+  operands[4] = gen_rtx_REG (CCmode, CR0_REGNO);
 
10598
+  operands[5] = gen_reg_rtx (SImode);
 
10599
+})
 
10600
+
 
10601
+(define_expand "ttest"
 
10602
+  [(set (match_dup 1)
 
10603
+       (unspec_volatile:CC [(const_int 0)
 
10604
+                            (reg:SI 0)
 
10605
+                            (const_int 0)]
 
10606
+                           UNSPECV_HTM_TABORTWCI))
 
10607
+   (set (subreg:CC (match_dup 2) 0) (match_dup 1))
 
10608
+   (set (match_dup 3) (lshiftrt:SI (match_dup 2) (const_int 24)))
 
10609
+   (parallel [(set (match_operand:SI 0 "int_reg_operand" "")
 
10610
+                  (and:SI (match_dup 3) (const_int 15)))
 
10611
+              (clobber (scratch:CC))])]
 
10612
+  "TARGET_HTM"
 
10613
+{
 
10614
+  operands[1] = gen_rtx_REG (CCmode, CR0_REGNO);
 
10615
+  operands[2] = gen_reg_rtx (SImode);
 
10616
+  operands[3] = gen_reg_rtx (SImode);
 
10617
+})
 
10618
+
 
10619
+(define_insn "*tabortwci_internal"
 
10620
+  [(set (match_operand:CC 3 "cc_reg_operand" "=x")
 
10621
+       (unspec_volatile:CC [(match_operand 0 "u5bit_cint_operand" "n")
 
10622
+                            (match_operand:SI 1 "gpc_reg_operand" "r")
 
10623
+                            (match_operand 2 "s5bit_cint_operand" "n")]
 
10624
+                           UNSPECV_HTM_TABORTWCI))]
 
10625
+  "TARGET_HTM"
 
10626
+  "tabortwci. %0,%1,%2"
 
10627
+  [(set_attr "type" "htm")
 
10628
+   (set_attr "length" "4")])
 
10629
+
 
10630
+(define_expand "tbegin"
 
10631
+  [(set (match_dup 2)
 
10632
+       (unspec_volatile:CC [(match_operand 1 "const_0_to_1_operand" "n")]
 
10633
+                           UNSPECV_HTM_TBEGIN))
 
10634
+   (set (match_dup 3)
 
10635
+       (eq:SI (match_dup 2)
 
10636
+              (const_int 0)))
 
10637
+   (set (match_operand:SI 0 "int_reg_operand" "")
 
10638
+       (minus:SI (const_int 1) (match_dup 3)))]
 
10639
+  "TARGET_HTM"
 
10640
+{
 
10641
+  operands[2] = gen_rtx_REG (CCmode, CR0_REGNO);
 
10642
+  operands[3] = gen_reg_rtx (SImode);
 
10643
+})
 
10644
+
 
10645
+(define_insn "*tbegin_internal"
 
10646
+  [(set (match_operand:CC 1 "cc_reg_operand" "=x")
 
10647
+       (unspec_volatile:CC [(match_operand 0 "const_0_to_1_operand" "n")]
 
10648
+                           UNSPECV_HTM_TBEGIN))]
 
10649
+  "TARGET_HTM"
 
10650
+  "tbegin. %0"
 
10651
+  [(set_attr "type" "htm")
 
10652
+   (set_attr "length" "4")])
 
10653
+
 
10654
+(define_expand "tcheck"
 
10655
+  [(set (match_dup 2)
 
10656
+       (unspec_volatile:CC [(match_operand 1 "u3bit_cint_operand" "n")]
 
10657
+                           UNSPECV_HTM_TCHECK))
 
10658
+   (set (match_dup 3)
 
10659
+       (eq:SI (match_dup 2)
 
10660
+              (const_int 0)))
 
10661
+   (set (match_operand:SI 0 "int_reg_operand" "")
 
10662
+       (minus:SI (const_int 1) (match_dup 3)))]
 
10663
+  "TARGET_HTM"
 
10664
+{
 
10665
+  operands[2] = gen_rtx_REG (CCmode, CR0_REGNO);
 
10666
+  operands[3] = gen_reg_rtx (SImode);
 
10667
+})
 
10668
+
 
10669
+(define_insn "*tcheck_internal"
 
10670
+  [(set (match_operand:CC 1 "cc_reg_operand" "=x")
 
10671
+       (unspec_volatile:CC [(match_operand 0 "u3bit_cint_operand" "n")]
 
10672
+                           UNSPECV_HTM_TCHECK))]
 
10673
+  "TARGET_HTM"
 
10674
+  "tcheck. %0"
 
10675
+  [(set_attr "type" "htm")
 
10676
+   (set_attr "length" "4")])
 
10677
+
 
10678
+(define_expand "tend"
 
10679
+  [(set (match_dup 2)
 
10680
+       (unspec_volatile:CC [(match_operand 1 "const_0_to_1_operand" "n")]
 
10681
+                           UNSPECV_HTM_TEND))
 
10682
+   (set (match_dup 3)
 
10683
+       (eq:SI (match_dup 2)
 
10684
+              (const_int 0)))
 
10685
+   (set (match_operand:SI 0 "int_reg_operand" "")
 
10686
+       (minus:SI (const_int 1) (match_dup 3)))]
 
10687
+  "TARGET_HTM"
 
10688
+{
 
10689
+  operands[2] = gen_rtx_REG (CCmode, CR0_REGNO);
 
10690
+  operands[3] = gen_reg_rtx (SImode);
 
10691
+})
 
10692
+
 
10693
+(define_insn "*tend_internal"
 
10694
+  [(set (match_operand:CC 1 "cc_reg_operand" "=x")
 
10695
+       (unspec_volatile:CC [(match_operand 0 "const_0_to_1_operand" "n")]
 
10696
+                           UNSPECV_HTM_TEND))]
 
10697
+  "TARGET_HTM"
 
10698
+  "tend. %0"
 
10699
+  [(set_attr "type" "htm")
 
10700
+   (set_attr "length" "4")])
 
10701
+
 
10702
+(define_expand "trechkpt"
 
10703
+  [(set (match_dup 1)
 
10704
+       (unspec_volatile:CC [(const_int 0)]
 
10705
+                           UNSPECV_HTM_TRECHKPT))
 
10706
+   (set (match_dup 2)
 
10707
+       (eq:SI (match_dup 1)
 
10708
+              (const_int 0)))
 
10709
+   (set (match_operand:SI 0 "int_reg_operand" "")
 
10710
+       (minus:SI (const_int 1) (match_dup 2)))]
 
10711
+  "TARGET_HTM"
 
10712
+{
 
10713
+  operands[1] = gen_rtx_REG (CCmode, CR0_REGNO);
 
10714
+  operands[2] = gen_reg_rtx (SImode);
 
10715
+})
 
10716
+
 
10717
+(define_insn "*trechkpt_internal"
 
10718
+  [(set (match_operand:CC 0 "cc_reg_operand" "=x")
 
10719
+       (unspec_volatile:CC [(const_int 0)]
 
10720
+                           UNSPECV_HTM_TRECHKPT))]
 
10721
+  "TARGET_HTM"
 
10722
+  "trechkpt."
 
10723
+  [(set_attr "type" "htm")
 
10724
+   (set_attr "length" "4")])
 
10725
+
 
10726
+(define_expand "treclaim"
 
10727
+  [(set (match_dup 2)
 
10728
+       (unspec_volatile:CC [(match_operand:SI 1 "gpc_reg_operand" "r")]
 
10729
+                           UNSPECV_HTM_TRECLAIM))
 
10730
+   (set (match_dup 3)
 
10731
+       (eq:SI (match_dup 2)
 
10732
+              (const_int 0)))
 
10733
+   (set (match_operand:SI 0 "int_reg_operand" "")
 
10734
+       (minus:SI (const_int 1) (match_dup 3)))]
 
10735
+  "TARGET_HTM"
 
10736
+{
 
10737
+  operands[2] = gen_rtx_REG (CCmode, CR0_REGNO);
 
10738
+  operands[3] = gen_reg_rtx (SImode);
 
10739
+})
 
10740
+
 
10741
+(define_insn "*treclaim_internal"
 
10742
+  [(set (match_operand:CC 1 "cc_reg_operand" "=x")
 
10743
+       (unspec_volatile:CC [(match_operand:SI 0 "gpc_reg_operand" "r")]
 
10744
+                           UNSPECV_HTM_TRECLAIM))]
 
10745
+  "TARGET_HTM"
 
10746
+  "treclaim. %0"
 
10747
+  [(set_attr "type" "htm")
 
10748
+   (set_attr "length" "4")])
 
10749
+
 
10750
+(define_expand "tsr"
 
10751
+  [(set (match_dup 2)
 
10752
+       (unspec_volatile:CC [(match_operand 1 "const_0_to_1_operand" "n")]
 
10753
+                           UNSPECV_HTM_TSR))
 
10754
+   (set (match_dup 3)
 
10755
+       (eq:SI (match_dup 2)
 
10756
+              (const_int 0)))
 
10757
+   (set (match_operand:SI 0 "int_reg_operand" "")
 
10758
+       (minus:SI (const_int 1) (match_dup 3)))]
 
10759
+  "TARGET_HTM"
 
10760
+{
 
10761
+  operands[2] = gen_rtx_REG (CCmode, CR0_REGNO);
 
10762
+  operands[3] = gen_reg_rtx (SImode);
 
10763
+})
 
10764
+
 
10765
+(define_insn "*tsr_internal"
 
10766
+  [(set (match_operand:CC 1 "cc_reg_operand" "=x")
 
10767
+       (unspec_volatile:CC [(match_operand 0 "const_0_to_1_operand" "n")]
 
10768
+                           UNSPECV_HTM_TSR))]
 
10769
+  "TARGET_HTM"
 
10770
+  "tsr. %0"
 
10771
+  [(set_attr "type" "htm")
 
10772
+   (set_attr "length" "4")])
 
10773
+
 
10774
+(define_insn "htm_mfspr_<mode>"
 
10775
+  [(set (match_operand:P 0 "gpc_reg_operand" "=r")
 
10776
+        (unspec_volatile:P [(match_operand 1 "u10bit_cint_operand" "n")
 
10777
+                           (match_operand:P 2 "htm_spr_reg_operand" "")]
 
10778
+                          UNSPECV_HTM_MFSPR))]
 
10779
+  "TARGET_HTM"
 
10780
+  "mfspr %0,%1";
 
10781
+  [(set_attr "type" "htm")
 
10782
+   (set_attr "length" "4")])
 
10783
+
 
10784
+(define_insn "htm_mtspr_<mode>"
 
10785
+  [(set (match_operand:P 2 "htm_spr_reg_operand" "")
 
10786
+        (unspec_volatile:P [(match_operand:P 0 "gpc_reg_operand" "r")
 
10787
+                           (match_operand 1 "u10bit_cint_operand" "n")]
 
10788
+                           UNSPECV_HTM_MTSPR))]
 
10789
+  "TARGET_HTM"
 
10790
+  "mtspr %1,%0";
 
10791
+  [(set_attr "type" "htm")
 
10792
+   (set_attr "length" "4")])
 
10793
--- a/src/gcc/config/rs6000/rs6000-modes.def
 
10794
+++ b/src/gcc/config/rs6000/rs6000-modes.def
 
10795
@@ -41,3 +41,8 @@
 
10796
 VECTOR_MODES (FLOAT, 8);      /*             V4HF V2SF */
 
10797
 VECTOR_MODES (FLOAT, 16);     /*       V8HF  V4SF V2DF */
 
10798
 VECTOR_MODES (FLOAT, 32);     /*       V16HF V8SF V4DF */
 
10799
+
 
10800
+/* Replacement for TImode that only is allowed in GPRs.  We also use PTImode
 
10801
+   for quad memory atomic operations to force getting an even/odd register
 
10802
+   combination.  */
 
10803
+PARTIAL_INT_MODE (TI);
 
10804
--- a/src/gcc/config/rs6000/rs6000-cpus.def
 
10805
+++ b/src/gcc/config/rs6000/rs6000-cpus.def
 
10806
@@ -28,7 +28,7 @@
 
10807
      ALTIVEC, since in general it isn't a win on power6.  In ISA 2.04, fsel,
 
10808
      fre, fsqrt, etc. were no longer documented as optional.  Group masks by
 
10809
      server and embedded. */
 
10810
-#define ISA_2_5_MASKS_EMBEDDED (ISA_2_2_MASKS                          \
 
10811
+#define ISA_2_5_MASKS_EMBEDDED (ISA_2_4_MASKS                          \
 
10812
                                 | OPTION_MASK_CMPB                     \
 
10813
                                 | OPTION_MASK_RECIP_PRECISION          \
 
10814
                                 | OPTION_MASK_PPC_GFXOPT               \
 
10815
@@ -38,12 +38,23 @@
 
10816
 
 
10817
   /* For ISA 2.06, don't add ISEL, since in general it isn't a win, but
 
10818
      altivec is a win so enable it.  */
 
10819
+  /* OPTION_MASK_VSX_TIMODE should be set, but disable it for now until
 
10820
+     PR 58587 is fixed.  */
 
10821
 #define ISA_2_6_MASKS_EMBEDDED (ISA_2_5_MASKS_EMBEDDED | OPTION_MASK_POPCNTD)
 
10822
 #define ISA_2_6_MASKS_SERVER   (ISA_2_5_MASKS_SERVER                   \
 
10823
                                 | OPTION_MASK_POPCNTD                  \
 
10824
                                 | OPTION_MASK_ALTIVEC                  \
 
10825
                                 | OPTION_MASK_VSX)
 
10826
 
 
10827
+/* For now, don't provide an embedded version of ISA 2.07.  */
 
10828
+#define ISA_2_7_MASKS_SERVER   (ISA_2_6_MASKS_SERVER                   \
 
10829
+                                | OPTION_MASK_P8_FUSION                \
 
10830
+                                | OPTION_MASK_P8_VECTOR                \
 
10831
+                                | OPTION_MASK_CRYPTO                   \
 
10832
+                                | OPTION_MASK_DIRECT_MOVE              \
 
10833
+                                | OPTION_MASK_HTM                      \
 
10834
+                                | OPTION_MASK_QUAD_MEMORY)
 
10835
+
 
10836
 #define POWERPC_7400_MASK      (OPTION_MASK_PPC_GFXOPT | OPTION_MASK_ALTIVEC)
 
10837
 
 
10838
 /* Deal with ports that do not have -mstrict-align.  */
 
10839
@@ -60,23 +71,30 @@
 
10840
 /* Mask of all options to set the default isa flags based on -mcpu=<xxx>.  */
 
10841
 #define POWERPC_MASKS          (OPTION_MASK_ALTIVEC                    \
 
10842
                                 | OPTION_MASK_CMPB                     \
 
10843
+                                | OPTION_MASK_CRYPTO                   \
 
10844
                                 | OPTION_MASK_DFP                      \
 
10845
+                                | OPTION_MASK_DIRECT_MOVE              \
 
10846
                                 | OPTION_MASK_DLMZB                    \
 
10847
                                 | OPTION_MASK_FPRND                    \
 
10848
+                                | OPTION_MASK_HTM                      \
 
10849
                                 | OPTION_MASK_ISEL                     \
 
10850
                                 | OPTION_MASK_MFCRF                    \
 
10851
                                 | OPTION_MASK_MFPGPR                   \
 
10852
                                 | OPTION_MASK_MULHW                    \
 
10853
                                 | OPTION_MASK_NO_UPDATE                \
 
10854
+                                | OPTION_MASK_P8_FUSION                \
 
10855
+                                | OPTION_MASK_P8_VECTOR                \
 
10856
                                 | OPTION_MASK_POPCNTB                  \
 
10857
                                 | OPTION_MASK_POPCNTD                  \
 
10858
                                 | OPTION_MASK_POWERPC64                \
 
10859
                                 | OPTION_MASK_PPC_GFXOPT               \
 
10860
                                 | OPTION_MASK_PPC_GPOPT                \
 
10861
+                                | OPTION_MASK_QUAD_MEMORY              \
 
10862
                                 | OPTION_MASK_RECIP_PRECISION          \
 
10863
                                 | OPTION_MASK_SOFT_FLOAT               \
 
10864
                                 | OPTION_MASK_STRICT_ALIGN_OPTIONAL    \
 
10865
-                                | OPTION_MASK_VSX)
 
10866
+                                | OPTION_MASK_VSX                      \
 
10867
+                                | OPTION_MASK_VSX_TIMODE)
 
10868
 
 
10869
 #endif
 
10870
 
 
10871
@@ -166,10 +184,7 @@
 
10872
            POWERPC_7400_MASK | MASK_POWERPC64 | MASK_PPC_GPOPT | MASK_MFCRF
 
10873
            | MASK_POPCNTB | MASK_FPRND | MASK_CMPB | MASK_DFP | MASK_POPCNTD
 
10874
            | MASK_VSX | MASK_RECIP_PRECISION)
 
10875
-RS6000_CPU ("power8", PROCESSOR_POWER7,   /* Don't add MASK_ISEL by default */
 
10876
-           POWERPC_7400_MASK | MASK_POWERPC64 | MASK_PPC_GPOPT | MASK_MFCRF
 
10877
-           | MASK_POPCNTB | MASK_FPRND | MASK_CMPB | MASK_DFP | MASK_POPCNTD
 
10878
-           | MASK_VSX | MASK_RECIP_PRECISION)
 
10879
+RS6000_CPU ("power8", PROCESSOR_POWER8, MASK_POWERPC64 | ISA_2_7_MASKS_SERVER)
 
10880
 RS6000_CPU ("powerpc", PROCESSOR_POWERPC, 0)
 
10881
 RS6000_CPU ("powerpc64", PROCESSOR_POWERPC64, MASK_PPC_GFXOPT | MASK_POWERPC64)
 
10882
 RS6000_CPU ("rs64", PROCESSOR_RS64A, MASK_PPC_GFXOPT | MASK_POWERPC64)
 
10883
--- a/src/gcc/config/rs6000/htmintrin.h
 
10884
+++ b/src/gcc/config/rs6000/htmintrin.h
 
10885
@@ -0,0 +1,131 @@
 
10886
+/* Hardware Transactional Memory (HTM) intrinsics.
 
10887
+   Copyright (C) 2013 Free Software Foundation, Inc.
 
10888
+   Contributed by Peter Bergner <bergner@vnet.ibm.com>.
 
10889
+
 
10890
+   This file is free software; you can redistribute it and/or modify it under
 
10891
+   the terms of the GNU General Public License as published by the Free
 
10892
+   Software Foundation; either version 3 of the License, or (at your option)
 
10893
+   any later version.
 
10894
+
 
10895
+   This file is distributed in the hope that it will be useful, but WITHOUT
 
10896
+   ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
 
10897
+   FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
 
10898
+   for more details.
 
10899
+
 
10900
+   Under Section 7 of GPL version 3, you are granted additional
 
10901
+   permissions described in the GCC Runtime Library Exception, version
 
10902
+   3.1, as published by the Free Software Foundation.
 
10903
+
 
10904
+   You should have received a copy of the GNU General Public License and
 
10905
+   a copy of the GCC Runtime Library Exception along with this program;
 
10906
+   see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
 
10907
+   <http://www.gnu.org/licenses/>.  */
 
10908
+
 
10909
+#ifndef __HTM__
 
10910
+# error "HTM instruction set not enabled"
 
10911
+#endif /* __HTM__ */
 
10912
+
 
10913
+#ifndef _HTMINTRIN_H
 
10914
+#define _HTMINTRIN_H
 
10915
+
 
10916
+#include <stdint.h>
 
10917
+
 
10918
+typedef uint64_t texasr_t;
 
10919
+typedef uint32_t texasru_t;
 
10920
+typedef uint32_t texasrl_t;
 
10921
+typedef uintptr_t tfiar_t;
 
10922
+typedef uintptr_t tfhar_t;
 
10923
+
 
10924
+#define _HTM_STATE(CR0) ((CR0 >> 1) & 0x3)
 
10925
+#define _HTM_NONTRANSACTIONAL 0x0
 
10926
+#define _HTM_SUSPENDED        0x1
 
10927
+#define _HTM_TRANSACTIONAL    0x2
 
10928
+
 
10929
+/* The following macros use the IBM bit numbering for BITNUM
 
10930
+   as used in the ISA documentation.  */
 
10931
+
 
10932
+#define _TEXASR_EXTRACT_BITS(TEXASR,BITNUM,SIZE) \
 
10933
+  (((TEXASR) >> (63-(BITNUM))) & ((1<<(SIZE))-1))
 
10934
+#define _TEXASRU_EXTRACT_BITS(TEXASR,BITNUM,SIZE) \
 
10935
+  (((TEXASR) >> (31-(BITNUM))) & ((1<<(SIZE))-1))
 
10936
+
 
10937
+#define _TEXASR_FAILURE_CODE(TEXASR) \
 
10938
+  _TEXASR_EXTRACT_BITS(TEXASR, 7, 8)
 
10939
+#define _TEXASRU_FAILURE_CODE(TEXASRU) \
 
10940
+  _TEXASRU_EXTRACT_BITS(TEXASRU, 7, 8)
 
10941
+
 
10942
+#define _TEXASR_FAILURE_PERSISTENT(TEXASR) \
 
10943
+  _TEXASR_EXTRACT_BITS(TEXASR, 7, 1)
 
10944
+#define _TEXASRU_FAILURE_PERSISTENT(TEXASRU) \
 
10945
+  _TEXASRU_EXTRACT_BITS(TEXASRU, 7, 1)
 
10946
+
 
10947
+#define _TEXASR_DISALLOWED(TEXASR) \
 
10948
+  _TEXASR_EXTRACT_BITS(TEXASR, 8, 1)
 
10949
+#define _TEXASRU_DISALLOWED(TEXASRU) \
 
10950
+  _TEXASRU_EXTRACT_BITS(TEXASRU, 8, 1)
 
10951
+
 
10952
+#define _TEXASR_NESTING_OVERFLOW(TEXASR) \
 
10953
+  _TEXASR_EXTRACT_BITS(TEXASR, 9, 1)
 
10954
+#define _TEXASRU_NESTING_OVERFLOW(TEXASRU) \
 
10955
+  _TEXASRU_EXTRACT_BITS(TEXASRU, 9, 1)
 
10956
+
 
10957
+#define _TEXASR_FOOTPRINT_OVERFLOW(TEXASR) \
 
10958
+  _TEXASR_EXTRACT_BITS(TEXASR, 10, 1)
 
10959
+#define _TEXASRU_FOOTPRINT_OVERFLOW(TEXASRU) \
 
10960
+  _TEXASRU_EXTRACT_BITS(TEXASRU, 10, 1)
 
10961
+
 
10962
+#define _TEXASR_SELF_INDUCED_CONFLICT(TEXASR) \
 
10963
+  _TEXASR_EXTRACT_BITS(TEXASR, 11, 1)
 
10964
+#define _TEXASRU_SELF_INDUCED_CONFLICT(TEXASRU) \
 
10965
+  _TEXASRU_EXTRACT_BITS(TEXASRU, 11, 1)
 
10966
+
 
10967
+#define _TEXASR_NON_TRANSACTIONAL_CONFLICT(TEXASR) \
 
10968
+  _TEXASR_EXTRACT_BITS(TEXASR, 12, 1)
 
10969
+#define _TEXASRU_NON_TRANSACTIONAL_CONFLICT(TEXASRU) \
 
10970
+  _TEXASRU_EXTRACT_BITS(TEXASRU, 12, 1)
 
10971
+
 
10972
+#define _TEXASR_TRANSACTION_CONFLICT(TEXASR) \
 
10973
+  _TEXASR_EXTRACT_BITS(TEXASR, 13, 1)
 
10974
+#define _TEXASRU_TRANSACTION_CONFLICT(TEXASRU) \
 
10975
+  _TEXASRU_EXTRACT_BITS(TEXASRU, 13, 1)
 
10976
+
 
10977
+#define _TEXASR_TRANSLATION_INVALIDATION_CONFLICT(TEXASR) \
 
10978
+  _TEXASR_EXTRACT_BITS(TEXASR, 14, 1)
 
10979
+#define _TEXASRU_TRANSLATION_INVALIDATION_CONFLICT(TEXASRU) \
 
10980
+  _TEXASRU_EXTRACT_BITS(TEXASRU, 14, 1)
 
10981
+
 
10982
+#define _TEXASR_IMPLEMENTAION_SPECIFIC(TEXASR) \
 
10983
+  _TEXASR_EXTRACT_BITS(TEXASR, 15, 1)
 
10984
+#define _TEXASRU_IMPLEMENTAION_SPECIFIC(TEXASRU) \
 
10985
+  _TEXASRU_EXTRACT_BITS(TEXASRU, 15, 1)
 
10986
+
 
10987
+#define _TEXASR_INSRUCTION_FETCH_CONFLICT(TEXASR) \
 
10988
+  _TEXASR_EXTRACT_BITS(TEXASR, 16, 1)
 
10989
+#define _TEXASRU_INSRUCTION_FETCH_CONFLICT(TEXASRU) \
 
10990
+  _TEXASRU_EXTRACT_BITS(TEXASRU, 16, 1)
 
10991
+
 
10992
+#define _TEXASR_ABORT(TEXASR) \
 
10993
+  _TEXASR_EXTRACT_BITS(TEXASR, 31, 1)
 
10994
+#define _TEXASRU_ABORT(TEXASRU) \
 
10995
+  _TEXASRU_EXTRACT_BITS(TEXASRU, 31, 1)
 
10996
+
 
10997
+
 
10998
+#define _TEXASR_SUSPENDED(TEXASR) \
 
10999
+  _TEXASR_EXTRACT_BITS(TEXASR, 32, 1)
 
11000
+
 
11001
+#define _TEXASR_PRIVILEGE(TEXASR) \
 
11002
+  _TEXASR_EXTRACT_BITS(TEXASR, 35, 2)
 
11003
+
 
11004
+#define _TEXASR_FAILURE_SUMMARY(TEXASR) \
 
11005
+  _TEXASR_EXTRACT_BITS(TEXASR, 36, 1)
 
11006
+
 
11007
+#define _TEXASR_TFIAR_EXACT(TEXASR) \
 
11008
+  _TEXASR_EXTRACT_BITS(TEXASR, 37, 1)
 
11009
+
 
11010
+#define _TEXASR_ROT(TEXASR) \
 
11011
+  _TEXASR_EXTRACT_BITS(TEXASR, 38, 1)
 
11012
+
 
11013
+#define _TEXASR_TRANSACTION_LEVEL(TEXASR) \
 
11014
+  _TEXASR_EXTRACT_BITS(TEXASR, 63, 12)
 
11015
+
 
11016
+#endif /* _HTMINTRIN_H */
 
11017
--- a/src/gcc/config/rs6000/rs6000-protos.h
 
11018
+++ b/src/gcc/config/rs6000/rs6000-protos.h
 
11019
@@ -50,11 +50,13 @@
 
11020
 extern rtx find_addr_reg (rtx);
 
11021
 extern rtx gen_easy_altivec_constant (rtx);
 
11022
 extern const char *output_vec_const_move (rtx *);
 
11023
+extern const char *rs6000_output_move_128bit (rtx *);
 
11024
 extern void rs6000_expand_vector_init (rtx, rtx);
 
11025
 extern void paired_expand_vector_init (rtx, rtx);
 
11026
 extern void rs6000_expand_vector_set (rtx, rtx, int);
 
11027
 extern void rs6000_expand_vector_extract (rtx, rtx, int);
 
11028
 extern bool altivec_expand_vec_perm_const (rtx op[4]);
 
11029
+extern void altivec_expand_vec_perm_le (rtx op[4]);
 
11030
 extern bool rs6000_expand_vec_perm_const (rtx op[4]);
 
11031
 extern void rs6000_expand_extract_even (rtx, rtx, rtx);
 
11032
 extern void rs6000_expand_interleave (rtx, rtx, rtx, bool);
 
11033
@@ -70,6 +72,11 @@
 
11034
 extern int registers_ok_for_quad_peep (rtx, rtx);
 
11035
 extern int mems_ok_for_quad_peep (rtx, rtx);
 
11036
 extern bool gpr_or_gpr_p (rtx, rtx);
 
11037
+extern bool direct_move_p (rtx, rtx);
 
11038
+extern bool quad_load_store_p (rtx, rtx);
 
11039
+extern bool fusion_gpr_load_p (rtx *, bool);
 
11040
+extern void expand_fusion_gpr_load (rtx *);
 
11041
+extern const char *emit_fusion_gpr_load (rtx *);
 
11042
 extern enum reg_class (*rs6000_preferred_reload_class_ptr) (rtx,
 
11043
                                                            enum reg_class);
 
11044
 extern enum reg_class (*rs6000_secondary_reload_class_ptr) (enum reg_class,
 
11045
@@ -116,6 +123,7 @@
 
11046
 extern void rs6000_fatal_bad_address (rtx);
 
11047
 extern rtx create_TOC_reference (rtx, rtx);
 
11048
 extern void rs6000_split_multireg_move (rtx, rtx);
 
11049
+extern void rs6000_emit_le_vsx_move (rtx, rtx, enum machine_mode);
 
11050
 extern void rs6000_emit_move (rtx, rtx, enum machine_mode);
 
11051
 extern rtx rs6000_secondary_memory_needed_rtx (enum machine_mode);
 
11052
 extern rtx (*rs6000_legitimize_reload_address_ptr) (rtx, enum machine_mode,
 
11053
@@ -135,6 +143,7 @@
 
11054
 extern rtx rs6000_address_for_altivec (rtx);
 
11055
 extern rtx rs6000_allocate_stack_temp (enum machine_mode, bool, bool);
 
11056
 extern int rs6000_loop_align (rtx);
 
11057
+extern void rs6000_split_logical (rtx [], enum rtx_code, bool, bool, bool, rtx);
 
11058
 #endif /* RTX_CODE */
 
11059
 
 
11060
 #ifdef TREE_CODE
 
11061
@@ -146,6 +155,7 @@
 
11062
 extern rtx rs6000_libcall_value (enum machine_mode);
 
11063
 extern rtx rs6000_va_arg (tree, tree);
 
11064
 extern int function_ok_for_sibcall (tree);
 
11065
+extern int rs6000_reg_parm_stack_space (tree);
 
11066
 extern void rs6000_elf_declare_function_name (FILE *, const char *, tree);
 
11067
 extern bool rs6000_elf_in_small_data_p (const_tree);
 
11068
 #ifdef ARGS_SIZE_RTX
 
11069
@@ -170,7 +180,8 @@
 
11070
 extern void rs6000_emit_epilogue (int);
 
11071
 extern void rs6000_emit_eh_reg_restore (rtx, rtx);
 
11072
 extern const char * output_isel (rtx *);
 
11073
-extern void rs6000_call_indirect_aix (rtx, rtx, rtx);
 
11074
+extern void rs6000_call_aix (rtx, rtx, rtx, rtx);
 
11075
+extern void rs6000_sibcall_aix (rtx, rtx, rtx, rtx);
 
11076
 extern void rs6000_aix_asm_output_dwarf_table_ref (char *);
 
11077
 extern void get_ppc476_thunk_name (char name[32]);
 
11078
 extern bool rs6000_overloaded_builtin_p (enum rs6000_builtins);
 
11079
--- a/src/gcc/config/rs6000/t-rs6000
 
11080
+++ b/src/gcc/config/rs6000/t-rs6000
 
11081
@@ -60,6 +60,7 @@
 
11082
        $(srcdir)/config/rs6000/power5.md \
 
11083
        $(srcdir)/config/rs6000/power6.md \
 
11084
        $(srcdir)/config/rs6000/power7.md \
 
11085
+       $(srcdir)/config/rs6000/power8.md \
 
11086
        $(srcdir)/config/rs6000/cell.md \
 
11087
        $(srcdir)/config/rs6000/xfpu.md \
 
11088
        $(srcdir)/config/rs6000/a2.md \
 
11089
@@ -70,6 +71,8 @@
 
11090
        $(srcdir)/config/rs6000/vector.md \
 
11091
        $(srcdir)/config/rs6000/vsx.md \
 
11092
        $(srcdir)/config/rs6000/altivec.md \
 
11093
+       $(srcdir)/config/rs6000/crypto.md \
 
11094
+       $(srcdir)/config/rs6000/htm.md \
 
11095
        $(srcdir)/config/rs6000/spe.md \
 
11096
        $(srcdir)/config/rs6000/dfp.md \
 
11097
        $(srcdir)/config/rs6000/paired.md
 
11098
--- a/src/gcc/config/rs6000/htmxlintrin.h
 
11099
+++ b/src/gcc/config/rs6000/htmxlintrin.h
 
11100
@@ -0,0 +1,208 @@
 
11101
+/* XL compiler Hardware Transactional Memory (HTM) execution intrinsics.
 
11102
+   Copyright (C) 2013 Free Software Foundation, Inc.
 
11103
+   Contributed by Peter Bergner <bergner@vnet.ibm.com>.
 
11104
+
 
11105
+   This file is free software; you can redistribute it and/or modify it under
 
11106
+   the terms of the GNU General Public License as published by the Free
 
11107
+   Software Foundation; either version 3 of the License, or (at your option)
 
11108
+   any later version.
 
11109
+
 
11110
+   This file is distributed in the hope that it will be useful, but WITHOUT
 
11111
+   ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
 
11112
+   FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
 
11113
+   for more details.
 
11114
+
 
11115
+   Under Section 7 of GPL version 3, you are granted additional
 
11116
+   permissions described in the GCC Runtime Library Exception, version
 
11117
+   3.1, as published by the Free Software Foundation.
 
11118
+
 
11119
+   You should have received a copy of the GNU General Public License and
 
11120
+   a copy of the GCC Runtime Library Exception along with this program;
 
11121
+   see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
 
11122
+   <http://www.gnu.org/licenses/>.  */
 
11123
+
 
11124
+#ifndef __HTM__
 
11125
+# error "HTM instruction set not enabled"
 
11126
+#endif /* __HTM__ */
 
11127
+
 
11128
+#ifndef _HTMXLINTRIN_H
 
11129
+#define _HTMXLINTRIN_H
 
11130
+
 
11131
+#include <stdint.h>
 
11132
+#include <htmintrin.h>
 
11133
+
 
11134
+#ifdef __cplusplus
 
11135
+extern "C" {
 
11136
+#endif
 
11137
+
 
11138
+#define _TEXASR_PTR(TM_BUF) \
 
11139
+  ((texasr_t *)((TM_BUF)+0))
 
11140
+#define _TEXASRU_PTR(TM_BUF) \
 
11141
+  ((texasru_t *)((TM_BUF)+0))
 
11142
+#define _TEXASRL_PTR(TM_BUF) \
 
11143
+  ((texasrl_t *)((TM_BUF)+4))
 
11144
+#define _TFIAR_PTR(TM_BUF) \
 
11145
+  ((tfiar_t *)((TM_BUF)+8))
 
11146
+
 
11147
+typedef char TM_buff_type[16];
 
11148
+
 
11149
+extern __inline long
 
11150
+__attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
 
11151
+__TM_simple_begin (void)
 
11152
+{
 
11153
+  if (__builtin_expect (__builtin_tbegin (0), 1))
 
11154
+    return 1;
 
11155
+  return 0;
 
11156
+}
 
11157
+
 
11158
+extern __inline long
 
11159
+__attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
 
11160
+__TM_begin (void* const TM_buff)
 
11161
+{
 
11162
+  *_TEXASRL_PTR (TM_buff) = 0;
 
11163
+  if (__builtin_expect (__builtin_tbegin (0), 1))
 
11164
+    return 1;
 
11165
+#ifdef __powerpc64__
 
11166
+  *_TEXASR_PTR (TM_buff) = __builtin_get_texasr ();
 
11167
+#else
 
11168
+  *_TEXASRU_PTR (TM_buff) = __builtin_get_texasru ();
 
11169
+  *_TEXASRL_PTR (TM_buff) = __builtin_get_texasr ();
 
11170
+#endif
 
11171
+  *_TFIAR_PTR (TM_buff) = __builtin_get_tfiar ();
 
11172
+  return 0;
 
11173
+}
 
11174
+
 
11175
+extern __inline long
 
11176
+__attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
 
11177
+__TM_end (void)
 
11178
+{
 
11179
+  if (__builtin_expect (__builtin_tend (0), 1))
 
11180
+    return 1;
 
11181
+  return 0;
 
11182
+}
 
11183
+
 
11184
+extern __inline void
 
11185
+__attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
 
11186
+__TM_abort (void)
 
11187
+{
 
11188
+  __builtin_tabort (0);
 
11189
+}
 
11190
+
 
11191
+extern __inline void
 
11192
+__attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
 
11193
+__TM_named_abort (unsigned char const code)
 
11194
+{
 
11195
+  __builtin_tabort (code);
 
11196
+}
 
11197
+
 
11198
+extern __inline void
 
11199
+__attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
 
11200
+__TM_resume (void)
 
11201
+{
 
11202
+  __builtin_tresume ();
 
11203
+}
 
11204
+
 
11205
+extern __inline void
 
11206
+__attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
 
11207
+__TM_suspend (void)
 
11208
+{
 
11209
+  __builtin_tsuspend ();
 
11210
+}
 
11211
+
 
11212
+extern __inline long
 
11213
+__attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
 
11214
+__TM_is_user_abort (void* const TM_buff)
 
11215
+{
 
11216
+  texasru_t texasru = *_TEXASRU_PTR (TM_buff);
 
11217
+  return _TEXASRU_ABORT (texasru);
 
11218
+}
 
11219
+
 
11220
+extern __inline long
 
11221
+__attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
 
11222
+__TM_is_named_user_abort (void* const TM_buff, unsigned char *code)
 
11223
+{
 
11224
+  texasru_t texasru = *_TEXASRU_PTR (TM_buff);
 
11225
+
 
11226
+  *code = _TEXASRU_FAILURE_CODE (texasru);
 
11227
+  return _TEXASRU_ABORT (texasru);
 
11228
+}
 
11229
+
 
11230
+extern __inline long
 
11231
+__attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
 
11232
+__TM_is_illegal (void* const TM_buff)
 
11233
+{
 
11234
+  texasru_t texasru = *_TEXASRU_PTR (TM_buff);
 
11235
+  return _TEXASRU_DISALLOWED (texasru);
 
11236
+}
 
11237
+
 
11238
+extern __inline long
 
11239
+__attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
 
11240
+__TM_is_footprint_exceeded (void* const TM_buff)
 
11241
+{
 
11242
+  texasru_t texasru = *_TEXASRU_PTR (TM_buff);
 
11243
+  return _TEXASRU_FOOTPRINT_OVERFLOW (texasru);
 
11244
+}
 
11245
+
 
11246
+extern __inline long
 
11247
+__attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
 
11248
+__TM_nesting_depth (void* const TM_buff)
 
11249
+{
 
11250
+  texasrl_t texasrl;
 
11251
+
 
11252
+  if (_HTM_STATE (__builtin_ttest ()) == _HTM_NONTRANSACTIONAL)
 
11253
+    {
 
11254
+      texasrl = *_TEXASRL_PTR (TM_buff);
 
11255
+      if (!_TEXASR_FAILURE_SUMMARY (texasrl))
 
11256
+        texasrl = 0;
 
11257
+    }
 
11258
+  else
 
11259
+    texasrl = (texasrl_t) __builtin_get_texasr ();
 
11260
+
 
11261
+  return _TEXASR_TRANSACTION_LEVEL (texasrl);
 
11262
+}
 
11263
+
 
11264
+extern __inline long
 
11265
+__attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
 
11266
+__TM_is_nested_too_deep(void* const TM_buff)
 
11267
+{
 
11268
+  texasru_t texasru = *_TEXASRU_PTR (TM_buff);
 
11269
+  return _TEXASRU_NESTING_OVERFLOW (texasru);
 
11270
+}
 
11271
+
 
11272
+extern __inline long
 
11273
+__attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
 
11274
+__TM_is_conflict(void* const TM_buff)
 
11275
+{
 
11276
+  texasru_t texasru = *_TEXASRU_PTR (TM_buff);
 
11277
+  /* Return TEXASR bits 11 (Self-Induced Conflict) through
 
11278
+     14 (Translation Invalidation Conflict).  */
 
11279
+  return (_TEXASRU_EXTRACT_BITS (texasru, 14, 4)) ? 1 : 0;
 
11280
+}
 
11281
+
 
11282
+extern __inline long
 
11283
+__attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
 
11284
+__TM_is_failure_persistent(void* const TM_buff)
 
11285
+{
 
11286
+  texasru_t texasru = *_TEXASRU_PTR (TM_buff);
 
11287
+  return _TEXASRU_FAILURE_PERSISTENT (texasru);
 
11288
+}
 
11289
+
 
11290
+extern __inline long
 
11291
+__attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
 
11292
+__TM_failure_address(void* const TM_buff)
 
11293
+{
 
11294
+  return *_TFIAR_PTR (TM_buff);
 
11295
+}
 
11296
+
 
11297
+extern __inline long long
 
11298
+__attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
 
11299
+__TM_failure_code(void* const TM_buff)
 
11300
+{
 
11301
+  return *_TEXASR_PTR (TM_buff);
 
11302
+}
 
11303
+
 
11304
+#ifdef __cplusplus
 
11305
+}
 
11306
+#endif
 
11307
+
 
11308
+#endif /* _HTMXLINTRIN_H */
 
11309
--- a/src/gcc/config/rs6000/rs6000-builtin.def
 
11310
+++ b/src/gcc/config/rs6000/rs6000-builtin.def
 
11311
@@ -30,7 +30,8 @@
 
11312
    RS6000_BUILTIN_A -- ABS builtins
 
11313
    RS6000_BUILTIN_D -- DST builtins
 
11314
    RS6000_BUILTIN_E -- SPE EVSEL builtins.
 
11315
-   RS6000_BUILTIN_P -- Altivec and VSX predicate builtins
 
11316
+   RS6000_BUILTIN_H -- HTM builtins
 
11317
+   RS6000_BUILTIN_P -- Altivec, VSX, ISA 2.07 vector predicate builtins
 
11318
    RS6000_BUILTIN_Q -- Paired floating point VSX predicate builtins
 
11319
    RS6000_BUILTIN_S -- SPE predicate builtins
 
11320
    RS6000_BUILTIN_X -- special builtins
 
11321
@@ -66,6 +67,10 @@
 
11322
   #error "RS6000_BUILTIN_E is not defined."
 
11323
 #endif
 
11324
 
 
11325
+#ifndef RS6000_BUILTIN_H
 
11326
+  #error "RS6000_BUILTIN_H is not defined."
 
11327
+#endif
 
11328
+
 
11329
 #ifndef RS6000_BUILTIN_P
 
11330
   #error "RS6000_BUILTIN_P is not defined."
 
11331
 #endif
 
11332
@@ -301,6 +306,158 @@
 
11333
                     | RS6000_BTC_SPECIAL),                             \
 
11334
                    CODE_FOR_nothing)                   /* ICODE */
 
11335
 
 
11336
+/* ISA 2.07 (power8) vector convenience macros.  */
 
11337
+/* For the instructions that are encoded as altivec instructions use
 
11338
+   __builtin_altivec_ as the builtin name.  */
 
11339
+#define BU_P8V_AV_1(ENUM, NAME, ATTR, ICODE)                           \
 
11340
+  RS6000_BUILTIN_1 (P8V_BUILTIN_ ## ENUM,              /* ENUM */      \
 
11341
+                   "__builtin_altivec_" NAME,          /* NAME */      \
 
11342
+                   RS6000_BTM_P8_VECTOR,               /* MASK */      \
 
11343
+                   (RS6000_BTC_ ## ATTR                /* ATTR */      \
 
11344
+                    | RS6000_BTC_UNARY),                               \
 
11345
+                   CODE_FOR_ ## ICODE)                 /* ICODE */
 
11346
+
 
11347
+#define BU_P8V_AV_2(ENUM, NAME, ATTR, ICODE)                           \
 
11348
+  RS6000_BUILTIN_2 (P8V_BUILTIN_ ## ENUM,              /* ENUM */      \
 
11349
+                   "__builtin_altivec_" NAME,          /* NAME */      \
 
11350
+                   RS6000_BTM_P8_VECTOR,               /* MASK */      \
 
11351
+                   (RS6000_BTC_ ## ATTR                /* ATTR */      \
 
11352
+                    | RS6000_BTC_BINARY),                              \
 
11353
+                   CODE_FOR_ ## ICODE)                 /* ICODE */
 
11354
+
 
11355
+#define BU_P8V_AV_P(ENUM, NAME, ATTR, ICODE)                           \
 
11356
+  RS6000_BUILTIN_P (P8V_BUILTIN_ ## ENUM,              /* ENUM */      \
 
11357
+                   "__builtin_altivec_" NAME,          /* NAME */      \
 
11358
+                   RS6000_BTM_P8_VECTOR,               /* MASK */      \
 
11359
+                   (RS6000_BTC_ ## ATTR                /* ATTR */      \
 
11360
+                    | RS6000_BTC_PREDICATE),                           \
 
11361
+                   CODE_FOR_ ## ICODE)                 /* ICODE */
 
11362
+
 
11363
+/* For the instructions encoded as VSX instructions use __builtin_vsx as the
 
11364
+   builtin name.  */
 
11365
+#define BU_P8V_VSX_1(ENUM, NAME, ATTR, ICODE)                          \
 
11366
+  RS6000_BUILTIN_1 (P8V_BUILTIN_ ## ENUM,              /* ENUM */      \
 
11367
+                   "__builtin_vsx_" NAME,              /* NAME */      \
 
11368
+                   RS6000_BTM_P8_VECTOR,               /* MASK */      \
 
11369
+                   (RS6000_BTC_ ## ATTR                /* ATTR */      \
 
11370
+                    | RS6000_BTC_UNARY),                               \
 
11371
+                   CODE_FOR_ ## ICODE)                 /* ICODE */
 
11372
+
 
11373
+#define BU_P8V_OVERLOAD_1(ENUM, NAME)                                  \
 
11374
+  RS6000_BUILTIN_1 (P8V_BUILTIN_VEC_ ## ENUM,          /* ENUM */      \
 
11375
+                   "__builtin_vec_" NAME,              /* NAME */      \
 
11376
+                   RS6000_BTM_P8_VECTOR,               /* MASK */      \
 
11377
+                   (RS6000_BTC_OVERLOADED              /* ATTR */      \
 
11378
+                    | RS6000_BTC_UNARY),                               \
 
11379
+                   CODE_FOR_nothing)                   /* ICODE */
 
11380
+
 
11381
+#define BU_P8V_OVERLOAD_2(ENUM, NAME)                                  \
 
11382
+  RS6000_BUILTIN_2 (P8V_BUILTIN_VEC_ ## ENUM,          /* ENUM */      \
 
11383
+                   "__builtin_vec_" NAME,              /* NAME */      \
 
11384
+                   RS6000_BTM_P8_VECTOR,               /* MASK */      \
 
11385
+                   (RS6000_BTC_OVERLOADED              /* ATTR */      \
 
11386
+                    | RS6000_BTC_BINARY),                              \
 
11387
+                   CODE_FOR_nothing)                   /* ICODE */
 
11388
+
 
11389
+/* Crypto convenience macros.  */
 
11390
+#define BU_CRYPTO_1(ENUM, NAME, ATTR, ICODE)                           \
 
11391
+  RS6000_BUILTIN_1 (CRYPTO_BUILTIN_ ## ENUM,           /* ENUM */      \
 
11392
+                   "__builtin_crypto_" NAME,           /* NAME */      \
 
11393
+                   RS6000_BTM_CRYPTO,                  /* MASK */      \
 
11394
+                   (RS6000_BTC_ ## ATTR                /* ATTR */      \
 
11395
+                    | RS6000_BTC_UNARY),                               \
 
11396
+                   CODE_FOR_ ## ICODE)                 /* ICODE */
 
11397
+
 
11398
+#define BU_CRYPTO_2(ENUM, NAME, ATTR, ICODE)                           \
 
11399
+  RS6000_BUILTIN_2 (CRYPTO_BUILTIN_ ## ENUM,           /* ENUM */      \
 
11400
+                   "__builtin_crypto_" NAME,           /* NAME */      \
 
11401
+                   RS6000_BTM_CRYPTO,                  /* MASK */      \
 
11402
+                   (RS6000_BTC_ ## ATTR                /* ATTR */      \
 
11403
+                    | RS6000_BTC_BINARY),                              \
 
11404
+                   CODE_FOR_ ## ICODE)                 /* ICODE */
 
11405
+
 
11406
+#define BU_CRYPTO_3(ENUM, NAME, ATTR, ICODE)                           \
 
11407
+  RS6000_BUILTIN_3 (CRYPTO_BUILTIN_ ## ENUM,           /* ENUM */      \
 
11408
+                   "__builtin_crypto_" NAME,           /* NAME */      \
 
11409
+                   RS6000_BTM_CRYPTO,                  /* MASK */      \
 
11410
+                   (RS6000_BTC_ ## ATTR                /* ATTR */      \
 
11411
+                    | RS6000_BTC_TERNARY),                             \
 
11412
+                   CODE_FOR_ ## ICODE)                 /* ICODE */
 
11413
+
 
11414
+#define BU_CRYPTO_OVERLOAD_1(ENUM, NAME)                               \
 
11415
+  RS6000_BUILTIN_1 (CRYPTO_BUILTIN_ ## ENUM,           /* ENUM */      \
 
11416
+                   "__builtin_crypto_" NAME,           /* NAME */      \
 
11417
+                   RS6000_BTM_CRYPTO,                  /* MASK */      \
 
11418
+                   (RS6000_BTC_OVERLOADED              /* ATTR */      \
 
11419
+                    | RS6000_BTC_UNARY),                               \
 
11420
+                   CODE_FOR_nothing)                   /* ICODE */
 
11421
+
 
11422
+#define BU_CRYPTO_OVERLOAD_2(ENUM, NAME)                               \
 
11423
+  RS6000_BUILTIN_2 (CRYPTO_BUILTIN_ ## ENUM,           /* ENUM */      \
 
11424
+                   "__builtin_crypto_" NAME,           /* NAME */      \
 
11425
+                   RS6000_BTM_CRYPTO,                  /* MASK */      \
 
11426
+                   (RS6000_BTC_OVERLOADED              /* ATTR */      \
 
11427
+                    | RS6000_BTC_BINARY),                              \
 
11428
+                   CODE_FOR_nothing)                   /* ICODE */
 
11429
+
 
11430
+#define BU_CRYPTO_OVERLOAD_3(ENUM, NAME)                               \
 
11431
+  RS6000_BUILTIN_3 (CRYPTO_BUILTIN_ ## ENUM,           /* ENUM */      \
 
11432
+                   "__builtin_crypto_" NAME,           /* NAME */      \
 
11433
+                   RS6000_BTM_CRYPTO,                  /* MASK */      \
 
11434
+                   (RS6000_BTC_OVERLOADED              /* ATTR */      \
 
11435
+                    | RS6000_BTC_TERNARY),                             \
 
11436
+                   CODE_FOR_nothing)                   /* ICODE */
 
11437
+
 
11438
+/* HTM convenience macros.  */
 
11439
+#define BU_HTM_0(ENUM, NAME, ATTR, ICODE)                              \
 
11440
+  RS6000_BUILTIN_H (HTM_BUILTIN_ ## ENUM,              /* ENUM */      \
 
11441
+                   "__builtin_" NAME,                  /* NAME */      \
 
11442
+                   RS6000_BTM_HTM,                     /* MASK */      \
 
11443
+                   RS6000_BTC_ ## ATTR,                /* ATTR */      \
 
11444
+                   CODE_FOR_ ## ICODE)                 /* ICODE */
 
11445
+
 
11446
+#define BU_HTM_1(ENUM, NAME, ATTR, ICODE)                              \
 
11447
+  RS6000_BUILTIN_H (HTM_BUILTIN_ ## ENUM,              /* ENUM */      \
 
11448
+                   "__builtin_" NAME,                  /* NAME */      \
 
11449
+                   RS6000_BTM_HTM,                     /* MASK */      \
 
11450
+                   (RS6000_BTC_ ## ATTR                /* ATTR */      \
 
11451
+                    | RS6000_BTC_UNARY),                               \
 
11452
+                   CODE_FOR_ ## ICODE)                 /* ICODE */
 
11453
+
 
11454
+#define BU_HTM_2(ENUM, NAME, ATTR, ICODE)                              \
 
11455
+  RS6000_BUILTIN_H (HTM_BUILTIN_ ## ENUM,              /* ENUM */      \
 
11456
+                   "__builtin_" NAME,                  /* NAME */      \
 
11457
+                   RS6000_BTM_HTM,                     /* MASK */      \
 
11458
+                   (RS6000_BTC_ ## ATTR                /* ATTR */      \
 
11459
+                    | RS6000_BTC_BINARY),                              \
 
11460
+                   CODE_FOR_ ## ICODE)                 /* ICODE */
 
11461
+
 
11462
+#define BU_HTM_3(ENUM, NAME, ATTR, ICODE)                              \
 
11463
+  RS6000_BUILTIN_H (HTM_BUILTIN_ ## ENUM,              /* ENUM */      \
 
11464
+                   "__builtin_" NAME,                  /* NAME */      \
 
11465
+                   RS6000_BTM_HTM,                     /* MASK */      \
 
11466
+                   (RS6000_BTC_ ## ATTR                /* ATTR */      \
 
11467
+                    | RS6000_BTC_TERNARY),                             \
 
11468
+                   CODE_FOR_ ## ICODE)                 /* ICODE */
 
11469
+
 
11470
+#define BU_HTM_SPR0(ENUM, NAME, ATTR, ICODE)                           \
 
11471
+  RS6000_BUILTIN_H (HTM_BUILTIN_ ## ENUM,              /* ENUM */      \
 
11472
+                   "__builtin_" NAME,                  /* NAME */      \
 
11473
+                   RS6000_BTM_HTM,                     /* MASK */      \
 
11474
+                   (RS6000_BTC_ ## ATTR                /* ATTR */      \
 
11475
+                    | RS6000_BTC_SPR),                                 \
 
11476
+                   CODE_FOR_ ## ICODE)                 /* ICODE */
 
11477
+
 
11478
+#define BU_HTM_SPR1(ENUM, NAME, ATTR, ICODE)                           \
 
11479
+  RS6000_BUILTIN_H (HTM_BUILTIN_ ## ENUM,              /* ENUM */      \
 
11480
+                   "__builtin_" NAME,                  /* NAME */      \
 
11481
+                   RS6000_BTM_HTM,                     /* MASK */      \
 
11482
+                   (RS6000_BTC_ ## ATTR                /* ATTR */      \
 
11483
+                    | RS6000_BTC_UNARY                                 \
 
11484
+                    | RS6000_BTC_SPR                                   \
 
11485
+                    | RS6000_BTC_VOID),                                \
 
11486
+                   CODE_FOR_ ## ICODE)                 /* ICODE */
 
11487
+
 
11488
 /* SPE convenience macros.  */
 
11489
 #define BU_SPE_1(ENUM, NAME, ATTR, ICODE)                              \
 
11490
   RS6000_BUILTIN_1 (SPE_BUILTIN_ ## ENUM,              /* ENUM */      \
 
11491
@@ -1012,7 +1169,7 @@
 
11492
 BU_VSX_1 (XVRESP,            "xvresp",         CONST,  vsx_frev4sf2)
 
11493
 
 
11494
 BU_VSX_1 (XSCVDPSP,          "xscvdpsp",       CONST,  vsx_xscvdpsp)
 
11495
-BU_VSX_1 (XSCVSPDP,          "xscvspdp",       CONST,  vsx_xscvdpsp)
 
11496
+BU_VSX_1 (XSCVSPDP,          "xscvspdp",       CONST,  vsx_xscvspdp)
 
11497
 BU_VSX_1 (XVCVDPSP,          "xvcvdpsp",       CONST,  vsx_xvcvdpsp)
 
11498
 BU_VSX_1 (XVCVSPDP,          "xvcvspdp",       CONST,  vsx_xvcvspdp)
 
11499
 BU_VSX_1 (XSTSQRTDP_FE,              "xstsqrtdp_fe",   CONST,  vsx_tsqrtdf2_fe)
 
11500
@@ -1052,9 +1209,9 @@
 
11501
 
 
11502
 BU_VSX_1 (XSRDPI,            "xsrdpi",         CONST,  vsx_xsrdpi)
 
11503
 BU_VSX_1 (XSRDPIC,           "xsrdpic",        CONST,  vsx_xsrdpic)
 
11504
-BU_VSX_1 (XSRDPIM,           "xsrdpim",        CONST,  vsx_floordf2)
 
11505
-BU_VSX_1 (XSRDPIP,           "xsrdpip",        CONST,  vsx_ceildf2)
 
11506
-BU_VSX_1 (XSRDPIZ,           "xsrdpiz",        CONST,  vsx_btruncdf2)
 
11507
+BU_VSX_1 (XSRDPIM,           "xsrdpim",        CONST,  floordf2)
 
11508
+BU_VSX_1 (XSRDPIP,           "xsrdpip",        CONST,  ceildf2)
 
11509
+BU_VSX_1 (XSRDPIZ,           "xsrdpiz",        CONST,  btruncdf2)
 
11510
 
 
11511
 /* VSX predicate functions.  */
 
11512
 BU_VSX_P (XVCMPEQSP_P,       "xvcmpeqsp_p",    CONST,  vector_eq_v4sf_p)
 
11513
@@ -1132,6 +1289,166 @@
 
11514
 BU_VSX_OVERLOAD_X (LD,      "ld")
 
11515
 BU_VSX_OVERLOAD_X (ST,      "st")
 
11516
 
 
11517
+/* 1 argument VSX instructions added in ISA 2.07.  */
 
11518
+BU_P8V_VSX_1 (XSCVSPDPN,      "xscvspdpn",     CONST,  vsx_xscvspdpn)
 
11519
+BU_P8V_VSX_1 (XSCVDPSPN,      "xscvdpspn",     CONST,  vsx_xscvdpspn)
 
11520
+
 
11521
+/* 1 argument altivec instructions added in ISA 2.07.  */
 
11522
+BU_P8V_AV_1 (ABS_V2DI,       "abs_v2di",       CONST,  absv2di2)
 
11523
+BU_P8V_AV_1 (VUPKHSW,        "vupkhsw",        CONST,  altivec_vupkhsw)
 
11524
+BU_P8V_AV_1 (VUPKLSW,        "vupklsw",        CONST,  altivec_vupklsw)
 
11525
+BU_P8V_AV_1 (VCLZB,          "vclzb",          CONST,  clzv16qi2)
 
11526
+BU_P8V_AV_1 (VCLZH,          "vclzh",          CONST,  clzv8hi2)
 
11527
+BU_P8V_AV_1 (VCLZW,          "vclzw",          CONST,  clzv4si2)
 
11528
+BU_P8V_AV_1 (VCLZD,          "vclzd",          CONST,  clzv2di2)
 
11529
+BU_P8V_AV_1 (VPOPCNTB,       "vpopcntb",       CONST,  popcountv16qi2)
 
11530
+BU_P8V_AV_1 (VPOPCNTH,       "vpopcnth",       CONST,  popcountv8hi2)
 
11531
+BU_P8V_AV_1 (VPOPCNTW,       "vpopcntw",       CONST,  popcountv4si2)
 
11532
+BU_P8V_AV_1 (VPOPCNTD,       "vpopcntd",       CONST,  popcountv2di2)
 
11533
+BU_P8V_AV_1 (VGBBD,          "vgbbd",          CONST,  p8v_vgbbd)
 
11534
+
 
11535
+/* 2 argument altivec instructions added in ISA 2.07.  */
 
11536
+BU_P8V_AV_2 (VADDUDM,          "vaddudm",      CONST,  addv2di3)
 
11537
+BU_P8V_AV_2 (VMINSD,           "vminsd",       CONST,  sminv2di3)
 
11538
+BU_P8V_AV_2 (VMAXSD,           "vmaxsd",       CONST,  smaxv2di3)
 
11539
+BU_P8V_AV_2 (VMINUD,           "vminud",       CONST,  uminv2di3)
 
11540
+BU_P8V_AV_2 (VMAXUD,           "vmaxud",       CONST,  umaxv2di3)
 
11541
+BU_P8V_AV_2 (VMRGEW,           "vmrgew",       CONST,  p8_vmrgew)
 
11542
+BU_P8V_AV_2 (VMRGOW,           "vmrgow",       CONST,  p8_vmrgow)
 
11543
+BU_P8V_AV_2 (VPKUDUM,          "vpkudum",      CONST,  altivec_vpkudum)
 
11544
+BU_P8V_AV_2 (VPKSDSS,          "vpksdss",      CONST,  altivec_vpksdss)
 
11545
+BU_P8V_AV_2 (VPKUDUS,          "vpkudus",      CONST,  altivec_vpkudus)
 
11546
+BU_P8V_AV_2 (VPKSDUS,          "vpksdus",      CONST,  altivec_vpkswus)
 
11547
+BU_P8V_AV_2 (VRLD,             "vrld",         CONST,  vrotlv2di3)
 
11548
+BU_P8V_AV_2 (VSLD,             "vsld",         CONST,  vashlv2di3)
 
11549
+BU_P8V_AV_2 (VSRD,             "vsrd",         CONST,  vlshrv2di3)
 
11550
+BU_P8V_AV_2 (VSRAD,            "vsrad",        CONST,  vashrv2di3)
 
11551
+BU_P8V_AV_2 (VSUBUDM,          "vsubudm",      CONST,  subv2di3)
 
11552
+
 
11553
+BU_P8V_AV_2 (EQV_V16QI,                "eqv_v16qi",    CONST,  eqvv16qi3)
 
11554
+BU_P8V_AV_2 (EQV_V8HI,         "eqv_v8hi",     CONST,  eqvv8hi3)
 
11555
+BU_P8V_AV_2 (EQV_V4SI,         "eqv_v4si",     CONST,  eqvv4si3)
 
11556
+BU_P8V_AV_2 (EQV_V2DI,         "eqv_v2di",     CONST,  eqvv2di3)
 
11557
+BU_P8V_AV_2 (EQV_V4SF,         "eqv_v4sf",     CONST,  eqvv4sf3)
 
11558
+BU_P8V_AV_2 (EQV_V2DF,         "eqv_v2df",     CONST,  eqvv2df3)
 
11559
+
 
11560
+BU_P8V_AV_2 (NAND_V16QI,       "nand_v16qi",   CONST,  nandv16qi3)
 
11561
+BU_P8V_AV_2 (NAND_V8HI,                "nand_v8hi",    CONST,  nandv8hi3)
 
11562
+BU_P8V_AV_2 (NAND_V4SI,                "nand_v4si",    CONST,  nandv4si3)
 
11563
+BU_P8V_AV_2 (NAND_V2DI,                "nand_v2di",    CONST,  nandv2di3)
 
11564
+BU_P8V_AV_2 (NAND_V4SF,                "nand_v4sf",    CONST,  nandv4sf3)
 
11565
+BU_P8V_AV_2 (NAND_V2DF,                "nand_v2df",    CONST,  nandv2df3)
 
11566
+
 
11567
+BU_P8V_AV_2 (ORC_V16QI,                "orc_v16qi",    CONST,  orcv16qi3)
 
11568
+BU_P8V_AV_2 (ORC_V8HI,         "orc_v8hi",     CONST,  orcv8hi3)
 
11569
+BU_P8V_AV_2 (ORC_V4SI,         "orc_v4si",     CONST,  orcv4si3)
 
11570
+BU_P8V_AV_2 (ORC_V2DI,         "orc_v2di",     CONST,  orcv2di3)
 
11571
+BU_P8V_AV_2 (ORC_V4SF,         "orc_v4sf",     CONST,  orcv4sf3)
 
11572
+BU_P8V_AV_2 (ORC_V2DF,         "orc_v2df",     CONST,  orcv2df3)
 
11573
+
 
11574
+/* Vector comparison instructions added in ISA 2.07.  */
 
11575
+BU_P8V_AV_2 (VCMPEQUD,         "vcmpequd",     CONST,  vector_eqv2di)
 
11576
+BU_P8V_AV_2 (VCMPGTSD,         "vcmpgtsd",     CONST,  vector_gtv2di)
 
11577
+BU_P8V_AV_2 (VCMPGTUD,         "vcmpgtud",     CONST,  vector_gtuv2di)
 
11578
+
 
11579
+/* Vector comparison predicate instructions added in ISA 2.07.  */
 
11580
+BU_P8V_AV_P (VCMPEQUD_P,       "vcmpequd_p",   CONST,  vector_eq_v2di_p)
 
11581
+BU_P8V_AV_P (VCMPGTSD_P,       "vcmpgtsd_p",   CONST,  vector_gt_v2di_p)
 
11582
+BU_P8V_AV_P (VCMPGTUD_P,       "vcmpgtud_p",   CONST,  vector_gtu_v2di_p)
 
11583
+
 
11584
+/* ISA 2.07 vector overloaded 1 argument functions.  */
 
11585
+BU_P8V_OVERLOAD_1 (VUPKHSW,    "vupkhsw")
 
11586
+BU_P8V_OVERLOAD_1 (VUPKLSW,    "vupklsw")
 
11587
+BU_P8V_OVERLOAD_1 (VCLZ,       "vclz")
 
11588
+BU_P8V_OVERLOAD_1 (VCLZB,      "vclzb")
 
11589
+BU_P8V_OVERLOAD_1 (VCLZH,      "vclzh")
 
11590
+BU_P8V_OVERLOAD_1 (VCLZW,      "vclzw")
 
11591
+BU_P8V_OVERLOAD_1 (VCLZD,      "vclzd")
 
11592
+BU_P8V_OVERLOAD_1 (VPOPCNT,    "vpopcnt")
 
11593
+BU_P8V_OVERLOAD_1 (VPOPCNTB,   "vpopcntb")
 
11594
+BU_P8V_OVERLOAD_1 (VPOPCNTH,   "vpopcnth")
 
11595
+BU_P8V_OVERLOAD_1 (VPOPCNTW,   "vpopcntw")
 
11596
+BU_P8V_OVERLOAD_1 (VPOPCNTD,   "vpopcntd")
 
11597
+BU_P8V_OVERLOAD_1 (VGBBD,      "vgbbd")
 
11598
+
 
11599
+/* ISA 2.07 vector overloaded 2 argument functions.  */
 
11600
+BU_P8V_OVERLOAD_2 (EQV,                "eqv")
 
11601
+BU_P8V_OVERLOAD_2 (NAND,       "nand")
 
11602
+BU_P8V_OVERLOAD_2 (ORC,                "orc")
 
11603
+BU_P8V_OVERLOAD_2 (VADDUDM,    "vaddudm")
 
11604
+BU_P8V_OVERLOAD_2 (VMAXSD,     "vmaxsd")
 
11605
+BU_P8V_OVERLOAD_2 (VMAXUD,     "vmaxud")
 
11606
+BU_P8V_OVERLOAD_2 (VMINSD,     "vminsd")
 
11607
+BU_P8V_OVERLOAD_2 (VMINUD,     "vminud")
 
11608
+BU_P8V_OVERLOAD_2 (VMRGEW,     "vmrgew")
 
11609
+BU_P8V_OVERLOAD_2 (VMRGOW,     "vmrgow")
 
11610
+BU_P8V_OVERLOAD_2 (VPKSDSS,    "vpksdss")
 
11611
+BU_P8V_OVERLOAD_2 (VPKSDUS,    "vpksdus")
 
11612
+BU_P8V_OVERLOAD_2 (VPKUDUM,    "vpkudum")
 
11613
+BU_P8V_OVERLOAD_2 (VPKUDUS,    "vpkudus")
 
11614
+BU_P8V_OVERLOAD_2 (VRLD,       "vrld")
 
11615
+BU_P8V_OVERLOAD_2 (VSLD,       "vsld")
 
11616
+BU_P8V_OVERLOAD_2 (VSRAD,      "vsrad")
 
11617
+BU_P8V_OVERLOAD_2 (VSRD,       "vsrd")
 
11618
+BU_P8V_OVERLOAD_2 (VSUBUDM,    "vsubudm")
 
11619
+
 
11620
+
 
11621
+/* 1 argument crypto functions.  */
 
11622
+BU_CRYPTO_1 (VSBOX,            "vsbox",          CONST, crypto_vsbox)
 
11623
+
 
11624
+/* 2 argument crypto functions.  */
 
11625
+BU_CRYPTO_2 (VCIPHER,          "vcipher",        CONST, crypto_vcipher)
 
11626
+BU_CRYPTO_2 (VCIPHERLAST,      "vcipherlast",    CONST, crypto_vcipherlast)
 
11627
+BU_CRYPTO_2 (VNCIPHER,         "vncipher",       CONST, crypto_vncipher)
 
11628
+BU_CRYPTO_2 (VNCIPHERLAST,     "vncipherlast",   CONST, crypto_vncipherlast)
 
11629
+BU_CRYPTO_2 (VPMSUMB,          "vpmsumb",        CONST, crypto_vpmsumb)
 
11630
+BU_CRYPTO_2 (VPMSUMH,          "vpmsumh",        CONST, crypto_vpmsumh)
 
11631
+BU_CRYPTO_2 (VPMSUMW,          "vpmsumw",        CONST, crypto_vpmsumw)
 
11632
+BU_CRYPTO_2 (VPMSUMD,          "vpmsumd",        CONST, crypto_vpmsumd)
 
11633
+
 
11634
+/* 3 argument crypto functions.  */
 
11635
+BU_CRYPTO_3 (VPERMXOR_V2DI,    "vpermxor_v2di",  CONST, crypto_vpermxor_v2di)
 
11636
+BU_CRYPTO_3 (VPERMXOR_V4SI,    "vpermxor_v4si",  CONST, crypto_vpermxor_v4si)
 
11637
+BU_CRYPTO_3 (VPERMXOR_V8HI,    "vpermxor_v8hi",  CONST, crypto_vpermxor_v8hi)
 
11638
+BU_CRYPTO_3 (VPERMXOR_V16QI,   "vpermxor_v16qi", CONST, crypto_vpermxor_v16qi)
 
11639
+BU_CRYPTO_3 (VSHASIGMAW,       "vshasigmaw",     CONST, crypto_vshasigmaw)
 
11640
+BU_CRYPTO_3 (VSHASIGMAD,       "vshasigmad",     CONST, crypto_vshasigmad)
 
11641
+
 
11642
+/* 2 argument crypto overloaded functions.  */
 
11643
+BU_CRYPTO_OVERLOAD_2 (VPMSUM,   "vpmsum")
 
11644
+
 
11645
+/* 3 argument crypto overloaded functions.  */
 
11646
+BU_CRYPTO_OVERLOAD_3 (VPERMXOR,         "vpermxor")
 
11647
+BU_CRYPTO_OVERLOAD_3 (VSHASIGMA, "vshasigma")
 
11648
+
 
11649
+
 
11650
+/* HTM functions.  */
 
11651
+BU_HTM_1  (TABORT,     "tabort",       MISC,   tabort)
 
11652
+BU_HTM_3  (TABORTDC,   "tabortdc",     MISC,   tabortdc)
 
11653
+BU_HTM_3  (TABORTDCI,  "tabortdci",    MISC,   tabortdci)
 
11654
+BU_HTM_3  (TABORTWC,   "tabortwc",     MISC,   tabortwc)
 
11655
+BU_HTM_3  (TABORTWCI,  "tabortwci",    MISC,   tabortwci)
 
11656
+BU_HTM_1  (TBEGIN,     "tbegin",       MISC,   tbegin)
 
11657
+BU_HTM_1  (TCHECK,     "tcheck",       MISC,   tcheck)
 
11658
+BU_HTM_1  (TEND,       "tend",         MISC,   tend)
 
11659
+BU_HTM_0  (TENDALL,    "tendall",      MISC,   tend)
 
11660
+BU_HTM_0  (TRECHKPT,   "trechkpt",     MISC,   trechkpt)
 
11661
+BU_HTM_1  (TRECLAIM,   "treclaim",     MISC,   treclaim)
 
11662
+BU_HTM_0  (TRESUME,    "tresume",      MISC,   tsr)
 
11663
+BU_HTM_0  (TSUSPEND,   "tsuspend",     MISC,   tsr)
 
11664
+BU_HTM_1  (TSR,                "tsr",          MISC,   tsr)
 
11665
+BU_HTM_0  (TTEST,      "ttest",        MISC,   ttest)
 
11666
+
 
11667
+BU_HTM_SPR0 (GET_TFHAR,                "get_tfhar",    MISC,   nothing)
 
11668
+BU_HTM_SPR1 (SET_TFHAR,                "set_tfhar",    MISC,   nothing)
 
11669
+BU_HTM_SPR0 (GET_TFIAR,                "get_tfiar",    MISC,   nothing)
 
11670
+BU_HTM_SPR1 (SET_TFIAR,                "set_tfiar",    MISC,   nothing)
 
11671
+BU_HTM_SPR0 (GET_TEXASR,       "get_texasr",   MISC,   nothing)
 
11672
+BU_HTM_SPR1 (SET_TEXASR,       "set_texasr",   MISC,   nothing)
 
11673
+BU_HTM_SPR0 (GET_TEXASRU,      "get_texasru",  MISC,   nothing)
 
11674
+BU_HTM_SPR1 (SET_TEXASRU,      "set_texasru",  MISC,   nothing)
 
11675
+
 
11676
+
 
11677
 /* 3 argument paired floating point builtins.  */
 
11678
 BU_PAIRED_3 (MSUB,            "msub",           FP,    fmsv2sf4)
 
11679
 BU_PAIRED_3 (MADD,            "madd",           FP,    fmav2sf4)
 
11680
@@ -1430,10 +1747,10 @@
 
11681
              RS6000_BTC_FP)
 
11682
 
 
11683
 BU_SPECIAL_X (RS6000_BUILTIN_GET_TB, "__builtin_ppc_get_timebase",
 
11684
-            RS6000_BTM_ALWAYS, RS6000_BTC_MISC)
 
11685
+             RS6000_BTM_ALWAYS, RS6000_BTC_MISC)
 
11686
 
 
11687
 BU_SPECIAL_X (RS6000_BUILTIN_MFTB, "__builtin_ppc_mftb",
 
11688
-            RS6000_BTM_ALWAYS, RS6000_BTC_MISC)
 
11689
+             RS6000_BTM_ALWAYS, RS6000_BTC_MISC)
 
11690
 
 
11691
 /* Darwin CfString builtin.  */
 
11692
 BU_SPECIAL_X (RS6000_BUILTIN_CFSTRING, "__builtin_cfstring", RS6000_BTM_ALWAYS,
 
11693
--- a/src/gcc/config/rs6000/rs6000-c.c
 
11694
+++ b/src/gcc/config/rs6000/rs6000-c.c
 
11695
@@ -315,6 +315,8 @@
 
11696
     rs6000_define_or_undefine_macro (define_p, "_ARCH_PWR6X");
 
11697
   if ((flags & OPTION_MASK_POPCNTD) != 0)
 
11698
     rs6000_define_or_undefine_macro (define_p, "_ARCH_PWR7");
 
11699
+  if ((flags & OPTION_MASK_DIRECT_MOVE) != 0)
 
11700
+    rs6000_define_or_undefine_macro (define_p, "_ARCH_PWR8");
 
11701
   if ((flags & OPTION_MASK_SOFT_FLOAT) != 0)
 
11702
     rs6000_define_or_undefine_macro (define_p, "_SOFT_FLOAT");
 
11703
   if ((flags & OPTION_MASK_RECIP_PRECISION) != 0)
 
11704
@@ -331,6 +333,12 @@
 
11705
     }
 
11706
   if ((flags & OPTION_MASK_VSX) != 0)
 
11707
     rs6000_define_or_undefine_macro (define_p, "__VSX__");
 
11708
+  if ((flags & OPTION_MASK_HTM) != 0)
 
11709
+    rs6000_define_or_undefine_macro (define_p, "__HTM__");
 
11710
+  if ((flags & OPTION_MASK_P8_VECTOR) != 0)
 
11711
+    rs6000_define_or_undefine_macro (define_p, "__POWER8_VECTOR__");
 
11712
+  if ((flags & OPTION_MASK_CRYPTO) != 0)
 
11713
+    rs6000_define_or_undefine_macro (define_p, "__CRYPTO__");
 
11714
 
 
11715
   /* options from the builtin masks.  */
 
11716
   if ((bu_mask & RS6000_BTM_SPE) != 0)
 
11717
@@ -453,7 +461,11 @@
 
11718
     case ABI_AIX:
 
11719
       builtin_define ("_CALL_AIXDESC");
 
11720
       builtin_define ("_CALL_AIX");
 
11721
+      builtin_define ("_CALL_ELF=1");
 
11722
       break;
 
11723
+    case ABI_ELFv2:
 
11724
+      builtin_define ("_CALL_ELF=2");
 
11725
+      break;
 
11726
     case ABI_DARWIN:
 
11727
       builtin_define ("_CALL_DARWIN");
 
11728
       break;
 
11729
@@ -465,6 +477,13 @@
 
11730
   if (TARGET_SOFT_FLOAT || !TARGET_FPRS)
 
11731
     builtin_define ("__NO_FPRS__");
 
11732
 
 
11733
+  /* Whether aggregates passed by value are aligned to a 16 byte boundary
 
11734
+     if their alignment is 16 bytes or larger.  */
 
11735
+  if ((TARGET_MACHO && rs6000_darwin64_abi)
 
11736
+      || DEFAULT_ABI == ABI_ELFv2
 
11737
+      || (DEFAULT_ABI == ABI_AIX && !rs6000_compat_align_parm))
 
11738
+    builtin_define ("__STRUCT_PARM_ALIGN__=16");
 
11739
+
 
11740
   /* Generate defines for Xilinx FPU. */
 
11741
   if (rs6000_xilinx_fpu) 
 
11742
     {
 
11743
@@ -505,6 +524,8 @@
 
11744
     RS6000_BTI_V8HI, RS6000_BTI_V8HI, 0, 0 },
 
11745
   { ALTIVEC_BUILTIN_VEC_ABS, ALTIVEC_BUILTIN_ABS_V4SI,
 
11746
     RS6000_BTI_V4SI, RS6000_BTI_V4SI, 0, 0 },
 
11747
+  { ALTIVEC_BUILTIN_VEC_ABS, P8V_BUILTIN_ABS_V2DI,
 
11748
+    RS6000_BTI_V2DI, RS6000_BTI_V2DI, 0, 0 },
 
11749
   { ALTIVEC_BUILTIN_VEC_ABS, ALTIVEC_BUILTIN_ABS_V4SF,
 
11750
     RS6000_BTI_V4SF, RS6000_BTI_V4SF, 0, 0 },
 
11751
   { ALTIVEC_BUILTIN_VEC_ABS, VSX_BUILTIN_XVABSDP,
 
11752
@@ -577,12 +598,24 @@
 
11753
     RS6000_BTI_V4SI, RS6000_BTI_V8HI, 0, 0 },
 
11754
   { ALTIVEC_BUILTIN_VEC_UNPACKH, ALTIVEC_BUILTIN_VUPKHSH,
 
11755
     RS6000_BTI_bool_V4SI, RS6000_BTI_bool_V8HI, 0, 0 },
 
11756
+  { ALTIVEC_BUILTIN_VEC_UNPACKH, P8V_BUILTIN_VUPKHSW,
 
11757
+    RS6000_BTI_V2DI, RS6000_BTI_V4SI, 0, 0 },
 
11758
+  { ALTIVEC_BUILTIN_VEC_UNPACKH, P8V_BUILTIN_VUPKHSW,
 
11759
+    RS6000_BTI_bool_V2DI, RS6000_BTI_bool_V4SI, 0, 0 },
 
11760
   { ALTIVEC_BUILTIN_VEC_UNPACKH, ALTIVEC_BUILTIN_VUPKHPX,
 
11761
     RS6000_BTI_unsigned_V4SI, RS6000_BTI_pixel_V8HI, 0, 0 },
 
11762
   { ALTIVEC_BUILTIN_VEC_VUPKHSH, ALTIVEC_BUILTIN_VUPKHSH,
 
11763
     RS6000_BTI_V4SI, RS6000_BTI_V8HI, 0, 0 },
 
11764
   { ALTIVEC_BUILTIN_VEC_VUPKHSH, ALTIVEC_BUILTIN_VUPKHSH,
 
11765
     RS6000_BTI_bool_V4SI, RS6000_BTI_bool_V8HI, 0, 0 },
 
11766
+  { ALTIVEC_BUILTIN_VEC_UNPACKH, P8V_BUILTIN_VUPKHSW,
 
11767
+    RS6000_BTI_V2DI, RS6000_BTI_V4SI, 0, 0 },
 
11768
+  { ALTIVEC_BUILTIN_VEC_UNPACKH, P8V_BUILTIN_VUPKHSW,
 
11769
+    RS6000_BTI_bool_V2DI, RS6000_BTI_bool_V4SI, 0, 0 },
 
11770
+  { ALTIVEC_BUILTIN_VEC_VUPKHSH, P8V_BUILTIN_VUPKHSW,
 
11771
+    RS6000_BTI_V2DI, RS6000_BTI_V4SI, 0, 0 },
 
11772
+  { ALTIVEC_BUILTIN_VEC_VUPKHSH, P8V_BUILTIN_VUPKHSW,
 
11773
+    RS6000_BTI_bool_V2DI, RS6000_BTI_bool_V4SI, 0, 0 },
 
11774
   { ALTIVEC_BUILTIN_VEC_VUPKHPX, ALTIVEC_BUILTIN_VUPKHPX,
 
11775
     RS6000_BTI_unsigned_V4SI, RS6000_BTI_unsigned_V8HI, 0, 0 },
 
11776
   { ALTIVEC_BUILTIN_VEC_VUPKHPX, ALTIVEC_BUILTIN_VUPKHPX,
 
11777
@@ -601,6 +634,10 @@
 
11778
     RS6000_BTI_V4SI, RS6000_BTI_V8HI, 0, 0 },
 
11779
   { ALTIVEC_BUILTIN_VEC_UNPACKL, ALTIVEC_BUILTIN_VUPKLSH,
 
11780
     RS6000_BTI_bool_V4SI, RS6000_BTI_bool_V8HI, 0, 0 },
 
11781
+  { ALTIVEC_BUILTIN_VEC_UNPACKL, P8V_BUILTIN_VUPKLSW,
 
11782
+    RS6000_BTI_V2DI, RS6000_BTI_V4SI, 0, 0 },
 
11783
+  { ALTIVEC_BUILTIN_VEC_UNPACKL, P8V_BUILTIN_VUPKLSW,
 
11784
+    RS6000_BTI_bool_V2DI, RS6000_BTI_bool_V4SI, 0, 0 },
 
11785
   { ALTIVEC_BUILTIN_VEC_VUPKLPX, ALTIVEC_BUILTIN_VUPKLPX,
 
11786
     RS6000_BTI_unsigned_V4SI, RS6000_BTI_unsigned_V8HI, 0, 0 },
 
11787
   { ALTIVEC_BUILTIN_VEC_VUPKLPX, ALTIVEC_BUILTIN_VUPKLPX,
 
11788
@@ -651,6 +688,18 @@
 
11789
     RS6000_BTI_unsigned_V4SI, RS6000_BTI_unsigned_V4SI, RS6000_BTI_bool_V4SI, 0 },
 
11790
   { ALTIVEC_BUILTIN_VEC_ADD, ALTIVEC_BUILTIN_VADDUWM,
 
11791
     RS6000_BTI_unsigned_V4SI, RS6000_BTI_unsigned_V4SI, RS6000_BTI_unsigned_V4SI, 0 },
 
11792
+  { ALTIVEC_BUILTIN_VEC_ADD, P8V_BUILTIN_VADDUDM,
 
11793
+    RS6000_BTI_V2DI, RS6000_BTI_bool_V2DI, RS6000_BTI_V2DI, 0 },
 
11794
+  { ALTIVEC_BUILTIN_VEC_ADD, P8V_BUILTIN_VADDUDM,
 
11795
+    RS6000_BTI_V2DI, RS6000_BTI_V2DI, RS6000_BTI_bool_V2DI, 0 },
 
11796
+  { ALTIVEC_BUILTIN_VEC_ADD, P8V_BUILTIN_VADDUDM,
 
11797
+    RS6000_BTI_V2DI, RS6000_BTI_V2DI, RS6000_BTI_V2DI, 0 },
 
11798
+  { ALTIVEC_BUILTIN_VEC_ADD, P8V_BUILTIN_VADDUDM,
 
11799
+    RS6000_BTI_unsigned_V2DI, RS6000_BTI_bool_V2DI, RS6000_BTI_unsigned_V2DI, 0 },
 
11800
+  { ALTIVEC_BUILTIN_VEC_ADD, P8V_BUILTIN_VADDUDM,
 
11801
+    RS6000_BTI_unsigned_V2DI, RS6000_BTI_unsigned_V2DI, RS6000_BTI_bool_V2DI, 0 },
 
11802
+  { ALTIVEC_BUILTIN_VEC_ADD, P8V_BUILTIN_VADDUDM,
 
11803
+    RS6000_BTI_unsigned_V2DI, RS6000_BTI_unsigned_V2DI, RS6000_BTI_unsigned_V2DI, 0 },
 
11804
   { ALTIVEC_BUILTIN_VEC_ADD, ALTIVEC_BUILTIN_VADDFP,
 
11805
     RS6000_BTI_V4SF, RS6000_BTI_V4SF, RS6000_BTI_V4SF, 0 },
 
11806
   { ALTIVEC_BUILTIN_VEC_ADD, VSX_BUILTIN_XVADDDP,
 
11807
@@ -937,6 +986,10 @@
 
11808
     RS6000_BTI_bool_V4SI, RS6000_BTI_V4SI, RS6000_BTI_V4SI, 0 },
 
11809
   { ALTIVEC_BUILTIN_VEC_CMPEQ, ALTIVEC_BUILTIN_VCMPEQUW,
 
11810
     RS6000_BTI_bool_V4SI, RS6000_BTI_unsigned_V4SI, RS6000_BTI_unsigned_V4SI, 0 },
 
11811
+  { ALTIVEC_BUILTIN_VEC_CMPEQ, P8V_BUILTIN_VCMPEQUD,
 
11812
+    RS6000_BTI_bool_V2DI, RS6000_BTI_V2DI, RS6000_BTI_V2DI, 0 },
 
11813
+  { ALTIVEC_BUILTIN_VEC_CMPEQ, P8V_BUILTIN_VCMPEQUD,
 
11814
+    RS6000_BTI_bool_V2DI, RS6000_BTI_unsigned_V2DI, RS6000_BTI_unsigned_V2DI, 0 },
 
11815
   { ALTIVEC_BUILTIN_VEC_CMPEQ, ALTIVEC_BUILTIN_VCMPEQFP,
 
11816
     RS6000_BTI_bool_V4SI, RS6000_BTI_V4SF, RS6000_BTI_V4SF, 0 },
 
11817
   { ALTIVEC_BUILTIN_VEC_CMPEQ, VSX_BUILTIN_XVCMPEQDP,
 
11818
@@ -975,6 +1028,10 @@
 
11819
     RS6000_BTI_bool_V4SI, RS6000_BTI_unsigned_V4SI, RS6000_BTI_unsigned_V4SI, 0 },
 
11820
   { ALTIVEC_BUILTIN_VEC_CMPGT, ALTIVEC_BUILTIN_VCMPGTSW,
 
11821
     RS6000_BTI_bool_V4SI, RS6000_BTI_V4SI, RS6000_BTI_V4SI, 0 },
 
11822
+  { ALTIVEC_BUILTIN_VEC_CMPGT, P8V_BUILTIN_VCMPGTUD,
 
11823
+    RS6000_BTI_bool_V2DI, RS6000_BTI_unsigned_V2DI, RS6000_BTI_unsigned_V2DI, 0 },
 
11824
+  { ALTIVEC_BUILTIN_VEC_CMPGT, P8V_BUILTIN_VCMPGTSD,
 
11825
+    RS6000_BTI_bool_V2DI, RS6000_BTI_V2DI, RS6000_BTI_V2DI, 0 },
 
11826
   { ALTIVEC_BUILTIN_VEC_CMPGT, ALTIVEC_BUILTIN_VCMPGTFP,
 
11827
     RS6000_BTI_bool_V4SI, RS6000_BTI_V4SF, RS6000_BTI_V4SF, 0 },
 
11828
   { ALTIVEC_BUILTIN_VEC_CMPGT, VSX_BUILTIN_XVCMPGTDP,
 
11829
@@ -1021,6 +1078,10 @@
 
11830
     RS6000_BTI_bool_V4SI, RS6000_BTI_unsigned_V4SI, RS6000_BTI_unsigned_V4SI, 0 },
 
11831
   { ALTIVEC_BUILTIN_VEC_CMPLT, ALTIVEC_BUILTIN_VCMPGTSW,
 
11832
     RS6000_BTI_bool_V4SI, RS6000_BTI_V4SI, RS6000_BTI_V4SI, 0 },
 
11833
+  { ALTIVEC_BUILTIN_VEC_CMPLT, P8V_BUILTIN_VCMPGTUD,
 
11834
+    RS6000_BTI_bool_V2DI, RS6000_BTI_unsigned_V2DI, RS6000_BTI_unsigned_V2DI, 0 },
 
11835
+  { ALTIVEC_BUILTIN_VEC_CMPLT, P8V_BUILTIN_VCMPGTSD,
 
11836
+    RS6000_BTI_bool_V2DI, RS6000_BTI_V2DI, RS6000_BTI_V2DI, 0 },
 
11837
   { ALTIVEC_BUILTIN_VEC_CMPLT, ALTIVEC_BUILTIN_VCMPGTFP,
 
11838
     RS6000_BTI_bool_V4SI, RS6000_BTI_V4SF, RS6000_BTI_V4SF, 0 },
 
11839
   { ALTIVEC_BUILTIN_VEC_CMPLT, VSX_BUILTIN_XVCMPGTDP,
 
11840
@@ -1418,6 +1479,18 @@
 
11841
     RS6000_BTI_V4SI, RS6000_BTI_V4SI, RS6000_BTI_bool_V4SI, 0 },
 
11842
   { ALTIVEC_BUILTIN_VEC_MAX, ALTIVEC_BUILTIN_VMAXSW,
 
11843
     RS6000_BTI_V4SI, RS6000_BTI_V4SI, RS6000_BTI_V4SI, 0 },
 
11844
+  { ALTIVEC_BUILTIN_VEC_MAX, P8V_BUILTIN_VMAXUD,
 
11845
+    RS6000_BTI_unsigned_V2DI, RS6000_BTI_bool_V2DI, RS6000_BTI_unsigned_V2DI, 0 },
 
11846
+  { ALTIVEC_BUILTIN_VEC_MAX, P8V_BUILTIN_VMAXUD,
 
11847
+    RS6000_BTI_unsigned_V2DI, RS6000_BTI_unsigned_V2DI, RS6000_BTI_bool_V2DI, 0 },
 
11848
+  { ALTIVEC_BUILTIN_VEC_MAX, P8V_BUILTIN_VMAXUD,
 
11849
+    RS6000_BTI_unsigned_V2DI, RS6000_BTI_unsigned_V2DI, RS6000_BTI_unsigned_V2DI, 0 },
 
11850
+  { ALTIVEC_BUILTIN_VEC_MAX, P8V_BUILTIN_VMAXSD,
 
11851
+    RS6000_BTI_V2DI, RS6000_BTI_bool_V2DI, RS6000_BTI_V2DI, 0 },
 
11852
+  { ALTIVEC_BUILTIN_VEC_MAX, P8V_BUILTIN_VMAXSD,
 
11853
+    RS6000_BTI_V2DI, RS6000_BTI_V2DI, RS6000_BTI_bool_V2DI, 0 },
 
11854
+  { ALTIVEC_BUILTIN_VEC_MAX, P8V_BUILTIN_VMAXSD,
 
11855
+    RS6000_BTI_V2DI, RS6000_BTI_V2DI, RS6000_BTI_V2DI, 0 },
 
11856
   { ALTIVEC_BUILTIN_VEC_MAX, ALTIVEC_BUILTIN_VMAXFP,
 
11857
     RS6000_BTI_V4SF, RS6000_BTI_V4SF, RS6000_BTI_V4SF, 0 },
 
11858
   { ALTIVEC_BUILTIN_VEC_MAX, VSX_BUILTIN_XVMAXDP,
 
11859
@@ -1604,6 +1677,18 @@
 
11860
     RS6000_BTI_V4SI, RS6000_BTI_V4SI, RS6000_BTI_bool_V4SI, 0 },
 
11861
   { ALTIVEC_BUILTIN_VEC_MIN, ALTIVEC_BUILTIN_VMINSW,
 
11862
     RS6000_BTI_V4SI, RS6000_BTI_V4SI, RS6000_BTI_V4SI, 0 },
 
11863
+  { ALTIVEC_BUILTIN_VEC_MIN, P8V_BUILTIN_VMINUD,
 
11864
+    RS6000_BTI_unsigned_V2DI, RS6000_BTI_bool_V2DI, RS6000_BTI_unsigned_V2DI, 0 },
 
11865
+  { ALTIVEC_BUILTIN_VEC_MIN, P8V_BUILTIN_VMINUD,
 
11866
+    RS6000_BTI_unsigned_V2DI, RS6000_BTI_unsigned_V2DI, RS6000_BTI_bool_V2DI, 0 },
 
11867
+  { ALTIVEC_BUILTIN_VEC_MIN, P8V_BUILTIN_VMINUD,
 
11868
+    RS6000_BTI_unsigned_V2DI, RS6000_BTI_unsigned_V2DI, RS6000_BTI_unsigned_V2DI, 0 },
 
11869
+  { ALTIVEC_BUILTIN_VEC_MIN, P8V_BUILTIN_VMINSD,
 
11870
+    RS6000_BTI_V2DI, RS6000_BTI_bool_V2DI, RS6000_BTI_V2DI, 0 },
 
11871
+  { ALTIVEC_BUILTIN_VEC_MIN, P8V_BUILTIN_VMINSD,
 
11872
+    RS6000_BTI_V2DI, RS6000_BTI_V2DI, RS6000_BTI_bool_V2DI, 0 },
 
11873
+  { ALTIVEC_BUILTIN_VEC_MIN, P8V_BUILTIN_VMINSD,
 
11874
+    RS6000_BTI_V2DI, RS6000_BTI_V2DI, RS6000_BTI_V2DI, 0 },
 
11875
   { ALTIVEC_BUILTIN_VEC_MIN, ALTIVEC_BUILTIN_VMINFP,
 
11876
     RS6000_BTI_V4SF, RS6000_BTI_V4SF, RS6000_BTI_V4SF, 0 },
 
11877
   { ALTIVEC_BUILTIN_VEC_MIN, VSX_BUILTIN_XVMINDP,
 
11878
@@ -1786,6 +1871,12 @@
 
11879
     RS6000_BTI_unsigned_V8HI, RS6000_BTI_unsigned_V4SI, RS6000_BTI_unsigned_V4SI, 0 },
 
11880
   { ALTIVEC_BUILTIN_VEC_PACK, ALTIVEC_BUILTIN_VPKUWUM,
 
11881
     RS6000_BTI_bool_V8HI, RS6000_BTI_bool_V4SI, RS6000_BTI_bool_V4SI, 0 },
 
11882
+  { ALTIVEC_BUILTIN_VEC_PACK, P8V_BUILTIN_VPKUDUM,
 
11883
+    RS6000_BTI_V4SI, RS6000_BTI_V2DI, RS6000_BTI_V2DI, 0 },
 
11884
+  { ALTIVEC_BUILTIN_VEC_PACK, P8V_BUILTIN_VPKUDUM,
 
11885
+    RS6000_BTI_unsigned_V4SI, RS6000_BTI_unsigned_V2DI, RS6000_BTI_unsigned_V2DI, 0 },
 
11886
+  { ALTIVEC_BUILTIN_VEC_PACK, P8V_BUILTIN_VPKUDUM,
 
11887
+    RS6000_BTI_bool_V4SI, RS6000_BTI_bool_V2DI, RS6000_BTI_bool_V2DI, 0 },
 
11888
   { ALTIVEC_BUILTIN_VEC_VPKUWUM, ALTIVEC_BUILTIN_VPKUWUM,
 
11889
     RS6000_BTI_V8HI, RS6000_BTI_V4SI, RS6000_BTI_V4SI, 0 },
 
11890
   { ALTIVEC_BUILTIN_VEC_VPKUWUM, ALTIVEC_BUILTIN_VPKUWUM,
 
11891
@@ -1812,6 +1903,10 @@
 
11892
     RS6000_BTI_V8HI, RS6000_BTI_V4SI, RS6000_BTI_V4SI, 0 },
 
11893
   { ALTIVEC_BUILTIN_VEC_VPKUWUS, ALTIVEC_BUILTIN_VPKUWUS,
 
11894
     RS6000_BTI_unsigned_V8HI, RS6000_BTI_unsigned_V4SI, RS6000_BTI_unsigned_V4SI, 0 },
 
11895
+  { ALTIVEC_BUILTIN_VEC_PACKS, P8V_BUILTIN_VPKUDUS,
 
11896
+    RS6000_BTI_unsigned_V4SI, RS6000_BTI_unsigned_V2DI, RS6000_BTI_unsigned_V2DI, 0 },
 
11897
+  { ALTIVEC_BUILTIN_VEC_PACKS, P8V_BUILTIN_VPKSDSS,
 
11898
+    RS6000_BTI_V4SI, RS6000_BTI_V2DI, RS6000_BTI_V2DI, 0 },
 
11899
   { ALTIVEC_BUILTIN_VEC_VPKSHSS, ALTIVEC_BUILTIN_VPKSHSS,
 
11900
     RS6000_BTI_V16QI, RS6000_BTI_V8HI, RS6000_BTI_V8HI, 0 },
 
11901
   { ALTIVEC_BUILTIN_VEC_VPKUHUS, ALTIVEC_BUILTIN_VPKUHUS,
 
11902
@@ -1824,6 +1919,8 @@
 
11903
     RS6000_BTI_unsigned_V8HI, RS6000_BTI_unsigned_V4SI, RS6000_BTI_unsigned_V4SI, 0 },
 
11904
   { ALTIVEC_BUILTIN_VEC_PACKSU, ALTIVEC_BUILTIN_VPKSWUS,
 
11905
     RS6000_BTI_unsigned_V8HI, RS6000_BTI_V4SI, RS6000_BTI_V4SI, 0 },
 
11906
+  { ALTIVEC_BUILTIN_VEC_PACKSU, P8V_BUILTIN_VPKSDUS,
 
11907
+    RS6000_BTI_unsigned_V4SI, RS6000_BTI_V2DI, RS6000_BTI_V2DI, 0 },
 
11908
   { ALTIVEC_BUILTIN_VEC_VPKSWUS, ALTIVEC_BUILTIN_VPKSWUS,
 
11909
     RS6000_BTI_unsigned_V8HI, RS6000_BTI_V4SI, RS6000_BTI_V4SI, 0 },
 
11910
   { ALTIVEC_BUILTIN_VEC_VPKSHUS, ALTIVEC_BUILTIN_VPKSHUS,
 
11911
@@ -1844,6 +1941,10 @@
 
11912
     RS6000_BTI_V4SI, RS6000_BTI_V4SI, RS6000_BTI_unsigned_V4SI, 0 },
 
11913
   { ALTIVEC_BUILTIN_VEC_RL, ALTIVEC_BUILTIN_VRLW,
 
11914
     RS6000_BTI_unsigned_V4SI, RS6000_BTI_unsigned_V4SI, RS6000_BTI_unsigned_V4SI, 0 },
 
11915
+  { ALTIVEC_BUILTIN_VEC_RL, P8V_BUILTIN_VRLD,
 
11916
+    RS6000_BTI_V2DI, RS6000_BTI_V2DI, RS6000_BTI_unsigned_V2DI, 0 },
 
11917
+  { ALTIVEC_BUILTIN_VEC_RL, P8V_BUILTIN_VRLD,
 
11918
+    RS6000_BTI_unsigned_V2DI, RS6000_BTI_unsigned_V2DI, RS6000_BTI_unsigned_V2DI, 0 },
 
11919
   { ALTIVEC_BUILTIN_VEC_VRLW, ALTIVEC_BUILTIN_VRLW,
 
11920
     RS6000_BTI_V4SI, RS6000_BTI_V4SI, RS6000_BTI_unsigned_V4SI, 0 },
 
11921
   { ALTIVEC_BUILTIN_VEC_VRLW, ALTIVEC_BUILTIN_VRLW,
 
11922
@@ -1868,6 +1969,10 @@
 
11923
     RS6000_BTI_V4SI, RS6000_BTI_V4SI, RS6000_BTI_unsigned_V4SI, 0 },
 
11924
   { ALTIVEC_BUILTIN_VEC_SL, ALTIVEC_BUILTIN_VSLW,
 
11925
     RS6000_BTI_unsigned_V4SI, RS6000_BTI_unsigned_V4SI, RS6000_BTI_unsigned_V4SI, 0 },
 
11926
+  { ALTIVEC_BUILTIN_VEC_SL, P8V_BUILTIN_VSLD,
 
11927
+    RS6000_BTI_V2DI, RS6000_BTI_V2DI, RS6000_BTI_unsigned_V2DI, 0 },
 
11928
+  { ALTIVEC_BUILTIN_VEC_SL, P8V_BUILTIN_VSLD,
 
11929
+    RS6000_BTI_unsigned_V2DI, RS6000_BTI_unsigned_V2DI, RS6000_BTI_unsigned_V2DI, 0 },
 
11930
   { ALTIVEC_BUILTIN_VEC_SQRT, VSX_BUILTIN_XVSQRTDP,
 
11931
     RS6000_BTI_V2DF, RS6000_BTI_V2DF, 0, 0 },
 
11932
   { ALTIVEC_BUILTIN_VEC_SQRT, VSX_BUILTIN_XVSQRTSP,
 
11933
@@ -2032,6 +2137,10 @@
 
11934
     RS6000_BTI_V4SI, RS6000_BTI_V4SI, RS6000_BTI_unsigned_V4SI, 0 },
 
11935
   { ALTIVEC_BUILTIN_VEC_SR, ALTIVEC_BUILTIN_VSRW,
 
11936
     RS6000_BTI_unsigned_V4SI, RS6000_BTI_unsigned_V4SI, RS6000_BTI_unsigned_V4SI, 0 },
 
11937
+  { ALTIVEC_BUILTIN_VEC_SR, P8V_BUILTIN_VSRD,
 
11938
+    RS6000_BTI_V2DI, RS6000_BTI_V2DI, RS6000_BTI_unsigned_V2DI, 0 },
 
11939
+  { ALTIVEC_BUILTIN_VEC_SR, P8V_BUILTIN_VSRD,
 
11940
+    RS6000_BTI_unsigned_V2DI, RS6000_BTI_unsigned_V2DI, RS6000_BTI_unsigned_V2DI, 0 },
 
11941
   { ALTIVEC_BUILTIN_VEC_VSRW, ALTIVEC_BUILTIN_VSRW,
 
11942
     RS6000_BTI_V4SI, RS6000_BTI_V4SI, RS6000_BTI_unsigned_V4SI, 0 },
 
11943
   { ALTIVEC_BUILTIN_VEC_VSRW, ALTIVEC_BUILTIN_VSRW,
 
11944
@@ -2056,6 +2165,10 @@
 
11945
     RS6000_BTI_V4SI, RS6000_BTI_V4SI, RS6000_BTI_unsigned_V4SI, 0 },
 
11946
   { ALTIVEC_BUILTIN_VEC_SRA, ALTIVEC_BUILTIN_VSRAW,
 
11947
     RS6000_BTI_unsigned_V4SI, RS6000_BTI_unsigned_V4SI, RS6000_BTI_unsigned_V4SI, 0 },
 
11948
+  { ALTIVEC_BUILTIN_VEC_SRA, P8V_BUILTIN_VSRAD,
 
11949
+    RS6000_BTI_V2DI, RS6000_BTI_V2DI, RS6000_BTI_unsigned_V2DI, 0 },
 
11950
+  { ALTIVEC_BUILTIN_VEC_SRA, P8V_BUILTIN_VSRD,
 
11951
+    RS6000_BTI_unsigned_V2DI, RS6000_BTI_unsigned_V2DI, RS6000_BTI_unsigned_V2DI, 0 },
 
11952
   { ALTIVEC_BUILTIN_VEC_VSRAW, ALTIVEC_BUILTIN_VSRAW,
 
11953
     RS6000_BTI_V4SI, RS6000_BTI_V4SI, RS6000_BTI_unsigned_V4SI, 0 },
 
11954
   { ALTIVEC_BUILTIN_VEC_VSRAW, ALTIVEC_BUILTIN_VSRAW,
 
11955
@@ -2196,6 +2309,18 @@
 
11956
     RS6000_BTI_unsigned_V4SI, RS6000_BTI_unsigned_V4SI, RS6000_BTI_bool_V4SI, 0 },
 
11957
   { ALTIVEC_BUILTIN_VEC_SUB, ALTIVEC_BUILTIN_VSUBUWM,
 
11958
     RS6000_BTI_unsigned_V4SI, RS6000_BTI_unsigned_V4SI, RS6000_BTI_unsigned_V4SI, 0 },
 
11959
+  { ALTIVEC_BUILTIN_VEC_SUB, P8V_BUILTIN_VSUBUDM,
 
11960
+    RS6000_BTI_V2DI, RS6000_BTI_bool_V2DI, RS6000_BTI_V2DI, 0 },
 
11961
+  { ALTIVEC_BUILTIN_VEC_SUB, P8V_BUILTIN_VSUBUDM,
 
11962
+    RS6000_BTI_V2DI, RS6000_BTI_V2DI, RS6000_BTI_bool_V2DI, 0 },
 
11963
+  { ALTIVEC_BUILTIN_VEC_SUB, P8V_BUILTIN_VSUBUDM,
 
11964
+    RS6000_BTI_V2DI, RS6000_BTI_V2DI, RS6000_BTI_V2DI, 0 },
 
11965
+  { ALTIVEC_BUILTIN_VEC_SUB, P8V_BUILTIN_VSUBUDM,
 
11966
+    RS6000_BTI_unsigned_V2DI, RS6000_BTI_bool_V2DI, RS6000_BTI_unsigned_V2DI, 0 },
 
11967
+  { ALTIVEC_BUILTIN_VEC_SUB, P8V_BUILTIN_VSUBUDM,
 
11968
+    RS6000_BTI_unsigned_V2DI, RS6000_BTI_unsigned_V2DI, RS6000_BTI_bool_V2DI, 0 },
 
11969
+  { ALTIVEC_BUILTIN_VEC_SUB, P8V_BUILTIN_VSUBUDM,
 
11970
+    RS6000_BTI_unsigned_V2DI, RS6000_BTI_unsigned_V2DI, RS6000_BTI_unsigned_V2DI, 0 },
 
11971
   { ALTIVEC_BUILTIN_VEC_SUB, ALTIVEC_BUILTIN_VSUBFP,
 
11972
     RS6000_BTI_V4SF, RS6000_BTI_V4SF, RS6000_BTI_V4SF, 0 },
 
11973
   { ALTIVEC_BUILTIN_VEC_SUB, VSX_BUILTIN_XVSUBDP,
 
11974
@@ -3327,6 +3452,20 @@
 
11975
     RS6000_BTI_INTSI, RS6000_BTI_INTSI, RS6000_BTI_V4SI, RS6000_BTI_V4SI },
 
11976
   { ALTIVEC_BUILTIN_VEC_VCMPEQ_P, ALTIVEC_BUILTIN_VCMPEQUW_P,
 
11977
     RS6000_BTI_INTSI, RS6000_BTI_INTSI, RS6000_BTI_bool_V4SI, RS6000_BTI_bool_V4SI },
 
11978
+  { ALTIVEC_BUILTIN_VEC_VCMPEQ_P, P8V_BUILTIN_VCMPEQUD_P,
 
11979
+    RS6000_BTI_INTSI, RS6000_BTI_INTSI, RS6000_BTI_bool_V2DI, RS6000_BTI_unsigned_V2DI },
 
11980
+  { ALTIVEC_BUILTIN_VEC_VCMPEQ_P, P8V_BUILTIN_VCMPEQUD_P,
 
11981
+    RS6000_BTI_INTSI, RS6000_BTI_INTSI, RS6000_BTI_unsigned_V2DI, RS6000_BTI_bool_V2DI },
 
11982
+  { ALTIVEC_BUILTIN_VEC_VCMPEQ_P, P8V_BUILTIN_VCMPEQUD_P,
 
11983
+    RS6000_BTI_INTSI, RS6000_BTI_INTSI, RS6000_BTI_unsigned_V2DI, RS6000_BTI_unsigned_V2DI },
 
11984
+  { ALTIVEC_BUILTIN_VEC_VCMPEQ_P, P8V_BUILTIN_VCMPEQUD_P,
 
11985
+    RS6000_BTI_INTSI, RS6000_BTI_INTSI, RS6000_BTI_bool_V2DI, RS6000_BTI_V2DI },
 
11986
+  { ALTIVEC_BUILTIN_VEC_VCMPEQ_P, P8V_BUILTIN_VCMPEQUD_P,
 
11987
+    RS6000_BTI_INTSI, RS6000_BTI_INTSI, RS6000_BTI_V2DI, RS6000_BTI_bool_V2DI },
 
11988
+  { ALTIVEC_BUILTIN_VEC_VCMPEQ_P, P8V_BUILTIN_VCMPEQUD_P,
 
11989
+    RS6000_BTI_INTSI, RS6000_BTI_INTSI, RS6000_BTI_V2DI, RS6000_BTI_V2DI },
 
11990
+  { ALTIVEC_BUILTIN_VEC_VCMPEQ_P, P8V_BUILTIN_VCMPEQUD_P,
 
11991
+    RS6000_BTI_INTSI, RS6000_BTI_INTSI, RS6000_BTI_bool_V2DI, RS6000_BTI_bool_V2DI },
 
11992
   { ALTIVEC_BUILTIN_VEC_VCMPEQ_P, ALTIVEC_BUILTIN_VCMPEQFP_P,
 
11993
     RS6000_BTI_INTSI, RS6000_BTI_INTSI, RS6000_BTI_V4SF, RS6000_BTI_V4SF },
 
11994
   { ALTIVEC_BUILTIN_VEC_VCMPEQ_P, VSX_BUILTIN_XVCMPEQDP_P,
 
11995
@@ -3372,11 +3511,455 @@
 
11996
     RS6000_BTI_INTSI, RS6000_BTI_INTSI, RS6000_BTI_V4SI, RS6000_BTI_bool_V4SI },
 
11997
   { ALTIVEC_BUILTIN_VEC_VCMPGE_P, ALTIVEC_BUILTIN_VCMPGTSW_P,
 
11998
     RS6000_BTI_INTSI, RS6000_BTI_INTSI, RS6000_BTI_V4SI, RS6000_BTI_V4SI },
 
11999
+  { ALTIVEC_BUILTIN_VEC_VCMPGE_P, P8V_BUILTIN_VCMPGTUD_P,
 
12000
+    RS6000_BTI_INTSI, RS6000_BTI_INTSI, RS6000_BTI_bool_V2DI, RS6000_BTI_unsigned_V2DI },
 
12001
+  { ALTIVEC_BUILTIN_VEC_VCMPGE_P, P8V_BUILTIN_VCMPGTUD_P,
 
12002
+    RS6000_BTI_INTSI, RS6000_BTI_INTSI, RS6000_BTI_unsigned_V2DI, RS6000_BTI_bool_V2DI },
 
12003
+  { ALTIVEC_BUILTIN_VEC_VCMPGE_P, P8V_BUILTIN_VCMPGTUD_P,
 
12004
+    RS6000_BTI_INTSI, RS6000_BTI_INTSI, RS6000_BTI_unsigned_V2DI, RS6000_BTI_unsigned_V2DI },
 
12005
+  { ALTIVEC_BUILTIN_VEC_VCMPGE_P, P8V_BUILTIN_VCMPGTSD_P,
 
12006
+    RS6000_BTI_INTSI, RS6000_BTI_INTSI, RS6000_BTI_bool_V2DI, RS6000_BTI_V2DI },
 
12007
+  { ALTIVEC_BUILTIN_VEC_VCMPGE_P, P8V_BUILTIN_VCMPGTSD_P,
 
12008
+    RS6000_BTI_INTSI, RS6000_BTI_INTSI, RS6000_BTI_V2DI, RS6000_BTI_bool_V2DI },
 
12009
+  { ALTIVEC_BUILTIN_VEC_VCMPGE_P, P8V_BUILTIN_VCMPGTSD_P,
 
12010
+    RS6000_BTI_INTSI, RS6000_BTI_INTSI, RS6000_BTI_V2DI, RS6000_BTI_V2DI },
 
12011
   { ALTIVEC_BUILTIN_VEC_VCMPGE_P, ALTIVEC_BUILTIN_VCMPGEFP_P,
 
12012
     RS6000_BTI_INTSI, RS6000_BTI_INTSI, RS6000_BTI_V4SF, RS6000_BTI_V4SF },
 
12013
   { ALTIVEC_BUILTIN_VEC_VCMPGE_P, VSX_BUILTIN_XVCMPGEDP_P,
 
12014
     RS6000_BTI_INTSI, RS6000_BTI_INTSI, RS6000_BTI_V2DF, RS6000_BTI_V2DF },
 
12015
 
 
12016
+  /* Power8 vector overloaded functions.  */
 
12017
+  { P8V_BUILTIN_VEC_EQV, P8V_BUILTIN_EQV_V16QI,
 
12018
+    RS6000_BTI_V16QI, RS6000_BTI_bool_V16QI, RS6000_BTI_V16QI, 0 },
 
12019
+  { P8V_BUILTIN_VEC_EQV, P8V_BUILTIN_EQV_V16QI,
 
12020
+    RS6000_BTI_V16QI, RS6000_BTI_V16QI, RS6000_BTI_bool_V16QI, 0 },
 
12021
+  { P8V_BUILTIN_VEC_EQV, P8V_BUILTIN_EQV_V16QI,
 
12022
+    RS6000_BTI_V16QI, RS6000_BTI_V16QI, RS6000_BTI_V16QI, 0 },
 
12023
+  { P8V_BUILTIN_VEC_EQV, P8V_BUILTIN_EQV_V16QI,
 
12024
+    RS6000_BTI_unsigned_V16QI, RS6000_BTI_bool_V16QI,
 
12025
+    RS6000_BTI_unsigned_V16QI, 0 },
 
12026
+  { P8V_BUILTIN_VEC_EQV, P8V_BUILTIN_EQV_V16QI,
 
12027
+    RS6000_BTI_unsigned_V16QI, RS6000_BTI_unsigned_V16QI,
 
12028
+    RS6000_BTI_bool_V16QI, 0 },
 
12029
+  { P8V_BUILTIN_VEC_EQV, P8V_BUILTIN_EQV_V16QI,
 
12030
+    RS6000_BTI_unsigned_V16QI, RS6000_BTI_unsigned_V16QI,
 
12031
+    RS6000_BTI_unsigned_V16QI, 0 },
 
12032
+  { P8V_BUILTIN_VEC_EQV, P8V_BUILTIN_EQV_V8HI,
 
12033
+    RS6000_BTI_V8HI, RS6000_BTI_bool_V8HI, RS6000_BTI_V8HI, 0 },
 
12034
+  { P8V_BUILTIN_VEC_EQV, P8V_BUILTIN_EQV_V8HI,
 
12035
+    RS6000_BTI_V8HI, RS6000_BTI_V8HI, RS6000_BTI_bool_V8HI, 0 },
 
12036
+  { P8V_BUILTIN_VEC_EQV, P8V_BUILTIN_EQV_V8HI,
 
12037
+    RS6000_BTI_V8HI, RS6000_BTI_V8HI, RS6000_BTI_V8HI, 0 },
 
12038
+  { P8V_BUILTIN_VEC_EQV, P8V_BUILTIN_EQV_V8HI,
 
12039
+    RS6000_BTI_unsigned_V8HI, RS6000_BTI_bool_V8HI,
 
12040
+    RS6000_BTI_unsigned_V8HI, 0 },
 
12041
+  { P8V_BUILTIN_VEC_EQV, P8V_BUILTIN_EQV_V8HI,
 
12042
+    RS6000_BTI_unsigned_V8HI, RS6000_BTI_unsigned_V8HI,
 
12043
+    RS6000_BTI_bool_V8HI, 0 },
 
12044
+  { P8V_BUILTIN_VEC_EQV, P8V_BUILTIN_EQV_V8HI,
 
12045
+    RS6000_BTI_unsigned_V8HI, RS6000_BTI_unsigned_V8HI,
 
12046
+    RS6000_BTI_unsigned_V8HI, 0 },
 
12047
+  { P8V_BUILTIN_VEC_EQV, P8V_BUILTIN_EQV_V4SI,
 
12048
+    RS6000_BTI_V4SI, RS6000_BTI_bool_V4SI, RS6000_BTI_V4SI, 0 },
 
12049
+  { P8V_BUILTIN_VEC_EQV, P8V_BUILTIN_EQV_V4SI,
 
12050
+    RS6000_BTI_V4SI, RS6000_BTI_V4SI, RS6000_BTI_bool_V4SI, 0 },
 
12051
+  { P8V_BUILTIN_VEC_EQV, P8V_BUILTIN_EQV_V4SI,
 
12052
+    RS6000_BTI_V4SI, RS6000_BTI_V4SI, RS6000_BTI_V4SI, 0 },
 
12053
+  { P8V_BUILTIN_VEC_EQV, P8V_BUILTIN_EQV_V4SI,
 
12054
+    RS6000_BTI_unsigned_V4SI, RS6000_BTI_bool_V4SI,
 
12055
+    RS6000_BTI_unsigned_V4SI, 0 },
 
12056
+  { P8V_BUILTIN_VEC_EQV, P8V_BUILTIN_EQV_V4SI,
 
12057
+    RS6000_BTI_unsigned_V4SI, RS6000_BTI_unsigned_V4SI,
 
12058
+    RS6000_BTI_bool_V4SI, 0 },
 
12059
+  { P8V_BUILTIN_VEC_EQV, P8V_BUILTIN_EQV_V4SI,
 
12060
+    RS6000_BTI_unsigned_V4SI, RS6000_BTI_unsigned_V4SI,
 
12061
+    RS6000_BTI_unsigned_V4SI, 0 },
 
12062
+  { P8V_BUILTIN_VEC_EQV, P8V_BUILTIN_EQV_V2DI,
 
12063
+    RS6000_BTI_V2DI, RS6000_BTI_bool_V2DI, RS6000_BTI_V2DI, 0 },
 
12064
+  { P8V_BUILTIN_VEC_EQV, P8V_BUILTIN_EQV_V2DI,
 
12065
+    RS6000_BTI_V2DI, RS6000_BTI_V2DI, RS6000_BTI_bool_V2DI, 0 },
 
12066
+  { P8V_BUILTIN_VEC_EQV, P8V_BUILTIN_EQV_V2DI,
 
12067
+    RS6000_BTI_V2DI, RS6000_BTI_V2DI, RS6000_BTI_V2DI, 0 },
 
12068
+  { P8V_BUILTIN_VEC_EQV, P8V_BUILTIN_EQV_V2DI,
 
12069
+    RS6000_BTI_unsigned_V2DI, RS6000_BTI_bool_V2DI,
 
12070
+    RS6000_BTI_unsigned_V2DI, 0 },
 
12071
+  { P8V_BUILTIN_VEC_EQV, P8V_BUILTIN_EQV_V2DI,
 
12072
+    RS6000_BTI_unsigned_V2DI, RS6000_BTI_unsigned_V2DI,
 
12073
+    RS6000_BTI_bool_V2DI, 0 },
 
12074
+  { P8V_BUILTIN_VEC_EQV, P8V_BUILTIN_EQV_V2DI,
 
12075
+    RS6000_BTI_unsigned_V2DI, RS6000_BTI_unsigned_V2DI,
 
12076
+    RS6000_BTI_unsigned_V2DI, 0 },
 
12077
+  { P8V_BUILTIN_VEC_EQV, P8V_BUILTIN_EQV_V4SF,
 
12078
+    RS6000_BTI_V4SF, RS6000_BTI_V4SF, RS6000_BTI_V4SF, 0 },
 
12079
+  { P8V_BUILTIN_VEC_EQV, P8V_BUILTIN_EQV_V2DF,
 
12080
+    RS6000_BTI_V2DF, RS6000_BTI_V2DF, RS6000_BTI_V2DF, 0 },
 
12081
+
 
12082
+  { P8V_BUILTIN_VEC_NAND, P8V_BUILTIN_NAND_V16QI,
 
12083
+    RS6000_BTI_V16QI, RS6000_BTI_bool_V16QI, RS6000_BTI_V16QI, 0 },
 
12084
+  { P8V_BUILTIN_VEC_NAND, P8V_BUILTIN_NAND_V16QI,
 
12085
+    RS6000_BTI_V16QI, RS6000_BTI_V16QI, RS6000_BTI_bool_V16QI, 0 },
 
12086
+  { P8V_BUILTIN_VEC_NAND, P8V_BUILTIN_NAND_V16QI,
 
12087
+    RS6000_BTI_V16QI, RS6000_BTI_V16QI, RS6000_BTI_V16QI, 0 },
 
12088
+  { P8V_BUILTIN_VEC_NAND, P8V_BUILTIN_NAND_V16QI,
 
12089
+    RS6000_BTI_unsigned_V16QI, RS6000_BTI_bool_V16QI,
 
12090
+    RS6000_BTI_unsigned_V16QI, 0 },
 
12091
+  { P8V_BUILTIN_VEC_NAND, P8V_BUILTIN_NAND_V16QI,
 
12092
+    RS6000_BTI_unsigned_V16QI, RS6000_BTI_unsigned_V16QI,
 
12093
+    RS6000_BTI_bool_V16QI, 0 },
 
12094
+  { P8V_BUILTIN_VEC_NAND, P8V_BUILTIN_NAND_V16QI,
 
12095
+    RS6000_BTI_unsigned_V16QI, RS6000_BTI_unsigned_V16QI,
 
12096
+    RS6000_BTI_unsigned_V16QI, 0 },
 
12097
+  { P8V_BUILTIN_VEC_NAND, P8V_BUILTIN_NAND_V8HI,
 
12098
+    RS6000_BTI_V8HI, RS6000_BTI_bool_V8HI, RS6000_BTI_V8HI, 0 },
 
12099
+  { P8V_BUILTIN_VEC_NAND, P8V_BUILTIN_NAND_V8HI,
 
12100
+    RS6000_BTI_V8HI, RS6000_BTI_V8HI, RS6000_BTI_bool_V8HI, 0 },
 
12101
+  { P8V_BUILTIN_VEC_NAND, P8V_BUILTIN_NAND_V8HI,
 
12102
+    RS6000_BTI_V8HI, RS6000_BTI_V8HI, RS6000_BTI_V8HI, 0 },
 
12103
+  { P8V_BUILTIN_VEC_NAND, P8V_BUILTIN_NAND_V8HI,
 
12104
+    RS6000_BTI_unsigned_V8HI, RS6000_BTI_bool_V8HI,
 
12105
+    RS6000_BTI_unsigned_V8HI, 0 },
 
12106
+  { P8V_BUILTIN_VEC_NAND, P8V_BUILTIN_NAND_V8HI,
 
12107
+    RS6000_BTI_unsigned_V8HI, RS6000_BTI_unsigned_V8HI,
 
12108
+    RS6000_BTI_bool_V8HI, 0 },
 
12109
+  { P8V_BUILTIN_VEC_NAND, P8V_BUILTIN_NAND_V8HI,
 
12110
+    RS6000_BTI_unsigned_V8HI, RS6000_BTI_unsigned_V8HI,
 
12111
+    RS6000_BTI_unsigned_V8HI, 0 },
 
12112
+  { P8V_BUILTIN_VEC_NAND, P8V_BUILTIN_NAND_V4SI,
 
12113
+    RS6000_BTI_V4SI, RS6000_BTI_bool_V4SI, RS6000_BTI_V4SI, 0 },
 
12114
+  { P8V_BUILTIN_VEC_NAND, P8V_BUILTIN_NAND_V4SI,
 
12115
+    RS6000_BTI_V4SI, RS6000_BTI_V4SI, RS6000_BTI_bool_V4SI, 0 },
 
12116
+  { P8V_BUILTIN_VEC_NAND, P8V_BUILTIN_NAND_V4SI,
 
12117
+    RS6000_BTI_V4SI, RS6000_BTI_V4SI, RS6000_BTI_V4SI, 0 },
 
12118
+  { P8V_BUILTIN_VEC_NAND, P8V_BUILTIN_NAND_V4SI,
 
12119
+    RS6000_BTI_unsigned_V4SI, RS6000_BTI_bool_V4SI,
 
12120
+    RS6000_BTI_unsigned_V4SI, 0 },
 
12121
+  { P8V_BUILTIN_VEC_NAND, P8V_BUILTIN_NAND_V4SI,
 
12122
+    RS6000_BTI_unsigned_V4SI, RS6000_BTI_unsigned_V4SI,
 
12123
+    RS6000_BTI_bool_V4SI, 0 },
 
12124
+  { P8V_BUILTIN_VEC_NAND, P8V_BUILTIN_NAND_V4SI,
 
12125
+    RS6000_BTI_unsigned_V4SI, RS6000_BTI_unsigned_V4SI,
 
12126
+    RS6000_BTI_unsigned_V4SI, 0 },
 
12127
+  { P8V_BUILTIN_VEC_NAND, P8V_BUILTIN_NAND_V2DI,
 
12128
+    RS6000_BTI_V2DI, RS6000_BTI_bool_V2DI, RS6000_BTI_V2DI, 0 },
 
12129
+  { P8V_BUILTIN_VEC_NAND, P8V_BUILTIN_NAND_V2DI,
 
12130
+    RS6000_BTI_V2DI, RS6000_BTI_V2DI, RS6000_BTI_bool_V2DI, 0 },
 
12131
+  { P8V_BUILTIN_VEC_NAND, P8V_BUILTIN_NAND_V2DI,
 
12132
+    RS6000_BTI_V2DI, RS6000_BTI_V2DI, RS6000_BTI_V2DI, 0 },
 
12133
+  { P8V_BUILTIN_VEC_NAND, P8V_BUILTIN_NAND_V2DI,
 
12134
+    RS6000_BTI_unsigned_V2DI, RS6000_BTI_bool_V2DI,
 
12135
+    RS6000_BTI_unsigned_V2DI, 0 },
 
12136
+  { P8V_BUILTIN_VEC_NAND, P8V_BUILTIN_NAND_V2DI,
 
12137
+    RS6000_BTI_unsigned_V2DI, RS6000_BTI_unsigned_V2DI,
 
12138
+    RS6000_BTI_bool_V2DI, 0 },
 
12139
+  { P8V_BUILTIN_VEC_NAND, P8V_BUILTIN_NAND_V2DI,
 
12140
+    RS6000_BTI_unsigned_V2DI, RS6000_BTI_unsigned_V2DI,
 
12141
+    RS6000_BTI_unsigned_V2DI, 0 },
 
12142
+  { P8V_BUILTIN_VEC_NAND, P8V_BUILTIN_NAND_V4SF,
 
12143
+    RS6000_BTI_V4SF, RS6000_BTI_V4SF, RS6000_BTI_V4SF, 0 },
 
12144
+  { P8V_BUILTIN_VEC_NAND, P8V_BUILTIN_NAND_V2DF,
 
12145
+    RS6000_BTI_V2DF, RS6000_BTI_V2DF, RS6000_BTI_V2DF, 0 },
 
12146
+
 
12147
+  { P8V_BUILTIN_VEC_ORC, P8V_BUILTIN_ORC_V16QI,
 
12148
+    RS6000_BTI_V16QI, RS6000_BTI_bool_V16QI, RS6000_BTI_V16QI, 0 },
 
12149
+  { P8V_BUILTIN_VEC_ORC, P8V_BUILTIN_ORC_V16QI,
 
12150
+    RS6000_BTI_V16QI, RS6000_BTI_V16QI, RS6000_BTI_bool_V16QI, 0 },
 
12151
+  { P8V_BUILTIN_VEC_ORC, P8V_BUILTIN_ORC_V16QI,
 
12152
+    RS6000_BTI_V16QI, RS6000_BTI_V16QI, RS6000_BTI_V16QI, 0 },
 
12153
+  { P8V_BUILTIN_VEC_ORC, P8V_BUILTIN_ORC_V16QI,
 
12154
+    RS6000_BTI_unsigned_V16QI, RS6000_BTI_bool_V16QI,
 
12155
+    RS6000_BTI_unsigned_V16QI, 0 },
 
12156
+  { P8V_BUILTIN_VEC_ORC, P8V_BUILTIN_ORC_V16QI,
 
12157
+    RS6000_BTI_unsigned_V16QI, RS6000_BTI_unsigned_V16QI,
 
12158
+    RS6000_BTI_bool_V16QI, 0 },
 
12159
+  { P8V_BUILTIN_VEC_ORC, P8V_BUILTIN_ORC_V16QI,
 
12160
+    RS6000_BTI_unsigned_V16QI, RS6000_BTI_unsigned_V16QI,
 
12161
+    RS6000_BTI_unsigned_V16QI, 0 },
 
12162
+  { P8V_BUILTIN_VEC_ORC, P8V_BUILTIN_ORC_V8HI,
 
12163
+    RS6000_BTI_V8HI, RS6000_BTI_bool_V8HI, RS6000_BTI_V8HI, 0 },
 
12164
+  { P8V_BUILTIN_VEC_ORC, P8V_BUILTIN_ORC_V8HI,
 
12165
+    RS6000_BTI_V8HI, RS6000_BTI_V8HI, RS6000_BTI_bool_V8HI, 0 },
 
12166
+  { P8V_BUILTIN_VEC_ORC, P8V_BUILTIN_ORC_V8HI,
 
12167
+    RS6000_BTI_V8HI, RS6000_BTI_V8HI, RS6000_BTI_V8HI, 0 },
 
12168
+  { P8V_BUILTIN_VEC_ORC, P8V_BUILTIN_ORC_V8HI,
 
12169
+    RS6000_BTI_unsigned_V8HI, RS6000_BTI_bool_V8HI,
 
12170
+    RS6000_BTI_unsigned_V8HI, 0 },
 
12171
+  { P8V_BUILTIN_VEC_ORC, P8V_BUILTIN_ORC_V8HI,
 
12172
+    RS6000_BTI_unsigned_V8HI, RS6000_BTI_unsigned_V8HI,
 
12173
+    RS6000_BTI_bool_V8HI, 0 },
 
12174
+  { P8V_BUILTIN_VEC_ORC, P8V_BUILTIN_ORC_V8HI,
 
12175
+    RS6000_BTI_unsigned_V8HI, RS6000_BTI_unsigned_V8HI,
 
12176
+    RS6000_BTI_unsigned_V8HI, 0 },
 
12177
+  { P8V_BUILTIN_VEC_ORC, P8V_BUILTIN_ORC_V4SI,
 
12178
+    RS6000_BTI_V4SI, RS6000_BTI_bool_V4SI, RS6000_BTI_V4SI, 0 },
 
12179
+  { P8V_BUILTIN_VEC_ORC, P8V_BUILTIN_ORC_V4SI,
 
12180
+    RS6000_BTI_V4SI, RS6000_BTI_V4SI, RS6000_BTI_bool_V4SI, 0 },
 
12181
+  { P8V_BUILTIN_VEC_ORC, P8V_BUILTIN_ORC_V4SI,
 
12182
+    RS6000_BTI_V4SI, RS6000_BTI_V4SI, RS6000_BTI_V4SI, 0 },
 
12183
+  { P8V_BUILTIN_VEC_ORC, P8V_BUILTIN_ORC_V4SI,
 
12184
+    RS6000_BTI_unsigned_V4SI, RS6000_BTI_bool_V4SI,
 
12185
+    RS6000_BTI_unsigned_V4SI, 0 },
 
12186
+  { P8V_BUILTIN_VEC_ORC, P8V_BUILTIN_ORC_V4SI,
 
12187
+    RS6000_BTI_unsigned_V4SI, RS6000_BTI_unsigned_V4SI,
 
12188
+    RS6000_BTI_bool_V4SI, 0 },
 
12189
+  { P8V_BUILTIN_VEC_ORC, P8V_BUILTIN_ORC_V4SI,
 
12190
+    RS6000_BTI_unsigned_V4SI, RS6000_BTI_unsigned_V4SI,
 
12191
+    RS6000_BTI_unsigned_V4SI, 0 },
 
12192
+  { P8V_BUILTIN_VEC_ORC, P8V_BUILTIN_ORC_V2DI,
 
12193
+    RS6000_BTI_V2DI, RS6000_BTI_bool_V2DI, RS6000_BTI_V2DI, 0 },
 
12194
+  { P8V_BUILTIN_VEC_ORC, P8V_BUILTIN_ORC_V2DI,
 
12195
+    RS6000_BTI_V2DI, RS6000_BTI_V2DI, RS6000_BTI_bool_V2DI, 0 },
 
12196
+  { P8V_BUILTIN_VEC_ORC, P8V_BUILTIN_ORC_V2DI,
 
12197
+    RS6000_BTI_V2DI, RS6000_BTI_V2DI, RS6000_BTI_V2DI, 0 },
 
12198
+  { P8V_BUILTIN_VEC_ORC, P8V_BUILTIN_ORC_V2DI,
 
12199
+    RS6000_BTI_unsigned_V2DI, RS6000_BTI_bool_V2DI,
 
12200
+    RS6000_BTI_unsigned_V2DI, 0 },
 
12201
+  { P8V_BUILTIN_VEC_ORC, P8V_BUILTIN_ORC_V2DI,
 
12202
+    RS6000_BTI_unsigned_V2DI, RS6000_BTI_unsigned_V2DI,
 
12203
+    RS6000_BTI_bool_V2DI, 0 },
 
12204
+  { P8V_BUILTIN_VEC_ORC, P8V_BUILTIN_ORC_V2DI,
 
12205
+    RS6000_BTI_unsigned_V2DI, RS6000_BTI_unsigned_V2DI,
 
12206
+    RS6000_BTI_unsigned_V2DI, 0 },
 
12207
+  { P8V_BUILTIN_VEC_ORC, P8V_BUILTIN_ORC_V4SF,
 
12208
+    RS6000_BTI_V4SF, RS6000_BTI_V4SF, RS6000_BTI_V4SF, 0 },
 
12209
+  { P8V_BUILTIN_VEC_ORC, P8V_BUILTIN_ORC_V2DF,
 
12210
+    RS6000_BTI_V2DF, RS6000_BTI_V2DF, RS6000_BTI_V2DF, 0 },
 
12211
+
 
12212
+  { P8V_BUILTIN_VEC_VADDUDM, P8V_BUILTIN_VADDUDM,
 
12213
+    RS6000_BTI_V2DI, RS6000_BTI_bool_V2DI, RS6000_BTI_V2DI, 0 },
 
12214
+  { P8V_BUILTIN_VEC_VADDUDM, P8V_BUILTIN_VADDUDM,
 
12215
+    RS6000_BTI_V2DI, RS6000_BTI_V2DI, RS6000_BTI_bool_V2DI, 0 },
 
12216
+  { P8V_BUILTIN_VEC_VADDUDM, P8V_BUILTIN_VADDUDM,
 
12217
+    RS6000_BTI_V2DI, RS6000_BTI_V2DI, RS6000_BTI_V2DI, 0 },
 
12218
+  { P8V_BUILTIN_VEC_VADDUDM, P8V_BUILTIN_VADDUDM,
 
12219
+    RS6000_BTI_unsigned_V2DI, RS6000_BTI_bool_V2DI, RS6000_BTI_unsigned_V2DI, 0 },
 
12220
+  { P8V_BUILTIN_VEC_VADDUDM, P8V_BUILTIN_VADDUDM,
 
12221
+    RS6000_BTI_unsigned_V2DI, RS6000_BTI_unsigned_V2DI, RS6000_BTI_bool_V2DI, 0 },
 
12222
+  { P8V_BUILTIN_VEC_VADDUDM, P8V_BUILTIN_VADDUDM,
 
12223
+    RS6000_BTI_unsigned_V2DI, RS6000_BTI_unsigned_V2DI, RS6000_BTI_unsigned_V2DI, 0 },
 
12224
+
 
12225
+  { P8V_BUILTIN_VEC_VCLZ, P8V_BUILTIN_VCLZB,
 
12226
+    RS6000_BTI_V16QI, RS6000_BTI_V16QI, 0, 0 },
 
12227
+  { P8V_BUILTIN_VEC_VCLZ, P8V_BUILTIN_VCLZB,
 
12228
+    RS6000_BTI_unsigned_V16QI, RS6000_BTI_unsigned_V16QI, 0, 0 },
 
12229
+  { P8V_BUILTIN_VEC_VCLZ, P8V_BUILTIN_VCLZH,
 
12230
+    RS6000_BTI_V8HI, RS6000_BTI_V8HI, 0, 0 },
 
12231
+  { P8V_BUILTIN_VEC_VCLZ, P8V_BUILTIN_VCLZH,
 
12232
+    RS6000_BTI_unsigned_V8HI, RS6000_BTI_unsigned_V8HI, 0, 0 },
 
12233
+  { P8V_BUILTIN_VEC_VCLZ, P8V_BUILTIN_VCLZW,
 
12234
+    RS6000_BTI_V4SI, RS6000_BTI_V4SI, 0, 0 },
 
12235
+  { P8V_BUILTIN_VEC_VCLZ, P8V_BUILTIN_VCLZW,
 
12236
+    RS6000_BTI_unsigned_V4SI, RS6000_BTI_unsigned_V4SI, 0, 0 },
 
12237
+  { P8V_BUILTIN_VEC_VCLZ, P8V_BUILTIN_VCLZD,
 
12238
+    RS6000_BTI_V2DI, RS6000_BTI_V2DI, 0, 0 },
 
12239
+  { P8V_BUILTIN_VEC_VCLZ, P8V_BUILTIN_VCLZD,
 
12240
+    RS6000_BTI_unsigned_V2DI, RS6000_BTI_unsigned_V2DI, 0, 0 },
 
12241
+
 
12242
+  { P8V_BUILTIN_VEC_VCLZB, P8V_BUILTIN_VCLZB,
 
12243
+    RS6000_BTI_V16QI, RS6000_BTI_V16QI, 0, 0 },
 
12244
+  { P8V_BUILTIN_VEC_VCLZB, P8V_BUILTIN_VCLZB,
 
12245
+    RS6000_BTI_unsigned_V16QI, RS6000_BTI_unsigned_V16QI, 0, 0 },
 
12246
+
 
12247
+  { P8V_BUILTIN_VEC_VCLZH, P8V_BUILTIN_VCLZH,
 
12248
+    RS6000_BTI_V8HI, RS6000_BTI_V8HI, 0, 0 },
 
12249
+  { P8V_BUILTIN_VEC_VCLZH, P8V_BUILTIN_VCLZH,
 
12250
+    RS6000_BTI_unsigned_V8HI, RS6000_BTI_unsigned_V8HI, 0, 0 },
 
12251
+
 
12252
+  { P8V_BUILTIN_VEC_VCLZW, P8V_BUILTIN_VCLZW,
 
12253
+    RS6000_BTI_V4SI, RS6000_BTI_V4SI, 0, 0 },
 
12254
+  { P8V_BUILTIN_VEC_VCLZW, P8V_BUILTIN_VCLZW,
 
12255
+    RS6000_BTI_unsigned_V4SI, RS6000_BTI_unsigned_V4SI, 0, 0 },
 
12256
+
 
12257
+  { P8V_BUILTIN_VEC_VCLZD, P8V_BUILTIN_VCLZD,
 
12258
+    RS6000_BTI_V2DI, RS6000_BTI_V2DI, 0, 0 },
 
12259
+  { P8V_BUILTIN_VEC_VCLZD, P8V_BUILTIN_VCLZD,
 
12260
+    RS6000_BTI_unsigned_V2DI, RS6000_BTI_unsigned_V2DI, 0, 0 },
 
12261
+
 
12262
+  { P8V_BUILTIN_VEC_VGBBD, P8V_BUILTIN_VGBBD,
 
12263
+    RS6000_BTI_V16QI, RS6000_BTI_V16QI, 0, 0 },
 
12264
+  { P8V_BUILTIN_VEC_VGBBD, P8V_BUILTIN_VGBBD,
 
12265
+    RS6000_BTI_unsigned_V16QI, RS6000_BTI_unsigned_V16QI, 0, 0 },
 
12266
+
 
12267
+  { P8V_BUILTIN_VEC_VMINSD, P8V_BUILTIN_VMINSD,
 
12268
+    RS6000_BTI_V2DI, RS6000_BTI_bool_V2DI, RS6000_BTI_V2DI, 0 },
 
12269
+  { P8V_BUILTIN_VEC_VMINSD, P8V_BUILTIN_VMINSD,
 
12270
+    RS6000_BTI_V2DI, RS6000_BTI_V2DI, RS6000_BTI_bool_V2DI, 0 },
 
12271
+  { P8V_BUILTIN_VEC_VMINSD, P8V_BUILTIN_VMINSD,
 
12272
+    RS6000_BTI_V2DI, RS6000_BTI_V2DI, RS6000_BTI_V2DI, 0 },
 
12273
+
 
12274
+  { P8V_BUILTIN_VEC_VMAXSD, P8V_BUILTIN_VMAXSD,
 
12275
+    RS6000_BTI_V2DI, RS6000_BTI_bool_V2DI, RS6000_BTI_V2DI, 0 },
 
12276
+  { P8V_BUILTIN_VEC_VMAXSD, P8V_BUILTIN_VMAXSD,
 
12277
+    RS6000_BTI_V2DI, RS6000_BTI_V2DI, RS6000_BTI_bool_V2DI, 0 },
 
12278
+  { P8V_BUILTIN_VEC_VMAXSD, P8V_BUILTIN_VMAXSD,
 
12279
+    RS6000_BTI_V2DI, RS6000_BTI_V2DI, RS6000_BTI_V2DI, 0 },
 
12280
+
 
12281
+  { P8V_BUILTIN_VEC_VMINUD, P8V_BUILTIN_VMINUD,
 
12282
+    RS6000_BTI_unsigned_V2DI, RS6000_BTI_bool_V2DI,
 
12283
+    RS6000_BTI_unsigned_V2DI, 0 },
 
12284
+  { P8V_BUILTIN_VEC_VMINUD, P8V_BUILTIN_VMINUD,
 
12285
+    RS6000_BTI_unsigned_V2DI, RS6000_BTI_unsigned_V2DI,
 
12286
+    RS6000_BTI_bool_V2DI, 0 },
 
12287
+  { P8V_BUILTIN_VEC_VMINUD, P8V_BUILTIN_VMINUD,
 
12288
+    RS6000_BTI_unsigned_V2DI, RS6000_BTI_unsigned_V2DI,
 
12289
+    RS6000_BTI_unsigned_V2DI, 0 },
 
12290
+
 
12291
+  { P8V_BUILTIN_VEC_VMAXUD, P8V_BUILTIN_VMAXUD,
 
12292
+    RS6000_BTI_unsigned_V2DI, RS6000_BTI_bool_V2DI,
 
12293
+    RS6000_BTI_unsigned_V2DI, 0 },
 
12294
+  { P8V_BUILTIN_VEC_VMAXUD, P8V_BUILTIN_VMAXUD,
 
12295
+    RS6000_BTI_unsigned_V2DI, RS6000_BTI_unsigned_V2DI,
 
12296
+    RS6000_BTI_bool_V2DI, 0 },
 
12297
+  { P8V_BUILTIN_VEC_VMAXUD, P8V_BUILTIN_VMAXUD,
 
12298
+    RS6000_BTI_unsigned_V2DI, RS6000_BTI_unsigned_V2DI,
 
12299
+    RS6000_BTI_unsigned_V2DI, 0 },
 
12300
+
 
12301
+  { P8V_BUILTIN_VEC_VMRGEW, P8V_BUILTIN_VMRGEW,
 
12302
+    RS6000_BTI_V4SI, RS6000_BTI_V4SI, RS6000_BTI_V4SI, 0 },
 
12303
+  { P8V_BUILTIN_VEC_VMRGEW, P8V_BUILTIN_VMRGEW,
 
12304
+    RS6000_BTI_unsigned_V4SI, RS6000_BTI_unsigned_V4SI,
 
12305
+    RS6000_BTI_unsigned_V4SI, 0 },
 
12306
+
 
12307
+  { P8V_BUILTIN_VEC_VMRGOW, P8V_BUILTIN_VMRGOW,
 
12308
+    RS6000_BTI_V4SI, RS6000_BTI_V4SI, RS6000_BTI_V4SI, 0 },
 
12309
+  { P8V_BUILTIN_VEC_VMRGOW, P8V_BUILTIN_VMRGOW,
 
12310
+    RS6000_BTI_unsigned_V4SI, RS6000_BTI_unsigned_V4SI,
 
12311
+    RS6000_BTI_unsigned_V4SI, 0 },
 
12312
+
 
12313
+  { P8V_BUILTIN_VEC_VPOPCNT, P8V_BUILTIN_VPOPCNTB,
 
12314
+    RS6000_BTI_V16QI, RS6000_BTI_V16QI, 0, 0 },
 
12315
+  { P8V_BUILTIN_VEC_VPOPCNT, P8V_BUILTIN_VPOPCNTB,
 
12316
+    RS6000_BTI_unsigned_V16QI, RS6000_BTI_unsigned_V16QI, 0, 0 },
 
12317
+  { P8V_BUILTIN_VEC_VPOPCNT, P8V_BUILTIN_VPOPCNTH,
 
12318
+    RS6000_BTI_V8HI, RS6000_BTI_V8HI, 0, 0 },
 
12319
+  { P8V_BUILTIN_VEC_VPOPCNT, P8V_BUILTIN_VPOPCNTH,
 
12320
+    RS6000_BTI_unsigned_V8HI, RS6000_BTI_unsigned_V8HI, 0, 0 },
 
12321
+  { P8V_BUILTIN_VEC_VPOPCNT, P8V_BUILTIN_VPOPCNTW,
 
12322
+    RS6000_BTI_V4SI, RS6000_BTI_V4SI, 0, 0 },
 
12323
+  { P8V_BUILTIN_VEC_VPOPCNT, P8V_BUILTIN_VPOPCNTW,
 
12324
+    RS6000_BTI_unsigned_V4SI, RS6000_BTI_unsigned_V4SI, 0, 0 },
 
12325
+  { P8V_BUILTIN_VEC_VPOPCNT, P8V_BUILTIN_VPOPCNTD,
 
12326
+    RS6000_BTI_V2DI, RS6000_BTI_V2DI, 0, 0 },
 
12327
+  { P8V_BUILTIN_VEC_VPOPCNT, P8V_BUILTIN_VPOPCNTD,
 
12328
+    RS6000_BTI_unsigned_V2DI, RS6000_BTI_unsigned_V2DI, 0, 0 },
 
12329
+
 
12330
+  { P8V_BUILTIN_VEC_VPOPCNTB, P8V_BUILTIN_VPOPCNTB,
 
12331
+    RS6000_BTI_V16QI, RS6000_BTI_V16QI, 0, 0 },
 
12332
+  { P8V_BUILTIN_VEC_VPOPCNTB, P8V_BUILTIN_VPOPCNTB,
 
12333
+    RS6000_BTI_unsigned_V16QI, RS6000_BTI_unsigned_V16QI, 0, 0 },
 
12334
+
 
12335
+  { P8V_BUILTIN_VEC_VPOPCNTH, P8V_BUILTIN_VPOPCNTH,
 
12336
+    RS6000_BTI_V8HI, RS6000_BTI_V8HI, 0, 0 },
 
12337
+  { P8V_BUILTIN_VEC_VPOPCNTH, P8V_BUILTIN_VPOPCNTH,
 
12338
+    RS6000_BTI_unsigned_V8HI, RS6000_BTI_unsigned_V8HI, 0, 0 },
 
12339
+
 
12340
+  { P8V_BUILTIN_VEC_VPOPCNTW, P8V_BUILTIN_VPOPCNTW,
 
12341
+    RS6000_BTI_V4SI, RS6000_BTI_V4SI, 0, 0 },
 
12342
+  { P8V_BUILTIN_VEC_VPOPCNTW, P8V_BUILTIN_VPOPCNTW,
 
12343
+    RS6000_BTI_unsigned_V4SI, RS6000_BTI_unsigned_V4SI, 0, 0 },
 
12344
+
 
12345
+  { P8V_BUILTIN_VEC_VPOPCNTD, P8V_BUILTIN_VPOPCNTD,
 
12346
+    RS6000_BTI_V2DI, RS6000_BTI_V2DI, 0, 0 },
 
12347
+  { P8V_BUILTIN_VEC_VPOPCNTD, P8V_BUILTIN_VPOPCNTD,
 
12348
+    RS6000_BTI_unsigned_V2DI, RS6000_BTI_unsigned_V2DI, 0, 0 },
 
12349
+
 
12350
+  { P8V_BUILTIN_VEC_VPKUDUM, P8V_BUILTIN_VPKUDUM,
 
12351
+    RS6000_BTI_V4SI, RS6000_BTI_V2DI, RS6000_BTI_V2DI, 0 },
 
12352
+  { P8V_BUILTIN_VEC_VPKUDUM, P8V_BUILTIN_VPKUDUM,
 
12353
+    RS6000_BTI_unsigned_V4SI, RS6000_BTI_unsigned_V2DI, RS6000_BTI_unsigned_V2DI, 0 },
 
12354
+  { P8V_BUILTIN_VEC_VPKUDUM, P8V_BUILTIN_VPKUDUM,
 
12355
+    RS6000_BTI_bool_V4SI, RS6000_BTI_bool_V2DI, RS6000_BTI_bool_V2DI, 0 },
 
12356
+
 
12357
+  { P8V_BUILTIN_VEC_VPKSDSS, P8V_BUILTIN_VPKSDSS,
 
12358
+    RS6000_BTI_V4SI, RS6000_BTI_V2DI, RS6000_BTI_V2DI, 0 },
 
12359
+
 
12360
+  { P8V_BUILTIN_VEC_VPKUDUS, P8V_BUILTIN_VPKUDUS,
 
12361
+    RS6000_BTI_unsigned_V4SI, RS6000_BTI_unsigned_V2DI, RS6000_BTI_unsigned_V2DI, 0 },
 
12362
+
 
12363
+  { P8V_BUILTIN_VEC_VPKSDUS, P8V_BUILTIN_VPKSDUS,
 
12364
+    RS6000_BTI_unsigned_V4SI, RS6000_BTI_V2DI, RS6000_BTI_V2DI, 0 },
 
12365
+
 
12366
+  { P8V_BUILTIN_VEC_VRLD, P8V_BUILTIN_VRLD,
 
12367
+    RS6000_BTI_V2DI, RS6000_BTI_V2DI, RS6000_BTI_unsigned_V2DI, 0 },
 
12368
+  { P8V_BUILTIN_VEC_VRLD, P8V_BUILTIN_VRLD,
 
12369
+    RS6000_BTI_unsigned_V2DI, RS6000_BTI_unsigned_V2DI, RS6000_BTI_unsigned_V2DI, 0 },
 
12370
+
 
12371
+  { P8V_BUILTIN_VEC_VSLD, P8V_BUILTIN_VSLD,
 
12372
+    RS6000_BTI_V2DI, RS6000_BTI_V2DI, RS6000_BTI_unsigned_V2DI, 0 },
 
12373
+  { P8V_BUILTIN_VEC_VSLD, P8V_BUILTIN_VSLD,
 
12374
+    RS6000_BTI_unsigned_V2DI, RS6000_BTI_unsigned_V2DI, RS6000_BTI_unsigned_V2DI, 0 },
 
12375
+
 
12376
+  { P8V_BUILTIN_VEC_VSRD, P8V_BUILTIN_VSRD,
 
12377
+    RS6000_BTI_V2DI, RS6000_BTI_V2DI, RS6000_BTI_unsigned_V2DI, 0 },
 
12378
+  { P8V_BUILTIN_VEC_VSRD, P8V_BUILTIN_VSRD,
 
12379
+    RS6000_BTI_unsigned_V2DI, RS6000_BTI_unsigned_V2DI, RS6000_BTI_unsigned_V2DI, 0 },
 
12380
+
 
12381
+  { P8V_BUILTIN_VEC_VSRAD, P8V_BUILTIN_VSRAD,
 
12382
+    RS6000_BTI_V2DI, RS6000_BTI_V2DI, RS6000_BTI_unsigned_V2DI, 0 },
 
12383
+  { P8V_BUILTIN_VEC_VSRAD, P8V_BUILTIN_VSRD,
 
12384
+    RS6000_BTI_unsigned_V2DI, RS6000_BTI_unsigned_V2DI, RS6000_BTI_unsigned_V2DI, 0 },
 
12385
+
 
12386
+  { P8V_BUILTIN_VEC_VSUBUDM, P8V_BUILTIN_VSUBUDM,
 
12387
+    RS6000_BTI_V2DI, RS6000_BTI_bool_V2DI, RS6000_BTI_V2DI, 0 },
 
12388
+  { P8V_BUILTIN_VEC_VSUBUDM, P8V_BUILTIN_VSUBUDM,
 
12389
+    RS6000_BTI_V2DI, RS6000_BTI_V2DI, RS6000_BTI_bool_V2DI, 0 },
 
12390
+  { P8V_BUILTIN_VEC_VSUBUDM, P8V_BUILTIN_VSUBUDM,
 
12391
+    RS6000_BTI_V2DI, RS6000_BTI_V2DI, RS6000_BTI_V2DI, 0 },
 
12392
+  { P8V_BUILTIN_VEC_VSUBUDM, P8V_BUILTIN_VSUBUDM,
 
12393
+    RS6000_BTI_unsigned_V2DI, RS6000_BTI_bool_V2DI, RS6000_BTI_unsigned_V2DI, 0 },
 
12394
+  { P8V_BUILTIN_VEC_VSUBUDM, P8V_BUILTIN_VSUBUDM,
 
12395
+    RS6000_BTI_unsigned_V2DI, RS6000_BTI_unsigned_V2DI, RS6000_BTI_bool_V2DI, 0 },
 
12396
+  { P8V_BUILTIN_VEC_VSUBUDM, P8V_BUILTIN_VSUBUDM,
 
12397
+    RS6000_BTI_unsigned_V2DI, RS6000_BTI_unsigned_V2DI, RS6000_BTI_unsigned_V2DI, 0 },
 
12398
+
 
12399
+  { P8V_BUILTIN_VEC_VUPKHSW, P8V_BUILTIN_VUPKHSW,
 
12400
+    RS6000_BTI_V2DI, RS6000_BTI_V4SI, 0, 0 },
 
12401
+  { P8V_BUILTIN_VEC_VUPKHSW, P8V_BUILTIN_VUPKHSW,
 
12402
+    RS6000_BTI_bool_V2DI, RS6000_BTI_bool_V4SI, 0, 0 },
 
12403
+
 
12404
+  { P8V_BUILTIN_VEC_VUPKLSW, P8V_BUILTIN_VUPKLSW,
 
12405
+    RS6000_BTI_V2DI, RS6000_BTI_V4SI, 0, 0 },
 
12406
+  { P8V_BUILTIN_VEC_VUPKLSW, P8V_BUILTIN_VUPKLSW,
 
12407
+    RS6000_BTI_bool_V2DI, RS6000_BTI_bool_V4SI, 0, 0 },
 
12408
+
 
12409
+  { P8V_BUILTIN_VEC_VGBBD, P8V_BUILTIN_VGBBD,
 
12410
+    RS6000_BTI_V16QI, 0, 0, 0 },
 
12411
+  { P8V_BUILTIN_VEC_VGBBD, P8V_BUILTIN_VGBBD,
 
12412
+    RS6000_BTI_unsigned_V16QI, 0, 0, 0 },
 
12413
+
 
12414
+  /* Crypto builtins.  */
 
12415
+  { CRYPTO_BUILTIN_VPERMXOR, CRYPTO_BUILTIN_VPERMXOR_V16QI,
 
12416
+    RS6000_BTI_unsigned_V16QI, RS6000_BTI_unsigned_V16QI,
 
12417
+    RS6000_BTI_unsigned_V16QI, RS6000_BTI_unsigned_V16QI },
 
12418
+  { CRYPTO_BUILTIN_VPERMXOR, CRYPTO_BUILTIN_VPERMXOR_V8HI,
 
12419
+    RS6000_BTI_unsigned_V8HI, RS6000_BTI_unsigned_V8HI,
 
12420
+    RS6000_BTI_unsigned_V8HI, RS6000_BTI_unsigned_V8HI },
 
12421
+  { CRYPTO_BUILTIN_VPERMXOR, CRYPTO_BUILTIN_VPERMXOR_V4SI,
 
12422
+    RS6000_BTI_unsigned_V4SI, RS6000_BTI_unsigned_V4SI,
 
12423
+    RS6000_BTI_unsigned_V4SI, RS6000_BTI_unsigned_V4SI },
 
12424
+  { CRYPTO_BUILTIN_VPERMXOR, CRYPTO_BUILTIN_VPERMXOR_V2DI,
 
12425
+    RS6000_BTI_unsigned_V2DI, RS6000_BTI_unsigned_V2DI,
 
12426
+    RS6000_BTI_unsigned_V2DI, RS6000_BTI_unsigned_V2DI },
 
12427
+
 
12428
+  { CRYPTO_BUILTIN_VPMSUM, CRYPTO_BUILTIN_VPMSUMB,
 
12429
+    RS6000_BTI_unsigned_V16QI, RS6000_BTI_unsigned_V16QI,
 
12430
+    RS6000_BTI_unsigned_V16QI, 0 },
 
12431
+  { CRYPTO_BUILTIN_VPMSUM, CRYPTO_BUILTIN_VPMSUMH,
 
12432
+    RS6000_BTI_unsigned_V8HI, RS6000_BTI_unsigned_V8HI,
 
12433
+    RS6000_BTI_unsigned_V8HI, 0 },
 
12434
+  { CRYPTO_BUILTIN_VPMSUM, CRYPTO_BUILTIN_VPMSUMW,
 
12435
+    RS6000_BTI_unsigned_V4SI, RS6000_BTI_unsigned_V4SI,
 
12436
+    RS6000_BTI_unsigned_V4SI, 0 },
 
12437
+  { CRYPTO_BUILTIN_VPMSUM, CRYPTO_BUILTIN_VPMSUMD,
 
12438
+    RS6000_BTI_unsigned_V2DI, RS6000_BTI_unsigned_V2DI,
 
12439
+    RS6000_BTI_unsigned_V2DI, 0 },
 
12440
+
 
12441
+  { CRYPTO_BUILTIN_VSHASIGMA, CRYPTO_BUILTIN_VSHASIGMAW,
 
12442
+    RS6000_BTI_unsigned_V4SI, RS6000_BTI_unsigned_V4SI,
 
12443
+    RS6000_BTI_INTSI, RS6000_BTI_INTSI },
 
12444
+  { CRYPTO_BUILTIN_VSHASIGMA, CRYPTO_BUILTIN_VSHASIGMAD,
 
12445
+    RS6000_BTI_unsigned_V2DI, RS6000_BTI_unsigned_V2DI,
 
12446
+    RS6000_BTI_INTSI, RS6000_BTI_INTSI },
 
12447
+
 
12448
   { (enum rs6000_builtins) 0, (enum rs6000_builtins) 0, 0, 0, 0, 0 }
 
12449
 };
 
12450
 
 
12451
@@ -3824,7 +4407,8 @@
 
12452
        && (desc->op2 == RS6000_BTI_NOT_OPAQUE
 
12453
            || rs6000_builtin_type_compatible (types[1], desc->op2))
 
12454
        && (desc->op3 == RS6000_BTI_NOT_OPAQUE
 
12455
-           || rs6000_builtin_type_compatible (types[2], desc->op3)))
 
12456
+           || rs6000_builtin_type_compatible (types[2], desc->op3))
 
12457
+       && rs6000_builtin_decls[desc->overloaded_code] != NULL_TREE)
 
12458
       return altivec_build_resolved_builtin (args, n, desc);
 
12459
 
 
12460
  bad:
 
12461
--- a/src/gcc/config/rs6000/rs6000.opt
 
12462
+++ b/src/gcc/config/rs6000/rs6000.opt
 
12463
@@ -181,13 +181,16 @@
 
12464
 Target Report Mask(VSX) Var(rs6000_isa_flags)
 
12465
 Use vector/scalar (VSX) instructions
 
12466
 
 
12467
+mvsx-scalar-float
 
12468
+Target Undocumented Report Var(TARGET_VSX_SCALAR_FLOAT) Init(1)
 
12469
+; If -mpower8-vector, use VSX arithmetic instructions for SFmode (on by default)
 
12470
+
 
12471
 mvsx-scalar-double
 
12472
-Target Undocumented Report Var(TARGET_VSX_SCALAR_DOUBLE) Init(-1)
 
12473
-; If -mvsx, use VSX arithmetic instructions for scalar double (on by default)
 
12474
+Target Undocumented Report Var(TARGET_VSX_SCALAR_DOUBLE) Init(1)
 
12475
+; If -mvsx, use VSX arithmetic instructions for DFmode (on by default)
 
12476
 
 
12477
 mvsx-scalar-memory
 
12478
-Target Undocumented Report Var(TARGET_VSX_SCALAR_MEMORY)
 
12479
-; If -mvsx, use VSX scalar memory reference instructions for scalar double (off by default)
 
12480
+Target Undocumented Report Alias(mupper-regs-df)
 
12481
 
 
12482
 mvsx-align-128
 
12483
 Target Undocumented Report Var(TARGET_VSX_ALIGN_128)
 
12484
@@ -363,6 +366,14 @@
 
12485
 Target RejectNegative Var(rs6000_spe_abi, 0)
 
12486
 Do not use the SPE ABI extensions
 
12487
 
 
12488
+mabi=elfv1
 
12489
+Target RejectNegative Var(rs6000_elf_abi, 1) Save
 
12490
+Use the ELFv1 ABI
 
12491
+
 
12492
+mabi=elfv2
 
12493
+Target RejectNegative Var(rs6000_elf_abi, 2)
 
12494
+Use the ELFv2 ABI
 
12495
+
 
12496
 ; These are here for testing during development only, do not document
 
12497
 ; in the manual please.
 
12498
 
 
12499
@@ -514,3 +525,47 @@
 
12500
 msave-toc-indirect
 
12501
 Target Report Var(TARGET_SAVE_TOC_INDIRECT) Save
 
12502
 Control whether we save the TOC in the prologue for indirect calls or generate the save inline
 
12503
+
 
12504
+mvsx-timode
 
12505
+Target Undocumented Mask(VSX_TIMODE) Var(rs6000_isa_flags)
 
12506
+Allow 128-bit integers in VSX registers
 
12507
+
 
12508
+mpower8-fusion
 
12509
+Target Report Mask(P8_FUSION) Var(rs6000_isa_flags)
 
12510
+Fuse certain integer operations together for better performance on power8
 
12511
+
 
12512
+mpower8-fusion-sign
 
12513
+Target Undocumented Mask(P8_FUSION_SIGN) Var(rs6000_isa_flags)
 
12514
+Allow sign extension in fusion operations
 
12515
+
 
12516
+mpower8-vector
 
12517
+Target Report Mask(P8_VECTOR) Var(rs6000_isa_flags)
 
12518
+Use/do not use vector and scalar instructions added in ISA 2.07.
 
12519
+
 
12520
+mcrypto
 
12521
+Target Report Mask(CRYPTO) Var(rs6000_isa_flags)
 
12522
+Use ISA 2.07 crypto instructions
 
12523
+
 
12524
+mdirect-move
 
12525
+Target Report Mask(DIRECT_MOVE) Var(rs6000_isa_flags)
 
12526
+Use ISA 2.07 direct move between GPR & VSX register instructions
 
12527
+
 
12528
+mhtm
 
12529
+Target Report Mask(HTM) Var(rs6000_isa_flags)
 
12530
+Use ISA 2.07 transactional memory (HTM) instructions
 
12531
+
 
12532
+mquad-memory
 
12533
+Target Report Mask(QUAD_MEMORY) Var(rs6000_isa_flags)
 
12534
+Generate the quad word memory instructions (lq/stq/lqarx/stqcx).
 
12535
+
 
12536
+mcompat-align-parm
 
12537
+Target Report Var(rs6000_compat_align_parm) Init(1) Save
 
12538
+Generate aggregate parameter passing code with at most 64-bit alignment.
 
12539
+
 
12540
+mupper-regs-df
 
12541
+Target Undocumented Mask(UPPER_REGS_DF) Var(rs6000_isa_flags)
 
12542
+Allow double variables in upper registers with -mcpu=power7 or -mvsx
 
12543
+
 
12544
+mupper-regs-sf
 
12545
+Target Undocumented Mask(UPPER_REGS_SF) Var(rs6000_isa_flags)
 
12546
+Allow float variables in upper registers with -mcpu=power8 or -mp8-vector
 
12547
--- a/src/gcc/config/rs6000/linux64.h
 
12548
+++ b/src/gcc/config/rs6000/linux64.h
 
12549
@@ -25,9 +25,6 @@
 
12550
 
 
12551
 #ifndef RS6000_BI_ARCH
 
12552
 
 
12553
-#undef DEFAULT_ABI
 
12554
-#define        DEFAULT_ABI ABI_AIX
 
12555
-
 
12556
 #undef TARGET_64BIT
 
12557
 #define        TARGET_64BIT 1
 
12558
 
 
12559
@@ -74,7 +71,11 @@
 
12560
 #undef  PROCESSOR_DEFAULT
 
12561
 #define PROCESSOR_DEFAULT PROCESSOR_POWER7
 
12562
 #undef  PROCESSOR_DEFAULT64
 
12563
+#ifdef LINUX64_DEFAULT_ABI_ELFv2
 
12564
+#define PROCESSOR_DEFAULT64 PROCESSOR_POWER8
 
12565
+#else
 
12566
 #define PROCESSOR_DEFAULT64 PROCESSOR_POWER7
 
12567
+#endif
 
12568
 
 
12569
 /* We don't need to generate entries in .fixup, except when
 
12570
    -mrelocatable or -mrelocatable-lib is given.  */
 
12571
@@ -88,6 +89,12 @@
 
12572
 #define INVALID_64BIT "-m%s not supported in this configuration"
 
12573
 #define INVALID_32BIT INVALID_64BIT
 
12574
 
 
12575
+#ifdef LINUX64_DEFAULT_ABI_ELFv2
 
12576
+#define ELFv2_ABI_CHECK (rs6000_elf_abi != 1)
 
12577
+#else
 
12578
+#define ELFv2_ABI_CHECK (rs6000_elf_abi == 2)
 
12579
+#endif
 
12580
+
 
12581
 #undef SUBSUBTARGET_OVERRIDE_OPTIONS
 
12582
 #define        SUBSUBTARGET_OVERRIDE_OPTIONS                           \
 
12583
   do                                                           \
 
12584
@@ -102,6 +109,12 @@
 
12585
              error (INVALID_64BIT, "call");                    \
 
12586
            }                                                   \
 
12587
          dot_symbols = !strcmp (rs6000_abi_name, "aixdesc");   \
 
12588
+         if (ELFv2_ABI_CHECK)                                  \
 
12589
+           {                                                   \
 
12590
+             rs6000_current_abi = ABI_ELFv2;                   \
 
12591
+             if (dot_symbols)                                  \
 
12592
+               error ("-mcall-aixdesc incompatible with -mabi=elfv2"); \
 
12593
+           }                                                   \
 
12594
          if (rs6000_isa_flags & OPTION_MASK_RELOCATABLE)       \
 
12595
            {                                                   \
 
12596
              rs6000_isa_flags &= ~OPTION_MASK_RELOCATABLE;     \
 
12597
@@ -351,7 +364,11 @@
 
12598
 #define LINK_OS_DEFAULT_SPEC "%(link_os_linux)"
 
12599
 
 
12600
 #define GLIBC_DYNAMIC_LINKER32 "/lib/ld.so.1"
 
12601
-#define GLIBC_DYNAMIC_LINKER64 "/lib64/ld64.so.1"
 
12602
+#ifdef LINUX64_DEFAULT_ABI_ELFv2
 
12603
+#define GLIBC_DYNAMIC_LINKER64 "%{mabi=elfv1:/lib64/ld64.so.1;:/lib64/ld64.so.2}"
 
12604
+#else
 
12605
+#define GLIBC_DYNAMIC_LINKER64 "%{mabi=elfv2:/lib64/ld64.so.2;:/lib64/ld64.so.1}"
 
12606
+#endif
 
12607
 #define UCLIBC_DYNAMIC_LINKER32 "/lib/ld-uClibc.so.0"
 
12608
 #define UCLIBC_DYNAMIC_LINKER64 "/lib/ld64-uClibc.so.0"
 
12609
 #if DEFAULT_LIBC == LIBC_UCLIBC
 
12610
--- a/src/gcc/config/rs6000/darwin.h
 
12611
+++ b/src/gcc/config/rs6000/darwin.h
 
12612
@@ -205,7 +205,8 @@
 
12613
     "v24", "v25", "v26", "v27", "v28", "v29", "v30", "v31",             \
 
12614
     "vrsave", "vscr",                                                  \
 
12615
     "spe_acc", "spefscr",                                               \
 
12616
-    "sfp"                                                              \
 
12617
+    "sfp",                                                             \
 
12618
+    "tfhar", "tfiar", "texasr"                                         \
 
12619
 }
 
12620
 
 
12621
 /* This outputs NAME to FILE.  */
 
12622
--- a/src/gcc/config/rs6000/rs6000.c
 
12623
+++ b/src/gcc/config/rs6000/rs6000.c
 
12624
@@ -96,6 +96,7 @@
 
12625
   int spe_gp_save_offset;      /* offset to save spe 64-bit gprs  */
 
12626
   int varargs_save_offset;     /* offset to save the varargs registers */
 
12627
   int ehrd_offset;             /* offset to EH return data */
 
12628
+  int ehcr_offset;             /* offset to EH CR field data */
 
12629
   int reg_size;                        /* register size (4 or 8) */
 
12630
   HOST_WIDE_INT vars_size;     /* variable save area size */
 
12631
   int parm_size;               /* outgoing parameter size */
 
12632
@@ -139,6 +140,8 @@
 
12633
      64-bits wide and is allocated early enough so that the offset
 
12634
      does not overflow the 16-bit load/store offset field.  */
 
12635
   rtx sdmode_stack_slot;
 
12636
+  /* Flag if r2 setup is needed with ELFv2 ABI.  */
 
12637
+  bool r2_setup_needed;
 
12638
 } machine_function;
 
12639
 
 
12640
 /* Support targetm.vectorize.builtin_mask_for_load.  */
 
12641
@@ -189,9 +192,6 @@
 
12642
 /* Map register number to register class.  */
 
12643
 enum reg_class rs6000_regno_regclass[FIRST_PSEUDO_REGISTER];
 
12644
 
 
12645
-/* Reload functions based on the type and the vector unit.  */
 
12646
-static enum insn_code rs6000_vector_reload[NUM_MACHINE_MODES][2];
 
12647
-
 
12648
 static int dbg_cost_ctrl;
 
12649
 
 
12650
 /* Built in types.  */
 
12651
@@ -289,6 +289,105 @@
 
12652
    don't link in rs6000-c.c, so we can't call it directly.  */
 
12653
 void (*rs6000_target_modify_macros_ptr) (bool, HOST_WIDE_INT, HOST_WIDE_INT);
 
12654
 
 
12655
+/* Simplfy register classes into simpler classifications.  We assume
 
12656
+   GPR_REG_TYPE - FPR_REG_TYPE are ordered so that we can use a simple range
 
12657
+   check for standard register classes (gpr/floating/altivec/vsx) and
 
12658
+   floating/vector classes (float/altivec/vsx).  */
 
12659
+
 
12660
+enum rs6000_reg_type {
 
12661
+  NO_REG_TYPE,
 
12662
+  PSEUDO_REG_TYPE,
 
12663
+  GPR_REG_TYPE,
 
12664
+  VSX_REG_TYPE,
 
12665
+  ALTIVEC_REG_TYPE,
 
12666
+  FPR_REG_TYPE,
 
12667
+  SPR_REG_TYPE,
 
12668
+  CR_REG_TYPE,
 
12669
+  SPE_ACC_TYPE,
 
12670
+  SPEFSCR_REG_TYPE
 
12671
+};
 
12672
+
 
12673
+/* Map register class to register type.  */
 
12674
+static enum rs6000_reg_type reg_class_to_reg_type[N_REG_CLASSES];
 
12675
+
 
12676
+/* First/last register type for the 'normal' register types (i.e. general
 
12677
+   purpose, floating point, altivec, and VSX registers).  */
 
12678
+#define IS_STD_REG_TYPE(RTYPE) IN_RANGE(RTYPE, GPR_REG_TYPE, FPR_REG_TYPE)
 
12679
+
 
12680
+#define IS_FP_VECT_REG_TYPE(RTYPE) IN_RANGE(RTYPE, VSX_REG_TYPE, FPR_REG_TYPE)
 
12681
+
 
12682
+
 
12683
+/* Register classes we care about in secondary reload or go if legitimate
 
12684
+   address.  We only need to worry about GPR, FPR, and Altivec registers here,
 
12685
+   along an ANY field that is the OR of the 3 register classes.  */
 
12686
+
 
12687
+enum rs6000_reload_reg_type {
 
12688
+  RELOAD_REG_GPR,                      /* General purpose registers.  */
 
12689
+  RELOAD_REG_FPR,                      /* Traditional floating point regs.  */
 
12690
+  RELOAD_REG_VMX,                      /* Altivec (VMX) registers.  */
 
12691
+  RELOAD_REG_ANY,                      /* OR of GPR, FPR, Altivec masks.  */
 
12692
+  N_RELOAD_REG
 
12693
+};
 
12694
+
 
12695
+/* For setting up register classes, loop through the 3 register classes mapping
 
12696
+   into real registers, and skip the ANY class, which is just an OR of the
 
12697
+   bits.  */
 
12698
+#define FIRST_RELOAD_REG_CLASS RELOAD_REG_GPR
 
12699
+#define LAST_RELOAD_REG_CLASS  RELOAD_REG_VMX
 
12700
+
 
12701
+/* Map reload register type to a register in the register class.  */
 
12702
+struct reload_reg_map_type {
 
12703
+  const char *name;                    /* Register class name.  */
 
12704
+  int reg;                             /* Register in the register class.  */
 
12705
+};
 
12706
+
 
12707
+static const struct reload_reg_map_type reload_reg_map[N_RELOAD_REG] = {
 
12708
+  { "Gpr",     FIRST_GPR_REGNO },      /* RELOAD_REG_GPR.  */
 
12709
+  { "Fpr",     FIRST_FPR_REGNO },      /* RELOAD_REG_FPR.  */
 
12710
+  { "VMX",     FIRST_ALTIVEC_REGNO },  /* RELOAD_REG_VMX.  */
 
12711
+  { "Any",     -1 },                   /* RELOAD_REG_ANY.  */
 
12712
+};
 
12713
+
 
12714
+/* Mask bits for each register class, indexed per mode.  Historically the
 
12715
+   compiler has been more restrictive which types can do PRE_MODIFY instead of
 
12716
+   PRE_INC and PRE_DEC, so keep track of sepaate bits for these two.  */
 
12717
+typedef unsigned char addr_mask_type;
 
12718
+
 
12719
+#define RELOAD_REG_VALID       0x01    /* Mode valid in register..  */
 
12720
+#define RELOAD_REG_MULTIPLE    0x02    /* Mode takes multiple registers.  */
 
12721
+#define RELOAD_REG_INDEXED     0x04    /* Reg+reg addressing.  */
 
12722
+#define RELOAD_REG_OFFSET      0x08    /* Reg+offset addressing. */
 
12723
+#define RELOAD_REG_PRE_INCDEC  0x10    /* PRE_INC/PRE_DEC valid.  */
 
12724
+#define RELOAD_REG_PRE_MODIFY  0x20    /* PRE_MODIFY valid.  */
 
12725
+
 
12726
+/* Register type masks based on the type, of valid addressing modes.  */
 
12727
+struct rs6000_reg_addr {
 
12728
+  enum insn_code reload_load;          /* INSN to reload for loading. */
 
12729
+  enum insn_code reload_store;         /* INSN to reload for storing.  */
 
12730
+  enum insn_code reload_fpr_gpr;       /* INSN to move from FPR to GPR.  */
 
12731
+  enum insn_code reload_gpr_vsx;       /* INSN to move from GPR to VSX.  */
 
12732
+  enum insn_code reload_vsx_gpr;       /* INSN to move from VSX to GPR.  */
 
12733
+  addr_mask_type addr_mask[(int)N_RELOAD_REG]; /* Valid address masks.  */
 
12734
+};
 
12735
+
 
12736
+static struct rs6000_reg_addr reg_addr[NUM_MACHINE_MODES];
 
12737
+
 
12738
+/* Helper function to say whether a mode supports PRE_INC or PRE_DEC.  */
 
12739
+static inline bool
 
12740
+mode_supports_pre_incdec_p (enum machine_mode mode)
 
12741
+{
 
12742
+  return ((reg_addr[mode].addr_mask[RELOAD_REG_ANY] & RELOAD_REG_PRE_INCDEC)
 
12743
+         != 0);
 
12744
+}
 
12745
+
 
12746
+/* Helper function to say whether a mode supports PRE_MODIFY.  */
 
12747
+static inline bool
 
12748
+mode_supports_pre_modify_p (enum machine_mode mode)
 
12749
+{
 
12750
+  return ((reg_addr[mode].addr_mask[RELOAD_REG_ANY] & RELOAD_REG_PRE_MODIFY)
 
12751
+         != 0);
 
12752
+}
 
12753
+
 
12754
 
 
12755
 /* Target cpu costs.  */
 
12756
 
 
12757
@@ -828,6 +927,25 @@
 
12758
   12,                  /* prefetch streams */
 
12759
 };
 
12760
 
 
12761
+/* Instruction costs on POWER8 processors.  */
 
12762
+static const
 
12763
+struct processor_costs power8_cost = {
 
12764
+  COSTS_N_INSNS (3),   /* mulsi */
 
12765
+  COSTS_N_INSNS (3),   /* mulsi_const */
 
12766
+  COSTS_N_INSNS (3),   /* mulsi_const9 */
 
12767
+  COSTS_N_INSNS (3),   /* muldi */
 
12768
+  COSTS_N_INSNS (19),  /* divsi */
 
12769
+  COSTS_N_INSNS (35),  /* divdi */
 
12770
+  COSTS_N_INSNS (3),   /* fp */
 
12771
+  COSTS_N_INSNS (3),   /* dmul */
 
12772
+  COSTS_N_INSNS (14),  /* sdiv */
 
12773
+  COSTS_N_INSNS (17),  /* ddiv */
 
12774
+  128,                 /* cache line size */
 
12775
+  32,                  /* l1 cache */
 
12776
+  256,                 /* l2 cache */
 
12777
+  12,                  /* prefetch streams */
 
12778
+};
 
12779
+
 
12780
 /* Instruction costs on POWER A2 processors.  */
 
12781
 static const
 
12782
 struct processor_costs ppca2_cost = {
 
12783
@@ -855,6 +973,7 @@
 
12784
 #undef RS6000_BUILTIN_A
 
12785
 #undef RS6000_BUILTIN_D
 
12786
 #undef RS6000_BUILTIN_E
 
12787
+#undef RS6000_BUILTIN_H
 
12788
 #undef RS6000_BUILTIN_P
 
12789
 #undef RS6000_BUILTIN_Q
 
12790
 #undef RS6000_BUILTIN_S
 
12791
@@ -878,6 +997,9 @@
 
12792
 #define RS6000_BUILTIN_E(ENUM, NAME, MASK, ATTR, ICODE)  \
 
12793
   { NAME, ICODE, MASK, ATTR },
 
12794
 
 
12795
+#define RS6000_BUILTIN_H(ENUM, NAME, MASK, ATTR, ICODE)  \
 
12796
+  { NAME, ICODE, MASK, ATTR },
 
12797
+
 
12798
 #define RS6000_BUILTIN_P(ENUM, NAME, MASK, ATTR, ICODE)  \
 
12799
   { NAME, ICODE, MASK, ATTR },
 
12800
 
 
12801
@@ -908,6 +1030,7 @@
 
12802
 #undef RS6000_BUILTIN_A
 
12803
 #undef RS6000_BUILTIN_D
 
12804
 #undef RS6000_BUILTIN_E
 
12805
+#undef RS6000_BUILTIN_H
 
12806
 #undef RS6000_BUILTIN_P
 
12807
 #undef RS6000_BUILTIN_Q
 
12808
 #undef RS6000_BUILTIN_S
 
12809
@@ -948,6 +1071,7 @@
 
12810
 static void paired_init_builtins (void);
 
12811
 static rtx paired_expand_predicate_builtin (enum insn_code, tree, rtx);
 
12812
 static void spe_init_builtins (void);
 
12813
+static void htm_init_builtins (void);
 
12814
 static rtx spe_expand_predicate_builtin (enum insn_code, tree, rtx);
 
12815
 static rtx spe_expand_evsel_builtin (enum insn_code, tree, rtx);
 
12816
 static int rs6000_emit_int_cmove (rtx, rtx, rtx, rtx);
 
12817
@@ -1020,6 +1144,13 @@
 
12818
 static void rs6000_print_builtin_options (FILE *, int, const char *,
 
12819
                                          HOST_WIDE_INT);
 
12820
 
 
12821
+static enum rs6000_reg_type register_to_reg_type (rtx, bool *);
 
12822
+static bool rs6000_secondary_reload_move (enum rs6000_reg_type,
 
12823
+                                         enum rs6000_reg_type,
 
12824
+                                         enum machine_mode,
 
12825
+                                         secondary_reload_info *,
 
12826
+                                         bool);
 
12827
+
 
12828
 /* Hash table stuff for keeping track of TOC entries.  */
 
12829
 
 
12830
 struct GTY(()) toc_hash_struct
 
12831
@@ -1068,7 +1199,9 @@
 
12832
       /* SPE registers.  */
 
12833
       "spe_acc", "spefscr",
 
12834
       /* Soft frame pointer.  */
 
12835
-      "sfp"
 
12836
+      "sfp",
 
12837
+      /* HTM SPR registers.  */
 
12838
+      "tfhar", "tfiar", "texasr"
 
12839
 };
 
12840
 
 
12841
 #ifdef TARGET_REGNAMES
 
12842
@@ -1094,7 +1227,9 @@
 
12843
   /* SPE registers.  */
 
12844
   "spe_acc", "spefscr",
 
12845
   /* Soft frame pointer.  */
 
12846
-  "sfp"
 
12847
+  "sfp",
 
12848
+  /* HTM SPR registers.  */
 
12849
+  "tfhar", "tfiar", "texasr"
 
12850
 };
 
12851
 #endif
 
12852
 
 
12853
@@ -1316,6 +1451,9 @@
 
12854
 #undef TARGET_RETURN_IN_MEMORY
 
12855
 #define TARGET_RETURN_IN_MEMORY rs6000_return_in_memory
 
12856
 
 
12857
+#undef TARGET_RETURN_IN_MSB
 
12858
+#define TARGET_RETURN_IN_MSB rs6000_return_in_msb
 
12859
+
 
12860
 #undef TARGET_SETUP_INCOMING_VARARGS
 
12861
 #define TARGET_SETUP_INCOMING_VARARGS setup_incoming_varargs
 
12862
 
 
12863
@@ -1513,8 +1651,9 @@
 
12864
 {
 
12865
   unsigned HOST_WIDE_INT reg_size;
 
12866
 
 
12867
+  /* TF/TD modes are special in that they always take 2 registers.  */
 
12868
   if (FP_REGNO_P (regno))
 
12869
-    reg_size = (VECTOR_MEM_VSX_P (mode)
 
12870
+    reg_size = ((VECTOR_MEM_VSX_P (mode) && mode != TDmode && mode != TFmode)
 
12871
                ? UNITS_PER_VSX_WORD
 
12872
                : UNITS_PER_FP_WORD);
 
12873
 
 
12874
@@ -1546,16 +1685,38 @@
 
12875
 {
 
12876
   int last_regno = regno + rs6000_hard_regno_nregs[mode][regno] - 1;
 
12877
 
 
12878
+  /* PTImode can only go in GPRs.  Quad word memory operations require even/odd
 
12879
+     register combinations, and use PTImode where we need to deal with quad
 
12880
+     word memory operations.  Don't allow quad words in the argument or frame
 
12881
+     pointer registers, just registers 0..31.  */
 
12882
+  if (mode == PTImode)
 
12883
+    return (IN_RANGE (regno, FIRST_GPR_REGNO, LAST_GPR_REGNO)
 
12884
+           && IN_RANGE (last_regno, FIRST_GPR_REGNO, LAST_GPR_REGNO)
 
12885
+           && ((regno & 1) == 0));
 
12886
+
 
12887
   /* VSX registers that overlap the FPR registers are larger than for non-VSX
 
12888
      implementations.  Don't allow an item to be split between a FP register
 
12889
-     and an Altivec register.  */
 
12890
-  if (VECTOR_MEM_VSX_P (mode))
 
12891
+     and an Altivec register.  Allow TImode in all VSX registers if the user
 
12892
+     asked for it.  */
 
12893
+  if (TARGET_VSX && VSX_REGNO_P (regno)
 
12894
+      && (VECTOR_MEM_VSX_P (mode)
 
12895
+         || (TARGET_VSX_SCALAR_FLOAT && mode == SFmode)
 
12896
+         || (TARGET_VSX_SCALAR_DOUBLE && (mode == DFmode || mode == DImode))
 
12897
+         || (TARGET_VSX_TIMODE && mode == TImode)))
 
12898
     {
 
12899
       if (FP_REGNO_P (regno))
 
12900
        return FP_REGNO_P (last_regno);
 
12901
 
 
12902
       if (ALTIVEC_REGNO_P (regno))
 
12903
-       return ALTIVEC_REGNO_P (last_regno);
 
12904
+       {
 
12905
+         if (mode == SFmode && !TARGET_UPPER_REGS_SF)
 
12906
+           return 0;
 
12907
+
 
12908
+         if ((mode == DFmode || mode == DImode) && !TARGET_UPPER_REGS_DF)
 
12909
+           return 0;
 
12910
+
 
12911
+         return ALTIVEC_REGNO_P (last_regno);
 
12912
+       }
 
12913
     }
 
12914
 
 
12915
   /* The GPRs can hold any mode, but values bigger than one register
 
12916
@@ -1564,8 +1725,7 @@
 
12917
     return INT_REGNO_P (last_regno);
 
12918
 
 
12919
   /* The float registers (except for VSX vector modes) can only hold floating
 
12920
-     modes and DImode.  This excludes the 32-bit decimal float mode for
 
12921
-     now.  */
 
12922
+     modes and DImode.  */
 
12923
   if (FP_REGNO_P (regno))
 
12924
     {
 
12925
       if (SCALAR_FLOAT_MODE_P (mode)
 
12926
@@ -1599,9 +1759,8 @@
 
12927
   if (SPE_SIMD_REGNO_P (regno) && TARGET_SPE && SPE_VECTOR_MODE (mode))
 
12928
     return 1;
 
12929
 
 
12930
-  /* We cannot put TImode anywhere except general register and it must be able
 
12931
-     to fit within the register set.  In the future, allow TImode in the
 
12932
-     Altivec or VSX registers.  */
 
12933
+  /* We cannot put non-VSX TImode or PTImode anywhere except general register
 
12934
+     and it must be able to fit within the register set.  */
 
12935
 
 
12936
   return GET_MODE_SIZE (mode) <= UNITS_PER_WORD;
 
12937
 }
 
12938
@@ -1674,10 +1833,77 @@
 
12939
          comma = "";
 
12940
        }
 
12941
 
 
12942
+      len += fprintf (stderr, "%sreg-class = %s", comma,
 
12943
+                     reg_class_names[(int)rs6000_regno_regclass[r]]);
 
12944
+      comma = ", ";
 
12945
+
 
12946
+      if (len > 70)
 
12947
+       {
 
12948
+         fprintf (stderr, ",\n\t");
 
12949
+         comma = "";
 
12950
+       }
 
12951
+
 
12952
       fprintf (stderr, "%sregno = %d\n", comma, r);
 
12953
     }
 
12954
 }
 
12955
 
 
12956
+static const char *
 
12957
+rs6000_debug_vector_unit (enum rs6000_vector v)
 
12958
+{
 
12959
+  const char *ret;
 
12960
+
 
12961
+  switch (v)
 
12962
+    {
 
12963
+    case VECTOR_NONE:     ret = "none";      break;
 
12964
+    case VECTOR_ALTIVEC:   ret = "altivec";   break;
 
12965
+    case VECTOR_VSX:      ret = "vsx";       break;
 
12966
+    case VECTOR_P8_VECTOR: ret = "p8_vector"; break;
 
12967
+    case VECTOR_PAIRED:           ret = "paired";    break;
 
12968
+    case VECTOR_SPE:      ret = "spe";       break;
 
12969
+    case VECTOR_OTHER:    ret = "other";     break;
 
12970
+    default:              ret = "unknown";   break;
 
12971
+    }
 
12972
+
 
12973
+  return ret;
 
12974
+}
 
12975
+
 
12976
+/* Print the address masks in a human readble fashion.  */
 
12977
+DEBUG_FUNCTION void
 
12978
+rs6000_debug_print_mode (ssize_t m)
 
12979
+{
 
12980
+  ssize_t rc;
 
12981
+
 
12982
+  fprintf (stderr, "Mode: %-5s", GET_MODE_NAME (m));
 
12983
+  for (rc = 0; rc < N_RELOAD_REG; rc++)
 
12984
+    {
 
12985
+      addr_mask_type mask = reg_addr[m].addr_mask[rc];
 
12986
+      fprintf (stderr,
 
12987
+              "  %s: %c%c%c%c%c%c",
 
12988
+              reload_reg_map[rc].name,
 
12989
+              (mask & RELOAD_REG_VALID)      != 0 ? 'v' : ' ',
 
12990
+              (mask & RELOAD_REG_MULTIPLE)   != 0 ? 'm' : ' ',
 
12991
+              (mask & RELOAD_REG_INDEXED)    != 0 ? 'i' : ' ',
 
12992
+              (mask & RELOAD_REG_OFFSET)     != 0 ? 'o' : ' ',
 
12993
+              (mask & RELOAD_REG_PRE_INCDEC) != 0 ? '+' : ' ',
 
12994
+              (mask & RELOAD_REG_PRE_MODIFY) != 0 ? '+' : ' ');
 
12995
+    }
 
12996
+
 
12997
+  if (rs6000_vector_unit[m] != VECTOR_NONE
 
12998
+      || rs6000_vector_mem[m] != VECTOR_NONE
 
12999
+      || (reg_addr[m].reload_store != CODE_FOR_nothing)
 
13000
+      || (reg_addr[m].reload_load != CODE_FOR_nothing))
 
13001
+    {
 
13002
+      fprintf (stderr,
 
13003
+              "  Vector-arith=%-10s Vector-mem=%-10s Reload=%c%c",
 
13004
+              rs6000_debug_vector_unit (rs6000_vector_unit[m]),
 
13005
+              rs6000_debug_vector_unit (rs6000_vector_mem[m]),
 
13006
+              (reg_addr[m].reload_store != CODE_FOR_nothing) ? 's' : '*',
 
13007
+              (reg_addr[m].reload_load != CODE_FOR_nothing) ? 'l' : '*');
 
13008
+    }
 
13009
+
 
13010
+  fputs ("\n", stderr);
 
13011
+}
 
13012
+
 
13013
 #define DEBUG_FMT_ID "%-32s= "
 
13014
 #define DEBUG_FMT_D   DEBUG_FMT_ID "%d\n"
 
13015
 #define DEBUG_FMT_WX  DEBUG_FMT_ID "%#.12" HOST_WIDE_INT_PRINT "x: "
 
13016
@@ -1690,6 +1916,7 @@
 
13017
   static const char *const tf[2] = { "false", "true" };
 
13018
   const char *nl = (const char *)0;
 
13019
   int m;
 
13020
+  size_t m1, m2, v;
 
13021
   char costly_num[20];
 
13022
   char nop_num[20];
 
13023
   char flags_buffer[40];
 
13024
@@ -1700,20 +1927,67 @@
 
13025
   const char *cmodel_str;
 
13026
   struct cl_target_option cl_opts;
 
13027
 
 
13028
-  /* Map enum rs6000_vector to string.  */
 
13029
-  static const char *rs6000_debug_vector_unit[] = {
 
13030
-    "none",
 
13031
-    "altivec",
 
13032
-    "vsx",
 
13033
-    "paired",
 
13034
-    "spe",
 
13035
-    "other"
 
13036
+  /* Modes we want tieable information on.  */
 
13037
+  static const enum machine_mode print_tieable_modes[] = {
 
13038
+    QImode,
 
13039
+    HImode,
 
13040
+    SImode,
 
13041
+    DImode,
 
13042
+    TImode,
 
13043
+    PTImode,
 
13044
+    SFmode,
 
13045
+    DFmode,
 
13046
+    TFmode,
 
13047
+    SDmode,
 
13048
+    DDmode,
 
13049
+    TDmode,
 
13050
+    V8QImode,
 
13051
+    V4HImode,
 
13052
+    V2SImode,
 
13053
+    V16QImode,
 
13054
+    V8HImode,
 
13055
+    V4SImode,
 
13056
+    V2DImode,
 
13057
+    V32QImode,
 
13058
+    V16HImode,
 
13059
+    V8SImode,
 
13060
+    V4DImode,
 
13061
+    V2SFmode,
 
13062
+    V4SFmode,
 
13063
+    V2DFmode,
 
13064
+    V8SFmode,
 
13065
+    V4DFmode,
 
13066
+    CCmode,
 
13067
+    CCUNSmode,
 
13068
+    CCEQmode,
 
13069
   };
 
13070
 
 
13071
-  fprintf (stderr, "Register information: (last virtual reg = %d)\n",
 
13072
-          LAST_VIRTUAL_REGISTER);
 
13073
-  rs6000_debug_reg_print (0, 31, "gr");
 
13074
-  rs6000_debug_reg_print (32, 63, "fp");
 
13075
+  /* Virtual regs we are interested in.  */
 
13076
+  const static struct {
 
13077
+    int regno;                 /* register number.  */
 
13078
+    const char *name;          /* register name.  */
 
13079
+  } virtual_regs[] = {
 
13080
+    { STACK_POINTER_REGNUM,                    "stack pointer:" },
 
13081
+    { TOC_REGNUM,                              "toc:          " },
 
13082
+    { STATIC_CHAIN_REGNUM,                     "static chain: " },
 
13083
+    { RS6000_PIC_OFFSET_TABLE_REGNUM,          "pic offset:   " },
 
13084
+    { HARD_FRAME_POINTER_REGNUM,               "hard frame:   " },
 
13085
+    { ARG_POINTER_REGNUM,                      "arg pointer:  " },
 
13086
+    { FRAME_POINTER_REGNUM,                    "frame pointer:" },
 
13087
+    { FIRST_PSEUDO_REGISTER,                   "first pseudo: " },
 
13088
+    { FIRST_VIRTUAL_REGISTER,                  "first virtual:" },
 
13089
+    { VIRTUAL_INCOMING_ARGS_REGNUM,            "incoming_args:" },
 
13090
+    { VIRTUAL_STACK_VARS_REGNUM,               "stack_vars:   " },
 
13091
+    { VIRTUAL_STACK_DYNAMIC_REGNUM,            "stack_dynamic:" },
 
13092
+    { VIRTUAL_OUTGOING_ARGS_REGNUM,            "outgoing_args:" },
 
13093
+    { VIRTUAL_CFA_REGNUM,                      "cfa (frame):  " },
 
13094
+    { VIRTUAL_PREFERRED_STACK_BOUNDARY_REGNUM, "stack boundry:" },
 
13095
+    { LAST_VIRTUAL_REGISTER,                   "last virtual: " },
 
13096
+  };
 
13097
+
 
13098
+  fputs ("\nHard register information:\n", stderr);
 
13099
+  rs6000_debug_reg_print (FIRST_GPR_REGNO, LAST_GPR_REGNO, "gr");
 
13100
+  rs6000_debug_reg_print (FIRST_FPR_REGNO, LAST_FPR_REGNO, "fp");
 
13101
   rs6000_debug_reg_print (FIRST_ALTIVEC_REGNO,
 
13102
                          LAST_ALTIVEC_REGNO,
 
13103
                          "vs");
 
13104
@@ -1726,6 +2000,10 @@
 
13105
   rs6000_debug_reg_print (SPE_ACC_REGNO, SPE_ACC_REGNO, "spe_a");
 
13106
   rs6000_debug_reg_print (SPEFSCR_REGNO, SPEFSCR_REGNO, "spe_f");
 
13107
 
 
13108
+  fputs ("\nVirtual/stack/frame registers:\n", stderr);
 
13109
+  for (v = 0; v < ARRAY_SIZE (virtual_regs); v++)
 
13110
+    fprintf (stderr, "%s regno = %3d\n", virtual_regs[v].name, virtual_regs[v].regno);
 
13111
+
 
13112
   fprintf (stderr,
 
13113
           "\n"
 
13114
           "d  reg_class = %s\n"
 
13115
@@ -1734,25 +2012,70 @@
 
13116
           "wa reg_class = %s\n"
 
13117
           "wd reg_class = %s\n"
 
13118
           "wf reg_class = %s\n"
 
13119
-          "ws reg_class = %s\n\n",
 
13120
+          "wg reg_class = %s\n"
 
13121
+          "wl reg_class = %s\n"
 
13122
+          "wm reg_class = %s\n"
 
13123
+          "wr reg_class = %s\n"
 
13124
+          "ws reg_class = %s\n"
 
13125
+          "wt reg_class = %s\n"
 
13126
+          "wu reg_class = %s\n"
 
13127
+          "wv reg_class = %s\n"
 
13128
+          "ww reg_class = %s\n"
 
13129
+          "wx reg_class = %s\n"
 
13130
+          "wy reg_class = %s\n"
 
13131
+          "wz reg_class = %s\n"
 
13132
+          "\n",
 
13133
           reg_class_names[rs6000_constraints[RS6000_CONSTRAINT_d]],
 
13134
           reg_class_names[rs6000_constraints[RS6000_CONSTRAINT_f]],
 
13135
           reg_class_names[rs6000_constraints[RS6000_CONSTRAINT_v]],
 
13136
           reg_class_names[rs6000_constraints[RS6000_CONSTRAINT_wa]],
 
13137
           reg_class_names[rs6000_constraints[RS6000_CONSTRAINT_wd]],
 
13138
           reg_class_names[rs6000_constraints[RS6000_CONSTRAINT_wf]],
 
13139
-          reg_class_names[rs6000_constraints[RS6000_CONSTRAINT_ws]]);
 
13140
+          reg_class_names[rs6000_constraints[RS6000_CONSTRAINT_wg]],
 
13141
+          reg_class_names[rs6000_constraints[RS6000_CONSTRAINT_wl]],
 
13142
+          reg_class_names[rs6000_constraints[RS6000_CONSTRAINT_wm]],
 
13143
+          reg_class_names[rs6000_constraints[RS6000_CONSTRAINT_wr]],
 
13144
+          reg_class_names[rs6000_constraints[RS6000_CONSTRAINT_ws]],
 
13145
+          reg_class_names[rs6000_constraints[RS6000_CONSTRAINT_wt]],
 
13146
+          reg_class_names[rs6000_constraints[RS6000_CONSTRAINT_wu]],
 
13147
+          reg_class_names[rs6000_constraints[RS6000_CONSTRAINT_wv]],
 
13148
+          reg_class_names[rs6000_constraints[RS6000_CONSTRAINT_ww]],
 
13149
+          reg_class_names[rs6000_constraints[RS6000_CONSTRAINT_wx]],
 
13150
+          reg_class_names[rs6000_constraints[RS6000_CONSTRAINT_wy]],
 
13151
+          reg_class_names[rs6000_constraints[RS6000_CONSTRAINT_wz]]);
 
13152
 
 
13153
+  nl = "\n";
 
13154
   for (m = 0; m < NUM_MACHINE_MODES; ++m)
 
13155
-    if (rs6000_vector_unit[m] || rs6000_vector_mem[m])
 
13156
-      {
 
13157
-       nl = "\n";
 
13158
-       fprintf (stderr, "Vector mode: %-5s arithmetic: %-8s move: %-8s\n",
 
13159
-                GET_MODE_NAME (m),
 
13160
-                rs6000_debug_vector_unit[ rs6000_vector_unit[m] ],
 
13161
-                rs6000_debug_vector_unit[ rs6000_vector_mem[m] ]);
 
13162
-      }
 
13163
+    rs6000_debug_print_mode (m);
 
13164
 
 
13165
+  fputs ("\n", stderr);
 
13166
+
 
13167
+  for (m1 = 0; m1 < ARRAY_SIZE (print_tieable_modes); m1++)
 
13168
+    {
 
13169
+      enum machine_mode mode1 = print_tieable_modes[m1];
 
13170
+      bool first_time = true;
 
13171
+
 
13172
+      nl = (const char *)0;
 
13173
+      for (m2 = 0; m2 < ARRAY_SIZE (print_tieable_modes); m2++)
 
13174
+       {
 
13175
+         enum machine_mode mode2 = print_tieable_modes[m2];
 
13176
+         if (mode1 != mode2 && MODES_TIEABLE_P (mode1, mode2))
 
13177
+           {
 
13178
+             if (first_time)
 
13179
+               {
 
13180
+                 fprintf (stderr, "Tieable modes %s:", GET_MODE_NAME (mode1));
 
13181
+                 nl = "\n";
 
13182
+                 first_time = false;
 
13183
+               }
 
13184
+
 
13185
+             fprintf (stderr, " %s", GET_MODE_NAME (mode2));
 
13186
+           }
 
13187
+       }
 
13188
+
 
13189
+      if (!first_time)
 
13190
+       fputs ("\n", stderr);
 
13191
+    }
 
13192
+
 
13193
   if (nl)
 
13194
     fputs (nl, stderr);
 
13195
 
 
13196
@@ -1913,6 +2236,7 @@
 
13197
     {
 
13198
     case ABI_NONE:     abi_str = "none";       break;
 
13199
     case ABI_AIX:      abi_str = "aix";        break;
 
13200
+    case ABI_ELFv2:    abi_str = "ELFv2";      break;
 
13201
     case ABI_V4:       abi_str = "V4";         break;
 
13202
     case ABI_DARWIN:   abi_str = "darwin";     break;
 
13203
     default:           abi_str = "unknown";    break;
 
13204
@@ -1935,6 +2259,13 @@
 
13205
   if (TARGET_LINK_STACK)
 
13206
     fprintf (stderr, DEBUG_FMT_S, "link_stack", "true");
 
13207
 
 
13208
+  if (targetm.lra_p ())
 
13209
+    fprintf (stderr, DEBUG_FMT_S, "lra", "true");
 
13210
+
 
13211
+  if (TARGET_P8_FUSION)
 
13212
+    fprintf (stderr, DEBUG_FMT_S, "p8 fusion",
 
13213
+            (TARGET_P8_FUSION_SIGN) ? "zero+sign" : "zero");
 
13214
+
 
13215
   fprintf (stderr, DEBUG_FMT_S, "plt-format",
 
13216
           TARGET_SECURE_PLT ? "secure" : "bss");
 
13217
   fprintf (stderr, DEBUG_FMT_S, "struct-return",
 
13218
@@ -1954,11 +2285,106 @@
 
13219
           (int)RS6000_BUILTIN_COUNT);
 
13220
 }
 
13221
 
 
13222
+
 
13223
+/* Update the addr mask bits in reg_addr to help secondary reload and go if
 
13224
+   legitimate address support to figure out the appropriate addressing to
 
13225
+   use.  */
 
13226
+
 
13227
+static void
 
13228
+rs6000_setup_reg_addr_masks (void)
 
13229
+{
 
13230
+  ssize_t rc, reg, m, nregs;
 
13231
+  addr_mask_type any_addr_mask, addr_mask;
 
13232
+
 
13233
+  for (m = 0; m < NUM_MACHINE_MODES; ++m)
 
13234
+    {
 
13235
+      /* SDmode is special in that we want to access it only via REG+REG
 
13236
+        addressing on power7 and above, since we want to use the LFIWZX and
 
13237
+        STFIWZX instructions to load it.  */
 
13238
+      bool indexed_only_p = (m == SDmode && TARGET_NO_SDMODE_STACK);
 
13239
+
 
13240
+      any_addr_mask = 0;
 
13241
+      for (rc = FIRST_RELOAD_REG_CLASS; rc <= LAST_RELOAD_REG_CLASS; rc++)
 
13242
+       {
 
13243
+         addr_mask = 0;
 
13244
+         reg = reload_reg_map[rc].reg;
 
13245
+
 
13246
+         /* Can mode values go in the GPR/FPR/Altivec registers?  */
 
13247
+         if (reg >= 0 && rs6000_hard_regno_mode_ok_p[m][reg])
 
13248
+           {
 
13249
+             nregs = rs6000_hard_regno_nregs[m][reg];
 
13250
+             addr_mask |= RELOAD_REG_VALID;
 
13251
+
 
13252
+             /* Indicate if the mode takes more than 1 physical register.  If
 
13253
+                it takes a single register, indicate it can do REG+REG
 
13254
+                addressing.  */
 
13255
+             if (nregs > 1 || m == BLKmode)
 
13256
+               addr_mask |= RELOAD_REG_MULTIPLE;
 
13257
+             else
 
13258
+               addr_mask |= RELOAD_REG_INDEXED;
 
13259
+
 
13260
+             /* Figure out if we can do PRE_INC, PRE_DEC, or PRE_MODIFY
 
13261
+                addressing.  Restrict addressing on SPE for 64-bit types
 
13262
+                because of the SUBREG hackery used to address 64-bit floats in
 
13263
+                '32-bit' GPRs.  To simplify secondary reload, don't allow
 
13264
+                update forms on scalar floating point types that can go in the
 
13265
+                upper registers.  */
 
13266
+
 
13267
+             if (TARGET_UPDATE
 
13268
+                 && (rc == RELOAD_REG_GPR || rc == RELOAD_REG_FPR)
 
13269
+                 && GET_MODE_SIZE (m) <= 8
 
13270
+                 && !VECTOR_MODE_P (m)
 
13271
+                 && !COMPLEX_MODE_P (m)
 
13272
+                 && !indexed_only_p
 
13273
+                 && !(TARGET_E500_DOUBLE && GET_MODE_SIZE (m) == 8)
 
13274
+                 && !(m == DFmode && TARGET_UPPER_REGS_DF)
 
13275
+                 && !(m == SFmode && TARGET_UPPER_REGS_SF))
 
13276
+               {
 
13277
+                 addr_mask |= RELOAD_REG_PRE_INCDEC;
 
13278
+
 
13279
+                 /* PRE_MODIFY is more restricted than PRE_INC/PRE_DEC in that
 
13280
+                    we don't allow PRE_MODIFY for some multi-register
 
13281
+                    operations.  */
 
13282
+                 switch (m)
 
13283
+                   {
 
13284
+                   default:
 
13285
+                     addr_mask |= RELOAD_REG_PRE_MODIFY;
 
13286
+                     break;
 
13287
+
 
13288
+                   case DImode:
 
13289
+                     if (TARGET_POWERPC64)
 
13290
+                       addr_mask |= RELOAD_REG_PRE_MODIFY;
 
13291
+                     break;
 
13292
+
 
13293
+                   case DFmode:
 
13294
+                   case DDmode:
 
13295
+                     if (TARGET_DF_INSN)
 
13296
+                       addr_mask |= RELOAD_REG_PRE_MODIFY;
 
13297
+                     break;
 
13298
+                   }
 
13299
+               }
 
13300
+           }
 
13301
+
 
13302
+         /* GPR and FPR registers can do REG+OFFSET addressing, except
 
13303
+            possibly for SDmode.  */
 
13304
+         if ((addr_mask != 0) && !indexed_only_p
 
13305
+             && (rc == RELOAD_REG_GPR || rc == RELOAD_REG_FPR))
 
13306
+           addr_mask |= RELOAD_REG_OFFSET;
 
13307
+
 
13308
+         reg_addr[m].addr_mask[rc] = addr_mask;
 
13309
+         any_addr_mask |= addr_mask;
 
13310
+       }
 
13311
+
 
13312
+      reg_addr[m].addr_mask[RELOAD_REG_ANY] = any_addr_mask;
 
13313
+    }
 
13314
+}
 
13315
+
 
13316
+
 
13317
 /* Initialize the various global tables that are based on register size.  */
 
13318
 static void
 
13319
 rs6000_init_hard_regno_mode_ok (bool global_init_p)
 
13320
 {
 
13321
-  int r, m, c;
 
13322
+  ssize_t r, m, c;
 
13323
   int align64;
 
13324
   int align32;
 
13325
 
 
13326
@@ -1987,21 +2413,55 @@
 
13327
   rs6000_regno_regclass[VSCR_REGNO] = VRSAVE_REGS;
 
13328
   rs6000_regno_regclass[SPE_ACC_REGNO] = SPE_ACC_REGS;
 
13329
   rs6000_regno_regclass[SPEFSCR_REGNO] = SPEFSCR_REGS;
 
13330
+  rs6000_regno_regclass[TFHAR_REGNO] = SPR_REGS;
 
13331
+  rs6000_regno_regclass[TFIAR_REGNO] = SPR_REGS;
 
13332
+  rs6000_regno_regclass[TEXASR_REGNO] = SPR_REGS;
 
13333
   rs6000_regno_regclass[ARG_POINTER_REGNUM] = BASE_REGS;
 
13334
   rs6000_regno_regclass[FRAME_POINTER_REGNUM] = BASE_REGS;
 
13335
 
 
13336
-  /* Precalculate vector information, this must be set up before the
 
13337
-     rs6000_hard_regno_nregs_internal below.  */
 
13338
-  for (m = 0; m < NUM_MACHINE_MODES; ++m)
 
13339
+  /* Precalculate register class to simpler reload register class.  We don't
 
13340
+     need all of the register classes that are combinations of different
 
13341
+     classes, just the simple ones that have constraint letters.  */
 
13342
+  for (c = 0; c < N_REG_CLASSES; c++)
 
13343
+    reg_class_to_reg_type[c] = NO_REG_TYPE;
 
13344
+
 
13345
+  reg_class_to_reg_type[(int)GENERAL_REGS] = GPR_REG_TYPE;
 
13346
+  reg_class_to_reg_type[(int)BASE_REGS] = GPR_REG_TYPE;
 
13347
+  reg_class_to_reg_type[(int)VSX_REGS] = VSX_REG_TYPE;
 
13348
+  reg_class_to_reg_type[(int)VRSAVE_REGS] = SPR_REG_TYPE;
 
13349
+  reg_class_to_reg_type[(int)VSCR_REGS] = SPR_REG_TYPE;
 
13350
+  reg_class_to_reg_type[(int)LINK_REGS] = SPR_REG_TYPE;
 
13351
+  reg_class_to_reg_type[(int)CTR_REGS] = SPR_REG_TYPE;
 
13352
+  reg_class_to_reg_type[(int)LINK_OR_CTR_REGS] = SPR_REG_TYPE;
 
13353
+  reg_class_to_reg_type[(int)CR_REGS] = CR_REG_TYPE;
 
13354
+  reg_class_to_reg_type[(int)CR0_REGS] = CR_REG_TYPE;
 
13355
+  reg_class_to_reg_type[(int)SPE_ACC_REGS] = SPE_ACC_TYPE;
 
13356
+  reg_class_to_reg_type[(int)SPEFSCR_REGS] = SPEFSCR_REG_TYPE;
 
13357
+
 
13358
+  if (TARGET_VSX)
 
13359
     {
 
13360
-      rs6000_vector_unit[m] = rs6000_vector_mem[m] = VECTOR_NONE;
 
13361
-      rs6000_vector_reload[m][0] = CODE_FOR_nothing;
 
13362
-      rs6000_vector_reload[m][1] = CODE_FOR_nothing;
 
13363
+      reg_class_to_reg_type[(int)FLOAT_REGS] = VSX_REG_TYPE;
 
13364
+      reg_class_to_reg_type[(int)ALTIVEC_REGS] = VSX_REG_TYPE;
 
13365
     }
 
13366
+  else
 
13367
+    {
 
13368
+      reg_class_to_reg_type[(int)FLOAT_REGS] = FPR_REG_TYPE;
 
13369
+      reg_class_to_reg_type[(int)ALTIVEC_REGS] = ALTIVEC_REG_TYPE;
 
13370
+    }
 
13371
 
 
13372
-  for (c = 0; c < (int)(int)RS6000_CONSTRAINT_MAX; c++)
 
13373
-    rs6000_constraints[c] = NO_REGS;
 
13374
+  /* Precalculate the valid memory formats as well as the vector information,
 
13375
+     this must be set up before the rs6000_hard_regno_nregs_internal calls
 
13376
+     below.  */
 
13377
+  gcc_assert ((int)VECTOR_NONE == 0);
 
13378
+  memset ((void *) &rs6000_vector_unit[0], '\0', sizeof (rs6000_vector_unit));
 
13379
+  memset ((void *) &rs6000_vector_mem[0], '\0', sizeof (rs6000_vector_unit));
 
13380
 
 
13381
+  gcc_assert ((int)CODE_FOR_nothing == 0);
 
13382
+  memset ((void *) &reg_addr[0], '\0', sizeof (reg_addr));
 
13383
+
 
13384
+  gcc_assert ((int)NO_REGS == 0);
 
13385
+  memset ((void *) &rs6000_constraints[0], '\0', sizeof (rs6000_constraints));
 
13386
+
 
13387
   /* The VSX hardware allows native alignment for vectors, but control whether the compiler
 
13388
      believes it can use native alignment or still uses 128-bit alignment.  */
 
13389
   if (TARGET_VSX && !TARGET_VSX_ALIGN_128)
 
13390
@@ -2062,12 +2522,13 @@
 
13391
        }
 
13392
     }
 
13393
 
 
13394
-  /* V2DImode, only allow under VSX, which can do V2DI insert/splat/extract.
 
13395
-     Altivec doesn't have 64-bit support.  */
 
13396
+  /* V2DImode, full mode depends on ISA 2.07 vector mode.  Allow under VSX to
 
13397
+     do insert/splat/extract.  Altivec doesn't have 64-bit integer support.  */
 
13398
   if (TARGET_VSX)
 
13399
     {
 
13400
       rs6000_vector_mem[V2DImode] = VECTOR_VSX;
 
13401
-      rs6000_vector_unit[V2DImode] = VECTOR_NONE;
 
13402
+      rs6000_vector_unit[V2DImode]
 
13403
+       = (TARGET_P8_VECTOR) ? VECTOR_P8_VECTOR : VECTOR_NONE;
 
13404
       rs6000_vector_align[V2DImode] = align64;
 
13405
     }
 
13406
 
 
13407
@@ -2076,14 +2537,48 @@
 
13408
     {
 
13409
       rs6000_vector_unit[DFmode] = VECTOR_VSX;
 
13410
       rs6000_vector_mem[DFmode]
 
13411
-       = (TARGET_VSX_SCALAR_MEMORY ? VECTOR_VSX : VECTOR_NONE);
 
13412
+       = (TARGET_UPPER_REGS_DF ? VECTOR_VSX : VECTOR_NONE);
 
13413
       rs6000_vector_align[DFmode] = align64;
 
13414
     }
 
13415
 
 
13416
+  /* Allow TImode in VSX register and set the VSX memory macros.  */
 
13417
+  if (TARGET_VSX && TARGET_VSX_TIMODE)
 
13418
+    {
 
13419
+      rs6000_vector_mem[TImode] = VECTOR_VSX;
 
13420
+      rs6000_vector_align[TImode] = align64;
 
13421
+    }
 
13422
+
 
13423
   /* TODO add SPE and paired floating point vector support.  */
 
13424
 
 
13425
   /* Register class constraints for the constraints that depend on compile
 
13426
-     switches.  */
 
13427
+     switches. When the VSX code was added, different constraints were added
 
13428
+     based on the type (DFmode, V2DFmode, V4SFmode).  For the vector types, all
 
13429
+     of the VSX registers are used.  The register classes for scalar floating
 
13430
+     point types is set, based on whether we allow that type into the upper
 
13431
+     (Altivec) registers.  GCC has register classes to target the Altivec
 
13432
+     registers for load/store operations, to select using a VSX memory
 
13433
+     operation instead of the traditional floating point operation.  The
 
13434
+     constraints are:
 
13435
+
 
13436
+       d  - Register class to use with traditional DFmode instructions.
 
13437
+       f  - Register class to use with traditional SFmode instructions.
 
13438
+       v  - Altivec register.
 
13439
+       wa - Any VSX register.
 
13440
+       wd - Preferred register class for V2DFmode.
 
13441
+       wf - Preferred register class for V4SFmode.
 
13442
+       wg - Float register for power6x move insns.
 
13443
+       wl - Float register if we can do 32-bit signed int loads.
 
13444
+       wm - VSX register for ISA 2.07 direct move operations.
 
13445
+       wr - GPR if 64-bit mode is permitted.
 
13446
+       ws - Register class to do ISA 2.06 DF operations.
 
13447
+       wu - Altivec register for ISA 2.07 VSX SF/SI load/stores.
 
13448
+       wv - Altivec register for ISA 2.06 VSX DF/DI load/stores.
 
13449
+       wt - VSX register for TImode in VSX registers.
 
13450
+       ww - Register class to do SF conversions in with VSX operations.
 
13451
+       wx - Float register if we can do 32-bit int stores.
 
13452
+       wy - Register class to do ISA 2.07 SF operations.
 
13453
+       wz - Float register if we can do 32-bit unsigned int loads.  */
 
13454
+
 
13455
   if (TARGET_HARD_FLOAT && TARGET_FPRS)
 
13456
     rs6000_constraints[RS6000_CONSTRAINT_f] = FLOAT_REGS;
 
13457
 
 
13458
@@ -2092,64 +2587,158 @@
 
13459
 
 
13460
   if (TARGET_VSX)
 
13461
     {
 
13462
-      /* At present, we just use VSX_REGS, but we have different constraints
 
13463
-        based on the use, in case we want to fine tune the default register
 
13464
-        class used.  wa = any VSX register, wf = register class to use for
 
13465
-        V4SF, wd = register class to use for V2DF, and ws = register classs to
 
13466
-        use for DF scalars.  */
 
13467
       rs6000_constraints[RS6000_CONSTRAINT_wa] = VSX_REGS;
 
13468
+      rs6000_constraints[RS6000_CONSTRAINT_wd] = VSX_REGS;
 
13469
       rs6000_constraints[RS6000_CONSTRAINT_wf] = VSX_REGS;
 
13470
-      rs6000_constraints[RS6000_CONSTRAINT_wd] = VSX_REGS;
 
13471
-      rs6000_constraints[RS6000_CONSTRAINT_ws] = (TARGET_VSX_SCALAR_MEMORY
 
13472
-                                                 ? VSX_REGS
 
13473
-                                                 : FLOAT_REGS);
 
13474
+
 
13475
+      if (TARGET_VSX_TIMODE)
 
13476
+       rs6000_constraints[RS6000_CONSTRAINT_wt] = VSX_REGS;
 
13477
+
 
13478
+      if (TARGET_UPPER_REGS_DF)
 
13479
+       {
 
13480
+         rs6000_constraints[RS6000_CONSTRAINT_ws] = VSX_REGS;
 
13481
+         rs6000_constraints[RS6000_CONSTRAINT_wv] = ALTIVEC_REGS;
 
13482
+       }
 
13483
+      else
 
13484
+       rs6000_constraints[RS6000_CONSTRAINT_ws] = FLOAT_REGS;
 
13485
     }
 
13486
 
 
13487
+  /* Add conditional constraints based on various options, to allow us to
 
13488
+     collapse multiple insn patterns.  */
 
13489
   if (TARGET_ALTIVEC)
 
13490
     rs6000_constraints[RS6000_CONSTRAINT_v] = ALTIVEC_REGS;
 
13491
 
 
13492
-  /* Set up the reload helper functions.  */
 
13493
+  if (TARGET_MFPGPR)
 
13494
+    rs6000_constraints[RS6000_CONSTRAINT_wg] = FLOAT_REGS;
 
13495
+
 
13496
+  if (TARGET_LFIWAX)
 
13497
+    rs6000_constraints[RS6000_CONSTRAINT_wl] = FLOAT_REGS;
 
13498
+
 
13499
+  if (TARGET_DIRECT_MOVE)
 
13500
+    rs6000_constraints[RS6000_CONSTRAINT_wm] = VSX_REGS;
 
13501
+
 
13502
+  if (TARGET_POWERPC64)
 
13503
+    rs6000_constraints[RS6000_CONSTRAINT_wr] = GENERAL_REGS;
 
13504
+
 
13505
+  if (TARGET_P8_VECTOR && TARGET_UPPER_REGS_SF)
 
13506
+    {
 
13507
+      rs6000_constraints[RS6000_CONSTRAINT_wu] = ALTIVEC_REGS;
 
13508
+      rs6000_constraints[RS6000_CONSTRAINT_wy] = VSX_REGS;
 
13509
+      rs6000_constraints[RS6000_CONSTRAINT_ww] = VSX_REGS;
 
13510
+    }
 
13511
+  else if (TARGET_P8_VECTOR)
 
13512
+    {
 
13513
+      rs6000_constraints[RS6000_CONSTRAINT_wy] = FLOAT_REGS;
 
13514
+      rs6000_constraints[RS6000_CONSTRAINT_ww] = FLOAT_REGS;
 
13515
+    }
 
13516
+  else if (TARGET_VSX)
 
13517
+    rs6000_constraints[RS6000_CONSTRAINT_ww] = FLOAT_REGS;
 
13518
+
 
13519
+  if (TARGET_STFIWX)
 
13520
+    rs6000_constraints[RS6000_CONSTRAINT_wx] = FLOAT_REGS;
 
13521
+
 
13522
+  if (TARGET_LFIWZX)
 
13523
+    rs6000_constraints[RS6000_CONSTRAINT_wz] = FLOAT_REGS;
 
13524
+
 
13525
+  /* Set up the reload helper and direct move functions.  */
 
13526
   if (TARGET_VSX || TARGET_ALTIVEC)
 
13527
     {
 
13528
       if (TARGET_64BIT)
 
13529
        {
 
13530
-         rs6000_vector_reload[V16QImode][0] = CODE_FOR_reload_v16qi_di_store;
 
13531
-         rs6000_vector_reload[V16QImode][1] = CODE_FOR_reload_v16qi_di_load;
 
13532
-         rs6000_vector_reload[V8HImode][0]  = CODE_FOR_reload_v8hi_di_store;
 
13533
-         rs6000_vector_reload[V8HImode][1]  = CODE_FOR_reload_v8hi_di_load;
 
13534
-         rs6000_vector_reload[V4SImode][0]  = CODE_FOR_reload_v4si_di_store;
 
13535
-         rs6000_vector_reload[V4SImode][1]  = CODE_FOR_reload_v4si_di_load;
 
13536
-         rs6000_vector_reload[V2DImode][0]  = CODE_FOR_reload_v2di_di_store;
 
13537
-         rs6000_vector_reload[V2DImode][1]  = CODE_FOR_reload_v2di_di_load;
 
13538
-         rs6000_vector_reload[V4SFmode][0]  = CODE_FOR_reload_v4sf_di_store;
 
13539
-         rs6000_vector_reload[V4SFmode][1]  = CODE_FOR_reload_v4sf_di_load;
 
13540
-         rs6000_vector_reload[V2DFmode][0]  = CODE_FOR_reload_v2df_di_store;
 
13541
-         rs6000_vector_reload[V2DFmode][1]  = CODE_FOR_reload_v2df_di_load;
 
13542
-         if (TARGET_VSX && TARGET_VSX_SCALAR_MEMORY)
 
13543
+         reg_addr[V16QImode].reload_store = CODE_FOR_reload_v16qi_di_store;
 
13544
+         reg_addr[V16QImode].reload_load  = CODE_FOR_reload_v16qi_di_load;
 
13545
+         reg_addr[V8HImode].reload_store  = CODE_FOR_reload_v8hi_di_store;
 
13546
+         reg_addr[V8HImode].reload_load   = CODE_FOR_reload_v8hi_di_load;
 
13547
+         reg_addr[V4SImode].reload_store  = CODE_FOR_reload_v4si_di_store;
 
13548
+         reg_addr[V4SImode].reload_load   = CODE_FOR_reload_v4si_di_load;
 
13549
+         reg_addr[V2DImode].reload_store  = CODE_FOR_reload_v2di_di_store;
 
13550
+         reg_addr[V2DImode].reload_load   = CODE_FOR_reload_v2di_di_load;
 
13551
+         reg_addr[V4SFmode].reload_store  = CODE_FOR_reload_v4sf_di_store;
 
13552
+         reg_addr[V4SFmode].reload_load   = CODE_FOR_reload_v4sf_di_load;
 
13553
+         reg_addr[V2DFmode].reload_store  = CODE_FOR_reload_v2df_di_store;
 
13554
+         reg_addr[V2DFmode].reload_load   = CODE_FOR_reload_v2df_di_load;
 
13555
+         if (TARGET_VSX && TARGET_UPPER_REGS_DF)
 
13556
            {
 
13557
-             rs6000_vector_reload[DFmode][0]  = CODE_FOR_reload_df_di_store;
 
13558
-             rs6000_vector_reload[DFmode][1]  = CODE_FOR_reload_df_di_load;
 
13559
+             reg_addr[DFmode].reload_store  = CODE_FOR_reload_df_di_store;
 
13560
+             reg_addr[DFmode].reload_load   = CODE_FOR_reload_df_di_load;
 
13561
+             reg_addr[DDmode].reload_store  = CODE_FOR_reload_dd_di_store;
 
13562
+             reg_addr[DDmode].reload_load   = CODE_FOR_reload_dd_di_load;
 
13563
            }
 
13564
+         if (TARGET_P8_VECTOR)
 
13565
+           {
 
13566
+             reg_addr[SFmode].reload_store  = CODE_FOR_reload_sf_di_store;
 
13567
+             reg_addr[SFmode].reload_load   = CODE_FOR_reload_sf_di_load;
 
13568
+             reg_addr[SDmode].reload_store  = CODE_FOR_reload_sd_di_store;
 
13569
+             reg_addr[SDmode].reload_load   = CODE_FOR_reload_sd_di_load;
 
13570
+           }
 
13571
+         if (TARGET_VSX_TIMODE)
 
13572
+           {
 
13573
+             reg_addr[TImode].reload_store  = CODE_FOR_reload_ti_di_store;
 
13574
+             reg_addr[TImode].reload_load   = CODE_FOR_reload_ti_di_load;
 
13575
+           }
 
13576
+         if (TARGET_DIRECT_MOVE)
 
13577
+           {
 
13578
+             if (TARGET_POWERPC64)
 
13579
+               {
 
13580
+                 reg_addr[TImode].reload_gpr_vsx    = CODE_FOR_reload_gpr_from_vsxti;
 
13581
+                 reg_addr[V2DFmode].reload_gpr_vsx  = CODE_FOR_reload_gpr_from_vsxv2df;
 
13582
+                 reg_addr[V2DImode].reload_gpr_vsx  = CODE_FOR_reload_gpr_from_vsxv2di;
 
13583
+                 reg_addr[V4SFmode].reload_gpr_vsx  = CODE_FOR_reload_gpr_from_vsxv4sf;
 
13584
+                 reg_addr[V4SImode].reload_gpr_vsx  = CODE_FOR_reload_gpr_from_vsxv4si;
 
13585
+                 reg_addr[V8HImode].reload_gpr_vsx  = CODE_FOR_reload_gpr_from_vsxv8hi;
 
13586
+                 reg_addr[V16QImode].reload_gpr_vsx = CODE_FOR_reload_gpr_from_vsxv16qi;
 
13587
+                 reg_addr[SFmode].reload_gpr_vsx    = CODE_FOR_reload_gpr_from_vsxsf;
 
13588
+
 
13589
+                 reg_addr[TImode].reload_vsx_gpr    = CODE_FOR_reload_vsx_from_gprti;
 
13590
+                 reg_addr[V2DFmode].reload_vsx_gpr  = CODE_FOR_reload_vsx_from_gprv2df;
 
13591
+                 reg_addr[V2DImode].reload_vsx_gpr  = CODE_FOR_reload_vsx_from_gprv2di;
 
13592
+                 reg_addr[V4SFmode].reload_vsx_gpr  = CODE_FOR_reload_vsx_from_gprv4sf;
 
13593
+                 reg_addr[V4SImode].reload_vsx_gpr  = CODE_FOR_reload_vsx_from_gprv4si;
 
13594
+                 reg_addr[V8HImode].reload_vsx_gpr  = CODE_FOR_reload_vsx_from_gprv8hi;
 
13595
+                 reg_addr[V16QImode].reload_vsx_gpr = CODE_FOR_reload_vsx_from_gprv16qi;
 
13596
+                 reg_addr[SFmode].reload_vsx_gpr    = CODE_FOR_reload_vsx_from_gprsf;
 
13597
+               }
 
13598
+             else
 
13599
+               {
 
13600
+                 reg_addr[DImode].reload_fpr_gpr = CODE_FOR_reload_fpr_from_gprdi;
 
13601
+                 reg_addr[DDmode].reload_fpr_gpr = CODE_FOR_reload_fpr_from_gprdd;
 
13602
+                 reg_addr[DFmode].reload_fpr_gpr = CODE_FOR_reload_fpr_from_gprdf;
 
13603
+               }
 
13604
+           }
 
13605
        }
 
13606
       else
 
13607
        {
 
13608
-         rs6000_vector_reload[V16QImode][0] = CODE_FOR_reload_v16qi_si_store;
 
13609
-         rs6000_vector_reload[V16QImode][1] = CODE_FOR_reload_v16qi_si_load;
 
13610
-         rs6000_vector_reload[V8HImode][0]  = CODE_FOR_reload_v8hi_si_store;
 
13611
-         rs6000_vector_reload[V8HImode][1]  = CODE_FOR_reload_v8hi_si_load;
 
13612
-         rs6000_vector_reload[V4SImode][0]  = CODE_FOR_reload_v4si_si_store;
 
13613
-         rs6000_vector_reload[V4SImode][1]  = CODE_FOR_reload_v4si_si_load;
 
13614
-         rs6000_vector_reload[V2DImode][0]  = CODE_FOR_reload_v2di_si_store;
 
13615
-         rs6000_vector_reload[V2DImode][1]  = CODE_FOR_reload_v2di_si_load;
 
13616
-         rs6000_vector_reload[V4SFmode][0]  = CODE_FOR_reload_v4sf_si_store;
 
13617
-         rs6000_vector_reload[V4SFmode][1]  = CODE_FOR_reload_v4sf_si_load;
 
13618
-         rs6000_vector_reload[V2DFmode][0]  = CODE_FOR_reload_v2df_si_store;
 
13619
-         rs6000_vector_reload[V2DFmode][1]  = CODE_FOR_reload_v2df_si_load;
 
13620
-         if (TARGET_VSX && TARGET_VSX_SCALAR_MEMORY)
 
13621
+         reg_addr[V16QImode].reload_store = CODE_FOR_reload_v16qi_si_store;
 
13622
+         reg_addr[V16QImode].reload_load  = CODE_FOR_reload_v16qi_si_load;
 
13623
+         reg_addr[V8HImode].reload_store  = CODE_FOR_reload_v8hi_si_store;
 
13624
+         reg_addr[V8HImode].reload_load   = CODE_FOR_reload_v8hi_si_load;
 
13625
+         reg_addr[V4SImode].reload_store  = CODE_FOR_reload_v4si_si_store;
 
13626
+         reg_addr[V4SImode].reload_load   = CODE_FOR_reload_v4si_si_load;
 
13627
+         reg_addr[V2DImode].reload_store  = CODE_FOR_reload_v2di_si_store;
 
13628
+         reg_addr[V2DImode].reload_load   = CODE_FOR_reload_v2di_si_load;
 
13629
+         reg_addr[V4SFmode].reload_store  = CODE_FOR_reload_v4sf_si_store;
 
13630
+         reg_addr[V4SFmode].reload_load   = CODE_FOR_reload_v4sf_si_load;
 
13631
+         reg_addr[V2DFmode].reload_store  = CODE_FOR_reload_v2df_si_store;
 
13632
+         reg_addr[V2DFmode].reload_load   = CODE_FOR_reload_v2df_si_load;
 
13633
+         if (TARGET_VSX && TARGET_UPPER_REGS_DF)
 
13634
            {
 
13635
-             rs6000_vector_reload[DFmode][0]  = CODE_FOR_reload_df_si_store;
 
13636
-             rs6000_vector_reload[DFmode][1]  = CODE_FOR_reload_df_si_load;
 
13637
+             reg_addr[DFmode].reload_store  = CODE_FOR_reload_df_si_store;
 
13638
+             reg_addr[DFmode].reload_load   = CODE_FOR_reload_df_si_load;
 
13639
+             reg_addr[DDmode].reload_store  = CODE_FOR_reload_dd_si_store;
 
13640
+             reg_addr[DDmode].reload_load   = CODE_FOR_reload_dd_si_load;
 
13641
            }
 
13642
+         if (TARGET_P8_VECTOR)
 
13643
+           {
 
13644
+             reg_addr[SFmode].reload_store  = CODE_FOR_reload_sf_si_store;
 
13645
+             reg_addr[SFmode].reload_load   = CODE_FOR_reload_sf_si_load;
 
13646
+             reg_addr[SDmode].reload_store  = CODE_FOR_reload_sd_si_store;
 
13647
+             reg_addr[SDmode].reload_load   = CODE_FOR_reload_sd_si_load;
 
13648
+           }
 
13649
+         if (TARGET_VSX_TIMODE)
 
13650
+           {
 
13651
+             reg_addr[TImode].reload_store  = CODE_FOR_reload_ti_si_store;
 
13652
+             reg_addr[TImode].reload_load   = CODE_FOR_reload_ti_si_load;
 
13653
+           }
 
13654
        }
 
13655
     }
 
13656
 
 
13657
@@ -2267,6 +2856,11 @@
 
13658
        }
 
13659
     }
 
13660
 
 
13661
+  /* Update the addr mask bits in reg_addr to help secondary reload and go if
 
13662
+     legitimate address support to figure out the appropriate addressing to
 
13663
+     use.  */
 
13664
+  rs6000_setup_reg_addr_masks ();
 
13665
+
 
13666
   if (global_init_p || TARGET_DEBUG_TARGET)
 
13667
     {
 
13668
       if (TARGET_DEBUG_REG)
 
13669
@@ -2369,16 +2963,19 @@
 
13670
 HOST_WIDE_INT
 
13671
 rs6000_builtin_mask_calculate (void)
 
13672
 {
 
13673
-  return (((TARGET_ALTIVEC)                ? RS6000_BTM_ALTIVEC  : 0)
 
13674
-         | ((TARGET_VSX)                   ? RS6000_BTM_VSX      : 0)
 
13675
-         | ((TARGET_SPE)                   ? RS6000_BTM_SPE      : 0)
 
13676
-         | ((TARGET_PAIRED_FLOAT)          ? RS6000_BTM_PAIRED   : 0)
 
13677
-         | ((TARGET_FRE)                   ? RS6000_BTM_FRE      : 0)
 
13678
-         | ((TARGET_FRES)                  ? RS6000_BTM_FRES     : 0)
 
13679
-         | ((TARGET_FRSQRTE)               ? RS6000_BTM_FRSQRTE  : 0)
 
13680
-         | ((TARGET_FRSQRTES)              ? RS6000_BTM_FRSQRTES : 0)
 
13681
-         | ((TARGET_POPCNTD)               ? RS6000_BTM_POPCNTD  : 0)
 
13682
-         | ((rs6000_cpu == PROCESSOR_CELL) ? RS6000_BTM_CELL     : 0));
 
13683
+  return (((TARGET_ALTIVEC)                ? RS6000_BTM_ALTIVEC   : 0)
 
13684
+         | ((TARGET_VSX)                   ? RS6000_BTM_VSX       : 0)
 
13685
+         | ((TARGET_SPE)                   ? RS6000_BTM_SPE       : 0)
 
13686
+         | ((TARGET_PAIRED_FLOAT)          ? RS6000_BTM_PAIRED    : 0)
 
13687
+         | ((TARGET_FRE)                   ? RS6000_BTM_FRE       : 0)
 
13688
+         | ((TARGET_FRES)                  ? RS6000_BTM_FRES      : 0)
 
13689
+         | ((TARGET_FRSQRTE)               ? RS6000_BTM_FRSQRTE   : 0)
 
13690
+         | ((TARGET_FRSQRTES)              ? RS6000_BTM_FRSQRTES  : 0)
 
13691
+         | ((TARGET_POPCNTD)               ? RS6000_BTM_POPCNTD   : 0)
 
13692
+         | ((rs6000_cpu == PROCESSOR_CELL) ? RS6000_BTM_CELL      : 0)
 
13693
+         | ((TARGET_P8_VECTOR)             ? RS6000_BTM_P8_VECTOR : 0)
 
13694
+         | ((TARGET_CRYPTO)                ? RS6000_BTM_CRYPTO    : 0)
 
13695
+         | ((TARGET_HTM)                   ? RS6000_BTM_HTM       : 0));
 
13696
 }
 
13697
 
 
13698
 /* Override command line options.  Mostly we process the processor type and
 
13699
@@ -2609,6 +3206,12 @@
 
13700
        }
 
13701
     }
 
13702
 
 
13703
+  /* If little-endian, default to -mstrict-align on older processors.
 
13704
+     Testing for htm matches power8 and later.  */
 
13705
+  if (!BYTES_BIG_ENDIAN
 
13706
+      && !(processor_target_table[tune_index].target_enable & OPTION_MASK_HTM))
 
13707
+    rs6000_isa_flags |= ~rs6000_isa_flags_explicit & OPTION_MASK_STRICT_ALIGN;
 
13708
+
 
13709
   /* Add some warnings for VSX.  */
 
13710
   if (TARGET_VSX)
 
13711
     {
 
13712
@@ -2619,15 +3222,13 @@
 
13713
          if (rs6000_isa_flags_explicit & OPTION_MASK_VSX)
 
13714
            msg = N_("-mvsx requires hardware floating point");
 
13715
          else
 
13716
-           rs6000_isa_flags &= ~ OPTION_MASK_VSX;
 
13717
+           {
 
13718
+             rs6000_isa_flags &= ~ OPTION_MASK_VSX;
 
13719
+             rs6000_isa_flags_explicit |= OPTION_MASK_VSX;
 
13720
+           }
 
13721
        }
 
13722
       else if (TARGET_PAIRED_FLOAT)
 
13723
        msg = N_("-mvsx and -mpaired are incompatible");
 
13724
-      /* The hardware will allow VSX and little endian, but until we make sure
 
13725
-        things like vector select, etc. work don't allow VSX on little endian
 
13726
-        systems at this point.  */
 
13727
-      else if (!BYTES_BIG_ENDIAN)
 
13728
-       msg = N_("-mvsx used with little endian code");
 
13729
       else if (TARGET_AVOID_XFORM > 0)
 
13730
        msg = N_("-mvsx needs indexed addressing");
 
13731
       else if (!TARGET_ALTIVEC && (rs6000_isa_flags_explicit
 
13732
@@ -2647,9 +3248,24 @@
 
13733
        }
 
13734
     }
 
13735
 
 
13736
+  /* If hard-float/altivec/vsx were explicitly turned off then don't allow
 
13737
+     the -mcpu setting to enable options that conflict. */
 
13738
+  if ((!TARGET_HARD_FLOAT || !TARGET_ALTIVEC || !TARGET_VSX)
 
13739
+      && (rs6000_isa_flags_explicit & (OPTION_MASK_SOFT_FLOAT
 
13740
+                                      | OPTION_MASK_ALTIVEC
 
13741
+                                      | OPTION_MASK_VSX)) != 0)
 
13742
+    rs6000_isa_flags &= ~((OPTION_MASK_P8_VECTOR | OPTION_MASK_CRYPTO
 
13743
+                          | OPTION_MASK_DIRECT_MOVE)
 
13744
+                        & ~rs6000_isa_flags_explicit);
 
13745
+
 
13746
+  if (TARGET_DEBUG_REG || TARGET_DEBUG_TARGET)
 
13747
+    rs6000_print_isa_options (stderr, 0, "before defaults", rs6000_isa_flags);
 
13748
+
 
13749
   /* For the newer switches (vsx, dfp, etc.) set some of the older options,
 
13750
      unless the user explicitly used the -mno-<option> to disable the code.  */
 
13751
-  if (TARGET_VSX)
 
13752
+  if (TARGET_P8_VECTOR || TARGET_DIRECT_MOVE || TARGET_CRYPTO)
 
13753
+    rs6000_isa_flags |= (ISA_2_7_MASKS_SERVER & ~rs6000_isa_flags_explicit);
 
13754
+  else if (TARGET_VSX)
 
13755
     rs6000_isa_flags |= (ISA_2_6_MASKS_SERVER & ~rs6000_isa_flags_explicit);
 
13756
   else if (TARGET_POPCNTD)
 
13757
     rs6000_isa_flags |= (ISA_2_6_MASKS_EMBEDDED & ~rs6000_isa_flags_explicit);
 
13758
@@ -2664,6 +3280,69 @@
 
13759
   else if (TARGET_ALTIVEC)
 
13760
     rs6000_isa_flags |= (OPTION_MASK_PPC_GFXOPT & ~rs6000_isa_flags_explicit);
 
13761
 
 
13762
+  if (TARGET_CRYPTO && !TARGET_ALTIVEC)
 
13763
+    {
 
13764
+      if (rs6000_isa_flags_explicit & OPTION_MASK_CRYPTO)
 
13765
+       error ("-mcrypto requires -maltivec");
 
13766
+      rs6000_isa_flags &= ~OPTION_MASK_CRYPTO;
 
13767
+    }
 
13768
+
 
13769
+  if (TARGET_DIRECT_MOVE && !TARGET_VSX)
 
13770
+    {
 
13771
+      if (rs6000_isa_flags_explicit & OPTION_MASK_DIRECT_MOVE)
 
13772
+       error ("-mdirect-move requires -mvsx");
 
13773
+      rs6000_isa_flags &= ~OPTION_MASK_DIRECT_MOVE;
 
13774
+    }
 
13775
+
 
13776
+  if (TARGET_P8_VECTOR && !TARGET_ALTIVEC)
 
13777
+    {
 
13778
+      if (rs6000_isa_flags_explicit & OPTION_MASK_P8_VECTOR)
 
13779
+       error ("-mpower8-vector requires -maltivec");
 
13780
+      rs6000_isa_flags &= ~OPTION_MASK_P8_VECTOR;
 
13781
+    }
 
13782
+
 
13783
+  if (TARGET_P8_VECTOR && !TARGET_VSX)
 
13784
+    {
 
13785
+      if (rs6000_isa_flags_explicit & OPTION_MASK_P8_VECTOR)
 
13786
+       error ("-mpower8-vector requires -mvsx");
 
13787
+      rs6000_isa_flags &= ~OPTION_MASK_P8_VECTOR;
 
13788
+    }
 
13789
+
 
13790
+  if (TARGET_VSX_TIMODE && !TARGET_VSX)
 
13791
+    {
 
13792
+      if (rs6000_isa_flags_explicit & OPTION_MASK_VSX_TIMODE)
 
13793
+       error ("-mvsx-timode requires -mvsx");
 
13794
+      rs6000_isa_flags &= ~OPTION_MASK_VSX_TIMODE;
 
13795
+    }
 
13796
+
 
13797
+  /* The quad memory instructions only works in 64-bit mode. In 32-bit mode,
 
13798
+     silently turn off quad memory mode.  */
 
13799
+  if (TARGET_QUAD_MEMORY && !TARGET_POWERPC64)
 
13800
+    {
 
13801
+      if ((rs6000_isa_flags_explicit & OPTION_MASK_QUAD_MEMORY) != 0)
 
13802
+       warning (0, N_("-mquad-memory requires 64-bit mode"));
 
13803
+
 
13804
+      rs6000_isa_flags &= ~OPTION_MASK_QUAD_MEMORY;
 
13805
+    }
 
13806
+
 
13807
+  /* Enable power8 fusion if we are tuning for power8, even if we aren't
 
13808
+     generating power8 instructions.  */
 
13809
+  if (!(rs6000_isa_flags_explicit & OPTION_MASK_P8_FUSION))
 
13810
+    rs6000_isa_flags |= (processor_target_table[tune_index].target_enable
 
13811
+                        & OPTION_MASK_P8_FUSION);
 
13812
+
 
13813
+  /* Power8 does not fuse sign extended loads with the addis.  If we are
 
13814
+     optimizing at high levels for speed, convert a sign extended load into a
 
13815
+     zero extending load, and an explicit sign extension.  */
 
13816
+  if (TARGET_P8_FUSION
 
13817
+      && !(rs6000_isa_flags_explicit & OPTION_MASK_P8_FUSION_SIGN)
 
13818
+      && optimize_function_for_speed_p (cfun)
 
13819
+      && optimize >= 3)
 
13820
+    rs6000_isa_flags |= OPTION_MASK_P8_FUSION_SIGN;
 
13821
+
 
13822
+  if (TARGET_DEBUG_REG || TARGET_DEBUG_TARGET)
 
13823
+    rs6000_print_isa_options (stderr, 0, "after defaults", rs6000_isa_flags);
 
13824
+
 
13825
   /* E500mc does "better" if we inline more aggressively.  Respect the
 
13826
      user's opinion, though.  */
 
13827
   if (rs6000_block_move_inline_limit == 0
 
13828
@@ -2790,6 +3469,9 @@
 
13829
   if (flag_section_anchors)
 
13830
     TARGET_NO_FP_IN_TOC = 1;
 
13831
 
 
13832
+  if (TARGET_DEBUG_REG || TARGET_DEBUG_TARGET)
 
13833
+    rs6000_print_isa_options (stderr, 0, "before subtarget", rs6000_isa_flags);
 
13834
+
 
13835
 #ifdef SUBTARGET_OVERRIDE_OPTIONS
 
13836
   SUBTARGET_OVERRIDE_OPTIONS;
 
13837
 #endif
 
13838
@@ -2800,6 +3482,9 @@
 
13839
   SUB3TARGET_OVERRIDE_OPTIONS;
 
13840
 #endif
 
13841
 
 
13842
+  if (TARGET_DEBUG_REG || TARGET_DEBUG_TARGET)
 
13843
+    rs6000_print_isa_options (stderr, 0, "after subtarget", rs6000_isa_flags);
 
13844
+
 
13845
   /* For the E500 family of cores, reset the single/double FP flags to let us
 
13846
      check that they remain constant across attributes or pragmas.  Also,
 
13847
      clear a possible request for string instructions, not supported and which
 
13848
@@ -2849,16 +3534,19 @@
 
13849
                        && rs6000_cpu != PROCESSOR_POWER5
 
13850
                        && rs6000_cpu != PROCESSOR_POWER6
 
13851
                        && rs6000_cpu != PROCESSOR_POWER7
 
13852
+                       && rs6000_cpu != PROCESSOR_POWER8
 
13853
                        && rs6000_cpu != PROCESSOR_PPCA2
 
13854
                        && rs6000_cpu != PROCESSOR_CELL
 
13855
                        && rs6000_cpu != PROCESSOR_PPC476);
 
13856
   rs6000_sched_groups = (rs6000_cpu == PROCESSOR_POWER4
 
13857
                         || rs6000_cpu == PROCESSOR_POWER5
 
13858
-                        || rs6000_cpu == PROCESSOR_POWER7);
 
13859
+                        || rs6000_cpu == PROCESSOR_POWER7
 
13860
+                        || rs6000_cpu == PROCESSOR_POWER8);
 
13861
   rs6000_align_branch_targets = (rs6000_cpu == PROCESSOR_POWER4
 
13862
                                 || rs6000_cpu == PROCESSOR_POWER5
 
13863
                                 || rs6000_cpu == PROCESSOR_POWER6
 
13864
                                 || rs6000_cpu == PROCESSOR_POWER7
 
13865
+                                || rs6000_cpu == PROCESSOR_POWER8
 
13866
                                 || rs6000_cpu == PROCESSOR_PPCE500MC
 
13867
                                 || rs6000_cpu == PROCESSOR_PPCE500MC64
 
13868
                                 || rs6000_cpu == PROCESSOR_PPCE5500
 
13869
@@ -2988,7 +3676,7 @@
 
13870
 
 
13871
       /* We should always be splitting complex arguments, but we can't break
 
13872
         Linux and Darwin ABIs at the moment.  For now, only AIX is fixed.  */
 
13873
-      if (DEFAULT_ABI != ABI_AIX)
 
13874
+      if (DEFAULT_ABI == ABI_V4 || DEFAULT_ABI == ABI_DARWIN)
 
13875
        targetm.calls.split_complex_arg = NULL;
 
13876
     }
 
13877
 
 
13878
@@ -3102,6 +3790,10 @@
 
13879
        rs6000_cost = &power7_cost;
 
13880
        break;
 
13881
 
 
13882
+      case PROCESSOR_POWER8:
 
13883
+       rs6000_cost = &power8_cost;
 
13884
+       break;
 
13885
+
 
13886
       case PROCESSOR_PPCA2:
 
13887
        rs6000_cost = &ppca2_cost;
 
13888
        break;
 
13889
@@ -3274,7 +3966,8 @@
 
13890
       && (rs6000_cpu == PROCESSOR_POWER4
 
13891
          || rs6000_cpu == PROCESSOR_POWER5
 
13892
          || rs6000_cpu == PROCESSOR_POWER6
 
13893
-         || rs6000_cpu == PROCESSOR_POWER7))
 
13894
+         || rs6000_cpu == PROCESSOR_POWER7
 
13895
+         || rs6000_cpu == PROCESSOR_POWER8))
 
13896
     return 5;
 
13897
   else
 
13898
     return align_loops_log;
 
13899
@@ -3813,6 +4506,22 @@
 
13900
       enum built_in_function fn = DECL_FUNCTION_CODE (fndecl);
 
13901
       switch (fn)
 
13902
        {
 
13903
+       case BUILT_IN_CLZIMAX:
 
13904
+       case BUILT_IN_CLZLL:
 
13905
+       case BUILT_IN_CLZL:
 
13906
+       case BUILT_IN_CLZ:
 
13907
+         if (TARGET_P8_VECTOR && in_mode == out_mode && out_n == in_n)
 
13908
+           {
 
13909
+             if (out_mode == QImode && out_n == 16)
 
13910
+               return rs6000_builtin_decls[P8V_BUILTIN_VCLZB];
 
13911
+             else if (out_mode == HImode && out_n == 8)
 
13912
+               return rs6000_builtin_decls[P8V_BUILTIN_VCLZH];
 
13913
+             else if (out_mode == SImode && out_n == 4)
 
13914
+               return rs6000_builtin_decls[P8V_BUILTIN_VCLZW];
 
13915
+             else if (out_mode == DImode && out_n == 2)
 
13916
+               return rs6000_builtin_decls[P8V_BUILTIN_VCLZD];
 
13917
+           }
 
13918
+         break;
 
13919
        case BUILT_IN_COPYSIGN:
 
13920
          if (VECTOR_UNIT_VSX_P (V2DFmode)
 
13921
              && out_mode == DFmode && out_n == 2
 
13922
@@ -3828,6 +4537,22 @@
 
13923
          if (VECTOR_UNIT_ALTIVEC_P (V4SFmode))
 
13924
            return rs6000_builtin_decls[ALTIVEC_BUILTIN_COPYSIGN_V4SF];
 
13925
          break;
 
13926
+       case BUILT_IN_POPCOUNTIMAX:
 
13927
+       case BUILT_IN_POPCOUNTLL:
 
13928
+       case BUILT_IN_POPCOUNTL:
 
13929
+       case BUILT_IN_POPCOUNT:
 
13930
+         if (TARGET_P8_VECTOR && in_mode == out_mode && out_n == in_n)
 
13931
+           {
 
13932
+             if (out_mode == QImode && out_n == 16)
 
13933
+               return rs6000_builtin_decls[P8V_BUILTIN_VPOPCNTB];
 
13934
+             else if (out_mode == HImode && out_n == 8)
 
13935
+               return rs6000_builtin_decls[P8V_BUILTIN_VPOPCNTH];
 
13936
+             else if (out_mode == SImode && out_n == 4)
 
13937
+               return rs6000_builtin_decls[P8V_BUILTIN_VPOPCNTW];
 
13938
+             else if (out_mode == DImode && out_n == 2)
 
13939
+               return rs6000_builtin_decls[P8V_BUILTIN_VPOPCNTD];
 
13940
+           }
 
13941
+         break;
 
13942
        case BUILT_IN_SQRT:
 
13943
          if (VECTOR_UNIT_VSX_P (V2DFmode)
 
13944
              && out_mode == DFmode && out_n == 2
 
13945
@@ -4043,7 +4768,11 @@
 
13946
        putc ('\n', file);
 
13947
     }
 
13948
 
 
13949
-  if (DEFAULT_ABI == ABI_AIX || (TARGET_ELF && flag_pic == 2))
 
13950
+  if (DEFAULT_ABI == ABI_ELFv2)
 
13951
+    fprintf (file, "\t.abiversion 2\n");
 
13952
+
 
13953
+  if (DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_ELFv2
 
13954
+      || (TARGET_ELF && flag_pic == 2))
 
13955
     {
 
13956
       switch_to_section (toc_section);
 
13957
       switch_to_section (text_section);
 
13958
@@ -4274,15 +5003,16 @@
 
13959
 
 
13960
   /* Check if VAL is present in every STEP-th element, and the
 
13961
      other elements are filled with its most significant bit.  */
 
13962
-  for (i = 0; i < nunits - 1; ++i)
 
13963
+  for (i = 1; i < nunits; ++i)
 
13964
     {
 
13965
       HOST_WIDE_INT desired_val;
 
13966
-      if (((BYTES_BIG_ENDIAN ? i + 1 : i) & (step - 1)) == 0)
 
13967
+      unsigned elt = BYTES_BIG_ENDIAN ? nunits - 1 - i : i;
 
13968
+      if ((i & (step - 1)) == 0)
 
13969
        desired_val = val;
 
13970
       else
 
13971
        desired_val = msb_val;
 
13972
 
 
13973
-      if (desired_val != const_vector_elt_as_int (op, i))
 
13974
+      if (desired_val != const_vector_elt_as_int (op, elt))
 
13975
        return false;
 
13976
     }
 
13977
 
 
13978
@@ -4698,8 +5428,11 @@
 
13979
        {
 
13980
          rtx freg = gen_reg_rtx (V4SFmode);
 
13981
          rtx sreg = force_reg (SFmode, XVECEXP (vals, 0, 0));
 
13982
+         rtx cvt  = ((TARGET_XSCVDPSPN)
 
13983
+                     ? gen_vsx_xscvdpspn_scalar (freg, sreg)
 
13984
+                     : gen_vsx_xscvdpsp_scalar (freg, sreg));
 
13985
 
 
13986
-         emit_insn (gen_vsx_xscvdpsp_scalar (freg, sreg));
 
13987
+         emit_insn (cvt);
 
13988
          emit_insn (gen_vsx_xxspltw_v4sf (target, freg, const0_rtx));
 
13989
        }
 
13990
       else
 
13991
@@ -4726,6 +5459,7 @@
 
13992
      of 64-bit items is not supported on Altivec.  */
 
13993
   if (all_same && GET_MODE_SIZE (inner_mode) <= 4)
 
13994
     {
 
13995
+      rtx field;
 
13996
       mem = assign_stack_temp (mode, GET_MODE_SIZE (inner_mode));
 
13997
       emit_move_insn (adjust_address_nv (mem, inner_mode, 0),
 
13998
                      XVECEXP (vals, 0, 0));
 
13999
@@ -4736,9 +5470,11 @@
 
14000
                                              gen_rtx_SET (VOIDmode,
 
14001
                                                           target, mem),
 
14002
                                              x)));
 
14003
+      field = (BYTES_BIG_ENDIAN ? const0_rtx
 
14004
+              : GEN_INT (GET_MODE_NUNITS (mode) - 1));
 
14005
       x = gen_rtx_VEC_SELECT (inner_mode, target,
 
14006
                              gen_rtx_PARALLEL (VOIDmode,
 
14007
-                                               gen_rtvec (1, const0_rtx)));
 
14008
+                                               gen_rtvec (1, field)));
 
14009
       emit_insn (gen_rtx_SET (VOIDmode, target,
 
14010
                              gen_rtx_VEC_DUPLICATE (mode, x)));
 
14011
       return;
 
14012
@@ -4811,10 +5547,27 @@
 
14013
     XVECEXP (mask, 0, elt*width + i)
 
14014
       = GEN_INT (i + 0x10);
 
14015
   x = gen_rtx_CONST_VECTOR (V16QImode, XVEC (mask, 0));
 
14016
-  x = gen_rtx_UNSPEC (mode,
 
14017
-                     gen_rtvec (3, target, reg,
 
14018
-                                force_reg (V16QImode, x)),
 
14019
-                     UNSPEC_VPERM);
 
14020
+
 
14021
+  if (BYTES_BIG_ENDIAN)
 
14022
+    x = gen_rtx_UNSPEC (mode,
 
14023
+                       gen_rtvec (3, target, reg,
 
14024
+                                  force_reg (V16QImode, x)),
 
14025
+                       UNSPEC_VPERM);
 
14026
+  else 
 
14027
+    {
 
14028
+      /* Invert selector.  */
 
14029
+      rtx splat = gen_rtx_VEC_DUPLICATE (V16QImode,
 
14030
+                                        gen_rtx_CONST_INT (QImode, -1));
 
14031
+      rtx tmp = gen_reg_rtx (V16QImode);
 
14032
+      emit_move_insn (tmp, splat);
 
14033
+      x = gen_rtx_MINUS (V16QImode, tmp, force_reg (V16QImode, x));
 
14034
+      emit_move_insn (tmp, x);
 
14035
+
 
14036
+      /* Permute with operands reversed and adjusted selector.  */
 
14037
+      x = gen_rtx_UNSPEC (mode, gen_rtvec (3, reg, target, tmp),
 
14038
+                         UNSPEC_VPERM);
 
14039
+    }
 
14040
+
 
14041
   emit_insn (gen_rtx_SET (VOIDmode, target, x));
 
14042
 }
 
14043
 
 
14044
@@ -4938,7 +5691,7 @@
 
14045
         purpose.  */
 
14046
       if (GET_CODE (op) == SUBREG
 
14047
          && (mode == SImode || mode == DImode || mode == TImode
 
14048
-             || mode == DDmode || mode == TDmode)
 
14049
+             || mode == DDmode || mode == TDmode || mode == PTImode)
 
14050
          && REG_P (SUBREG_REG (op))
 
14051
          && (GET_MODE (SUBREG_REG (op)) == DFmode
 
14052
              || GET_MODE (SUBREG_REG (op)) == TFmode))
 
14053
@@ -4951,6 +5704,7 @@
 
14054
          && REG_P (SUBREG_REG (op))
 
14055
          && (GET_MODE (SUBREG_REG (op)) == DImode
 
14056
              || GET_MODE (SUBREG_REG (op)) == TImode
 
14057
+             || GET_MODE (SUBREG_REG (op)) == PTImode
 
14058
              || GET_MODE (SUBREG_REG (op)) == DDmode
 
14059
              || GET_MODE (SUBREG_REG (op)) == TDmode))
 
14060
        return true;
 
14061
@@ -5087,6 +5841,72 @@
 
14062
          || (REG_P (op1) && INT_REGNO_P (REGNO (op1))));
 
14063
 }
 
14064
 
 
14065
+/* Return true if this is a move direct operation between GPR registers and
 
14066
+   floating point/VSX registers.  */
 
14067
+
 
14068
+bool
 
14069
+direct_move_p (rtx op0, rtx op1)
 
14070
+{
 
14071
+  int regno0, regno1;
 
14072
+
 
14073
+  if (!REG_P (op0) || !REG_P (op1))
 
14074
+    return false;
 
14075
+
 
14076
+  if (!TARGET_DIRECT_MOVE && !TARGET_MFPGPR)
 
14077
+    return false;
 
14078
+
 
14079
+  regno0 = REGNO (op0);
 
14080
+  regno1 = REGNO (op1);
 
14081
+  if (regno0 >= FIRST_PSEUDO_REGISTER || regno1 >= FIRST_PSEUDO_REGISTER)
 
14082
+    return false;
 
14083
+
 
14084
+  if (INT_REGNO_P (regno0))
 
14085
+    return (TARGET_DIRECT_MOVE) ? VSX_REGNO_P (regno1) : FP_REGNO_P (regno1);
 
14086
+
 
14087
+  else if (INT_REGNO_P (regno1))
 
14088
+    {
 
14089
+      if (TARGET_MFPGPR && FP_REGNO_P (regno0))
 
14090
+       return true;
 
14091
+
 
14092
+      else if (TARGET_DIRECT_MOVE && VSX_REGNO_P (regno0))
 
14093
+       return true;
 
14094
+    }
 
14095
+
 
14096
+  return false;
 
14097
+}
 
14098
+
 
14099
+/* Return true if this is a load or store quad operation.  */
 
14100
+
 
14101
+bool
 
14102
+quad_load_store_p (rtx op0, rtx op1)
 
14103
+{
 
14104
+  bool ret;
 
14105
+
 
14106
+  if (!TARGET_QUAD_MEMORY)
 
14107
+    ret = false;
 
14108
+
 
14109
+  else if (REG_P (op0) && MEM_P (op1))
 
14110
+    ret = (quad_int_reg_operand (op0, GET_MODE (op0))
 
14111
+          && quad_memory_operand (op1, GET_MODE (op1))
 
14112
+          && !reg_overlap_mentioned_p (op0, op1));
 
14113
+
 
14114
+  else if (MEM_P (op0) && REG_P (op1))
 
14115
+    ret = (quad_memory_operand (op0, GET_MODE (op0))
 
14116
+          && quad_int_reg_operand (op1, GET_MODE (op1)));
 
14117
+
 
14118
+  else
 
14119
+    ret = false;
 
14120
+
 
14121
+  if (TARGET_DEBUG_ADDR)
 
14122
+    {
 
14123
+      fprintf (stderr, "\n========== quad_load_store, return %s\n",
 
14124
+              ret ? "true" : "false");
 
14125
+      debug_rtx (gen_rtx_SET (VOIDmode, op0, op1));
 
14126
+    }
 
14127
+
 
14128
+  return ret;
 
14129
+}
 
14130
+
 
14131
 /* Given an address, return a constant offset term if one exists.  */
 
14132
 
 
14133
 static rtx
 
14134
@@ -5170,7 +5990,11 @@
 
14135
     case V4SImode:
 
14136
     case V2DFmode:
 
14137
     case V2DImode:
 
14138
-      /* AltiVec/VSX vector modes.  Only reg+reg addressing is valid.  */
 
14139
+    case TImode:
 
14140
+      /* AltiVec/VSX vector modes.  Only reg+reg addressing is valid.  While
 
14141
+        TImode is not a vector mode, if we want to use the VSX registers to
 
14142
+        move it around, we need to restrict ourselves to reg+reg
 
14143
+        addressing.  */
 
14144
       if (VECTOR_MEM_ALTIVEC_OR_VSX_P (mode))
 
14145
        return false;
 
14146
       break;
 
14147
@@ -5184,6 +6008,13 @@
 
14148
         return false;
 
14149
       break;
 
14150
 
 
14151
+    case SDmode:
 
14152
+      /* If we can do direct load/stores of SDmode, restrict it to reg+reg
 
14153
+        addressing for the LFIWZX and STFIWX instructions.  */
 
14154
+      if (TARGET_NO_SDMODE_STACK)
 
14155
+       return false;
 
14156
+      break;
 
14157
+
 
14158
     default:
 
14159
       break;
 
14160
     }
 
14161
@@ -5416,7 +6247,7 @@
 
14162
 
 
14163
       /* If we are using VSX scalar loads, restrict ourselves to reg+reg
 
14164
         addressing.  */
 
14165
-      if (mode == DFmode && VECTOR_MEM_VSX_P (DFmode))
 
14166
+      if (VECTOR_MEM_VSX_P (mode))
 
14167
        return false;
 
14168
 
 
14169
       if (!worst_case)
 
14170
@@ -5430,6 +6261,7 @@
 
14171
     case TFmode:
 
14172
     case TDmode:
 
14173
     case TImode:
 
14174
+    case PTImode:
 
14175
       if (TARGET_E500_DOUBLE)
 
14176
        return (SPE_CONST_OFFSET_OK (offset)
 
14177
                && SPE_CONST_OFFSET_OK (offset + 8));
 
14178
@@ -5526,7 +6358,7 @@
 
14179
 
 
14180
   if (TARGET_ELF || TARGET_MACHO)
 
14181
     {
 
14182
-      if (DEFAULT_ABI != ABI_AIX && DEFAULT_ABI != ABI_DARWIN && flag_pic)
 
14183
+      if (DEFAULT_ABI == ABI_V4 && flag_pic)
 
14184
        return false;
 
14185
       if (TARGET_TOC)
 
14186
        return false;
 
14187
@@ -5582,8 +6414,11 @@
 
14188
       if (GET_CODE (x) == PLUS && XEXP (x, 1) == const0_rtx)
 
14189
        return force_reg (Pmode, XEXP (x, 0));
 
14190
 
 
14191
+      /* For TImode with load/store quad, restrict addresses to just a single
 
14192
+        pointer, so it works with both GPRs and VSX registers.  */
 
14193
       /* Make sure both operands are registers.  */
 
14194
-      else if (GET_CODE (x) == PLUS)
 
14195
+      else if (GET_CODE (x) == PLUS
 
14196
+              && (mode != TImode || !TARGET_QUAD_MEMORY))
 
14197
        return gen_rtx_PLUS (Pmode,
 
14198
                             force_reg (Pmode, XEXP (x, 0)),
 
14199
                             force_reg (Pmode, XEXP (x, 1)));
 
14200
@@ -5603,11 +6438,12 @@
 
14201
     case TFmode:
 
14202
     case TDmode:
 
14203
     case TImode:
 
14204
+    case PTImode:
 
14205
       /* As in legitimate_offset_address_p we do not assume
 
14206
         worst-case.  The mode here is just a hint as to the registers
 
14207
         used.  A TImode is usually in gprs, but may actually be in
 
14208
         fprs.  Leave worst-case scenario for reload to handle via
 
14209
-        insn constraints.  */
 
14210
+        insn constraints.  PTImode is only GPRs.  */
 
14211
       extra = 8;
 
14212
       break;
 
14213
     default:
 
14214
@@ -6099,10 +6935,13 @@
 
14215
                                   1, const0_rtx, Pmode);
 
14216
 
 
14217
          r3 = gen_rtx_REG (Pmode, 3);
 
14218
-         if (DEFAULT_ABI == ABI_AIX && TARGET_64BIT)
 
14219
-           insn = gen_tls_gd_aix64 (r3, got, addr, tga, const0_rtx);
 
14220
-         else if (DEFAULT_ABI == ABI_AIX && !TARGET_64BIT)
 
14221
-           insn = gen_tls_gd_aix32 (r3, got, addr, tga, const0_rtx);
 
14222
+         if (DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_ELFv2)
 
14223
+           {
 
14224
+             if (TARGET_64BIT)
 
14225
+               insn = gen_tls_gd_aix64 (r3, got, addr, tga, const0_rtx);
 
14226
+             else
 
14227
+               insn = gen_tls_gd_aix32 (r3, got, addr, tga, const0_rtx);
 
14228
+           }
 
14229
          else if (DEFAULT_ABI == ABI_V4)
 
14230
            insn = gen_tls_gd_sysvsi (r3, got, addr, tga, const0_rtx);
 
14231
          else
 
14232
@@ -6121,10 +6960,13 @@
 
14233
                                   1, const0_rtx, Pmode);
 
14234
 
 
14235
          r3 = gen_rtx_REG (Pmode, 3);
 
14236
-         if (DEFAULT_ABI == ABI_AIX && TARGET_64BIT)
 
14237
-           insn = gen_tls_ld_aix64 (r3, got, tga, const0_rtx);
 
14238
-         else if (DEFAULT_ABI == ABI_AIX && !TARGET_64BIT)
 
14239
-           insn = gen_tls_ld_aix32 (r3, got, tga, const0_rtx);
 
14240
+         if (DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_ELFv2)
 
14241
+           {
 
14242
+             if (TARGET_64BIT)
 
14243
+               insn = gen_tls_ld_aix64 (r3, got, tga, const0_rtx);
 
14244
+             else
 
14245
+               insn = gen_tls_ld_aix32 (r3, got, tga, const0_rtx);
 
14246
+           }
 
14247
          else if (DEFAULT_ABI == ABI_V4)
 
14248
            insn = gen_tls_ld_sysvsi (r3, got, tga, const0_rtx);
 
14249
          else
 
14250
@@ -6338,7 +7180,7 @@
 
14251
       && !(TARGET_E500_DOUBLE && (mode == DFmode || mode == TFmode
 
14252
                                  || mode == DDmode || mode == TDmode
 
14253
                                  || mode == DImode))
 
14254
-      && VECTOR_MEM_NONE_P (mode))
 
14255
+      && (!VECTOR_MODE_P (mode) || VECTOR_MEM_NONE_P (mode)))
 
14256
     {
 
14257
       HOST_WIDE_INT val = INTVAL (XEXP (x, 1));
 
14258
       HOST_WIDE_INT low = ((val & 0xffff) ^ 0x8000) - 0x8000;
 
14259
@@ -6369,7 +7211,7 @@
 
14260
 
 
14261
   if (GET_CODE (x) == SYMBOL_REF
 
14262
       && reg_offset_p
 
14263
-      && VECTOR_MEM_NONE_P (mode)
 
14264
+      && (!VECTOR_MODE_P (mode) || VECTOR_MEM_NONE_P (mode))
 
14265
       && !SPE_VECTOR_MODE (mode)
 
14266
 #if TARGET_MACHO
 
14267
       && DEFAULT_ABI == ABI_DARWIN
 
14268
@@ -6395,6 +7237,8 @@
 
14269
         mem is sufficiently aligned.  */
 
14270
       && mode != TFmode
 
14271
       && mode != TDmode
 
14272
+      && (mode != TImode || !TARGET_VSX_TIMODE)
 
14273
+      && mode != PTImode
 
14274
       && (mode != DImode || TARGET_POWERPC64)
 
14275
       && ((mode != DFmode && mode != DDmode) || TARGET_POWERPC64
 
14276
          || (TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT)))
 
14277
@@ -6515,15 +7359,9 @@
 
14278
     return 0;
 
14279
   if (legitimate_indirect_address_p (x, reg_ok_strict))
 
14280
     return 1;
 
14281
-  if ((GET_CODE (x) == PRE_INC || GET_CODE (x) == PRE_DEC)
 
14282
-      && !VECTOR_MEM_ALTIVEC_OR_VSX_P (mode)
 
14283
-      && !SPE_VECTOR_MODE (mode)
 
14284
-      && mode != TFmode
 
14285
-      && mode != TDmode
 
14286
-      /* Restrict addressing for DI because of our SUBREG hackery.  */
 
14287
-      && !(TARGET_E500_DOUBLE
 
14288
-          && (mode == DFmode || mode == DDmode || mode == DImode))
 
14289
-      && TARGET_UPDATE
 
14290
+  if (TARGET_UPDATE
 
14291
+      && (GET_CODE (x) == PRE_INC || GET_CODE (x) == PRE_DEC)
 
14292
+      && mode_supports_pre_incdec_p (mode)
 
14293
       && legitimate_indirect_address_p (XEXP (x, 0), reg_ok_strict))
 
14294
     return 1;
 
14295
   if (virtual_stack_registers_memory_p (x))
 
14296
@@ -6533,6 +7371,13 @@
 
14297
   if (reg_offset_p
 
14298
       && legitimate_constant_pool_address_p (x, mode, reg_ok_strict))
 
14299
     return 1;
 
14300
+  /* For TImode, if we have load/store quad and TImode in VSX registers, only
 
14301
+     allow register indirect addresses.  This will allow the values to go in
 
14302
+     either GPRs or VSX registers without reloading.  The vector types would
 
14303
+     tend to go into VSX registers, so we allow REG+REG, while TImode seems
 
14304
+     somewhat split, in that some uses are GPR based, and some VSX based.  */
 
14305
+  if (mode == TImode && TARGET_QUAD_MEMORY && TARGET_VSX_TIMODE)
 
14306
+    return 0;
 
14307
   /* If not REG_OK_STRICT (before reload) let pass any stack offset.  */
 
14308
   if (! reg_ok_strict
 
14309
       && reg_offset_p
 
14310
@@ -6544,31 +7389,20 @@
 
14311
     return 1;
 
14312
   if (rs6000_legitimate_offset_address_p (mode, x, reg_ok_strict, false))
 
14313
     return 1;
 
14314
-  if (mode != TImode
 
14315
-      && mode != TFmode
 
14316
+  if (mode != TFmode
 
14317
       && mode != TDmode
 
14318
       && ((TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT)
 
14319
          || TARGET_POWERPC64
 
14320
          || (mode != DFmode && mode != DDmode)
 
14321
          || (TARGET_E500_DOUBLE && mode != DDmode))
 
14322
       && (TARGET_POWERPC64 || mode != DImode)
 
14323
+      && (mode != TImode || VECTOR_MEM_VSX_P (TImode))
 
14324
+      && mode != PTImode
 
14325
       && !avoiding_indexed_address_p (mode)
 
14326
       && legitimate_indexed_address_p (x, reg_ok_strict))
 
14327
     return 1;
 
14328
-  if (GET_CODE (x) == PRE_MODIFY
 
14329
-      && mode != TImode
 
14330
-      && mode != TFmode
 
14331
-      && mode != TDmode
 
14332
-      && ((TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT)
 
14333
-         || TARGET_POWERPC64
 
14334
-         || ((mode != DFmode && mode != DDmode) || TARGET_E500_DOUBLE))
 
14335
-      && (TARGET_POWERPC64 || mode != DImode)
 
14336
-      && !VECTOR_MEM_ALTIVEC_OR_VSX_P (mode)
 
14337
-      && !SPE_VECTOR_MODE (mode)
 
14338
-      /* Restrict addressing for DI because of our SUBREG hackery.  */
 
14339
-      && !(TARGET_E500_DOUBLE
 
14340
-          && (mode == DFmode || mode == DDmode || mode == DImode))
 
14341
-      && TARGET_UPDATE
 
14342
+  if (TARGET_UPDATE && GET_CODE (x) == PRE_MODIFY
 
14343
+      && mode_supports_pre_modify_p (mode)
 
14344
       && legitimate_indirect_address_p (XEXP (x, 0), reg_ok_strict)
 
14345
       && (rs6000_legitimate_offset_address_p (mode, XEXP (x, 1),
 
14346
                                              reg_ok_strict, false)
 
14347
@@ -6589,10 +7423,13 @@
 
14348
   bool ret = rs6000_legitimate_address_p (mode, x, reg_ok_strict);
 
14349
   fprintf (stderr,
 
14350
           "\nrs6000_legitimate_address_p: return = %s, mode = %s, "
 
14351
-          "strict = %d, code = %s\n",
 
14352
+          "strict = %d, reload = %s, code = %s\n",
 
14353
           ret ? "true" : "false",
 
14354
           GET_MODE_NAME (mode),
 
14355
           reg_ok_strict,
 
14356
+          (reload_completed
 
14357
+           ? "after"
 
14358
+           : (reload_in_progress ? "progress" : "before")),
 
14359
           GET_RTX_NAME (GET_CODE (x)));
 
14360
   debug_rtx (x);
 
14361
 
 
14362
@@ -6758,7 +7595,7 @@
 
14363
 
 
14364
   /* The TOC register is not killed across calls in a way that is
 
14365
      visible to the compiler.  */
 
14366
-  if (DEFAULT_ABI == ABI_AIX)
 
14367
+  if (DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_ELFv2)
 
14368
     call_really_used_regs[2] = 0;
 
14369
 
 
14370
   if (DEFAULT_ABI == ABI_V4
 
14371
@@ -7006,7 +7843,7 @@
 
14372
 }
 
14373
 
 
14374
 /* Helper for the following.  Get rid of [r+r] memory refs
 
14375
-   in cases where it won't work (TImode, TFmode, TDmode).  */
 
14376
+   in cases where it won't work (TImode, TFmode, TDmode, PTImode).  */
 
14377
 
 
14378
 static void
 
14379
 rs6000_eliminate_indexed_memrefs (rtx operands[2])
 
14380
@@ -7031,6 +7868,107 @@
 
14381
                               copy_addr_to_reg (XEXP (operands[1], 0)));
 
14382
 }
 
14383
 
 
14384
+/* Generate a vector of constants to permute MODE for a little-endian
 
14385
+   storage operation by swapping the two halves of a vector.  */
 
14386
+static rtvec
 
14387
+rs6000_const_vec (enum machine_mode mode)
 
14388
+{
 
14389
+  int i, subparts;
 
14390
+  rtvec v;
 
14391
+
 
14392
+  switch (mode)
 
14393
+    {
 
14394
+    case V2DFmode:
 
14395
+    case V2DImode:
 
14396
+      subparts = 2;
 
14397
+      break;
 
14398
+    case V4SFmode:
 
14399
+    case V4SImode:
 
14400
+      subparts = 4;
 
14401
+      break;
 
14402
+    case V8HImode:
 
14403
+      subparts = 8;
 
14404
+      break;
 
14405
+    case V16QImode:
 
14406
+      subparts = 16;
 
14407
+      break;
 
14408
+    default:
 
14409
+      gcc_unreachable();
 
14410
+    }
 
14411
+
 
14412
+  v = rtvec_alloc (subparts);
 
14413
+
 
14414
+  for (i = 0; i < subparts / 2; ++i)
 
14415
+    RTVEC_ELT (v, i) = gen_rtx_CONST_INT (DImode, i + subparts / 2);
 
14416
+  for (i = subparts / 2; i < subparts; ++i)
 
14417
+    RTVEC_ELT (v, i) = gen_rtx_CONST_INT (DImode, i - subparts / 2);
 
14418
+
 
14419
+  return v;
 
14420
+}
 
14421
+
 
14422
+/* Generate a permute rtx that represents an lxvd2x, stxvd2x, or xxpermdi
 
14423
+   for a VSX load or store operation.  */
 
14424
+rtx
 
14425
+rs6000_gen_le_vsx_permute (rtx source, enum machine_mode mode)
 
14426
+{
 
14427
+  rtx par = gen_rtx_PARALLEL (VOIDmode, rs6000_const_vec (mode));
 
14428
+  return gen_rtx_VEC_SELECT (mode, source, par);
 
14429
+}
 
14430
+
 
14431
+/* Emit a little-endian load from vector memory location SOURCE to VSX
 
14432
+   register DEST in mode MODE.  The load is done with two permuting
 
14433
+   insn's that represent an lxvd2x and xxpermdi.  */
 
14434
+void
 
14435
+rs6000_emit_le_vsx_load (rtx dest, rtx source, enum machine_mode mode)
 
14436
+{
 
14437
+  rtx tmp = can_create_pseudo_p () ? gen_reg_rtx_and_attrs (dest) : dest;
 
14438
+  rtx permute_mem = rs6000_gen_le_vsx_permute (source, mode);
 
14439
+  rtx permute_reg = rs6000_gen_le_vsx_permute (tmp, mode);
 
14440
+  emit_insn (gen_rtx_SET (VOIDmode, tmp, permute_mem));
 
14441
+  emit_insn (gen_rtx_SET (VOIDmode, dest, permute_reg));
 
14442
+}
 
14443
+
 
14444
+/* Emit a little-endian store to vector memory location DEST from VSX
 
14445
+   register SOURCE in mode MODE.  The store is done with two permuting
 
14446
+   insn's that represent an xxpermdi and an stxvd2x.  */
 
14447
+void
 
14448
+rs6000_emit_le_vsx_store (rtx dest, rtx source, enum machine_mode mode)
 
14449
+{
 
14450
+  rtx tmp = can_create_pseudo_p () ? gen_reg_rtx_and_attrs (source) : source;
 
14451
+  rtx permute_src = rs6000_gen_le_vsx_permute (source, mode);
 
14452
+  rtx permute_tmp = rs6000_gen_le_vsx_permute (tmp, mode);
 
14453
+  emit_insn (gen_rtx_SET (VOIDmode, tmp, permute_src));
 
14454
+  emit_insn (gen_rtx_SET (VOIDmode, dest, permute_tmp));
 
14455
+}
 
14456
+
 
14457
+/* Emit a sequence representing a little-endian VSX load or store,
 
14458
+   moving data from SOURCE to DEST in mode MODE.  This is done
 
14459
+   separately from rs6000_emit_move to ensure it is called only
 
14460
+   during expand.  LE VSX loads and stores introduced later are
 
14461
+   handled with a split.  The expand-time RTL generation allows
 
14462
+   us to optimize away redundant pairs of register-permutes.  */
 
14463
+void
 
14464
+rs6000_emit_le_vsx_move (rtx dest, rtx source, enum machine_mode mode)
 
14465
+{
 
14466
+  gcc_assert (!BYTES_BIG_ENDIAN
 
14467
+             && VECTOR_MEM_VSX_P (mode)
 
14468
+             && mode != TImode
 
14469
+             && !gpr_or_gpr_p (dest, source)
 
14470
+             && (MEM_P (source) ^ MEM_P (dest)));
 
14471
+
 
14472
+  if (MEM_P (source))
 
14473
+    {
 
14474
+      gcc_assert (REG_P (dest));
 
14475
+      rs6000_emit_le_vsx_load (dest, source, mode);
 
14476
+    }
 
14477
+  else
 
14478
+    {
 
14479
+      if (!REG_P (source))
 
14480
+       source = force_reg (mode, source);
 
14481
+      rs6000_emit_le_vsx_store (dest, source, mode);
 
14482
+    }
 
14483
+}
 
14484
+
 
14485
 /* Emit a move from SOURCE to DEST in mode MODE.  */
 
14486
 void
 
14487
 rs6000_emit_move (rtx dest, rtx source, enum machine_mode mode)
 
14488
@@ -7151,6 +8089,7 @@
 
14489
 
 
14490
   if (reload_in_progress
 
14491
       && mode == SDmode
 
14492
+      && cfun->machine->sdmode_stack_slot != NULL_RTX
 
14493
       && MEM_P (operands[0])
 
14494
       && rtx_equal_p (operands[0], cfun->machine->sdmode_stack_slot)
 
14495
       && REG_P (operands[1]))
 
14496
@@ -7163,7 +8102,9 @@
 
14497
        }
 
14498
       else if (INT_REGNO_P (REGNO (operands[1])))
 
14499
        {
 
14500
-         rtx mem = adjust_address_nv (operands[0], mode, 4);
 
14501
+         rtx mem = operands[0];
 
14502
+         if (BYTES_BIG_ENDIAN)
 
14503
+           mem = adjust_address_nv (mem, mode, 4);
 
14504
          mem = eliminate_regs (mem, VOIDmode, NULL_RTX);
 
14505
          emit_insn (gen_movsd_hardfloat (mem, operands[1]));
 
14506
        }
 
14507
@@ -7175,6 +8116,7 @@
 
14508
       && mode == SDmode
 
14509
       && REG_P (operands[0])
 
14510
       && MEM_P (operands[1])
 
14511
+      && cfun->machine->sdmode_stack_slot != NULL_RTX
 
14512
       && rtx_equal_p (operands[1], cfun->machine->sdmode_stack_slot))
 
14513
     {
 
14514
       if (FP_REGNO_P (REGNO (operands[0])))
 
14515
@@ -7185,7 +8127,9 @@
 
14516
        }
 
14517
       else if (INT_REGNO_P (REGNO (operands[0])))
 
14518
        {
 
14519
-         rtx mem = adjust_address_nv (operands[1], mode, 4);
 
14520
+         rtx mem = operands[1];
 
14521
+         if (BYTES_BIG_ENDIAN)
 
14522
+           mem = adjust_address_nv (mem, mode, 4);
 
14523
          mem = eliminate_regs (mem, VOIDmode, NULL_RTX);
 
14524
          emit_insn (gen_movsd_hardfloat (operands[0], mem));
 
14525
        }
 
14526
@@ -7388,6 +8332,11 @@
 
14527
       break;
 
14528
 
 
14529
     case TImode:
 
14530
+      if (!VECTOR_MEM_VSX_P (TImode))
 
14531
+       rs6000_eliminate_indexed_memrefs (operands);
 
14532
+      break;
 
14533
+
 
14534
+    case PTImode:
 
14535
       rs6000_eliminate_indexed_memrefs (operands);
 
14536
       break;
 
14537
 
 
14538
@@ -7426,18 +8375,231 @@
 
14539
 }
 
14540
 
 
14541
 /* Nonzero if we can use a floating-point register to pass this arg.  */
 
14542
-#define USE_FP_FOR_ARG_P(CUM,MODE,TYPE)                \
 
14543
+#define USE_FP_FOR_ARG_P(CUM,MODE)             \
 
14544
   (SCALAR_FLOAT_MODE_P (MODE)                  \
 
14545
    && (CUM)->fregno <= FP_ARG_MAX_REG          \
 
14546
    && TARGET_HARD_FLOAT && TARGET_FPRS)
 
14547
 
 
14548
 /* Nonzero if we can use an AltiVec register to pass this arg.  */
 
14549
-#define USE_ALTIVEC_FOR_ARG_P(CUM,MODE,TYPE,NAMED)             \
 
14550
+#define USE_ALTIVEC_FOR_ARG_P(CUM,MODE,NAMED)                  \
 
14551
   (ALTIVEC_OR_VSX_VECTOR_MODE (MODE)                           \
 
14552
    && (CUM)->vregno <= ALTIVEC_ARG_MAX_REG                     \
 
14553
    && TARGET_ALTIVEC_ABI                                       \
 
14554
    && (NAMED))
 
14555
 
 
14556
+/* Walk down the type tree of TYPE counting consecutive base elements.
 
14557
+   If *MODEP is VOIDmode, then set it to the first valid floating point
 
14558
+   or vector type.  If a non-floating point or vector type is found, or
 
14559
+   if a floating point or vector type that doesn't match a non-VOIDmode
 
14560
+   *MODEP is found, then return -1, otherwise return the count in the
 
14561
+   sub-tree.  */
 
14562
+
 
14563
+static int
 
14564
+rs6000_aggregate_candidate (const_tree type, enum machine_mode *modep)
 
14565
+{
 
14566
+  enum machine_mode mode;
 
14567
+  HOST_WIDE_INT size;
 
14568
+
 
14569
+  switch (TREE_CODE (type))
 
14570
+    {
 
14571
+    case REAL_TYPE:
 
14572
+      mode = TYPE_MODE (type);
 
14573
+      if (!SCALAR_FLOAT_MODE_P (mode))
 
14574
+       return -1;
 
14575
+
 
14576
+      if (*modep == VOIDmode)
 
14577
+       *modep = mode;
 
14578
+
 
14579
+      if (*modep == mode)
 
14580
+       return 1;
 
14581
+
 
14582
+      break;
 
14583
+
 
14584
+    case COMPLEX_TYPE:
 
14585
+      mode = TYPE_MODE (TREE_TYPE (type));
 
14586
+      if (!SCALAR_FLOAT_MODE_P (mode))
 
14587
+       return -1;
 
14588
+
 
14589
+      if (*modep == VOIDmode)
 
14590
+       *modep = mode;
 
14591
+
 
14592
+      if (*modep == mode)
 
14593
+       return 2;
 
14594
+
 
14595
+      break;
 
14596
+
 
14597
+    case VECTOR_TYPE:
 
14598
+      if (!TARGET_ALTIVEC_ABI || !TARGET_ALTIVEC)
 
14599
+       return -1;
 
14600
+
 
14601
+      /* Use V4SImode as representative of all 128-bit vector types.  */
 
14602
+      size = int_size_in_bytes (type);
 
14603
+      switch (size)
 
14604
+       {
 
14605
+       case 16:
 
14606
+         mode = V4SImode;
 
14607
+         break;
 
14608
+       default:
 
14609
+         return -1;
 
14610
+       }
 
14611
+
 
14612
+      if (*modep == VOIDmode)
 
14613
+       *modep = mode;
 
14614
+
 
14615
+      /* Vector modes are considered to be opaque: two vectors are
 
14616
+        equivalent for the purposes of being homogeneous aggregates
 
14617
+        if they are the same size.  */
 
14618
+      if (*modep == mode)
 
14619
+       return 1;
 
14620
+
 
14621
+      break;
 
14622
+
 
14623
+    case ARRAY_TYPE:
 
14624
+      {
 
14625
+       int count;
 
14626
+       tree index = TYPE_DOMAIN (type);
 
14627
+
 
14628
+       /* Can't handle incomplete types.  */
 
14629
+       if (!COMPLETE_TYPE_P (type))
 
14630
+         return -1;
 
14631
+
 
14632
+       count = rs6000_aggregate_candidate (TREE_TYPE (type), modep);
 
14633
+       if (count == -1
 
14634
+           || !index
 
14635
+           || !TYPE_MAX_VALUE (index)
 
14636
+           || !host_integerp (TYPE_MAX_VALUE (index), 1)
 
14637
+           || !TYPE_MIN_VALUE (index)
 
14638
+           || !host_integerp (TYPE_MIN_VALUE (index), 1)
 
14639
+           || count < 0)
 
14640
+         return -1;
 
14641
+
 
14642
+       count *= (1 + tree_low_cst (TYPE_MAX_VALUE (index), 1)
 
14643
+                     - tree_low_cst (TYPE_MIN_VALUE (index), 1));
 
14644
+
 
14645
+       /* There must be no padding.  */
 
14646
+       if (!host_integerp (TYPE_SIZE (type), 1)
 
14647
+           || (tree_low_cst (TYPE_SIZE (type), 1)
 
14648
+               != count * GET_MODE_BITSIZE (*modep)))
 
14649
+         return -1;
 
14650
+
 
14651
+       return count;
 
14652
+      }
 
14653
+
 
14654
+    case RECORD_TYPE:
 
14655
+      {
 
14656
+       int count = 0;
 
14657
+       int sub_count;
 
14658
+       tree field;
 
14659
+
 
14660
+       /* Can't handle incomplete types.  */
 
14661
+       if (!COMPLETE_TYPE_P (type))
 
14662
+         return -1;
 
14663
+
 
14664
+       for (field = TYPE_FIELDS (type); field; field = TREE_CHAIN (field))
 
14665
+         {
 
14666
+           if (TREE_CODE (field) != FIELD_DECL)
 
14667
+             continue;
 
14668
+
 
14669
+           sub_count = rs6000_aggregate_candidate (TREE_TYPE (field), modep);
 
14670
+           if (sub_count < 0)
 
14671
+             return -1;
 
14672
+           count += sub_count;
 
14673
+         }
 
14674
+
 
14675
+       /* There must be no padding.  */
 
14676
+       if (!host_integerp (TYPE_SIZE (type), 1)
 
14677
+           || (tree_low_cst (TYPE_SIZE (type), 1)
 
14678
+               != count * GET_MODE_BITSIZE (*modep)))
 
14679
+         return -1;
 
14680
+
 
14681
+       return count;
 
14682
+      }
 
14683
+
 
14684
+    case UNION_TYPE:
 
14685
+    case QUAL_UNION_TYPE:
 
14686
+      {
 
14687
+       /* These aren't very interesting except in a degenerate case.  */
 
14688
+       int count = 0;
 
14689
+       int sub_count;
 
14690
+       tree field;
 
14691
+
 
14692
+       /* Can't handle incomplete types.  */
 
14693
+       if (!COMPLETE_TYPE_P (type))
 
14694
+         return -1;
 
14695
+
 
14696
+       for (field = TYPE_FIELDS (type); field; field = TREE_CHAIN (field))
 
14697
+         {
 
14698
+           if (TREE_CODE (field) != FIELD_DECL)
 
14699
+             continue;
 
14700
+
 
14701
+           sub_count = rs6000_aggregate_candidate (TREE_TYPE (field), modep);
 
14702
+           if (sub_count < 0)
 
14703
+             return -1;
 
14704
+           count = count > sub_count ? count : sub_count;
 
14705
+         }
 
14706
+
 
14707
+       /* There must be no padding.  */
 
14708
+       if (!host_integerp (TYPE_SIZE (type), 1)
 
14709
+           || (tree_low_cst (TYPE_SIZE (type), 1)
 
14710
+               != count * GET_MODE_BITSIZE (*modep)))
 
14711
+         return -1;
 
14712
+
 
14713
+       return count;
 
14714
+      }
 
14715
+
 
14716
+    default:
 
14717
+      break;
 
14718
+    }
 
14719
+
 
14720
+  return -1;
 
14721
+}
 
14722
+
 
14723
+/* If an argument, whose type is described by TYPE and MODE, is a homogeneous
 
14724
+   float or vector aggregate that shall be passed in FP/vector registers
 
14725
+   according to the ELFv2 ABI, return the homogeneous element mode in
 
14726
+   *ELT_MODE and the number of elements in *N_ELTS, and return TRUE.
 
14727
+
 
14728
+   Otherwise, set *ELT_MODE to MODE and *N_ELTS to 1, and return FALSE.  */
 
14729
+
 
14730
+static bool
 
14731
+rs6000_discover_homogeneous_aggregate (enum machine_mode mode, const_tree type,
 
14732
+                                      enum machine_mode *elt_mode,
 
14733
+                                      int *n_elts)
 
14734
+{
 
14735
+  /* Note that we do not accept complex types at the top level as
 
14736
+     homogeneous aggregates; these types are handled via the
 
14737
+     targetm.calls.split_complex_arg mechanism.  Complex types
 
14738
+     can be elements of homogeneous aggregates, however.  */
 
14739
+  if (DEFAULT_ABI == ABI_ELFv2 && type && AGGREGATE_TYPE_P (type))
 
14740
+    {
 
14741
+      enum machine_mode field_mode = VOIDmode;
 
14742
+      int field_count = rs6000_aggregate_candidate (type, &field_mode);
 
14743
+
 
14744
+      if (field_count > 0)
 
14745
+       {
 
14746
+         int n_regs = (SCALAR_FLOAT_MODE_P (field_mode)?
 
14747
+                       (GET_MODE_SIZE (field_mode) + 7) >> 3 : 1);
 
14748
+
 
14749
+         /* The ELFv2 ABI allows homogeneous aggregates to occupy
 
14750
+            up to AGGR_ARG_NUM_REG registers.  */
 
14751
+         if (field_count * n_regs <= AGGR_ARG_NUM_REG)
 
14752
+           {
 
14753
+             if (elt_mode)
 
14754
+               *elt_mode = field_mode;
 
14755
+             if (n_elts)
 
14756
+               *n_elts = field_count;
 
14757
+             return true;
 
14758
+           }
 
14759
+       }
 
14760
+    }
 
14761
+
 
14762
+  if (elt_mode)
 
14763
+    *elt_mode = mode;
 
14764
+  if (n_elts)
 
14765
+    *n_elts = 1;
 
14766
+  return false;
 
14767
+}
 
14768
+
 
14769
 /* Return a nonzero value to say to return the function value in
 
14770
    memory, just as large structures are always returned.  TYPE will be
 
14771
    the data type of the value, and FNTYPE will be the type of the
 
14772
@@ -7490,6 +8652,16 @@
 
14773
       /* Otherwise fall through to more conventional ABI rules.  */
 
14774
     }
 
14775
 
 
14776
+  /* The ELFv2 ABI returns homogeneous VFP aggregates in registers */
 
14777
+  if (rs6000_discover_homogeneous_aggregate (TYPE_MODE (type), type,
 
14778
+                                            NULL, NULL))
 
14779
+    return false;
 
14780
+
 
14781
+  /* The ELFv2 ABI returns aggregates up to 16B in registers */
 
14782
+  if (DEFAULT_ABI == ABI_ELFv2 && AGGREGATE_TYPE_P (type)
 
14783
+      && (unsigned HOST_WIDE_INT) int_size_in_bytes (type) <= 16)
 
14784
+    return false;
 
14785
+
 
14786
   if (AGGREGATE_TYPE_P (type)
 
14787
       && (aix_struct_return
 
14788
          || (unsigned HOST_WIDE_INT) int_size_in_bytes (type) > 8))
 
14789
@@ -7521,6 +8693,19 @@
 
14790
   return false;
 
14791
 }
 
14792
 
 
14793
+/* Specify whether values returned in registers should be at the most
 
14794
+   significant end of a register.  We want aggregates returned by
 
14795
+   value to match the way aggregates are passed to functions.  */
 
14796
+
 
14797
+static bool
 
14798
+rs6000_return_in_msb (const_tree valtype)
 
14799
+{
 
14800
+  return (DEFAULT_ABI == ABI_ELFv2
 
14801
+         && BYTES_BIG_ENDIAN
 
14802
+         && AGGREGATE_TYPE_P (valtype)
 
14803
+         && FUNCTION_ARG_PADDING (TYPE_MODE (valtype), valtype) == upward);
 
14804
+}
 
14805
+
 
14806
 #ifdef HAVE_AS_GNU_ATTRIBUTE
 
14807
 /* Return TRUE if a call to function FNDECL may be one that
 
14808
    potentially affects the function calling ABI of the object file.  */
 
14809
@@ -7657,7 +8842,7 @@
 
14810
 static bool
 
14811
 rs6000_must_pass_in_stack (enum machine_mode mode, const_tree type)
 
14812
 {
 
14813
-  if (DEFAULT_ABI == ABI_AIX || TARGET_64BIT)
 
14814
+  if (DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_ELFv2 || TARGET_64BIT)
 
14815
     return must_pass_in_stack_var_size (mode, type);
 
14816
   else
 
14817
     return must_pass_in_stack_var_size_or_pad (mode, type);
 
14818
@@ -7738,6 +8923,11 @@
 
14819
 static unsigned int
 
14820
 rs6000_function_arg_boundary (enum machine_mode mode, const_tree type)
 
14821
 {
 
14822
+  enum machine_mode elt_mode;
 
14823
+  int n_elts;
 
14824
+
 
14825
+  rs6000_discover_homogeneous_aggregate (mode, type, &elt_mode, &n_elts);
 
14826
+
 
14827
   if (DEFAULT_ABI == ABI_V4
 
14828
       && (GET_MODE_SIZE (mode) == 8
 
14829
          || (TARGET_HARD_FLOAT
 
14830
@@ -7749,12 +8939,13 @@
 
14831
               && int_size_in_bytes (type) >= 8
 
14832
               && int_size_in_bytes (type) < 16))
 
14833
     return 64;
 
14834
-  else if (ALTIVEC_OR_VSX_VECTOR_MODE (mode)
 
14835
+  else if (ALTIVEC_OR_VSX_VECTOR_MODE (elt_mode)
 
14836
           || (type && TREE_CODE (type) == VECTOR_TYPE
 
14837
               && int_size_in_bytes (type) >= 16))
 
14838
     return 128;
 
14839
-  else if (TARGET_MACHO
 
14840
-          && rs6000_darwin64_abi
 
14841
+  else if (((TARGET_MACHO && rs6000_darwin64_abi)
 
14842
+           || DEFAULT_ABI == ABI_ELFv2
 
14843
+            || (DEFAULT_ABI == ABI_AIX && !rs6000_compat_align_parm))
 
14844
           && mode == BLKmode
 
14845
           && type && TYPE_ALIGN (type) > 64)
 
14846
     return 128;
 
14847
@@ -7762,6 +8953,16 @@
 
14848
     return PARM_BOUNDARY;
 
14849
 }
 
14850
 
 
14851
+/* The offset in words to the start of the parameter save area.  */
 
14852
+
 
14853
+static unsigned int
 
14854
+rs6000_parm_offset (void)
 
14855
+{
 
14856
+  return (DEFAULT_ABI == ABI_V4 ? 2
 
14857
+         : DEFAULT_ABI == ABI_ELFv2 ? 4
 
14858
+         : 6);
 
14859
+}
 
14860
+
 
14861
 /* For a function parm of MODE and TYPE, return the starting word in
 
14862
    the parameter area.  NWORDS of the parameter area are already used.  */
 
14863
 
 
14864
@@ -7770,11 +8971,9 @@
 
14865
                   unsigned int nwords)
 
14866
 {
 
14867
   unsigned int align;
 
14868
-  unsigned int parm_offset;
 
14869
 
 
14870
   align = rs6000_function_arg_boundary (mode, type) / PARM_BOUNDARY - 1;
 
14871
-  parm_offset = DEFAULT_ABI == ABI_V4 ? 2 : 6;
 
14872
-  return nwords + (-(parm_offset + nwords) & align);
 
14873
+  return nwords + (-(rs6000_parm_offset () + nwords) & align);
 
14874
 }
 
14875
 
 
14876
 /* Compute the size (in words) of a function argument.  */
 
14877
@@ -7881,7 +9080,7 @@
 
14878
 
 
14879
        if (TREE_CODE (ftype) == RECORD_TYPE)
 
14880
          rs6000_darwin64_record_arg_advance_recurse (cum, ftype, bitpos);
 
14881
-       else if (USE_FP_FOR_ARG_P (cum, mode, ftype))
 
14882
+       else if (USE_FP_FOR_ARG_P (cum, mode))
 
14883
          {
 
14884
            unsigned n_fpregs = (GET_MODE_SIZE (mode) + 7) >> 3;
 
14885
            rs6000_darwin64_record_arg_advance_flush (cum, bitpos, 0);
 
14886
@@ -7922,7 +9121,7 @@
 
14887
            else
 
14888
              cum->words += n_fpregs;
 
14889
          }
 
14890
-       else if (USE_ALTIVEC_FOR_ARG_P (cum, mode, type, 1))
 
14891
+       else if (USE_ALTIVEC_FOR_ARG_P (cum, mode, 1))
 
14892
          {
 
14893
            rs6000_darwin64_record_arg_advance_flush (cum, bitpos, 0);
 
14894
            cum->vregno++;
 
14895
@@ -7959,6 +9158,11 @@
 
14896
 rs6000_function_arg_advance_1 (CUMULATIVE_ARGS *cum, enum machine_mode mode,
 
14897
                               const_tree type, bool named, int depth)
 
14898
 {
 
14899
+  enum machine_mode elt_mode;
 
14900
+  int n_elts;
 
14901
+
 
14902
+  rs6000_discover_homogeneous_aggregate (mode, type, &elt_mode, &n_elts);
 
14903
+
 
14904
   /* Only tick off an argument if we're not recursing.  */
 
14905
   if (depth == 0)
 
14906
     cum->nargs_prototype--;
 
14907
@@ -7979,15 +9183,16 @@
 
14908
 #endif
 
14909
 
 
14910
   if (TARGET_ALTIVEC_ABI
 
14911
-      && (ALTIVEC_OR_VSX_VECTOR_MODE (mode)
 
14912
+      && (ALTIVEC_OR_VSX_VECTOR_MODE (elt_mode)
 
14913
          || (type && TREE_CODE (type) == VECTOR_TYPE
 
14914
              && int_size_in_bytes (type) == 16)))
 
14915
     {
 
14916
       bool stack = false;
 
14917
 
 
14918
-      if (USE_ALTIVEC_FOR_ARG_P (cum, mode, type, named))
 
14919
+      if (USE_ALTIVEC_FOR_ARG_P (cum, elt_mode, named))
 
14920
        {
 
14921
-         cum->vregno++;
 
14922
+         cum->vregno += n_elts;
 
14923
+
 
14924
          if (!TARGET_ALTIVEC)
 
14925
            error ("cannot pass argument in vector register because"
 
14926
                   " altivec instructions are disabled, use -maltivec"
 
14927
@@ -7996,7 +9201,8 @@
 
14928
          /* PowerPC64 Linux and AIX allocate GPRs for a vector argument
 
14929
             even if it is going to be passed in a vector register.
 
14930
             Darwin does the same for variable-argument functions.  */
 
14931
-         if ((DEFAULT_ABI == ABI_AIX && TARGET_64BIT)
 
14932
+         if (((DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_ELFv2)
 
14933
+              && TARGET_64BIT)
 
14934
              || (cum->stdarg && DEFAULT_ABI != ABI_V4))
 
14935
            stack = true;
 
14936
        }
 
14937
@@ -8007,15 +9213,13 @@
 
14938
        {
 
14939
          int align;
 
14940
 
 
14941
-         /* Vector parameters must be 16-byte aligned.  This places
 
14942
-            them at 2 mod 4 in terms of words in 32-bit mode, since
 
14943
-            the parameter save area starts at offset 24 from the
 
14944
-            stack.  In 64-bit mode, they just have to start on an
 
14945
-            even word, since the parameter save area is 16-byte
 
14946
-            aligned.  Space for GPRs is reserved even if the argument
 
14947
-            will be passed in memory.  */
 
14948
+         /* Vector parameters must be 16-byte aligned.  In 32-bit
 
14949
+            mode this means we need to take into account the offset
 
14950
+            to the parameter save area.  In 64-bit mode, they just
 
14951
+            have to start on an even word, since the parameter save
 
14952
+            area is 16-byte aligned.  */
 
14953
          if (TARGET_32BIT)
 
14954
-           align = (2 - cum->words) & 3;
 
14955
+           align = -(rs6000_parm_offset () + cum->words) & 3;
 
14956
          else
 
14957
            align = cum->words & 1;
 
14958
          cum->words += align + rs6000_arg_size (mode, type);
 
14959
@@ -8140,15 +9344,15 @@
 
14960
 
 
14961
       cum->words = align_words + n_words;
 
14962
 
 
14963
-      if (SCALAR_FLOAT_MODE_P (mode)
 
14964
+      if (SCALAR_FLOAT_MODE_P (elt_mode)
 
14965
          && TARGET_HARD_FLOAT && TARGET_FPRS)
 
14966
        {
 
14967
          /* _Decimal128 must be passed in an even/odd float register pair.
 
14968
             This assumes that the register number is odd when fregno is
 
14969
             odd.  */
 
14970
-         if (mode == TDmode && (cum->fregno % 2) == 1)
 
14971
+         if (elt_mode == TDmode && (cum->fregno % 2) == 1)
 
14972
            cum->fregno++;
 
14973
-         cum->fregno += (GET_MODE_SIZE (mode) + 7) >> 3;
 
14974
+         cum->fregno += n_elts * ((GET_MODE_SIZE (elt_mode) + 7) >> 3);
 
14975
        }
 
14976
 
 
14977
       if (TARGET_DEBUG_ARG)
 
14978
@@ -8358,7 +9562,7 @@
 
14979
 
 
14980
        if (TREE_CODE (ftype) == RECORD_TYPE)
 
14981
          rs6000_darwin64_record_arg_recurse (cum, ftype, bitpos, rvec, k);
 
14982
-       else if (cum->named && USE_FP_FOR_ARG_P (cum, mode, ftype))
 
14983
+       else if (cum->named && USE_FP_FOR_ARG_P (cum, mode))
 
14984
          {
 
14985
            unsigned n_fpreg = (GET_MODE_SIZE (mode) + 7) >> 3;
 
14986
 #if 0
 
14987
@@ -8386,7 +9590,7 @@
 
14988
            if (mode == TFmode || mode == TDmode)
 
14989
              cum->fregno++;
 
14990
          }
 
14991
-       else if (cum->named && USE_ALTIVEC_FOR_ARG_P (cum, mode, ftype, 1))
 
14992
+       else if (cum->named && USE_ALTIVEC_FOR_ARG_P (cum, mode, 1))
 
14993
          {
 
14994
            rs6000_darwin64_record_arg_flush (cum, bitpos, rvec, k);
 
14995
            rvec[(*k)++]
 
14996
@@ -8503,6 +9707,84 @@
 
14997
   return gen_rtx_PARALLEL (mode, gen_rtvec_v (k, rvec));
 
14998
 }
 
14999
 
 
15000
+/* We have an argument of MODE and TYPE that goes into FPRs or VRs,
 
15001
+   but must also be copied into the parameter save area starting at
 
15002
+   offset ALIGN_WORDS.  Fill in RVEC with the elements corresponding
 
15003
+   to the GPRs and/or memory.  Return the number of elements used.  */
 
15004
+
 
15005
+static int
 
15006
+rs6000_psave_function_arg (enum machine_mode mode, const_tree type,
 
15007
+                          int align_words, rtx *rvec)
 
15008
+{
 
15009
+  int k = 0;
 
15010
+
 
15011
+  if (align_words < GP_ARG_NUM_REG)
 
15012
+    {
 
15013
+      int n_words = rs6000_arg_size (mode, type);
 
15014
+
 
15015
+      if (align_words + n_words > GP_ARG_NUM_REG
 
15016
+         || mode == BLKmode
 
15017
+         || (TARGET_32BIT && TARGET_POWERPC64))
 
15018
+       {
 
15019
+         /* If this is partially on the stack, then we only
 
15020
+            include the portion actually in registers here.  */
 
15021
+         enum machine_mode rmode = TARGET_32BIT ? SImode : DImode;
 
15022
+         int i = 0;
 
15023
+
 
15024
+         if (align_words + n_words > GP_ARG_NUM_REG)
 
15025
+           {
 
15026
+             /* Not all of the arg fits in gprs.  Say that it goes in memory
 
15027
+                too, using a magic NULL_RTX component.  Also see comment in
 
15028
+                rs6000_mixed_function_arg for why the normal
 
15029
+                function_arg_partial_nregs scheme doesn't work in this case. */
 
15030
+             rvec[k++] = gen_rtx_EXPR_LIST (VOIDmode, NULL_RTX, const0_rtx);
 
15031
+           }
 
15032
+
 
15033
+         do
 
15034
+           {
 
15035
+             rtx r = gen_rtx_REG (rmode, GP_ARG_MIN_REG + align_words);
 
15036
+             rtx off = GEN_INT (i++ * GET_MODE_SIZE (rmode));
 
15037
+             rvec[k++] = gen_rtx_EXPR_LIST (VOIDmode, r, off);
 
15038
+           }
 
15039
+         while (++align_words < GP_ARG_NUM_REG && --n_words != 0);
 
15040
+       }
 
15041
+      else
 
15042
+       {
 
15043
+         /* The whole arg fits in gprs.  */
 
15044
+         rtx r = gen_rtx_REG (mode, GP_ARG_MIN_REG + align_words);
 
15045
+         rvec[k++] = gen_rtx_EXPR_LIST (VOIDmode, r, const0_rtx);
 
15046
+       }
 
15047
+    }
 
15048
+  else
 
15049
+    {
 
15050
+      /* It's entirely in memory.  */
 
15051
+      rvec[k++] = gen_rtx_EXPR_LIST (VOIDmode, NULL_RTX, const0_rtx);
 
15052
+    }
 
15053
+
 
15054
+  return k;
 
15055
+}
 
15056
+
 
15057
+/* RVEC is a vector of K components of an argument of mode MODE.
 
15058
+   Construct the final function_arg return value from it.  */
 
15059
+
 
15060
+static rtx
 
15061
+rs6000_finish_function_arg (enum machine_mode mode, rtx *rvec, int k)
 
15062
+{
 
15063
+  gcc_assert (k >= 1);
 
15064
+
 
15065
+  /* Avoid returning a PARALLEL in the trivial cases.  */
 
15066
+  if (k == 1)
 
15067
+    {
 
15068
+      if (XEXP (rvec[0], 0) == NULL_RTX)
 
15069
+       return NULL_RTX;
 
15070
+
 
15071
+      if (GET_MODE (XEXP (rvec[0], 0)) == mode)
 
15072
+       return XEXP (rvec[0], 0);
 
15073
+    }
 
15074
+
 
15075
+  return gen_rtx_PARALLEL (mode, gen_rtvec_v (k, rvec));
 
15076
+}
 
15077
+
 
15078
 /* Determine where to put an argument to a function.
 
15079
    Value is zero to push the argument on the stack,
 
15080
    or a hard register in which to store the argument.
 
15081
@@ -8537,6 +9819,8 @@
 
15082
 {
 
15083
   CUMULATIVE_ARGS *cum = get_cumulative_args (cum_v);
 
15084
   enum rs6000_abi abi = DEFAULT_ABI;
 
15085
+  enum machine_mode elt_mode;
 
15086
+  int n_elts;
 
15087
 
 
15088
   /* Return a marker to indicate whether CR1 needs to set or clear the
 
15089
      bit that V.4 uses to say fp args were passed in registers.
 
15090
@@ -8563,6 +9847,8 @@
 
15091
       return GEN_INT (cum->call_cookie & ~CALL_LIBCALL);
 
15092
     }
 
15093
 
 
15094
+  rs6000_discover_homogeneous_aggregate (mode, type, &elt_mode, &n_elts);
 
15095
+
 
15096
   if (TARGET_MACHO && rs6000_darwin64_struct_check_p (mode, type))
 
15097
     {
 
15098
       rtx rslt = rs6000_darwin64_record_arg (cum, type, named, /*retval= */false);
 
15099
@@ -8571,33 +9857,30 @@
 
15100
       /* Else fall through to usual handling.  */
 
15101
     }
 
15102
 
 
15103
-  if (USE_ALTIVEC_FOR_ARG_P (cum, mode, type, named))
 
15104
-    if (TARGET_64BIT && ! cum->prototype)
 
15105
-      {
 
15106
-       /* Vector parameters get passed in vector register
 
15107
-          and also in GPRs or memory, in absence of prototype.  */
 
15108
-       int align_words;
 
15109
-       rtx slot;
 
15110
-       align_words = (cum->words + 1) & ~1;
 
15111
+  if (USE_ALTIVEC_FOR_ARG_P (cum, elt_mode, named))
 
15112
+    {
 
15113
+      rtx rvec[GP_ARG_NUM_REG + AGGR_ARG_NUM_REG + 1];
 
15114
+      rtx r, off;
 
15115
+      int i, k = 0;
 
15116
 
 
15117
-       if (align_words >= GP_ARG_NUM_REG)
 
15118
-         {
 
15119
-           slot = NULL_RTX;
 
15120
-         }
 
15121
-       else
 
15122
-         {
 
15123
-           slot = gen_rtx_REG (mode, GP_ARG_MIN_REG + align_words);
 
15124
-         }
 
15125
-       return gen_rtx_PARALLEL (mode,
 
15126
-                gen_rtvec (2,
 
15127
-                           gen_rtx_EXPR_LIST (VOIDmode,
 
15128
-                                              slot, const0_rtx),
 
15129
-                           gen_rtx_EXPR_LIST (VOIDmode,
 
15130
-                                              gen_rtx_REG (mode, cum->vregno),
 
15131
-                                              const0_rtx)));
 
15132
-      }
 
15133
-    else
 
15134
-      return gen_rtx_REG (mode, cum->vregno);
 
15135
+      /* Do we also need to pass this argument in the parameter
 
15136
+        save area?  */
 
15137
+      if (TARGET_64BIT && ! cum->prototype)
 
15138
+       {
 
15139
+         int align_words = (cum->words + 1) & ~1;
 
15140
+         k = rs6000_psave_function_arg (mode, type, align_words, rvec);
 
15141
+       }
 
15142
+
 
15143
+      /* Describe where this argument goes in the vector registers.  */
 
15144
+      for (i = 0; i < n_elts && cum->vregno + i <= ALTIVEC_ARG_MAX_REG; i++)
 
15145
+       {
 
15146
+         r = gen_rtx_REG (elt_mode, cum->vregno + i);
 
15147
+         off = GEN_INT (i * GET_MODE_SIZE (elt_mode));
 
15148
+         rvec[k++] =  gen_rtx_EXPR_LIST (VOIDmode, r, off);
 
15149
+       }
 
15150
+
 
15151
+      return rs6000_finish_function_arg (mode, rvec, k);
 
15152
+    }
 
15153
   else if (TARGET_ALTIVEC_ABI
 
15154
           && (ALTIVEC_OR_VSX_VECTOR_MODE (mode)
 
15155
               || (type && TREE_CODE (type) == VECTOR_TYPE
 
15156
@@ -8612,13 +9895,13 @@
 
15157
          int align, align_words, n_words;
 
15158
          enum machine_mode part_mode;
 
15159
 
 
15160
-         /* Vector parameters must be 16-byte aligned.  This places them at
 
15161
-            2 mod 4 in terms of words in 32-bit mode, since the parameter
 
15162
-            save area starts at offset 24 from the stack.  In 64-bit mode,
 
15163
-            they just have to start on an even word, since the parameter
 
15164
-            save area is 16-byte aligned.  */
 
15165
+         /* Vector parameters must be 16-byte aligned.  In 32-bit
 
15166
+            mode this means we need to take into account the offset
 
15167
+            to the parameter save area.  In 64-bit mode, they just
 
15168
+            have to start on an even word, since the parameter save
 
15169
+            area is 16-byte aligned.  */
 
15170
          if (TARGET_32BIT)
 
15171
-           align = (2 - cum->words) & 3;
 
15172
+           align = -(rs6000_parm_offset () + cum->words) & 3;
 
15173
          else
 
15174
            align = cum->words & 1;
 
15175
          align_words = cum->words + align;
 
15176
@@ -8696,101 +9979,50 @@
 
15177
 
 
15178
       /* _Decimal128 must be passed in an even/odd float register pair.
 
15179
         This assumes that the register number is odd when fregno is odd.  */
 
15180
-      if (mode == TDmode && (cum->fregno % 2) == 1)
 
15181
+      if (elt_mode == TDmode && (cum->fregno % 2) == 1)
 
15182
        cum->fregno++;
 
15183
 
 
15184
-      if (USE_FP_FOR_ARG_P (cum, mode, type))
 
15185
+      if (USE_FP_FOR_ARG_P (cum, elt_mode))
 
15186
        {
 
15187
-         rtx rvec[GP_ARG_NUM_REG + 1];
 
15188
-         rtx r;
 
15189
-         int k;
 
15190
-         bool needs_psave;
 
15191
-         enum machine_mode fmode = mode;
 
15192
-         unsigned long n_fpreg = (GET_MODE_SIZE (mode) + 7) >> 3;
 
15193
+         rtx rvec[GP_ARG_NUM_REG + AGGR_ARG_NUM_REG + 1];
 
15194
+         rtx r, off;
 
15195
+         int i, k = 0;
 
15196
+         unsigned long n_fpreg = (GET_MODE_SIZE (elt_mode) + 7) >> 3;
 
15197
 
 
15198
-         if (cum->fregno + n_fpreg > FP_ARG_MAX_REG + 1)
 
15199
-           {
 
15200
-             /* Currently, we only ever need one reg here because complex
 
15201
-                doubles are split.  */
 
15202
-             gcc_assert (cum->fregno == FP_ARG_MAX_REG
 
15203
-                         && (fmode == TFmode || fmode == TDmode));
 
15204
+         /* Do we also need to pass this argument in the parameter
 
15205
+            save area?  */
 
15206
+         if (type && (cum->nargs_prototype <= 0
 
15207
+                      || ((DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_ELFv2)
 
15208
+                          && TARGET_XL_COMPAT
 
15209
+                          && align_words >= GP_ARG_NUM_REG)))
 
15210
+           k = rs6000_psave_function_arg (mode, type, align_words, rvec);
 
15211
 
 
15212
-             /* Long double or _Decimal128 split over regs and memory.  */
 
15213
-             fmode = DECIMAL_FLOAT_MODE_P (fmode) ? DDmode : DFmode;
 
15214
-           }
 
15215
-
 
15216
-         /* Do we also need to pass this arg in the parameter save
 
15217
-            area?  */
 
15218
-         needs_psave = (type
 
15219
-                        && (cum->nargs_prototype <= 0
 
15220
-                            || (DEFAULT_ABI == ABI_AIX
 
15221
-                                && TARGET_XL_COMPAT
 
15222
-                                && align_words >= GP_ARG_NUM_REG)));
 
15223
-
 
15224
-         if (!needs_psave && mode == fmode)
 
15225
-           return gen_rtx_REG (fmode, cum->fregno);
 
15226
-
 
15227
-         k = 0;
 
15228
-         if (needs_psave)
 
15229
+         /* Describe where this argument goes in the fprs.  */
 
15230
+         for (i = 0; i < n_elts
 
15231
+                     && cum->fregno + i * n_fpreg <= FP_ARG_MAX_REG; i++)
 
15232
            {
 
15233
-             /* Describe the part that goes in gprs or the stack.
 
15234
-                This piece must come first, before the fprs.  */
 
15235
-             if (align_words < GP_ARG_NUM_REG)
 
15236
+             /* Check if the argument is split over registers and memory.
 
15237
+                This can only ever happen for long double or _Decimal128;
 
15238
+                complex types are handled via split_complex_arg.  */
 
15239
+             enum machine_mode fmode = elt_mode;
 
15240
+             if (cum->fregno + (i + 1) * n_fpreg > FP_ARG_MAX_REG + 1)
 
15241
                {
 
15242
-                 unsigned long n_words = rs6000_arg_size (mode, type);
 
15243
+                 gcc_assert (fmode == TFmode || fmode == TDmode);
 
15244
+                 fmode = DECIMAL_FLOAT_MODE_P (fmode) ? DDmode : DFmode;
 
15245
+               }
 
15246
 
 
15247
-                 if (align_words + n_words > GP_ARG_NUM_REG
 
15248
-                     || (TARGET_32BIT && TARGET_POWERPC64))
 
15249
-                   {
 
15250
-                     /* If this is partially on the stack, then we only
 
15251
-                        include the portion actually in registers here.  */
 
15252
-                     enum machine_mode rmode = TARGET_32BIT ? SImode : DImode;
 
15253
-                     rtx off;
 
15254
-                     int i = 0;
 
15255
-                     if (align_words + n_words > GP_ARG_NUM_REG)
 
15256
-                       /* Not all of the arg fits in gprs.  Say that it
 
15257
-                          goes in memory too, using a magic NULL_RTX
 
15258
-                          component.  Also see comment in
 
15259
-                          rs6000_mixed_function_arg for why the normal
 
15260
-                          function_arg_partial_nregs scheme doesn't work
 
15261
-                          in this case. */
 
15262
-                       rvec[k++] = gen_rtx_EXPR_LIST (VOIDmode, NULL_RTX,
 
15263
-                                                      const0_rtx);
 
15264
-                     do
 
15265
-                       {
 
15266
-                         r = gen_rtx_REG (rmode,
 
15267
-                                          GP_ARG_MIN_REG + align_words);
 
15268
-                         off = GEN_INT (i++ * GET_MODE_SIZE (rmode));
 
15269
-                         rvec[k++] = gen_rtx_EXPR_LIST (VOIDmode, r, off);
 
15270
-                       }
 
15271
-                     while (++align_words < GP_ARG_NUM_REG && --n_words != 0);
 
15272
-                   }
 
15273
-                 else
 
15274
-                   {
 
15275
-                     /* The whole arg fits in gprs.  */
 
15276
-                     r = gen_rtx_REG (mode, GP_ARG_MIN_REG + align_words);
 
15277
-                     rvec[k++] = gen_rtx_EXPR_LIST (VOIDmode, r, const0_rtx);
 
15278
-                   }
 
15279
-               }
 
15280
-             else
 
15281
-               /* It's entirely in memory.  */
 
15282
-               rvec[k++] = gen_rtx_EXPR_LIST (VOIDmode, NULL_RTX, const0_rtx);
 
15283
+             r = gen_rtx_REG (fmode, cum->fregno + i * n_fpreg);
 
15284
+             off = GEN_INT (i * GET_MODE_SIZE (elt_mode));
 
15285
+             rvec[k++] = gen_rtx_EXPR_LIST (VOIDmode, r, off);
 
15286
            }
 
15287
 
 
15288
-         /* Describe where this piece goes in the fprs.  */
 
15289
-         r = gen_rtx_REG (fmode, cum->fregno);
 
15290
-         rvec[k++] = gen_rtx_EXPR_LIST (VOIDmode, r, const0_rtx);
 
15291
-
 
15292
-         return gen_rtx_PARALLEL (mode, gen_rtvec_v (k, rvec));
 
15293
+         return rs6000_finish_function_arg (mode, rvec, k);
 
15294
        }
 
15295
       else if (align_words < GP_ARG_NUM_REG)
 
15296
        {
 
15297
          if (TARGET_32BIT && TARGET_POWERPC64)
 
15298
            return rs6000_mixed_function_arg (mode, type, align_words);
 
15299
 
 
15300
-         if (mode == BLKmode)
 
15301
-           mode = Pmode;
 
15302
-
 
15303
          return gen_rtx_REG (mode, GP_ARG_MIN_REG + align_words);
 
15304
        }
 
15305
       else
 
15306
@@ -8809,42 +10041,62 @@
 
15307
                          tree type, bool named)
 
15308
 {
 
15309
   CUMULATIVE_ARGS *cum = get_cumulative_args (cum_v);
 
15310
+  bool passed_in_gprs = true;
 
15311
   int ret = 0;
 
15312
   int align_words;
 
15313
+  enum machine_mode elt_mode;
 
15314
+  int n_elts;
 
15315
 
 
15316
+  rs6000_discover_homogeneous_aggregate (mode, type, &elt_mode, &n_elts);
 
15317
+
 
15318
   if (DEFAULT_ABI == ABI_V4)
 
15319
     return 0;
 
15320
 
 
15321
-  if (USE_ALTIVEC_FOR_ARG_P (cum, mode, type, named)
 
15322
-      && cum->nargs_prototype >= 0)
 
15323
-    return 0;
 
15324
+  if (USE_ALTIVEC_FOR_ARG_P (cum, elt_mode, named))
 
15325
+    {
 
15326
+      /* If we are passing this arg in the fixed parameter save area
 
15327
+         (gprs or memory) as well as VRs, we do not use the partial
 
15328
+        bytes mechanism; instead, rs6000_function_arg will return a
 
15329
+        PARALLEL including a memory element as necessary.  */
 
15330
+      if (TARGET_64BIT && ! cum->prototype)
 
15331
+       return 0;
 
15332
 
 
15333
+      /* Otherwise, we pass in VRs only.  Check for partial copies.  */
 
15334
+      passed_in_gprs = false;
 
15335
+      if (cum->vregno + n_elts > ALTIVEC_ARG_MAX_REG + 1)
 
15336
+       ret = (ALTIVEC_ARG_MAX_REG + 1 - cum->vregno) * 16;
 
15337
+    }
 
15338
+
 
15339
   /* In this complicated case we just disable the partial_nregs code.  */
 
15340
   if (TARGET_MACHO && rs6000_darwin64_struct_check_p (mode, type))
 
15341
     return 0;
 
15342
 
 
15343
   align_words = rs6000_parm_start (mode, type, cum->words);
 
15344
 
 
15345
-  if (USE_FP_FOR_ARG_P (cum, mode, type))
 
15346
+  if (USE_FP_FOR_ARG_P (cum, elt_mode))
 
15347
     {
 
15348
+      unsigned long n_fpreg = (GET_MODE_SIZE (elt_mode) + 7) >> 3;
 
15349
+
 
15350
       /* If we are passing this arg in the fixed parameter save area
 
15351
-        (gprs or memory) as well as fprs, then this function should
 
15352
-        return the number of partial bytes passed in the parameter
 
15353
-        save area rather than partial bytes passed in fprs.  */
 
15354
+         (gprs or memory) as well as FPRs, we do not use the partial
 
15355
+        bytes mechanism; instead, rs6000_function_arg will return a
 
15356
+        PARALLEL including a memory element as necessary.  */
 
15357
       if (type
 
15358
          && (cum->nargs_prototype <= 0
 
15359
-             || (DEFAULT_ABI == ABI_AIX
 
15360
+             || ((DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_ELFv2)
 
15361
                  && TARGET_XL_COMPAT
 
15362
                  && align_words >= GP_ARG_NUM_REG)))
 
15363
        return 0;
 
15364
-      else if (cum->fregno + ((GET_MODE_SIZE (mode) + 7) >> 3)
 
15365
-              > FP_ARG_MAX_REG + 1)
 
15366
-       ret = (FP_ARG_MAX_REG + 1 - cum->fregno) * 8;
 
15367
-      else if (cum->nargs_prototype >= 0)
 
15368
-       return 0;
 
15369
+
 
15370
+      /* Otherwise, we pass in FPRs only.  Check for partial copies.  */
 
15371
+      passed_in_gprs = false;
 
15372
+      if (cum->fregno + n_elts * n_fpreg > FP_ARG_MAX_REG + 1)
 
15373
+       ret = ((FP_ARG_MAX_REG + 1 - cum->fregno)
 
15374
+              * MIN (8, GET_MODE_SIZE (elt_mode)));
 
15375
     }
 
15376
 
 
15377
-  if (align_words < GP_ARG_NUM_REG
 
15378
+  if (passed_in_gprs
 
15379
+      && align_words < GP_ARG_NUM_REG
 
15380
       && GP_ARG_NUM_REG < align_words + rs6000_arg_size (mode, type))
 
15381
     ret = (GP_ARG_NUM_REG - align_words) * (TARGET_32BIT ? 4 : 8);
 
15382
 
 
15383
@@ -8925,6 +10177,139 @@
 
15384
   return 0;
 
15385
 }
 
15386
 
 
15387
+/* Process parameter of type TYPE after ARGS_SO_FAR parameters were
 
15388
+   already processes.  Return true if the parameter must be passed
 
15389
+   (fully or partially) on the stack.  */
 
15390
+
 
15391
+static bool
 
15392
+rs6000_parm_needs_stack (cumulative_args_t args_so_far, tree type)
 
15393
+{
 
15394
+  enum machine_mode mode;
 
15395
+  int unsignedp;
 
15396
+  rtx entry_parm;
 
15397
+
 
15398
+  /* Catch errors.  */
 
15399
+  if (type == NULL || type == error_mark_node)
 
15400
+    return true;
 
15401
+
 
15402
+  /* Handle types with no storage requirement.  */
 
15403
+  if (TYPE_MODE (type) == VOIDmode)
 
15404
+    return false;
 
15405
+
 
15406
+  /* Handle complex types.  */
 
15407
+  if (TREE_CODE (type) == COMPLEX_TYPE)
 
15408
+    return (rs6000_parm_needs_stack (args_so_far, TREE_TYPE (type))
 
15409
+           || rs6000_parm_needs_stack (args_so_far, TREE_TYPE (type)));
 
15410
+
 
15411
+  /* Handle transparent aggregates.  */
 
15412
+  if ((TREE_CODE (type) == UNION_TYPE || TREE_CODE (type) == RECORD_TYPE)
 
15413
+      && TYPE_TRANSPARENT_AGGR (type))
 
15414
+    type = TREE_TYPE (first_field (type));
 
15415
+
 
15416
+  /* See if this arg was passed by invisible reference.  */
 
15417
+  if (pass_by_reference (get_cumulative_args (args_so_far),
 
15418
+                        TYPE_MODE (type), type, true))
 
15419
+    type = build_pointer_type (type);
 
15420
+
 
15421
+  /* Find mode as it is passed by the ABI.  */
 
15422
+  unsignedp = TYPE_UNSIGNED (type);
 
15423
+  mode = promote_mode (type, TYPE_MODE (type), &unsignedp);
 
15424
+
 
15425
+  /* If we must pass in stack, we need a stack.  */
 
15426
+  if (rs6000_must_pass_in_stack (mode, type))
 
15427
+    return true;
 
15428
+
 
15429
+  /* If there is no incoming register, we need a stack.  */
 
15430
+  entry_parm = rs6000_function_arg (args_so_far, mode, type, true);
 
15431
+  if (entry_parm == NULL)
 
15432
+    return true;
 
15433
+
 
15434
+  /* Likewise if we need to pass both in registers and on the stack.  */
 
15435
+  if (GET_CODE (entry_parm) == PARALLEL
 
15436
+      && XEXP (XVECEXP (entry_parm, 0, 0), 0) == NULL_RTX)
 
15437
+    return true;
 
15438
+
 
15439
+  /* Also true if we're partially in registers and partially not.  */
 
15440
+  if (rs6000_arg_partial_bytes (args_so_far, mode, type, true) != 0)
 
15441
+    return true;
 
15442
+
 
15443
+  /* Update info on where next arg arrives in registers.  */
 
15444
+  rs6000_function_arg_advance (args_so_far, mode, type, true);
 
15445
+  return false;
 
15446
+}
 
15447
+
 
15448
+/* Return true if FUN has no prototype, has a variable argument
 
15449
+   list, or passes any parameter in memory.  */
 
15450
+
 
15451
+static bool
 
15452
+rs6000_function_parms_need_stack (tree fun)
 
15453
+{
 
15454
+  function_args_iterator args_iter;
 
15455
+  tree arg_type;
 
15456
+  CUMULATIVE_ARGS args_so_far_v;
 
15457
+  cumulative_args_t args_so_far;
 
15458
+
 
15459
+  if (!fun)
 
15460
+    /* Must be a libcall, all of which only use reg parms.  */
 
15461
+    return false;
 
15462
+  if (!TYPE_P (fun))
 
15463
+    fun = TREE_TYPE (fun);
 
15464
+
 
15465
+  /* Varargs functions need the parameter save area.  */
 
15466
+  if (!prototype_p (fun) || stdarg_p (fun))
 
15467
+    return true;
 
15468
+
 
15469
+  INIT_CUMULATIVE_INCOMING_ARGS (args_so_far_v, fun, NULL_RTX);
 
15470
+  args_so_far = pack_cumulative_args (&args_so_far_v);
 
15471
+
 
15472
+  if (aggregate_value_p (TREE_TYPE (fun), fun))
 
15473
+    {
 
15474
+      tree type = build_pointer_type (TREE_TYPE (fun));
 
15475
+      rs6000_parm_needs_stack (args_so_far, type);
 
15476
+    }
 
15477
+
 
15478
+  FOREACH_FUNCTION_ARGS (fun, arg_type, args_iter)
 
15479
+    if (rs6000_parm_needs_stack (args_so_far, arg_type))
 
15480
+      return true;
 
15481
+
 
15482
+  return false;
 
15483
+}
 
15484
+
 
15485
+/* Return the size of the REG_PARM_STACK_SPACE are for FUN.  This is
 
15486
+   usually a constant depending on the ABI.  However, in the ELFv2 ABI
 
15487
+   the register parameter area is optional when calling a function that
 
15488
+   has a prototype is scope, has no variable argument list, and passes
 
15489
+   all parameters in registers.  */
 
15490
+
 
15491
+int
 
15492
+rs6000_reg_parm_stack_space (tree fun)
 
15493
+{
 
15494
+  int reg_parm_stack_space;
 
15495
+
 
15496
+  switch (DEFAULT_ABI)
 
15497
+    {
 
15498
+    default:
 
15499
+      reg_parm_stack_space = 0;
 
15500
+      break;
 
15501
+
 
15502
+    case ABI_AIX:
 
15503
+    case ABI_DARWIN:
 
15504
+      reg_parm_stack_space = TARGET_64BIT ? 64 : 32;
 
15505
+      break;
 
15506
+
 
15507
+    case ABI_ELFv2:
 
15508
+      /* ??? Recomputing this every time is a bit expensive.  Is there
 
15509
+        a place to cache this information?  */
 
15510
+      if (rs6000_function_parms_need_stack (fun))
 
15511
+       reg_parm_stack_space = TARGET_64BIT ? 64 : 32;
 
15512
+      else
 
15513
+       reg_parm_stack_space = 0;
 
15514
+      break;
 
15515
+    }
 
15516
+
 
15517
+  return reg_parm_stack_space;
 
15518
+}
 
15519
+
 
15520
 static void
 
15521
 rs6000_move_block_from_reg (int regno, rtx x, int nregs)
 
15522
 {
 
15523
@@ -9306,8 +10691,10 @@
 
15524
      We don't need to check for pass-by-reference because of the test above.
 
15525
      We can return a simplifed answer, since we know there's no offset to add.  */
 
15526
 
 
15527
-  if (TARGET_MACHO
 
15528
-      && rs6000_darwin64_abi 
 
15529
+  if (((TARGET_MACHO
 
15530
+        && rs6000_darwin64_abi)
 
15531
+       || DEFAULT_ABI == ABI_ELFv2
 
15532
+       || (DEFAULT_ABI == ABI_AIX && !rs6000_compat_align_parm))
 
15533
       && integer_zerop (TYPE_SIZE (type)))
 
15534
     {
 
15535
       unsigned HOST_WIDE_INT align, boundary;
 
15536
@@ -9602,6 +10989,7 @@
 
15537
 #undef RS6000_BUILTIN_A
 
15538
 #undef RS6000_BUILTIN_D
 
15539
 #undef RS6000_BUILTIN_E
 
15540
+#undef RS6000_BUILTIN_H
 
15541
 #undef RS6000_BUILTIN_P
 
15542
 #undef RS6000_BUILTIN_Q
 
15543
 #undef RS6000_BUILTIN_S
 
15544
@@ -9615,6 +11003,7 @@
 
15545
 #define RS6000_BUILTIN_A(ENUM, NAME, MASK, ATTR, ICODE)
 
15546
 #define RS6000_BUILTIN_D(ENUM, NAME, MASK, ATTR, ICODE)
 
15547
 #define RS6000_BUILTIN_E(ENUM, NAME, MASK, ATTR, ICODE)
 
15548
+#define RS6000_BUILTIN_H(ENUM, NAME, MASK, ATTR, ICODE)
 
15549
 #define RS6000_BUILTIN_P(ENUM, NAME, MASK, ATTR, ICODE)
 
15550
 #define RS6000_BUILTIN_Q(ENUM, NAME, MASK, ATTR, ICODE)
 
15551
 #define RS6000_BUILTIN_S(ENUM, NAME, MASK, ATTR, ICODE)
 
15552
@@ -9633,6 +11022,7 @@
 
15553
 #undef RS6000_BUILTIN_A
 
15554
 #undef RS6000_BUILTIN_D
 
15555
 #undef RS6000_BUILTIN_E
 
15556
+#undef RS6000_BUILTIN_H
 
15557
 #undef RS6000_BUILTIN_P
 
15558
 #undef RS6000_BUILTIN_Q
 
15559
 #undef RS6000_BUILTIN_S
 
15560
@@ -9646,6 +11036,7 @@
 
15561
   { MASK, ICODE, NAME, ENUM },
 
15562
 
 
15563
 #define RS6000_BUILTIN_E(ENUM, NAME, MASK, ATTR, ICODE)
 
15564
+#define RS6000_BUILTIN_H(ENUM, NAME, MASK, ATTR, ICODE)
 
15565
 #define RS6000_BUILTIN_P(ENUM, NAME, MASK, ATTR, ICODE)
 
15566
 #define RS6000_BUILTIN_Q(ENUM, NAME, MASK, ATTR, ICODE)
 
15567
 #define RS6000_BUILTIN_S(ENUM, NAME, MASK, ATTR, ICODE)
 
15568
@@ -9664,6 +11055,7 @@
 
15569
 #undef RS6000_BUILTIN_A
 
15570
 #undef RS6000_BUILTIN_D
 
15571
 #undef RS6000_BUILTIN_E
 
15572
+#undef RS6000_BUILTIN_H
 
15573
 #undef RS6000_BUILTIN_P
 
15574
 #undef RS6000_BUILTIN_Q
 
15575
 #undef RS6000_BUILTIN_S
 
15576
@@ -9677,6 +11069,7 @@
 
15577
 #define RS6000_BUILTIN_A(ENUM, NAME, MASK, ATTR, ICODE)
 
15578
 #define RS6000_BUILTIN_D(ENUM, NAME, MASK, ATTR, ICODE)
 
15579
 #define RS6000_BUILTIN_E(ENUM, NAME, MASK, ATTR, ICODE)
 
15580
+#define RS6000_BUILTIN_H(ENUM, NAME, MASK, ATTR, ICODE)
 
15581
 #define RS6000_BUILTIN_P(ENUM, NAME, MASK, ATTR, ICODE)
 
15582
 #define RS6000_BUILTIN_Q(ENUM, NAME, MASK, ATTR, ICODE)
 
15583
 #define RS6000_BUILTIN_S(ENUM, NAME, MASK, ATTR, ICODE)
 
15584
@@ -9693,6 +11086,7 @@
 
15585
 #undef RS6000_BUILTIN_A
 
15586
 #undef RS6000_BUILTIN_D
 
15587
 #undef RS6000_BUILTIN_E
 
15588
+#undef RS6000_BUILTIN_H
 
15589
 #undef RS6000_BUILTIN_P
 
15590
 #undef RS6000_BUILTIN_Q
 
15591
 #undef RS6000_BUILTIN_S
 
15592
@@ -9704,6 +11098,7 @@
 
15593
 #define RS6000_BUILTIN_A(ENUM, NAME, MASK, ATTR, ICODE)
 
15594
 #define RS6000_BUILTIN_D(ENUM, NAME, MASK, ATTR, ICODE)
 
15595
 #define RS6000_BUILTIN_E(ENUM, NAME, MASK, ATTR, ICODE)
 
15596
+#define RS6000_BUILTIN_H(ENUM, NAME, MASK, ATTR, ICODE)
 
15597
 #define RS6000_BUILTIN_P(ENUM, NAME, MASK, ATTR, ICODE) \
 
15598
   { MASK, ICODE, NAME, ENUM },
 
15599
 
 
15600
@@ -9725,6 +11120,7 @@
 
15601
 #undef RS6000_BUILTIN_A
 
15602
 #undef RS6000_BUILTIN_D
 
15603
 #undef RS6000_BUILTIN_E
 
15604
+#undef RS6000_BUILTIN_H
 
15605
 #undef RS6000_BUILTIN_P
 
15606
 #undef RS6000_BUILTIN_Q
 
15607
 #undef RS6000_BUILTIN_S
 
15608
@@ -9736,6 +11132,7 @@
 
15609
 #define RS6000_BUILTIN_A(ENUM, NAME, MASK, ATTR, ICODE)
 
15610
 #define RS6000_BUILTIN_D(ENUM, NAME, MASK, ATTR, ICODE)
 
15611
 #define RS6000_BUILTIN_E(ENUM, NAME, MASK, ATTR, ICODE)
 
15612
+#define RS6000_BUILTIN_H(ENUM, NAME, MASK, ATTR, ICODE)
 
15613
 #define RS6000_BUILTIN_P(ENUM, NAME, MASK, ATTR, ICODE)
 
15614
 #define RS6000_BUILTIN_Q(ENUM, NAME, MASK, ATTR, ICODE)
 
15615
 #define RS6000_BUILTIN_S(ENUM, NAME, MASK, ATTR, ICODE) \
 
15616
@@ -9755,6 +11152,7 @@
 
15617
 #undef RS6000_BUILTIN_A
 
15618
 #undef RS6000_BUILTIN_D
 
15619
 #undef RS6000_BUILTIN_E
 
15620
+#undef RS6000_BUILTIN_H
 
15621
 #undef RS6000_BUILTIN_P
 
15622
 #undef RS6000_BUILTIN_Q
 
15623
 #undef RS6000_BUILTIN_S
 
15624
@@ -9768,6 +11166,7 @@
 
15625
 #define RS6000_BUILTIN_E(ENUM, NAME, MASK, ATTR, ICODE) \
 
15626
   { MASK, ICODE, NAME, ENUM },
 
15627
 
 
15628
+#define RS6000_BUILTIN_H(ENUM, NAME, MASK, ATTR, ICODE)
 
15629
 #define RS6000_BUILTIN_P(ENUM, NAME, MASK, ATTR, ICODE)
 
15630
 #define RS6000_BUILTIN_Q(ENUM, NAME, MASK, ATTR, ICODE)
 
15631
 #define RS6000_BUILTIN_S(ENUM, NAME, MASK, ATTR, ICODE)
 
15632
@@ -9785,6 +11184,7 @@
 
15633
 #undef RS6000_BUILTIN_A
 
15634
 #undef RS6000_BUILTIN_D
 
15635
 #undef RS6000_BUILTIN_E
 
15636
+#undef RS6000_BUILTIN_H
 
15637
 #undef RS6000_BUILTIN_P
 
15638
 #undef RS6000_BUILTIN_Q
 
15639
 #undef RS6000_BUILTIN_S
 
15640
@@ -9796,6 +11196,7 @@
 
15641
 #define RS6000_BUILTIN_A(ENUM, NAME, MASK, ATTR, ICODE)
 
15642
 #define RS6000_BUILTIN_D(ENUM, NAME, MASK, ATTR, ICODE)
 
15643
 #define RS6000_BUILTIN_E(ENUM, NAME, MASK, ATTR, ICODE)
 
15644
+#define RS6000_BUILTIN_H(ENUM, NAME, MASK, ATTR, ICODE)
 
15645
 #define RS6000_BUILTIN_P(ENUM, NAME, MASK, ATTR, ICODE)
 
15646
 #define RS6000_BUILTIN_Q(ENUM, NAME, MASK, ATTR, ICODE) \
 
15647
   { MASK, ICODE, NAME, ENUM },
 
15648
@@ -9816,6 +11217,7 @@
 
15649
 #undef RS6000_BUILTIN_A
 
15650
 #undef RS6000_BUILTIN_D
 
15651
 #undef RS6000_BUILTIN_E
 
15652
+#undef RS6000_BUILTIN_H
 
15653
 #undef RS6000_BUILTIN_P
 
15654
 #undef RS6000_BUILTIN_Q
 
15655
 #undef RS6000_BUILTIN_S
 
15656
@@ -9829,6 +11231,7 @@
 
15657
 
 
15658
 #define RS6000_BUILTIN_D(ENUM, NAME, MASK, ATTR, ICODE)
 
15659
 #define RS6000_BUILTIN_E(ENUM, NAME, MASK, ATTR, ICODE)
 
15660
+#define RS6000_BUILTIN_H(ENUM, NAME, MASK, ATTR, ICODE)
 
15661
 #define RS6000_BUILTIN_P(ENUM, NAME, MASK, ATTR, ICODE)
 
15662
 #define RS6000_BUILTIN_Q(ENUM, NAME, MASK, ATTR, ICODE)
 
15663
 #define RS6000_BUILTIN_S(ENUM, NAME, MASK, ATTR, ICODE)
 
15664
@@ -9846,8 +11249,9 @@
 
15665
 #undef RS6000_BUILTIN_2
 
15666
 #undef RS6000_BUILTIN_3
 
15667
 #undef RS6000_BUILTIN_A
 
15668
+#undef RS6000_BUILTIN_D
 
15669
 #undef RS6000_BUILTIN_E
 
15670
-#undef RS6000_BUILTIN_D
 
15671
+#undef RS6000_BUILTIN_H
 
15672
 #undef RS6000_BUILTIN_P
 
15673
 #undef RS6000_BUILTIN_Q
 
15674
 #undef RS6000_BUILTIN_S
 
15675
@@ -9861,6 +11265,7 @@
 
15676
 #define RS6000_BUILTIN_A(ENUM, NAME, MASK, ATTR, ICODE)
 
15677
 #define RS6000_BUILTIN_D(ENUM, NAME, MASK, ATTR, ICODE)
 
15678
 #define RS6000_BUILTIN_E(ENUM, NAME, MASK, ATTR, ICODE)
 
15679
+#define RS6000_BUILTIN_H(ENUM, NAME, MASK, ATTR, ICODE)
 
15680
 #define RS6000_BUILTIN_P(ENUM, NAME, MASK, ATTR, ICODE)
 
15681
 #define RS6000_BUILTIN_Q(ENUM, NAME, MASK, ATTR, ICODE)
 
15682
 #define RS6000_BUILTIN_S(ENUM, NAME, MASK, ATTR, ICODE)
 
15683
@@ -9871,17 +11276,49 @@
 
15684
 #include "rs6000-builtin.def"
 
15685
 };
 
15686
 
 
15687
+/* HTM builtins.  */
 
15688
 #undef RS6000_BUILTIN_1
 
15689
 #undef RS6000_BUILTIN_2
 
15690
 #undef RS6000_BUILTIN_3
 
15691
 #undef RS6000_BUILTIN_A
 
15692
 #undef RS6000_BUILTIN_D
 
15693
 #undef RS6000_BUILTIN_E
 
15694
+#undef RS6000_BUILTIN_H
 
15695
 #undef RS6000_BUILTIN_P
 
15696
 #undef RS6000_BUILTIN_Q
 
15697
 #undef RS6000_BUILTIN_S
 
15698
 #undef RS6000_BUILTIN_X
 
15699
 
 
15700
+#define RS6000_BUILTIN_1(ENUM, NAME, MASK, ATTR, ICODE)
 
15701
+#define RS6000_BUILTIN_2(ENUM, NAME, MASK, ATTR, ICODE)
 
15702
+#define RS6000_BUILTIN_3(ENUM, NAME, MASK, ATTR, ICODE)
 
15703
+#define RS6000_BUILTIN_A(ENUM, NAME, MASK, ATTR, ICODE)
 
15704
+#define RS6000_BUILTIN_D(ENUM, NAME, MASK, ATTR, ICODE)
 
15705
+#define RS6000_BUILTIN_E(ENUM, NAME, MASK, ATTR, ICODE)
 
15706
+#define RS6000_BUILTIN_H(ENUM, NAME, MASK, ATTR, ICODE) \
 
15707
+  { MASK, ICODE, NAME, ENUM },
 
15708
+
 
15709
+#define RS6000_BUILTIN_P(ENUM, NAME, MASK, ATTR, ICODE)
 
15710
+#define RS6000_BUILTIN_Q(ENUM, NAME, MASK, ATTR, ICODE)
 
15711
+#define RS6000_BUILTIN_S(ENUM, NAME, MASK, ATTR, ICODE)
 
15712
+#define RS6000_BUILTIN_X(ENUM, NAME, MASK, ATTR, ICODE)
 
15713
+
 
15714
+static const struct builtin_description bdesc_htm[] =
 
15715
+{
 
15716
+#include "rs6000-builtin.def"
 
15717
+};
 
15718
+
 
15719
+#undef RS6000_BUILTIN_1
 
15720
+#undef RS6000_BUILTIN_2
 
15721
+#undef RS6000_BUILTIN_3
 
15722
+#undef RS6000_BUILTIN_A
 
15723
+#undef RS6000_BUILTIN_D
 
15724
+#undef RS6000_BUILTIN_E
 
15725
+#undef RS6000_BUILTIN_H
 
15726
+#undef RS6000_BUILTIN_P
 
15727
+#undef RS6000_BUILTIN_Q
 
15728
+#undef RS6000_BUILTIN_S
 
15729
+
 
15730
 /* Return true if a builtin function is overloaded.  */
 
15731
 bool
 
15732
 rs6000_overloaded_builtin_p (enum rs6000_builtins fncode)
 
15733
@@ -10351,7 +11788,198 @@
 
15734
   return NULL_RTX;
 
15735
 }
 
15736
 
 
15737
+/* Return the appropriate SPR number associated with the given builtin.  */
 
15738
+static inline HOST_WIDE_INT
 
15739
+htm_spr_num (enum rs6000_builtins code)
 
15740
+{
 
15741
+  if (code == HTM_BUILTIN_GET_TFHAR
 
15742
+      || code == HTM_BUILTIN_SET_TFHAR)
 
15743
+    return TFHAR_SPR;
 
15744
+  else if (code == HTM_BUILTIN_GET_TFIAR
 
15745
+          || code == HTM_BUILTIN_SET_TFIAR)
 
15746
+    return TFIAR_SPR;
 
15747
+  else if (code == HTM_BUILTIN_GET_TEXASR
 
15748
+          || code == HTM_BUILTIN_SET_TEXASR)
 
15749
+    return TEXASR_SPR;
 
15750
+  gcc_assert (code == HTM_BUILTIN_GET_TEXASRU
 
15751
+             || code == HTM_BUILTIN_SET_TEXASRU);
 
15752
+  return TEXASRU_SPR;
 
15753
+}
 
15754
+
 
15755
+/* Return the appropriate SPR regno associated with the given builtin.  */
 
15756
+static inline HOST_WIDE_INT
 
15757
+htm_spr_regno (enum rs6000_builtins code)
 
15758
+{
 
15759
+  if (code == HTM_BUILTIN_GET_TFHAR
 
15760
+      || code == HTM_BUILTIN_SET_TFHAR)
 
15761
+    return TFHAR_REGNO;
 
15762
+  else if (code == HTM_BUILTIN_GET_TFIAR
 
15763
+          || code == HTM_BUILTIN_SET_TFIAR)
 
15764
+    return TFIAR_REGNO;
 
15765
+  gcc_assert (code == HTM_BUILTIN_GET_TEXASR
 
15766
+             || code == HTM_BUILTIN_SET_TEXASR
 
15767
+             || code == HTM_BUILTIN_GET_TEXASRU
 
15768
+             || code == HTM_BUILTIN_SET_TEXASRU);
 
15769
+  return TEXASR_REGNO;
 
15770
+}
 
15771
+
 
15772
+/* Return the correct ICODE value depending on whether we are
 
15773
+   setting or reading the HTM SPRs.  */
 
15774
+static inline enum insn_code
 
15775
+rs6000_htm_spr_icode (bool nonvoid)
 
15776
+{
 
15777
+  if (nonvoid)
 
15778
+    return (TARGET_64BIT) ? CODE_FOR_htm_mfspr_di : CODE_FOR_htm_mfspr_si;
 
15779
+  else
 
15780
+    return (TARGET_64BIT) ? CODE_FOR_htm_mtspr_di : CODE_FOR_htm_mtspr_si;
 
15781
+}
 
15782
+
 
15783
+/* Expand the HTM builtin in EXP and store the result in TARGET.
 
15784
+   Store true in *EXPANDEDP if we found a builtin to expand.  */
 
15785
 static rtx
 
15786
+htm_expand_builtin (tree exp, rtx target, bool * expandedp)
 
15787
+{
 
15788
+  tree fndecl = TREE_OPERAND (CALL_EXPR_FN (exp), 0);
 
15789
+  bool nonvoid = TREE_TYPE (TREE_TYPE (fndecl)) != void_type_node;
 
15790
+  enum rs6000_builtins fcode = (enum rs6000_builtins) DECL_FUNCTION_CODE (fndecl);
 
15791
+  const struct builtin_description *d;
 
15792
+  size_t i;
 
15793
+
 
15794
+  *expandedp = false;
 
15795
+
 
15796
+  /* Expand the HTM builtins.  */
 
15797
+  d = bdesc_htm;
 
15798
+  for (i = 0; i < ARRAY_SIZE (bdesc_htm); i++, d++)
 
15799
+    if (d->code == fcode)
 
15800
+      {
 
15801
+       rtx op[MAX_HTM_OPERANDS], pat;
 
15802
+       int nopnds = 0;
 
15803
+       tree arg;
 
15804
+       call_expr_arg_iterator iter;
 
15805
+       unsigned attr = rs6000_builtin_info[fcode].attr;
 
15806
+       enum insn_code icode = d->icode;
 
15807
+
 
15808
+       if (attr & RS6000_BTC_SPR)
 
15809
+         icode = rs6000_htm_spr_icode (nonvoid);
 
15810
+
 
15811
+       if (nonvoid)
 
15812
+         {
 
15813
+           enum machine_mode tmode = insn_data[icode].operand[0].mode;
 
15814
+           if (!target
 
15815
+               || GET_MODE (target) != tmode
 
15816
+               || !(*insn_data[icode].operand[0].predicate) (target, tmode))
 
15817
+             target = gen_reg_rtx (tmode);
 
15818
+           op[nopnds++] = target;
 
15819
+         }
 
15820
+
 
15821
+       FOR_EACH_CALL_EXPR_ARG (arg, iter, exp)
 
15822
+       {
 
15823
+         const struct insn_operand_data *insn_op;
 
15824
+
 
15825
+         if (arg == error_mark_node || nopnds >= MAX_HTM_OPERANDS)
 
15826
+           return NULL_RTX;
 
15827
+
 
15828
+         insn_op = &insn_data[icode].operand[nopnds];
 
15829
+
 
15830
+         op[nopnds] = expand_normal (arg);
 
15831
+
 
15832
+         if (!(*insn_op->predicate) (op[nopnds], insn_op->mode))
 
15833
+           {
 
15834
+             if (!strcmp (insn_op->constraint, "n"))
 
15835
+               {
 
15836
+                 int arg_num = (nonvoid) ? nopnds : nopnds + 1;
 
15837
+                 if (!CONST_INT_P (op[nopnds]))
 
15838
+                   error ("argument %d must be an unsigned literal", arg_num);
 
15839
+                 else
 
15840
+                   error ("argument %d is an unsigned literal that is "
 
15841
+                          "out of range", arg_num);
 
15842
+                 return const0_rtx;
 
15843
+               }
 
15844
+             op[nopnds] = copy_to_mode_reg (insn_op->mode, op[nopnds]);
 
15845
+           }
 
15846
+
 
15847
+         nopnds++;
 
15848
+       }
 
15849
+
 
15850
+       /* Handle the builtins for extended mnemonics.  These accept
 
15851
+          no arguments, but map to builtins that take arguments.  */
 
15852
+       switch (fcode)
 
15853
+         {
 
15854
+         case HTM_BUILTIN_TENDALL:  /* Alias for: tend. 1  */
 
15855
+         case HTM_BUILTIN_TRESUME:  /* Alias for: tsr. 1  */
 
15856
+           op[nopnds++] = GEN_INT (1);
 
15857
+#ifdef ENABLE_CHECKING
 
15858
+           attr |= RS6000_BTC_UNARY;
 
15859
+#endif
 
15860
+           break;
 
15861
+         case HTM_BUILTIN_TSUSPEND: /* Alias for: tsr. 0  */
 
15862
+           op[nopnds++] = GEN_INT (0);
 
15863
+#ifdef ENABLE_CHECKING
 
15864
+           attr |= RS6000_BTC_UNARY;
 
15865
+#endif
 
15866
+           break;
 
15867
+         default:
 
15868
+           break;
 
15869
+         }
 
15870
+
 
15871
+       /* If this builtin accesses SPRs, then pass in the appropriate
 
15872
+          SPR number and SPR regno as the last two operands.  */
 
15873
+       if (attr & RS6000_BTC_SPR)
 
15874
+         {
 
15875
+           op[nopnds++] = gen_rtx_CONST_INT (Pmode, htm_spr_num (fcode));
 
15876
+           op[nopnds++] = gen_rtx_REG (Pmode, htm_spr_regno (fcode));
 
15877
+         }
 
15878
+
 
15879
+#ifdef ENABLE_CHECKING
 
15880
+       int expected_nopnds = 0;
 
15881
+       if ((attr & RS6000_BTC_TYPE_MASK) == RS6000_BTC_UNARY)
 
15882
+         expected_nopnds = 1;
 
15883
+       else if ((attr & RS6000_BTC_TYPE_MASK) == RS6000_BTC_BINARY)
 
15884
+         expected_nopnds = 2;
 
15885
+       else if ((attr & RS6000_BTC_TYPE_MASK) == RS6000_BTC_TERNARY)
 
15886
+         expected_nopnds = 3;
 
15887
+       if (!(attr & RS6000_BTC_VOID))
 
15888
+         expected_nopnds += 1;
 
15889
+       if (attr & RS6000_BTC_SPR)
 
15890
+         expected_nopnds += 2;
 
15891
+
 
15892
+       gcc_assert (nopnds == expected_nopnds && nopnds <= MAX_HTM_OPERANDS);
 
15893
+#endif
 
15894
+
 
15895
+       switch (nopnds)
 
15896
+         {
 
15897
+         case 0:
 
15898
+           pat = GEN_FCN (icode) (NULL_RTX);
 
15899
+           break;
 
15900
+         case 1:
 
15901
+           pat = GEN_FCN (icode) (op[0]);
 
15902
+           break;
 
15903
+         case 2:
 
15904
+           pat = GEN_FCN (icode) (op[0], op[1]);
 
15905
+           break;
 
15906
+         case 3:
 
15907
+           pat = GEN_FCN (icode) (op[0], op[1], op[2]);
 
15908
+           break;
 
15909
+         case 4:
 
15910
+           pat = GEN_FCN (icode) (op[0], op[1], op[2], op[3]);
 
15911
+           break;
 
15912
+         default:
 
15913
+           gcc_unreachable ();
 
15914
+         }
 
15915
+       if (!pat)
 
15916
+         return NULL_RTX;
 
15917
+       emit_insn (pat);
 
15918
+
 
15919
+       *expandedp = true;
 
15920
+       if (nonvoid)
 
15921
+         return target;
 
15922
+       return const0_rtx;
 
15923
+      }
 
15924
+
 
15925
+  return NULL_RTX;
 
15926
+}
 
15927
+
 
15928
+static rtx
 
15929
 rs6000_expand_ternop_builtin (enum insn_code icode, tree exp, rtx target)
 
15930
 {
 
15931
   rtx pat;
 
15932
@@ -10427,7 +12055,28 @@
 
15933
          return const0_rtx;
 
15934
        }
 
15935
     }
 
15936
+  else if (icode == CODE_FOR_crypto_vshasigmaw
 
15937
+          || icode == CODE_FOR_crypto_vshasigmad)
 
15938
+    {
 
15939
+      /* Check whether the 2nd and 3rd arguments are integer constants and in
 
15940
+        range and prepare arguments.  */
 
15941
+      STRIP_NOPS (arg1);
 
15942
+      if (TREE_CODE (arg1) != INTEGER_CST
 
15943
+         || !IN_RANGE (TREE_INT_CST_LOW (arg1), 0, 1))
 
15944
+       {
 
15945
+         error ("argument 2 must be 0 or 1");
 
15946
+         return const0_rtx;
 
15947
+       }
 
15948
 
 
15949
+      STRIP_NOPS (arg2);
 
15950
+      if (TREE_CODE (arg2) != INTEGER_CST
 
15951
+         || !IN_RANGE (TREE_INT_CST_LOW (arg2), 0, 15))
 
15952
+       {
 
15953
+         error ("argument 3 must be in the range 0..15");
 
15954
+         return const0_rtx;
 
15955
+       }
 
15956
+    }
 
15957
+
 
15958
   if (target == 0
 
15959
       || GET_MODE (target) != tmode
 
15960
       || ! (*insn_data[icode].operand[0].predicate) (target, tmode))
 
15961
@@ -11411,6 +13060,8 @@
 
15962
     error ("Builtin function %s is only valid for the cell processor", name);
 
15963
   else if ((fnmask & RS6000_BTM_VSX) != 0)
 
15964
     error ("Builtin function %s requires the -mvsx option", name);
 
15965
+  else if ((fnmask & RS6000_BTM_HTM) != 0)
 
15966
+    error ("Builtin function %s requires the -mhtm option", name);
 
15967
   else if ((fnmask & RS6000_BTM_ALTIVEC) != 0)
 
15968
     error ("Builtin function %s requires the -maltivec option", name);
 
15969
   else if ((fnmask & RS6000_BTM_PAIRED) != 0)
 
15970
@@ -11515,7 +13166,8 @@
 
15971
     case ALTIVEC_BUILTIN_MASK_FOR_LOAD:
 
15972
     case ALTIVEC_BUILTIN_MASK_FOR_STORE:
 
15973
       {
 
15974
-       int icode = (int) CODE_FOR_altivec_lvsr;
 
15975
+       int icode = (BYTES_BIG_ENDIAN ? (int) CODE_FOR_altivec_lvsr
 
15976
+                    : (int) CODE_FOR_altivec_lvsl);
 
15977
        enum machine_mode tmode = insn_data[icode].operand[0].mode;
 
15978
        enum machine_mode mode = insn_data[icode].operand[1].mode;
 
15979
        tree arg;
 
15980
@@ -11590,7 +13242,14 @@
 
15981
       if (success)
 
15982
        return ret;
 
15983
     }  
 
15984
+  if (TARGET_HTM)
 
15985
+    {
 
15986
+      ret = htm_expand_builtin (exp, target, &success);
 
15987
 
 
15988
+      if (success)
 
15989
+       return ret;
 
15990
+    }  
 
15991
+
 
15992
   gcc_assert (TARGET_ALTIVEC || TARGET_VSX || TARGET_SPE || TARGET_PAIRED_FLOAT);
 
15993
 
 
15994
   /* Handle simple unary operations.  */
 
15995
@@ -11772,6 +13431,9 @@
 
15996
     spe_init_builtins ();
 
15997
   if (TARGET_EXTRA_BUILTINS)
 
15998
     altivec_init_builtins ();
 
15999
+  if (TARGET_HTM)
 
16000
+    htm_init_builtins ();
 
16001
+
 
16002
   if (TARGET_EXTRA_BUILTINS || TARGET_SPE || TARGET_PAIRED_FLOAT)
 
16003
     rs6000_common_init_builtins ();
 
16004
 
 
16005
@@ -12117,6 +13779,10 @@
 
16006
     = build_function_type_list (integer_type_node,
 
16007
                                integer_type_node, V4SI_type_node,
 
16008
                                V4SI_type_node, NULL_TREE);
 
16009
+  tree int_ftype_int_v2di_v2di
 
16010
+    = build_function_type_list (integer_type_node,
 
16011
+                               integer_type_node, V2DI_type_node,
 
16012
+                               V2DI_type_node, NULL_TREE);
 
16013
   tree void_ftype_v4si
 
16014
     = build_function_type_list (void_type_node, V4SI_type_node, NULL_TREE);
 
16015
   tree v8hi_ftype_void
 
16016
@@ -12199,6 +13865,8 @@
 
16017
     = build_function_type_list (integer_type_node,
 
16018
                                integer_type_node, V2DF_type_node,
 
16019
                                V2DF_type_node, NULL_TREE);
 
16020
+  tree v2di_ftype_v2di
 
16021
+    = build_function_type_list (V2DI_type_node, V2DI_type_node, NULL_TREE);
 
16022
   tree v4si_ftype_v4si
 
16023
     = build_function_type_list (V4SI_type_node, V4SI_type_node, NULL_TREE);
 
16024
   tree v8hi_ftype_v8hi
 
16025
@@ -12334,6 +14002,9 @@
 
16026
        case VOIDmode:
 
16027
          type = int_ftype_int_opaque_opaque;
 
16028
          break;
 
16029
+       case V2DImode:
 
16030
+         type = int_ftype_int_v2di_v2di;
 
16031
+         break;
 
16032
        case V4SImode:
 
16033
          type = int_ftype_int_v4si_v4si;
 
16034
          break;
 
16035
@@ -12367,6 +14038,9 @@
 
16036
 
 
16037
       switch (mode0)
 
16038
        {
 
16039
+       case V2DImode:
 
16040
+         type = v2di_ftype_v2di;
 
16041
+         break;
 
16042
        case V4SImode:
 
16043
          type = v4si_ftype_v4si;
 
16044
          break;
 
16045
@@ -12499,6 +14173,79 @@
 
16046
   def_builtin ("__builtin_vec_ext_v2di", ftype, VSX_BUILTIN_VEC_EXT_V2DI);
 
16047
 }
 
16048
 
 
16049
+static void
 
16050
+htm_init_builtins (void)
 
16051
+{
 
16052
+  HOST_WIDE_INT builtin_mask = rs6000_builtin_mask;
 
16053
+  const struct builtin_description *d;
 
16054
+  size_t i;
 
16055
+
 
16056
+  d = bdesc_htm;
 
16057
+  for (i = 0; i < ARRAY_SIZE (bdesc_htm); i++, d++)
 
16058
+    {
 
16059
+      tree op[MAX_HTM_OPERANDS], type;
 
16060
+      HOST_WIDE_INT mask = d->mask;
 
16061
+      unsigned attr = rs6000_builtin_info[d->code].attr;
 
16062
+      bool void_func = (attr & RS6000_BTC_VOID);
 
16063
+      int attr_args = (attr & RS6000_BTC_TYPE_MASK);
 
16064
+      int nopnds = 0;
 
16065
+      tree argtype = (attr & RS6000_BTC_SPR) ? long_unsigned_type_node
 
16066
+                                            : unsigned_type_node;
 
16067
+
 
16068
+      if ((mask & builtin_mask) != mask)
 
16069
+       {
 
16070
+         if (TARGET_DEBUG_BUILTIN)
 
16071
+           fprintf (stderr, "htm_builtin, skip binary %s\n", d->name);
 
16072
+         continue;
 
16073
+       }
 
16074
+
 
16075
+      if (d->name == 0)
 
16076
+       {
 
16077
+         if (TARGET_DEBUG_BUILTIN)
 
16078
+           fprintf (stderr, "htm_builtin, bdesc_htm[%ld] no name\n",
 
16079
+                    (long unsigned) i);
 
16080
+         continue;
 
16081
+       }
 
16082
+
 
16083
+      op[nopnds++] = (void_func) ? void_type_node : argtype;
 
16084
+
 
16085
+      if (attr_args == RS6000_BTC_UNARY)
 
16086
+       op[nopnds++] = argtype;
 
16087
+      else if (attr_args == RS6000_BTC_BINARY)
 
16088
+       {
 
16089
+         op[nopnds++] = argtype;
 
16090
+         op[nopnds++] = argtype;
 
16091
+       }
 
16092
+      else if (attr_args == RS6000_BTC_TERNARY)
 
16093
+       {
 
16094
+         op[nopnds++] = argtype;
 
16095
+         op[nopnds++] = argtype;
 
16096
+         op[nopnds++] = argtype;
 
16097
+       }
 
16098
+
 
16099
+      switch (nopnds)
 
16100
+       {
 
16101
+       case 1:
 
16102
+         type = build_function_type_list (op[0], NULL_TREE);
 
16103
+         break;
 
16104
+       case 2:
 
16105
+         type = build_function_type_list (op[0], op[1], NULL_TREE);
 
16106
+         break;
 
16107
+       case 3:
 
16108
+         type = build_function_type_list (op[0], op[1], op[2], NULL_TREE);
 
16109
+         break;
 
16110
+       case 4:
 
16111
+         type = build_function_type_list (op[0], op[1], op[2], op[3],
 
16112
+                                          NULL_TREE);
 
16113
+         break;
 
16114
+       default:
 
16115
+         gcc_unreachable ();
 
16116
+       }
 
16117
+
 
16118
+      def_builtin (d->name, type, d->code);
 
16119
+    }
 
16120
+}
 
16121
+
 
16122
 /* Hash function for builtin functions with up to 3 arguments and a return
 
16123
    type.  */
 
16124
 static unsigned
 
16125
@@ -12572,11 +14319,27 @@
 
16126
      are type correct.  */
 
16127
   switch (builtin)
 
16128
     {
 
16129
+      /* unsigned 1 argument functions.  */
 
16130
+    case CRYPTO_BUILTIN_VSBOX:
 
16131
+    case P8V_BUILTIN_VGBBD:
 
16132
+      h.uns_p[0] = 1;
 
16133
+      h.uns_p[1] = 1;
 
16134
+      break;
 
16135
+
 
16136
       /* unsigned 2 argument functions.  */
 
16137
     case ALTIVEC_BUILTIN_VMULEUB_UNS:
 
16138
     case ALTIVEC_BUILTIN_VMULEUH_UNS:
 
16139
     case ALTIVEC_BUILTIN_VMULOUB_UNS:
 
16140
     case ALTIVEC_BUILTIN_VMULOUH_UNS:
 
16141
+    case CRYPTO_BUILTIN_VCIPHER:
 
16142
+    case CRYPTO_BUILTIN_VCIPHERLAST:
 
16143
+    case CRYPTO_BUILTIN_VNCIPHER:
 
16144
+    case CRYPTO_BUILTIN_VNCIPHERLAST:
 
16145
+    case CRYPTO_BUILTIN_VPMSUMB:
 
16146
+    case CRYPTO_BUILTIN_VPMSUMH:
 
16147
+    case CRYPTO_BUILTIN_VPMSUMW:
 
16148
+    case CRYPTO_BUILTIN_VPMSUMD:
 
16149
+    case CRYPTO_BUILTIN_VPMSUM:
 
16150
       h.uns_p[0] = 1;
 
16151
       h.uns_p[1] = 1;
 
16152
       h.uns_p[2] = 1;
 
16153
@@ -12599,6 +14362,14 @@
 
16154
     case VSX_BUILTIN_XXSEL_8HI_UNS:
 
16155
     case VSX_BUILTIN_XXSEL_4SI_UNS:
 
16156
     case VSX_BUILTIN_XXSEL_2DI_UNS:
 
16157
+    case CRYPTO_BUILTIN_VPERMXOR:
 
16158
+    case CRYPTO_BUILTIN_VPERMXOR_V2DI:
 
16159
+    case CRYPTO_BUILTIN_VPERMXOR_V4SI:
 
16160
+    case CRYPTO_BUILTIN_VPERMXOR_V8HI:
 
16161
+    case CRYPTO_BUILTIN_VPERMXOR_V16QI:
 
16162
+    case CRYPTO_BUILTIN_VSHASIGMAW:
 
16163
+    case CRYPTO_BUILTIN_VSHASIGMAD:
 
16164
+    case CRYPTO_BUILTIN_VSHASIGMA:
 
16165
       h.uns_p[0] = 1;
 
16166
       h.uns_p[1] = 1;
 
16167
       h.uns_p[2] = 1;
 
16168
@@ -12740,9 +14511,24 @@
 
16169
       else
 
16170
        {
 
16171
          enum insn_code icode = d->icode;
 
16172
-          if (d->name == 0 || icode == CODE_FOR_nothing)
 
16173
-           continue;
 
16174
+         if (d->name == 0)
 
16175
+           {
 
16176
+             if (TARGET_DEBUG_BUILTIN)
 
16177
+               fprintf (stderr, "rs6000_builtin, bdesc_3arg[%ld] no name\n",
 
16178
+                        (long unsigned)i);
 
16179
 
 
16180
+             continue;
 
16181
+           }
 
16182
+
 
16183
+          if (icode == CODE_FOR_nothing)
 
16184
+           {
 
16185
+             if (TARGET_DEBUG_BUILTIN)
 
16186
+               fprintf (stderr, "rs6000_builtin, skip ternary %s (no code)\n",
 
16187
+                        d->name);
 
16188
+
 
16189
+             continue;
 
16190
+           }
 
16191
+
 
16192
          type = builtin_function_type (insn_data[icode].operand[0].mode,
 
16193
                                        insn_data[icode].operand[1].mode,
 
16194
                                        insn_data[icode].operand[2].mode,
 
16195
@@ -12780,9 +14566,24 @@
 
16196
       else
 
16197
        {
 
16198
          enum insn_code icode = d->icode;
 
16199
-          if (d->name == 0 || icode == CODE_FOR_nothing)
 
16200
-           continue;
 
16201
+         if (d->name == 0)
 
16202
+           {
 
16203
+             if (TARGET_DEBUG_BUILTIN)
 
16204
+               fprintf (stderr, "rs6000_builtin, bdesc_2arg[%ld] no name\n",
 
16205
+                        (long unsigned)i);
 
16206
 
 
16207
+             continue;
 
16208
+           }
 
16209
+
 
16210
+          if (icode == CODE_FOR_nothing)
 
16211
+           {
 
16212
+             if (TARGET_DEBUG_BUILTIN)
 
16213
+               fprintf (stderr, "rs6000_builtin, skip binary %s (no code)\n",
 
16214
+                        d->name);
 
16215
+
 
16216
+             continue;
 
16217
+           }
 
16218
+
 
16219
           mode0 = insn_data[icode].operand[0].mode;
 
16220
           mode1 = insn_data[icode].operand[1].mode;
 
16221
           mode2 = insn_data[icode].operand[2].mode;
 
16222
@@ -12842,9 +14643,24 @@
 
16223
       else
 
16224
         {
 
16225
          enum insn_code icode = d->icode;
 
16226
-          if (d->name == 0 || icode == CODE_FOR_nothing)
 
16227
-           continue;
 
16228
+         if (d->name == 0)
 
16229
+           {
 
16230
+             if (TARGET_DEBUG_BUILTIN)
 
16231
+               fprintf (stderr, "rs6000_builtin, bdesc_1arg[%ld] no name\n",
 
16232
+                        (long unsigned)i);
 
16233
 
 
16234
+             continue;
 
16235
+           }
 
16236
+
 
16237
+          if (icode == CODE_FOR_nothing)
 
16238
+           {
 
16239
+             if (TARGET_DEBUG_BUILTIN)
 
16240
+               fprintf (stderr, "rs6000_builtin, skip unary %s (no code)\n",
 
16241
+                        d->name);
 
16242
+
 
16243
+             continue;
 
16244
+           }
 
16245
+
 
16246
           mode0 = insn_data[icode].operand[0].mode;
 
16247
           mode1 = insn_data[icode].operand[1].mode;
 
16248
 
 
16249
@@ -13631,7 +15447,7 @@
 
16250
   static bool eliminated = false;
 
16251
   rtx ret;
 
16252
 
 
16253
-  if (mode != SDmode)
 
16254
+  if (mode != SDmode || TARGET_NO_SDMODE_STACK)
 
16255
     ret = assign_stack_local (mode, GET_MODE_SIZE (mode), 0);
 
16256
   else
 
16257
     {
 
16258
@@ -13690,31 +15506,228 @@
 
16259
   return NULL_TREE;
 
16260
 }
 
16261
 
 
16262
-enum reload_reg_type {
 
16263
-  GPR_REGISTER_TYPE,
 
16264
-  VECTOR_REGISTER_TYPE,
 
16265
-  OTHER_REGISTER_TYPE
 
16266
-};
 
16267
+/* Classify a register type.  Because the FMRGOW/FMRGEW instructions only work
 
16268
+   on traditional floating point registers, and the VMRGOW/VMRGEW instructions
 
16269
+   only work on the traditional altivec registers, note if an altivec register
 
16270
+   was chosen.  */
 
16271
 
 
16272
-static enum reload_reg_type
 
16273
-rs6000_reload_register_type (enum reg_class rclass)
 
16274
+static enum rs6000_reg_type
 
16275
+register_to_reg_type (rtx reg, bool *is_altivec)
 
16276
 {
 
16277
-  switch (rclass)
 
16278
+  HOST_WIDE_INT regno;
 
16279
+  enum reg_class rclass;
 
16280
+
 
16281
+  if (GET_CODE (reg) == SUBREG)
 
16282
+    reg = SUBREG_REG (reg);
 
16283
+
 
16284
+  if (!REG_P (reg))
 
16285
+    return NO_REG_TYPE;
 
16286
+
 
16287
+  regno = REGNO (reg);
 
16288
+  if (regno >= FIRST_PSEUDO_REGISTER)
 
16289
     {
 
16290
-    case GENERAL_REGS:
 
16291
-    case BASE_REGS:
 
16292
-      return GPR_REGISTER_TYPE;
 
16293
+      if (!lra_in_progress && !reload_in_progress && !reload_completed)
 
16294
+       return PSEUDO_REG_TYPE;
 
16295
 
 
16296
-    case FLOAT_REGS:
 
16297
-    case ALTIVEC_REGS:
 
16298
-    case VSX_REGS:
 
16299
-      return VECTOR_REGISTER_TYPE;
 
16300
+      regno = true_regnum (reg);
 
16301
+      if (regno < 0 || regno >= FIRST_PSEUDO_REGISTER)
 
16302
+       return PSEUDO_REG_TYPE;
 
16303
+    }  
 
16304
 
 
16305
-    default:
 
16306
-      return OTHER_REGISTER_TYPE;
 
16307
+  gcc_assert (regno >= 0);
 
16308
+
 
16309
+  if (is_altivec && ALTIVEC_REGNO_P (regno))
 
16310
+    *is_altivec = true;
 
16311
+
 
16312
+  rclass = rs6000_regno_regclass[regno];
 
16313
+  return reg_class_to_reg_type[(int)rclass];
 
16314
+}
 
16315
+
 
16316
+/* Helper function for rs6000_secondary_reload to return true if a move to a
 
16317
+   different register classe is really a simple move.  */
 
16318
+
 
16319
+static bool
 
16320
+rs6000_secondary_reload_simple_move (enum rs6000_reg_type to_type,
 
16321
+                                    enum rs6000_reg_type from_type,
 
16322
+                                    enum machine_mode mode)
 
16323
+{
 
16324
+  int size;
 
16325
+
 
16326
+  /* Add support for various direct moves available.  In this function, we only
 
16327
+     look at cases where we don't need any extra registers, and one or more
 
16328
+     simple move insns are issued.  At present, 32-bit integers are not allowed
 
16329
+     in FPR/VSX registers.  Single precision binary floating is not a simple
 
16330
+     move because we need to convert to the single precision memory layout.
 
16331
+     The 4-byte SDmode can be moved.  */
 
16332
+  size = GET_MODE_SIZE (mode);
 
16333
+  if (TARGET_DIRECT_MOVE
 
16334
+      && ((mode == SDmode) || (TARGET_POWERPC64 && size == 8))
 
16335
+      && ((to_type == GPR_REG_TYPE && from_type == VSX_REG_TYPE)
 
16336
+         || (to_type == VSX_REG_TYPE && from_type == GPR_REG_TYPE)))
 
16337
+    return true;
 
16338
+
 
16339
+  else if (TARGET_MFPGPR && TARGET_POWERPC64 && size == 8
 
16340
+          && ((to_type == GPR_REG_TYPE && from_type == FPR_REG_TYPE)
 
16341
+              || (to_type == FPR_REG_TYPE && from_type == GPR_REG_TYPE)))
 
16342
+    return true;
 
16343
+
 
16344
+  else if ((size == 4 || (TARGET_POWERPC64 && size == 8))
 
16345
+          && ((to_type == GPR_REG_TYPE && from_type == SPR_REG_TYPE)
 
16346
+              || (to_type == SPR_REG_TYPE && from_type == GPR_REG_TYPE)))
 
16347
+    return true;
 
16348
+
 
16349
+  return false;
 
16350
+}
 
16351
+
 
16352
+/* Power8 helper function for rs6000_secondary_reload, handle all of the
 
16353
+   special direct moves that involve allocating an extra register, return the
 
16354
+   insn code of the helper function if there is such a function or
 
16355
+   CODE_FOR_nothing if not.  */
 
16356
+
 
16357
+static bool
 
16358
+rs6000_secondary_reload_direct_move (enum rs6000_reg_type to_type,
 
16359
+                                    enum rs6000_reg_type from_type,
 
16360
+                                    enum machine_mode mode,
 
16361
+                                    secondary_reload_info *sri,
 
16362
+                                    bool altivec_p)
 
16363
+{
 
16364
+  bool ret = false;
 
16365
+  enum insn_code icode = CODE_FOR_nothing;
 
16366
+  int cost = 0;
 
16367
+  int size = GET_MODE_SIZE (mode);
 
16368
+
 
16369
+  if (TARGET_POWERPC64)
 
16370
+    {
 
16371
+      if (size == 16)
 
16372
+       {
 
16373
+         /* Handle moving 128-bit values from GPRs to VSX point registers on
 
16374
+            power8 when running in 64-bit mode using XXPERMDI to glue the two
 
16375
+            64-bit values back together.  */
 
16376
+         if (to_type == VSX_REG_TYPE && from_type == GPR_REG_TYPE)
 
16377
+           {
 
16378
+             cost = 3;                 /* 2 mtvsrd's, 1 xxpermdi.  */
 
16379
+             icode = reg_addr[mode].reload_vsx_gpr;
 
16380
+           }
 
16381
+
 
16382
+         /* Handle moving 128-bit values from VSX point registers to GPRs on
 
16383
+            power8 when running in 64-bit mode using XXPERMDI to get access to the
 
16384
+            bottom 64-bit value.  */
 
16385
+         else if (to_type == GPR_REG_TYPE && from_type == VSX_REG_TYPE)
 
16386
+           {
 
16387
+             cost = 3;                 /* 2 mfvsrd's, 1 xxpermdi.  */
 
16388
+             icode = reg_addr[mode].reload_gpr_vsx;
 
16389
+           }
 
16390
+       }
 
16391
+
 
16392
+      else if (mode == SFmode)
 
16393
+       {
 
16394
+         if (to_type == GPR_REG_TYPE && from_type == VSX_REG_TYPE)
 
16395
+           {
 
16396
+             cost = 3;                 /* xscvdpspn, mfvsrd, and.  */
 
16397
+             icode = reg_addr[mode].reload_gpr_vsx;
 
16398
+           }
 
16399
+
 
16400
+         else if (to_type == VSX_REG_TYPE && from_type == GPR_REG_TYPE)
 
16401
+           {
 
16402
+             cost = 2;                 /* mtvsrz, xscvspdpn.  */
 
16403
+             icode = reg_addr[mode].reload_vsx_gpr;
 
16404
+           }
 
16405
+       }
 
16406
     }
 
16407
+
 
16408
+  if (TARGET_POWERPC64 && size == 16)
 
16409
+    {
 
16410
+      /* Handle moving 128-bit values from GPRs to VSX point registers on
 
16411
+        power8 when running in 64-bit mode using XXPERMDI to glue the two
 
16412
+        64-bit values back together.  */
 
16413
+      if (to_type == VSX_REG_TYPE && from_type == GPR_REG_TYPE)
 
16414
+       {
 
16415
+         cost = 3;                     /* 2 mtvsrd's, 1 xxpermdi.  */
 
16416
+         icode = reg_addr[mode].reload_vsx_gpr;
 
16417
+       }
 
16418
+
 
16419
+      /* Handle moving 128-bit values from VSX point registers to GPRs on
 
16420
+        power8 when running in 64-bit mode using XXPERMDI to get access to the
 
16421
+        bottom 64-bit value.  */
 
16422
+      else if (to_type == GPR_REG_TYPE && from_type == VSX_REG_TYPE)
 
16423
+       {
 
16424
+         cost = 3;                     /* 2 mfvsrd's, 1 xxpermdi.  */
 
16425
+         icode = reg_addr[mode].reload_gpr_vsx;
 
16426
+       }
 
16427
+    }
 
16428
+
 
16429
+  else if (!TARGET_POWERPC64 && size == 8)
 
16430
+    {
 
16431
+      /* Handle moving 64-bit values from GPRs to floating point registers on
 
16432
+        power8 when running in 32-bit mode using FMRGOW to glue the two 32-bit
 
16433
+        values back together.  Altivec register classes must be handled
 
16434
+        specially since a different instruction is used, and the secondary
 
16435
+        reload support requires a single instruction class in the scratch
 
16436
+        register constraint.  However, right now TFmode is not allowed in
 
16437
+        Altivec registers, so the pattern will never match.  */
 
16438
+      if (to_type == VSX_REG_TYPE && from_type == GPR_REG_TYPE && !altivec_p)
 
16439
+       {
 
16440
+         cost = 3;                     /* 2 mtvsrwz's, 1 fmrgow.  */
 
16441
+         icode = reg_addr[mode].reload_fpr_gpr;
 
16442
+       }
 
16443
+    }
 
16444
+
 
16445
+  if (icode != CODE_FOR_nothing)
 
16446
+    {
 
16447
+      ret = true;
 
16448
+      if (sri)
 
16449
+       {
 
16450
+         sri->icode = icode;
 
16451
+         sri->extra_cost = cost;
 
16452
+       }
 
16453
+    }
 
16454
+
 
16455
+  return ret;
 
16456
 }
 
16457
 
 
16458
+/* Return whether a move between two register classes can be done either
 
16459
+   directly (simple move) or via a pattern that uses a single extra temporary
 
16460
+   (using power8's direct move in this case.  */
 
16461
+
 
16462
+static bool
 
16463
+rs6000_secondary_reload_move (enum rs6000_reg_type to_type,
 
16464
+                             enum rs6000_reg_type from_type,
 
16465
+                             enum machine_mode mode,
 
16466
+                             secondary_reload_info *sri,
 
16467
+                             bool altivec_p)
 
16468
+{
 
16469
+  /* Fall back to load/store reloads if either type is not a register.  */
 
16470
+  if (to_type == NO_REG_TYPE || from_type == NO_REG_TYPE)
 
16471
+    return false;
 
16472
+
 
16473
+  /* If we haven't allocated registers yet, assume the move can be done for the
 
16474
+     standard register types.  */
 
16475
+  if ((to_type == PSEUDO_REG_TYPE && from_type == PSEUDO_REG_TYPE)
 
16476
+      || (to_type == PSEUDO_REG_TYPE && IS_STD_REG_TYPE (from_type))
 
16477
+      || (from_type == PSEUDO_REG_TYPE && IS_STD_REG_TYPE (to_type)))
 
16478
+    return true;
 
16479
+
 
16480
+  /* Moves to the same set of registers is a simple move for non-specialized
 
16481
+     registers.  */
 
16482
+  if (to_type == from_type && IS_STD_REG_TYPE (to_type))
 
16483
+    return true;
 
16484
+
 
16485
+  /* Check whether a simple move can be done directly.  */
 
16486
+  if (rs6000_secondary_reload_simple_move (to_type, from_type, mode))
 
16487
+    {
 
16488
+      if (sri)
 
16489
+       {
 
16490
+         sri->icode = CODE_FOR_nothing;
 
16491
+         sri->extra_cost = 0;
 
16492
+       }
 
16493
+      return true;
 
16494
+    }
 
16495
+
 
16496
+  /* Now check if we can do it in a few steps.  */
 
16497
+  return rs6000_secondary_reload_direct_move (to_type, from_type, mode, sri,
 
16498
+                                             altivec_p);
 
16499
+}
 
16500
+
 
16501
 /* Inform reload about cases where moving X with a mode MODE to a register in
 
16502
    RCLASS requires an extra scratch or immediate register.  Return the class
 
16503
    needed for the immediate register.
 
16504
@@ -13738,12 +15751,36 @@
 
16505
   bool default_p = false;
 
16506
 
 
16507
   sri->icode = CODE_FOR_nothing;
 
16508
+  icode = ((in_p)
 
16509
+          ? reg_addr[mode].reload_load
 
16510
+          : reg_addr[mode].reload_store);
 
16511
 
 
16512
-  /* Convert vector loads and stores into gprs to use an additional base
 
16513
-     register.  */
 
16514
-  icode = rs6000_vector_reload[mode][in_p != false];
 
16515
-  if (icode != CODE_FOR_nothing)
 
16516
+  if (REG_P (x) || register_operand (x, mode))
 
16517
     {
 
16518
+      enum rs6000_reg_type to_type = reg_class_to_reg_type[(int)rclass];
 
16519
+      bool altivec_p = (rclass == ALTIVEC_REGS);
 
16520
+      enum rs6000_reg_type from_type = register_to_reg_type (x, &altivec_p);
 
16521
+
 
16522
+      if (!in_p)
 
16523
+       {
 
16524
+         enum rs6000_reg_type exchange = to_type;
 
16525
+         to_type = from_type;
 
16526
+         from_type = exchange;
 
16527
+       }
 
16528
+
 
16529
+      /* Can we do a direct move of some sort?  */
 
16530
+      if (rs6000_secondary_reload_move (to_type, from_type, mode, sri,
 
16531
+                                       altivec_p))
 
16532
+       {
 
16533
+         icode = (enum insn_code)sri->icode;
 
16534
+         default_p = false;
 
16535
+         ret = NO_REGS;
 
16536
+       }
 
16537
+    }
 
16538
+
 
16539
+  /* Handle vector moves with reload helper functions.  */
 
16540
+  if (ret == ALL_REGS && icode != CODE_FOR_nothing)
 
16541
+    {
 
16542
       ret = NO_REGS;
 
16543
       sri->icode = CODE_FOR_nothing;
 
16544
       sri->extra_cost = 0;
 
16545
@@ -13754,22 +15791,43 @@
 
16546
 
 
16547
          /* Loads to and stores from gprs can do reg+offset, and wouldn't need
 
16548
             an extra register in that case, but it would need an extra
 
16549
-            register if the addressing is reg+reg or (reg+reg)&(-16).  */
 
16550
+            register if the addressing is reg+reg or (reg+reg)&(-16).  Special
 
16551
+            case load/store quad.  */
 
16552
          if (rclass == GENERAL_REGS || rclass == BASE_REGS)
 
16553
            {
 
16554
-             if (!legitimate_indirect_address_p (addr, false)
 
16555
-                 && !rs6000_legitimate_offset_address_p (TImode, addr,
 
16556
-                                                         false, true))
 
16557
+             if (TARGET_POWERPC64 && TARGET_QUAD_MEMORY
 
16558
+                 && GET_MODE_SIZE (mode) == 16
 
16559
+                 && quad_memory_operand (x, mode))
 
16560
                {
 
16561
                  sri->icode = icode;
 
16562
+                 sri->extra_cost = 2;
 
16563
+               }
 
16564
+
 
16565
+             else if (!legitimate_indirect_address_p (addr, false)
 
16566
+                      && !rs6000_legitimate_offset_address_p (PTImode, addr,
 
16567
+                                                              false, true))
 
16568
+               {
 
16569
+                 sri->icode = icode;
 
16570
                  /* account for splitting the loads, and converting the
 
16571
                     address from reg+reg to reg.  */
 
16572
                  sri->extra_cost = (((TARGET_64BIT) ? 3 : 5)
 
16573
                                     + ((GET_CODE (addr) == AND) ? 1 : 0));
 
16574
                }
 
16575
            }
 
16576
-         /* Loads to and stores from vector registers can only do reg+reg
 
16577
-            addressing.  Altivec registers can also do (reg+reg)&(-16).  */
 
16578
+         /* Allow scalar loads to/from the traditional floating point
 
16579
+            registers, even if VSX memory is set.  */
 
16580
+         else if ((rclass == FLOAT_REGS || rclass == NO_REGS)
 
16581
+                  && (GET_MODE_SIZE (mode) == 4 || GET_MODE_SIZE (mode) == 8)
 
16582
+                  && (legitimate_indirect_address_p (addr, false)
 
16583
+                      || legitimate_indirect_address_p (addr, false)
 
16584
+                      || rs6000_legitimate_offset_address_p (mode, addr,
 
16585
+                                                             false, true)))
 
16586
+
 
16587
+           ;
 
16588
+         /* Loads to and stores from vector registers can only do reg+reg
 
16589
+            addressing.  Altivec registers can also do (reg+reg)&(-16).  Allow
 
16590
+            scalar modes loading up the traditional floating point registers
 
16591
+            to use offset addresses.  */
 
16592
          else if (rclass == VSX_REGS || rclass == ALTIVEC_REGS
 
16593
                   || rclass == FLOAT_REGS || rclass == NO_REGS)
 
16594
            {
 
16595
@@ -13813,12 +15871,12 @@
 
16596
          else
 
16597
            {
 
16598
              enum reg_class xclass = REGNO_REG_CLASS (regno);
 
16599
-             enum reload_reg_type rtype1 = rs6000_reload_register_type (rclass);
 
16600
-             enum reload_reg_type rtype2 = rs6000_reload_register_type (xclass);
 
16601
+             enum rs6000_reg_type rtype1 = reg_class_to_reg_type[(int)rclass];
 
16602
+             enum rs6000_reg_type rtype2 = reg_class_to_reg_type[(int)xclass];
 
16603
 
 
16604
              /* If memory is needed, use default_secondary_reload to create the
 
16605
                 stack slot.  */
 
16606
-             if (rtype1 != rtype2 || rtype1 == OTHER_REGISTER_TYPE)
 
16607
+             if (rtype1 != rtype2 || !IS_STD_REG_TYPE (rtype1))
 
16608
                default_p = true;
 
16609
              else
 
16610
                ret = NO_REGS;
 
16611
@@ -13828,7 +15886,7 @@
 
16612
        default_p = true;
 
16613
     }
 
16614
   else if (TARGET_POWERPC64
 
16615
-          && rs6000_reload_register_type (rclass) == GPR_REGISTER_TYPE
 
16616
+          && reg_class_to_reg_type[(int)rclass] == GPR_REG_TYPE
 
16617
           && MEM_P (x)
 
16618
           && GET_MODE_SIZE (GET_MODE (x)) >= UNITS_PER_WORD)
 
16619
     {
 
16620
@@ -13867,7 +15925,7 @@
 
16621
        default_p = true;
 
16622
     }
 
16623
   else if (!TARGET_POWERPC64
 
16624
-          && rs6000_reload_register_type (rclass) == GPR_REGISTER_TYPE
 
16625
+          && reg_class_to_reg_type[(int)rclass] == GPR_REG_TYPE
 
16626
           && MEM_P (x)
 
16627
           && GET_MODE_SIZE (GET_MODE (x)) > UNITS_PER_WORD)
 
16628
     {
 
16629
@@ -13945,6 +16003,36 @@
 
16630
   return ret;
 
16631
 }
 
16632
 
 
16633
+/* Better tracing for rs6000_secondary_reload_inner.  */
 
16634
+
 
16635
+static void
 
16636
+rs6000_secondary_reload_trace (int line, rtx reg, rtx mem, rtx scratch,
 
16637
+                              bool store_p)
 
16638
+{
 
16639
+  rtx set, clobber;
 
16640
+
 
16641
+  gcc_assert (reg != NULL_RTX && mem != NULL_RTX && scratch != NULL_RTX);
 
16642
+
 
16643
+  fprintf (stderr, "rs6000_secondary_reload_inner:%d, type = %s\n", line,
 
16644
+          store_p ? "store" : "load");
 
16645
+
 
16646
+  if (store_p)
 
16647
+    set = gen_rtx_SET (VOIDmode, mem, reg);
 
16648
+  else
 
16649
+    set = gen_rtx_SET (VOIDmode, reg, mem);
 
16650
+
 
16651
+  clobber = gen_rtx_CLOBBER (VOIDmode, scratch);
 
16652
+  debug_rtx (gen_rtx_PARALLEL (VOIDmode, gen_rtvec (2, set, clobber)));
 
16653
+}
 
16654
+
 
16655
+static void
 
16656
+rs6000_secondary_reload_fail (int line, rtx reg, rtx mem, rtx scratch,
 
16657
+                             bool store_p)
 
16658
+{
 
16659
+  rs6000_secondary_reload_trace (line, reg, mem, scratch, store_p);
 
16660
+  gcc_unreachable ();
 
16661
+}
 
16662
+
 
16663
 /* Fixup reload addresses for Altivec or VSX loads/stores to change SP+offset
 
16664
    to SP+reg addressing.  */
 
16665
 
 
16666
@@ -13963,19 +16051,14 @@
 
16667
   rtx cc_clobber;
 
16668
 
 
16669
   if (TARGET_DEBUG_ADDR)
 
16670
-    {
 
16671
-      fprintf (stderr, "\nrs6000_secondary_reload_inner, type = %s\n",
 
16672
-              store_p ? "store" : "load");
 
16673
-      fprintf (stderr, "reg:\n");
 
16674
-      debug_rtx (reg);
 
16675
-      fprintf (stderr, "mem:\n");
 
16676
-      debug_rtx (mem);
 
16677
-      fprintf (stderr, "scratch:\n");
 
16678
-      debug_rtx (scratch);
 
16679
-    }
 
16680
+    rs6000_secondary_reload_trace (__LINE__, reg, mem, scratch, store_p);
 
16681
 
 
16682
-  gcc_assert (regno >= 0 && regno < FIRST_PSEUDO_REGISTER);
 
16683
-  gcc_assert (GET_CODE (mem) == MEM);
 
16684
+  if (regno < 0 || regno >= FIRST_PSEUDO_REGISTER)
 
16685
+    rs6000_secondary_reload_fail (__LINE__, reg, mem, scratch, store_p);
 
16686
+
 
16687
+  if (GET_CODE (mem) != MEM)
 
16688
+    rs6000_secondary_reload_fail (__LINE__, reg, mem, scratch, store_p);
 
16689
+
 
16690
   rclass = REGNO_REG_CLASS (regno);
 
16691
   addr = XEXP (mem, 0);
 
16692
 
 
16693
@@ -13994,19 +16077,24 @@
 
16694
       if (GET_CODE (addr) == PRE_MODIFY)
 
16695
        {
 
16696
          scratch_or_premodify = XEXP (addr, 0);
 
16697
-         gcc_assert (REG_P (scratch_or_premodify));
 
16698
-         gcc_assert (GET_CODE (XEXP (addr, 1)) == PLUS);
 
16699
+         if (!REG_P (scratch_or_premodify))
 
16700
+           rs6000_secondary_reload_fail (__LINE__, reg, mem, scratch, store_p);
 
16701
+
 
16702
+         if (GET_CODE (XEXP (addr, 1)) != PLUS)
 
16703
+           rs6000_secondary_reload_fail (__LINE__, reg, mem, scratch, store_p);
 
16704
+
 
16705
          addr = XEXP (addr, 1);
 
16706
        }
 
16707
 
 
16708
       if (GET_CODE (addr) == PLUS
 
16709
          && (and_op2 != NULL_RTX
 
16710
-             || !rs6000_legitimate_offset_address_p (TImode, addr,
 
16711
+             || !rs6000_legitimate_offset_address_p (PTImode, addr,
 
16712
                                                      false, true)))
 
16713
        {
 
16714
          addr_op1 = XEXP (addr, 0);
 
16715
          addr_op2 = XEXP (addr, 1);
 
16716
-         gcc_assert (legitimate_indirect_address_p (addr_op1, false));
 
16717
+         if (!legitimate_indirect_address_p (addr_op1, false))
 
16718
+           rs6000_secondary_reload_fail (__LINE__, reg, mem, scratch, store_p);
 
16719
 
 
16720
          if (!REG_P (addr_op2)
 
16721
              && (GET_CODE (addr_op2) != CONST_INT
 
16722
@@ -14034,7 +16122,7 @@
 
16723
          scratch_or_premodify = scratch;
 
16724
        }
 
16725
       else if (!legitimate_indirect_address_p (addr, false)
 
16726
-              && !rs6000_legitimate_offset_address_p (TImode, addr,
 
16727
+              && !rs6000_legitimate_offset_address_p (PTImode, addr,
 
16728
                                                       false, true))
 
16729
        {
 
16730
          if (TARGET_DEBUG_ADDR)
 
16731
@@ -14050,9 +16138,21 @@
 
16732
        }
 
16733
       break;
 
16734
 
 
16735
-      /* Float/Altivec registers can only handle reg+reg addressing.  Move
 
16736
-        other addresses into a scratch register.  */
 
16737
+      /* Float registers can do offset+reg addressing for scalar types.  */
 
16738
     case FLOAT_REGS:
 
16739
+      if (legitimate_indirect_address_p (addr, false)  /* reg */
 
16740
+         || legitimate_indexed_address_p (addr, false) /* reg+reg */
 
16741
+         || ((GET_MODE_SIZE (mode) == 4 || GET_MODE_SIZE (mode) == 8)
 
16742
+             && and_op2 == NULL_RTX
 
16743
+             && scratch_or_premodify == scratch
 
16744
+             && rs6000_legitimate_offset_address_p (mode, addr, false, false)))
 
16745
+       break;
 
16746
+
 
16747
+      /* If this isn't a legacy floating point load/store, fall through to the
 
16748
+        VSX defaults.  */
 
16749
+
 
16750
+      /* VSX/Altivec registers can only handle reg+reg addressing.  Move other
 
16751
+        addresses into a scratch register.  */
 
16752
     case VSX_REGS:
 
16753
     case ALTIVEC_REGS:
 
16754
 
 
16755
@@ -14072,36 +16172,38 @@
 
16756
       /* If we aren't using a VSX load, save the PRE_MODIFY register and use it
 
16757
         as the address later.  */
 
16758
       if (GET_CODE (addr) == PRE_MODIFY
 
16759
-         && (!VECTOR_MEM_VSX_P (mode)
 
16760
+         && ((ALTIVEC_OR_VSX_VECTOR_MODE (mode)
 
16761
+              && (rclass != FLOAT_REGS
 
16762
+                  || (GET_MODE_SIZE (mode) != 4 && GET_MODE_SIZE (mode) != 8)))
 
16763
              || and_op2 != NULL_RTX
 
16764
              || !legitimate_indexed_address_p (XEXP (addr, 1), false)))
 
16765
        {
 
16766
          scratch_or_premodify = XEXP (addr, 0);
 
16767
-         gcc_assert (legitimate_indirect_address_p (scratch_or_premodify,
 
16768
-                                                    false));
 
16769
-         gcc_assert (GET_CODE (XEXP (addr, 1)) == PLUS);
 
16770
+         if (!legitimate_indirect_address_p (scratch_or_premodify, false))
 
16771
+           rs6000_secondary_reload_fail (__LINE__, reg, mem, scratch, store_p);
 
16772
+
 
16773
+         if (GET_CODE (XEXP (addr, 1)) != PLUS)
 
16774
+           rs6000_secondary_reload_fail (__LINE__, reg, mem, scratch, store_p);
 
16775
+
 
16776
          addr = XEXP (addr, 1);
 
16777
        }
 
16778
 
 
16779
       if (legitimate_indirect_address_p (addr, false)  /* reg */
 
16780
          || legitimate_indexed_address_p (addr, false) /* reg+reg */
 
16781
-         || GET_CODE (addr) == PRE_MODIFY              /* VSX pre-modify */
 
16782
          || (GET_CODE (addr) == AND                    /* Altivec memory */
 
16783
+             && rclass == ALTIVEC_REGS
 
16784
              && GET_CODE (XEXP (addr, 1)) == CONST_INT
 
16785
              && INTVAL (XEXP (addr, 1)) == -16
 
16786
-             && VECTOR_MEM_ALTIVEC_P (mode))
 
16787
-         || (rclass == FLOAT_REGS                      /* legacy float mem */
 
16788
-             && GET_MODE_SIZE (mode) == 8
 
16789
-             && and_op2 == NULL_RTX
 
16790
-             && scratch_or_premodify == scratch
 
16791
-             && rs6000_legitimate_offset_address_p (mode, addr, false, false)))
 
16792
+             && (legitimate_indirect_address_p (XEXP (addr, 0), false)
 
16793
+                 || legitimate_indexed_address_p (XEXP (addr, 0), false))))
 
16794
        ;
 
16795
 
 
16796
       else if (GET_CODE (addr) == PLUS)
 
16797
        {
 
16798
          addr_op1 = XEXP (addr, 0);
 
16799
          addr_op2 = XEXP (addr, 1);
 
16800
-         gcc_assert (REG_P (addr_op1));
 
16801
+         if (!REG_P (addr_op1))
 
16802
+           rs6000_secondary_reload_fail (__LINE__, reg, mem, scratch, store_p);
 
16803
 
 
16804
          if (TARGET_DEBUG_ADDR)
 
16805
            {
 
16806
@@ -14120,7 +16222,8 @@
 
16807
        }
 
16808
 
 
16809
       else if (GET_CODE (addr) == SYMBOL_REF || GET_CODE (addr) == CONST
 
16810
-              || GET_CODE (addr) == CONST_INT || REG_P (addr))
 
16811
+              || GET_CODE (addr) == CONST_INT || GET_CODE (addr) == LO_SUM
 
16812
+              || REG_P (addr))
 
16813
        {
 
16814
          if (TARGET_DEBUG_ADDR)
 
16815
            {
 
16816
@@ -14136,12 +16239,12 @@
 
16817
        }
 
16818
 
 
16819
       else
 
16820
-       gcc_unreachable ();
 
16821
+       rs6000_secondary_reload_fail (__LINE__, reg, mem, scratch, store_p);
 
16822
 
 
16823
       break;
 
16824
 
 
16825
     default:
 
16826
-      gcc_unreachable ();
 
16827
+      rs6000_secondary_reload_fail (__LINE__, reg, mem, scratch, store_p);
 
16828
     }
 
16829
 
 
16830
   /* If the original address involved a pre-modify that we couldn't use the VSX
 
16831
@@ -14188,7 +16291,7 @@
 
16832
   /* Adjust the address if it changed.  */
 
16833
   if (addr != XEXP (mem, 0))
 
16834
     {
 
16835
-      mem = change_address (mem, mode, addr);
 
16836
+      mem = replace_equiv_address_nv (mem, addr);
 
16837
       if (TARGET_DEBUG_ADDR)
 
16838
        fprintf (stderr, "\nrs6000_secondary_reload_inner, mem adjusted.\n");
 
16839
     }
 
16840
@@ -14253,8 +16356,10 @@
 
16841
   return;
 
16842
 }
 
16843
 
 
16844
-/* Allocate a 64-bit stack slot to be used for copying SDmode
 
16845
-   values through if this function has any SDmode references.  */
 
16846
+/* Allocate a 64-bit stack slot to be used for copying SDmode values through if
 
16847
+   this function has any SDmode references.  If we are on a power7 or later, we
 
16848
+   don't need the 64-bit stack slot since the LFIWZX and STIFWX instructions
 
16849
+   can load/store the value.  */
 
16850
 
 
16851
 static void
 
16852
 rs6000_alloc_sdmode_stack_slot (void)
 
16853
@@ -14265,6 +16370,9 @@
 
16854
 
 
16855
   gcc_assert (cfun->machine->sdmode_stack_slot == NULL_RTX);
 
16856
 
 
16857
+  if (TARGET_NO_SDMODE_STACK)
 
16858
+    return;
 
16859
+
 
16860
   FOR_EACH_BB (bb)
 
16861
     for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi); gsi_next (&gsi))
 
16862
       {
 
16863
@@ -14325,8 +16433,7 @@
 
16864
 {
 
16865
   enum machine_mode mode = GET_MODE (x);
 
16866
 
 
16867
-  if (VECTOR_UNIT_VSX_P (mode)
 
16868
-      && x == CONST0_RTX (mode) && VSX_REG_CLASS_P (rclass))
 
16869
+  if (TARGET_VSX && x == CONST0_RTX (mode) && VSX_REG_CLASS_P (rclass))
 
16870
     return rclass;
 
16871
 
 
16872
   if (VECTOR_UNIT_ALTIVEC_OR_VSX_P (mode)
 
16873
@@ -14381,60 +16488,45 @@
 
16874
    set and vice versa.  */
 
16875
 
 
16876
 static bool
 
16877
-rs6000_secondary_memory_needed (enum reg_class class1,
 
16878
-                               enum reg_class class2,
 
16879
+rs6000_secondary_memory_needed (enum reg_class from_class,
 
16880
+                               enum reg_class to_class,
 
16881
                                enum machine_mode mode)
 
16882
 {
 
16883
-  if (class1 == class2)
 
16884
-    return false;
 
16885
+  enum rs6000_reg_type from_type, to_type;
 
16886
+  bool altivec_p = ((from_class == ALTIVEC_REGS)
 
16887
+                   || (to_class == ALTIVEC_REGS));
 
16888
 
 
16889
-  /* Under VSX, there are 3 register classes that values could be in (VSX_REGS,
 
16890
-     ALTIVEC_REGS, and FLOAT_REGS).  We don't need to use memory to copy
 
16891
-     between these classes.  But we need memory for other things that can go in
 
16892
-     FLOAT_REGS like SFmode.  */
 
16893
-  if (TARGET_VSX
 
16894
-      && (VECTOR_MEM_VSX_P (mode) || VECTOR_UNIT_VSX_P (mode))
 
16895
-      && (class1 == VSX_REGS || class1 == ALTIVEC_REGS
 
16896
-         || class1 == FLOAT_REGS))
 
16897
-    return (class2 != VSX_REGS && class2 != ALTIVEC_REGS
 
16898
-           && class2 != FLOAT_REGS);
 
16899
+  /* If a simple/direct move is available, we don't need secondary memory  */
 
16900
+  from_type = reg_class_to_reg_type[(int)from_class];
 
16901
+  to_type = reg_class_to_reg_type[(int)to_class];
 
16902
 
 
16903
-  if (class1 == VSX_REGS || class2 == VSX_REGS)
 
16904
-    return true;
 
16905
+  if (rs6000_secondary_reload_move (to_type, from_type, mode,
 
16906
+                                   (secondary_reload_info *)0, altivec_p))
 
16907
+    return false;
 
16908
 
 
16909
-  if (class1 == FLOAT_REGS
 
16910
-      && (!TARGET_MFPGPR || !TARGET_POWERPC64
 
16911
-         || ((mode != DFmode)
 
16912
-             && (mode != DDmode)
 
16913
-             && (mode != DImode))))
 
16914
+  /* If we have a floating point or vector register class, we need to use
 
16915
+     memory to transfer the data.  */
 
16916
+  if (IS_FP_VECT_REG_TYPE (from_type) || IS_FP_VECT_REG_TYPE (to_type))
 
16917
     return true;
 
16918
 
 
16919
-  if (class2 == FLOAT_REGS
 
16920
-      && (!TARGET_MFPGPR || !TARGET_POWERPC64
 
16921
-         || ((mode != DFmode)
 
16922
-             && (mode != DDmode)
 
16923
-             && (mode != DImode))))
 
16924
-    return true;
 
16925
-
 
16926
-  if (class1 == ALTIVEC_REGS || class2 == ALTIVEC_REGS)
 
16927
-    return true;
 
16928
-
 
16929
   return false;
 
16930
 }
 
16931
 
 
16932
 /* Debug version of rs6000_secondary_memory_needed.  */
 
16933
 static bool
 
16934
-rs6000_debug_secondary_memory_needed (enum reg_class class1,
 
16935
-                                     enum reg_class class2,
 
16936
+rs6000_debug_secondary_memory_needed (enum reg_class from_class,
 
16937
+                                     enum reg_class to_class,
 
16938
                                      enum machine_mode mode)
 
16939
 {
 
16940
-  bool ret = rs6000_secondary_memory_needed (class1, class2, mode);
 
16941
+  bool ret = rs6000_secondary_memory_needed (from_class, to_class, mode);
 
16942
 
 
16943
   fprintf (stderr,
 
16944
-          "rs6000_secondary_memory_needed, return: %s, class1 = %s, "
 
16945
-          "class2 = %s, mode = %s\n",
 
16946
-          ret ? "true" : "false", reg_class_names[class1],
 
16947
-          reg_class_names[class2], GET_MODE_NAME (mode));
 
16948
+          "rs6000_secondary_memory_needed, return: %s, from_class = %s, "
 
16949
+          "to_class = %s, mode = %s\n",
 
16950
+          ret ? "true" : "false",
 
16951
+          reg_class_names[from_class],
 
16952
+          reg_class_names[to_class],
 
16953
+          GET_MODE_NAME (mode));
 
16954
 
 
16955
   return ret;
 
16956
 }
 
16957
@@ -14501,12 +16593,18 @@
 
16958
     return (mode != SDmode) ? NO_REGS : GENERAL_REGS;
 
16959
 
 
16960
   /* Memory, and FP/altivec registers can go into fp/altivec registers under
 
16961
-     VSX.  */
 
16962
+     VSX.  However, for scalar variables, use the traditional floating point
 
16963
+     registers so that we can use offset+register addressing.  */
 
16964
   if (TARGET_VSX
 
16965
       && (regno == -1 || VSX_REGNO_P (regno))
 
16966
       && VSX_REG_CLASS_P (rclass))
 
16967
-    return NO_REGS;
 
16968
+    {
 
16969
+      if (GET_MODE_SIZE (mode) < 16)
 
16970
+       return FLOAT_REGS;
 
16971
 
 
16972
+      return NO_REGS;
 
16973
+    }
 
16974
+
 
16975
   /* Memory, and AltiVec registers can go into AltiVec registers.  */
 
16976
   if ((regno == -1 || ALTIVEC_REGNO_P (regno))
 
16977
       && rclass == ALTIVEC_REGS)
 
16978
@@ -14550,8 +16648,42 @@
 
16979
   if (from_size != to_size)
 
16980
     {
 
16981
       enum reg_class xclass = (TARGET_VSX) ? VSX_REGS : FLOAT_REGS;
 
16982
-      return ((from_size < 8 || to_size < 8 || TARGET_IEEEQUAD)
 
16983
-             && reg_classes_intersect_p (xclass, rclass));
 
16984
+
 
16985
+      if (reg_classes_intersect_p (xclass, rclass))
 
16986
+       {
 
16987
+         unsigned to_nregs = hard_regno_nregs[FIRST_FPR_REGNO][to];
 
16988
+         unsigned from_nregs = hard_regno_nregs[FIRST_FPR_REGNO][from];
 
16989
+
 
16990
+         /* Don't allow 64-bit types to overlap with 128-bit types that take a
 
16991
+            single register under VSX because the scalar part of the register
 
16992
+            is in the upper 64-bits, and not the lower 64-bits.  Types like
 
16993
+            TFmode/TDmode that take 2 scalar register can overlap.  128-bit
 
16994
+            IEEE floating point can't overlap, and neither can small
 
16995
+            values.  */
 
16996
+
 
16997
+         if (TARGET_IEEEQUAD && (to == TFmode || from == TFmode))
 
16998
+           return true;
 
16999
+
 
17000
+         /* TDmode in floating-mode registers must always go into a register
 
17001
+            pair with the most significant word in the even-numbered register
 
17002
+            to match ISA requirements.  In little-endian mode, this does not
 
17003
+            match subreg numbering, so we cannot allow subregs.  */
 
17004
+         if (!BYTES_BIG_ENDIAN && (to == TDmode || from == TDmode))
 
17005
+           return true;
 
17006
+
 
17007
+         if (from_size < 8 || to_size < 8)
 
17008
+           return true;
 
17009
+
 
17010
+         if (from_size == 8 && (8 * to_nregs) != to_size)
 
17011
+           return true;
 
17012
+
 
17013
+         if (to_size == 8 && (8 * from_nregs) != from_size)
 
17014
+           return true;
 
17015
+
 
17016
+         return false;
 
17017
+       }
 
17018
+      else
 
17019
+       return false;
 
17020
     }
 
17021
 
 
17022
   if (TARGET_E500_DOUBLE
 
17023
@@ -14565,10 +16697,19 @@
 
17024
   /* Since the VSX register set includes traditional floating point registers
 
17025
      and altivec registers, just check for the size being different instead of
 
17026
      trying to check whether the modes are vector modes.  Otherwise it won't
 
17027
-     allow say DF and DI to change classes.  */
 
17028
+     allow say DF and DI to change classes.  For types like TFmode and TDmode
 
17029
+     that take 2 64-bit registers, rather than a single 128-bit register, don't
 
17030
+     allow subregs of those types to other 128 bit types.  */
 
17031
   if (TARGET_VSX && VSX_REG_CLASS_P (rclass))
 
17032
-    return (from_size != 8 && from_size != 16);
 
17033
+    {
 
17034
+      unsigned num_regs = (from_size + 15) / 16;
 
17035
+      if (hard_regno_nregs[FIRST_FPR_REGNO][to] > num_regs
 
17036
+         || hard_regno_nregs[FIRST_FPR_REGNO][from] > num_regs)
 
17037
+       return true;
 
17038
 
 
17039
+      return (from_size != 8 && from_size != 16);
 
17040
+    }
 
17041
+
 
17042
   if (TARGET_ALTIVEC && rclass == ALTIVEC_REGS
 
17043
       && (ALTIVEC_VECTOR_MODE (from) + ALTIVEC_VECTOR_MODE (to)) == 1)
 
17044
     return true;
 
17045
@@ -14598,6 +16739,161 @@
 
17046
   return ret;
 
17047
 }
 
17048
 
 
17049
+/* Return a string to do a move operation of 128 bits of data.  */
 
17050
+
 
17051
+const char *
 
17052
+rs6000_output_move_128bit (rtx operands[])
 
17053
+{
 
17054
+  rtx dest = operands[0];
 
17055
+  rtx src = operands[1];
 
17056
+  enum machine_mode mode = GET_MODE (dest);
 
17057
+  int dest_regno;
 
17058
+  int src_regno;
 
17059
+  bool dest_gpr_p, dest_fp_p, dest_vmx_p, dest_vsx_p;
 
17060
+  bool src_gpr_p, src_fp_p, src_vmx_p, src_vsx_p;
 
17061
+
 
17062
+  if (REG_P (dest))
 
17063
+    {
 
17064
+      dest_regno = REGNO (dest);
 
17065
+      dest_gpr_p = INT_REGNO_P (dest_regno);
 
17066
+      dest_fp_p = FP_REGNO_P (dest_regno);
 
17067
+      dest_vmx_p = ALTIVEC_REGNO_P (dest_regno);
 
17068
+      dest_vsx_p = dest_fp_p | dest_vmx_p;
 
17069
+    }
 
17070
+  else
 
17071
+    {
 
17072
+      dest_regno = -1;
 
17073
+      dest_gpr_p = dest_fp_p = dest_vmx_p = dest_vsx_p = false;
 
17074
+    }
 
17075
+
 
17076
+  if (REG_P (src))
 
17077
+    {
 
17078
+      src_regno = REGNO (src);
 
17079
+      src_gpr_p = INT_REGNO_P (src_regno);
 
17080
+      src_fp_p = FP_REGNO_P (src_regno);
 
17081
+      src_vmx_p = ALTIVEC_REGNO_P (src_regno);
 
17082
+      src_vsx_p = src_fp_p | src_vmx_p;
 
17083
+    }
 
17084
+  else
 
17085
+    {
 
17086
+      src_regno = -1;
 
17087
+      src_gpr_p = src_fp_p = src_vmx_p = src_vsx_p = false;
 
17088
+    }
 
17089
+
 
17090
+  /* Register moves.  */
 
17091
+  if (dest_regno >= 0 && src_regno >= 0)
 
17092
+    {
 
17093
+      if (dest_gpr_p)
 
17094
+       {
 
17095
+         if (src_gpr_p)
 
17096
+           return "#";
 
17097
+
 
17098
+         else if (TARGET_VSX && TARGET_DIRECT_MOVE && src_vsx_p)
 
17099
+           return "#";
 
17100
+       }
 
17101
+
 
17102
+      else if (TARGET_VSX && dest_vsx_p)
 
17103
+       {
 
17104
+         if (src_vsx_p)
 
17105
+           return "xxlor %x0,%x1,%x1";
 
17106
+
 
17107
+         else if (TARGET_DIRECT_MOVE && src_gpr_p)
 
17108
+           return "#";
 
17109
+       }
 
17110
+
 
17111
+      else if (TARGET_ALTIVEC && dest_vmx_p && src_vmx_p)
 
17112
+       return "vor %0,%1,%1";
 
17113
+
 
17114
+      else if (dest_fp_p && src_fp_p)
 
17115
+       return "#";
 
17116
+    }
 
17117
+
 
17118
+  /* Loads.  */
 
17119
+  else if (dest_regno >= 0 && MEM_P (src))
 
17120
+    {
 
17121
+      if (dest_gpr_p)
 
17122
+       {
 
17123
+         if (TARGET_QUAD_MEMORY && quad_load_store_p (dest, src))
 
17124
+           return "lq %0,%1";
 
17125
+         else
 
17126
+           return "#";
 
17127
+       }
 
17128
+
 
17129
+      else if (TARGET_ALTIVEC && dest_vmx_p
 
17130
+              && altivec_indexed_or_indirect_operand (src, mode))
 
17131
+       return "lvx %0,%y1";
 
17132
+
 
17133
+      else if (TARGET_VSX && dest_vsx_p)
 
17134
+       {
 
17135
+         if (mode == V16QImode || mode == V8HImode || mode == V4SImode)
 
17136
+           return "lxvw4x %x0,%y1";
 
17137
+         else
 
17138
+           return "lxvd2x %x0,%y1";
 
17139
+       }
 
17140
+
 
17141
+      else if (TARGET_ALTIVEC && dest_vmx_p)
 
17142
+       return "lvx %0,%y1";
 
17143
+
 
17144
+      else if (dest_fp_p)
 
17145
+       return "#";
 
17146
+    }
 
17147
+
 
17148
+  /* Stores.  */
 
17149
+  else if (src_regno >= 0 && MEM_P (dest))
 
17150
+    {
 
17151
+      if (src_gpr_p)
 
17152
+       {
 
17153
+         if (TARGET_QUAD_MEMORY && quad_load_store_p (dest, src))
 
17154
+           return "stq %1,%0";
 
17155
+         else
 
17156
+           return "#";
 
17157
+       }
 
17158
+
 
17159
+      else if (TARGET_ALTIVEC && src_vmx_p
 
17160
+              && altivec_indexed_or_indirect_operand (src, mode))
 
17161
+       return "stvx %1,%y0";
 
17162
+
 
17163
+      else if (TARGET_VSX && src_vsx_p)
 
17164
+       {
 
17165
+         if (mode == V16QImode || mode == V8HImode || mode == V4SImode)
 
17166
+           return "stxvw4x %x1,%y0";
 
17167
+         else
 
17168
+           return "stxvd2x %x1,%y0";
 
17169
+       }
 
17170
+
 
17171
+      else if (TARGET_ALTIVEC && src_vmx_p)
 
17172
+       return "stvx %1,%y0";
 
17173
+
 
17174
+      else if (src_fp_p)
 
17175
+       return "#";
 
17176
+    }
 
17177
+
 
17178
+  /* Constants.  */
 
17179
+  else if (dest_regno >= 0
 
17180
+          && (GET_CODE (src) == CONST_INT
 
17181
+              || GET_CODE (src) == CONST_DOUBLE
 
17182
+              || GET_CODE (src) == CONST_VECTOR))
 
17183
+    {
 
17184
+      if (dest_gpr_p)
 
17185
+       return "#";
 
17186
+
 
17187
+      else if (TARGET_VSX && dest_vsx_p && zero_constant (src, mode))
 
17188
+       return "xxlxor %x0,%x0,%x0";
 
17189
+
 
17190
+      else if (TARGET_ALTIVEC && dest_vmx_p)
 
17191
+       return output_vec_const_move (operands);
 
17192
+    }
 
17193
+
 
17194
+  if (TARGET_DEBUG_ADDR)
 
17195
+    {
 
17196
+      fprintf (stderr, "\n===== Bad 128 bit move:\n");
 
17197
+      debug_rtx (gen_rtx_SET (VOIDmode, dest, src));
 
17198
+    }
 
17199
+
 
17200
+  gcc_unreachable ();
 
17201
+}
 
17202
+
 
17203
+
 
17204
 /* Given a comparison operation, return the bit number in CCR to test.  We
 
17205
    know this is a valid comparison.
 
17206
 
 
17207
@@ -14823,6 +17119,7 @@
 
17208
            ASM_OUTPUT_INTERNAL_LABEL_PREFIX (file, "L.");
 
17209
          break;
 
17210
 
 
17211
+       case ABI_ELFv2:
 
17212
        case ABI_V4:
 
17213
        case ABI_DARWIN:
 
17214
          break;
 
17215
@@ -15302,7 +17599,7 @@
 
17216
       return;
 
17217
 
 
17218
     case 'Y':
 
17219
-      /* Like 'L', for third word of TImode  */
 
17220
+      /* Like 'L', for third word of TImode/PTImode  */
 
17221
       if (REG_P (x))
 
17222
        fputs (reg_names[REGNO (x) + 2], file);
 
17223
       else if (MEM_P (x))
 
17224
@@ -15352,7 +17649,7 @@
 
17225
       return;
 
17226
 
 
17227
     case 'Z':
 
17228
-      /* Like 'L', for last word of TImode.  */
 
17229
+      /* Like 'L', for last word of TImode/PTImode.  */
 
17230
       if (REG_P (x))
 
17231
        fputs (reg_names[REGNO (x) + 3], file);
 
17232
       else if (MEM_P (x))
 
17233
@@ -15383,7 +17680,8 @@
 
17234
        if ((TARGET_SPE || TARGET_E500_DOUBLE)
 
17235
            && (GET_MODE_SIZE (GET_MODE (x)) == 8
 
17236
                || GET_MODE (x) == TFmode
 
17237
-               || GET_MODE (x) == TImode))
 
17238
+               || GET_MODE (x) == TImode
 
17239
+               || GET_MODE (x) == PTImode))
 
17240
          {
 
17241
            /* Handle [reg].  */
 
17242
            if (REG_P (tmp))
 
17243
@@ -16766,7 +19064,8 @@
 
17244
 }
 
17245
 
 
17246
 /* A subroutine of the atomic operation splitters.  Emit a load-locked
 
17247
-   instruction in MODE.  */
 
17248
+   instruction in MODE.  For QI/HImode, possibly use a pattern than includes
 
17249
+   the zero_extend operation.  */
 
17250
 
 
17251
 static void
 
17252
 emit_load_locked (enum machine_mode mode, rtx reg, rtx mem)
 
17253
@@ -16775,12 +19074,26 @@
 
17254
 
 
17255
   switch (mode)
 
17256
     {
 
17257
+    case QImode:
 
17258
+      fn = gen_load_lockedqi;
 
17259
+      break;
 
17260
+    case HImode:
 
17261
+      fn = gen_load_lockedhi;
 
17262
+      break;
 
17263
     case SImode:
 
17264
-      fn = gen_load_lockedsi;
 
17265
+      if (GET_MODE (mem) == QImode)
 
17266
+       fn = gen_load_lockedqi_si;
 
17267
+      else if (GET_MODE (mem) == HImode)
 
17268
+       fn = gen_load_lockedhi_si;
 
17269
+      else
 
17270
+       fn = gen_load_lockedsi;
 
17271
       break;
 
17272
     case DImode:
 
17273
       fn = gen_load_lockeddi;
 
17274
       break;
 
17275
+    case TImode:
 
17276
+      fn = gen_load_lockedti;
 
17277
+      break;
 
17278
     default:
 
17279
       gcc_unreachable ();
 
17280
     }
 
17281
@@ -16797,12 +19110,21 @@
 
17282
 
 
17283
   switch (mode)
 
17284
     {
 
17285
+    case QImode:
 
17286
+      fn = gen_store_conditionalqi;
 
17287
+      break;
 
17288
+    case HImode:
 
17289
+      fn = gen_store_conditionalhi;
 
17290
+      break;
 
17291
     case SImode:
 
17292
       fn = gen_store_conditionalsi;
 
17293
       break;
 
17294
     case DImode:
 
17295
       fn = gen_store_conditionaldi;
 
17296
       break;
 
17297
+    case TImode:
 
17298
+      fn = gen_store_conditionalti;
 
17299
+      break;
 
17300
     default:
 
17301
       gcc_unreachable ();
 
17302
     }
 
17303
@@ -16949,7 +19271,7 @@
 
17304
 {
 
17305
   rtx boolval, retval, mem, oldval, newval, cond;
 
17306
   rtx label1, label2, x, mask, shift;
 
17307
-  enum machine_mode mode;
 
17308
+  enum machine_mode mode, orig_mode;
 
17309
   enum memmodel mod_s, mod_f;
 
17310
   bool is_weak;
 
17311
 
 
17312
@@ -16961,23 +19283,30 @@
 
17313
   is_weak = (INTVAL (operands[5]) != 0);
 
17314
   mod_s = (enum memmodel) INTVAL (operands[6]);
 
17315
   mod_f = (enum memmodel) INTVAL (operands[7]);
 
17316
-  mode = GET_MODE (mem);
 
17317
+  orig_mode = mode = GET_MODE (mem);
 
17318
 
 
17319
   mask = shift = NULL_RTX;
 
17320
   if (mode == QImode || mode == HImode)
 
17321
     {
 
17322
-      mem = rs6000_adjust_atomic_subword (mem, &shift, &mask);
 
17323
-
 
17324
-      /* Shift and mask OLDVAL into position with the word.  */
 
17325
+      /* Before power8, we didn't have access to lbarx/lharx, so generate a
 
17326
+        lwarx and shift/mask operations.  With power8, we need to do the
 
17327
+        comparison in SImode, but the store is still done in QI/HImode.  */
 
17328
       oldval = convert_modes (SImode, mode, oldval, 1);
 
17329
-      oldval = expand_simple_binop (SImode, ASHIFT, oldval, shift,
 
17330
-                                   NULL_RTX, 1, OPTAB_LIB_WIDEN);
 
17331
 
 
17332
-      /* Shift and mask NEWVAL into position within the word.  */
 
17333
-      newval = convert_modes (SImode, mode, newval, 1);
 
17334
-      newval = expand_simple_binop (SImode, ASHIFT, newval, shift,
 
17335
-                                   NULL_RTX, 1, OPTAB_LIB_WIDEN);
 
17336
+      if (!TARGET_SYNC_HI_QI)
 
17337
+       {
 
17338
+         mem = rs6000_adjust_atomic_subword (mem, &shift, &mask);
 
17339
 
 
17340
+         /* Shift and mask OLDVAL into position with the word.  */
 
17341
+         oldval = expand_simple_binop (SImode, ASHIFT, oldval, shift,
 
17342
+                                       NULL_RTX, 1, OPTAB_LIB_WIDEN);
 
17343
+
 
17344
+         /* Shift and mask NEWVAL into position within the word.  */
 
17345
+         newval = convert_modes (SImode, mode, newval, 1);
 
17346
+         newval = expand_simple_binop (SImode, ASHIFT, newval, shift,
 
17347
+                                       NULL_RTX, 1, OPTAB_LIB_WIDEN);
 
17348
+       }
 
17349
+
 
17350
       /* Prepare to adjust the return value.  */
 
17351
       retval = gen_reg_rtx (SImode);
 
17352
       mode = SImode;
 
17353
@@ -17005,7 +19334,25 @@
 
17354
     }
 
17355
 
 
17356
   cond = gen_reg_rtx (CCmode);
 
17357
-  x = gen_rtx_COMPARE (CCmode, x, oldval);
 
17358
+  /* If we have TImode, synthesize a comparison.  */
 
17359
+  if (mode != TImode)
 
17360
+    x = gen_rtx_COMPARE (CCmode, x, oldval);
 
17361
+  else
 
17362
+    {
 
17363
+      rtx xor1_result = gen_reg_rtx (DImode);
 
17364
+      rtx xor2_result = gen_reg_rtx (DImode);
 
17365
+      rtx or_result = gen_reg_rtx (DImode);
 
17366
+      rtx new_word0 = simplify_gen_subreg (DImode, x, TImode, 0);
 
17367
+      rtx new_word1 = simplify_gen_subreg (DImode, x, TImode, 8);
 
17368
+      rtx old_word0 = simplify_gen_subreg (DImode, oldval, TImode, 0);
 
17369
+      rtx old_word1 = simplify_gen_subreg (DImode, oldval, TImode, 8);
 
17370
+
 
17371
+      emit_insn (gen_xordi3 (xor1_result, new_word0, old_word0));
 
17372
+      emit_insn (gen_xordi3 (xor2_result, new_word1, old_word1));
 
17373
+      emit_insn (gen_iordi3 (or_result, xor1_result, xor2_result));
 
17374
+      x = gen_rtx_COMPARE (CCmode, or_result, const0_rtx);
 
17375
+    }
 
17376
+
 
17377
   emit_insn (gen_rtx_SET (VOIDmode, cond, x));
 
17378
 
 
17379
   x = gen_rtx_NE (VOIDmode, cond, const0_rtx);
 
17380
@@ -17015,7 +19362,7 @@
 
17381
   if (mask)
 
17382
     x = rs6000_mask_atomic_subword (retval, newval, mask);
 
17383
 
 
17384
-  emit_store_conditional (mode, cond, mem, x);
 
17385
+  emit_store_conditional (orig_mode, cond, mem, x);
 
17386
 
 
17387
   if (!is_weak)
 
17388
     {
 
17389
@@ -17033,6 +19380,8 @@
 
17390
 
 
17391
   if (shift)
 
17392
     rs6000_finish_atomic_subword (operands[1], retval, shift);
 
17393
+  else if (mode != GET_MODE (operands[1]))
 
17394
+    convert_move (operands[1], retval, 1);
 
17395
 
 
17396
   /* In all cases, CR0 contains EQ on success, and NE on failure.  */
 
17397
   x = gen_rtx_EQ (SImode, cond, const0_rtx);
 
17398
@@ -17056,7 +19405,7 @@
 
17399
   mode = GET_MODE (mem);
 
17400
 
 
17401
   mask = shift = NULL_RTX;
 
17402
-  if (mode == QImode || mode == HImode)
 
17403
+  if (!TARGET_SYNC_HI_QI && (mode == QImode || mode == HImode))
 
17404
     {
 
17405
       mem = rs6000_adjust_atomic_subword (mem, &shift, &mask);
 
17406
 
 
17407
@@ -17105,53 +19454,70 @@
 
17408
 {
 
17409
   enum memmodel model = (enum memmodel) INTVAL (model_rtx);
 
17410
   enum machine_mode mode = GET_MODE (mem);
 
17411
+  enum machine_mode store_mode = mode;
 
17412
   rtx label, x, cond, mask, shift;
 
17413
   rtx before = orig_before, after = orig_after;
 
17414
 
 
17415
   mask = shift = NULL_RTX;
 
17416
+  /* On power8, we want to use SImode for the operation.  On previous systems,
 
17417
+     use the operation in a subword and shift/mask to get the proper byte or
 
17418
+     halfword.  */
 
17419
   if (mode == QImode || mode == HImode)
 
17420
     {
 
17421
-      mem = rs6000_adjust_atomic_subword (mem, &shift, &mask);
 
17422
+      if (TARGET_SYNC_HI_QI)
 
17423
+       {
 
17424
+         val = convert_modes (SImode, mode, val, 1);
 
17425
 
 
17426
-      /* Shift and mask VAL into position with the word.  */
 
17427
-      val = convert_modes (SImode, mode, val, 1);
 
17428
-      val = expand_simple_binop (SImode, ASHIFT, val, shift,
 
17429
-                                NULL_RTX, 1, OPTAB_LIB_WIDEN);
 
17430
-
 
17431
-      switch (code)
 
17432
+         /* Prepare to adjust the return value.  */
 
17433
+         before = gen_reg_rtx (SImode);
 
17434
+         if (after)
 
17435
+           after = gen_reg_rtx (SImode);
 
17436
+         mode = SImode;
 
17437
+       }
 
17438
+      else
 
17439
        {
 
17440
-       case IOR:
 
17441
-       case XOR:
 
17442
-         /* We've already zero-extended VAL.  That is sufficient to
 
17443
-            make certain that it does not affect other bits.  */
 
17444
-         mask = NULL;
 
17445
-         break;
 
17446
+         mem = rs6000_adjust_atomic_subword (mem, &shift, &mask);
 
17447
 
 
17448
-       case AND:
 
17449
-         /* If we make certain that all of the other bits in VAL are
 
17450
-            set, that will be sufficient to not affect other bits.  */
 
17451
-         x = gen_rtx_NOT (SImode, mask);
 
17452
-         x = gen_rtx_IOR (SImode, x, val);
 
17453
-         emit_insn (gen_rtx_SET (VOIDmode, val, x));
 
17454
-         mask = NULL;
 
17455
-         break;
 
17456
+         /* Shift and mask VAL into position with the word.  */
 
17457
+         val = convert_modes (SImode, mode, val, 1);
 
17458
+         val = expand_simple_binop (SImode, ASHIFT, val, shift,
 
17459
+                                    NULL_RTX, 1, OPTAB_LIB_WIDEN);
 
17460
 
 
17461
-       case NOT:
 
17462
-       case PLUS:
 
17463
-       case MINUS:
 
17464
-         /* These will all affect bits outside the field and need
 
17465
-            adjustment via MASK within the loop.  */
 
17466
-         break;
 
17467
+         switch (code)
 
17468
+           {
 
17469
+           case IOR:
 
17470
+           case XOR:
 
17471
+             /* We've already zero-extended VAL.  That is sufficient to
 
17472
+                make certain that it does not affect other bits.  */
 
17473
+             mask = NULL;
 
17474
+             break;
 
17475
 
 
17476
-       default:
 
17477
-         gcc_unreachable ();
 
17478
+           case AND:
 
17479
+             /* If we make certain that all of the other bits in VAL are
 
17480
+                set, that will be sufficient to not affect other bits.  */
 
17481
+             x = gen_rtx_NOT (SImode, mask);
 
17482
+             x = gen_rtx_IOR (SImode, x, val);
 
17483
+             emit_insn (gen_rtx_SET (VOIDmode, val, x));
 
17484
+             mask = NULL;
 
17485
+             break;
 
17486
+
 
17487
+           case NOT:
 
17488
+           case PLUS:
 
17489
+           case MINUS:
 
17490
+             /* These will all affect bits outside the field and need
 
17491
+                adjustment via MASK within the loop.  */
 
17492
+             break;
 
17493
+
 
17494
+           default:
 
17495
+             gcc_unreachable ();
 
17496
+           }
 
17497
+
 
17498
+         /* Prepare to adjust the return value.  */
 
17499
+         before = gen_reg_rtx (SImode);
 
17500
+         if (after)
 
17501
+           after = gen_reg_rtx (SImode);
 
17502
+         store_mode = mode = SImode;
 
17503
        }
 
17504
-
 
17505
-      /* Prepare to adjust the return value.  */
 
17506
-      before = gen_reg_rtx (SImode);
 
17507
-      if (after)
 
17508
-       after = gen_reg_rtx (SImode);
 
17509
-      mode = SImode;
 
17510
     }
 
17511
 
 
17512
   mem = rs6000_pre_atomic_barrier (mem, model);
 
17513
@@ -17184,9 +19550,11 @@
 
17514
                               NULL_RTX, 1, OPTAB_LIB_WIDEN);
 
17515
       x = rs6000_mask_atomic_subword (before, x, mask);
 
17516
     }
 
17517
+  else if (store_mode != mode)
 
17518
+    x = convert_modes (store_mode, mode, x, 1);
 
17519
 
 
17520
   cond = gen_reg_rtx (CCmode);
 
17521
-  emit_store_conditional (mode, cond, mem, x);
 
17522
+  emit_store_conditional (store_mode, cond, mem, x);
 
17523
 
 
17524
   x = gen_rtx_NE (VOIDmode, cond, const0_rtx);
 
17525
   emit_unlikely_jump (x, label);
 
17526
@@ -17195,11 +19563,22 @@
 
17527
 
 
17528
   if (shift)
 
17529
     {
 
17530
+      /* QImode/HImode on machines without lbarx/lharx where we do a lwarx and
 
17531
+        then do the calcuations in a SImode register.  */
 
17532
       if (orig_before)
 
17533
        rs6000_finish_atomic_subword (orig_before, before, shift);
 
17534
       if (orig_after)
 
17535
        rs6000_finish_atomic_subword (orig_after, after, shift);
 
17536
     }
 
17537
+  else if (store_mode != mode)
 
17538
+    {
 
17539
+      /* QImode/HImode on machines with lbarx/lharx where we do the native
 
17540
+        operation and then do the calcuations in a SImode register.  */
 
17541
+      if (orig_before)
 
17542
+       convert_move (orig_before, before, 1);
 
17543
+      if (orig_after)
 
17544
+       convert_move (orig_after, after, 1);
 
17545
+    }
 
17546
   else if (orig_after && after != orig_after)
 
17547
     emit_move_insn (orig_after, after);
 
17548
 }
 
17549
@@ -17239,6 +19618,39 @@
 
17550
 
 
17551
   gcc_assert (reg_mode_size * nregs == GET_MODE_SIZE (mode));
 
17552
 
 
17553
+  /* TDmode residing in FP registers is special, since the ISA requires that
 
17554
+     the lower-numbered word of a register pair is always the most significant
 
17555
+     word, even in little-endian mode.  This does not match the usual subreg
 
17556
+     semantics, so we cannnot use simplify_gen_subreg in those cases.  Access
 
17557
+     the appropriate constituent registers "by hand" in little-endian mode.
 
17558
+
 
17559
+     Note we do not need to check for destructive overlap here since TDmode
 
17560
+     can only reside in even/odd register pairs.  */
 
17561
+  if (FP_REGNO_P (reg) && DECIMAL_FLOAT_MODE_P (mode) && !BYTES_BIG_ENDIAN)
 
17562
+    {
 
17563
+      rtx p_src, p_dst;
 
17564
+      int i;
 
17565
+
 
17566
+      for (i = 0; i < nregs; i++)
 
17567
+       {
 
17568
+         if (REG_P (src) && FP_REGNO_P (REGNO (src)))
 
17569
+           p_src = gen_rtx_REG (reg_mode, REGNO (src) + nregs - 1 - i);
 
17570
+         else
 
17571
+           p_src = simplify_gen_subreg (reg_mode, src, mode,
 
17572
+                                        i * reg_mode_size);
 
17573
+
 
17574
+         if (REG_P (dst) && FP_REGNO_P (REGNO (dst)))
 
17575
+           p_dst = gen_rtx_REG (reg_mode, REGNO (dst) + nregs - 1 - i);
 
17576
+         else
 
17577
+           p_dst = simplify_gen_subreg (reg_mode, dst, mode,
 
17578
+                                        i * reg_mode_size);
 
17579
+
 
17580
+         emit_insn (gen_rtx_SET (VOIDmode, p_dst, p_src));
 
17581
+       }
 
17582
+
 
17583
+      return;
 
17584
+    }
 
17585
+
 
17586
   if (REG_P (src) && REG_P (dst) && (REGNO (src) < REGNO (dst)))
 
17587
     {
 
17588
       /* Move register range backwards, if we might have destructive
 
17589
@@ -17693,7 +20105,7 @@
 
17590
     }
 
17591
   else
 
17592
     {
 
17593
-      gcc_checking_assert (DEFAULT_ABI == ABI_AIX);
 
17594
+      gcc_checking_assert (DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_ELFv2);
 
17595
       if (info->first_fp_reg_save > 61)
 
17596
        strategy |= SAVE_INLINE_FPRS | REST_INLINE_FPRS;
 
17597
       strategy |= SAVE_INLINE_GPRS | REST_INLINE_GPRS;
 
17598
@@ -17704,7 +20116,8 @@
 
17599
      by the static chain.  It would require too much fiddling and the
 
17600
      static chain is rarely used anyway.  FPRs are saved w.r.t the stack
 
17601
      pointer on Darwin, and AIX uses r1 or r12.  */
 
17602
-  if (using_static_chain_p && DEFAULT_ABI != ABI_AIX)
 
17603
+  if (using_static_chain_p
 
17604
+      && (DEFAULT_ABI == ABI_V4 || DEFAULT_ABI == ABI_DARWIN))
 
17605
     strategy |= ((DEFAULT_ABI == ABI_DARWIN ? 0 : SAVE_INLINE_FPRS)
 
17606
                 | SAVE_INLINE_GPRS
 
17607
                 | SAVE_INLINE_VRS | REST_INLINE_VRS);
 
17608
@@ -17837,7 +20250,35 @@
 
17609
    The required alignment for AIX configurations is two words (i.e., 8
 
17610
    or 16 bytes).
 
17611
 
 
17612
+   The ELFv2 ABI is a variant of the AIX ABI.  Stack frames look like:
 
17613
 
 
17614
+       SP----> +---------------------------------------+
 
17615
+               | Back chain to caller                  |  0
 
17616
+               +---------------------------------------+
 
17617
+               | Save area for CR                      |  8
 
17618
+               +---------------------------------------+
 
17619
+               | Saved LR                              |  16
 
17620
+               +---------------------------------------+
 
17621
+               | Saved TOC pointer                     |  24
 
17622
+               +---------------------------------------+
 
17623
+               | Parameter save area (P)               |  32
 
17624
+               +---------------------------------------+
 
17625
+               | Alloca space (A)                      |  32+P
 
17626
+               +---------------------------------------+
 
17627
+               | Local variable space (L)              |  32+P+A
 
17628
+               +---------------------------------------+
 
17629
+               | Save area for AltiVec registers (W)   |  32+P+A+L
 
17630
+               +---------------------------------------+
 
17631
+               | AltiVec alignment padding (Y)         |  32+P+A+L+W
 
17632
+               +---------------------------------------+
 
17633
+               | Save area for GP registers (G)        |  32+P+A+L+W+Y
 
17634
+               +---------------------------------------+
 
17635
+               | Save area for FP registers (F)        |  32+P+A+L+W+Y+G
 
17636
+               +---------------------------------------+
 
17637
+       old SP->| back chain to caller's caller         |  32+P+A+L+W+Y+G+F
 
17638
+               +---------------------------------------+
 
17639
+
 
17640
+
 
17641
    V.4 stack frames look like:
 
17642
 
 
17643
        SP----> +---------------------------------------+
 
17644
@@ -17897,6 +20338,7 @@
 
17645
   rs6000_stack_t *info_ptr = &stack_info;
 
17646
   int reg_size = TARGET_32BIT ? 4 : 8;
 
17647
   int ehrd_size;
 
17648
+  int ehcr_size;
 
17649
   int save_align;
 
17650
   int first_gp;
 
17651
   HOST_WIDE_INT non_fixed_size;
 
17652
@@ -17990,6 +20432,18 @@
 
17653
   else
 
17654
     ehrd_size = 0;
 
17655
 
 
17656
+  /* In the ELFv2 ABI, we also need to allocate space for separate
 
17657
+     CR field save areas if the function calls __builtin_eh_return.  */
 
17658
+  if (DEFAULT_ABI == ABI_ELFv2 && crtl->calls_eh_return)
 
17659
+    {
 
17660
+      /* This hard-codes that we have three call-saved CR fields.  */
 
17661
+      ehcr_size = 3 * reg_size;
 
17662
+      /* We do *not* use the regular CR save mechanism.  */
 
17663
+      info_ptr->cr_save_p = 0;
 
17664
+    }
 
17665
+  else
 
17666
+    ehcr_size = 0;
 
17667
+
 
17668
   /* Determine various sizes.  */
 
17669
   info_ptr->reg_size     = reg_size;
 
17670
   info_ptr->fixed_size   = RS6000_SAVE_AREA;
 
17671
@@ -18029,6 +20483,7 @@
 
17672
       gcc_unreachable ();
 
17673
 
 
17674
     case ABI_AIX:
 
17675
+    case ABI_ELFv2:
 
17676
     case ABI_DARWIN:
 
17677
       info_ptr->fp_save_offset   = - info_ptr->fp_size;
 
17678
       info_ptr->gp_save_offset   = info_ptr->fp_save_offset - info_ptr->gp_size;
 
17679
@@ -18058,6 +20513,8 @@
 
17680
        }
 
17681
       else
 
17682
        info_ptr->ehrd_offset      = info_ptr->gp_save_offset - ehrd_size;
 
17683
+
 
17684
+      info_ptr->ehcr_offset      = info_ptr->ehrd_offset - ehcr_size;
 
17685
       info_ptr->cr_save_offset   = reg_size; /* first word when 64-bit.  */
 
17686
       info_ptr->lr_save_offset   = 2*reg_size;
 
17687
       break;
 
17688
@@ -18120,6 +20577,7 @@
 
17689
                                         + info_ptr->spe_gp_size
 
17690
                                         + info_ptr->spe_padding_size
 
17691
                                         + ehrd_size
 
17692
+                                        + ehcr_size
 
17693
                                         + info_ptr->cr_size
 
17694
                                         + info_ptr->vrsave_size,
 
17695
                                         save_align);
 
17696
@@ -18133,7 +20591,7 @@
 
17697
 
 
17698
   /* Determine if we need to save the link register.  */
 
17699
   if (info_ptr->calls_p
 
17700
-      || (DEFAULT_ABI == ABI_AIX
 
17701
+      || ((DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_ELFv2)
 
17702
          && crtl->profile
 
17703
          && !TARGET_PROFILE_KERNEL)
 
17704
       || (DEFAULT_ABI == ABI_V4 && cfun->calls_alloca)
 
17705
@@ -18279,6 +20737,7 @@
 
17706
     default:            abi_string = "Unknown";        break;
 
17707
     case ABI_NONE:      abi_string = "NONE";           break;
 
17708
     case ABI_AIX:       abi_string = "AIX";            break;
 
17709
+    case ABI_ELFv2:     abi_string = "ELFv2";          break;
 
17710
     case ABI_DARWIN:    abi_string = "Darwin";         break;
 
17711
     case ABI_V4:        abi_string = "V.4";            break;
 
17712
     }
 
17713
@@ -18400,7 +20859,8 @@
 
17714
   /* Currently we don't optimize very well between prolog and body
 
17715
      code and for PIC code the code can be actually quite bad, so
 
17716
      don't try to be too clever here.  */
 
17717
-  if (count != 0 || (DEFAULT_ABI != ABI_AIX && flag_pic))
 
17718
+  if (count != 0
 
17719
+      || ((DEFAULT_ABI == ABI_V4 || DEFAULT_ABI == ABI_DARWIN) && flag_pic))
 
17720
     {
 
17721
       cfun->machine->ra_needs_full_frame = 1;
 
17722
 
 
17723
@@ -18459,13 +20919,13 @@
 
17724
        return false;
 
17725
     }
 
17726
 
 
17727
-  /* Under the AIX ABI we can't allow calls to non-local functions,
 
17728
-     because the callee may have a different TOC pointer to the
 
17729
-     caller and there's no way to ensure we restore the TOC when we
 
17730
-     return.  With the secure-plt SYSV ABI we can't make non-local
 
17731
+  /* Under the AIX or ELFv2 ABIs we can't allow calls to non-local
 
17732
+     functions, because the callee may have a different TOC pointer to
 
17733
+     the caller and there's no way to ensure we restore the TOC when
 
17734
+     we return.  With the secure-plt SYSV ABI we can't make non-local
 
17735
      calls when -fpic/PIC because the plt call stubs use r30.  */
 
17736
   if (DEFAULT_ABI == ABI_DARWIN
 
17737
-      || (DEFAULT_ABI == ABI_AIX
 
17738
+      || ((DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_ELFv2)
 
17739
          && decl
 
17740
          && !DECL_EXTERNAL (decl)
 
17741
          && (*targetm.binds_local_p) (decl))
 
17742
@@ -18566,7 +21026,7 @@
 
17743
   rtx dest;
 
17744
   dest = gen_rtx_REG (Pmode, RS6000_PIC_OFFSET_TABLE_REGNUM);
 
17745
 
 
17746
-  if (TARGET_ELF && TARGET_SECURE_PLT && DEFAULT_ABI != ABI_AIX && flag_pic)
 
17747
+  if (TARGET_ELF && TARGET_SECURE_PLT && DEFAULT_ABI == ABI_V4 && flag_pic)
 
17748
     {
 
17749
       char buf[30];
 
17750
       rtx lab, tmp1, tmp2, got;
 
17751
@@ -18594,7 +21054,7 @@
 
17752
       emit_insn (gen_load_toc_v4_pic_si ());
 
17753
       emit_move_insn (dest, gen_rtx_REG (Pmode, LR_REGNO));
 
17754
     }
 
17755
-  else if (TARGET_ELF && DEFAULT_ABI != ABI_AIX && flag_pic == 2)
 
17756
+  else if (TARGET_ELF && DEFAULT_ABI == ABI_V4 && flag_pic == 2)
 
17757
     {
 
17758
       char buf[30];
 
17759
       rtx temp0 = (fromprolog
 
17760
@@ -18642,7 +21102,7 @@
 
17761
     }
 
17762
   else
 
17763
     {
 
17764
-      gcc_assert (DEFAULT_ABI == ABI_AIX);
 
17765
+      gcc_assert (DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_ELFv2);
 
17766
 
 
17767
       if (TARGET_32BIT)
 
17768
        emit_insn (gen_load_toc_aix_si (dest));
 
17769
@@ -19047,7 +21507,7 @@
 
17770
 
 
17771
 static rtx
 
17772
 rs6000_frame_related (rtx insn, rtx reg, HOST_WIDE_INT val,
 
17773
-                     rtx reg2, rtx rreg)
 
17774
+                     rtx reg2, rtx rreg, rtx split_reg)
 
17775
 {
 
17776
   rtx real, temp;
 
17777
 
 
17778
@@ -19138,6 +21598,11 @@
 
17779
          }
 
17780
     }
 
17781
 
 
17782
+  /* If a store insn has been split into multiple insns, the
 
17783
+     true source register is given by split_reg.  */
 
17784
+  if (split_reg != NULL_RTX)
 
17785
+    real = gen_rtx_SET (VOIDmode, SET_DEST (real), split_reg);
 
17786
+
 
17787
   RTX_FRAME_RELATED_P (insn) = 1;
 
17788
   add_reg_note (insn, REG_FRAME_RELATED_EXPR, real);
 
17789
 
 
17790
@@ -19245,7 +21710,7 @@
 
17791
   reg = gen_rtx_REG (mode, regno);
 
17792
   insn = emit_insn (gen_frame_store (reg, frame_reg, offset));
 
17793
   return rs6000_frame_related (insn, frame_reg, frame_reg_to_sp,
 
17794
-                              NULL_RTX, NULL_RTX);
 
17795
+                              NULL_RTX, NULL_RTX, NULL_RTX);
 
17796
 }
 
17797
 
 
17798
 /* Emit an offset memory reference suitable for a frame store, while
 
17799
@@ -19361,7 +21826,7 @@
 
17800
       if ((sel & SAVRES_LR))
 
17801
        suffix = "_x";
 
17802
     }
 
17803
-  else if (DEFAULT_ABI == ABI_AIX)
 
17804
+  else if (DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_ELFv2)
 
17805
     {
 
17806
 #if !defined (POWERPC_LINUX) && !defined (POWERPC_FREEBSD)
 
17807
       /* No out-of-line save/restore routines for GPRs on AIX.  */
 
17808
@@ -19502,7 +21967,7 @@
 
17809
 static inline unsigned
 
17810
 ptr_regno_for_savres (int sel)
 
17811
 {
 
17812
-  if (DEFAULT_ABI == ABI_AIX)
 
17813
+  if (DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_ELFv2)
 
17814
     return (sel & SAVRES_REG) == SAVRES_FPR || (sel & SAVRES_LR) ? 1 : 12;
 
17815
   return DEFAULT_ABI == ABI_DARWIN && (sel & SAVRES_REG) == SAVRES_FPR ? 1 : 11;
 
17816
 }
 
17817
@@ -19587,6 +22052,43 @@
 
17818
   return insn;
 
17819
 }
 
17820
 
 
17821
+/* Emit code to store CR fields that need to be saved into REG.  */
 
17822
+
 
17823
+static void
 
17824
+rs6000_emit_move_from_cr (rtx reg)
 
17825
+{
 
17826
+  /* Only the ELFv2 ABI allows storing only selected fields.  */
 
17827
+  if (DEFAULT_ABI == ABI_ELFv2 && TARGET_MFCRF)
 
17828
+    {
 
17829
+      int i, cr_reg[8], count = 0;
 
17830
+
 
17831
+      /* Collect CR fields that must be saved.  */
 
17832
+      for (i = 0; i < 8; i++)
 
17833
+       if (save_reg_p (CR0_REGNO + i))
 
17834
+         cr_reg[count++] = i;
 
17835
+
 
17836
+      /* If it's just a single one, use mfcrf.  */
 
17837
+      if (count == 1)
 
17838
+       {
 
17839
+         rtvec p = rtvec_alloc (1);
 
17840
+         rtvec r = rtvec_alloc (2);
 
17841
+         RTVEC_ELT (r, 0) = gen_rtx_REG (CCmode, CR0_REGNO + cr_reg[0]);
 
17842
+         RTVEC_ELT (r, 1) = GEN_INT (1 << (7 - cr_reg[0]));
 
17843
+         RTVEC_ELT (p, 0)
 
17844
+           = gen_rtx_SET (VOIDmode, reg,
 
17845
+                          gen_rtx_UNSPEC (SImode, r, UNSPEC_MOVESI_FROM_CR));
 
17846
+
 
17847
+         emit_insn (gen_rtx_PARALLEL (VOIDmode, p));
 
17848
+         return;
 
17849
+       }
 
17850
+
 
17851
+      /* ??? It might be better to handle count == 2 / 3 cases here
 
17852
+        as well, using logical operations to combine the values.  */
 
17853
+    }
 
17854
+
 
17855
+  emit_insn (gen_movesi_from_cr (reg));
 
17856
+}
 
17857
+
 
17858
 /* Determine whether the gp REG is really used.  */
 
17859
 
 
17860
 static bool
 
17861
@@ -19652,6 +22154,17 @@
 
17862
 #define NOT_INUSE(R) do {} while (0)
 
17863
 #endif
 
17864
 
 
17865
+  if (DEFAULT_ABI == ABI_ELFv2)
 
17866
+    {
 
17867
+      cfun->machine->r2_setup_needed = df_regs_ever_live_p (TOC_REGNUM);
 
17868
+
 
17869
+      /* With -mminimal-toc we may generate an extra use of r2 below.  */
 
17870
+      if (!TARGET_SINGLE_PIC_BASE
 
17871
+         && TARGET_TOC && TARGET_MINIMAL_TOC && get_pool_size () != 0)
 
17872
+       cfun->machine->r2_setup_needed = true;
 
17873
+    }
 
17874
+
 
17875
+
 
17876
   if (flag_stack_usage_info)
 
17877
     current_function_static_stack_size = info->total_size;
 
17878
 
 
17879
@@ -19766,7 +22279,7 @@
 
17880
 
 
17881
       insn = emit_insn (gen_rtx_PARALLEL (VOIDmode, p));
 
17882
       rs6000_frame_related (insn, frame_reg_rtx, sp_off - frame_off,
 
17883
-                           treg, GEN_INT (-info->total_size));
 
17884
+                           treg, GEN_INT (-info->total_size), NULL_RTX);
 
17885
       sp_off = frame_off = info->total_size;
 
17886
     }
 
17887
 
 
17888
@@ -19851,14 +22364,14 @@
 
17889
 
 
17890
          insn = emit_move_insn (mem, reg);
 
17891
          rs6000_frame_related (insn, frame_reg_rtx, sp_off - frame_off,
 
17892
-                               NULL_RTX, NULL_RTX);
 
17893
+                               NULL_RTX, NULL_RTX, NULL_RTX);
 
17894
          END_USE (0);
 
17895
        }
 
17896
     }
 
17897
 
 
17898
   /* If we need to save CR, put it into r12 or r11.  Choose r12 except when
 
17899
      r12 will be needed by out-of-line gpr restore.  */
 
17900
-  cr_save_regno = (DEFAULT_ABI == ABI_AIX
 
17901
+  cr_save_regno = ((DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_ELFv2)
 
17902
                   && !(strategy & (SAVE_INLINE_GPRS
 
17903
                                    | SAVE_NOINLINE_GPRS_SAVES_LR))
 
17904
                   ? 11 : 12);
 
17905
@@ -19867,21 +22380,9 @@
 
17906
       && REGNO (frame_reg_rtx) != cr_save_regno
 
17907
       && !(using_static_chain_p && cr_save_regno == 11))
 
17908
     {
 
17909
-      rtx set;
 
17910
-
 
17911
       cr_save_rtx = gen_rtx_REG (SImode, cr_save_regno);
 
17912
       START_USE (cr_save_regno);
 
17913
-      insn = emit_insn (gen_movesi_from_cr (cr_save_rtx));
 
17914
-      RTX_FRAME_RELATED_P (insn) = 1;
 
17915
-      /* Now, there's no way that dwarf2out_frame_debug_expr is going
 
17916
-        to understand '(unspec:SI [(reg:CC 68) ...] UNSPEC_MOVESI_FROM_CR)'.
 
17917
-        But that's OK.  All we have to do is specify that _one_ condition
 
17918
-        code register is saved in this stack slot.  The thrower's epilogue
 
17919
-        will then restore all the call-saved registers.
 
17920
-        We use CR2_REGNO (70) to be compatible with gcc-2.95 on Linux.  */
 
17921
-      set = gen_rtx_SET (VOIDmode, cr_save_rtx,
 
17922
-                        gen_rtx_REG (SImode, CR2_REGNO));
 
17923
-      add_reg_note (insn, REG_FRAME_RELATED_EXPR, set);
 
17924
+      rs6000_emit_move_from_cr (cr_save_rtx);
 
17925
     }
 
17926
 
 
17927
   /* Do any required saving of fpr's.  If only one or two to save, do
 
17928
@@ -19919,7 +22420,7 @@
 
17929
                                     info->lr_save_offset,
 
17930
                                     DFmode, sel);
 
17931
       rs6000_frame_related (insn, ptr_reg, sp_off,
 
17932
-                           NULL_RTX, NULL_RTX);
 
17933
+                           NULL_RTX, NULL_RTX, NULL_RTX);
 
17934
       if (lr)
 
17935
        END_USE (0);
 
17936
     }
 
17937
@@ -19998,7 +22499,7 @@
 
17938
                                         SAVRES_SAVE | SAVRES_GPR);
 
17939
 
 
17940
          rs6000_frame_related (insn, spe_save_area_ptr, sp_off - save_off,
 
17941
-                               NULL_RTX, NULL_RTX);
 
17942
+                               NULL_RTX, NULL_RTX, NULL_RTX);
 
17943
        }
 
17944
 
 
17945
       /* Move the static chain pointer back.  */
 
17946
@@ -20048,7 +22549,7 @@
 
17947
                                     info->lr_save_offset + ptr_off,
 
17948
                                     reg_mode, sel);
 
17949
       rs6000_frame_related (insn, ptr_reg, sp_off - ptr_off,
 
17950
-                           NULL_RTX, NULL_RTX);
 
17951
+                           NULL_RTX, NULL_RTX, NULL_RTX);
 
17952
       if (lr)
 
17953
        END_USE (0);
 
17954
     }
 
17955
@@ -20064,7 +22565,7 @@
 
17956
                             info->gp_save_offset + frame_off + reg_size * i);
 
17957
       insn = emit_insn (gen_rtx_PARALLEL (VOIDmode, p));
 
17958
       rs6000_frame_related (insn, frame_reg_rtx, sp_off - frame_off,
 
17959
-                           NULL_RTX, NULL_RTX);
 
17960
+                           NULL_RTX, NULL_RTX, NULL_RTX);
 
17961
     }
 
17962
   else if (!WORLD_SAVE_P (info))
 
17963
     {
 
17964
@@ -20133,7 +22634,8 @@
 
17965
         be updated if we arrived at this function via a plt call or
 
17966
         toc adjusting stub.  */
 
17967
       emit_move_insn (tmp_reg_si, gen_rtx_MEM (SImode, tmp_reg));
 
17968
-      toc_restore_insn = TARGET_32BIT ? 0x80410014 : 0xE8410028;
 
17969
+      toc_restore_insn = ((TARGET_32BIT ? 0x80410000 : 0xE8410000)
 
17970
+                         + RS6000_TOC_SAVE_SLOT);
 
17971
       hi = gen_int_mode (toc_restore_insn & ~0xffff, SImode);
 
17972
       emit_insn (gen_xorsi3 (tmp_reg_si, tmp_reg_si, hi));
 
17973
       compare_result = gen_rtx_REG (CCUNSmode, CR0_REGNO);
 
17974
@@ -20152,7 +22654,7 @@
 
17975
       LABEL_NUSES (toc_save_done) += 1;
 
17976
 
 
17977
       save_insn = emit_frame_save (frame_reg_rtx, reg_mode,
 
17978
-                                  TOC_REGNUM, frame_off + 5 * reg_size,
 
17979
+                                  TOC_REGNUM, frame_off + RS6000_TOC_SAVE_SLOT,
 
17980
                                   sp_off - frame_off);
 
17981
 
 
17982
       emit_label (toc_save_done);
 
17983
@@ -20192,28 +22694,123 @@
 
17984
       rtx addr = gen_rtx_PLUS (Pmode, frame_reg_rtx,
 
17985
                               GEN_INT (info->cr_save_offset + frame_off));
 
17986
       rtx mem = gen_frame_mem (SImode, addr);
 
17987
-      /* See the large comment above about why CR2_REGNO is used.  */
 
17988
-      rtx magic_eh_cr_reg = gen_rtx_REG (SImode, CR2_REGNO);
 
17989
 
 
17990
       /* If we didn't copy cr before, do so now using r0.  */
 
17991
       if (cr_save_rtx == NULL_RTX)
 
17992
        {
 
17993
-         rtx set;
 
17994
-
 
17995
          START_USE (0);
 
17996
          cr_save_rtx = gen_rtx_REG (SImode, 0);
 
17997
-         insn = emit_insn (gen_movesi_from_cr (cr_save_rtx));
 
17998
-         RTX_FRAME_RELATED_P (insn) = 1;
 
17999
-         set = gen_rtx_SET (VOIDmode, cr_save_rtx, magic_eh_cr_reg);
 
18000
-         add_reg_note (insn, REG_FRAME_RELATED_EXPR, set);
 
18001
+         rs6000_emit_move_from_cr (cr_save_rtx);
 
18002
        }
 
18003
-      insn = emit_move_insn (mem, cr_save_rtx);
 
18004
+
 
18005
+      /* Saving CR requires a two-instruction sequence: one instruction
 
18006
+        to move the CR to a general-purpose register, and a second
 
18007
+        instruction that stores the GPR to memory.
 
18008
+
 
18009
+        We do not emit any DWARF CFI records for the first of these,
 
18010
+        because we cannot properly represent the fact that CR is saved in
 
18011
+        a register.  One reason is that we cannot express that multiple
 
18012
+        CR fields are saved; another reason is that on 64-bit, the size
 
18013
+        of the CR register in DWARF (4 bytes) differs from the size of
 
18014
+        a general-purpose register.
 
18015
+
 
18016
+        This means if any intervening instruction were to clobber one of
 
18017
+        the call-saved CR fields, we'd have incorrect CFI.  To prevent
 
18018
+        this from happening, we mark the store to memory as a use of
 
18019
+        those CR fields, which prevents any such instruction from being
 
18020
+        scheduled in between the two instructions.  */
 
18021
+      rtx crsave_v[9];
 
18022
+      int n_crsave = 0;
 
18023
+      int i;
 
18024
+
 
18025
+      crsave_v[n_crsave++] = gen_rtx_SET (VOIDmode, mem, cr_save_rtx);
 
18026
+      for (i = 0; i < 8; i++)
 
18027
+       if (save_reg_p (CR0_REGNO + i))
 
18028
+         crsave_v[n_crsave++]
 
18029
+           = gen_rtx_USE (VOIDmode, gen_rtx_REG (CCmode, CR0_REGNO + i));
 
18030
+
 
18031
+      insn = emit_insn (gen_rtx_PARALLEL (VOIDmode,
 
18032
+                                         gen_rtvec_v (n_crsave, crsave_v)));
 
18033
       END_USE (REGNO (cr_save_rtx));
 
18034
 
 
18035
-      rs6000_frame_related (insn, frame_reg_rtx, sp_off - frame_off,
 
18036
-                           NULL_RTX, NULL_RTX);
 
18037
+      /* Now, there's no way that dwarf2out_frame_debug_expr is going to
 
18038
+        understand '(unspec:SI [(reg:CC 68) ...] UNSPEC_MOVESI_FROM_CR)',
 
18039
+        so we need to construct a frame expression manually.  */
 
18040
+      RTX_FRAME_RELATED_P (insn) = 1;
 
18041
+
 
18042
+      /* Update address to be stack-pointer relative, like
 
18043
+        rs6000_frame_related would do.  */
 
18044
+      addr = gen_rtx_PLUS (Pmode, gen_rtx_REG (Pmode, STACK_POINTER_REGNUM),
 
18045
+                          GEN_INT (info->cr_save_offset + sp_off));
 
18046
+      mem = gen_frame_mem (SImode, addr);
 
18047
+
 
18048
+      if (DEFAULT_ABI == ABI_ELFv2)
 
18049
+       {
 
18050
+         /* In the ELFv2 ABI we generate separate CFI records for each
 
18051
+            CR field that was actually saved.  They all point to the
 
18052
+            same 32-bit stack slot.  */
 
18053
+         rtx crframe[8];
 
18054
+         int n_crframe = 0;
 
18055
+
 
18056
+         for (i = 0; i < 8; i++)
 
18057
+           if (save_reg_p (CR0_REGNO + i))
 
18058
+             {
 
18059
+               crframe[n_crframe]
 
18060
+                 = gen_rtx_SET (VOIDmode, mem,
 
18061
+                                gen_rtx_REG (SImode, CR0_REGNO + i));
 
18062
+
 
18063
+               RTX_FRAME_RELATED_P (crframe[n_crframe]) = 1;
 
18064
+               n_crframe++;
 
18065
+            }
 
18066
+
 
18067
+         add_reg_note (insn, REG_FRAME_RELATED_EXPR,
 
18068
+                       gen_rtx_PARALLEL (VOIDmode,
 
18069
+                                         gen_rtvec_v (n_crframe, crframe)));
 
18070
+       }
 
18071
+      else
 
18072
+       {
 
18073
+         /* In other ABIs, by convention, we use a single CR regnum to
 
18074
+            represent the fact that all call-saved CR fields are saved.
 
18075
+            We use CR2_REGNO to be compatible with gcc-2.95 on Linux.  */
 
18076
+         rtx set = gen_rtx_SET (VOIDmode, mem,
 
18077
+                                gen_rtx_REG (SImode, CR2_REGNO));
 
18078
+         add_reg_note (insn, REG_FRAME_RELATED_EXPR, set);
 
18079
+       }
 
18080
     }
 
18081
 
 
18082
+  /* In the ELFv2 ABI we need to save all call-saved CR fields into
 
18083
+     *separate* slots if the routine calls __builtin_eh_return, so
 
18084
+     that they can be independently restored by the unwinder.  */
 
18085
+  if (DEFAULT_ABI == ABI_ELFv2 && crtl->calls_eh_return)
 
18086
+    {
 
18087
+      int i, cr_off = info->ehcr_offset;
 
18088
+      rtx crsave;
 
18089
+
 
18090
+      /* ??? We might get better performance by using multiple mfocrf
 
18091
+        instructions.  */
 
18092
+      crsave = gen_rtx_REG (SImode, 0);
 
18093
+      emit_insn (gen_movesi_from_cr (crsave));
 
18094
+
 
18095
+      for (i = 0; i < 8; i++)
 
18096
+       if (!call_used_regs[CR0_REGNO + i])
 
18097
+         {
 
18098
+           rtvec p = rtvec_alloc (2);
 
18099
+           RTVEC_ELT (p, 0)
 
18100
+             = gen_frame_store (crsave, frame_reg_rtx, cr_off + frame_off);
 
18101
+           RTVEC_ELT (p, 1)
 
18102
+             = gen_rtx_USE (VOIDmode, gen_rtx_REG (CCmode, CR0_REGNO + i));
 
18103
+
 
18104
+           insn = emit_insn (gen_rtx_PARALLEL (VOIDmode, p));
 
18105
+
 
18106
+           RTX_FRAME_RELATED_P (insn) = 1;
 
18107
+           add_reg_note (insn, REG_FRAME_RELATED_EXPR,
 
18108
+                         gen_frame_store (gen_rtx_REG (SImode, CR0_REGNO + i),
 
18109
+                                          sp_reg_rtx, cr_off + sp_off));
 
18110
+
 
18111
+           cr_off += reg_size;
 
18112
+         }
 
18113
+    }
 
18114
+
 
18115
   /* Update stack and set back pointer unless this is V.4,
 
18116
      for which it was done previously.  */
 
18117
   if (!WORLD_SAVE_P (info) && info->push_p
 
18118
@@ -20291,7 +22888,7 @@
 
18119
                                     info->altivec_save_offset + ptr_off,
 
18120
                                     0, V4SImode, SAVRES_SAVE | SAVRES_VR);
 
18121
       rs6000_frame_related (insn, scratch_reg, sp_off - ptr_off,
 
18122
-                           NULL_RTX, NULL_RTX);
 
18123
+                           NULL_RTX, NULL_RTX, NULL_RTX);
 
18124
       if (REGNO (frame_reg_rtx) == REGNO (scratch_reg))
 
18125
        {
 
18126
          /* The oddity mentioned above clobbered our frame reg.  */
 
18127
@@ -20307,7 +22904,7 @@
 
18128
       for (i = info->first_altivec_reg_save; i <= LAST_ALTIVEC_REGNO; ++i)
 
18129
        if (info->vrsave_mask & ALTIVEC_REG_BIT (i))
 
18130
          {
 
18131
-           rtx areg, savereg, mem;
 
18132
+           rtx areg, savereg, mem, split_reg;
 
18133
            int offset;
 
18134
 
 
18135
            offset = (info->altivec_save_offset + frame_off
 
18136
@@ -20325,8 +22922,18 @@
 
18137
 
 
18138
            insn = emit_move_insn (mem, savereg);
 
18139
 
 
18140
+           /* When we split a VSX store into two insns, we need to make
 
18141
+              sure the DWARF info knows which register we are storing.
 
18142
+              Pass it in to be used on the appropriate note.  */
 
18143
+           if (!BYTES_BIG_ENDIAN
 
18144
+               && GET_CODE (PATTERN (insn)) == SET
 
18145
+               && GET_CODE (SET_SRC (PATTERN (insn))) == VEC_SELECT)
 
18146
+             split_reg = savereg;
 
18147
+           else
 
18148
+             split_reg = NULL_RTX;
 
18149
+
 
18150
            rs6000_frame_related (insn, frame_reg_rtx, sp_off - frame_off,
 
18151
-                                 areg, GEN_INT (offset));
 
18152
+                                 areg, GEN_INT (offset), split_reg);
 
18153
          }
 
18154
     }
 
18155
 
 
18156
@@ -20350,7 +22957,8 @@
 
18157
         be using r12 as frame_reg_rtx and r11 as the static chain
 
18158
         pointer for nested functions.  */
 
18159
       save_regno = 12;
 
18160
-      if (DEFAULT_ABI == ABI_AIX && !using_static_chain_p)
 
18161
+      if ((DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_ELFv2)
 
18162
+         && !using_static_chain_p)
 
18163
        save_regno = 11;
 
18164
       else if (REGNO (frame_reg_rtx) == 12)
 
18165
        {
 
18166
@@ -20389,7 +22997,7 @@
 
18167
         can use register 0.  This allows us to use a plain 'blr' to return
 
18168
         from the procedure more often.  */
 
18169
       int save_LR_around_toc_setup = (TARGET_ELF
 
18170
-                                     && DEFAULT_ABI != ABI_AIX
 
18171
+                                     && DEFAULT_ABI == ABI_V4
 
18172
                                      && flag_pic
 
18173
                                      && ! info->lr_save_p
 
18174
                                      && EDGE_COUNT (EXIT_BLOCK_PTR->preds) > 0);
 
18175
@@ -20451,7 +23059,7 @@
 
18176
   if (rs6000_save_toc_in_prologue_p ())
 
18177
     {
 
18178
       rtx reg = gen_rtx_REG (reg_mode, TOC_REGNUM);
 
18179
-      emit_insn (gen_frame_store (reg, sp_reg_rtx, 5 * reg_size));
 
18180
+      emit_insn (gen_frame_store (reg, sp_reg_rtx, RS6000_TOC_SAVE_SLOT));
 
18181
     }
 
18182
 }
 
18183
 
 
18184
@@ -20492,6 +23100,49 @@
 
18185
        }
 
18186
     }
 
18187
 
 
18188
+  /* ELFv2 ABI r2 setup code and local entry point.  This must follow
 
18189
+     immediately after the global entry point label.  */
 
18190
+  if (DEFAULT_ABI == ABI_ELFv2 && cfun->machine->r2_setup_needed)
 
18191
+    {
 
18192
+      const char *name = XSTR (XEXP (DECL_RTL (current_function_decl), 0), 0);
 
18193
+
 
18194
+      fprintf (file, "0:\taddis 2,12,.TOC.-0b@ha\n");
 
18195
+      fprintf (file, "\taddi 2,2,.TOC.-0b@l\n");
 
18196
+
 
18197
+      fputs ("\t.localentry\t", file);
 
18198
+      assemble_name (file, name);
 
18199
+      fputs (",.-", file);
 
18200
+      assemble_name (file, name);
 
18201
+      fputs ("\n", file);
 
18202
+    }
 
18203
+
 
18204
+  /* Output -mprofile-kernel code.  This needs to be done here instead of
 
18205
+     in output_function_profile since it must go after the ELFv2 ABI
 
18206
+     local entry point.  */
 
18207
+  if (TARGET_PROFILE_KERNEL)
 
18208
+    {
 
18209
+      gcc_assert (DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_ELFv2);
 
18210
+      gcc_assert (!TARGET_32BIT);
 
18211
+
 
18212
+      asm_fprintf (file, "\tmflr %s\n", reg_names[0]);
 
18213
+      asm_fprintf (file, "\tstd %s,16(%s)\n", reg_names[0], reg_names[1]);
 
18214
+
 
18215
+      /* In the ELFv2 ABI we have no compiler stack word.  It must be
 
18216
+        the resposibility of _mcount to preserve the static chain
 
18217
+        register if required.  */
 
18218
+      if (DEFAULT_ABI != ABI_ELFv2
 
18219
+         && cfun->static_chain_decl != NULL)
 
18220
+       {
 
18221
+         asm_fprintf (file, "\tstd %s,24(%s)\n",
 
18222
+                      reg_names[STATIC_CHAIN_REGNUM], reg_names[1]);
 
18223
+         fprintf (file, "\tbl %s\n", RS6000_MCOUNT);
 
18224
+         asm_fprintf (file, "\tld %s,24(%s)\n",
 
18225
+                      reg_names[STATIC_CHAIN_REGNUM], reg_names[1]);
 
18226
+       }
 
18227
+      else
 
18228
+       fprintf (file, "\tbl %s\n", RS6000_MCOUNT);
 
18229
+    }
 
18230
+
 
18231
   rs6000_pic_labelno++;
 
18232
 }
 
18233
 
 
18234
@@ -20544,6 +23195,7 @@
 
18235
 
 
18236
   if (using_mfcr_multiple && count > 1)
 
18237
     {
 
18238
+      rtx insn;
 
18239
       rtvec p;
 
18240
       int ndx;
 
18241
 
 
18242
@@ -20561,16 +23213,43 @@
 
18243
                           gen_rtx_UNSPEC (CCmode, r, UNSPEC_MOVESI_TO_CR));
 
18244
            ndx++;
 
18245
          }
 
18246
-      emit_insn (gen_rtx_PARALLEL (VOIDmode, p));
 
18247
+      insn = emit_insn (gen_rtx_PARALLEL (VOIDmode, p));
 
18248
       gcc_assert (ndx == count);
 
18249
+
 
18250
+      /* For the ELFv2 ABI we generate a CFA_RESTORE for each
 
18251
+        CR field separately.  */
 
18252
+      if (!exit_func && DEFAULT_ABI == ABI_ELFv2 && flag_shrink_wrap)
 
18253
+       {
 
18254
+         for (i = 0; i < 8; i++)
 
18255
+           if (save_reg_p (CR0_REGNO + i))
 
18256
+             add_reg_note (insn, REG_CFA_RESTORE,
 
18257
+                           gen_rtx_REG (SImode, CR0_REGNO + i));
 
18258
+
 
18259
+         RTX_FRAME_RELATED_P (insn) = 1;
 
18260
+       }
 
18261
     }
 
18262
   else
 
18263
     for (i = 0; i < 8; i++)
 
18264
       if (save_reg_p (CR0_REGNO + i))
 
18265
-       emit_insn (gen_movsi_to_cr_one (gen_rtx_REG (CCmode, CR0_REGNO + i),
 
18266
-                                       reg));
 
18267
+       {
 
18268
+         rtx insn = emit_insn (gen_movsi_to_cr_one
 
18269
+                                (gen_rtx_REG (CCmode, CR0_REGNO + i), reg));
 
18270
 
 
18271
-  if (!exit_func && (DEFAULT_ABI == ABI_V4 || flag_shrink_wrap))
 
18272
+         /* For the ELFv2 ABI we generate a CFA_RESTORE for each
 
18273
+            CR field separately, attached to the insn that in fact
 
18274
+            restores this particular CR field.  */
 
18275
+         if (!exit_func && DEFAULT_ABI == ABI_ELFv2 && flag_shrink_wrap)
 
18276
+           {
 
18277
+             add_reg_note (insn, REG_CFA_RESTORE,
 
18278
+                           gen_rtx_REG (SImode, CR0_REGNO + i));
 
18279
+
 
18280
+             RTX_FRAME_RELATED_P (insn) = 1;
 
18281
+           }
 
18282
+       }
 
18283
+
 
18284
+  /* For other ABIs, we just generate a single CFA_RESTORE for CR2.  */
 
18285
+  if (!exit_func && DEFAULT_ABI != ABI_ELFv2
 
18286
+      && (DEFAULT_ABI == ABI_V4 || flag_shrink_wrap))
 
18287
     {
 
18288
       rtx insn = get_last_insn ();
 
18289
       rtx cr = gen_rtx_REG (SImode, CR2_REGNO);
 
18290
@@ -20611,10 +23290,22 @@
 
18291
 static rtx
 
18292
 add_crlr_cfa_restore (const rs6000_stack_t *info, rtx cfa_restores)
 
18293
 {
 
18294
-  if (info->cr_save_p)
 
18295
+  if (DEFAULT_ABI == ABI_ELFv2)
 
18296
+    {
 
18297
+      int i;
 
18298
+      for (i = 0; i < 8; i++)
 
18299
+       if (save_reg_p (CR0_REGNO + i))
 
18300
+         {
 
18301
+           rtx cr = gen_rtx_REG (SImode, CR0_REGNO + i);
 
18302
+           cfa_restores = alloc_reg_note (REG_CFA_RESTORE, cr,
 
18303
+                                          cfa_restores);
 
18304
+         }
 
18305
+    }
 
18306
+  else if (info->cr_save_p)
 
18307
     cfa_restores = alloc_reg_note (REG_CFA_RESTORE,
 
18308
                                   gen_rtx_REG (SImode, CR2_REGNO),
 
18309
                                   cfa_restores);
 
18310
+
 
18311
   if (info->lr_save_p)
 
18312
     cfa_restores = alloc_reg_note (REG_CFA_RESTORE,
 
18313
                                   gen_rtx_REG (Pmode, LR_REGNO),
 
18314
@@ -21112,6 +23803,35 @@
 
18315
               || (!restoring_GPRs_inline
 
18316
                   && info->first_fp_reg_save == 64));
 
18317
 
 
18318
+  /* In the ELFv2 ABI we need to restore all call-saved CR fields from
 
18319
+     *separate* slots if the routine calls __builtin_eh_return, so
 
18320
+     that they can be independently restored by the unwinder.  */
 
18321
+  if (DEFAULT_ABI == ABI_ELFv2 && crtl->calls_eh_return)
 
18322
+    {
 
18323
+      int i, cr_off = info->ehcr_offset;
 
18324
+
 
18325
+      for (i = 0; i < 8; i++)
 
18326
+       if (!call_used_regs[CR0_REGNO + i])
 
18327
+         {
 
18328
+           rtx reg = gen_rtx_REG (SImode, 0);
 
18329
+           emit_insn (gen_frame_load (reg, frame_reg_rtx,
 
18330
+                                      cr_off + frame_off));
 
18331
+
 
18332
+           insn = emit_insn (gen_movsi_to_cr_one
 
18333
+                               (gen_rtx_REG (CCmode, CR0_REGNO + i), reg));
 
18334
+
 
18335
+           if (!exit_func && flag_shrink_wrap)
 
18336
+             {
 
18337
+               add_reg_note (insn, REG_CFA_RESTORE,
 
18338
+                             gen_rtx_REG (SImode, CR0_REGNO + i));
 
18339
+
 
18340
+               RTX_FRAME_RELATED_P (insn) = 1;
 
18341
+             }
 
18342
+
 
18343
+           cr_off += reg_size;
 
18344
+         }
 
18345
+    }
 
18346
+
 
18347
   /* Get the old lr if we saved it.  If we are restoring registers
 
18348
      out-of-line, then the out-of-line routines can do this for us.  */
 
18349
   if (restore_lr && restoring_GPRs_inline)
 
18350
@@ -21155,7 +23875,7 @@
 
18351
        {
 
18352
          rtx reg = gen_rtx_REG (reg_mode, 2);
 
18353
          emit_insn (gen_frame_load (reg, frame_reg_rtx,
 
18354
-                                    frame_off + 5 * reg_size));
 
18355
+                                    frame_off + RS6000_TOC_SAVE_SLOT));
 
18356
        }
 
18357
 
 
18358
       for (i = 0; ; ++i)
 
18359
@@ -21441,6 +24161,7 @@
 
18360
       if (! restoring_FPRs_inline)
 
18361
        {
 
18362
          int i;
 
18363
+         int reg;
 
18364
          rtx sym;
 
18365
 
 
18366
          if (flag_shrink_wrap)
 
18367
@@ -21449,10 +24170,9 @@
 
18368
          sym = rs6000_savres_routine_sym (info,
 
18369
                                           SAVRES_FPR | (lr ? SAVRES_LR : 0));
 
18370
          RTVEC_ELT (p, 2) = gen_rtx_USE (VOIDmode, sym);
 
18371
-         RTVEC_ELT (p, 3) = gen_rtx_USE (VOIDmode,
 
18372
-                                         gen_rtx_REG (Pmode,
 
18373
-                                                      DEFAULT_ABI == ABI_AIX
 
18374
-                                                      ? 1 : 11));
 
18375
+         reg = (DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_ELFv2)? 1 : 11;
 
18376
+         RTVEC_ELT (p, 3) = gen_rtx_USE (VOIDmode, gen_rtx_REG (Pmode, reg));
 
18377
+
 
18378
          for (i = 0; i < 64 - info->first_fp_reg_save; i++)
 
18379
            {
 
18380
              rtx reg = gen_rtx_REG (DFmode, info->first_fp_reg_save + i);
 
18381
@@ -21530,7 +24250,8 @@
 
18382
 
 
18383
      System V.4 Powerpc's (and the embedded ABI derived from it) use a
 
18384
      different traceback table.  */
 
18385
-  if (DEFAULT_ABI == ABI_AIX && ! flag_inhibit_size_directive
 
18386
+  if ((DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_ELFv2)
 
18387
+      && ! flag_inhibit_size_directive
 
18388
       && rs6000_traceback != traceback_none && !cfun->is_thunk)
 
18389
     {
 
18390
       const char *fname = NULL;
 
18391
@@ -21858,6 +24579,12 @@
 
18392
   SIBLING_CALL_P (insn) = 1;
 
18393
   emit_barrier ();
 
18394
 
 
18395
+  /* Ensure we have a global entry point for the thunk.   ??? We could
 
18396
+     avoid that if the target routine doesn't need a global entry point,
 
18397
+     but we do not know whether this is the case at this point.  */
 
18398
+  if (DEFAULT_ABI == ABI_ELFv2)
 
18399
+    cfun->machine->r2_setup_needed = true;
 
18400
+
 
18401
   /* Run just enough of rest_of_compilation to get the insns emitted.
 
18402
      There's not really enough bulk here to make other passes such as
 
18403
      instruction scheduling worth while.  Note that use_thunk calls
 
18404
@@ -22554,7 +25281,7 @@
 
18405
   if (TARGET_PROFILE_KERNEL)
 
18406
     return;
 
18407
 
 
18408
-  if (DEFAULT_ABI == ABI_AIX)
 
18409
+  if (DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_ELFv2)
 
18410
     {
 
18411
 #ifndef NO_PROFILE_COUNTERS
 
18412
 # define NO_PROFILE_COUNTERS 0
 
18413
@@ -22698,29 +25425,9 @@
 
18414
       break;
 
18415
 
 
18416
     case ABI_AIX:
 
18417
+    case ABI_ELFv2:
 
18418
     case ABI_DARWIN:
 
18419
-      if (!TARGET_PROFILE_KERNEL)
 
18420
-       {
 
18421
-         /* Don't do anything, done in output_profile_hook ().  */
 
18422
-       }
 
18423
-      else
 
18424
-       {
 
18425
-         gcc_assert (!TARGET_32BIT);
 
18426
-
 
18427
-         asm_fprintf (file, "\tmflr %s\n", reg_names[0]);
 
18428
-         asm_fprintf (file, "\tstd %s,16(%s)\n", reg_names[0], reg_names[1]);
 
18429
-
 
18430
-         if (cfun->static_chain_decl != NULL)
 
18431
-           {
 
18432
-             asm_fprintf (file, "\tstd %s,24(%s)\n",
 
18433
-                          reg_names[STATIC_CHAIN_REGNUM], reg_names[1]);
 
18434
-             fprintf (file, "\tbl %s\n", RS6000_MCOUNT);
 
18435
-             asm_fprintf (file, "\tld %s,24(%s)\n",
 
18436
-                          reg_names[STATIC_CHAIN_REGNUM], reg_names[1]);
 
18437
-           }
 
18438
-         else
 
18439
-           fprintf (file, "\tbl %s\n", RS6000_MCOUNT);
 
18440
-       }
 
18441
+      /* Don't do anything, done in output_profile_hook ().  */
 
18442
       break;
 
18443
     }
 
18444
 }
 
18445
@@ -22846,6 +25553,7 @@
 
18446
                  || rs6000_cpu_attr == CPU_POWER4
 
18447
                  || rs6000_cpu_attr == CPU_POWER5
 
18448
                 || rs6000_cpu_attr == CPU_POWER7
 
18449
+                || rs6000_cpu_attr == CPU_POWER8
 
18450
                  || rs6000_cpu_attr == CPU_CELL)
 
18451
                 && recog_memoized (dep_insn)
 
18452
                 && (INSN_CODE (dep_insn) >= 0))
 
18453
@@ -23128,7 +25836,8 @@
 
18454
   if (rs6000_cpu_attr == CPU_CELL)
 
18455
     return get_attr_cell_micro (insn) == CELL_MICRO_ALWAYS;
 
18456
 
 
18457
-  if (rs6000_sched_groups)
 
18458
+  if (rs6000_sched_groups
 
18459
+      && (rs6000_cpu == PROCESSOR_POWER4 || rs6000_cpu == PROCESSOR_POWER5))
 
18460
     {
 
18461
       enum attr_type type = get_attr_type (insn);
 
18462
       if (type == TYPE_LOAD_EXT_U
 
18463
@@ -23153,7 +25862,8 @@
 
18464
       || GET_CODE (PATTERN (insn)) == CLOBBER)
 
18465
     return false;
 
18466
 
 
18467
-  if (rs6000_sched_groups)
 
18468
+  if (rs6000_sched_groups
 
18469
+      && (rs6000_cpu == PROCESSOR_POWER4 || rs6000_cpu == PROCESSOR_POWER5))
 
18470
     {
 
18471
       enum attr_type type = get_attr_type (insn);
 
18472
       if (type == TYPE_LOAD_U || type == TYPE_STORE_U
 
18473
@@ -23432,6 +26142,8 @@
 
18474
   case CPU_POWER6:
 
18475
   case CPU_POWER7:
 
18476
     return 5;
 
18477
+  case CPU_POWER8:
 
18478
+    return 7;
 
18479
   default:
 
18480
     return 1;
 
18481
   }
 
18482
@@ -24059,6 +26771,39 @@
 
18483
           break;
 
18484
         }
 
18485
       break;
 
18486
+    case PROCESSOR_POWER8:
 
18487
+      type = get_attr_type (insn);
 
18488
+
 
18489
+      switch (type)
 
18490
+        {
 
18491
+        case TYPE_CR_LOGICAL:
 
18492
+        case TYPE_DELAYED_CR:
 
18493
+        case TYPE_MFCR:
 
18494
+        case TYPE_MFCRF:
 
18495
+        case TYPE_MTCR:
 
18496
+        case TYPE_COMPARE:
 
18497
+        case TYPE_DELAYED_COMPARE:
 
18498
+        case TYPE_VAR_DELAYED_COMPARE:
 
18499
+        case TYPE_IMUL_COMPARE:
 
18500
+        case TYPE_LMUL_COMPARE:
 
18501
+        case TYPE_SYNC:
 
18502
+        case TYPE_ISYNC:
 
18503
+        case TYPE_LOAD_L:
 
18504
+        case TYPE_STORE_C:
 
18505
+        case TYPE_LOAD_U:
 
18506
+        case TYPE_LOAD_UX:
 
18507
+        case TYPE_LOAD_EXT:
 
18508
+        case TYPE_LOAD_EXT_U:
 
18509
+        case TYPE_LOAD_EXT_UX:
 
18510
+        case TYPE_STORE_UX:
 
18511
+        case TYPE_VECSTORE:
 
18512
+        case TYPE_MFJMPR:
 
18513
+        case TYPE_MTJMPR:
 
18514
+          return true;
 
18515
+        default:
 
18516
+          break;
 
18517
+        }
 
18518
+      break;
 
18519
     default:
 
18520
       break;
 
18521
     }
 
18522
@@ -24137,6 +26882,25 @@
 
18523
         break;
 
18524
     }
 
18525
     break;
 
18526
+  case PROCESSOR_POWER8:
 
18527
+    type = get_attr_type (insn);
 
18528
+
 
18529
+    switch (type)
 
18530
+      {
 
18531
+      case TYPE_MFCR:
 
18532
+      case TYPE_MTCR:
 
18533
+      case TYPE_ISYNC:
 
18534
+      case TYPE_SYNC:
 
18535
+      case TYPE_LOAD_L:
 
18536
+      case TYPE_STORE_C:
 
18537
+      case TYPE_LOAD_EXT_U:
 
18538
+      case TYPE_LOAD_EXT_UX:
 
18539
+      case TYPE_STORE_UX:
 
18540
+        return true;
 
18541
+      default:
 
18542
+        break;
 
18543
+    }
 
18544
+    break;
 
18545
   default:
 
18546
     break;
 
18547
   }
 
18548
@@ -24226,8 +26990,9 @@
 
18549
       if (can_issue_more && !is_branch_slot_insn (next_insn))
 
18550
        can_issue_more--;
 
18551
 
 
18552
-      /* Power6 and Power7 have special group ending nop. */
 
18553
-      if (rs6000_cpu_attr == CPU_POWER6 || rs6000_cpu_attr == CPU_POWER7)
 
18554
+      /* Do we have a special group ending nop? */
 
18555
+      if (rs6000_cpu_attr == CPU_POWER6 || rs6000_cpu_attr == CPU_POWER7
 
18556
+         || rs6000_cpu_attr == CPU_POWER8)
 
18557
        {
 
18558
          nop = gen_group_ending_nop ();
 
18559
          emit_insn_before (nop, next_insn);
 
18560
@@ -24598,6 +27363,11 @@
 
18561
       ret = (TARGET_32BIT) ? 12 : 24;
 
18562
       break;
 
18563
 
 
18564
+    case ABI_ELFv2:
 
18565
+      gcc_assert (!TARGET_32BIT);
 
18566
+      ret = 32;
 
18567
+      break;
 
18568
+
 
18569
     case ABI_DARWIN:
 
18570
     case ABI_V4:
 
18571
       ret = (TARGET_32BIT) ? 40 : 48;
 
18572
@@ -24653,6 +27423,7 @@
 
18573
       break;
 
18574
 
 
18575
     /* Under V.4/eabi/darwin, __trampoline_setup does the real work.  */
 
18576
+    case ABI_ELFv2:
 
18577
     case ABI_DARWIN:
 
18578
     case ABI_V4:
 
18579
       emit_library_call (gen_rtx_SYMBOL_REF (Pmode, "__trampoline_setup"),
 
18580
@@ -24947,7 +27718,7 @@
 
18581
 static void
 
18582
 rs6000_elf_output_toc_section_asm_op (const void *data ATTRIBUTE_UNUSED)
 
18583
 {
 
18584
-  if (DEFAULT_ABI == ABI_AIX
 
18585
+  if ((DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_ELFv2)
 
18586
       && TARGET_MINIMAL_TOC
 
18587
       && !TARGET_RELOCATABLE)
 
18588
     {
 
18589
@@ -24968,7 +27739,8 @@
 
18590
       else
 
18591
        fprintf (asm_out_file, "%s\n", MINIMAL_TOC_SECTION_ASM_OP);
 
18592
     }
 
18593
-  else if (DEFAULT_ABI == ABI_AIX && !TARGET_RELOCATABLE)
 
18594
+  else if ((DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_ELFv2)
 
18595
+          && !TARGET_RELOCATABLE)
 
18596
     fprintf (asm_out_file, "%s\n", TOC_SECTION_ASM_OP);
 
18597
   else
 
18598
     {
 
18599
@@ -25518,7 +28290,7 @@
 
18600
 {
 
18601
   if (flag_pic)
 
18602
     return 3;
 
18603
-  else if (DEFAULT_ABI == ABI_AIX)
 
18604
+  else if (DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_ELFv2)
 
18605
     return 2;
 
18606
   else
 
18607
     return 0;
 
18608
@@ -25594,7 +28366,7 @@
 
18609
 void
 
18610
 rs6000_elf_declare_function_name (FILE *file, const char *name, tree decl)
 
18611
 {
 
18612
-  if (TARGET_64BIT)
 
18613
+  if (TARGET_64BIT && DEFAULT_ABI != ABI_ELFv2)
 
18614
     {
 
18615
       fputs ("\t.section\t\".opd\",\"aw\"\n\t.align 3\n", file);
 
18616
       ASM_OUTPUT_LABEL (file, name);
 
18617
@@ -25660,8 +28432,7 @@
 
18618
       fprintf (file, "%s:\n", desc_name);
 
18619
       fprintf (file, "\t.long %s\n", orig_name);
 
18620
       fputs ("\t.long _GLOBAL_OFFSET_TABLE_\n", file);
 
18621
-      if (DEFAULT_ABI == ABI_AIX)
 
18622
-       fputs ("\t.long 0\n", file);
 
18623
+      fputs ("\t.long 0\n", file);
 
18624
       fprintf (file, "\t.previous\n");
 
18625
     }
 
18626
   ASM_OUTPUT_LABEL (file, name);
 
18627
@@ -25690,7 +28461,7 @@
 
18628
     }
 
18629
 #endif
 
18630
 #if defined (POWERPC_LINUX) || defined (POWERPC_FREEBSD)
 
18631
-  if (TARGET_32BIT)
 
18632
+  if (TARGET_32BIT || DEFAULT_ABI == ABI_ELFv2)
 
18633
     file_end_indicate_exec_stack ();
 
18634
 #endif
 
18635
 }
 
18636
@@ -26430,7 +29201,8 @@
 
18637
       /* For those processors that have slow LR/CTR moves, make them more
 
18638
          expensive than memory in order to bias spills to memory .*/
 
18639
       else if ((rs6000_cpu == PROCESSOR_POWER6
 
18640
-               || rs6000_cpu == PROCESSOR_POWER7)
 
18641
+               || rs6000_cpu == PROCESSOR_POWER7
 
18642
+               || rs6000_cpu == PROCESSOR_POWER8)
 
18643
               && reg_classes_intersect_p (rclass, LINK_OR_CTR_REGS))
 
18644
         ret = 6 * hard_regno_nregs[0][mode];
 
18645
 
 
18646
@@ -26440,7 +29212,7 @@
 
18647
     }
 
18648
 
 
18649
   /* If we have VSX, we can easily move between FPR or Altivec registers.  */
 
18650
-  else if (VECTOR_UNIT_VSX_P (mode)
 
18651
+  else if (VECTOR_MEM_VSX_P (mode)
 
18652
           && reg_classes_intersect_p (to, VSX_REGS)
 
18653
           && reg_classes_intersect_p (from, VSX_REGS))
 
18654
     ret = 2 * hard_regno_nregs[32][mode];
 
18655
@@ -26481,7 +29253,8 @@
 
18656
 
 
18657
   if (reg_classes_intersect_p (rclass, GENERAL_REGS))
 
18658
     ret = 4 * hard_regno_nregs[0][mode];
 
18659
-  else if (reg_classes_intersect_p (rclass, FLOAT_REGS))
 
18660
+  else if ((reg_classes_intersect_p (rclass, FLOAT_REGS)
 
18661
+           || reg_classes_intersect_p (rclass, VSX_REGS)))
 
18662
     ret = 4 * hard_regno_nregs[32][mode];
 
18663
   else if (reg_classes_intersect_p (rclass, ALTIVEC_REGS))
 
18664
     ret = 4 * hard_regno_nregs[FIRST_ALTIVEC_REGNO][mode];
 
18665
@@ -26643,54 +29416,26 @@
 
18666
   emit_insn (gen_rtx_SET (VOIDmode, dst, r));
 
18667
 }
 
18668
 
 
18669
-/* Newton-Raphson approximation of floating point divide with just 2 passes
 
18670
-   (either single precision floating point, or newer machines with higher
 
18671
-   accuracy estimates).  Support both scalar and vector divide.  Assumes no
 
18672
-   trapping math and finite arguments.  */
 
18673
+/* Newton-Raphson approximation of floating point divide DST = N/D.  If NOTE_P,
 
18674
+   add a reg_note saying that this was a division.  Support both scalar and
 
18675
+   vector divide.  Assumes no trapping math and finite arguments.  */
 
18676
 
 
18677
-static void
 
18678
-rs6000_emit_swdiv_high_precision (rtx dst, rtx n, rtx d)
 
18679
+void
 
18680
+rs6000_emit_swdiv (rtx dst, rtx n, rtx d, bool note_p)
 
18681
 {
 
18682
   enum machine_mode mode = GET_MODE (dst);
 
18683
-  rtx x0, e0, e1, y1, u0, v0;
 
18684
-  enum insn_code code = optab_handler (smul_optab, mode);
 
18685
-  insn_gen_fn gen_mul = GEN_FCN (code);
 
18686
-  rtx one = rs6000_load_constant_and_splat (mode, dconst1);
 
18687
+  rtx one, x0, e0, x1, xprev, eprev, xnext, enext, u, v;
 
18688
+  int i;
 
18689
 
 
18690
-  gcc_assert (code != CODE_FOR_nothing);
 
18691
+  /* Low precision estimates guarantee 5 bits of accuracy.  High
 
18692
+     precision estimates guarantee 14 bits of accuracy.  SFmode
 
18693
+     requires 23 bits of accuracy.  DFmode requires 52 bits of
 
18694
+     accuracy.  Each pass at least doubles the accuracy, leading
 
18695
+     to the following.  */
 
18696
+  int passes = (TARGET_RECIP_PRECISION) ? 1 : 3;
 
18697
+  if (mode == DFmode || mode == V2DFmode)
 
18698
+    passes++;
 
18699
 
 
18700
-  /* x0 = 1./d estimate */
 
18701
-  x0 = gen_reg_rtx (mode);
 
18702
-  emit_insn (gen_rtx_SET (VOIDmode, x0,
 
18703
-                         gen_rtx_UNSPEC (mode, gen_rtvec (1, d),
 
18704
-                                         UNSPEC_FRES)));
 
18705
-
 
18706
-  e0 = gen_reg_rtx (mode);
 
18707
-  rs6000_emit_nmsub (e0, d, x0, one);          /* e0 = 1. - (d * x0) */
 
18708
-
 
18709
-  e1 = gen_reg_rtx (mode);
 
18710
-  rs6000_emit_madd (e1, e0, e0, e0);           /* e1 = (e0 * e0) + e0 */
 
18711
-
 
18712
-  y1 = gen_reg_rtx (mode);
 
18713
-  rs6000_emit_madd (y1, e1, x0, x0);           /* y1 = (e1 * x0) + x0 */
 
18714
-
 
18715
-  u0 = gen_reg_rtx (mode);
 
18716
-  emit_insn (gen_mul (u0, n, y1));             /* u0 = n * y1 */
 
18717
-
 
18718
-  v0 = gen_reg_rtx (mode);
 
18719
-  rs6000_emit_nmsub (v0, d, u0, n);            /* v0 = n - (d * u0) */
 
18720
-
 
18721
-  rs6000_emit_madd (dst, v0, y1, u0);          /* dst = (v0 * y1) + u0 */
 
18722
-}
 
18723
-
 
18724
-/* Newton-Raphson approximation of floating point divide that has a low
 
18725
-   precision estimate.  Assumes no trapping math and finite arguments.  */
 
18726
-
 
18727
-static void
 
18728
-rs6000_emit_swdiv_low_precision (rtx dst, rtx n, rtx d)
 
18729
-{
 
18730
-  enum machine_mode mode = GET_MODE (dst);
 
18731
-  rtx x0, e0, e1, e2, y1, y2, y3, u0, v0, one;
 
18732
   enum insn_code code = optab_handler (smul_optab, mode);
 
18733
   insn_gen_fn gen_mul = GEN_FCN (code);
 
18734
 
 
18735
@@ -26704,47 +29449,45 @@
 
18736
                          gen_rtx_UNSPEC (mode, gen_rtvec (1, d),
 
18737
                                          UNSPEC_FRES)));
 
18738
 
 
18739
-  e0 = gen_reg_rtx (mode);
 
18740
-  rs6000_emit_nmsub (e0, d, x0, one);          /* e0 = 1. - d * x0 */
 
18741
+  /* Each iteration but the last calculates x_(i+1) = x_i * (2 - d * x_i).  */
 
18742
+  if (passes > 1) {
 
18743
 
 
18744
-  y1 = gen_reg_rtx (mode);
 
18745
-  rs6000_emit_madd (y1, e0, x0, x0);           /* y1 = x0 + e0 * x0 */
 
18746
+    /* e0 = 1. - d * x0  */
 
18747
+    e0 = gen_reg_rtx (mode);
 
18748
+    rs6000_emit_nmsub (e0, d, x0, one);
 
18749
 
 
18750
-  e1 = gen_reg_rtx (mode);
 
18751
-  emit_insn (gen_mul (e1, e0, e0));            /* e1 = e0 * e0 */
 
18752
+    /* x1 = x0 + e0 * x0  */
 
18753
+    x1 = gen_reg_rtx (mode);
 
18754
+    rs6000_emit_madd (x1, e0, x0, x0);
 
18755
 
 
18756
-  y2 = gen_reg_rtx (mode);
 
18757
-  rs6000_emit_madd (y2, e1, y1, y1);           /* y2 = y1 + e1 * y1 */
 
18758
+    for (i = 0, xprev = x1, eprev = e0; i < passes - 2;
 
18759
+        ++i, xprev = xnext, eprev = enext) {
 
18760
+      
 
18761
+      /* enext = eprev * eprev  */
 
18762
+      enext = gen_reg_rtx (mode);
 
18763
+      emit_insn (gen_mul (enext, eprev, eprev));
 
18764
 
 
18765
-  e2 = gen_reg_rtx (mode);
 
18766
-  emit_insn (gen_mul (e2, e1, e1));            /* e2 = e1 * e1 */
 
18767
+      /* xnext = xprev + enext * xprev  */
 
18768
+      xnext = gen_reg_rtx (mode);
 
18769
+      rs6000_emit_madd (xnext, enext, xprev, xprev);
 
18770
+    }
 
18771
 
 
18772
-  y3 = gen_reg_rtx (mode);
 
18773
-  rs6000_emit_madd (y3, e2, y2, y2);           /* y3 = y2 + e2 * y2 */
 
18774
+  } else
 
18775
+    xprev = x0;
 
18776
 
 
18777
-  u0 = gen_reg_rtx (mode);
 
18778
-  emit_insn (gen_mul (u0, n, y3));             /* u0 = n * y3 */
 
18779
+  /* The last iteration calculates x_(i+1) = n * x_i * (2 - d * x_i).  */
 
18780
 
 
18781
-  v0 = gen_reg_rtx (mode);
 
18782
-  rs6000_emit_nmsub (v0, d, u0, n);            /* v0 = n - d * u0 */
 
18783
+  /* u = n * xprev  */
 
18784
+  u = gen_reg_rtx (mode);
 
18785
+  emit_insn (gen_mul (u, n, xprev));
 
18786
 
 
18787
-  rs6000_emit_madd (dst, v0, y3, u0);          /* dst = u0 + v0 * y3 */
 
18788
-}
 
18789
+  /* v = n - (d * u)  */
 
18790
+  v = gen_reg_rtx (mode);
 
18791
+  rs6000_emit_nmsub (v, d, u, n);
 
18792
 
 
18793
-/* Newton-Raphson approximation of floating point divide DST = N/D.  If NOTE_P,
 
18794
-   add a reg_note saying that this was a division.  Support both scalar and
 
18795
-   vector divide.  Assumes no trapping math and finite arguments.  */
 
18796
+  /* dst = (v * xprev) + u  */
 
18797
+  rs6000_emit_madd (dst, v, xprev, u);
 
18798
 
 
18799
-void
 
18800
-rs6000_emit_swdiv (rtx dst, rtx n, rtx d, bool note_p)
 
18801
-{
 
18802
-  enum machine_mode mode = GET_MODE (dst);
 
18803
-
 
18804
-  if (RS6000_RECIP_HIGH_PRECISION_P (mode))
 
18805
-    rs6000_emit_swdiv_high_precision (dst, n, d);
 
18806
-  else
 
18807
-    rs6000_emit_swdiv_low_precision (dst, n, d);
 
18808
-
 
18809
   if (note_p)
 
18810
     add_reg_note (get_last_insn (), REG_EQUAL, gen_rtx_DIV (mode, n, d));
 
18811
 }
 
18812
@@ -26758,7 +29501,16 @@
 
18813
   enum machine_mode mode = GET_MODE (src);
 
18814
   rtx x0 = gen_reg_rtx (mode);
 
18815
   rtx y = gen_reg_rtx (mode);
 
18816
-  int passes = (TARGET_RECIP_PRECISION) ? 2 : 3;
 
18817
+
 
18818
+  /* Low precision estimates guarantee 5 bits of accuracy.  High
 
18819
+     precision estimates guarantee 14 bits of accuracy.  SFmode
 
18820
+     requires 23 bits of accuracy.  DFmode requires 52 bits of
 
18821
+     accuracy.  Each pass at least doubles the accuracy, leading
 
18822
+     to the following.  */
 
18823
+  int passes = (TARGET_RECIP_PRECISION) ? 1 : 3;
 
18824
+  if (mode == DFmode || mode == V2DFmode)
 
18825
+    passes++;
 
18826
+
 
18827
   REAL_VALUE_TYPE dconst3_2;
 
18828
   int i;
 
18829
   rtx halfthree;
 
18830
@@ -26920,6 +29672,136 @@
 
18831
     }
 
18832
 }
 
18833
 
 
18834
+/* Expand an Altivec constant permutation for little endian mode.
 
18835
+   There are two issues: First, the two input operands must be
 
18836
+   swapped so that together they form a double-wide array in LE
 
18837
+   order.  Second, the vperm instruction has surprising behavior
 
18838
+   in LE mode:  it interprets the elements of the source vectors
 
18839
+   in BE mode ("left to right") and interprets the elements of
 
18840
+   the destination vector in LE mode ("right to left").  To
 
18841
+   correct for this, we must subtract each element of the permute
 
18842
+   control vector from 31.
 
18843
+
 
18844
+   For example, suppose we want to concatenate vr10 = {0, 1, 2, 3}
 
18845
+   with vr11 = {4, 5, 6, 7} and extract {0, 2, 4, 6} using a vperm.
 
18846
+   We place {0,1,2,3,8,9,10,11,16,17,18,19,24,25,26,27} in vr12 to
 
18847
+   serve as the permute control vector.  Then, in BE mode,
 
18848
+
 
18849
+     vperm 9,10,11,12
 
18850
+
 
18851
+   places the desired result in vr9.  However, in LE mode the 
 
18852
+   vector contents will be
 
18853
+
 
18854
+     vr10 = 00000003 00000002 00000001 00000000
 
18855
+     vr11 = 00000007 00000006 00000005 00000004
 
18856
+
 
18857
+   The result of the vperm using the same permute control vector is
 
18858
+
 
18859
+     vr9  = 05000000 07000000 01000000 03000000
 
18860
+
 
18861
+   That is, the leftmost 4 bytes of vr10 are interpreted as the
 
18862
+   source for the rightmost 4 bytes of vr9, and so on.
 
18863
+
 
18864
+   If we change the permute control vector to
 
18865
+
 
18866
+     vr12 = {31,20,29,28,23,22,21,20,15,14,13,12,7,6,5,4}
 
18867
+
 
18868
+   and issue
 
18869
+
 
18870
+     vperm 9,11,10,12
 
18871
+
 
18872
+   we get the desired
 
18873
+
 
18874
+   vr9  = 00000006 00000004 00000002 00000000.  */
 
18875
+
 
18876
+void
 
18877
+altivec_expand_vec_perm_const_le (rtx operands[4])
 
18878
+{
 
18879
+  unsigned int i;
 
18880
+  rtx perm[16];
 
18881
+  rtx constv, unspec;
 
18882
+  rtx target = operands[0];
 
18883
+  rtx op0 = operands[1];
 
18884
+  rtx op1 = operands[2];
 
18885
+  rtx sel = operands[3];
 
18886
+
 
18887
+  /* Unpack and adjust the constant selector.  */
 
18888
+  for (i = 0; i < 16; ++i)
 
18889
+    {
 
18890
+      rtx e = XVECEXP (sel, 0, i);
 
18891
+      unsigned int elt = 31 - (INTVAL (e) & 31);
 
18892
+      perm[i] = GEN_INT (elt);
 
18893
+    }
 
18894
+
 
18895
+  /* Expand to a permute, swapping the inputs and using the
 
18896
+     adjusted selector.  */
 
18897
+  if (!REG_P (op0))
 
18898
+    op0 = force_reg (V16QImode, op0);
 
18899
+  if (!REG_P (op1))
 
18900
+    op1 = force_reg (V16QImode, op1);
 
18901
+
 
18902
+  constv = gen_rtx_CONST_VECTOR (V16QImode, gen_rtvec_v (16, perm));
 
18903
+  constv = force_reg (V16QImode, constv);
 
18904
+  unspec = gen_rtx_UNSPEC (V16QImode, gen_rtvec (3, op1, op0, constv),
 
18905
+                          UNSPEC_VPERM);
 
18906
+  if (!REG_P (target))
 
18907
+    {
 
18908
+      rtx tmp = gen_reg_rtx (V16QImode);
 
18909
+      emit_move_insn (tmp, unspec);
 
18910
+      unspec = tmp;
 
18911
+    }
 
18912
+
 
18913
+  emit_move_insn (target, unspec);
 
18914
+}
 
18915
+
 
18916
+/* Similarly to altivec_expand_vec_perm_const_le, we must adjust the
 
18917
+   permute control vector.  But here it's not a constant, so we must
 
18918
+   generate a vector splat/subtract to do the adjustment.  */
 
18919
+
 
18920
+void
 
18921
+altivec_expand_vec_perm_le (rtx operands[4])
 
18922
+{
 
18923
+  rtx splat, unspec;
 
18924
+  rtx target = operands[0];
 
18925
+  rtx op0 = operands[1];
 
18926
+  rtx op1 = operands[2];
 
18927
+  rtx sel = operands[3];
 
18928
+  rtx tmp = target;
 
18929
+
 
18930
+  /* Get everything in regs so the pattern matches.  */
 
18931
+  if (!REG_P (op0))
 
18932
+    op0 = force_reg (V16QImode, op0);
 
18933
+  if (!REG_P (op1))
 
18934
+    op1 = force_reg (V16QImode, op1);
 
18935
+  if (!REG_P (sel))
 
18936
+    sel = force_reg (V16QImode, sel);
 
18937
+  if (!REG_P (target))
 
18938
+    tmp = gen_reg_rtx (V16QImode);
 
18939
+
 
18940
+  /* SEL = splat(31) - SEL.  */
 
18941
+  /* We want to subtract from 31, but we can't vspltisb 31 since
 
18942
+     it's out of range.  -1 works as well because only the low-order
 
18943
+     five bits of the permute control vector elements are used.  */
 
18944
+  splat = gen_rtx_VEC_DUPLICATE (V16QImode,
 
18945
+                                gen_rtx_CONST_INT (QImode, -1));
 
18946
+  emit_move_insn (tmp, splat);
 
18947
+  sel = gen_rtx_MINUS (V16QImode, tmp, sel);
 
18948
+  emit_move_insn (tmp, sel);
 
18949
+
 
18950
+  /* Permute with operands reversed and adjusted selector.  */
 
18951
+  unspec = gen_rtx_UNSPEC (V16QImode, gen_rtvec (3, op1, op0, tmp),
 
18952
+                          UNSPEC_VPERM);
 
18953
+
 
18954
+  /* Copy into target, possibly by way of a register.  */
 
18955
+  if (!REG_P (target))
 
18956
+    {
 
18957
+      emit_move_insn (tmp, unspec);
 
18958
+      unspec = tmp;
 
18959
+    }
 
18960
+
 
18961
+  emit_move_insn (target, unspec);
 
18962
+}
 
18963
+
 
18964
 /* Expand an Altivec constant permutation.  Return true if we match
 
18965
    an efficient implementation; false to fall back to VPERM.  */
 
18966
 
 
18967
@@ -26927,26 +29809,37 @@
 
18968
 altivec_expand_vec_perm_const (rtx operands[4])
 
18969
 {
 
18970
   struct altivec_perm_insn {
 
18971
+    HOST_WIDE_INT mask;
 
18972
     enum insn_code impl;
 
18973
     unsigned char perm[16];
 
18974
   };
 
18975
   static const struct altivec_perm_insn patterns[] = {
 
18976
-    { CODE_FOR_altivec_vpkuhum,
 
18977
+    { OPTION_MASK_ALTIVEC, CODE_FOR_altivec_vpkuhum,
 
18978
       {  1,  3,  5,  7,  9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29, 31 } },
 
18979
-    { CODE_FOR_altivec_vpkuwum,
 
18980
+    { OPTION_MASK_ALTIVEC, CODE_FOR_altivec_vpkuwum,
 
18981
       {  2,  3,  6,  7, 10, 11, 14, 15, 18, 19, 22, 23, 26, 27, 30, 31 } },
 
18982
-    { CODE_FOR_altivec_vmrghb,
 
18983
+    { OPTION_MASK_ALTIVEC, 
 
18984
+      BYTES_BIG_ENDIAN ? CODE_FOR_altivec_vmrghb : CODE_FOR_altivec_vmrglb,
 
18985
       {  0, 16,  1, 17,  2, 18,  3, 19,  4, 20,  5, 21,  6, 22,  7, 23 } },
 
18986
-    { CODE_FOR_altivec_vmrghh,
 
18987
+    { OPTION_MASK_ALTIVEC,
 
18988
+      BYTES_BIG_ENDIAN ? CODE_FOR_altivec_vmrghh : CODE_FOR_altivec_vmrglh,
 
18989
       {  0,  1, 16, 17,  2,  3, 18, 19,  4,  5, 20, 21,  6,  7, 22, 23 } },
 
18990
-    { CODE_FOR_altivec_vmrghw,
 
18991
+    { OPTION_MASK_ALTIVEC,
 
18992
+      BYTES_BIG_ENDIAN ? CODE_FOR_altivec_vmrghw : CODE_FOR_altivec_vmrglw,
 
18993
       {  0,  1,  2,  3, 16, 17, 18, 19,  4,  5,  6,  7, 20, 21, 22, 23 } },
 
18994
-    { CODE_FOR_altivec_vmrglb,
 
18995
+    { OPTION_MASK_ALTIVEC,
 
18996
+      BYTES_BIG_ENDIAN ? CODE_FOR_altivec_vmrglb : CODE_FOR_altivec_vmrghb,
 
18997
       {  8, 24,  9, 25, 10, 26, 11, 27, 12, 28, 13, 29, 14, 30, 15, 31 } },
 
18998
-    { CODE_FOR_altivec_vmrglh,
 
18999
+    { OPTION_MASK_ALTIVEC,
 
19000
+      BYTES_BIG_ENDIAN ? CODE_FOR_altivec_vmrglh : CODE_FOR_altivec_vmrghh,
 
19001
       {  8,  9, 24, 25, 10, 11, 26, 27, 12, 13, 28, 29, 14, 15, 30, 31 } },
 
19002
-    { CODE_FOR_altivec_vmrglw,
 
19003
-      {  8,  9, 10, 11, 24, 25, 26, 27, 12, 13, 14, 15, 28, 29, 30, 31 } }
 
19004
+    { OPTION_MASK_ALTIVEC,
 
19005
+      BYTES_BIG_ENDIAN ? CODE_FOR_altivec_vmrglw : CODE_FOR_altivec_vmrghw,
 
19006
+      {  8,  9, 10, 11, 24, 25, 26, 27, 12, 13, 14, 15, 28, 29, 30, 31 } },
 
19007
+    { OPTION_MASK_P8_VECTOR, CODE_FOR_p8_vmrgew,
 
19008
+      {  0,  1,  2,  3, 16, 17, 18, 19,  8,  9, 10, 11, 24, 25, 26, 27 } },
 
19009
+    { OPTION_MASK_P8_VECTOR, CODE_FOR_p8_vmrgow,
 
19010
+      {  4,  5,  6,  7, 20, 21, 22, 23, 12, 13, 14, 15, 28, 29, 30, 31 } }
 
19011
   };
 
19012
 
 
19013
   unsigned int i, j, elt, which;
 
19014
@@ -27003,6 +29896,8 @@
 
19015
          break;
 
19016
       if (i == 16)
 
19017
        {
 
19018
+          if (!BYTES_BIG_ENDIAN)
 
19019
+            elt = 15 - elt;
 
19020
          emit_insn (gen_altivec_vspltb (target, op0, GEN_INT (elt)));
 
19021
          return true;
 
19022
        }
 
19023
@@ -27014,9 +29909,10 @@
 
19024
              break;
 
19025
          if (i == 16)
 
19026
            {
 
19027
+             int field = BYTES_BIG_ENDIAN ? elt / 2 : 7 - elt / 2;
 
19028
              x = gen_reg_rtx (V8HImode);
 
19029
              emit_insn (gen_altivec_vsplth (x, gen_lowpart (V8HImode, op0),
 
19030
-                                            GEN_INT (elt / 2)));
 
19031
+                                            GEN_INT (field)));
 
19032
              emit_move_insn (target, gen_lowpart (V16QImode, x));
 
19033
              return true;
 
19034
            }
 
19035
@@ -27032,9 +29928,10 @@
 
19036
              break;
 
19037
          if (i == 16)
 
19038
            {
 
19039
+             int field = BYTES_BIG_ENDIAN ? elt / 4 : 3 - elt / 4;
 
19040
              x = gen_reg_rtx (V4SImode);
 
19041
              emit_insn (gen_altivec_vspltw (x, gen_lowpart (V4SImode, op0),
 
19042
-                                            GEN_INT (elt / 4)));
 
19043
+                                            GEN_INT (field)));
 
19044
              emit_move_insn (target, gen_lowpart (V16QImode, x));
 
19045
              return true;
 
19046
            }
 
19047
@@ -27046,6 +29943,9 @@
 
19048
     {
 
19049
       bool swapped;
 
19050
 
 
19051
+      if ((patterns[j].mask & rs6000_isa_flags) == 0)
 
19052
+       continue;
 
19053
+
 
19054
       elt = patterns[j].perm[0];
 
19055
       if (perm[0] == elt)
 
19056
        swapped = false;
 
19057
@@ -27069,7 +29969,30 @@
 
19058
          enum machine_mode omode = insn_data[icode].operand[0].mode;
 
19059
          enum machine_mode imode = insn_data[icode].operand[1].mode;
 
19060
 
 
19061
-         if (swapped)
 
19062
+         /* For little-endian, don't use vpkuwum and vpkuhum if the
 
19063
+            underlying vector type is not V4SI and V8HI, respectively.
 
19064
+            For example, using vpkuwum with a V8HI picks up the even
 
19065
+            halfwords (BE numbering) when the even halfwords (LE
 
19066
+            numbering) are what we need.  */
 
19067
+         if (!BYTES_BIG_ENDIAN
 
19068
+             && icode == CODE_FOR_altivec_vpkuwum
 
19069
+             && ((GET_CODE (op0) == REG
 
19070
+                  && GET_MODE (op0) != V4SImode)
 
19071
+                 || (GET_CODE (op0) == SUBREG
 
19072
+                     && GET_MODE (XEXP (op0, 0)) != V4SImode)))
 
19073
+           continue;
 
19074
+         if (!BYTES_BIG_ENDIAN
 
19075
+             && icode == CODE_FOR_altivec_vpkuhum
 
19076
+             && ((GET_CODE (op0) == REG
 
19077
+                  && GET_MODE (op0) != V8HImode)
 
19078
+                 || (GET_CODE (op0) == SUBREG
 
19079
+                     && GET_MODE (XEXP (op0, 0)) != V8HImode)))
 
19080
+           continue;
 
19081
+
 
19082
+          /* For little-endian, the two input operands must be swapped
 
19083
+             (or swapped back) to ensure proper right-to-left numbering
 
19084
+             from 0 to 2N-1.  */
 
19085
+         if (swapped ^ !BYTES_BIG_ENDIAN)
 
19086
            x = op0, op0 = op1, op1 = x;
 
19087
          if (imode != V16QImode)
 
19088
            {
 
19089
@@ -27087,6 +30010,12 @@
 
19090
        }
 
19091
     }
 
19092
 
 
19093
+  if (!BYTES_BIG_ENDIAN)
 
19094
+    {
 
19095
+      altivec_expand_vec_perm_const_le (operands);
 
19096
+      return true;
 
19097
+    }
 
19098
+
 
19099
   return false;
 
19100
 }
 
19101
 
 
19102
@@ -27136,6 +30065,21 @@
 
19103
       gcc_assert (GET_MODE_NUNITS (vmode) == 2);
 
19104
       dmode = mode_for_vector (GET_MODE_INNER (vmode), 4);
 
19105
 
 
19106
+      /* For little endian, swap operands and invert/swap selectors
 
19107
+        to get the correct xxpermdi.  The operand swap sets up the
 
19108
+        inputs as a little endian array.  The selectors are swapped
 
19109
+        because they are defined to use big endian ordering.  The
 
19110
+        selectors are inverted to get the correct doublewords for
 
19111
+        little endian ordering.  */
 
19112
+      if (!BYTES_BIG_ENDIAN)
 
19113
+       {
 
19114
+         int n;
 
19115
+         perm0 = 3 - perm0;
 
19116
+         perm1 = 3 - perm1;
 
19117
+         n = perm0, perm0 = perm1, perm1 = n;
 
19118
+         x = op0, op0 = op1, op1 = x;
 
19119
+       }
 
19120
+
 
19121
       x = gen_rtx_VEC_CONCAT (dmode, op0, op1);
 
19122
       v = gen_rtvec (2, GEN_INT (perm0), GEN_INT (perm1));
 
19123
       x = gen_rtx_VEC_SELECT (vmode, x, gen_rtx_PARALLEL (VOIDmode, v));
 
19124
@@ -27231,7 +30175,7 @@
 
19125
   unsigned i, high, nelt = GET_MODE_NUNITS (vmode);
 
19126
   rtx perm[16];
 
19127
 
 
19128
-  high = (highp == BYTES_BIG_ENDIAN ? 0 : nelt / 2);
 
19129
+  high = (highp ? 0 : nelt / 2);
 
19130
   for (i = 0; i < nelt / 2; i++)
 
19131
     {
 
19132
       perm[i * 2] = GEN_INT (i + high);
 
19133
@@ -27286,6 +30230,8 @@
 
19134
 {
 
19135
   enum machine_mode mode;
 
19136
   unsigned int regno;
 
19137
+  enum machine_mode elt_mode;
 
19138
+  int n_elts;
 
19139
 
 
19140
   /* Special handling for structs in darwin64.  */
 
19141
   if (TARGET_MACHO 
 
19142
@@ -27305,6 +30251,36 @@
 
19143
       /* Otherwise fall through to standard ABI rules.  */
 
19144
     }
 
19145
 
 
19146
+  /* The ELFv2 ABI returns homogeneous VFP aggregates in registers.  */
 
19147
+  if (rs6000_discover_homogeneous_aggregate (TYPE_MODE (valtype), valtype,
 
19148
+                                            &elt_mode, &n_elts))
 
19149
+    {
 
19150
+      int first_reg, n_regs, i;
 
19151
+      rtx par;
 
19152
+
 
19153
+      if (SCALAR_FLOAT_MODE_P (elt_mode))
 
19154
+       {
 
19155
+         /* _Decimal128 must use even/odd register pairs.  */
 
19156
+         first_reg = (elt_mode == TDmode) ? FP_ARG_RETURN + 1 : FP_ARG_RETURN;
 
19157
+         n_regs = (GET_MODE_SIZE (elt_mode) + 7) >> 3;
 
19158
+       }
 
19159
+      else
 
19160
+       {
 
19161
+         first_reg = ALTIVEC_ARG_RETURN;
 
19162
+         n_regs = 1;
 
19163
+       }
 
19164
+
 
19165
+      par = gen_rtx_PARALLEL (TYPE_MODE (valtype), rtvec_alloc (n_elts));
 
19166
+      for (i = 0; i < n_elts; i++)
 
19167
+       {
 
19168
+         rtx r = gen_rtx_REG (elt_mode, first_reg + i * n_regs);
 
19169
+         rtx off = GEN_INT (i * GET_MODE_SIZE (elt_mode));
 
19170
+         XVECEXP (par, 0, i) = gen_rtx_EXPR_LIST (VOIDmode, r, off);
 
19171
+       }
 
19172
+
 
19173
+      return par;
 
19174
+    }
 
19175
+
 
19176
   if (TARGET_32BIT && TARGET_POWERPC64 && TYPE_MODE (valtype) == DImode)
 
19177
     {
 
19178
       /* Long long return value need be split in -mpowerpc64, 32bit ABI.  */
 
19179
@@ -27679,22 +30655,32 @@
 
19180
 {
 
19181
   { "altivec",                 OPTION_MASK_ALTIVEC,            false, true  },
 
19182
   { "cmpb",                    OPTION_MASK_CMPB,               false, true  },
 
19183
+  { "crypto",                  OPTION_MASK_CRYPTO,             false, true  },
 
19184
+  { "direct-move",             OPTION_MASK_DIRECT_MOVE,        false, true  },
 
19185
   { "dlmzb",                   OPTION_MASK_DLMZB,              false, true  },
 
19186
   { "fprnd",                   OPTION_MASK_FPRND,              false, true  },
 
19187
   { "hard-dfp",                        OPTION_MASK_DFP,                false, true  },
 
19188
+  { "htm",                     OPTION_MASK_HTM,                false, true  },
 
19189
   { "isel",                    OPTION_MASK_ISEL,               false, true  },
 
19190
   { "mfcrf",                   OPTION_MASK_MFCRF,              false, true  },
 
19191
   { "mfpgpr",                  OPTION_MASK_MFPGPR,             false, true  },
 
19192
   { "mulhw",                   OPTION_MASK_MULHW,              false, true  },
 
19193
   { "multiple",                        OPTION_MASK_MULTIPLE,           false, true  },
 
19194
-  { "update",                  OPTION_MASK_NO_UPDATE,          true , true  },
 
19195
   { "popcntb",                 OPTION_MASK_POPCNTB,            false, true  },
 
19196
   { "popcntd",                 OPTION_MASK_POPCNTD,            false, true  },
 
19197
+  { "power8-fusion",           OPTION_MASK_P8_FUSION,          false, true  },
 
19198
+  { "power8-fusion-sign",      OPTION_MASK_P8_FUSION_SIGN,     false, true  },
 
19199
+  { "power8-vector",           OPTION_MASK_P8_VECTOR,          false, true  },
 
19200
   { "powerpc-gfxopt",          OPTION_MASK_PPC_GFXOPT,         false, true  },
 
19201
   { "powerpc-gpopt",           OPTION_MASK_PPC_GPOPT,          false, true  },
 
19202
+  { "quad-memory",             OPTION_MASK_QUAD_MEMORY,        false, true  },
 
19203
   { "recip-precision",         OPTION_MASK_RECIP_PRECISION,    false, true  },
 
19204
   { "string",                  OPTION_MASK_STRING,             false, true  },
 
19205
+  { "update",                  OPTION_MASK_NO_UPDATE,          true , true  },
 
19206
+  { "upper-regs-df",           OPTION_MASK_UPPER_REGS_DF,      false, false },
 
19207
+  { "upper-regs-sf",           OPTION_MASK_UPPER_REGS_SF,      false, false },
 
19208
   { "vsx",                     OPTION_MASK_VSX,                false, true  },
 
19209
+  { "vsx-timode",              OPTION_MASK_VSX_TIMODE,         false, true  },
 
19210
 #ifdef OPTION_MASK_64BIT
 
19211
 #if TARGET_AIX_OS
 
19212
   { "aix64",                   OPTION_MASK_64BIT,              false, false },
 
19213
@@ -27734,6 +30720,9 @@
 
19214
   { "frsqrtes",                 RS6000_BTM_FRSQRTES,   false, false },
 
19215
   { "popcntd",          RS6000_BTM_POPCNTD,    false, false },
 
19216
   { "cell",             RS6000_BTM_CELL,       false, false },
 
19217
+  { "power8-vector",    RS6000_BTM_P8_VECTOR,  false, false },
 
19218
+  { "crypto",           RS6000_BTM_CRYPTO,     false, false },
 
19219
+  { "htm",              RS6000_BTM_HTM,        false, false },
 
19220
 };
 
19221
 
 
19222
 /* Option variables that we want to support inside attribute((target)) and
 
19223
@@ -28250,7 +31239,6 @@
 
19224
   size_t cur_column;
 
19225
   size_t max_column = 76;
 
19226
   const char *comma = "";
 
19227
-  const char *nl = "\n";
 
19228
 
 
19229
   if (indent)
 
19230
     start_column += fprintf (file, "%*s", indent, "");
 
19231
@@ -28281,7 +31269,6 @@
 
19232
              fprintf (stderr, ", \\\n%*s", (int)start_column, "");
 
19233
              cur_column = start_column + len;
 
19234
              comma = "";
 
19235
-             nl = "\n\n";
 
19236
            }
 
19237
 
 
19238
          fprintf (file, "%s%s%s%s", comma, prefix, no_str,
 
19239
@@ -28291,7 +31278,7 @@
 
19240
        }
 
19241
     }
 
19242
 
 
19243
-  fputs (nl, file);
 
19244
+  fputs ("\n", file);
 
19245
 }
 
19246
 
 
19247
 /* Helper function to print the current isa options on a line.  */
 
19248
@@ -28467,118 +31454,149 @@
 
19249
 }
 
19250
 
 
19251
 
 
19252
-/* A function pointer under AIX is a pointer to a data area whose first word
 
19253
-   contains the actual address of the function, whose second word contains a
 
19254
-   pointer to its TOC, and whose third word contains a value to place in the
 
19255
-   static chain register (r11).  Note that if we load the static chain, our
 
19256
-   "trampoline" need not have any executable code.  */
 
19257
 
 
19258
+/* Expand code to perform a call under the AIX or ELFv2 ABI.  */
 
19259
+
 
19260
 void
 
19261
-rs6000_call_indirect_aix (rtx value, rtx func_desc, rtx flag)
 
19262
+rs6000_call_aix (rtx value, rtx func_desc, rtx flag, rtx cookie)
 
19263
 {
 
19264
+  rtx toc_reg = gen_rtx_REG (Pmode, TOC_REGNUM);
 
19265
+  rtx toc_load = NULL_RTX;
 
19266
+  rtx toc_restore = NULL_RTX;
 
19267
   rtx func_addr;
 
19268
-  rtx toc_reg;
 
19269
-  rtx sc_reg;
 
19270
-  rtx stack_ptr;
 
19271
-  rtx stack_toc_offset;
 
19272
-  rtx stack_toc_mem;
 
19273
-  rtx func_toc_offset;
 
19274
-  rtx func_toc_mem;
 
19275
-  rtx func_sc_offset;
 
19276
-  rtx func_sc_mem;
 
19277
+  rtx abi_reg = NULL_RTX;
 
19278
+  rtx call[4];
 
19279
+  int n_call;
 
19280
   rtx insn;
 
19281
-  rtx (*call_func) (rtx, rtx, rtx, rtx);
 
19282
-  rtx (*call_value_func) (rtx, rtx, rtx, rtx, rtx);
 
19283
 
 
19284
-  stack_ptr = gen_rtx_REG (Pmode, STACK_POINTER_REGNUM);
 
19285
-  toc_reg = gen_rtx_REG (Pmode, TOC_REGNUM);
 
19286
+  /* Handle longcall attributes.  */
 
19287
+  if (INTVAL (cookie) & CALL_LONG)
 
19288
+    func_desc = rs6000_longcall_ref (func_desc);
 
19289
 
 
19290
-  /* Load up address of the actual function.  */
 
19291
-  func_desc = force_reg (Pmode, func_desc);
 
19292
-  func_addr = gen_reg_rtx (Pmode);
 
19293
-  emit_move_insn (func_addr, gen_rtx_MEM (Pmode, func_desc));
 
19294
-
 
19295
-  if (TARGET_32BIT)
 
19296
+  /* Handle indirect calls.  */
 
19297
+  if (GET_CODE (func_desc) != SYMBOL_REF
 
19298
+      || (DEFAULT_ABI == ABI_AIX && !SYMBOL_REF_FUNCTION_P (func_desc)))
 
19299
     {
 
19300
+      /* Save the TOC into its reserved slot before the call,
 
19301
+        and prepare to restore it after the call.  */
 
19302
+      rtx stack_ptr = gen_rtx_REG (Pmode, STACK_POINTER_REGNUM);
 
19303
+      rtx stack_toc_offset = GEN_INT (RS6000_TOC_SAVE_SLOT);
 
19304
+      rtx stack_toc_mem = gen_frame_mem (Pmode,
 
19305
+                                        gen_rtx_PLUS (Pmode, stack_ptr,
 
19306
+                                                      stack_toc_offset));
 
19307
+      toc_restore = gen_rtx_SET (VOIDmode, toc_reg, stack_toc_mem);
 
19308
 
 
19309
-      stack_toc_offset = GEN_INT (TOC_SAVE_OFFSET_32BIT);
 
19310
-      func_toc_offset = GEN_INT (AIX_FUNC_DESC_TOC_32BIT);
 
19311
-      func_sc_offset = GEN_INT (AIX_FUNC_DESC_SC_32BIT);
 
19312
-      if (TARGET_POINTERS_TO_NESTED_FUNCTIONS)
 
19313
-       {
 
19314
-         call_func = gen_call_indirect_aix32bit;
 
19315
-         call_value_func = gen_call_value_indirect_aix32bit;
 
19316
-       }
 
19317
+      /* Can we optimize saving the TOC in the prologue or
 
19318
+        do we need to do it at every call?  */
 
19319
+      if (TARGET_SAVE_TOC_INDIRECT && !cfun->calls_alloca)
 
19320
+       cfun->machine->save_toc_in_prologue = true;
 
19321
       else
 
19322
        {
 
19323
-         call_func = gen_call_indirect_aix32bit_nor11;
 
19324
-         call_value_func = gen_call_value_indirect_aix32bit_nor11;
 
19325
+         MEM_VOLATILE_P (stack_toc_mem) = 1;
 
19326
+         emit_move_insn (stack_toc_mem, toc_reg);
 
19327
        }
 
19328
-    }
 
19329
-  else
 
19330
-    {
 
19331
-      stack_toc_offset = GEN_INT (TOC_SAVE_OFFSET_64BIT);
 
19332
-      func_toc_offset = GEN_INT (AIX_FUNC_DESC_TOC_64BIT);
 
19333
-      func_sc_offset = GEN_INT (AIX_FUNC_DESC_SC_64BIT);
 
19334
-      if (TARGET_POINTERS_TO_NESTED_FUNCTIONS)
 
19335
+
 
19336
+      if (DEFAULT_ABI == ABI_ELFv2)
 
19337
        {
 
19338
-         call_func = gen_call_indirect_aix64bit;
 
19339
-         call_value_func = gen_call_value_indirect_aix64bit;
 
19340
+         /* A function pointer in the ELFv2 ABI is just a plain address, but
 
19341
+            the ABI requires it to be loaded into r12 before the call.  */
 
19342
+         func_addr = gen_rtx_REG (Pmode, 12);
 
19343
+         emit_move_insn (func_addr, func_desc);
 
19344
+         abi_reg = func_addr;
 
19345
        }
 
19346
       else
 
19347
        {
 
19348
-         call_func = gen_call_indirect_aix64bit_nor11;
 
19349
-         call_value_func = gen_call_value_indirect_aix64bit_nor11;
 
19350
-       }
 
19351
-    }
 
19352
+         /* A function pointer under AIX is a pointer to a data area whose
 
19353
+            first word contains the actual address of the function, whose
 
19354
+            second word contains a pointer to its TOC, and whose third word
 
19355
+            contains a value to place in the static chain register (r11).
 
19356
+            Note that if we load the static chain, our "trampoline" need
 
19357
+            not have any executable code.  */
 
19358
 
 
19359
-  /* Reserved spot to store the TOC.  */
 
19360
-  stack_toc_mem = gen_frame_mem (Pmode,
 
19361
-                                gen_rtx_PLUS (Pmode,
 
19362
-                                              stack_ptr,
 
19363
-                                              stack_toc_offset));
 
19364
+         /* Load up address of the actual function.  */
 
19365
+         func_desc = force_reg (Pmode, func_desc);
 
19366
+         func_addr = gen_reg_rtx (Pmode);
 
19367
+         emit_move_insn (func_addr, gen_rtx_MEM (Pmode, func_desc));
 
19368
 
 
19369
-  gcc_assert (cfun);
 
19370
-  gcc_assert (cfun->machine);
 
19371
+         /* Prepare to load the TOC of the called function.  Note that the
 
19372
+            TOC load must happen immediately before the actual call so
 
19373
+            that unwinding the TOC registers works correctly.  See the
 
19374
+            comment in frob_update_context.  */
 
19375
+         rtx func_toc_offset = GEN_INT (GET_MODE_SIZE (Pmode));
 
19376
+         rtx func_toc_mem = gen_rtx_MEM (Pmode,
 
19377
+                                         gen_rtx_PLUS (Pmode, func_desc,
 
19378
+                                                       func_toc_offset));
 
19379
+         toc_load = gen_rtx_USE (VOIDmode, func_toc_mem);
 
19380
 
 
19381
-  /* Can we optimize saving the TOC in the prologue or do we need to do it at
 
19382
-     every call?  */
 
19383
-  if (TARGET_SAVE_TOC_INDIRECT && !cfun->calls_alloca)
 
19384
-    cfun->machine->save_toc_in_prologue = true;
 
19385
-
 
19386
+         /* If we have a static chain, load it up.  */
 
19387
+         if (TARGET_POINTERS_TO_NESTED_FUNCTIONS)
 
19388
+           {
 
19389
+             rtx sc_reg = gen_rtx_REG (Pmode, STATIC_CHAIN_REGNUM);
 
19390
+             rtx func_sc_offset = GEN_INT (2 * GET_MODE_SIZE (Pmode));
 
19391
+             rtx func_sc_mem = gen_rtx_MEM (Pmode,
 
19392
+                                            gen_rtx_PLUS (Pmode, func_desc,
 
19393
+                                                          func_sc_offset));
 
19394
+             emit_move_insn (sc_reg, func_sc_mem);
 
19395
+             abi_reg = sc_reg;
 
19396
+           }
 
19397
+       }
 
19398
+    }
 
19399
   else
 
19400
     {
 
19401
-      MEM_VOLATILE_P (stack_toc_mem) = 1;
 
19402
-      emit_move_insn (stack_toc_mem, toc_reg);
 
19403
+      /* Direct calls use the TOC: for local calls, the callee will
 
19404
+        assume the TOC register is set; for non-local calls, the
 
19405
+        PLT stub needs the TOC register.  */
 
19406
+      abi_reg = toc_reg;
 
19407
+      func_addr = func_desc;
 
19408
     }
 
19409
 
 
19410
-  /* Calculate the address to load the TOC of the called function.  We don't
 
19411
-     actually load this until the split after reload.  */
 
19412
-  func_toc_mem = gen_rtx_MEM (Pmode,
 
19413
-                             gen_rtx_PLUS (Pmode,
 
19414
-                                           func_desc,
 
19415
-                                           func_toc_offset));
 
19416
+  /* Create the call.  */
 
19417
+  call[0] = gen_rtx_CALL (VOIDmode, gen_rtx_MEM (SImode, func_addr), flag);
 
19418
+  if (value != NULL_RTX)
 
19419
+    call[0] = gen_rtx_SET (VOIDmode, value, call[0]);
 
19420
+  n_call = 1;
 
19421
 
 
19422
-  /* If we have a static chain, load it up.  */
 
19423
-  if (TARGET_POINTERS_TO_NESTED_FUNCTIONS)
 
19424
-    {
 
19425
-      func_sc_mem = gen_rtx_MEM (Pmode,
 
19426
-                                gen_rtx_PLUS (Pmode,
 
19427
-                                              func_desc,
 
19428
-                                              func_sc_offset));
 
19429
+  if (toc_load)
 
19430
+    call[n_call++] = toc_load;
 
19431
+  if (toc_restore)
 
19432
+    call[n_call++] = toc_restore;
 
19433
 
 
19434
-      sc_reg = gen_rtx_REG (Pmode, STATIC_CHAIN_REGNUM);
 
19435
-      emit_move_insn (sc_reg, func_sc_mem);
 
19436
-    }
 
19437
+  call[n_call++] = gen_rtx_CLOBBER (VOIDmode, gen_rtx_REG (Pmode, LR_REGNO));
 
19438
 
 
19439
+  insn = gen_rtx_PARALLEL (VOIDmode, gen_rtvec_v (n_call, call));
 
19440
+  insn = emit_call_insn (insn);
 
19441
+
 
19442
+  /* Mention all registers defined by the ABI to hold information
 
19443
+     as uses in CALL_INSN_FUNCTION_USAGE.  */
 
19444
+  if (abi_reg)
 
19445
+    use_reg (&CALL_INSN_FUNCTION_USAGE (insn), abi_reg);
 
19446
+}
 
19447
+
 
19448
+/* Expand code to perform a sibling call under the AIX or ELFv2 ABI.  */
 
19449
+
 
19450
+void
 
19451
+rs6000_sibcall_aix (rtx value, rtx func_desc, rtx flag, rtx cookie)
 
19452
+{
 
19453
+  rtx call[2];
 
19454
+  rtx insn;
 
19455
+
 
19456
+  gcc_assert (INTVAL (cookie) == 0);
 
19457
+
 
19458
   /* Create the call.  */
 
19459
-  if (value)
 
19460
-    insn = call_value_func (value, func_addr, flag, func_toc_mem,
 
19461
-                           stack_toc_mem);
 
19462
-  else
 
19463
-    insn = call_func (func_addr, flag, func_toc_mem, stack_toc_mem);
 
19464
+  call[0] = gen_rtx_CALL (VOIDmode, gen_rtx_MEM (SImode, func_desc), flag);
 
19465
+  if (value != NULL_RTX)
 
19466
+    call[0] = gen_rtx_SET (VOIDmode, value, call[0]);
 
19467
 
 
19468
-  emit_call_insn (insn);
 
19469
+  call[1] = simple_return_rtx;
 
19470
+
 
19471
+  insn = gen_rtx_PARALLEL (VOIDmode, gen_rtvec_v (2, call));
 
19472
+  insn = emit_call_insn (insn);
 
19473
+
 
19474
+  /* Note use of the TOC register.  */
 
19475
+  use_reg (&CALL_INSN_FUNCTION_USAGE (insn), gen_rtx_REG (Pmode, TOC_REGNUM));
 
19476
+  /* We need to also mark a use of the link register since the function we
 
19477
+     sibling-call to will use it to return to our caller.  */
 
19478
+  use_reg (&CALL_INSN_FUNCTION_USAGE (insn), gen_rtx_REG (Pmode, LR_REGNO));
 
19479
 }
 
19480
 
 
19481
 /* Return whether we need to always update the saved TOC pointer when we update
 
19482
@@ -28679,6 +31697,656 @@
 
19483
     add_to_hard_reg_set (&set->set, Pmode, RS6000_PIC_OFFSET_TABLE_REGNUM);
 
19484
 }
 
19485
 
 
19486
+
 
19487
+/* Helper function for rs6000_split_logical to emit a logical instruction after
 
19488
+   spliting the operation to single GPR registers.
 
19489
+
 
19490
+   DEST is the destination register.
 
19491
+   OP1 and OP2 are the input source registers.
 
19492
+   CODE is the base operation (AND, IOR, XOR, NOT).
 
19493
+   MODE is the machine mode.
 
19494
+   If COMPLEMENT_FINAL_P is true, wrap the whole operation with NOT.
 
19495
+   If COMPLEMENT_OP1_P is true, wrap operand1 with NOT.
 
19496
+   If COMPLEMENT_OP2_P is true, wrap operand2 with NOT.
 
19497
+   CLOBBER_REG is either NULL or a scratch register of type CC to allow
 
19498
+   formation of the AND instructions.  */
 
19499
+
 
19500
+static void
 
19501
+rs6000_split_logical_inner (rtx dest,
 
19502
+                           rtx op1,
 
19503
+                           rtx op2,
 
19504
+                           enum rtx_code code,
 
19505
+                           enum machine_mode mode,
 
19506
+                           bool complement_final_p,
 
19507
+                           bool complement_op1_p,
 
19508
+                           bool complement_op2_p,
 
19509
+                           rtx clobber_reg)
 
19510
+{
 
19511
+  rtx bool_rtx;
 
19512
+  rtx set_rtx;
 
19513
+
 
19514
+  /* Optimize AND of 0/0xffffffff and IOR/XOR of 0.  */
 
19515
+  if (op2 && GET_CODE (op2) == CONST_INT
 
19516
+      && (mode == SImode || (mode == DImode && TARGET_POWERPC64))
 
19517
+      && !complement_final_p && !complement_op1_p && !complement_op2_p)
 
19518
+    {
 
19519
+      HOST_WIDE_INT mask = GET_MODE_MASK (mode);
 
19520
+      HOST_WIDE_INT value = INTVAL (op2) & mask;
 
19521
+
 
19522
+      /* Optimize AND of 0 to just set 0.  Optimize AND of -1 to be a move.  */
 
19523
+      if (code == AND)
 
19524
+       {
 
19525
+         if (value == 0)
 
19526
+           {
 
19527
+             emit_insn (gen_rtx_SET (VOIDmode, dest, const0_rtx));
 
19528
+             return;
 
19529
+           }
 
19530
+
 
19531
+         else if (value == mask)
 
19532
+           {
 
19533
+             if (!rtx_equal_p (dest, op1))
 
19534
+               emit_insn (gen_rtx_SET (VOIDmode, dest, op1));
 
19535
+             return;
 
19536
+           }
 
19537
+       }
 
19538
+
 
19539
+      /* Optimize IOR/XOR of 0 to be a simple move.  Split large operations
 
19540
+        into separate ORI/ORIS or XORI/XORIS instrucitons.  */
 
19541
+      else if (code == IOR || code == XOR)
 
19542
+       {
 
19543
+         if (value == 0)
 
19544
+           {
 
19545
+             if (!rtx_equal_p (dest, op1))
 
19546
+               emit_insn (gen_rtx_SET (VOIDmode, dest, op1));
 
19547
+             return;
 
19548
+           }
 
19549
+       }
 
19550
+    }
 
19551
+
 
19552
+  if (complement_op1_p)
 
19553
+    op1 = gen_rtx_NOT (mode, op1);
 
19554
+
 
19555
+  if (complement_op2_p)
 
19556
+    op2 = gen_rtx_NOT (mode, op2);
 
19557
+
 
19558
+  bool_rtx = ((code == NOT)
 
19559
+             ? gen_rtx_NOT (mode, op1)
 
19560
+             : gen_rtx_fmt_ee (code, mode, op1, op2));
 
19561
+
 
19562
+  if (complement_final_p)
 
19563
+    bool_rtx = gen_rtx_NOT (mode, bool_rtx);
 
19564
+
 
19565
+  set_rtx = gen_rtx_SET (VOIDmode, dest, bool_rtx);
 
19566
+
 
19567
+  /* Is this AND with an explicit clobber?  */
 
19568
+  if (clobber_reg)
 
19569
+    {
 
19570
+      rtx clobber = gen_rtx_CLOBBER (VOIDmode, clobber_reg);
 
19571
+      set_rtx = gen_rtx_PARALLEL (VOIDmode, gen_rtvec (2, set_rtx, clobber));
 
19572
+    }
 
19573
+
 
19574
+  emit_insn (set_rtx);
 
19575
+  return;
 
19576
+}
 
19577
+
 
19578
+/* Split a DImode AND/IOR/XOR with a constant on a 32-bit system.  These
 
19579
+   operations are split immediately during RTL generation to allow for more
 
19580
+   optimizations of the AND/IOR/XOR.
 
19581
+
 
19582
+   OPERANDS is an array containing the destination and two input operands.
 
19583
+   CODE is the base operation (AND, IOR, XOR, NOT).
 
19584
+   MODE is the machine mode.
 
19585
+   If COMPLEMENT_FINAL_P is true, wrap the whole operation with NOT.
 
19586
+   If COMPLEMENT_OP1_P is true, wrap operand1 with NOT.
 
19587
+   If COMPLEMENT_OP2_P is true, wrap operand2 with NOT.
 
19588
+   CLOBBER_REG is either NULL or a scratch register of type CC to allow
 
19589
+   formation of the AND instructions.  */
 
19590
+
 
19591
+static void
 
19592
+rs6000_split_logical_di (rtx operands[3],
 
19593
+                        enum rtx_code code,
 
19594
+                        bool complement_final_p,
 
19595
+                        bool complement_op1_p,
 
19596
+                        bool complement_op2_p,
 
19597
+                        rtx clobber_reg)
 
19598
+{
 
19599
+  const HOST_WIDE_INT lower_32bits = HOST_WIDE_INT_C(0xffffffff);
 
19600
+  const HOST_WIDE_INT upper_32bits = ~ lower_32bits;
 
19601
+  const HOST_WIDE_INT sign_bit = HOST_WIDE_INT_C(0x80000000);
 
19602
+  enum hi_lo { hi = 0, lo = 1 };
 
19603
+  rtx op0_hi_lo[2], op1_hi_lo[2], op2_hi_lo[2];
 
19604
+  size_t i;
 
19605
+
 
19606
+  op0_hi_lo[hi] = gen_highpart (SImode, operands[0]);
 
19607
+  op1_hi_lo[hi] = gen_highpart (SImode, operands[1]);
 
19608
+  op0_hi_lo[lo] = gen_lowpart (SImode, operands[0]);
 
19609
+  op1_hi_lo[lo] = gen_lowpart (SImode, operands[1]);
 
19610
+
 
19611
+  if (code == NOT)
 
19612
+    op2_hi_lo[hi] = op2_hi_lo[lo] = NULL_RTX;
 
19613
+  else
 
19614
+    {
 
19615
+      if (GET_CODE (operands[2]) != CONST_INT)
 
19616
+       {
 
19617
+         op2_hi_lo[hi] = gen_highpart_mode (SImode, DImode, operands[2]);
 
19618
+         op2_hi_lo[lo] = gen_lowpart (SImode, operands[2]);
 
19619
+       }
 
19620
+      else
 
19621
+       {
 
19622
+         HOST_WIDE_INT value = INTVAL (operands[2]);
 
19623
+         HOST_WIDE_INT value_hi_lo[2];
 
19624
+
 
19625
+         gcc_assert (!complement_final_p);
 
19626
+         gcc_assert (!complement_op1_p);
 
19627
+         gcc_assert (!complement_op2_p);
 
19628
+
 
19629
+         value_hi_lo[hi] = value >> 32;
 
19630
+         value_hi_lo[lo] = value & lower_32bits;
 
19631
+
 
19632
+         for (i = 0; i < 2; i++)
 
19633
+           {
 
19634
+             HOST_WIDE_INT sub_value = value_hi_lo[i];
 
19635
+
 
19636
+             if (sub_value & sign_bit)
 
19637
+               sub_value |= upper_32bits;
 
19638
+
 
19639
+             op2_hi_lo[i] = GEN_INT (sub_value);
 
19640
+
 
19641
+             /* If this is an AND instruction, check to see if we need to load
 
19642
+                the value in a register.  */
 
19643
+             if (code == AND && sub_value != -1 && sub_value != 0
 
19644
+                 && !and_operand (op2_hi_lo[i], SImode))
 
19645
+               op2_hi_lo[i] = force_reg (SImode, op2_hi_lo[i]);
 
19646
+           }
 
19647
+       }
 
19648
+    }
 
19649
+
 
19650
+  for (i = 0; i < 2; i++)
 
19651
+    {
 
19652
+      /* Split large IOR/XOR operations.  */
 
19653
+      if ((code == IOR || code == XOR)
 
19654
+         && GET_CODE (op2_hi_lo[i]) == CONST_INT
 
19655
+         && !complement_final_p
 
19656
+         && !complement_op1_p
 
19657
+         && !complement_op2_p
 
19658
+         && clobber_reg == NULL_RTX
 
19659
+         && !logical_const_operand (op2_hi_lo[i], SImode))
 
19660
+       {
 
19661
+         HOST_WIDE_INT value = INTVAL (op2_hi_lo[i]);
 
19662
+         HOST_WIDE_INT hi_16bits = value & HOST_WIDE_INT_C(0xffff0000);
 
19663
+         HOST_WIDE_INT lo_16bits = value & HOST_WIDE_INT_C(0x0000ffff);
 
19664
+         rtx tmp = gen_reg_rtx (SImode);
 
19665
+
 
19666
+         /* Make sure the constant is sign extended.  */
 
19667
+         if ((hi_16bits & sign_bit) != 0)
 
19668
+           hi_16bits |= upper_32bits;
 
19669
+
 
19670
+         rs6000_split_logical_inner (tmp, op1_hi_lo[i], GEN_INT (hi_16bits),
 
19671
+                                     code, SImode, false, false, false,
 
19672
+                                     NULL_RTX);
 
19673
+
 
19674
+         rs6000_split_logical_inner (op0_hi_lo[i], tmp, GEN_INT (lo_16bits),
 
19675
+                                     code, SImode, false, false, false,
 
19676
+                                     NULL_RTX);
 
19677
+       }
 
19678
+      else
 
19679
+       rs6000_split_logical_inner (op0_hi_lo[i], op1_hi_lo[i], op2_hi_lo[i],
 
19680
+                                   code, SImode, complement_final_p,
 
19681
+                                   complement_op1_p, complement_op2_p,
 
19682
+                                   clobber_reg);
 
19683
+    }
 
19684
+
 
19685
+  return;
 
19686
+}
 
19687
+
 
19688
+/* Split the insns that make up boolean operations operating on multiple GPR
 
19689
+   registers.  The boolean MD patterns ensure that the inputs either are
 
19690
+   exactly the same as the output registers, or there is no overlap.
 
19691
+
 
19692
+   OPERANDS is an array containing the destination and two input operands.
 
19693
+   CODE is the base operation (AND, IOR, XOR, NOT).
 
19694
+   MODE is the machine mode.
 
19695
+   If COMPLEMENT_FINAL_P is true, wrap the whole operation with NOT.
 
19696
+   If COMPLEMENT_OP1_P is true, wrap operand1 with NOT.
 
19697
+   If COMPLEMENT_OP2_P is true, wrap operand2 with NOT.
 
19698
+   CLOBBER_REG is either NULL or a scratch register of type CC to allow
 
19699
+   formation of the AND instructions.  */
 
19700
+
 
19701
+void
 
19702
+rs6000_split_logical (rtx operands[3],
 
19703
+                     enum rtx_code code,
 
19704
+                     bool complement_final_p,
 
19705
+                     bool complement_op1_p,
 
19706
+                     bool complement_op2_p,
 
19707
+                     rtx clobber_reg)
 
19708
+{
 
19709
+  enum machine_mode mode = GET_MODE (operands[0]);
 
19710
+  enum machine_mode sub_mode;
 
19711
+  rtx op0, op1, op2;
 
19712
+  int sub_size, regno0, regno1, nregs, i;
 
19713
+
 
19714
+  /* If this is DImode, use the specialized version that can run before
 
19715
+     register allocation.  */
 
19716
+  if (mode == DImode && !TARGET_POWERPC64)
 
19717
+    {
 
19718
+      rs6000_split_logical_di (operands, code, complement_final_p,
 
19719
+                              complement_op1_p, complement_op2_p,
 
19720
+                              clobber_reg);
 
19721
+      return;
 
19722
+    }
 
19723
+
 
19724
+  op0 = operands[0];
 
19725
+  op1 = operands[1];
 
19726
+  op2 = (code == NOT) ? NULL_RTX : operands[2];
 
19727
+  sub_mode = (TARGET_POWERPC64) ? DImode : SImode;
 
19728
+  sub_size = GET_MODE_SIZE (sub_mode);
 
19729
+  regno0 = REGNO (op0);
 
19730
+  regno1 = REGNO (op1);
 
19731
+
 
19732
+  gcc_assert (reload_completed);
 
19733
+  gcc_assert (IN_RANGE (regno0, FIRST_GPR_REGNO, LAST_GPR_REGNO));
 
19734
+  gcc_assert (IN_RANGE (regno1, FIRST_GPR_REGNO, LAST_GPR_REGNO));
 
19735
+
 
19736
+  nregs = rs6000_hard_regno_nregs[(int)mode][regno0];
 
19737
+  gcc_assert (nregs > 1);
 
19738
+
 
19739
+  if (op2 && REG_P (op2))
 
19740
+    gcc_assert (IN_RANGE (REGNO (op2), FIRST_GPR_REGNO, LAST_GPR_REGNO));
 
19741
+
 
19742
+  for (i = 0; i < nregs; i++)
 
19743
+    {
 
19744
+      int offset = i * sub_size;
 
19745
+      rtx sub_op0 = simplify_subreg (sub_mode, op0, mode, offset);
 
19746
+      rtx sub_op1 = simplify_subreg (sub_mode, op1, mode, offset);
 
19747
+      rtx sub_op2 = ((code == NOT)
 
19748
+                    ? NULL_RTX
 
19749
+                    : simplify_subreg (sub_mode, op2, mode, offset));
 
19750
+
 
19751
+      rs6000_split_logical_inner (sub_op0, sub_op1, sub_op2, code, sub_mode,
 
19752
+                                 complement_final_p, complement_op1_p,
 
19753
+                                 complement_op2_p, clobber_reg);
 
19754
+    }
 
19755
+
 
19756
+  return;
 
19757
+}
 
19758
+
 
19759
+
 
19760
+/* Return true if the peephole2 can combine a load involving a combination of
 
19761
+   an addis instruction and a load with an offset that can be fused together on
 
19762
+   a power8.
 
19763
+
 
19764
+   The operands are:
 
19765
+       operands[0]     register set with addis
 
19766
+       operands[1]     value set via addis
 
19767
+       operands[2]     target register being loaded
 
19768
+       operands[3]     D-form memory reference using operands[0].
 
19769
+
 
19770
+   In addition, we are passed a boolean that is true if this is a peephole2,
 
19771
+   and we can use see if the addis_reg is dead after the insn and can be
 
19772
+   replaced by the target register.  */
 
19773
+
 
19774
+bool
 
19775
+fusion_gpr_load_p (rtx *operands, bool peep2_p)
 
19776
+{
 
19777
+  rtx addis_reg = operands[0];
 
19778
+  rtx addis_value = operands[1];
 
19779
+  rtx target = operands[2];
 
19780
+  rtx mem = operands[3];
 
19781
+  rtx addr;
 
19782
+  rtx base_reg;
 
19783
+
 
19784
+  /* Validate arguments.  */
 
19785
+  if (!base_reg_operand (addis_reg, GET_MODE (addis_reg)))
 
19786
+    return false;
 
19787
+
 
19788
+  if (!base_reg_operand (target, GET_MODE (target)))
 
19789
+    return false;
 
19790
+
 
19791
+  if (!fusion_gpr_addis (addis_value, GET_MODE (addis_value)))
 
19792
+    return false;
 
19793
+
 
19794
+  if (!fusion_gpr_mem_load (mem, GET_MODE (mem)))
 
19795
+    return false;
 
19796
+
 
19797
+  /* Allow sign/zero extension.  */
 
19798
+  if (GET_CODE (mem) == ZERO_EXTEND
 
19799
+      || (GET_CODE (mem) == SIGN_EXTEND && TARGET_P8_FUSION_SIGN))
 
19800
+    mem = XEXP (mem, 0);
 
19801
+
 
19802
+  if (!MEM_P (mem))
 
19803
+    return false;
 
19804
+
 
19805
+  addr = XEXP (mem, 0);                        /* either PLUS or LO_SUM.  */
 
19806
+  if (GET_CODE (addr) != PLUS && GET_CODE (addr) != LO_SUM)
 
19807
+    return false;
 
19808
+
 
19809
+  /* Validate that the register used to load the high value is either the
 
19810
+     register being loaded, or we can safely replace its use in a peephole2.
 
19811
+
 
19812
+     If this is a peephole2, we assume that there are 2 instructions in the
 
19813
+     peephole (addis and load), so we want to check if the target register was
 
19814
+     not used in the memory address and the register to hold the addis result
 
19815
+     is dead after the peephole.  */
 
19816
+  if (REGNO (addis_reg) != REGNO (target))
 
19817
+    {
 
19818
+      if (!peep2_p)
 
19819
+       return false;
 
19820
+
 
19821
+      if (reg_mentioned_p (target, mem))
 
19822
+       return false;
 
19823
+
 
19824
+      if (!peep2_reg_dead_p (2, addis_reg))
 
19825
+       return false;
 
19826
+    }
 
19827
+
 
19828
+  base_reg = XEXP (addr, 0);
 
19829
+  return REGNO (addis_reg) == REGNO (base_reg);
 
19830
+}
 
19831
+
 
19832
+/* During the peephole2 pass, adjust and expand the insns for a load fusion
 
19833
+   sequence.  We adjust the addis register to use the target register.  If the
 
19834
+   load sign extends, we adjust the code to do the zero extending load, and an
 
19835
+   explicit sign extension later since the fusion only covers zero extending
 
19836
+   loads.
 
19837
+
 
19838
+   The operands are:
 
19839
+       operands[0]     register set with addis (to be replaced with target)
 
19840
+       operands[1]     value set via addis
 
19841
+       operands[2]     target register being loaded
 
19842
+       operands[3]     D-form memory reference using operands[0].  */
 
19843
+
 
19844
+void
 
19845
+expand_fusion_gpr_load (rtx *operands)
 
19846
+{
 
19847
+  rtx addis_value = operands[1];
 
19848
+  rtx target = operands[2];
 
19849
+  rtx orig_mem = operands[3];
 
19850
+  rtx  new_addr, new_mem, orig_addr, offset;
 
19851
+  enum rtx_code plus_or_lo_sum;
 
19852
+  enum machine_mode target_mode = GET_MODE (target);
 
19853
+  enum machine_mode extend_mode = target_mode;
 
19854
+  enum machine_mode ptr_mode = Pmode;
 
19855
+  enum rtx_code extend = UNKNOWN;
 
19856
+  rtx addis_reg = ((ptr_mode == target_mode)
 
19857
+                  ? target
 
19858
+                  : simplify_subreg (ptr_mode, target, target_mode, 0));
 
19859
+
 
19860
+  if (GET_CODE (orig_mem) == ZERO_EXTEND
 
19861
+      || (TARGET_P8_FUSION_SIGN && GET_CODE (orig_mem) == SIGN_EXTEND))
 
19862
+    {
 
19863
+      extend = GET_CODE (orig_mem);
 
19864
+      orig_mem = XEXP (orig_mem, 0);
 
19865
+      target_mode = GET_MODE (orig_mem);
 
19866
+    }
 
19867
+
 
19868
+  gcc_assert (MEM_P (orig_mem));
 
19869
+
 
19870
+  orig_addr = XEXP (orig_mem, 0);
 
19871
+  plus_or_lo_sum = GET_CODE (orig_addr);
 
19872
+  gcc_assert (plus_or_lo_sum == PLUS || plus_or_lo_sum == LO_SUM);
 
19873
+
 
19874
+  offset = XEXP (orig_addr, 1);
 
19875
+  new_addr = gen_rtx_fmt_ee (plus_or_lo_sum, ptr_mode, addis_reg, offset);
 
19876
+  new_mem = change_address (orig_mem, target_mode, new_addr);
 
19877
+
 
19878
+  if (extend != UNKNOWN)
 
19879
+    new_mem = gen_rtx_fmt_e (ZERO_EXTEND, extend_mode, new_mem);
 
19880
+
 
19881
+  emit_insn (gen_rtx_SET (VOIDmode, addis_reg, addis_value));
 
19882
+  emit_insn (gen_rtx_SET (VOIDmode, target, new_mem));
 
19883
+
 
19884
+  if (extend == SIGN_EXTEND)
 
19885
+    {
 
19886
+      int sub_off = ((BYTES_BIG_ENDIAN)
 
19887
+                    ? GET_MODE_SIZE (extend_mode) - GET_MODE_SIZE (target_mode)
 
19888
+                    : 0);
 
19889
+      rtx sign_reg
 
19890
+       = simplify_subreg (target_mode, target, extend_mode, sub_off);
 
19891
+
 
19892
+      emit_insn (gen_rtx_SET (VOIDmode, target,
 
19893
+                             gen_rtx_SIGN_EXTEND (extend_mode, sign_reg)));
 
19894
+    }
 
19895
+
 
19896
+  return;
 
19897
+}
 
19898
+
 
19899
+/* Return a string to fuse an addis instruction with a gpr load to the same
 
19900
+   register that we loaded up the addis instruction.  The code is complicated,
 
19901
+   so we call output_asm_insn directly, and just return "".
 
19902
+
 
19903
+   The operands are:
 
19904
+       operands[0]     register set with addis (must be same reg as target).
 
19905
+       operands[1]     value set via addis
 
19906
+       operands[2]     target register being loaded
 
19907
+       operands[3]     D-form memory reference using operands[0].  */
 
19908
+
 
19909
+const char *
 
19910
+emit_fusion_gpr_load (rtx *operands)
 
19911
+{
 
19912
+  rtx addis_reg = operands[0];
 
19913
+  rtx addis_value = operands[1];
 
19914
+  rtx target = operands[2];
 
19915
+  rtx mem = operands[3];
 
19916
+  rtx fuse_ops[10];
 
19917
+  rtx addr;
 
19918
+  rtx load_offset;
 
19919
+  const char *addis_str = NULL;
 
19920
+  const char *load_str = NULL;
 
19921
+  const char *extend_insn = NULL;
 
19922
+  const char *mode_name = NULL;
 
19923
+  char insn_template[80];
 
19924
+  enum machine_mode mode;
 
19925
+  const char *comment_str = ASM_COMMENT_START;
 
19926
+  bool sign_p = false;
 
19927
+
 
19928
+  gcc_assert (REG_P (addis_reg) && REG_P (target));
 
19929
+  gcc_assert (REGNO (addis_reg) == REGNO (target));
 
19930
+
 
19931
+  if (*comment_str == ' ')
 
19932
+    comment_str++;
 
19933
+
 
19934
+  /* Allow sign/zero extension.  */
 
19935
+  if (GET_CODE (mem) == ZERO_EXTEND)
 
19936
+    mem = XEXP (mem, 0);
 
19937
+
 
19938
+  else if (GET_CODE (mem) == SIGN_EXTEND && TARGET_P8_FUSION_SIGN)
 
19939
+    {
 
19940
+      sign_p = true;
 
19941
+      mem = XEXP (mem, 0);
 
19942
+    }
 
19943
+
 
19944
+  gcc_assert (MEM_P (mem));
 
19945
+  addr = XEXP (mem, 0);
 
19946
+  if (GET_CODE (addr) != PLUS && GET_CODE (addr) != LO_SUM)
 
19947
+    gcc_unreachable ();
 
19948
+
 
19949
+  load_offset = XEXP (addr, 1);
 
19950
+
 
19951
+  /* Now emit the load instruction to the same register.  */
 
19952
+  mode = GET_MODE (mem);
 
19953
+  switch (mode)
 
19954
+    {
 
19955
+    case QImode:
 
19956
+      mode_name = "char";
 
19957
+      load_str = "lbz";
 
19958
+      extend_insn = "extsb %0,%0";
 
19959
+      break;
 
19960
+
 
19961
+    case HImode:
 
19962
+      mode_name = "short";
 
19963
+      load_str = "lhz";
 
19964
+      extend_insn = "extsh %0,%0";
 
19965
+      break;
 
19966
+
 
19967
+    case SImode:
 
19968
+      mode_name = "int";
 
19969
+      load_str = "lwz";
 
19970
+      extend_insn = "extsw %0,%0";
 
19971
+      break;
 
19972
+
 
19973
+    case DImode:
 
19974
+      if (TARGET_POWERPC64)
 
19975
+       {
 
19976
+         mode_name = "long";
 
19977
+         load_str = "ld";
 
19978
+       }
 
19979
+      else
 
19980
+       gcc_unreachable ();
 
19981
+      break;
 
19982
+
 
19983
+    default:
 
19984
+      gcc_unreachable ();
 
19985
+    }
 
19986
+
 
19987
+  /* Emit the addis instruction.  */
 
19988
+  fuse_ops[0] = target;
 
19989
+  if (satisfies_constraint_L (addis_value))
 
19990
+    {
 
19991
+      fuse_ops[1] = addis_value;
 
19992
+      addis_str = "lis %0,%v1";
 
19993
+    }
 
19994
+
 
19995
+  else if (GET_CODE (addis_value) == PLUS)
 
19996
+    {
 
19997
+      rtx op0 = XEXP (addis_value, 0);
 
19998
+      rtx op1 = XEXP (addis_value, 1);
 
19999
+
 
20000
+      if (REG_P (op0) && CONST_INT_P (op1)
 
20001
+         && satisfies_constraint_L (op1))
 
20002
+       {
 
20003
+         fuse_ops[1] = op0;
 
20004
+         fuse_ops[2] = op1;
 
20005
+         addis_str = "addis %0,%1,%v2";
 
20006
+       }
 
20007
+    }
 
20008
+
 
20009
+  else if (GET_CODE (addis_value) == HIGH)
 
20010
+    {
 
20011
+      rtx value = XEXP (addis_value, 0);
 
20012
+      if (GET_CODE (value) == UNSPEC && XINT (value, 1) == UNSPEC_TOCREL)
 
20013
+       {
 
20014
+         fuse_ops[1] = XVECEXP (value, 0, 0);          /* symbol ref.  */
 
20015
+         fuse_ops[2] = XVECEXP (value, 0, 1);          /* TOC register.  */
 
20016
+         if (TARGET_ELF)
 
20017
+           addis_str = "addis %0,%2,%1@toc@ha";
 
20018
+
 
20019
+         else if (TARGET_XCOFF)
 
20020
+           addis_str = "addis %0,%1@u(%2)";
 
20021
+
 
20022
+         else
 
20023
+           gcc_unreachable ();
 
20024
+       }
 
20025
+
 
20026
+      else if (GET_CODE (value) == PLUS)
 
20027
+       {
 
20028
+         rtx op0 = XEXP (value, 0);
 
20029
+         rtx op1 = XEXP (value, 1);
 
20030
+
 
20031
+         if (GET_CODE (op0) == UNSPEC
 
20032
+             && XINT (op0, 1) == UNSPEC_TOCREL
 
20033
+             && CONST_INT_P (op1))
 
20034
+           {
 
20035
+             fuse_ops[1] = XVECEXP (op0, 0, 0);        /* symbol ref.  */
 
20036
+             fuse_ops[2] = XVECEXP (op0, 0, 1);        /* TOC register.  */
 
20037
+             fuse_ops[3] = op1;
 
20038
+             if (TARGET_ELF)
 
20039
+               addis_str = "addis %0,%2,%1+%3@toc@ha";
 
20040
+
 
20041
+             else if (TARGET_XCOFF)
 
20042
+               addis_str = "addis %0,%1+%3@u(%2)";
 
20043
+
 
20044
+             else
 
20045
+               gcc_unreachable ();
 
20046
+           }
 
20047
+       }
 
20048
+
 
20049
+      else if (satisfies_constraint_L (value))
 
20050
+       {
 
20051
+         fuse_ops[1] = value;
 
20052
+         addis_str = "lis %0,%v1";
 
20053
+       }
 
20054
+
 
20055
+      else if (TARGET_ELF && !TARGET_POWERPC64 && CONSTANT_P (value))
 
20056
+       {
 
20057
+         fuse_ops[1] = value;
 
20058
+         addis_str = "lis %0,%1@ha";
 
20059
+       }
 
20060
+    }
 
20061
+
 
20062
+  if (!addis_str)
 
20063
+    fatal_insn ("Could not generate addis value for fusion", addis_value);
 
20064
+
 
20065
+  sprintf (insn_template, "%s\t\t%s gpr load fusion, type %s", addis_str,
 
20066
+          comment_str, mode_name);
 
20067
+  output_asm_insn (insn_template, fuse_ops);
 
20068
+
 
20069
+  /* Emit the D-form load instruction.  */
 
20070
+  if (CONST_INT_P (load_offset) && satisfies_constraint_I (load_offset))
 
20071
+    {
 
20072
+      sprintf (insn_template, "%s %%0,%%1(%%0)", load_str);
 
20073
+      fuse_ops[1] = load_offset;
 
20074
+      output_asm_insn (insn_template, fuse_ops);
 
20075
+    }
 
20076
+
 
20077
+  else if (GET_CODE (load_offset) == UNSPEC
 
20078
+          && XINT (load_offset, 1) == UNSPEC_TOCREL)
 
20079
+    {
 
20080
+      if (TARGET_ELF)
 
20081
+       sprintf (insn_template, "%s %%0,%%1@toc@l(%%0)", load_str);
 
20082
+
 
20083
+      else if (TARGET_XCOFF)
 
20084
+       sprintf (insn_template, "%s %%0,%%1@l(%%0)", load_str);
 
20085
+
 
20086
+      else
 
20087
+       gcc_unreachable ();
 
20088
+
 
20089
+      fuse_ops[1] = XVECEXP (load_offset, 0, 0);
 
20090
+      output_asm_insn (insn_template, fuse_ops);
 
20091
+    }
 
20092
+
 
20093
+  else if (GET_CODE (load_offset) == PLUS
 
20094
+          && GET_CODE (XEXP (load_offset, 0)) == UNSPEC
 
20095
+          && XINT (XEXP (load_offset, 0), 1) == UNSPEC_TOCREL
 
20096
+          && CONST_INT_P (XEXP (load_offset, 1)))
 
20097
+    {
 
20098
+      rtx tocrel_unspec = XEXP (load_offset, 0);
 
20099
+      if (TARGET_ELF)
 
20100
+       sprintf (insn_template, "%s %%0,%%1+%%2@toc@l(%%0)", load_str);
 
20101
+
 
20102
+      else if (TARGET_XCOFF)
 
20103
+       sprintf (insn_template, "%s %%0,%%1+%%2@l(%%0)", load_str);
 
20104
+
 
20105
+      else
 
20106
+       gcc_unreachable ();
 
20107
+
 
20108
+      fuse_ops[1] = XVECEXP (tocrel_unspec, 0, 0);
 
20109
+      fuse_ops[2] = XEXP (load_offset, 1);
 
20110
+      output_asm_insn (insn_template, fuse_ops);
 
20111
+    }
 
20112
+
 
20113
+  else if (TARGET_ELF && !TARGET_POWERPC64 && CONSTANT_P (load_offset))
 
20114
+    {
 
20115
+      sprintf (insn_template, "%s %%0,%%1@l(%%0)", load_str);
 
20116
+
 
20117
+      fuse_ops[1] = load_offset;
 
20118
+      output_asm_insn (insn_template, fuse_ops);
 
20119
+    }
 
20120
+
 
20121
+  else
 
20122
+    fatal_insn ("Unable to generate load offset for fusion", load_offset);
 
20123
+
 
20124
+  /* Handle sign extension.  The peephole2 pass generates this as a separate
 
20125
+     insn, but we handle it just in case it got reattached.  */
 
20126
+  if (sign_p)
 
20127
+    {
 
20128
+      gcc_assert (extend_insn != NULL);
 
20129
+      output_asm_insn (extend_insn, fuse_ops);
 
20130
+    }
 
20131
+
 
20132
+  return "";
 
20133
+}
 
20134
+
 
20135
+
 
20136
 struct gcc_target targetm = TARGET_INITIALIZER;
 
20137
 
 
20138
 #include "gt-rs6000.h"
 
20139
--- a/src/gcc/config/rs6000/vsx.md
 
20140
+++ b/src/gcc/config/rs6000/vsx.md
 
20141
@@ -40,6 +40,14 @@
 
20142
 ;; it to use gprs as well as vsx registers.
 
20143
 (define_mode_iterator VSX_M [V16QI V8HI V4SI V2DI V4SF V2DF])
 
20144
 
 
20145
+(define_mode_iterator VSX_M2 [V16QI
 
20146
+                             V8HI
 
20147
+                             V4SI
 
20148
+                             V2DI
 
20149
+                             V4SF
 
20150
+                             V2DF
 
20151
+                             (TI       "TARGET_VSX_TIMODE")])
 
20152
+
 
20153
 ;; Map into the appropriate load/store name based on the type
 
20154
 (define_mode_attr VSm  [(V16QI "vw4")
 
20155
                        (V8HI  "vw4")
 
20156
@@ -48,7 +56,7 @@
 
20157
                        (V2DF  "vd2")
 
20158
                        (V2DI  "vd2")
 
20159
                        (DF    "d")
 
20160
-                       (TI    "vw4")])
 
20161
+                       (TI    "vd2")])
 
20162
 
 
20163
 ;; Map into the appropriate suffix based on the type
 
20164
 (define_mode_attr VSs  [(V16QI "sp")
 
20165
@@ -59,7 +67,7 @@
 
20166
                         (V2DI  "dp")
 
20167
                         (DF    "dp")
 
20168
                         (SF    "sp")
 
20169
-                        (TI    "sp")])
 
20170
+                        (TI    "dp")])
 
20171
 
 
20172
 ;; Map the register class used
 
20173
 (define_mode_attr VSr  [(V16QI "v")
 
20174
@@ -70,7 +78,7 @@
 
20175
                         (V2DF  "wd")
 
20176
                         (DF    "ws")
 
20177
                         (SF    "d")
 
20178
-                        (TI    "wd")])
 
20179
+                        (TI    "wt")])
 
20180
 
 
20181
 ;; Map the register class used for float<->int conversions
 
20182
 (define_mode_attr VSr2 [(V2DF  "wd")
 
20183
@@ -115,7 +123,6 @@
 
20184
                         (V4SF  "v")
 
20185
                         (V2DI  "v")
 
20186
                         (V2DF  "v")
 
20187
-                        (TI    "v")
 
20188
                         (DF    "s")])
 
20189
 
 
20190
 ;; Appropriate type for add ops (and other simple FP ops)
 
20191
@@ -192,6 +199,8 @@
 
20192
    UNSPEC_VSX_CVDPSXWS
 
20193
    UNSPEC_VSX_CVDPUXWS
 
20194
    UNSPEC_VSX_CVSPDP
 
20195
+   UNSPEC_VSX_CVSPDPN
 
20196
+   UNSPEC_VSX_CVDPSPN
 
20197
    UNSPEC_VSX_CVSXWDP
 
20198
    UNSPEC_VSX_CVUXWDP
 
20199
    UNSPEC_VSX_CVSXDSP
 
20200
@@ -207,77 +216,393 @@
 
20201
   ])
 
20202
 
 
20203
 ;; VSX moves
 
20204
-(define_insn "*vsx_mov<mode>"
 
20205
-  [(set (match_operand:VSX_M 0 "nonimmediate_operand" "=Z,<VSr>,<VSr>,?Z,?wa,?wa,*Y,*r,*r,<VSr>,?wa,*r,v,wZ,v")
 
20206
-       (match_operand:VSX_M 1 "input_operand" "<VSr>,Z,<VSr>,wa,Z,wa,r,Y,r,j,j,j,W,v,wZ"))]
 
20207
-  "VECTOR_MEM_VSX_P (<MODE>mode)
 
20208
-   && (register_operand (operands[0], <MODE>mode) 
 
20209
-       || register_operand (operands[1], <MODE>mode))"
 
20210
+
 
20211
+;; The patterns for LE permuted loads and stores come before the general
 
20212
+;; VSX moves so they match first.
 
20213
+(define_insn_and_split "*vsx_le_perm_load_<mode>"
 
20214
+  [(set (match_operand:VSX_D 0 "vsx_register_operand" "=wa")
 
20215
+        (match_operand:VSX_D 1 "memory_operand" "Z"))]
 
20216
+  "!BYTES_BIG_ENDIAN && TARGET_VSX"
 
20217
+  "#"
 
20218
+  "!BYTES_BIG_ENDIAN && TARGET_VSX"
 
20219
+  [(set (match_dup 2)
 
20220
+        (vec_select:<MODE>
 
20221
+          (match_dup 1)
 
20222
+          (parallel [(const_int 1) (const_int 0)])))
 
20223
+   (set (match_dup 0)
 
20224
+        (vec_select:<MODE>
 
20225
+          (match_dup 2)
 
20226
+          (parallel [(const_int 1) (const_int 0)])))]
 
20227
+  "
 
20228
 {
 
20229
-  switch (which_alternative)
 
20230
-    {
 
20231
-    case 0:
 
20232
-    case 3:
 
20233
-      gcc_assert (MEM_P (operands[0])
 
20234
-                 && GET_CODE (XEXP (operands[0], 0)) != PRE_INC
 
20235
-                 && GET_CODE (XEXP (operands[0], 0)) != PRE_DEC
 
20236
-                 && GET_CODE (XEXP (operands[0], 0)) != PRE_MODIFY);
 
20237
-      return "stx<VSm>x %x1,%y0";
 
20238
+  operands[2] = can_create_pseudo_p () ? gen_reg_rtx_and_attrs (operands[0])
 
20239
+                                       : operands[0];
 
20240
+}
 
20241
+  "
 
20242
+  [(set_attr "type" "vecload")
 
20243
+   (set_attr "length" "8")])
 
20244
 
 
20245
-    case 1:
 
20246
-    case 4:
 
20247
-      gcc_assert (MEM_P (operands[1])
 
20248
-                 && GET_CODE (XEXP (operands[1], 0)) != PRE_INC
 
20249
-                 && GET_CODE (XEXP (operands[1], 0)) != PRE_DEC
 
20250
-                 && GET_CODE (XEXP (operands[1], 0)) != PRE_MODIFY);
 
20251
-      return "lx<VSm>x %x0,%y1";
 
20252
+(define_insn_and_split "*vsx_le_perm_load_<mode>"
 
20253
+  [(set (match_operand:VSX_W 0 "vsx_register_operand" "=wa")
 
20254
+        (match_operand:VSX_W 1 "memory_operand" "Z"))]
 
20255
+  "!BYTES_BIG_ENDIAN && TARGET_VSX"
 
20256
+  "#"
 
20257
+  "!BYTES_BIG_ENDIAN && TARGET_VSX"
 
20258
+  [(set (match_dup 2)
 
20259
+        (vec_select:<MODE>
 
20260
+          (match_dup 1)
 
20261
+          (parallel [(const_int 2) (const_int 3)
 
20262
+                     (const_int 0) (const_int 1)])))
 
20263
+   (set (match_dup 0)
 
20264
+        (vec_select:<MODE>
 
20265
+          (match_dup 2)
 
20266
+          (parallel [(const_int 2) (const_int 3)
 
20267
+                     (const_int 0) (const_int 1)])))]
 
20268
+  "
 
20269
+{
 
20270
+  operands[2] = can_create_pseudo_p () ? gen_reg_rtx_and_attrs (operands[0])
 
20271
+                                       : operands[0];
 
20272
+}
 
20273
+  "
 
20274
+  [(set_attr "type" "vecload")
 
20275
+   (set_attr "length" "8")])
 
20276
 
 
20277
-    case 2:
 
20278
-    case 5:
 
20279
-      return "xxlor %x0,%x1,%x1";
 
20280
+(define_insn_and_split "*vsx_le_perm_load_v8hi"
 
20281
+  [(set (match_operand:V8HI 0 "vsx_register_operand" "=wa")
 
20282
+        (match_operand:V8HI 1 "memory_operand" "Z"))]
 
20283
+  "!BYTES_BIG_ENDIAN && TARGET_VSX"
 
20284
+  "#"
 
20285
+  "!BYTES_BIG_ENDIAN && TARGET_VSX"
 
20286
+  [(set (match_dup 2)
 
20287
+        (vec_select:V8HI
 
20288
+          (match_dup 1)
 
20289
+          (parallel [(const_int 4) (const_int 5)
 
20290
+                     (const_int 6) (const_int 7)
 
20291
+                     (const_int 0) (const_int 1)
 
20292
+                     (const_int 2) (const_int 3)])))
 
20293
+   (set (match_dup 0)
 
20294
+        (vec_select:V8HI
 
20295
+          (match_dup 2)
 
20296
+          (parallel [(const_int 4) (const_int 5)
 
20297
+                     (const_int 6) (const_int 7)
 
20298
+                     (const_int 0) (const_int 1)
 
20299
+                     (const_int 2) (const_int 3)])))]
 
20300
+  "
 
20301
+{
 
20302
+  operands[2] = can_create_pseudo_p () ? gen_reg_rtx_and_attrs (operands[0])
 
20303
+                                       : operands[0];
 
20304
+}
 
20305
+  "
 
20306
+  [(set_attr "type" "vecload")
 
20307
+   (set_attr "length" "8")])
 
20308
 
 
20309
-    case 6:
 
20310
-    case 7:
 
20311
-    case 8:
 
20312
-    case 11:
 
20313
-      return "#";
 
20314
+(define_insn_and_split "*vsx_le_perm_load_v16qi"
 
20315
+  [(set (match_operand:V16QI 0 "vsx_register_operand" "=wa")
 
20316
+        (match_operand:V16QI 1 "memory_operand" "Z"))]
 
20317
+  "!BYTES_BIG_ENDIAN && TARGET_VSX"
 
20318
+  "#"
 
20319
+  "!BYTES_BIG_ENDIAN && TARGET_VSX"
 
20320
+  [(set (match_dup 2)
 
20321
+        (vec_select:V16QI
 
20322
+          (match_dup 1)
 
20323
+          (parallel [(const_int 8) (const_int 9)
 
20324
+                     (const_int 10) (const_int 11)
 
20325
+                     (const_int 12) (const_int 13)
 
20326
+                     (const_int 14) (const_int 15)
 
20327
+                     (const_int 0) (const_int 1)
 
20328
+                     (const_int 2) (const_int 3)
 
20329
+                     (const_int 4) (const_int 5)
 
20330
+                     (const_int 6) (const_int 7)])))
 
20331
+   (set (match_dup 0)
 
20332
+        (vec_select:V16QI
 
20333
+          (match_dup 2)
 
20334
+          (parallel [(const_int 8) (const_int 9)
 
20335
+                     (const_int 10) (const_int 11)
 
20336
+                     (const_int 12) (const_int 13)
 
20337
+                     (const_int 14) (const_int 15)
 
20338
+                     (const_int 0) (const_int 1)
 
20339
+                     (const_int 2) (const_int 3)
 
20340
+                     (const_int 4) (const_int 5)
 
20341
+                     (const_int 6) (const_int 7)])))]
 
20342
+  "
 
20343
+{
 
20344
+  operands[2] = can_create_pseudo_p () ? gen_reg_rtx_and_attrs (operands[0])
 
20345
+                                       : operands[0];
 
20346
+}
 
20347
+  "
 
20348
+  [(set_attr "type" "vecload")
 
20349
+   (set_attr "length" "8")])
 
20350
 
 
20351
-    case 9:
 
20352
-    case 10:
 
20353
-      return "xxlxor %x0,%x0,%x0";
 
20354
+(define_insn "*vsx_le_perm_store_<mode>"
 
20355
+  [(set (match_operand:VSX_D 0 "memory_operand" "=Z")
 
20356
+        (match_operand:VSX_D 1 "vsx_register_operand" "+wa"))]
 
20357
+  "!BYTES_BIG_ENDIAN && TARGET_VSX"
 
20358
+  "#"
 
20359
+  [(set_attr "type" "vecstore")
 
20360
+   (set_attr "length" "12")])
 
20361
 
 
20362
-    case 12:
 
20363
-      return output_vec_const_move (operands);
 
20364
+(define_split
 
20365
+  [(set (match_operand:VSX_D 0 "memory_operand" "")
 
20366
+        (match_operand:VSX_D 1 "vsx_register_operand" ""))]
 
20367
+  "!BYTES_BIG_ENDIAN && TARGET_VSX && !reload_completed"
 
20368
+  [(set (match_dup 2)
 
20369
+        (vec_select:<MODE>
 
20370
+          (match_dup 1)
 
20371
+          (parallel [(const_int 1) (const_int 0)])))
 
20372
+   (set (match_dup 0)
 
20373
+        (vec_select:<MODE>
 
20374
+          (match_dup 2)
 
20375
+          (parallel [(const_int 1) (const_int 0)])))]
 
20376
+{
 
20377
+  operands[2] = can_create_pseudo_p () ? gen_reg_rtx_and_attrs (operands[1]) 
 
20378
+                                       : operands[1];
 
20379
+})
 
20380
 
 
20381
-    case 13:
 
20382
-      gcc_assert (MEM_P (operands[0])
 
20383
-                 && GET_CODE (XEXP (operands[0], 0)) != PRE_INC
 
20384
-                 && GET_CODE (XEXP (operands[0], 0)) != PRE_DEC
 
20385
-                 && GET_CODE (XEXP (operands[0], 0)) != PRE_MODIFY);
 
20386
-      return "stvx %1,%y0";
 
20387
+;; The post-reload split requires that we re-permute the source
 
20388
+;; register in case it is still live.
 
20389
+(define_split
 
20390
+  [(set (match_operand:VSX_D 0 "memory_operand" "")
 
20391
+        (match_operand:VSX_D 1 "vsx_register_operand" ""))]
 
20392
+  "!BYTES_BIG_ENDIAN && TARGET_VSX && reload_completed"
 
20393
+  [(set (match_dup 1)
 
20394
+        (vec_select:<MODE>
 
20395
+          (match_dup 1)
 
20396
+          (parallel [(const_int 1) (const_int 0)])))
 
20397
+   (set (match_dup 0)
 
20398
+        (vec_select:<MODE>
 
20399
+          (match_dup 1)
 
20400
+          (parallel [(const_int 1) (const_int 0)])))
 
20401
+   (set (match_dup 1)
 
20402
+        (vec_select:<MODE>
 
20403
+          (match_dup 1)
 
20404
+          (parallel [(const_int 1) (const_int 0)])))]
 
20405
+  "")
 
20406
 
 
20407
-    case 14:
 
20408
-      gcc_assert (MEM_P (operands[0])
 
20409
-                 && GET_CODE (XEXP (operands[0], 0)) != PRE_INC
 
20410
-                 && GET_CODE (XEXP (operands[0], 0)) != PRE_DEC
 
20411
-                 && GET_CODE (XEXP (operands[0], 0)) != PRE_MODIFY);
 
20412
-      return "lvx %0,%y1";
 
20413
+(define_insn "*vsx_le_perm_store_<mode>"
 
20414
+  [(set (match_operand:VSX_W 0 "memory_operand" "=Z")
 
20415
+        (match_operand:VSX_W 1 "vsx_register_operand" "+wa"))]
 
20416
+  "!BYTES_BIG_ENDIAN && TARGET_VSX"
 
20417
+  "#"
 
20418
+  [(set_attr "type" "vecstore")
 
20419
+   (set_attr "length" "12")])
 
20420
 
 
20421
-    default:
 
20422
-      gcc_unreachable ();
 
20423
-    }
 
20424
+(define_split
 
20425
+  [(set (match_operand:VSX_W 0 "memory_operand" "")
 
20426
+        (match_operand:VSX_W 1 "vsx_register_operand" ""))]
 
20427
+  "!BYTES_BIG_ENDIAN && TARGET_VSX && !reload_completed"
 
20428
+  [(set (match_dup 2)
 
20429
+        (vec_select:<MODE>
 
20430
+          (match_dup 1)
 
20431
+          (parallel [(const_int 2) (const_int 3)
 
20432
+                    (const_int 0) (const_int 1)])))
 
20433
+   (set (match_dup 0)
 
20434
+        (vec_select:<MODE>
 
20435
+          (match_dup 2)
 
20436
+          (parallel [(const_int 2) (const_int 3)
 
20437
+                    (const_int 0) (const_int 1)])))]
 
20438
+{
 
20439
+  operands[2] = can_create_pseudo_p () ? gen_reg_rtx_and_attrs (operands[1]) 
 
20440
+                                       : operands[1];
 
20441
+})
 
20442
+
 
20443
+;; The post-reload split requires that we re-permute the source
 
20444
+;; register in case it is still live.
 
20445
+(define_split
 
20446
+  [(set (match_operand:VSX_W 0 "memory_operand" "")
 
20447
+        (match_operand:VSX_W 1 "vsx_register_operand" ""))]
 
20448
+  "!BYTES_BIG_ENDIAN && TARGET_VSX && reload_completed"
 
20449
+  [(set (match_dup 1)
 
20450
+        (vec_select:<MODE>
 
20451
+          (match_dup 1)
 
20452
+          (parallel [(const_int 2) (const_int 3)
 
20453
+                    (const_int 0) (const_int 1)])))
 
20454
+   (set (match_dup 0)
 
20455
+        (vec_select:<MODE>
 
20456
+          (match_dup 1)
 
20457
+          (parallel [(const_int 2) (const_int 3)
 
20458
+                    (const_int 0) (const_int 1)])))
 
20459
+   (set (match_dup 1)
 
20460
+        (vec_select:<MODE>
 
20461
+          (match_dup 1)
 
20462
+          (parallel [(const_int 2) (const_int 3)
 
20463
+                    (const_int 0) (const_int 1)])))]
 
20464
+  "")
 
20465
+
 
20466
+(define_insn "*vsx_le_perm_store_v8hi"
 
20467
+  [(set (match_operand:V8HI 0 "memory_operand" "=Z")
 
20468
+        (match_operand:V8HI 1 "vsx_register_operand" "+wa"))]
 
20469
+  "!BYTES_BIG_ENDIAN && TARGET_VSX"
 
20470
+  "#"
 
20471
+  [(set_attr "type" "vecstore")
 
20472
+   (set_attr "length" "12")])
 
20473
+
 
20474
+(define_split
 
20475
+  [(set (match_operand:V8HI 0 "memory_operand" "")
 
20476
+        (match_operand:V8HI 1 "vsx_register_operand" ""))]
 
20477
+  "!BYTES_BIG_ENDIAN && TARGET_VSX && !reload_completed"
 
20478
+  [(set (match_dup 2)
 
20479
+        (vec_select:V8HI
 
20480
+          (match_dup 1)
 
20481
+          (parallel [(const_int 4) (const_int 5)
 
20482
+                     (const_int 6) (const_int 7)
 
20483
+                     (const_int 0) (const_int 1)
 
20484
+                     (const_int 2) (const_int 3)])))
 
20485
+   (set (match_dup 0)
 
20486
+        (vec_select:V8HI
 
20487
+          (match_dup 2)
 
20488
+          (parallel [(const_int 4) (const_int 5)
 
20489
+                     (const_int 6) (const_int 7)
 
20490
+                     (const_int 0) (const_int 1)
 
20491
+                     (const_int 2) (const_int 3)])))]
 
20492
+{
 
20493
+  operands[2] = can_create_pseudo_p () ? gen_reg_rtx_and_attrs (operands[1]) 
 
20494
+                                       : operands[1];
 
20495
+})
 
20496
+
 
20497
+;; The post-reload split requires that we re-permute the source
 
20498
+;; register in case it is still live.
 
20499
+(define_split
 
20500
+  [(set (match_operand:V8HI 0 "memory_operand" "")
 
20501
+        (match_operand:V8HI 1 "vsx_register_operand" ""))]
 
20502
+  "!BYTES_BIG_ENDIAN && TARGET_VSX && reload_completed"
 
20503
+  [(set (match_dup 1)
 
20504
+        (vec_select:V8HI
 
20505
+          (match_dup 1)
 
20506
+          (parallel [(const_int 4) (const_int 5)
 
20507
+                     (const_int 6) (const_int 7)
 
20508
+                     (const_int 0) (const_int 1)
 
20509
+                     (const_int 2) (const_int 3)])))
 
20510
+   (set (match_dup 0)
 
20511
+        (vec_select:V8HI
 
20512
+          (match_dup 1)
 
20513
+          (parallel [(const_int 4) (const_int 5)
 
20514
+                     (const_int 6) (const_int 7)
 
20515
+                     (const_int 0) (const_int 1)
 
20516
+                     (const_int 2) (const_int 3)])))
 
20517
+   (set (match_dup 1)
 
20518
+        (vec_select:V8HI
 
20519
+          (match_dup 1)
 
20520
+          (parallel [(const_int 4) (const_int 5)
 
20521
+                     (const_int 6) (const_int 7)
 
20522
+                     (const_int 0) (const_int 1)
 
20523
+                     (const_int 2) (const_int 3)])))]
 
20524
+  "")
 
20525
+
 
20526
+(define_insn "*vsx_le_perm_store_v16qi"
 
20527
+  [(set (match_operand:V16QI 0 "memory_operand" "=Z")
 
20528
+        (match_operand:V16QI 1 "vsx_register_operand" "+wa"))]
 
20529
+  "!BYTES_BIG_ENDIAN && TARGET_VSX"
 
20530
+  "#"
 
20531
+  [(set_attr "type" "vecstore")
 
20532
+   (set_attr "length" "12")])
 
20533
+
 
20534
+(define_split
 
20535
+  [(set (match_operand:V16QI 0 "memory_operand" "")
 
20536
+        (match_operand:V16QI 1 "vsx_register_operand" ""))]
 
20537
+  "!BYTES_BIG_ENDIAN && TARGET_VSX && !reload_completed"
 
20538
+  [(set (match_dup 2)
 
20539
+        (vec_select:V16QI
 
20540
+          (match_dup 1)
 
20541
+          (parallel [(const_int 8) (const_int 9)
 
20542
+                     (const_int 10) (const_int 11)
 
20543
+                     (const_int 12) (const_int 13)
 
20544
+                     (const_int 14) (const_int 15)
 
20545
+                     (const_int 0) (const_int 1)
 
20546
+                     (const_int 2) (const_int 3)
 
20547
+                     (const_int 4) (const_int 5)
 
20548
+                     (const_int 6) (const_int 7)])))
 
20549
+   (set (match_dup 0)
 
20550
+        (vec_select:V16QI
 
20551
+          (match_dup 2)
 
20552
+          (parallel [(const_int 8) (const_int 9)
 
20553
+                     (const_int 10) (const_int 11)
 
20554
+                     (const_int 12) (const_int 13)
 
20555
+                     (const_int 14) (const_int 15)
 
20556
+                     (const_int 0) (const_int 1)
 
20557
+                     (const_int 2) (const_int 3)
 
20558
+                     (const_int 4) (const_int 5)
 
20559
+                     (const_int 6) (const_int 7)])))]
 
20560
+{
 
20561
+  operands[2] = can_create_pseudo_p () ? gen_reg_rtx_and_attrs (operands[1]) 
 
20562
+                                       : operands[1];
 
20563
+})
 
20564
+
 
20565
+;; The post-reload split requires that we re-permute the source
 
20566
+;; register in case it is still live.
 
20567
+(define_split
 
20568
+  [(set (match_operand:V16QI 0 "memory_operand" "")
 
20569
+        (match_operand:V16QI 1 "vsx_register_operand" ""))]
 
20570
+  "!BYTES_BIG_ENDIAN && TARGET_VSX && reload_completed"
 
20571
+  [(set (match_dup 1)
 
20572
+        (vec_select:V16QI
 
20573
+          (match_dup 1)
 
20574
+          (parallel [(const_int 8) (const_int 9)
 
20575
+                     (const_int 10) (const_int 11)
 
20576
+                     (const_int 12) (const_int 13)
 
20577
+                     (const_int 14) (const_int 15)
 
20578
+                     (const_int 0) (const_int 1)
 
20579
+                     (const_int 2) (const_int 3)
 
20580
+                     (const_int 4) (const_int 5)
 
20581
+                     (const_int 6) (const_int 7)])))
 
20582
+   (set (match_dup 0)
 
20583
+        (vec_select:V16QI
 
20584
+          (match_dup 1)
 
20585
+          (parallel [(const_int 8) (const_int 9)
 
20586
+                     (const_int 10) (const_int 11)
 
20587
+                     (const_int 12) (const_int 13)
 
20588
+                     (const_int 14) (const_int 15)
 
20589
+                     (const_int 0) (const_int 1)
 
20590
+                     (const_int 2) (const_int 3)
 
20591
+                     (const_int 4) (const_int 5)
 
20592
+                     (const_int 6) (const_int 7)])))
 
20593
+   (set (match_dup 1)
 
20594
+        (vec_select:V16QI
 
20595
+          (match_dup 1)
 
20596
+          (parallel [(const_int 8) (const_int 9)
 
20597
+                     (const_int 10) (const_int 11)
 
20598
+                     (const_int 12) (const_int 13)
 
20599
+                     (const_int 14) (const_int 15)
 
20600
+                     (const_int 0) (const_int 1)
 
20601
+                     (const_int 2) (const_int 3)
 
20602
+                     (const_int 4) (const_int 5)
 
20603
+                     (const_int 6) (const_int 7)])))]
 
20604
+  "")
 
20605
+
 
20606
+
 
20607
+(define_insn "*vsx_mov<mode>"
 
20608
+  [(set (match_operand:VSX_M 0 "nonimmediate_operand" "=Z,<VSr>,<VSr>,?Z,?wa,?wa,wQ,?&r,??Y,??r,??r,<VSr>,?wa,*r,v,wZ, v")
 
20609
+       (match_operand:VSX_M 1 "input_operand" "<VSr>,Z,<VSr>,wa,Z,wa,r,wQ,r,Y,r,j,j,j,W,v,wZ"))]
 
20610
+  "VECTOR_MEM_VSX_P (<MODE>mode)
 
20611
+   && (register_operand (operands[0], <MODE>mode) 
 
20612
+       || register_operand (operands[1], <MODE>mode))"
 
20613
+{
 
20614
+  return rs6000_output_move_128bit (operands);
 
20615
 }
 
20616
-  [(set_attr "type" "vecstore,vecload,vecsimple,vecstore,vecload,vecsimple,*,*,*,vecsimple,vecsimple,*,*,vecstore,vecload")])
 
20617
+  [(set_attr "type" "vecstore,vecload,vecsimple,vecstore,vecload,vecsimple,load,store,store,load, *,vecsimple,vecsimple,*, *,vecstore,vecload")
 
20618
+   (set_attr "length" "4,4,4,4,4,4,12,12,12,12,16,4,4,*,16,4,4")])
 
20619
 
 
20620
-;; Unlike other VSX moves, allow the GPRs, since a normal use of TImode is for
 
20621
-;; unions.  However for plain data movement, slightly favor the vector loads
 
20622
-(define_insn "*vsx_movti"
 
20623
-  [(set (match_operand:TI 0 "nonimmediate_operand" "=Z,wa,wa,?Y,?r,?r,wa,v,v,wZ")
 
20624
-       (match_operand:TI 1 "input_operand" "wa,Z,wa,r,Y,r,j,W,wZ,v"))]
 
20625
-  "VECTOR_MEM_VSX_P (TImode)
 
20626
+;; Unlike other VSX moves, allow the GPRs even for reloading, since a normal
 
20627
+;; use of TImode is for unions.  However for plain data movement, slightly
 
20628
+;; favor the vector loads
 
20629
+(define_insn "*vsx_movti_64bit"
 
20630
+  [(set (match_operand:TI 0 "nonimmediate_operand" "=Z,wa,wa,wa,v,v,wZ,wQ,&r,Y,r,r,?r")
 
20631
+       (match_operand:TI 1 "input_operand" "wa,Z,wa,O,W,wZ,v,r,wQ,r,Y,r,n"))]
 
20632
+  "TARGET_POWERPC64 && VECTOR_MEM_VSX_P (TImode)
 
20633
    && (register_operand (operands[0], TImode) 
 
20634
        || register_operand (operands[1], TImode))"
 
20635
 {
 
20636
+  return rs6000_output_move_128bit (operands);
 
20637
+}
 
20638
+  [(set_attr "type" "vecstore,vecload,vecsimple,vecsimple,vecsimple,vecstore,vecload,store,load,store,load,*,*")
 
20639
+   (set_attr "length" "4,4,4,4,16,4,4,8,8,8,8,8,8")])
 
20640
+
 
20641
+(define_insn "*vsx_movti_32bit"
 
20642
+  [(set (match_operand:TI 0 "nonimmediate_operand" "=Z,wa,wa,wa,v, v,wZ,Q,Y,????r,????r,????r,r")
 
20643
+       (match_operand:TI 1 "input_operand"        "wa, Z,wa, O,W,wZ, v,r,r,    Q,    Y,    r,n"))]
 
20644
+  "! TARGET_POWERPC64 && VECTOR_MEM_VSX_P (TImode)
 
20645
+   && (register_operand (operands[0], TImode)
 
20646
+       || register_operand (operands[1], TImode))"
 
20647
+{
 
20648
   switch (which_alternative)
 
20649
     {
 
20650
     case 0:
 
20651
@@ -290,27 +615,45 @@
 
20652
       return "xxlor %x0,%x1,%x1";
 
20653
 
 
20654
     case 3:
 
20655
+      return "xxlxor %x0,%x0,%x0";
 
20656
+
 
20657
     case 4:
 
20658
+      return output_vec_const_move (operands);
 
20659
+
 
20660
     case 5:
 
20661
-      return "#";
 
20662
+      return "stvx %1,%y0";
 
20663
 
 
20664
     case 6:
 
20665
-      return "xxlxor %x0,%x0,%x0";
 
20666
+      return "lvx %0,%y1";
 
20667
 
 
20668
     case 7:
 
20669
-      return output_vec_const_move (operands);
 
20670
+      if (TARGET_STRING)
 
20671
+        return \"stswi %1,%P0,16\";
 
20672
 
 
20673
     case 8:
 
20674
-      return "stvx %1,%y0";
 
20675
+      return \"#\";
 
20676
 
 
20677
     case 9:
 
20678
-      return "lvx %0,%y1";
 
20679
+      /* If the address is not used in the output, we can use lsi.  Otherwise,
 
20680
+        fall through to generating four loads.  */
 
20681
+      if (TARGET_STRING
 
20682
+          && ! reg_overlap_mentioned_p (operands[0], operands[1]))
 
20683
+       return \"lswi %0,%P1,16\";
 
20684
+      /* ... fall through ...  */
 
20685
 
 
20686
+    case 10:
 
20687
+    case 11:
 
20688
+    case 12:
 
20689
+      return \"#\";
 
20690
     default:
 
20691
       gcc_unreachable ();
 
20692
     }
 
20693
 }
 
20694
-  [(set_attr "type" "vecstore,vecload,vecsimple,*,*,*,vecsimple,*,vecstore,vecload")])
 
20695
+  [(set_attr "type" "vecstore,vecload,vecsimple,vecsimple,vecsimple,vecstore,vecload,store_ux,store_ux,load_ux,load_ux, *, *")
 
20696
+   (set_attr "length" "     4,      4,        4,       4,         8,       4,      4,      16,      16,     16,     16,16,16")
 
20697
+   (set (attr "cell_micro") (if_then_else (match_test "TARGET_STRING")
 
20698
+                                         (const_string "always")
 
20699
+                                         (const_string "conditional")))])
 
20700
 
 
20701
 ;; Explicit  load/store expanders for the builtin functions
 
20702
 (define_expand "vsx_load_<mode>"
 
20703
@@ -320,46 +663,48 @@
 
20704
   "")
 
20705
 
 
20706
 (define_expand "vsx_store_<mode>"
 
20707
-  [(set (match_operand:VEC_M 0 "memory_operand" "")
 
20708
-       (match_operand:VEC_M 1 "vsx_register_operand" ""))]
 
20709
+  [(set (match_operand:VSX_M 0 "memory_operand" "")
 
20710
+       (match_operand:VSX_M 1 "vsx_register_operand" ""))]
 
20711
   "VECTOR_MEM_VSX_P (<MODE>mode)"
 
20712
   "")
 
20713
 
 
20714
 
 
20715
-;; VSX scalar and vector floating point arithmetic instructions
 
20716
+;; VSX vector floating point arithmetic instructions.  The VSX scalar
 
20717
+;; instructions are now combined with the insn for the traditional floating
 
20718
+;; point unit.
 
20719
 (define_insn "*vsx_add<mode>3"
 
20720
-  [(set (match_operand:VSX_B 0 "vsx_register_operand" "=<VSr>,?wa")
 
20721
-        (plus:VSX_B (match_operand:VSX_B 1 "vsx_register_operand" "<VSr>,wa")
 
20722
-                   (match_operand:VSX_B 2 "vsx_register_operand" "<VSr>,wa")))]
 
20723
+  [(set (match_operand:VSX_F 0 "vsx_register_operand" "=<VSr>,?wa")
 
20724
+        (plus:VSX_F (match_operand:VSX_F 1 "vsx_register_operand" "<VSr>,wa")
 
20725
+                   (match_operand:VSX_F 2 "vsx_register_operand" "<VSr>,wa")))]
 
20726
   "VECTOR_UNIT_VSX_P (<MODE>mode)"
 
20727
-  "x<VSv>add<VSs> %x0,%x1,%x2"
 
20728
+  "xvadd<VSs> %x0,%x1,%x2"
 
20729
   [(set_attr "type" "<VStype_simple>")
 
20730
    (set_attr "fp_type" "<VSfptype_simple>")])
 
20731
 
 
20732
 (define_insn "*vsx_sub<mode>3"
 
20733
-  [(set (match_operand:VSX_B 0 "vsx_register_operand" "=<VSr>,?wa")
 
20734
-        (minus:VSX_B (match_operand:VSX_B 1 "vsx_register_operand" "<VSr>,wa")
 
20735
-                    (match_operand:VSX_B 2 "vsx_register_operand" "<VSr>,wa")))]
 
20736
+  [(set (match_operand:VSX_F 0 "vsx_register_operand" "=<VSr>,?wa")
 
20737
+        (minus:VSX_F (match_operand:VSX_F 1 "vsx_register_operand" "<VSr>,wa")
 
20738
+                    (match_operand:VSX_F 2 "vsx_register_operand" "<VSr>,wa")))]
 
20739
   "VECTOR_UNIT_VSX_P (<MODE>mode)"
 
20740
-  "x<VSv>sub<VSs> %x0,%x1,%x2"
 
20741
+  "xvsub<VSs> %x0,%x1,%x2"
 
20742
   [(set_attr "type" "<VStype_simple>")
 
20743
    (set_attr "fp_type" "<VSfptype_simple>")])
 
20744
 
 
20745
 (define_insn "*vsx_mul<mode>3"
 
20746
-  [(set (match_operand:VSX_B 0 "vsx_register_operand" "=<VSr>,?wa")
 
20747
-        (mult:VSX_B (match_operand:VSX_B 1 "vsx_register_operand" "<VSr>,wa")
 
20748
-                   (match_operand:VSX_B 2 "vsx_register_operand" "<VSr>,wa")))]
 
20749
+  [(set (match_operand:VSX_F 0 "vsx_register_operand" "=<VSr>,?wa")
 
20750
+        (mult:VSX_F (match_operand:VSX_F 1 "vsx_register_operand" "<VSr>,wa")
 
20751
+                   (match_operand:VSX_F 2 "vsx_register_operand" "<VSr>,wa")))]
 
20752
   "VECTOR_UNIT_VSX_P (<MODE>mode)"
 
20753
-  "x<VSv>mul<VSs> %x0,%x1,%x2"
 
20754
-  [(set_attr "type" "<VStype_mul>")
 
20755
+  "xvmul<VSs> %x0,%x1,%x2"
 
20756
+  [(set_attr "type" "<VStype_simple>")
 
20757
    (set_attr "fp_type" "<VSfptype_mul>")])
 
20758
 
 
20759
 (define_insn "*vsx_div<mode>3"
 
20760
-  [(set (match_operand:VSX_B 0 "vsx_register_operand" "=<VSr>,?wa")
 
20761
-        (div:VSX_B (match_operand:VSX_B 1 "vsx_register_operand" "<VSr>,wa")
 
20762
-                  (match_operand:VSX_B 2 "vsx_register_operand" "<VSr>,wa")))]
 
20763
+  [(set (match_operand:VSX_F 0 "vsx_register_operand" "=<VSr>,?wa")
 
20764
+        (div:VSX_F (match_operand:VSX_F 1 "vsx_register_operand" "<VSr>,wa")
 
20765
+                  (match_operand:VSX_F 2 "vsx_register_operand" "<VSr>,wa")))]
 
20766
   "VECTOR_UNIT_VSX_P (<MODE>mode)"
 
20767
-  "x<VSv>div<VSs> %x0,%x1,%x2"
 
20768
+  "xvdiv<VSs> %x0,%x1,%x2"
 
20769
   [(set_attr "type" "<VStype_div>")
 
20770
    (set_attr "fp_type" "<VSfptype_div>")])
 
20771
 
 
20772
@@ -402,94 +747,72 @@
 
20773
    (set_attr "fp_type" "<VSfptype_simple>")])
 
20774
 
 
20775
 (define_insn "vsx_fre<mode>2"
 
20776
-  [(set (match_operand:VSX_B 0 "vsx_register_operand" "=<VSr>,?wa")
 
20777
-       (unspec:VSX_B [(match_operand:VSX_B 1 "vsx_register_operand" "<VSr>,wa")]
 
20778
+  [(set (match_operand:VSX_F 0 "vsx_register_operand" "=<VSr>,?wa")
 
20779
+       (unspec:VSX_F [(match_operand:VSX_F 1 "vsx_register_operand" "<VSr>,wa")]
 
20780
                      UNSPEC_FRES))]
 
20781
   "VECTOR_UNIT_VSX_P (<MODE>mode)"
 
20782
-  "x<VSv>re<VSs> %x0,%x1"
 
20783
+  "xvre<VSs> %x0,%x1"
 
20784
   [(set_attr "type" "<VStype_simple>")
 
20785
    (set_attr "fp_type" "<VSfptype_simple>")])
 
20786
 
 
20787
 (define_insn "*vsx_neg<mode>2"
 
20788
-  [(set (match_operand:VSX_B 0 "vsx_register_operand" "=<VSr>,?wa")
 
20789
-        (neg:VSX_B (match_operand:VSX_B 1 "vsx_register_operand" "<VSr>,wa")))]
 
20790
+  [(set (match_operand:VSX_F 0 "vsx_register_operand" "=<VSr>,?wa")
 
20791
+        (neg:VSX_F (match_operand:VSX_F 1 "vsx_register_operand" "<VSr>,wa")))]
 
20792
   "VECTOR_UNIT_VSX_P (<MODE>mode)"
 
20793
-  "x<VSv>neg<VSs> %x0,%x1"
 
20794
+  "xvneg<VSs> %x0,%x1"
 
20795
   [(set_attr "type" "<VStype_simple>")
 
20796
    (set_attr "fp_type" "<VSfptype_simple>")])
 
20797
 
 
20798
 (define_insn "*vsx_abs<mode>2"
 
20799
-  [(set (match_operand:VSX_B 0 "vsx_register_operand" "=<VSr>,?wa")
 
20800
-        (abs:VSX_B (match_operand:VSX_B 1 "vsx_register_operand" "<VSr>,wa")))]
 
20801
+  [(set (match_operand:VSX_F 0 "vsx_register_operand" "=<VSr>,?wa")
 
20802
+        (abs:VSX_F (match_operand:VSX_F 1 "vsx_register_operand" "<VSr>,wa")))]
 
20803
   "VECTOR_UNIT_VSX_P (<MODE>mode)"
 
20804
-  "x<VSv>abs<VSs> %x0,%x1"
 
20805
+  "xvabs<VSs> %x0,%x1"
 
20806
   [(set_attr "type" "<VStype_simple>")
 
20807
    (set_attr "fp_type" "<VSfptype_simple>")])
 
20808
 
 
20809
 (define_insn "vsx_nabs<mode>2"
 
20810
-  [(set (match_operand:VSX_B 0 "vsx_register_operand" "=<VSr>,?wa")
 
20811
-        (neg:VSX_B
 
20812
-        (abs:VSX_B
 
20813
-         (match_operand:VSX_B 1 "vsx_register_operand" "<VSr>,wa"))))]
 
20814
+  [(set (match_operand:VSX_F 0 "vsx_register_operand" "=<VSr>,?wa")
 
20815
+        (neg:VSX_F
 
20816
+        (abs:VSX_F
 
20817
+         (match_operand:VSX_F 1 "vsx_register_operand" "<VSr>,wa"))))]
 
20818
   "VECTOR_UNIT_VSX_P (<MODE>mode)"
 
20819
-  "x<VSv>nabs<VSs> %x0,%x1"
 
20820
+  "xvnabs<VSs> %x0,%x1"
 
20821
   [(set_attr "type" "<VStype_simple>")
 
20822
    (set_attr "fp_type" "<VSfptype_simple>")])
 
20823
 
 
20824
 (define_insn "vsx_smax<mode>3"
 
20825
-  [(set (match_operand:VSX_B 0 "vsx_register_operand" "=<VSr>,?wa")
 
20826
-        (smax:VSX_B (match_operand:VSX_B 1 "vsx_register_operand" "<VSr>,wa")
 
20827
-                   (match_operand:VSX_B 2 "vsx_register_operand" "<VSr>,wa")))]
 
20828
+  [(set (match_operand:VSX_F 0 "vsx_register_operand" "=<VSr>,?wa")
 
20829
+        (smax:VSX_F (match_operand:VSX_F 1 "vsx_register_operand" "<VSr>,wa")
 
20830
+                   (match_operand:VSX_F 2 "vsx_register_operand" "<VSr>,wa")))]
 
20831
   "VECTOR_UNIT_VSX_P (<MODE>mode)"
 
20832
-  "x<VSv>max<VSs> %x0,%x1,%x2"
 
20833
+  "xvmax<VSs> %x0,%x1,%x2"
 
20834
   [(set_attr "type" "<VStype_simple>")
 
20835
    (set_attr "fp_type" "<VSfptype_simple>")])
 
20836
 
 
20837
 (define_insn "*vsx_smin<mode>3"
 
20838
-  [(set (match_operand:VSX_B 0 "vsx_register_operand" "=<VSr>,?wa")
 
20839
-        (smin:VSX_B (match_operand:VSX_B 1 "vsx_register_operand" "<VSr>,wa")
 
20840
-                   (match_operand:VSX_B 2 "vsx_register_operand" "<VSr>,wa")))]
 
20841
+  [(set (match_operand:VSX_F 0 "vsx_register_operand" "=<VSr>,?wa")
 
20842
+        (smin:VSX_F (match_operand:VSX_F 1 "vsx_register_operand" "<VSr>,wa")
 
20843
+                   (match_operand:VSX_F 2 "vsx_register_operand" "<VSr>,wa")))]
 
20844
   "VECTOR_UNIT_VSX_P (<MODE>mode)"
 
20845
-  "x<VSv>min<VSs> %x0,%x1,%x2"
 
20846
+  "xvmin<VSs> %x0,%x1,%x2"
 
20847
   [(set_attr "type" "<VStype_simple>")
 
20848
    (set_attr "fp_type" "<VSfptype_simple>")])
 
20849
 
 
20850
-;; Special VSX version of smin/smax for single precision floating point.  Since
 
20851
-;; both numbers are rounded to single precision, we can just use the DP version
 
20852
-;; of the instruction.
 
20853
-
 
20854
-(define_insn "*vsx_smaxsf3"
 
20855
-  [(set (match_operand:SF 0 "vsx_register_operand" "=f")
 
20856
-        (smax:SF (match_operand:SF 1 "vsx_register_operand" "f")
 
20857
-                (match_operand:SF 2 "vsx_register_operand" "f")))]
 
20858
-  "VECTOR_UNIT_VSX_P (DFmode)"
 
20859
-  "xsmaxdp %x0,%x1,%x2"
 
20860
-  [(set_attr "type" "fp")
 
20861
-   (set_attr "fp_type" "fp_addsub_d")])
 
20862
-
 
20863
-(define_insn "*vsx_sminsf3"
 
20864
-  [(set (match_operand:SF 0 "vsx_register_operand" "=f")
 
20865
-        (smin:SF (match_operand:SF 1 "vsx_register_operand" "f")
 
20866
-                (match_operand:SF 2 "vsx_register_operand" "f")))]
 
20867
-  "VECTOR_UNIT_VSX_P (DFmode)"
 
20868
-  "xsmindp %x0,%x1,%x2"
 
20869
-  [(set_attr "type" "fp")
 
20870
-   (set_attr "fp_type" "fp_addsub_d")])
 
20871
-
 
20872
 (define_insn "*vsx_sqrt<mode>2"
 
20873
-  [(set (match_operand:VSX_B 0 "vsx_register_operand" "=<VSr>,?wa")
 
20874
-        (sqrt:VSX_B (match_operand:VSX_B 1 "vsx_register_operand" "<VSr>,wa")))]
 
20875
+  [(set (match_operand:VSX_F 0 "vsx_register_operand" "=<VSr>,?wa")
 
20876
+        (sqrt:VSX_F (match_operand:VSX_F 1 "vsx_register_operand" "<VSr>,wa")))]
 
20877
   "VECTOR_UNIT_VSX_P (<MODE>mode)"
 
20878
-  "x<VSv>sqrt<VSs> %x0,%x1"
 
20879
+  "xvsqrt<VSs> %x0,%x1"
 
20880
   [(set_attr "type" "<VStype_sqrt>")
 
20881
    (set_attr "fp_type" "<VSfptype_sqrt>")])
 
20882
 
 
20883
 (define_insn "*vsx_rsqrte<mode>2"
 
20884
-  [(set (match_operand:VSX_B 0 "vsx_register_operand" "=<VSr>,?wa")
 
20885
-       (unspec:VSX_B [(match_operand:VSX_B 1 "vsx_register_operand" "<VSr>,wa")]
 
20886
+  [(set (match_operand:VSX_F 0 "vsx_register_operand" "=<VSr>,?wa")
 
20887
+       (unspec:VSX_F [(match_operand:VSX_F 1 "vsx_register_operand" "<VSr>,wa")]
 
20888
                      UNSPEC_RSQRT))]
 
20889
   "VECTOR_UNIT_VSX_P (<MODE>mode)"
 
20890
-  "x<VSv>rsqrte<VSs> %x0,%x1"
 
20891
+  "xvrsqrte<VSs> %x0,%x1"
 
20892
   [(set_attr "type" "<VStype_simple>")
 
20893
    (set_attr "fp_type" "<VSfptype_simple>")])
 
20894
 
 
20895
@@ -528,27 +851,11 @@
 
20896
   [(set_attr "type" "<VStype_simple>")
 
20897
    (set_attr "fp_type" "<VSfptype_simple>")])
 
20898
 
 
20899
-;; Fused vector multiply/add instructions Support the classical DF versions of
 
20900
-;; fma, which allows the target to be a separate register from the 3 inputs.
 
20901
-;; Under VSX, the target must be either the addend or the first multiply.
 
20902
-;; Where we can, also do the same for the Altivec V4SF fmas.
 
20903
+;; Fused vector multiply/add instructions. Support the classical Altivec
 
20904
+;; versions of fma, which allows the target to be a separate register from the
 
20905
+;; 3 inputs.  Under VSX, the target must be either the addend or the first
 
20906
+;; multiply.
 
20907
 
 
20908
-(define_insn "*vsx_fmadf4"
 
20909
-  [(set (match_operand:DF 0 "vsx_register_operand" "=ws,ws,?wa,?wa,d")
 
20910
-       (fma:DF
 
20911
-         (match_operand:DF 1 "vsx_register_operand" "%ws,ws,wa,wa,d")
 
20912
-         (match_operand:DF 2 "vsx_register_operand" "ws,0,wa,0,d")
 
20913
-         (match_operand:DF 3 "vsx_register_operand" "0,ws,0,wa,d")))]
 
20914
-  "VECTOR_UNIT_VSX_P (DFmode)"
 
20915
-  "@
 
20916
-   xsmaddadp %x0,%x1,%x2
 
20917
-   xsmaddmdp %x0,%x1,%x3
 
20918
-   xsmaddadp %x0,%x1,%x2
 
20919
-   xsmaddmdp %x0,%x1,%x3
 
20920
-   fmadd %0,%1,%2,%3"
 
20921
-  [(set_attr "type" "fp")
 
20922
-   (set_attr "fp_type" "fp_maddsub_d")])
 
20923
-
 
20924
 (define_insn "*vsx_fmav4sf4"
 
20925
   [(set (match_operand:V4SF 0 "vsx_register_operand" "=ws,ws,?wa,?wa,v")
 
20926
        (fma:V4SF
 
20927
@@ -578,23 +885,6 @@
 
20928
    xvmaddmdp %x0,%x1,%x3"
 
20929
   [(set_attr "type" "vecdouble")])
 
20930
 
 
20931
-(define_insn "*vsx_fmsdf4"
 
20932
-  [(set (match_operand:DF 0 "vsx_register_operand" "=ws,ws,?wa,?wa,d")
 
20933
-       (fma:DF
 
20934
-         (match_operand:DF 1 "vsx_register_operand" "%ws,ws,wa,wa,d")
 
20935
-         (match_operand:DF 2 "vsx_register_operand" "ws,0,wa,0,d")
 
20936
-         (neg:DF
 
20937
-           (match_operand:DF 3 "vsx_register_operand" "0,ws,0,wa,d"))))]
 
20938
-  "VECTOR_UNIT_VSX_P (DFmode)"
 
20939
-  "@
 
20940
-   xsmsubadp %x0,%x1,%x2
 
20941
-   xsmsubmdp %x0,%x1,%x3
 
20942
-   xsmsubadp %x0,%x1,%x2
 
20943
-   xsmsubmdp %x0,%x1,%x3
 
20944
-   fmsub %0,%1,%2,%3"
 
20945
-  [(set_attr "type" "fp")
 
20946
-   (set_attr "fp_type" "fp_maddsub_d")])
 
20947
-
 
20948
 (define_insn "*vsx_fms<mode>4"
 
20949
   [(set (match_operand:VSX_F 0 "vsx_register_operand" "=<VSr>,<VSr>,?wa,?wa")
 
20950
        (fma:VSX_F
 
20951
@@ -604,29 +894,12 @@
 
20952
            (match_operand:VSX_F 3 "vsx_register_operand" "0,<VSr>,0,wa"))))]
 
20953
   "VECTOR_UNIT_VSX_P (<MODE>mode)"
 
20954
   "@
 
20955
-   x<VSv>msuba<VSs> %x0,%x1,%x2
 
20956
-   x<VSv>msubm<VSs> %x0,%x1,%x3
 
20957
-   x<VSv>msuba<VSs> %x0,%x1,%x2
 
20958
-   x<VSv>msubm<VSs> %x0,%x1,%x3"
 
20959
+   xvmsuba<VSs> %x0,%x1,%x2
 
20960
+   xvmsubm<VSs> %x0,%x1,%x3
 
20961
+   xvmsuba<VSs> %x0,%x1,%x2
 
20962
+   xvmsubm<VSs> %x0,%x1,%x3"
 
20963
   [(set_attr "type" "<VStype_mul>")])
 
20964
 
 
20965
-(define_insn "*vsx_nfmadf4"
 
20966
-  [(set (match_operand:DF 0 "vsx_register_operand" "=ws,ws,?wa,?wa,d")
 
20967
-       (neg:DF
 
20968
-        (fma:DF
 
20969
-         (match_operand:DF 1 "vsx_register_operand" "ws,ws,wa,wa,d")
 
20970
-         (match_operand:DF 2 "vsx_register_operand" "ws,0,wa,0,d")
 
20971
-         (match_operand:DF 3 "vsx_register_operand" "0,ws,0,wa,d"))))]
 
20972
-  "VECTOR_UNIT_VSX_P (DFmode)"
 
20973
-  "@
 
20974
-   xsnmaddadp %x0,%x1,%x2
 
20975
-   xsnmaddmdp %x0,%x1,%x3
 
20976
-   xsnmaddadp %x0,%x1,%x2
 
20977
-   xsnmaddmdp %x0,%x1,%x3
 
20978
-   fnmadd %0,%1,%2,%3"
 
20979
-  [(set_attr "type" "fp")
 
20980
-   (set_attr "fp_type" "fp_maddsub_d")])
 
20981
-
 
20982
 (define_insn "*vsx_nfma<mode>4"
 
20983
   [(set (match_operand:VSX_F 0 "vsx_register_operand" "=<VSr>,<VSr>,?wa,?wa")
 
20984
        (neg:VSX_F
 
20985
@@ -636,31 +909,13 @@
 
20986
          (match_operand:VSX_F 3 "vsx_register_operand" "0,<VSr>,0,wa"))))]
 
20987
   "VECTOR_UNIT_VSX_P (<MODE>mode)"
 
20988
   "@
 
20989
-   x<VSv>nmadda<VSs> %x0,%x1,%x2
 
20990
-   x<VSv>nmaddm<VSs> %x0,%x1,%x3
 
20991
-   x<VSv>nmadda<VSs> %x0,%x1,%x2
 
20992
-   x<VSv>nmaddm<VSs> %x0,%x1,%x3"
 
20993
+   xvnmadda<VSs> %x0,%x1,%x2
 
20994
+   xvnmaddm<VSs> %x0,%x1,%x3
 
20995
+   xvnmadda<VSs> %x0,%x1,%x2
 
20996
+   xvnmaddm<VSs> %x0,%x1,%x3"
 
20997
   [(set_attr "type" "<VStype_mul>")
 
20998
    (set_attr "fp_type" "<VSfptype_mul>")])
 
20999
 
 
21000
-(define_insn "*vsx_nfmsdf4"
 
21001
-  [(set (match_operand:DF 0 "vsx_register_operand" "=ws,ws,?wa,?wa,d")
 
21002
-       (neg:DF
 
21003
-        (fma:DF
 
21004
-          (match_operand:DF 1 "vsx_register_operand" "%ws,ws,wa,wa,d")
 
21005
-          (match_operand:DF 2 "vsx_register_operand" "ws,0,wa,0,d")
 
21006
-          (neg:DF
 
21007
-            (match_operand:DF 3 "vsx_register_operand" "0,ws,0,wa,d")))))]
 
21008
-  "VECTOR_UNIT_VSX_P (DFmode)"
 
21009
-  "@
 
21010
-   xsnmsubadp %x0,%x1,%x2
 
21011
-   xsnmsubmdp %x0,%x1,%x3
 
21012
-   xsnmsubadp %x0,%x1,%x2
 
21013
-   xsnmsubmdp %x0,%x1,%x3
 
21014
-   fnmsub %0,%1,%2,%3"
 
21015
-  [(set_attr "type" "fp")
 
21016
-   (set_attr "fp_type" "fp_maddsub_d")])
 
21017
-
 
21018
 (define_insn "*vsx_nfmsv4sf4"
 
21019
   [(set (match_operand:V4SF 0 "vsx_register_operand" "=wf,wf,?wa,?wa,v")
 
21020
        (neg:V4SF
 
21021
@@ -722,16 +977,6 @@
 
21022
   [(set_attr "type" "<VStype_simple>")
 
21023
    (set_attr "fp_type" "<VSfptype_simple>")])
 
21024
 
 
21025
-;; Floating point scalar compare
 
21026
-(define_insn "*vsx_cmpdf_internal1"
 
21027
-  [(set (match_operand:CCFP 0 "cc_reg_operand" "=y,?y")
 
21028
-       (compare:CCFP (match_operand:DF 1 "gpc_reg_operand" "ws,wa")
 
21029
-                     (match_operand:DF 2 "gpc_reg_operand" "ws,wa")))]
 
21030
-  "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
 
21031
-   && VECTOR_UNIT_VSX_P (DFmode)"
 
21032
-  "xscmpudp %0,%x1,%x2"
 
21033
-  [(set_attr "type" "fpcompare")])
 
21034
-
 
21035
 ;; Compare vectors producing a vector result and a predicate, setting CR6 to
 
21036
 ;; indicate a combined status
 
21037
 (define_insn "*vsx_eq_<mode>_p"
 
21038
@@ -798,13 +1043,13 @@
 
21039
 
 
21040
 ;; Copy sign
 
21041
 (define_insn "vsx_copysign<mode>3"
 
21042
-  [(set (match_operand:VSX_B 0 "vsx_register_operand" "=<VSr>,?wa")
 
21043
-       (unspec:VSX_B
 
21044
-        [(match_operand:VSX_B 1 "vsx_register_operand" "<VSr>,wa")
 
21045
-         (match_operand:VSX_B 2 "vsx_register_operand" "<VSr>,wa")]
 
21046
+  [(set (match_operand:VSX_F 0 "vsx_register_operand" "=<VSr>,?wa")
 
21047
+       (unspec:VSX_F
 
21048
+        [(match_operand:VSX_F 1 "vsx_register_operand" "<VSr>,wa")
 
21049
+         (match_operand:VSX_F 2 "vsx_register_operand" "<VSr>,wa")]
 
21050
         UNSPEC_COPYSIGN))]
 
21051
   "VECTOR_UNIT_VSX_P (<MODE>mode)"
 
21052
-  "x<VSv>cpsgn<VSs> %x0,%x2,%x1"
 
21053
+  "xvcpsgn<VSs> %x0,%x2,%x1"
 
21054
   [(set_attr "type" "<VStype_simple>")
 
21055
    (set_attr "fp_type" "<VSfptype_simple>")])
 
21056
 
 
21057
@@ -865,10 +1110,10 @@
 
21058
    (set_attr "fp_type" "<VSfptype_simple>")])
 
21059
 
 
21060
 (define_insn "vsx_btrunc<mode>2"
 
21061
-  [(set (match_operand:VSX_B 0 "vsx_register_operand" "=<VSr>,?wa")
 
21062
-       (fix:VSX_B (match_operand:VSX_B 1 "vsx_register_operand" "<VSr>,wa")))]
 
21063
+  [(set (match_operand:VSX_F 0 "vsx_register_operand" "=<VSr>,?wa")
 
21064
+       (fix:VSX_F (match_operand:VSX_F 1 "vsx_register_operand" "<VSr>,wa")))]
 
21065
   "VECTOR_UNIT_VSX_P (<MODE>mode)"
 
21066
-  "x<VSv>r<VSs>iz %x0,%x1"
 
21067
+  "xvr<VSs>iz %x0,%x1"
 
21068
   [(set_attr "type" "<VStype_simple>")
 
21069
    (set_attr "fp_type" "<VSfptype_simple>")])
 
21070
 
 
21071
@@ -882,20 +1127,20 @@
 
21072
    (set_attr "fp_type" "<VSfptype_simple>")])
 
21073
 
 
21074
 (define_insn "vsx_floor<mode>2"
 
21075
-  [(set (match_operand:VSX_B 0 "vsx_register_operand" "=<VSr>,?wa")
 
21076
-       (unspec:VSX_B [(match_operand:VSX_B 1 "vsx_register_operand" "<VSr>,wa")]
 
21077
+  [(set (match_operand:VSX_F 0 "vsx_register_operand" "=<VSr>,?wa")
 
21078
+       (unspec:VSX_F [(match_operand:VSX_F 1 "vsx_register_operand" "<VSr>,wa")]
 
21079
                      UNSPEC_FRIM))]
 
21080
   "VECTOR_UNIT_VSX_P (<MODE>mode)"
 
21081
-  "x<VSv>r<VSs>im %x0,%x1"
 
21082
+  "xvr<VSs>im %x0,%x1"
 
21083
   [(set_attr "type" "<VStype_simple>")
 
21084
    (set_attr "fp_type" "<VSfptype_simple>")])
 
21085
 
 
21086
 (define_insn "vsx_ceil<mode>2"
 
21087
-  [(set (match_operand:VSX_B 0 "vsx_register_operand" "=<VSr>,?wa")
 
21088
-       (unspec:VSX_B [(match_operand:VSX_B 1 "vsx_register_operand" "<VSr>,wa")]
 
21089
+  [(set (match_operand:VSX_F 0 "vsx_register_operand" "=<VSr>,?wa")
 
21090
+       (unspec:VSX_F [(match_operand:VSX_F 1 "vsx_register_operand" "<VSr>,wa")]
 
21091
                      UNSPEC_FRIP))]
 
21092
   "VECTOR_UNIT_VSX_P (<MODE>mode)"
 
21093
-  "x<VSv>r<VSs>ip %x0,%x1"
 
21094
+  "xvr<VSs>ip %x0,%x1"
 
21095
   [(set_attr "type" "<VStype_simple>")
 
21096
    (set_attr "fp_type" "<VSfptype_simple>")])
 
21097
 
 
21098
@@ -942,6 +1187,40 @@
 
21099
   "xscvspdp %x0,%x1"
 
21100
   [(set_attr "type" "fp")])
 
21101
 
 
21102
+;; ISA 2.07 xscvdpspn/xscvspdpn that does not raise an error on signalling NaNs
 
21103
+(define_insn "vsx_xscvdpspn"
 
21104
+  [(set (match_operand:V4SF 0 "vsx_register_operand" "=ws,?wa")
 
21105
+       (unspec:V4SF [(match_operand:DF 1 "vsx_register_operand" "wd,wa")]
 
21106
+                    UNSPEC_VSX_CVDPSPN))]
 
21107
+  "TARGET_XSCVDPSPN"
 
21108
+  "xscvdpspn %x0,%x1"
 
21109
+  [(set_attr "type" "fp")])
 
21110
+
 
21111
+(define_insn "vsx_xscvspdpn"
 
21112
+  [(set (match_operand:DF 0 "vsx_register_operand" "=ws,?wa")
 
21113
+       (unspec:DF [(match_operand:V4SF 1 "vsx_register_operand" "wa,wa")]
 
21114
+                  UNSPEC_VSX_CVSPDPN))]
 
21115
+  "TARGET_XSCVSPDPN"
 
21116
+  "xscvspdpn %x0,%x1"
 
21117
+  [(set_attr "type" "fp")])
 
21118
+
 
21119
+(define_insn "vsx_xscvdpspn_scalar"
 
21120
+  [(set (match_operand:V4SF 0 "vsx_register_operand" "=wa")
 
21121
+       (unspec:V4SF [(match_operand:SF 1 "vsx_register_operand" "f")]
 
21122
+                    UNSPEC_VSX_CVDPSPN))]
 
21123
+  "TARGET_XSCVDPSPN"
 
21124
+  "xscvdpspn %x0,%x1"
 
21125
+  [(set_attr "type" "fp")])
 
21126
+
 
21127
+;; Used by direct move to move a SFmode value from GPR to VSX register
 
21128
+(define_insn "vsx_xscvspdpn_directmove"
 
21129
+  [(set (match_operand:SF 0 "vsx_register_operand" "=wa")
 
21130
+       (unspec:SF [(match_operand:SF 1 "vsx_register_operand" "wa")]
 
21131
+                  UNSPEC_VSX_CVSPDPN))]
 
21132
+  "TARGET_XSCVSPDPN"
 
21133
+  "xscvspdpn %x0,%x1"
 
21134
+  [(set_attr "type" "fp")])
 
21135
+
 
21136
 ;; Convert from 64-bit to 32-bit types
 
21137
 ;; Note, favor the Altivec registers since the usual use of these instructions
 
21138
 ;; is in vector converts and we need to use the Altivec vperm instruction.
 
21139
@@ -1027,73 +1306,21 @@
 
21140
    (set_attr "fp_type" "<VSfptype_simple>")])
 
21141
 
 
21142
 
 
21143
-;; Logical and permute operations
 
21144
-(define_insn "*vsx_and<mode>3"
 
21145
-  [(set (match_operand:VSX_L 0 "vsx_register_operand" "=<VSr>,?wa")
 
21146
-        (and:VSX_L
 
21147
-        (match_operand:VSX_L 1 "vsx_register_operand" "<VSr>,?wa")
 
21148
-        (match_operand:VSX_L 2 "vsx_register_operand" "<VSr>,?wa")))]
 
21149
-  "VECTOR_MEM_VSX_P (<MODE>mode)"
 
21150
-  "xxland %x0,%x1,%x2"
 
21151
-  [(set_attr "type" "vecsimple")])
 
21152
-
 
21153
-(define_insn "*vsx_ior<mode>3"
 
21154
-  [(set (match_operand:VSX_L 0 "vsx_register_operand" "=<VSr>,?wa")
 
21155
-        (ior:VSX_L (match_operand:VSX_L 1 "vsx_register_operand" "<VSr>,?wa")
 
21156
-                  (match_operand:VSX_L 2 "vsx_register_operand" "<VSr>,?wa")))]
 
21157
-  "VECTOR_MEM_VSX_P (<MODE>mode)"
 
21158
-  "xxlor %x0,%x1,%x2"
 
21159
-  [(set_attr "type" "vecsimple")])
 
21160
-
 
21161
-(define_insn "*vsx_xor<mode>3"
 
21162
-  [(set (match_operand:VSX_L 0 "vsx_register_operand" "=<VSr>,?wa")
 
21163
-        (xor:VSX_L
 
21164
-        (match_operand:VSX_L 1 "vsx_register_operand" "<VSr>,?wa")
 
21165
-        (match_operand:VSX_L 2 "vsx_register_operand" "<VSr>,?wa")))]
 
21166
-  "VECTOR_MEM_VSX_P (<MODE>mode)"
 
21167
-  "xxlxor %x0,%x1,%x2"
 
21168
-  [(set_attr "type" "vecsimple")])
 
21169
-
 
21170
-(define_insn "*vsx_one_cmpl<mode>2"
 
21171
-  [(set (match_operand:VSX_L 0 "vsx_register_operand" "=<VSr>,?wa")
 
21172
-        (not:VSX_L
 
21173
-        (match_operand:VSX_L 1 "vsx_register_operand" "<VSr>,?wa")))]
 
21174
-  "VECTOR_MEM_VSX_P (<MODE>mode)"
 
21175
-  "xxlnor %x0,%x1,%x1"
 
21176
-  [(set_attr "type" "vecsimple")])
 
21177
-  
 
21178
-(define_insn "*vsx_nor<mode>3"
 
21179
-  [(set (match_operand:VSX_L 0 "vsx_register_operand" "=<VSr>,?wa")
 
21180
-        (not:VSX_L
 
21181
-        (ior:VSX_L
 
21182
-         (match_operand:VSX_L 1 "vsx_register_operand" "<VSr>,?wa")
 
21183
-         (match_operand:VSX_L 2 "vsx_register_operand" "<VSr>,?wa"))))]
 
21184
-  "VECTOR_MEM_VSX_P (<MODE>mode)"
 
21185
-  "xxlnor %x0,%x1,%x2"
 
21186
-  [(set_attr "type" "vecsimple")])
 
21187
-
 
21188
-(define_insn "*vsx_andc<mode>3"
 
21189
-  [(set (match_operand:VSX_L 0 "vsx_register_operand" "=<VSr>,?wa")
 
21190
-        (and:VSX_L
 
21191
-        (not:VSX_L
 
21192
-         (match_operand:VSX_L 2 "vsx_register_operand" "<VSr>,?wa"))
 
21193
-        (match_operand:VSX_L 1 "vsx_register_operand" "<VSr>,?wa")))]
 
21194
-  "VECTOR_MEM_VSX_P (<MODE>mode)"
 
21195
-  "xxlandc %x0,%x1,%x2"
 
21196
-  [(set_attr "type" "vecsimple")])
 
21197
-
 
21198
-
 
21199
 ;; Permute operations
 
21200
 
 
21201
 ;; Build a V2DF/V2DI vector from two scalars
 
21202
 (define_insn "vsx_concat_<mode>"
 
21203
-  [(set (match_operand:VSX_D 0 "vsx_register_operand" "=wd,?wa")
 
21204
-       (unspec:VSX_D
 
21205
-        [(match_operand:<VS_scalar> 1 "vsx_register_operand" "ws,wa")
 
21206
-         (match_operand:<VS_scalar> 2 "vsx_register_operand" "ws,wa")]
 
21207
-        UNSPEC_VSX_CONCAT))]
 
21208
+  [(set (match_operand:VSX_D 0 "vsx_register_operand" "=<VSr>,?wa")
 
21209
+       (vec_concat:VSX_D
 
21210
+        (match_operand:<VS_scalar> 1 "vsx_register_operand" "ws,wa")
 
21211
+        (match_operand:<VS_scalar> 2 "vsx_register_operand" "ws,wa")))]
 
21212
   "VECTOR_MEM_VSX_P (<MODE>mode)"
 
21213
-  "xxpermdi %x0,%x1,%x2,0"
 
21214
+{
 
21215
+  if (BYTES_BIG_ENDIAN)
 
21216
+    return "xxpermdi %x0,%x1,%x2,0";
 
21217
+  else
 
21218
+    return "xxpermdi %x0,%x2,%x1,0";
 
21219
+}
 
21220
   [(set_attr "type" "vecperm")])
 
21221
 
 
21222
 ;; Special purpose concat using xxpermdi to glue two single precision values
 
21223
@@ -1106,9 +1333,161 @@
 
21224
          (match_operand:SF 2 "vsx_register_operand" "f,f")]
 
21225
         UNSPEC_VSX_CONCAT))]
 
21226
   "VECTOR_MEM_VSX_P (V2DFmode)"
 
21227
-  "xxpermdi %x0,%x1,%x2,0"
 
21228
+{
 
21229
+  if (BYTES_BIG_ENDIAN)
 
21230
+    return "xxpermdi %x0,%x1,%x2,0";
 
21231
+  else
 
21232
+    return "xxpermdi %x0,%x2,%x1,0";
 
21233
+}
 
21234
   [(set_attr "type" "vecperm")])
 
21235
 
 
21236
+;; xxpermdi for little endian loads and stores.  We need several of
 
21237
+;; these since the form of the PARALLEL differs by mode.
 
21238
+(define_insn "*vsx_xxpermdi2_le_<mode>"
 
21239
+  [(set (match_operand:VSX_D 0 "vsx_register_operand" "=wa")
 
21240
+        (vec_select:VSX_D
 
21241
+          (match_operand:VSX_D 1 "vsx_register_operand" "wa")
 
21242
+          (parallel [(const_int 1) (const_int 0)])))]
 
21243
+  "!BYTES_BIG_ENDIAN && VECTOR_MEM_VSX_P (<MODE>mode)"
 
21244
+  "xxpermdi %x0,%x1,%x1,2"
 
21245
+  [(set_attr "type" "vecperm")])
 
21246
+
 
21247
+(define_insn "*vsx_xxpermdi4_le_<mode>"
 
21248
+  [(set (match_operand:VSX_W 0 "vsx_register_operand" "=wa")
 
21249
+        (vec_select:VSX_W
 
21250
+          (match_operand:VSX_W 1 "vsx_register_operand" "wa")
 
21251
+          (parallel [(const_int 2) (const_int 3)
 
21252
+                     (const_int 0) (const_int 1)])))]
 
21253
+  "!BYTES_BIG_ENDIAN && VECTOR_MEM_VSX_P (<MODE>mode)"
 
21254
+  "xxpermdi %x0,%x1,%x1,2"
 
21255
+  [(set_attr "type" "vecperm")])
 
21256
+
 
21257
+(define_insn "*vsx_xxpermdi8_le_V8HI"
 
21258
+  [(set (match_operand:V8HI 0 "vsx_register_operand" "=wa")
 
21259
+        (vec_select:V8HI
 
21260
+          (match_operand:V8HI 1 "vsx_register_operand" "wa")
 
21261
+          (parallel [(const_int 4) (const_int 5)
 
21262
+                     (const_int 6) (const_int 7)
 
21263
+                     (const_int 0) (const_int 1)
 
21264
+                     (const_int 2) (const_int 3)])))]
 
21265
+  "!BYTES_BIG_ENDIAN && VECTOR_MEM_VSX_P (V8HImode)"
 
21266
+  "xxpermdi %x0,%x1,%x1,2"
 
21267
+  [(set_attr "type" "vecperm")])
 
21268
+
 
21269
+(define_insn "*vsx_xxpermdi16_le_V16QI"
 
21270
+  [(set (match_operand:V16QI 0 "vsx_register_operand" "=wa")
 
21271
+        (vec_select:V16QI
 
21272
+          (match_operand:V16QI 1 "vsx_register_operand" "wa")
 
21273
+          (parallel [(const_int 8) (const_int 9)
 
21274
+                     (const_int 10) (const_int 11)
 
21275
+                     (const_int 12) (const_int 13)
 
21276
+                     (const_int 14) (const_int 15)
 
21277
+                     (const_int 0) (const_int 1)
 
21278
+                     (const_int 2) (const_int 3)
 
21279
+                     (const_int 4) (const_int 5)
 
21280
+                     (const_int 6) (const_int 7)])))]
 
21281
+  "!BYTES_BIG_ENDIAN && VECTOR_MEM_VSX_P (V16QImode)"
 
21282
+  "xxpermdi %x0,%x1,%x1,2"
 
21283
+  [(set_attr "type" "vecperm")])
 
21284
+
 
21285
+;; lxvd2x for little endian loads.  We need several of
 
21286
+;; these since the form of the PARALLEL differs by mode.
 
21287
+(define_insn "*vsx_lxvd2x2_le_<mode>"
 
21288
+  [(set (match_operand:VSX_D 0 "vsx_register_operand" "=wa")
 
21289
+        (vec_select:VSX_D
 
21290
+          (match_operand:VSX_D 1 "memory_operand" "Z")
 
21291
+          (parallel [(const_int 1) (const_int 0)])))]
 
21292
+  "!BYTES_BIG_ENDIAN && VECTOR_MEM_VSX_P (<MODE>mode)"
 
21293
+  "lxvd2x %x0,%y1"
 
21294
+  [(set_attr "type" "vecload")])
 
21295
+
 
21296
+(define_insn "*vsx_lxvd2x4_le_<mode>"
 
21297
+  [(set (match_operand:VSX_W 0 "vsx_register_operand" "=wa")
 
21298
+        (vec_select:VSX_W
 
21299
+          (match_operand:VSX_W 1 "memory_operand" "Z")
 
21300
+          (parallel [(const_int 2) (const_int 3)
 
21301
+                     (const_int 0) (const_int 1)])))]
 
21302
+  "!BYTES_BIG_ENDIAN && VECTOR_MEM_VSX_P (<MODE>mode)"
 
21303
+  "lxvd2x %x0,%y1"
 
21304
+  [(set_attr "type" "vecload")])
 
21305
+
 
21306
+(define_insn "*vsx_lxvd2x8_le_V8HI"
 
21307
+  [(set (match_operand:V8HI 0 "vsx_register_operand" "=wa")
 
21308
+        (vec_select:V8HI
 
21309
+          (match_operand:V8HI 1 "memory_operand" "Z")
 
21310
+          (parallel [(const_int 4) (const_int 5)
 
21311
+                     (const_int 6) (const_int 7)
 
21312
+                     (const_int 0) (const_int 1)
 
21313
+                     (const_int 2) (const_int 3)])))]
 
21314
+  "!BYTES_BIG_ENDIAN && VECTOR_MEM_VSX_P (V8HImode)"
 
21315
+  "lxvd2x %x0,%y1"
 
21316
+  [(set_attr "type" "vecload")])
 
21317
+
 
21318
+(define_insn "*vsx_lxvd2x16_le_V16QI"
 
21319
+  [(set (match_operand:V16QI 0 "vsx_register_operand" "=wa")
 
21320
+        (vec_select:V16QI
 
21321
+          (match_operand:V16QI 1 "memory_operand" "Z")
 
21322
+          (parallel [(const_int 8) (const_int 9)
 
21323
+                     (const_int 10) (const_int 11)
 
21324
+                     (const_int 12) (const_int 13)
 
21325
+                     (const_int 14) (const_int 15)
 
21326
+                     (const_int 0) (const_int 1)
 
21327
+                     (const_int 2) (const_int 3)
 
21328
+                     (const_int 4) (const_int 5)
 
21329
+                     (const_int 6) (const_int 7)])))]
 
21330
+  "!BYTES_BIG_ENDIAN && VECTOR_MEM_VSX_P (V16QImode)"
 
21331
+  "lxvd2x %x0,%y1"
 
21332
+  [(set_attr "type" "vecload")])
 
21333
+
 
21334
+;; stxvd2x for little endian stores.  We need several of
 
21335
+;; these since the form of the PARALLEL differs by mode.
 
21336
+(define_insn "*vsx_stxvd2x2_le_<mode>"
 
21337
+  [(set (match_operand:VSX_D 0 "memory_operand" "=Z")
 
21338
+        (vec_select:VSX_D
 
21339
+          (match_operand:VSX_D 1 "vsx_register_operand" "wa")
 
21340
+          (parallel [(const_int 1) (const_int 0)])))]
 
21341
+  "!BYTES_BIG_ENDIAN && VECTOR_MEM_VSX_P (<MODE>mode)"
 
21342
+  "stxvd2x %x1,%y0"
 
21343
+  [(set_attr "type" "vecstore")])
 
21344
+
 
21345
+(define_insn "*vsx_stxvd2x4_le_<mode>"
 
21346
+  [(set (match_operand:VSX_W 0 "memory_operand" "=Z")
 
21347
+        (vec_select:VSX_W
 
21348
+          (match_operand:VSX_W 1 "vsx_register_operand" "wa")
 
21349
+          (parallel [(const_int 2) (const_int 3)
 
21350
+                     (const_int 0) (const_int 1)])))]
 
21351
+  "!BYTES_BIG_ENDIAN && VECTOR_MEM_VSX_P (<MODE>mode)"
 
21352
+  "stxvd2x %x1,%y0"
 
21353
+  [(set_attr "type" "vecstore")])
 
21354
+
 
21355
+(define_insn "*vsx_stxvd2x8_le_V8HI"
 
21356
+  [(set (match_operand:V8HI 0 "memory_operand" "=Z")
 
21357
+        (vec_select:V8HI
 
21358
+          (match_operand:V8HI 1 "vsx_register_operand" "wa")
 
21359
+          (parallel [(const_int 4) (const_int 5)
 
21360
+                     (const_int 6) (const_int 7)
 
21361
+                     (const_int 0) (const_int 1)
 
21362
+                     (const_int 2) (const_int 3)])))]
 
21363
+  "!BYTES_BIG_ENDIAN && VECTOR_MEM_VSX_P (V8HImode)"
 
21364
+  "stxvd2x %x1,%y0"
 
21365
+  [(set_attr "type" "vecstore")])
 
21366
+
 
21367
+(define_insn "*vsx_stxvd2x16_le_V16QI"
 
21368
+  [(set (match_operand:V16QI 0 "memory_operand" "=Z")
 
21369
+        (vec_select:V16QI
 
21370
+          (match_operand:V16QI 1 "vsx_register_operand" "wa")
 
21371
+          (parallel [(const_int 8) (const_int 9)
 
21372
+                     (const_int 10) (const_int 11)
 
21373
+                     (const_int 12) (const_int 13)
 
21374
+                     (const_int 14) (const_int 15)
 
21375
+                     (const_int 0) (const_int 1)
 
21376
+                     (const_int 2) (const_int 3)
 
21377
+                     (const_int 4) (const_int 5)
 
21378
+                     (const_int 6) (const_int 7)])))]
 
21379
+  "!BYTES_BIG_ENDIAN && VECTOR_MEM_VSX_P (V16QImode)"
 
21380
+  "stxvd2x %x1,%y0"
 
21381
+  [(set_attr "type" "vecstore")])
 
21382
+
 
21383
 ;; Set the element of a V2DI/VD2F mode
 
21384
 (define_insn "vsx_set_<mode>"
 
21385
   [(set (match_operand:VSX_D 0 "vsx_register_operand" "=wd,?wa")
 
21386
@@ -1118,9 +1497,10 @@
 
21387
                      UNSPEC_VSX_SET))]
 
21388
   "VECTOR_MEM_VSX_P (<MODE>mode)"
 
21389
 {
 
21390
-  if (INTVAL (operands[3]) == 0)
 
21391
+  int idx_first = BYTES_BIG_ENDIAN ? 0 : 1;
 
21392
+  if (INTVAL (operands[3]) == idx_first)
 
21393
     return \"xxpermdi %x0,%x2,%x1,1\";
 
21394
-  else if (INTVAL (operands[3]) == 1)
 
21395
+  else if (INTVAL (operands[3]) == 1 - idx_first)
 
21396
     return \"xxpermdi %x0,%x1,%x2,0\";
 
21397
   else
 
21398
     gcc_unreachable ();
 
21399
@@ -1135,8 +1515,12 @@
 
21400
                        [(match_operand:QI 2 "u5bit_cint_operand" "i,i,i")])))]
 
21401
   "VECTOR_MEM_VSX_P (<MODE>mode)"
 
21402
 {
 
21403
+  int fldDM;
 
21404
   gcc_assert (UINTVAL (operands[2]) <= 1);
 
21405
-  operands[3] = GEN_INT (INTVAL (operands[2]) << 1);
 
21406
+  fldDM = INTVAL (operands[2]) << 1;
 
21407
+  if (!BYTES_BIG_ENDIAN)
 
21408
+    fldDM = 3 - fldDM;
 
21409
+  operands[3] = GEN_INT (fldDM);
 
21410
   return \"xxpermdi %x0,%x1,%x1,%3\";
 
21411
 }
 
21412
   [(set_attr "type" "vecperm")])
 
21413
@@ -1149,9 +1533,28 @@
 
21414
         (parallel [(const_int 0)])))]
 
21415
   "VECTOR_MEM_VSX_P (<MODE>mode) && WORDS_BIG_ENDIAN"
 
21416
   "lxsd%U1x %x0,%y1"
 
21417
-  [(set_attr "type" "fpload")
 
21418
+  [(set (attr "type")
 
21419
+      (if_then_else
 
21420
+       (match_test "update_indexed_address_mem (operands[1], VOIDmode)")
 
21421
+       (const_string "fpload_ux")
 
21422
+       (const_string "fpload")))
 
21423
    (set_attr "length" "4")])  
 
21424
 
 
21425
+;; Optimize extracting element 1 from memory for little endian
 
21426
+(define_insn "*vsx_extract_<mode>_one_le"
 
21427
+  [(set (match_operand:<VS_scalar> 0 "vsx_register_operand" "=ws,d,?wa")
 
21428
+       (vec_select:<VS_scalar>
 
21429
+        (match_operand:VSX_D 1 "indexed_or_indirect_operand" "Z,Z,Z")
 
21430
+        (parallel [(const_int 1)])))]
 
21431
+  "VECTOR_MEM_VSX_P (<MODE>mode) && !WORDS_BIG_ENDIAN"
 
21432
+  "lxsd%U1x %x0,%y1"
 
21433
+  [(set (attr "type")
 
21434
+      (if_then_else
 
21435
+       (match_test "update_indexed_address_mem (operands[1], VOIDmode)")
 
21436
+       (const_string "fpload_ux")
 
21437
+       (const_string "fpload")))
 
21438
+   (set_attr "length" "4")])  
 
21439
+
 
21440
 ;; Extract a SF element from V4SF
 
21441
 (define_insn_and_split "vsx_extract_v4sf"
 
21442
   [(set (match_operand:SF 0 "vsx_register_operand" "=f,f")
 
21443
@@ -1172,7 +1575,7 @@
 
21444
   rtx op2 = operands[2];
 
21445
   rtx op3 = operands[3];
 
21446
   rtx tmp;
 
21447
-  HOST_WIDE_INT ele = INTVAL (op2);
 
21448
+  HOST_WIDE_INT ele = BYTES_BIG_ENDIAN ? INTVAL (op2) : 3 - INTVAL (op2);
 
21449
 
 
21450
   if (ele == 0)
 
21451
     tmp = op1;
 
21452
@@ -1213,8 +1616,8 @@
 
21453
       if (<MODE>mode != V2DImode)
 
21454
        {
 
21455
          target = gen_lowpart (V2DImode, target);
 
21456
-         op0 = gen_lowpart (V2DImode, target);
 
21457
-         op1 = gen_lowpart (V2DImode, target);
 
21458
+         op0 = gen_lowpart (V2DImode, op0);
 
21459
+         op1 = gen_lowpart (V2DImode, op1);
 
21460
        }
 
21461
     }
 
21462
   emit_insn (gen (target, op0, op1, perm0, perm1));
 
21463
@@ -1483,3 +1886,27 @@
 
21464
 }"
 
21465
   [(set_attr "length" "20")
 
21466
    (set_attr "type" "veccomplex")])
 
21467
+
 
21468
+
 
21469
+;; Power8 Vector fusion.  The fused ops must be physically adjacent.
 
21470
+(define_peephole
 
21471
+  [(set (match_operand:P 0 "base_reg_operand" "")
 
21472
+       (match_operand:P 1 "short_cint_operand" ""))
 
21473
+   (set (match_operand:VSX_M2 2 "vsx_register_operand" "")
 
21474
+       (mem:VSX_M2 (plus:P (match_dup 0)
 
21475
+                           (match_operand:P 3 "int_reg_operand" ""))))]
 
21476
+  "TARGET_VSX && TARGET_P8_FUSION"
 
21477
+  "li %0,%1\t\t\t# vector load fusion\;lx<VSX_M2:VSm>x %x2,%0,%3"  
 
21478
+  [(set_attr "length" "8")
 
21479
+   (set_attr "type" "vecload")])
 
21480
+
 
21481
+(define_peephole
 
21482
+  [(set (match_operand:P 0 "base_reg_operand" "")
 
21483
+       (match_operand:P 1 "short_cint_operand" ""))
 
21484
+   (set (match_operand:VSX_M2 2 "vsx_register_operand" "")
 
21485
+       (mem:VSX_M2 (plus:P (match_operand:P 3 "int_reg_operand" "")
 
21486
+                           (match_dup 0))))]
 
21487
+  "TARGET_VSX && TARGET_P8_FUSION"
 
21488
+  "li %0,%1\t\t\t# vector load fusion\;lx<VSX_M2:VSm>x %x2,%0,%3"  
 
21489
+  [(set_attr "length" "8")
 
21490
+   (set_attr "type" "vecload")])
 
21491
--- a/src/gcc/config/rs6000/rs6000.h
 
21492
+++ b/src/gcc/config/rs6000/rs6000.h
 
21493
@@ -92,7 +92,7 @@
 
21494
 #ifdef HAVE_AS_POWER8
 
21495
 #define ASM_CPU_POWER8_SPEC "-mpower8"
 
21496
 #else
 
21497
-#define ASM_CPU_POWER8_SPEC "-mpower4 -maltivec"
 
21498
+#define ASM_CPU_POWER8_SPEC ASM_CPU_POWER7_SPEC
 
21499
 #endif
 
21500
 
 
21501
 #ifdef HAVE_AS_DCI
 
21502
@@ -164,6 +164,7 @@
 
21503
 %{mcpu=e6500: -me6500} \
 
21504
 %{maltivec: -maltivec} \
 
21505
 %{mvsx: -mvsx %{!maltivec: -maltivec} %{!mcpu*: %(asm_cpu_power7)}} \
 
21506
+%{mpower8-vector|mcrypto|mdirect-move|mhtm: %{!mcpu*: %(asm_cpu_power8)}} \
 
21507
 -many"
 
21508
 
 
21509
 #define CPP_DEFAULT_SPEC ""
 
21510
@@ -277,6 +278,21 @@
 
21511
 #define TARGET_POPCNTD 0
 
21512
 #endif
 
21513
 
 
21514
+/* Define the ISA 2.07 flags as 0 if the target assembler does not support the
 
21515
+   waitasecond instruction.  Allow -mpower8-fusion, since it does not add new
 
21516
+   instructions.  */
 
21517
+
 
21518
+#ifndef HAVE_AS_POWER8
 
21519
+#undef  TARGET_DIRECT_MOVE
 
21520
+#undef  TARGET_CRYPTO
 
21521
+#undef  TARGET_HTM
 
21522
+#undef  TARGET_P8_VECTOR
 
21523
+#define TARGET_DIRECT_MOVE 0
 
21524
+#define TARGET_CRYPTO 0
 
21525
+#define TARGET_HTM 0
 
21526
+#define TARGET_P8_VECTOR 0
 
21527
+#endif
 
21528
+
 
21529
 /* Define TARGET_LWSYNC_INSTRUCTION if the assembler knows about lwsync.  If
 
21530
    not, generate the lwsync code as an integer constant.  */
 
21531
 #ifdef HAVE_AS_LWSYNC
 
21532
@@ -386,6 +402,7 @@
 
21533
 #define TARGET_DEBUG_TARGET    (rs6000_debug & MASK_DEBUG_TARGET)
 
21534
 #define TARGET_DEBUG_BUILTIN   (rs6000_debug & MASK_DEBUG_BUILTIN)
 
21535
 
 
21536
+/* Describe the vector unit used for arithmetic operations.  */
 
21537
 extern enum rs6000_vector rs6000_vector_unit[];
 
21538
 
 
21539
 #define VECTOR_UNIT_NONE_P(MODE)                       \
 
21540
@@ -394,12 +411,25 @@
 
21541
 #define VECTOR_UNIT_VSX_P(MODE)                                \
 
21542
   (rs6000_vector_unit[(MODE)] == VECTOR_VSX)
 
21543
 
 
21544
+#define VECTOR_UNIT_P8_VECTOR_P(MODE)                  \
 
21545
+  (rs6000_vector_unit[(MODE)] == VECTOR_P8_VECTOR)
 
21546
+
 
21547
 #define VECTOR_UNIT_ALTIVEC_P(MODE)                    \
 
21548
   (rs6000_vector_unit[(MODE)] == VECTOR_ALTIVEC)
 
21549
 
 
21550
+#define VECTOR_UNIT_VSX_OR_P8_VECTOR_P(MODE)           \
 
21551
+  (IN_RANGE ((int)rs6000_vector_unit[(MODE)],          \
 
21552
+            (int)VECTOR_VSX,                           \
 
21553
+            (int)VECTOR_P8_VECTOR))
 
21554
+
 
21555
+/* VECTOR_UNIT_ALTIVEC_OR_VSX_P is used in places where we are using either
 
21556
+   altivec (VMX) or VSX vector instructions.  P8 vector support is upwards
 
21557
+   compatible, so allow it as well, rather than changing all of the uses of the
 
21558
+   macro.  */
 
21559
 #define VECTOR_UNIT_ALTIVEC_OR_VSX_P(MODE)             \
 
21560
-  (rs6000_vector_unit[(MODE)] == VECTOR_ALTIVEC        \
 
21561
-   || rs6000_vector_unit[(MODE)] == VECTOR_VSX)
 
21562
+  (IN_RANGE ((int)rs6000_vector_unit[(MODE)],          \
 
21563
+            (int)VECTOR_ALTIVEC,                       \
 
21564
+            (int)VECTOR_P8_VECTOR))
 
21565
 
 
21566
 /* Describe whether to use VSX loads or Altivec loads.  For now, just use the
 
21567
    same unit as the vector unit we are using, but we may want to migrate to
 
21568
@@ -412,12 +442,21 @@
 
21569
 #define VECTOR_MEM_VSX_P(MODE)                         \
 
21570
   (rs6000_vector_mem[(MODE)] == VECTOR_VSX)
 
21571
 
 
21572
+#define VECTOR_MEM_P8_VECTOR_P(MODE)                   \
 
21573
+  (rs6000_vector_mem[(MODE)] == VECTOR_VSX)
 
21574
+
 
21575
 #define VECTOR_MEM_ALTIVEC_P(MODE)                     \
 
21576
   (rs6000_vector_mem[(MODE)] == VECTOR_ALTIVEC)
 
21577
 
 
21578
+#define VECTOR_MEM_VSX_OR_P8_VECTOR_P(MODE)            \
 
21579
+  (IN_RANGE ((int)rs6000_vector_mem[(MODE)],           \
 
21580
+            (int)VECTOR_VSX,                           \
 
21581
+            (int)VECTOR_P8_VECTOR))
 
21582
+
 
21583
 #define VECTOR_MEM_ALTIVEC_OR_VSX_P(MODE)              \
 
21584
-  (rs6000_vector_mem[(MODE)] == VECTOR_ALTIVEC         \
 
21585
-   || rs6000_vector_mem[(MODE)] == VECTOR_VSX)
 
21586
+  (IN_RANGE ((int)rs6000_vector_mem[(MODE)],           \
 
21587
+            (int)VECTOR_ALTIVEC,                       \
 
21588
+            (int)VECTOR_P8_VECTOR))
 
21589
 
 
21590
 /* Return the alignment of a given vector type, which is set based on the
 
21591
    vector unit use.  VSX for instance can load 32 or 64 bit aligned words
 
21592
@@ -479,22 +518,41 @@
 
21593
 #define TARGET_FCTIDUZ TARGET_POPCNTD
 
21594
 #define TARGET_FCTIWUZ TARGET_POPCNTD
 
21595
 
 
21596
+#define TARGET_XSCVDPSPN       (TARGET_DIRECT_MOVE || TARGET_P8_VECTOR)
 
21597
+#define TARGET_XSCVSPDPN       (TARGET_DIRECT_MOVE || TARGET_P8_VECTOR)
 
21598
+
 
21599
+/* Byte/char syncs were added as phased in for ISA 2.06B, but are not present
 
21600
+   in power7, so conditionalize them on p8 features.  TImode syncs need quad
 
21601
+   memory support.  */
 
21602
+#define TARGET_SYNC_HI_QI      (TARGET_QUAD_MEMORY || TARGET_DIRECT_MOVE)
 
21603
+#define TARGET_SYNC_TI         TARGET_QUAD_MEMORY
 
21604
+
 
21605
+/* Power7 has both 32-bit load and store integer for the FPRs, so we don't need
 
21606
+   to allocate the SDmode stack slot to get the value into the proper location
 
21607
+   in the register.  */
 
21608
+#define TARGET_NO_SDMODE_STACK (TARGET_LFIWZX && TARGET_STFIWX && TARGET_DFP)
 
21609
+
 
21610
 /* In switching from using target_flags to using rs6000_isa_flags, the options
 
21611
    machinery creates OPTION_MASK_<xxx> instead of MASK_<xxx>.  For now map
 
21612
    OPTION_MASK_<xxx> back into MASK_<xxx>.  */
 
21613
 #define MASK_ALTIVEC                   OPTION_MASK_ALTIVEC
 
21614
 #define MASK_CMPB                      OPTION_MASK_CMPB
 
21615
+#define MASK_CRYPTO                    OPTION_MASK_CRYPTO
 
21616
 #define MASK_DFP                       OPTION_MASK_DFP
 
21617
+#define MASK_DIRECT_MOVE               OPTION_MASK_DIRECT_MOVE
 
21618
 #define MASK_DLMZB                     OPTION_MASK_DLMZB
 
21619
 #define MASK_EABI                      OPTION_MASK_EABI
 
21620
 #define MASK_FPRND                     OPTION_MASK_FPRND
 
21621
+#define MASK_P8_FUSION                 OPTION_MASK_P8_FUSION
 
21622
 #define MASK_HARD_FLOAT                        OPTION_MASK_HARD_FLOAT
 
21623
+#define MASK_HTM                       OPTION_MASK_HTM
 
21624
 #define MASK_ISEL                      OPTION_MASK_ISEL
 
21625
 #define MASK_MFCRF                     OPTION_MASK_MFCRF
 
21626
 #define MASK_MFPGPR                    OPTION_MASK_MFPGPR
 
21627
 #define MASK_MULHW                     OPTION_MASK_MULHW
 
21628
 #define MASK_MULTIPLE                  OPTION_MASK_MULTIPLE
 
21629
 #define MASK_NO_UPDATE                 OPTION_MASK_NO_UPDATE
 
21630
+#define MASK_P8_VECTOR                 OPTION_MASK_P8_VECTOR
 
21631
 #define MASK_POPCNTB                   OPTION_MASK_POPCNTB
 
21632
 #define MASK_POPCNTD                   OPTION_MASK_POPCNTD
 
21633
 #define MASK_PPC_GFXOPT                        OPTION_MASK_PPC_GFXOPT
 
21634
@@ -505,6 +563,7 @@
 
21635
 #define MASK_STRING                    OPTION_MASK_STRING
 
21636
 #define MASK_UPDATE                    OPTION_MASK_UPDATE
 
21637
 #define MASK_VSX                       OPTION_MASK_VSX
 
21638
+#define MASK_VSX_TIMODE                        OPTION_MASK_VSX_TIMODE
 
21639
 
 
21640
 #ifndef IN_LIBGCC2
 
21641
 #define MASK_POWERPC64                 OPTION_MASK_POWERPC64
 
21642
@@ -558,6 +617,25 @@
 
21643
                          || rs6000_cpu == PROCESSOR_PPC8548)
 
21644
 
 
21645
 
 
21646
+/* Whether SF/DF operations are supported on the E500.  */
 
21647
+#define TARGET_SF_SPE  (TARGET_HARD_FLOAT && TARGET_SINGLE_FLOAT       \
 
21648
+                        && !TARGET_FPRS)
 
21649
+
 
21650
+#define TARGET_DF_SPE  (TARGET_HARD_FLOAT && TARGET_DOUBLE_FLOAT       \
 
21651
+                        && !TARGET_FPRS && TARGET_E500_DOUBLE)
 
21652
+
 
21653
+/* Whether SF/DF operations are supported by by the normal floating point unit
 
21654
+   (or the vector/scalar unit).  */
 
21655
+#define TARGET_SF_FPR  (TARGET_HARD_FLOAT && TARGET_FPRS               \
 
21656
+                        && TARGET_SINGLE_FLOAT)
 
21657
+
 
21658
+#define TARGET_DF_FPR  (TARGET_HARD_FLOAT && TARGET_FPRS               \
 
21659
+                        && TARGET_DOUBLE_FLOAT)
 
21660
+
 
21661
+/* Whether SF/DF operations are supported by any hardware.  */
 
21662
+#define TARGET_SF_INSN (TARGET_SF_FPR || TARGET_SF_SPE)
 
21663
+#define TARGET_DF_INSN (TARGET_DF_FPR || TARGET_DF_SPE)
 
21664
+
 
21665
 /* Which machine supports the various reciprocal estimate instructions.  */
 
21666
 #define TARGET_FRES    (TARGET_HARD_FLOAT && TARGET_PPC_GFXOPT \
 
21667
                         && TARGET_FPRS && TARGET_SINGLE_FLOAT)
 
21668
@@ -595,9 +673,6 @@
 
21669
 #define RS6000_RECIP_AUTO_RSQRTE_P(MODE) \
 
21670
   (rs6000_recip_bits[(int)(MODE)] & RS6000_RECIP_MASK_AUTO_RSQRTE)
 
21671
 
 
21672
-#define RS6000_RECIP_HIGH_PRECISION_P(MODE) \
 
21673
-  ((MODE) == SFmode || (MODE) == V4SFmode || TARGET_RECIP_PRECISION)
 
21674
-
 
21675
 /* The default CPU for TARGET_OPTION_OVERRIDE.  */
 
21676
 #define OPTION_TARGET_CPU_DEFAULT TARGET_CPU_DEFAULT
 
21677
 
 
21678
@@ -842,15 +917,17 @@
 
21679
    in inline functions.
 
21680
 
 
21681
    Another pseudo (not included in DWARF_FRAME_REGISTERS) is soft frame
 
21682
-   pointer, which is eventually eliminated in favor of SP or FP.  */
 
21683
+   pointer, which is eventually eliminated in favor of SP or FP.
 
21684
 
 
21685
-#define FIRST_PSEUDO_REGISTER 114
 
21686
+   The 3 HTM registers aren't also included in DWARF_FRAME_REGISTERS.  */
 
21687
 
 
21688
+#define FIRST_PSEUDO_REGISTER 117
 
21689
+
 
21690
 /* This must be included for pre gcc 3.0 glibc compatibility.  */
 
21691
 #define PRE_GCC3_DWARF_FRAME_REGISTERS 77
 
21692
 
 
21693
 /* Add 32 dwarf columns for synthetic SPE registers.  */
 
21694
-#define DWARF_FRAME_REGISTERS ((FIRST_PSEUDO_REGISTER - 1) + 32)
 
21695
+#define DWARF_FRAME_REGISTERS ((FIRST_PSEUDO_REGISTER - 4) + 32)
 
21696
 
 
21697
 /* The SPE has an additional 32 synthetic registers, with DWARF debug
 
21698
    info numbering for these registers starting at 1200.  While eh_frame
 
21699
@@ -866,7 +943,7 @@
 
21700
    We must map them here to avoid huge unwinder tables mostly consisting
 
21701
    of unused space.  */
 
21702
 #define DWARF_REG_TO_UNWIND_COLUMN(r) \
 
21703
-  ((r) > 1200 ? ((r) - 1200 + FIRST_PSEUDO_REGISTER - 1) : (r))
 
21704
+  ((r) > 1200 ? ((r) - 1200 + (DWARF_FRAME_REGISTERS - 32)) : (r))
 
21705
 
 
21706
 /* Use standard DWARF numbering for DWARF debugging information.  */
 
21707
 #define DBX_REGISTER_NUMBER(REGNO) rs6000_dbx_register_number (REGNO)
 
21708
@@ -906,7 +983,7 @@
 
21709
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \
 
21710
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \
 
21711
    1, 1                                                   \
 
21712
-   , 1, 1, 1                                       \
 
21713
+   , 1, 1, 1, 1, 1, 1                             \
 
21714
 }
 
21715
 
 
21716
 /* 1 for registers not available across function calls.
 
21717
@@ -926,7 +1003,7 @@
 
21718
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \
 
21719
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \
 
21720
    1, 1                                                   \
 
21721
-   , 1, 1, 1                                       \
 
21722
+   , 1, 1, 1, 1, 1, 1                             \
 
21723
 }
 
21724
 
 
21725
 /* Like `CALL_USED_REGISTERS' except this macro doesn't require that
 
21726
@@ -945,7 +1022,7 @@
 
21727
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \
 
21728
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \
 
21729
    0, 0                                                   \
 
21730
-   , 0, 0, 0                                       \
 
21731
+   , 0, 0, 0, 0, 0, 0                             \
 
21732
 }
 
21733
 
 
21734
 #define TOTAL_ALTIVEC_REGS     (LAST_ALTIVEC_REGNO - FIRST_ALTIVEC_REGNO + 1)
 
21735
@@ -984,6 +1061,9 @@
 
21736
        vrsave, vscr    (fixed)
 
21737
        spe_acc, spefscr (fixed)
 
21738
        sfp             (fixed)
 
21739
+       tfhar           (fixed)
 
21740
+       tfiar           (fixed)
 
21741
+       texasr          (fixed)
 
21742
 */
 
21743
 
 
21744
 #if FIXED_R2 == 1
 
21745
@@ -1004,7 +1084,9 @@
 
21746
 
 
21747
 #define REG_ALLOC_ORDER                                                \
 
21748
   {32,                                                         \
 
21749
-   45, 44, 43, 42, 41, 40, 39, 38, 37, 36, 35, 34,             \
 
21750
+   /* move fr13 (ie 45) later, so if we need TFmode, it does */        \
 
21751
+   /* not use fr14 which is a saved register.  */              \
 
21752
+   44, 43, 42, 41, 40, 39, 38, 37, 36, 35, 34, 45,             \
 
21753
    33,                                                         \
 
21754
    63, 62, 61, 60, 59, 58, 57, 56, 55, 54, 53, 52, 51,         \
 
21755
    50, 49, 48, 47, 46,                                         \
 
21756
@@ -1023,7 +1105,7 @@
 
21757
    96, 95, 94, 93, 92, 91,                                     \
 
21758
    108, 107, 106, 105, 104, 103, 102, 101, 100, 99, 98, 97,    \
 
21759
    109, 110,                                                   \
 
21760
-   111, 112, 113                                               \
 
21761
+   111, 112, 113, 114, 115, 116                                        \
 
21762
 }
 
21763
 
 
21764
 /* True if register is floating-point.  */
 
21765
@@ -1064,8 +1146,11 @@
 
21766
 #define VINT_REGNO_P(N) ALTIVEC_REGNO_P (N)
 
21767
 
 
21768
 /* Alternate name for any vector register supporting logical operations, no
 
21769
-   matter which instruction set(s) are available.  */
 
21770
-#define VLOGICAL_REGNO_P(N) VFLOAT_REGNO_P (N)
 
21771
+   matter which instruction set(s) are available.  Allow GPRs as well as the
 
21772
+   vector registers.  */
 
21773
+#define VLOGICAL_REGNO_P(N)                                            \
 
21774
+  (INT_REGNO_P (N) || ALTIVEC_REGNO_P (N)                              \
 
21775
+   || (TARGET_VSX && FP_REGNO_P (N)))                                  \
 
21776
 
 
21777
 /* Return number of consecutive hard regs needed starting at reg REGNO
 
21778
    to hold something of mode MODE.  */
 
21779
@@ -1125,28 +1210,32 @@
 
21780
 /* Value is 1 if it is a good idea to tie two pseudo registers
 
21781
    when one has mode MODE1 and one has mode MODE2.
 
21782
    If HARD_REGNO_MODE_OK could produce different values for MODE1 and MODE2,
 
21783
-   for any hard reg, then this must be 0 for correct output.  */
 
21784
-#define MODES_TIEABLE_P(MODE1, MODE2) \
 
21785
-  (SCALAR_FLOAT_MODE_P (MODE1)                 \
 
21786
+   for any hard reg, then this must be 0 for correct output.
 
21787
+
 
21788
+   PTImode cannot tie with other modes because PTImode is restricted to even
 
21789
+   GPR registers, and TImode can go in any GPR as well as VSX registers (PR
 
21790
+   57744).  */
 
21791
+#define MODES_TIEABLE_P(MODE1, MODE2)          \
 
21792
+  ((MODE1) == PTImode                          \
 
21793
+   ? (MODE2) == PTImode                                \
 
21794
+   : (MODE2) == PTImode                                \
 
21795
+   ? 0                                         \
 
21796
+   : SCALAR_FLOAT_MODE_P (MODE1)               \
 
21797
    ? SCALAR_FLOAT_MODE_P (MODE2)               \
 
21798
    : SCALAR_FLOAT_MODE_P (MODE2)               \
 
21799
-   ? SCALAR_FLOAT_MODE_P (MODE1)               \
 
21800
+   ? 0                                         \
 
21801
    : GET_MODE_CLASS (MODE1) == MODE_CC         \
 
21802
    ? GET_MODE_CLASS (MODE2) == MODE_CC         \
 
21803
    : GET_MODE_CLASS (MODE2) == MODE_CC         \
 
21804
-   ? GET_MODE_CLASS (MODE1) == MODE_CC         \
 
21805
+   ? 0                                         \
 
21806
    : SPE_VECTOR_MODE (MODE1)                   \
 
21807
    ? SPE_VECTOR_MODE (MODE2)                   \
 
21808
    : SPE_VECTOR_MODE (MODE2)                   \
 
21809
-   ? SPE_VECTOR_MODE (MODE1)                   \
 
21810
-   : ALTIVEC_VECTOR_MODE (MODE1)               \
 
21811
-   ? ALTIVEC_VECTOR_MODE (MODE2)               \
 
21812
-   : ALTIVEC_VECTOR_MODE (MODE2)               \
 
21813
-   ? ALTIVEC_VECTOR_MODE (MODE1)               \
 
21814
+   ? 0                                         \
 
21815
    : ALTIVEC_OR_VSX_VECTOR_MODE (MODE1)                \
 
21816
    ? ALTIVEC_OR_VSX_VECTOR_MODE (MODE2)                \
 
21817
    : ALTIVEC_OR_VSX_VECTOR_MODE (MODE2)                \
 
21818
-   ? ALTIVEC_OR_VSX_VECTOR_MODE (MODE1)                \
 
21819
+   ? 0                                         \
 
21820
    : 1)
 
21821
 
 
21822
 /* Post-reload, we can't use any new AltiVec registers, as we already
 
21823
@@ -1240,6 +1329,7 @@
 
21824
   VSCR_REGS,
 
21825
   SPE_ACC_REGS,
 
21826
   SPEFSCR_REGS,
 
21827
+  SPR_REGS,
 
21828
   NON_SPECIAL_REGS,
 
21829
   LINK_REGS,
 
21830
   CTR_REGS,
 
21831
@@ -1270,6 +1360,7 @@
 
21832
   "VSCR_REGS",                                                         \
 
21833
   "SPE_ACC_REGS",                                                       \
 
21834
   "SPEFSCR_REGS",                                                       \
 
21835
+  "SPR_REGS",                                                          \
 
21836
   "NON_SPECIAL_REGS",                                                  \
 
21837
   "LINK_REGS",                                                         \
 
21838
   "CTR_REGS",                                                          \
 
21839
@@ -1299,6 +1390,7 @@
 
21840
   { 0x00000000, 0x00000000, 0x00000000, 0x00004000 }, /* VSCR_REGS */       \
 
21841
   { 0x00000000, 0x00000000, 0x00000000, 0x00008000 }, /* SPE_ACC_REGS */     \
 
21842
   { 0x00000000, 0x00000000, 0x00000000, 0x00010000 }, /* SPEFSCR_REGS */     \
 
21843
+  { 0x00000000, 0x00000000, 0x00000000, 0x00040000 }, /* SPR_REGS */     \
 
21844
   { 0xffffffff, 0xffffffff, 0x00000008, 0x00020000 }, /* NON_SPECIAL_REGS */ \
 
21845
   { 0x00000000, 0x00000000, 0x00000002, 0x00000000 }, /* LINK_REGS */       \
 
21846
   { 0x00000000, 0x00000000, 0x00000004, 0x00000000 }, /* CTR_REGS */        \
 
21847
@@ -1309,7 +1401,7 @@
 
21848
   { 0x00000000, 0x00000000, 0x00000ff0, 0x00000000 }, /* CR_REGS */         \
 
21849
   { 0xffffffff, 0x00000000, 0x00000ffe, 0x00020000 }, /* NON_FLOAT_REGS */   \
 
21850
   { 0x00000000, 0x00000000, 0x00001000, 0x00000000 }, /* CA_REGS */         \
 
21851
-  { 0xffffffff, 0xffffffff, 0xfffffffe, 0x0003ffff }  /* ALL_REGS */        \
 
21852
+  { 0xffffffff, 0xffffffff, 0xfffffffe, 0x0007ffff }  /* ALL_REGS */        \
 
21853
 }
 
21854
 
 
21855
 /* The same information, inverted:
 
21856
@@ -1337,7 +1429,18 @@
 
21857
   RS6000_CONSTRAINT_wa,                /* Any VSX register */
 
21858
   RS6000_CONSTRAINT_wd,                /* VSX register for V2DF */
 
21859
   RS6000_CONSTRAINT_wf,                /* VSX register for V4SF */
 
21860
+  RS6000_CONSTRAINT_wg,                /* FPR register for -mmfpgpr */
 
21861
+  RS6000_CONSTRAINT_wl,                /* FPR register for LFIWAX */
 
21862
+  RS6000_CONSTRAINT_wm,                /* VSX register for direct move */
 
21863
+  RS6000_CONSTRAINT_wr,                /* GPR register if 64-bit  */
 
21864
   RS6000_CONSTRAINT_ws,                /* VSX register for DF */
 
21865
+  RS6000_CONSTRAINT_wt,                /* VSX register for TImode */
 
21866
+  RS6000_CONSTRAINT_wu,                /* Altivec register for float load/stores.  */
 
21867
+  RS6000_CONSTRAINT_wv,                /* Altivec register for double load/stores.  */
 
21868
+  RS6000_CONSTRAINT_ww,                /* FP or VSX register for vsx float ops.  */
 
21869
+  RS6000_CONSTRAINT_wx,                /* FPR register for STFIWX */
 
21870
+  RS6000_CONSTRAINT_wy,                /* VSX register for SF */
 
21871
+  RS6000_CONSTRAINT_wz,                /* FPR register for LFIWZX */
 
21872
   RS6000_CONSTRAINT_MAX
 
21873
 };
 
21874
 
 
21875
@@ -1425,21 +1528,14 @@
 
21876
    arguments.  */
 
21877
 #define FRAME_GROWS_DOWNWARD (flag_stack_protect != 0 || flag_asan != 0)
 
21878
 
 
21879
-/* Size of the outgoing register save area */
 
21880
-#define RS6000_REG_SAVE ((DEFAULT_ABI == ABI_AIX                       \
 
21881
-                         || DEFAULT_ABI == ABI_DARWIN)                 \
 
21882
-                        ? (TARGET_64BIT ? 64 : 32)                     \
 
21883
-                        : 0)
 
21884
-
 
21885
 /* Size of the fixed area on the stack */
 
21886
 #define RS6000_SAVE_AREA \
 
21887
-  (((DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_DARWIN) ? 24 : 8)    \
 
21888
+  ((DEFAULT_ABI == ABI_V4 ? 8 : DEFAULT_ABI == ABI_ELFv2 ? 16 : 24)    \
 
21889
    << (TARGET_64BIT ? 1 : 0))
 
21890
 
 
21891
-/* MEM representing address to save the TOC register */
 
21892
-#define RS6000_SAVE_TOC gen_rtx_MEM (Pmode, \
 
21893
-                                    plus_constant (Pmode, stack_pointer_rtx, \
 
21894
-                                                   (TARGET_32BIT ? 20 : 40)))
 
21895
+/* Stack offset for toc save slot.  */
 
21896
+#define RS6000_TOC_SAVE_SLOT \
 
21897
+  ((DEFAULT_ABI == ABI_ELFv2 ? 12 : 20) << (TARGET_64BIT ? 1 : 0))
 
21898
 
 
21899
 /* Align an address */
 
21900
 #define RS6000_ALIGN(n,a) (((n) + (a) - 1) & ~((a) - 1))
 
21901
@@ -1489,7 +1585,7 @@
 
21902
 /* Define this if stack space is still allocated for a parameter passed
 
21903
    in a register.  The value is the number of bytes allocated to this
 
21904
    area.  */
 
21905
-#define REG_PARM_STACK_SPACE(FNDECL)   RS6000_REG_SAVE
 
21906
+#define REG_PARM_STACK_SPACE(FNDECL) rs6000_reg_parm_stack_space((FNDECL))
 
21907
 
 
21908
 /* Define this if the above stack space is to be considered part of the
 
21909
    space allocated by the caller.  */
 
21910
@@ -1522,7 +1618,7 @@
 
21911
    NONLOCAL needs twice Pmode to maintain both backchain and SP.  */
 
21912
 #define STACK_SAVEAREA_MODE(LEVEL)     \
 
21913
   (LEVEL == SAVE_FUNCTION ? VOIDmode   \
 
21914
-  : LEVEL == SAVE_NONLOCAL ? (TARGET_32BIT ? DImode : TImode) : Pmode)
 
21915
+  : LEVEL == SAVE_NONLOCAL ? (TARGET_32BIT ? DImode : PTImode) : Pmode)
 
21916
 
 
21917
 /* Minimum and maximum general purpose registers used to hold arguments.  */
 
21918
 #define GP_ARG_MIN_REG 3
 
21919
@@ -1533,9 +1629,8 @@
 
21920
 #define FP_ARG_MIN_REG 33
 
21921
 #define        FP_ARG_AIX_MAX_REG 45
 
21922
 #define        FP_ARG_V4_MAX_REG  40
 
21923
-#define        FP_ARG_MAX_REG ((DEFAULT_ABI == ABI_AIX                         \
 
21924
-                        || DEFAULT_ABI == ABI_DARWIN)                  \
 
21925
-                       ? FP_ARG_AIX_MAX_REG : FP_ARG_V4_MAX_REG)
 
21926
+#define        FP_ARG_MAX_REG (DEFAULT_ABI == ABI_V4                           \
 
21927
+                       ? FP_ARG_V4_MAX_REG : FP_ARG_AIX_MAX_REG)
 
21928
 #define FP_ARG_NUM_REG (FP_ARG_MAX_REG - FP_ARG_MIN_REG + 1)
 
21929
 
 
21930
 /* Minimum and maximum AltiVec registers used to hold arguments.  */
 
21931
@@ -1543,10 +1638,17 @@
 
21932
 #define ALTIVEC_ARG_MAX_REG (ALTIVEC_ARG_MIN_REG + 11)
 
21933
 #define ALTIVEC_ARG_NUM_REG (ALTIVEC_ARG_MAX_REG - ALTIVEC_ARG_MIN_REG + 1)
 
21934
 
 
21935
+/* Maximum number of registers per ELFv2 homogeneous aggregate argument.  */
 
21936
+#define AGGR_ARG_NUM_REG 8
 
21937
+
 
21938
 /* Return registers */
 
21939
 #define GP_ARG_RETURN GP_ARG_MIN_REG
 
21940
 #define FP_ARG_RETURN FP_ARG_MIN_REG
 
21941
 #define ALTIVEC_ARG_RETURN (FIRST_ALTIVEC_REGNO + 2)
 
21942
+#define FP_ARG_MAX_RETURN (DEFAULT_ABI != ABI_ELFv2 ? FP_ARG_RETURN    \
 
21943
+                          : (FP_ARG_RETURN + AGGR_ARG_NUM_REG - 1))
 
21944
+#define ALTIVEC_ARG_MAX_RETURN (DEFAULT_ABI != ABI_ELFv2 ? ALTIVEC_ARG_RETURN \
 
21945
+                               : (ALTIVEC_ARG_RETURN + AGGR_ARG_NUM_REG - 1))
 
21946
 
 
21947
 /* Flags for the call/call_value rtl operations set up by function_arg */
 
21948
 #define CALL_NORMAL            0x00000000      /* no special processing */
 
21949
@@ -1566,8 +1668,10 @@
 
21950
    On RS/6000, this is r3, fp1, and v2 (for AltiVec).  */
 
21951
 #define FUNCTION_VALUE_REGNO_P(N)                                      \
 
21952
   ((N) == GP_ARG_RETURN                                                        \
 
21953
-   || ((N) == FP_ARG_RETURN && TARGET_HARD_FLOAT && TARGET_FPRS)       \
 
21954
-   || ((N) == ALTIVEC_ARG_RETURN && TARGET_ALTIVEC && TARGET_ALTIVEC_ABI))
 
21955
+   || ((N) >= FP_ARG_RETURN && (N) <= FP_ARG_MAX_RETURN                        \
 
21956
+       && TARGET_HARD_FLOAT && TARGET_FPRS)                            \
 
21957
+   || ((N) >= ALTIVEC_ARG_RETURN && (N) <= ALTIVEC_ARG_MAX_RETURN      \
 
21958
+       && TARGET_ALTIVEC && TARGET_ALTIVEC_ABI))
 
21959
 
 
21960
 /* 1 if N is a possible register number for function argument passing.
 
21961
    On RS/6000, these are r3-r10 and fp1-fp13.
 
21962
@@ -1691,11 +1795,8 @@
 
21963
 /* Number of bytes into the frame return addresses can be found.  See
 
21964
    rs6000_stack_info in rs6000.c for more information on how the different
 
21965
    abi's store the return address.  */
 
21966
-#define RETURN_ADDRESS_OFFSET                                          \
 
21967
- ((DEFAULT_ABI == ABI_AIX                                              \
 
21968
-   || DEFAULT_ABI == ABI_DARWIN)       ? (TARGET_32BIT ? 8 : 16) :     \
 
21969
-  (DEFAULT_ABI == ABI_V4)              ? 4 :                           \
 
21970
-  (internal_error ("RETURN_ADDRESS_OFFSET not supported"), 0))
 
21971
+#define RETURN_ADDRESS_OFFSET \
 
21972
+  ((DEFAULT_ABI == ABI_V4 ? 4 : 8) << (TARGET_64BIT ? 1 : 0))
 
21973
 
 
21974
 /* The current return address is in link register (65).  The return address
 
21975
    of anything farther back is accessed normally at an offset of 8 from the
 
21976
@@ -2215,6 +2316,9 @@
 
21977
   &rs6000_reg_names[111][0],   /* spe_acc */                           \
 
21978
   &rs6000_reg_names[112][0],   /* spefscr */                           \
 
21979
   &rs6000_reg_names[113][0],   /* sfp  */                              \
 
21980
+  &rs6000_reg_names[114][0],   /* tfhar  */                            \
 
21981
+  &rs6000_reg_names[115][0],   /* tfiar  */                            \
 
21982
+  &rs6000_reg_names[116][0],   /* texasr  */                           \
 
21983
 }
 
21984
 
 
21985
 /* Table of additional register names to use in user input.  */
 
21986
@@ -2268,7 +2372,9 @@
 
21987
   {"vs48", 93}, {"vs49", 94}, {"vs50", 95}, {"vs51", 96},       \
 
21988
   {"vs52", 97}, {"vs53", 98}, {"vs54", 99}, {"vs55", 100},     \
 
21989
   {"vs56", 101},{"vs57", 102},{"vs58", 103},{"vs59", 104},      \
 
21990
-  {"vs60", 105},{"vs61", 106},{"vs62", 107},{"vs63", 108} }
 
21991
+  {"vs60", 105},{"vs61", 106},{"vs62", 107},{"vs63", 108},     \
 
21992
+  /* Transactional Memory Facility (HTM) Registers.  */                \
 
21993
+  {"tfhar",  114}, {"tfiar",  115}, {"texasr",  116} }
 
21994
 
 
21995
 /* This is how to output an element of a case-vector that is relative.  */
 
21996
 
 
21997
@@ -2357,7 +2463,12 @@
 
21998
 #define RS6000_BTC_ATTR_MASK   0x00000700      /* Mask of the attributes.  */
 
21999
 
 
22000
 /* Miscellaneous information.  */
 
22001
-#define RS6000_BTC_OVERLOADED  0x4000000       /* function is overloaded.  */
 
22002
+#define RS6000_BTC_SPR         0x01000000      /* function references SPRs.  */
 
22003
+#define RS6000_BTC_VOID                0x02000000      /* function has no return value.  */
 
22004
+#define RS6000_BTC_OVERLOADED  0x04000000      /* function is overloaded.  */
 
22005
+#define RS6000_BTC_32BIT       0x08000000      /* function references SPRs.  */
 
22006
+#define RS6000_BTC_64BIT       0x10000000      /* function references SPRs.  */
 
22007
+#define RS6000_BTC_MISC_MASK   0x1f000000      /* Mask of the misc info.  */
 
22008
 
 
22009
 /* Convenience macros to document the instruction type.  */
 
22010
 #define RS6000_BTC_MEM         RS6000_BTC_MISC /* load/store touches mem.  */
 
22011
@@ -2369,6 +2480,9 @@
 
22012
 #define RS6000_BTM_ALWAYS      0               /* Always enabled.  */
 
22013
 #define RS6000_BTM_ALTIVEC     MASK_ALTIVEC    /* VMX/altivec vectors.  */
 
22014
 #define RS6000_BTM_VSX         MASK_VSX        /* VSX (vector/scalar).  */
 
22015
+#define RS6000_BTM_P8_VECTOR   MASK_P8_VECTOR  /* ISA 2.07 vector.  */
 
22016
+#define RS6000_BTM_CRYPTO      MASK_CRYPTO     /* crypto funcs.  */
 
22017
+#define RS6000_BTM_HTM         MASK_HTM        /* hardware TM funcs.  */
 
22018
 #define RS6000_BTM_SPE         MASK_STRING     /* E500 */
 
22019
 #define RS6000_BTM_PAIRED      MASK_MULHW      /* 750CL paired insns.  */
 
22020
 #define RS6000_BTM_FRE         MASK_POPCNTB    /* FRE instruction.  */
 
22021
@@ -2380,10 +2494,13 @@
 
22022
 
 
22023
 #define RS6000_BTM_COMMON      (RS6000_BTM_ALTIVEC                     \
 
22024
                                 | RS6000_BTM_VSX                       \
 
22025
+                                | RS6000_BTM_P8_VECTOR                 \
 
22026
+                                | RS6000_BTM_CRYPTO                    \
 
22027
                                 | RS6000_BTM_FRE                       \
 
22028
                                 | RS6000_BTM_FRES                      \
 
22029
                                 | RS6000_BTM_FRSQRTE                   \
 
22030
                                 | RS6000_BTM_FRSQRTES                  \
 
22031
+                                | RS6000_BTM_HTM                       \
 
22032
                                 | RS6000_BTM_POPCNTD                   \
 
22033
                                 | RS6000_BTM_CELL)
 
22034
 
 
22035
@@ -2395,6 +2512,7 @@
 
22036
 #undef RS6000_BUILTIN_A
 
22037
 #undef RS6000_BUILTIN_D
 
22038
 #undef RS6000_BUILTIN_E
 
22039
+#undef RS6000_BUILTIN_H
 
22040
 #undef RS6000_BUILTIN_P
 
22041
 #undef RS6000_BUILTIN_Q
 
22042
 #undef RS6000_BUILTIN_S
 
22043
@@ -2406,6 +2524,7 @@
 
22044
 #define RS6000_BUILTIN_A(ENUM, NAME, MASK, ATTR, ICODE) ENUM,
 
22045
 #define RS6000_BUILTIN_D(ENUM, NAME, MASK, ATTR, ICODE) ENUM,
 
22046
 #define RS6000_BUILTIN_E(ENUM, NAME, MASK, ATTR, ICODE) ENUM,
 
22047
+#define RS6000_BUILTIN_H(ENUM, NAME, MASK, ATTR, ICODE) ENUM,
 
22048
 #define RS6000_BUILTIN_P(ENUM, NAME, MASK, ATTR, ICODE) ENUM,
 
22049
 #define RS6000_BUILTIN_Q(ENUM, NAME, MASK, ATTR, ICODE) ENUM,
 
22050
 #define RS6000_BUILTIN_S(ENUM, NAME, MASK, ATTR, ICODE) ENUM,
 
22051
@@ -2424,6 +2543,7 @@
 
22052
 #undef RS6000_BUILTIN_A
 
22053
 #undef RS6000_BUILTIN_D
 
22054
 #undef RS6000_BUILTIN_E
 
22055
+#undef RS6000_BUILTIN_H
 
22056
 #undef RS6000_BUILTIN_P
 
22057
 #undef RS6000_BUILTIN_Q
 
22058
 #undef RS6000_BUILTIN_S
 
22059
--- a/src/gcc/config/rs6000/altivec.md
 
22060
+++ b/src/gcc/config/rs6000/altivec.md
 
22061
@@ -41,15 +41,11 @@
 
22062
    UNSPEC_VMULOSB
 
22063
    UNSPEC_VMULOUH
 
22064
    UNSPEC_VMULOSH
 
22065
-   UNSPEC_VPKUHUM
 
22066
-   UNSPEC_VPKUWUM
 
22067
    UNSPEC_VPKPX
 
22068
-   UNSPEC_VPKSHSS
 
22069
-   UNSPEC_VPKSWSS
 
22070
-   UNSPEC_VPKUHUS
 
22071
-   UNSPEC_VPKSHUS
 
22072
-   UNSPEC_VPKUWUS
 
22073
-   UNSPEC_VPKSWUS
 
22074
+   UNSPEC_VPACK_SIGN_SIGN_SAT
 
22075
+   UNSPEC_VPACK_SIGN_UNS_SAT
 
22076
+   UNSPEC_VPACK_UNS_UNS_SAT
 
22077
+   UNSPEC_VPACK_UNS_UNS_MOD
 
22078
    UNSPEC_VSLV4SI
 
22079
    UNSPEC_VSLO
 
22080
    UNSPEC_VSR
 
22081
@@ -71,12 +67,10 @@
 
22082
    UNSPEC_VLOGEFP
 
22083
    UNSPEC_VEXPTEFP
 
22084
    UNSPEC_VLSDOI
 
22085
-   UNSPEC_VUPKHSB
 
22086
+   UNSPEC_VUNPACK_HI_SIGN
 
22087
+   UNSPEC_VUNPACK_LO_SIGN
 
22088
    UNSPEC_VUPKHPX
 
22089
-   UNSPEC_VUPKHSH
 
22090
-   UNSPEC_VUPKLSB
 
22091
    UNSPEC_VUPKLPX
 
22092
-   UNSPEC_VUPKLSH
 
22093
    UNSPEC_DST
 
22094
    UNSPEC_DSTT
 
22095
    UNSPEC_DSTST
 
22096
@@ -134,6 +128,7 @@
 
22097
    UNSPEC_VUPKLS_V4SF
 
22098
    UNSPEC_VUPKHU_V4SF
 
22099
    UNSPEC_VUPKLU_V4SF
 
22100
+   UNSPEC_VGBBD
 
22101
 ])
 
22102
 
 
22103
 (define_c_enum "unspecv"
 
22104
@@ -146,6 +141,8 @@
 
22105
 
 
22106
 ;; Vec int modes
 
22107
 (define_mode_iterator VI [V4SI V8HI V16QI])
 
22108
+;; Like VI, but add ISA 2.07 integer vector ops
 
22109
+(define_mode_iterator VI2 [V4SI V8HI V16QI V2DI])
 
22110
 ;; Short vec in modes
 
22111
 (define_mode_iterator VIshort [V8HI V16QI])
 
22112
 ;; Vec float modes
 
22113
@@ -159,9 +156,19 @@
 
22114
 ;; Like VM, except don't do TImode
 
22115
 (define_mode_iterator VM2 [V4SI V8HI V16QI V4SF V2DF V2DI])
 
22116
 
 
22117
-(define_mode_attr VI_char [(V4SI "w") (V8HI "h") (V16QI "b")])
 
22118
-(define_mode_attr VI_scalar [(V4SI "SI") (V8HI "HI") (V16QI "QI")])
 
22119
+(define_mode_attr VI_char [(V2DI "d") (V4SI "w") (V8HI "h") (V16QI "b")])
 
22120
+(define_mode_attr VI_scalar [(V2DI "DI") (V4SI "SI") (V8HI "HI") (V16QI "QI")])
 
22121
+(define_mode_attr VI_unit [(V16QI "VECTOR_UNIT_ALTIVEC_P (V16QImode)")
 
22122
+                          (V8HI "VECTOR_UNIT_ALTIVEC_P (V8HImode)")
 
22123
+                          (V4SI "VECTOR_UNIT_ALTIVEC_P (V4SImode)")
 
22124
+                          (V2DI "VECTOR_UNIT_P8_VECTOR_P (V2DImode)")])
 
22125
 
 
22126
+;; Vector pack/unpack
 
22127
+(define_mode_iterator VP [V2DI V4SI V8HI])
 
22128
+(define_mode_attr VP_small [(V2DI "V4SI") (V4SI "V8HI") (V8HI "V16QI")])
 
22129
+(define_mode_attr VP_small_lc [(V2DI "v4si") (V4SI "v8hi") (V8HI "v16qi")])
 
22130
+(define_mode_attr VU_char [(V2DI "w") (V4SI "h") (V8HI "b")])
 
22131
+
 
22132
 ;; Vector move instructions.
 
22133
 (define_insn "*altivec_mov<mode>"
 
22134
   [(set (match_operand:VM2 0 "nonimmediate_operand" "=Z,v,v,*Y,*r,*r,v,v")
 
22135
@@ -378,10 +385,10 @@
 
22136
 
 
22137
 ;; add
 
22138
 (define_insn "add<mode>3"
 
22139
-  [(set (match_operand:VI 0 "register_operand" "=v")
 
22140
-        (plus:VI (match_operand:VI 1 "register_operand" "v")
 
22141
-                 (match_operand:VI 2 "register_operand" "v")))]
 
22142
-  "TARGET_ALTIVEC"
 
22143
+  [(set (match_operand:VI2 0 "register_operand" "=v")
 
22144
+        (plus:VI2 (match_operand:VI2 1 "register_operand" "v")
 
22145
+                 (match_operand:VI2 2 "register_operand" "v")))]
 
22146
+  "<VI_unit>"
 
22147
   "vaddu<VI_char>m %0,%1,%2"
 
22148
   [(set_attr "type" "vecsimple")])
 
22149
 
 
22150
@@ -398,17 +405,17 @@
 
22151
         (unspec:V4SI [(match_operand:V4SI 1 "register_operand" "v")
 
22152
                       (match_operand:V4SI 2 "register_operand" "v")]
 
22153
                     UNSPEC_VADDCUW))]
 
22154
-  "TARGET_ALTIVEC"
 
22155
+  "VECTOR_UNIT_ALTIVEC_P (V4SImode)"
 
22156
   "vaddcuw %0,%1,%2"
 
22157
   [(set_attr "type" "vecsimple")])
 
22158
 
 
22159
 (define_insn "altivec_vaddu<VI_char>s"
 
22160
   [(set (match_operand:VI 0 "register_operand" "=v")
 
22161
         (unspec:VI [(match_operand:VI 1 "register_operand" "v")
 
22162
-                    (match_operand:VI 2 "register_operand" "v")]
 
22163
+                   (match_operand:VI 2 "register_operand" "v")]
 
22164
                   UNSPEC_VADDU))
 
22165
    (set (reg:SI 110) (unspec:SI [(const_int 0)] UNSPEC_SET_VSCR))]
 
22166
-  "TARGET_ALTIVEC"
 
22167
+  "<VI_unit>"
 
22168
   "vaddu<VI_char>s %0,%1,%2"
 
22169
   [(set_attr "type" "vecsimple")])
 
22170
 
 
22171
@@ -418,16 +425,16 @@
 
22172
                     (match_operand:VI 2 "register_operand" "v")]
 
22173
                   UNSPEC_VADDS))
 
22174
    (set (reg:SI 110) (unspec:SI [(const_int 0)] UNSPEC_SET_VSCR))]
 
22175
-  "TARGET_ALTIVEC"
 
22176
+  "VECTOR_UNIT_ALTIVEC_P (<MODE>mode)"
 
22177
   "vadds<VI_char>s %0,%1,%2"
 
22178
   [(set_attr "type" "vecsimple")])
 
22179
 
 
22180
 ;; sub
 
22181
 (define_insn "sub<mode>3"
 
22182
-  [(set (match_operand:VI 0 "register_operand" "=v")
 
22183
-        (minus:VI (match_operand:VI 1 "register_operand" "v")
 
22184
-                  (match_operand:VI 2 "register_operand" "v")))]
 
22185
-  "TARGET_ALTIVEC"
 
22186
+  [(set (match_operand:VI2 0 "register_operand" "=v")
 
22187
+        (minus:VI2 (match_operand:VI2 1 "register_operand" "v")
 
22188
+                  (match_operand:VI2 2 "register_operand" "v")))]
 
22189
+  "<VI_unit>"
 
22190
   "vsubu<VI_char>m %0,%1,%2"
 
22191
   [(set_attr "type" "vecsimple")])
 
22192
 
 
22193
@@ -444,7 +451,7 @@
 
22194
         (unspec:V4SI [(match_operand:V4SI 1 "register_operand" "v")
 
22195
                       (match_operand:V4SI 2 "register_operand" "v")]
 
22196
                     UNSPEC_VSUBCUW))]
 
22197
-  "TARGET_ALTIVEC"
 
22198
+  "VECTOR_UNIT_ALTIVEC_P (V4SImode)"
 
22199
   "vsubcuw %0,%1,%2"
 
22200
   [(set_attr "type" "vecsimple")])
 
22201
 
 
22202
@@ -454,7 +461,7 @@
 
22203
                     (match_operand:VI 2 "register_operand" "v")]
 
22204
                   UNSPEC_VSUBU))
 
22205
    (set (reg:SI 110) (unspec:SI [(const_int 0)] UNSPEC_SET_VSCR))]
 
22206
-  "TARGET_ALTIVEC"
 
22207
+  "VECTOR_UNIT_ALTIVEC_P (<MODE>mode)"
 
22208
   "vsubu<VI_char>s %0,%1,%2"
 
22209
   [(set_attr "type" "vecsimple")])
 
22210
 
 
22211
@@ -464,7 +471,7 @@
 
22212
                     (match_operand:VI 2 "register_operand" "v")]
 
22213
                   UNSPEC_VSUBS))
 
22214
    (set (reg:SI 110) (unspec:SI [(const_int 0)] UNSPEC_SET_VSCR))]
 
22215
-  "TARGET_ALTIVEC"
 
22216
+  "VECTOR_UNIT_ALTIVEC_P (<MODE>mode)"
 
22217
   "vsubs<VI_char>s %0,%1,%2"
 
22218
   [(set_attr "type" "vecsimple")])
 
22219
 
 
22220
@@ -483,7 +490,7 @@
 
22221
         (unspec:VI [(match_operand:VI 1 "register_operand" "v")
 
22222
                     (match_operand:VI 2 "register_operand" "v")]
 
22223
                   UNSPEC_VAVGS))]
 
22224
-  "TARGET_ALTIVEC"
 
22225
+  "VECTOR_UNIT_ALTIVEC_P (<MODE>mode)"
 
22226
   "vavgs<VI_char> %0,%1,%2"
 
22227
   [(set_attr "type" "vecsimple")])
 
22228
 
 
22229
@@ -492,31 +499,31 @@
 
22230
         (unspec:V4SI [(match_operand:V4SF 1 "register_operand" "v")
 
22231
                       (match_operand:V4SF 2 "register_operand" "v")] 
 
22232
                       UNSPEC_VCMPBFP))]
 
22233
-  "TARGET_ALTIVEC"
 
22234
+  "VECTOR_UNIT_ALTIVEC_P (V4SImode)"
 
22235
   "vcmpbfp %0,%1,%2"
 
22236
   [(set_attr "type" "veccmp")])
 
22237
 
 
22238
 (define_insn "*altivec_eq<mode>"
 
22239
-  [(set (match_operand:VI 0 "altivec_register_operand" "=v")
 
22240
-       (eq:VI (match_operand:VI 1 "altivec_register_operand" "v")
 
22241
-              (match_operand:VI 2 "altivec_register_operand" "v")))]
 
22242
-  "TARGET_ALTIVEC"
 
22243
+  [(set (match_operand:VI2 0 "altivec_register_operand" "=v")
 
22244
+       (eq:VI2 (match_operand:VI2 1 "altivec_register_operand" "v")
 
22245
+               (match_operand:VI2 2 "altivec_register_operand" "v")))]
 
22246
+  "<VI_unit>"
 
22247
   "vcmpequ<VI_char> %0,%1,%2"
 
22248
   [(set_attr "type" "veccmp")])
 
22249
 
 
22250
 (define_insn "*altivec_gt<mode>"
 
22251
-  [(set (match_operand:VI 0 "altivec_register_operand" "=v")
 
22252
-       (gt:VI (match_operand:VI 1 "altivec_register_operand" "v")
 
22253
-              (match_operand:VI 2 "altivec_register_operand" "v")))]
 
22254
-  "TARGET_ALTIVEC"
 
22255
+  [(set (match_operand:VI2 0 "altivec_register_operand" "=v")
 
22256
+       (gt:VI2 (match_operand:VI2 1 "altivec_register_operand" "v")
 
22257
+               (match_operand:VI2 2 "altivec_register_operand" "v")))]
 
22258
+  "<VI_unit>"
 
22259
   "vcmpgts<VI_char> %0,%1,%2"
 
22260
   [(set_attr "type" "veccmp")])
 
22261
 
 
22262
 (define_insn "*altivec_gtu<mode>"
 
22263
-  [(set (match_operand:VI 0 "altivec_register_operand" "=v")
 
22264
-       (gtu:VI (match_operand:VI 1 "altivec_register_operand" "v")
 
22265
-               (match_operand:VI 2 "altivec_register_operand" "v")))]
 
22266
-  "TARGET_ALTIVEC"
 
22267
+  [(set (match_operand:VI2 0 "altivec_register_operand" "=v")
 
22268
+       (gtu:VI2 (match_operand:VI2 1 "altivec_register_operand" "v")
 
22269
+                (match_operand:VI2 2 "altivec_register_operand" "v")))]
 
22270
+  "<VI_unit>"
 
22271
   "vcmpgtu<VI_char> %0,%1,%2"
 
22272
   [(set_attr "type" "veccmp")])
 
22273
 
 
22274
@@ -642,7 +649,7 @@
 
22275
    convert_move (small_swap, swap, 0);
 
22276
  
 
22277
    low_product = gen_reg_rtx (V4SImode);
 
22278
-   emit_insn (gen_vec_widen_umult_odd_v8hi (low_product, one, two));
 
22279
+   emit_insn (gen_altivec_vmulouh (low_product, one, two));
 
22280
  
 
22281
    high_product = gen_reg_rtx (V4SImode);
 
22282
    emit_insn (gen_altivec_vmsumuhm (high_product, one, small_swap, zero));
 
22283
@@ -669,11 +676,19 @@
 
22284
    emit_insn (gen_vec_widen_smult_even_v8hi (even, operands[1], operands[2]));
 
22285
    emit_insn (gen_vec_widen_smult_odd_v8hi (odd, operands[1], operands[2]));
 
22286
 
 
22287
-   emit_insn (gen_altivec_vmrghw (high, even, odd));
 
22288
-   emit_insn (gen_altivec_vmrglw (low, even, odd));
 
22289
+   if (BYTES_BIG_ENDIAN)
 
22290
+     {
 
22291
+       emit_insn (gen_altivec_vmrghw (high, even, odd));
 
22292
+       emit_insn (gen_altivec_vmrglw (low, even, odd));
 
22293
+       emit_insn (gen_altivec_vpkuwum (operands[0], high, low));
 
22294
+     }
 
22295
+   else
 
22296
+     {
 
22297
+       emit_insn (gen_altivec_vmrghw (high, odd, even));
 
22298
+       emit_insn (gen_altivec_vmrglw (low, odd, even));
 
22299
+       emit_insn (gen_altivec_vpkuwum (operands[0], low, high));
 
22300
+     } 
 
22301
 
 
22302
-   emit_insn (gen_altivec_vpkuwum (operands[0], high, low));
 
22303
-
 
22304
    DONE;
 
22305
 }")
 
22306
 
 
22307
@@ -744,18 +759,18 @@
 
22308
 ;; max
 
22309
 
 
22310
 (define_insn "umax<mode>3"
 
22311
-  [(set (match_operand:VI 0 "register_operand" "=v")
 
22312
-        (umax:VI (match_operand:VI 1 "register_operand" "v")
 
22313
-                 (match_operand:VI 2 "register_operand" "v")))]
 
22314
-  "TARGET_ALTIVEC"
 
22315
+  [(set (match_operand:VI2 0 "register_operand" "=v")
 
22316
+        (umax:VI2 (match_operand:VI2 1 "register_operand" "v")
 
22317
+                 (match_operand:VI2 2 "register_operand" "v")))]
 
22318
+  "<VI_unit>"
 
22319
   "vmaxu<VI_char> %0,%1,%2"
 
22320
   [(set_attr "type" "vecsimple")])
 
22321
 
 
22322
 (define_insn "smax<mode>3"
 
22323
-  [(set (match_operand:VI 0 "register_operand" "=v")
 
22324
-        (smax:VI (match_operand:VI 1 "register_operand" "v")
 
22325
-                 (match_operand:VI 2 "register_operand" "v")))]
 
22326
-  "TARGET_ALTIVEC"
 
22327
+  [(set (match_operand:VI2 0 "register_operand" "=v")
 
22328
+        (smax:VI2 (match_operand:VI2 1 "register_operand" "v")
 
22329
+                 (match_operand:VI2 2 "register_operand" "v")))]
 
22330
+  "<VI_unit>"
 
22331
   "vmaxs<VI_char> %0,%1,%2"
 
22332
   [(set_attr "type" "vecsimple")])
 
22333
 
 
22334
@@ -768,18 +783,18 @@
 
22335
   [(set_attr "type" "veccmp")])
 
22336
 
 
22337
 (define_insn "umin<mode>3"
 
22338
-  [(set (match_operand:VI 0 "register_operand" "=v")
 
22339
-        (umin:VI (match_operand:VI 1 "register_operand" "v")
 
22340
-                 (match_operand:VI 2 "register_operand" "v")))]
 
22341
-  "TARGET_ALTIVEC"
 
22342
+  [(set (match_operand:VI2 0 "register_operand" "=v")
 
22343
+        (umin:VI2 (match_operand:VI2 1 "register_operand" "v")
 
22344
+                 (match_operand:VI2 2 "register_operand" "v")))]
 
22345
+  "<VI_unit>"
 
22346
   "vminu<VI_char> %0,%1,%2"
 
22347
   [(set_attr "type" "vecsimple")])
 
22348
 
 
22349
 (define_insn "smin<mode>3"
 
22350
-  [(set (match_operand:VI 0 "register_operand" "=v")
 
22351
-        (smin:VI (match_operand:VI 1 "register_operand" "v")
 
22352
-                 (match_operand:VI 2 "register_operand" "v")))]
 
22353
-  "TARGET_ALTIVEC"
 
22354
+  [(set (match_operand:VI2 0 "register_operand" "=v")
 
22355
+        (smin:VI2 (match_operand:VI2 1 "register_operand" "v")
 
22356
+                 (match_operand:VI2 2 "register_operand" "v")))]
 
22357
+  "<VI_unit>"
 
22358
   "vmins<VI_char> %0,%1,%2"
 
22359
   [(set_attr "type" "vecsimple")])
 
22360
 
 
22361
@@ -935,7 +950,136 @@
 
22362
   "vmrglw %0,%1,%2"
 
22363
   [(set_attr "type" "vecperm")])
 
22364
 
 
22365
-(define_insn "vec_widen_umult_even_v16qi"
 
22366
+;; Power8 vector merge even/odd
 
22367
+(define_insn "p8_vmrgew"
 
22368
+  [(set (match_operand:V4SI 0 "register_operand" "=v")
 
22369
+       (vec_select:V4SI
 
22370
+         (vec_concat:V8SI
 
22371
+           (match_operand:V4SI 1 "register_operand" "v")
 
22372
+           (match_operand:V4SI 2 "register_operand" "v"))
 
22373
+         (parallel [(const_int 0) (const_int 4)
 
22374
+                    (const_int 2) (const_int 6)])))]
 
22375
+  "TARGET_P8_VECTOR"
 
22376
+  "vmrgew %0,%1,%2"
 
22377
+  [(set_attr "type" "vecperm")])
 
22378
+
 
22379
+(define_insn "p8_vmrgow"
 
22380
+  [(set (match_operand:V4SI 0 "register_operand" "=v")
 
22381
+       (vec_select:V4SI
 
22382
+         (vec_concat:V8SI
 
22383
+           (match_operand:V4SI 1 "register_operand" "v")
 
22384
+           (match_operand:V4SI 2 "register_operand" "v"))
 
22385
+         (parallel [(const_int 1) (const_int 5)
 
22386
+                    (const_int 3) (const_int 7)])))]
 
22387
+  "TARGET_P8_VECTOR"
 
22388
+  "vmrgow %0,%1,%2"
 
22389
+  [(set_attr "type" "vecperm")])
 
22390
+
 
22391
+(define_expand "vec_widen_umult_even_v16qi"
 
22392
+  [(use (match_operand:V8HI 0 "register_operand" ""))
 
22393
+   (use (match_operand:V16QI 1 "register_operand" ""))
 
22394
+   (use (match_operand:V16QI 2 "register_operand" ""))]
 
22395
+  "TARGET_ALTIVEC"
 
22396
+{
 
22397
+  if (BYTES_BIG_ENDIAN)
 
22398
+    emit_insn (gen_altivec_vmuleub (operands[0], operands[1], operands[2]));
 
22399
+  else
 
22400
+    emit_insn (gen_altivec_vmuloub (operands[0], operands[1], operands[2]));
 
22401
+  DONE;
 
22402
+})
 
22403
+
 
22404
+(define_expand "vec_widen_smult_even_v16qi"
 
22405
+  [(use (match_operand:V8HI 0 "register_operand" ""))
 
22406
+   (use (match_operand:V16QI 1 "register_operand" ""))
 
22407
+   (use (match_operand:V16QI 2 "register_operand" ""))]
 
22408
+  "TARGET_ALTIVEC"
 
22409
+{
 
22410
+  if (BYTES_BIG_ENDIAN)
 
22411
+    emit_insn (gen_altivec_vmulesb (operands[0], operands[1], operands[2]));
 
22412
+  else
 
22413
+    emit_insn (gen_altivec_vmulosb (operands[0], operands[1], operands[2]));
 
22414
+  DONE;
 
22415
+})
 
22416
+
 
22417
+(define_expand "vec_widen_umult_even_v8hi"
 
22418
+  [(use (match_operand:V4SI 0 "register_operand" ""))
 
22419
+   (use (match_operand:V8HI 1 "register_operand" ""))
 
22420
+   (use (match_operand:V8HI 2 "register_operand" ""))]
 
22421
+  "TARGET_ALTIVEC"
 
22422
+{
 
22423
+  if (BYTES_BIG_ENDIAN)
 
22424
+    emit_insn (gen_altivec_vmuleuh (operands[0], operands[1], operands[2]));
 
22425
+  else
 
22426
+    emit_insn (gen_altivec_vmulouh (operands[0], operands[1], operands[2]));
 
22427
+  DONE;
 
22428
+})
 
22429
+
 
22430
+(define_expand "vec_widen_smult_even_v8hi"
 
22431
+  [(use (match_operand:V4SI 0 "register_operand" ""))
 
22432
+   (use (match_operand:V8HI 1 "register_operand" ""))
 
22433
+   (use (match_operand:V8HI 2 "register_operand" ""))]
 
22434
+  "TARGET_ALTIVEC"
 
22435
+{
 
22436
+  if (BYTES_BIG_ENDIAN)
 
22437
+    emit_insn (gen_altivec_vmulesh (operands[0], operands[1], operands[2]));
 
22438
+  else
 
22439
+    emit_insn (gen_altivec_vmulosh (operands[0], operands[1], operands[2]));
 
22440
+  DONE;
 
22441
+})
 
22442
+
 
22443
+(define_expand "vec_widen_umult_odd_v16qi"
 
22444
+  [(use (match_operand:V8HI 0 "register_operand" ""))
 
22445
+   (use (match_operand:V16QI 1 "register_operand" ""))
 
22446
+   (use (match_operand:V16QI 2 "register_operand" ""))]
 
22447
+  "TARGET_ALTIVEC"
 
22448
+{
 
22449
+  if (BYTES_BIG_ENDIAN)
 
22450
+    emit_insn (gen_altivec_vmuloub (operands[0], operands[1], operands[2]));
 
22451
+  else
 
22452
+    emit_insn (gen_altivec_vmuleub (operands[0], operands[1], operands[2]));
 
22453
+  DONE;
 
22454
+})
 
22455
+
 
22456
+(define_expand "vec_widen_smult_odd_v16qi"
 
22457
+  [(use (match_operand:V8HI 0 "register_operand" ""))
 
22458
+   (use (match_operand:V16QI 1 "register_operand" ""))
 
22459
+   (use (match_operand:V16QI 2 "register_operand" ""))]
 
22460
+  "TARGET_ALTIVEC"
 
22461
+{
 
22462
+  if (BYTES_BIG_ENDIAN)
 
22463
+    emit_insn (gen_altivec_vmulosb (operands[0], operands[1], operands[2]));
 
22464
+  else
 
22465
+    emit_insn (gen_altivec_vmulesb (operands[0], operands[1], operands[2]));
 
22466
+  DONE;
 
22467
+})
 
22468
+
 
22469
+(define_expand "vec_widen_umult_odd_v8hi"
 
22470
+  [(use (match_operand:V4SI 0 "register_operand" ""))
 
22471
+   (use (match_operand:V8HI 1 "register_operand" ""))
 
22472
+   (use (match_operand:V8HI 2 "register_operand" ""))]
 
22473
+  "TARGET_ALTIVEC"
 
22474
+{
 
22475
+  if (BYTES_BIG_ENDIAN)
 
22476
+    emit_insn (gen_altivec_vmulouh (operands[0], operands[1], operands[2]));
 
22477
+  else
 
22478
+    emit_insn (gen_altivec_vmuleuh (operands[0], operands[1], operands[2]));
 
22479
+  DONE;
 
22480
+})
 
22481
+
 
22482
+(define_expand "vec_widen_smult_odd_v8hi"
 
22483
+  [(use (match_operand:V4SI 0 "register_operand" ""))
 
22484
+   (use (match_operand:V8HI 1 "register_operand" ""))
 
22485
+   (use (match_operand:V8HI 2 "register_operand" ""))]
 
22486
+  "TARGET_ALTIVEC"
 
22487
+{
 
22488
+  if (BYTES_BIG_ENDIAN)
 
22489
+    emit_insn (gen_altivec_vmulosh (operands[0], operands[1], operands[2]));
 
22490
+  else
 
22491
+    emit_insn (gen_altivec_vmulesh (operands[0], operands[1], operands[2]));
 
22492
+  DONE;
 
22493
+})
 
22494
+
 
22495
+(define_insn "altivec_vmuleub"
 
22496
   [(set (match_operand:V8HI 0 "register_operand" "=v")
 
22497
         (unspec:V8HI [(match_operand:V16QI 1 "register_operand" "v")
 
22498
                       (match_operand:V16QI 2 "register_operand" "v")]
 
22499
@@ -944,43 +1088,25 @@
 
22500
   "vmuleub %0,%1,%2"
 
22501
   [(set_attr "type" "veccomplex")])
 
22502
 
 
22503
-(define_insn "vec_widen_smult_even_v16qi"
 
22504
+(define_insn "altivec_vmuloub"
 
22505
   [(set (match_operand:V8HI 0 "register_operand" "=v")
 
22506
         (unspec:V8HI [(match_operand:V16QI 1 "register_operand" "v")
 
22507
                       (match_operand:V16QI 2 "register_operand" "v")]
 
22508
-                    UNSPEC_VMULESB))]
 
22509
+                    UNSPEC_VMULOUB))]
 
22510
   "TARGET_ALTIVEC"
 
22511
-  "vmulesb %0,%1,%2"
 
22512
+  "vmuloub %0,%1,%2"
 
22513
   [(set_attr "type" "veccomplex")])
 
22514
 
 
22515
-(define_insn "vec_widen_umult_even_v8hi"
 
22516
-  [(set (match_operand:V4SI 0 "register_operand" "=v")
 
22517
-        (unspec:V4SI [(match_operand:V8HI 1 "register_operand" "v")
 
22518
-                      (match_operand:V8HI 2 "register_operand" "v")]
 
22519
-                    UNSPEC_VMULEUH))]
 
22520
-  "TARGET_ALTIVEC"
 
22521
-  "vmuleuh %0,%1,%2"
 
22522
-  [(set_attr "type" "veccomplex")])
 
22523
-
 
22524
-(define_insn "vec_widen_smult_even_v8hi"
 
22525
-  [(set (match_operand:V4SI 0 "register_operand" "=v")
 
22526
-        (unspec:V4SI [(match_operand:V8HI 1 "register_operand" "v")
 
22527
-                      (match_operand:V8HI 2 "register_operand" "v")]
 
22528
-                    UNSPEC_VMULESH))]
 
22529
-  "TARGET_ALTIVEC"
 
22530
-  "vmulesh %0,%1,%2"
 
22531
-  [(set_attr "type" "veccomplex")])
 
22532
-
 
22533
-(define_insn "vec_widen_umult_odd_v16qi"
 
22534
+(define_insn "altivec_vmulesb"
 
22535
   [(set (match_operand:V8HI 0 "register_operand" "=v")
 
22536
         (unspec:V8HI [(match_operand:V16QI 1 "register_operand" "v")
 
22537
                       (match_operand:V16QI 2 "register_operand" "v")]
 
22538
-                    UNSPEC_VMULOUB))]
 
22539
+                    UNSPEC_VMULESB))]
 
22540
   "TARGET_ALTIVEC"
 
22541
-  "vmuloub %0,%1,%2"
 
22542
+  "vmulesb %0,%1,%2"
 
22543
   [(set_attr "type" "veccomplex")])
 
22544
 
 
22545
-(define_insn "vec_widen_smult_odd_v16qi"
 
22546
+(define_insn "altivec_vmulosb"
 
22547
   [(set (match_operand:V8HI 0 "register_operand" "=v")
 
22548
         (unspec:V8HI [(match_operand:V16QI 1 "register_operand" "v")
 
22549
                       (match_operand:V16QI 2 "register_operand" "v")]
 
22550
@@ -989,167 +1115,124 @@
 
22551
   "vmulosb %0,%1,%2"
 
22552
   [(set_attr "type" "veccomplex")])
 
22553
 
 
22554
-(define_insn "vec_widen_umult_odd_v8hi"
 
22555
+(define_insn "altivec_vmuleuh"
 
22556
   [(set (match_operand:V4SI 0 "register_operand" "=v")
 
22557
         (unspec:V4SI [(match_operand:V8HI 1 "register_operand" "v")
 
22558
                       (match_operand:V8HI 2 "register_operand" "v")]
 
22559
+                    UNSPEC_VMULEUH))]
 
22560
+  "TARGET_ALTIVEC"
 
22561
+  "vmuleuh %0,%1,%2"
 
22562
+  [(set_attr "type" "veccomplex")])
 
22563
+
 
22564
+(define_insn "altivec_vmulouh"
 
22565
+  [(set (match_operand:V4SI 0 "register_operand" "=v")
 
22566
+        (unspec:V4SI [(match_operand:V8HI 1 "register_operand" "v")
 
22567
+                      (match_operand:V8HI 2 "register_operand" "v")]
 
22568
                     UNSPEC_VMULOUH))]
 
22569
   "TARGET_ALTIVEC"
 
22570
   "vmulouh %0,%1,%2"
 
22571
   [(set_attr "type" "veccomplex")])
 
22572
 
 
22573
-(define_insn "vec_widen_smult_odd_v8hi"
 
22574
+(define_insn "altivec_vmulesh"
 
22575
   [(set (match_operand:V4SI 0 "register_operand" "=v")
 
22576
         (unspec:V4SI [(match_operand:V8HI 1 "register_operand" "v")
 
22577
                       (match_operand:V8HI 2 "register_operand" "v")]
 
22578
+                    UNSPEC_VMULESH))]
 
22579
+  "TARGET_ALTIVEC"
 
22580
+  "vmulesh %0,%1,%2"
 
22581
+  [(set_attr "type" "veccomplex")])
 
22582
+
 
22583
+(define_insn "altivec_vmulosh"
 
22584
+  [(set (match_operand:V4SI 0 "register_operand" "=v")
 
22585
+        (unspec:V4SI [(match_operand:V8HI 1 "register_operand" "v")
 
22586
+                      (match_operand:V8HI 2 "register_operand" "v")]
 
22587
                     UNSPEC_VMULOSH))]
 
22588
   "TARGET_ALTIVEC"
 
22589
   "vmulosh %0,%1,%2"
 
22590
   [(set_attr "type" "veccomplex")])
 
22591
 
 
22592
 
 
22593
-;; logical ops.  Have the logical ops follow the memory ops in
 
22594
-;; terms of whether to prefer VSX or Altivec
 
22595
-
 
22596
-(define_insn "*altivec_and<mode>3"
 
22597
-  [(set (match_operand:VM 0 "register_operand" "=v")
 
22598
-        (and:VM (match_operand:VM 1 "register_operand" "v")
 
22599
-               (match_operand:VM 2 "register_operand" "v")))]
 
22600
-  "VECTOR_MEM_ALTIVEC_P (<MODE>mode)"
 
22601
-  "vand %0,%1,%2"
 
22602
-  [(set_attr "type" "vecsimple")])
 
22603
-
 
22604
-(define_insn "*altivec_ior<mode>3"
 
22605
-  [(set (match_operand:VM 0 "register_operand" "=v")
 
22606
-        (ior:VM (match_operand:VM 1 "register_operand" "v")
 
22607
-               (match_operand:VM 2 "register_operand" "v")))]
 
22608
-  "VECTOR_MEM_ALTIVEC_P (<MODE>mode)"
 
22609
-  "vor %0,%1,%2"
 
22610
-  [(set_attr "type" "vecsimple")])
 
22611
-
 
22612
-(define_insn "*altivec_xor<mode>3"
 
22613
-  [(set (match_operand:VM 0 "register_operand" "=v")
 
22614
-        (xor:VM (match_operand:VM 1 "register_operand" "v")
 
22615
-               (match_operand:VM 2 "register_operand" "v")))]
 
22616
-  "VECTOR_MEM_ALTIVEC_P (<MODE>mode)"
 
22617
-  "vxor %0,%1,%2"
 
22618
-  [(set_attr "type" "vecsimple")])
 
22619
-
 
22620
-(define_insn "*altivec_one_cmpl<mode>2"
 
22621
-  [(set (match_operand:VM 0 "register_operand" "=v")
 
22622
-        (not:VM (match_operand:VM 1 "register_operand" "v")))]
 
22623
-  "VECTOR_MEM_ALTIVEC_P (<MODE>mode)"
 
22624
-  "vnor %0,%1,%1"
 
22625
-  [(set_attr "type" "vecsimple")])
 
22626
-  
 
22627
-(define_insn "*altivec_nor<mode>3"
 
22628
-  [(set (match_operand:VM 0 "register_operand" "=v")
 
22629
-        (not:VM (ior:VM (match_operand:VM 1 "register_operand" "v")
 
22630
-                       (match_operand:VM 2 "register_operand" "v"))))]
 
22631
-  "VECTOR_MEM_ALTIVEC_P (<MODE>mode)"
 
22632
-  "vnor %0,%1,%2"
 
22633
-  [(set_attr "type" "vecsimple")])
 
22634
-
 
22635
-(define_insn "*altivec_andc<mode>3"
 
22636
-  [(set (match_operand:VM 0 "register_operand" "=v")
 
22637
-        (and:VM (not:VM (match_operand:VM 2 "register_operand" "v"))
 
22638
-               (match_operand:VM 1 "register_operand" "v")))]
 
22639
-  "VECTOR_MEM_ALTIVEC_P (<MODE>mode)"
 
22640
-  "vandc %0,%1,%2"
 
22641
-  [(set_attr "type" "vecsimple")])
 
22642
-
 
22643
-(define_insn "altivec_vpkuhum"
 
22644
-  [(set (match_operand:V16QI 0 "register_operand" "=v")
 
22645
-        (unspec:V16QI [(match_operand:V8HI 1 "register_operand" "v")
 
22646
-                       (match_operand:V8HI 2 "register_operand" "v")]
 
22647
-                     UNSPEC_VPKUHUM))]
 
22648
-  "TARGET_ALTIVEC"
 
22649
-  "vpkuhum %0,%1,%2"
 
22650
-  [(set_attr "type" "vecperm")])
 
22651
-
 
22652
-(define_insn "altivec_vpkuwum"
 
22653
-  [(set (match_operand:V8HI 0 "register_operand" "=v")
 
22654
-        (unspec:V8HI [(match_operand:V4SI 1 "register_operand" "v")
 
22655
-                      (match_operand:V4SI 2 "register_operand" "v")]
 
22656
-                    UNSPEC_VPKUWUM))]
 
22657
-  "TARGET_ALTIVEC"
 
22658
-  "vpkuwum %0,%1,%2"
 
22659
-  [(set_attr "type" "vecperm")])
 
22660
-
 
22661
+;; Vector pack/unpack
 
22662
 (define_insn "altivec_vpkpx"
 
22663
   [(set (match_operand:V8HI 0 "register_operand" "=v")
 
22664
         (unspec:V8HI [(match_operand:V4SI 1 "register_operand" "v")
 
22665
                       (match_operand:V4SI 2 "register_operand" "v")]
 
22666
                     UNSPEC_VPKPX))]
 
22667
   "TARGET_ALTIVEC"
 
22668
-  "vpkpx %0,%1,%2"
 
22669
+  "*
 
22670
+  {
 
22671
+    if (BYTES_BIG_ENDIAN)
 
22672
+      return \"vpkpx %0,%1,%2\";
 
22673
+    else
 
22674
+      return \"vpkpx %0,%2,%1\";
 
22675
+  }"
 
22676
   [(set_attr "type" "vecperm")])
 
22677
 
 
22678
-(define_insn "altivec_vpkshss"
 
22679
-  [(set (match_operand:V16QI 0 "register_operand" "=v")
 
22680
-        (unspec:V16QI [(match_operand:V8HI 1 "register_operand" "v")
 
22681
-                       (match_operand:V8HI 2 "register_operand" "v")]
 
22682
-                     UNSPEC_VPKSHSS))
 
22683
-   (set (reg:SI 110) (unspec:SI [(const_int 0)] UNSPEC_SET_VSCR))]
 
22684
-  "TARGET_ALTIVEC"
 
22685
-  "vpkshss %0,%1,%2"
 
22686
+(define_insn "altivec_vpks<VI_char>ss"
 
22687
+  [(set (match_operand:<VP_small> 0 "register_operand" "=v")
 
22688
+       (unspec:<VP_small> [(match_operand:VP 1 "register_operand" "v")
 
22689
+                           (match_operand:VP 2 "register_operand" "v")]
 
22690
+                          UNSPEC_VPACK_SIGN_SIGN_SAT))]
 
22691
+  "<VI_unit>"
 
22692
+  "*
 
22693
+  {
 
22694
+    if (BYTES_BIG_ENDIAN)
 
22695
+      return \"vpks<VI_char>ss %0,%1,%2\";
 
22696
+    else
 
22697
+      return \"vpks<VI_char>ss %0,%2,%1\";
 
22698
+  }"
 
22699
   [(set_attr "type" "vecperm")])
 
22700
 
 
22701
-(define_insn "altivec_vpkswss"
 
22702
-  [(set (match_operand:V8HI 0 "register_operand" "=v")
 
22703
-        (unspec:V8HI [(match_operand:V4SI 1 "register_operand" "v")
 
22704
-                      (match_operand:V4SI 2 "register_operand" "v")]
 
22705
-                    UNSPEC_VPKSWSS))
 
22706
-   (set (reg:SI 110) (unspec:SI [(const_int 0)] UNSPEC_SET_VSCR))]
 
22707
-  "TARGET_ALTIVEC"
 
22708
-  "vpkswss %0,%1,%2"
 
22709
+(define_insn "altivec_vpks<VI_char>us"
 
22710
+  [(set (match_operand:<VP_small> 0 "register_operand" "=v")
 
22711
+       (unspec:<VP_small> [(match_operand:VP 1 "register_operand" "v")
 
22712
+                           (match_operand:VP 2 "register_operand" "v")]
 
22713
+                          UNSPEC_VPACK_SIGN_UNS_SAT))]
 
22714
+  "<VI_unit>"
 
22715
+  "*
 
22716
+  {
 
22717
+    if (BYTES_BIG_ENDIAN)
 
22718
+      return \"vpks<VI_char>us %0,%1,%2\";
 
22719
+    else
 
22720
+      return \"vpks<VI_char>us %0,%2,%1\";
 
22721
+  }"
 
22722
   [(set_attr "type" "vecperm")])
 
22723
 
 
22724
-(define_insn "altivec_vpkuhus"
 
22725
-  [(set (match_operand:V16QI 0 "register_operand" "=v")
 
22726
-        (unspec:V16QI [(match_operand:V8HI 1 "register_operand" "v")
 
22727
-                       (match_operand:V8HI 2 "register_operand" "v")]
 
22728
-                     UNSPEC_VPKUHUS))
 
22729
-   (set (reg:SI 110) (unspec:SI [(const_int 0)] UNSPEC_SET_VSCR))]
 
22730
-  "TARGET_ALTIVEC"
 
22731
-  "vpkuhus %0,%1,%2"
 
22732
+(define_insn "altivec_vpku<VI_char>us"
 
22733
+  [(set (match_operand:<VP_small> 0 "register_operand" "=v")
 
22734
+       (unspec:<VP_small> [(match_operand:VP 1 "register_operand" "v")
 
22735
+                           (match_operand:VP 2 "register_operand" "v")]
 
22736
+                          UNSPEC_VPACK_UNS_UNS_SAT))]
 
22737
+  "<VI_unit>"
 
22738
+  "*
 
22739
+  {
 
22740
+    if (BYTES_BIG_ENDIAN)
 
22741
+      return \"vpku<VI_char>us %0,%1,%2\";
 
22742
+    else
 
22743
+      return \"vpku<VI_char>us %0,%2,%1\";
 
22744
+  }"
 
22745
   [(set_attr "type" "vecperm")])
 
22746
 
 
22747
-(define_insn "altivec_vpkshus"
 
22748
-  [(set (match_operand:V16QI 0 "register_operand" "=v")
 
22749
-        (unspec:V16QI [(match_operand:V8HI 1 "register_operand" "v")
 
22750
-                       (match_operand:V8HI 2 "register_operand" "v")]
 
22751
-                     UNSPEC_VPKSHUS))
 
22752
-   (set (reg:SI 110) (unspec:SI [(const_int 0)] UNSPEC_SET_VSCR))]
 
22753
-  "TARGET_ALTIVEC"
 
22754
-  "vpkshus %0,%1,%2"
 
22755
+(define_insn "altivec_vpku<VI_char>um"
 
22756
+  [(set (match_operand:<VP_small> 0 "register_operand" "=v")
 
22757
+       (unspec:<VP_small> [(match_operand:VP 1 "register_operand" "v")
 
22758
+                           (match_operand:VP 2 "register_operand" "v")]
 
22759
+                          UNSPEC_VPACK_UNS_UNS_MOD))]
 
22760
+  "<VI_unit>"
 
22761
+  "*
 
22762
+  {
 
22763
+    if (BYTES_BIG_ENDIAN)
 
22764
+      return \"vpku<VI_char>um %0,%1,%2\";
 
22765
+    else
 
22766
+      return \"vpku<VI_char>um %0,%2,%1\";
 
22767
+  }"
 
22768
   [(set_attr "type" "vecperm")])
 
22769
 
 
22770
-(define_insn "altivec_vpkuwus"
 
22771
-  [(set (match_operand:V8HI 0 "register_operand" "=v")
 
22772
-        (unspec:V8HI [(match_operand:V4SI 1 "register_operand" "v")
 
22773
-                      (match_operand:V4SI 2 "register_operand" "v")]
 
22774
-                    UNSPEC_VPKUWUS))
 
22775
-   (set (reg:SI 110) (unspec:SI [(const_int 0)] UNSPEC_SET_VSCR))]
 
22776
-  "TARGET_ALTIVEC"
 
22777
-  "vpkuwus %0,%1,%2"
 
22778
-  [(set_attr "type" "vecperm")])
 
22779
-
 
22780
-(define_insn "altivec_vpkswus"
 
22781
-  [(set (match_operand:V8HI 0 "register_operand" "=v")
 
22782
-        (unspec:V8HI [(match_operand:V4SI 1 "register_operand" "v")
 
22783
-                      (match_operand:V4SI 2 "register_operand" "v")]
 
22784
-                    UNSPEC_VPKSWUS))
 
22785
-   (set (reg:SI 110) (unspec:SI [(const_int 0)] UNSPEC_SET_VSCR))]
 
22786
-  "TARGET_ALTIVEC"
 
22787
-  "vpkswus %0,%1,%2"
 
22788
-  [(set_attr "type" "vecperm")])
 
22789
-
 
22790
 (define_insn "*altivec_vrl<VI_char>"
 
22791
-  [(set (match_operand:VI 0 "register_operand" "=v")
 
22792
-        (rotate:VI (match_operand:VI 1 "register_operand" "v")
 
22793
-                  (match_operand:VI 2 "register_operand" "v")))]
 
22794
-  "TARGET_ALTIVEC"
 
22795
+  [(set (match_operand:VI2 0 "register_operand" "=v")
 
22796
+        (rotate:VI2 (match_operand:VI2 1 "register_operand" "v")
 
22797
+                   (match_operand:VI2 2 "register_operand" "v")))]
 
22798
+  "<VI_unit>"
 
22799
   "vrl<VI_char> %0,%1,%2"
 
22800
   [(set_attr "type" "vecsimple")])
 
22801
 
 
22802
@@ -1172,26 +1255,26 @@
 
22803
   [(set_attr "type" "vecperm")])
 
22804
 
 
22805
 (define_insn "*altivec_vsl<VI_char>"
 
22806
-  [(set (match_operand:VI 0 "register_operand" "=v")
 
22807
-        (ashift:VI (match_operand:VI 1 "register_operand" "v")
 
22808
-                  (match_operand:VI 2 "register_operand" "v")))]
 
22809
-  "TARGET_ALTIVEC"
 
22810
+  [(set (match_operand:VI2 0 "register_operand" "=v")
 
22811
+        (ashift:VI2 (match_operand:VI2 1 "register_operand" "v")
 
22812
+                   (match_operand:VI2 2 "register_operand" "v")))]
 
22813
+  "<VI_unit>"
 
22814
   "vsl<VI_char> %0,%1,%2"
 
22815
   [(set_attr "type" "vecsimple")])
 
22816
 
 
22817
 (define_insn "*altivec_vsr<VI_char>"
 
22818
-  [(set (match_operand:VI 0 "register_operand" "=v")
 
22819
-        (lshiftrt:VI (match_operand:VI 1 "register_operand" "v")
 
22820
-                    (match_operand:VI 2 "register_operand" "v")))]
 
22821
-  "TARGET_ALTIVEC"
 
22822
+  [(set (match_operand:VI2 0 "register_operand" "=v")
 
22823
+        (lshiftrt:VI2 (match_operand:VI2 1 "register_operand" "v")
 
22824
+                     (match_operand:VI2 2 "register_operand" "v")))]
 
22825
+  "<VI_unit>"
 
22826
   "vsr<VI_char> %0,%1,%2"
 
22827
   [(set_attr "type" "vecsimple")])
 
22828
 
 
22829
 (define_insn "*altivec_vsra<VI_char>"
 
22830
-  [(set (match_operand:VI 0 "register_operand" "=v")
 
22831
-        (ashiftrt:VI (match_operand:VI 1 "register_operand" "v")
 
22832
-                    (match_operand:VI 2 "register_operand" "v")))]
 
22833
-  "TARGET_ALTIVEC"
 
22834
+  [(set (match_operand:VI2 0 "register_operand" "=v")
 
22835
+        (ashiftrt:VI2 (match_operand:VI2 1 "register_operand" "v")
 
22836
+                     (match_operand:VI2 2 "register_operand" "v")))]
 
22837
+  "<VI_unit>"
 
22838
   "vsra<VI_char> %0,%1,%2"
 
22839
   [(set_attr "type" "vecsimple")])
 
22840
 
 
22841
@@ -1335,7 +1418,12 @@
 
22842
                       (match_operand:V16QI 3 "register_operand" "")]
 
22843
                      UNSPEC_VPERM))]
 
22844
   "TARGET_ALTIVEC"
 
22845
-  "")
 
22846
+{
 
22847
+  if (!BYTES_BIG_ENDIAN) {
 
22848
+    altivec_expand_vec_perm_le (operands);
 
22849
+    DONE;
 
22850
+  }
 
22851
+})
 
22852
 
 
22853
 (define_expand "vec_perm_constv16qi"
 
22854
   [(match_operand:V16QI 0 "register_operand" "")
 
22855
@@ -1476,14 +1564,22 @@
 
22856
   "vsldoi %0,%1,%2,%3"
 
22857
   [(set_attr "type" "vecperm")])
 
22858
 
 
22859
-(define_insn "altivec_vupkhsb"
 
22860
-  [(set (match_operand:V8HI 0 "register_operand" "=v")
 
22861
-       (unspec:V8HI [(match_operand:V16QI 1 "register_operand" "v")]
 
22862
-                    UNSPEC_VUPKHSB))]
 
22863
-  "TARGET_ALTIVEC"
 
22864
-  "vupkhsb %0,%1"
 
22865
+(define_insn "altivec_vupkhs<VU_char>"
 
22866
+  [(set (match_operand:VP 0 "register_operand" "=v")
 
22867
+       (unspec:VP [(match_operand:<VP_small> 1 "register_operand" "v")]
 
22868
+                    UNSPEC_VUNPACK_HI_SIGN))]
 
22869
+  "<VI_unit>"
 
22870
+  "vupkhs<VU_char> %0,%1"
 
22871
   [(set_attr "type" "vecperm")])
 
22872
 
 
22873
+(define_insn "altivec_vupkls<VU_char>"
 
22874
+  [(set (match_operand:VP 0 "register_operand" "=v")
 
22875
+       (unspec:VP [(match_operand:<VP_small> 1 "register_operand" "v")]
 
22876
+                    UNSPEC_VUNPACK_LO_SIGN))]
 
22877
+  "<VI_unit>"
 
22878
+  "vupkls<VU_char> %0,%1"
 
22879
+  [(set_attr "type" "vecperm")])
 
22880
+
 
22881
 (define_insn "altivec_vupkhpx"
 
22882
   [(set (match_operand:V4SI 0 "register_operand" "=v")
 
22883
        (unspec:V4SI [(match_operand:V8HI 1 "register_operand" "v")]
 
22884
@@ -1492,22 +1588,6 @@
 
22885
   "vupkhpx %0,%1"
 
22886
   [(set_attr "type" "vecperm")])
 
22887
 
 
22888
-(define_insn "altivec_vupkhsh"
 
22889
-  [(set (match_operand:V4SI 0 "register_operand" "=v")
 
22890
-       (unspec:V4SI [(match_operand:V8HI 1 "register_operand" "v")]
 
22891
-                    UNSPEC_VUPKHSH))]
 
22892
-  "TARGET_ALTIVEC"
 
22893
-  "vupkhsh %0,%1"
 
22894
-  [(set_attr "type" "vecperm")])
 
22895
-
 
22896
-(define_insn "altivec_vupklsb"
 
22897
-  [(set (match_operand:V8HI 0 "register_operand" "=v")
 
22898
-       (unspec:V8HI [(match_operand:V16QI 1 "register_operand" "v")]
 
22899
-                    UNSPEC_VUPKLSB))]
 
22900
-  "TARGET_ALTIVEC"
 
22901
-  "vupklsb %0,%1"
 
22902
-  [(set_attr "type" "vecperm")])
 
22903
-
 
22904
 (define_insn "altivec_vupklpx"
 
22905
   [(set (match_operand:V4SI 0 "register_operand" "=v")
 
22906
        (unspec:V4SI [(match_operand:V8HI 1 "register_operand" "v")]
 
22907
@@ -1516,49 +1596,41 @@
 
22908
   "vupklpx %0,%1"
 
22909
   [(set_attr "type" "vecperm")])
 
22910
 
 
22911
-(define_insn "altivec_vupklsh"
 
22912
-  [(set (match_operand:V4SI 0 "register_operand" "=v")
 
22913
-       (unspec:V4SI [(match_operand:V8HI 1 "register_operand" "v")]
 
22914
-                    UNSPEC_VUPKLSH))]
 
22915
-  "TARGET_ALTIVEC"
 
22916
-  "vupklsh %0,%1"
 
22917
-  [(set_attr "type" "vecperm")])
 
22918
-
 
22919
 ;; Compare vectors producing a vector result and a predicate, setting CR6 to
 
22920
 ;; indicate a combined status
 
22921
 (define_insn "*altivec_vcmpequ<VI_char>_p"
 
22922
   [(set (reg:CC 74)
 
22923
-       (unspec:CC [(eq:CC (match_operand:VI 1 "register_operand" "v")
 
22924
-                          (match_operand:VI 2 "register_operand" "v"))]
 
22925
+       (unspec:CC [(eq:CC (match_operand:VI2 1 "register_operand" "v")
 
22926
+                          (match_operand:VI2 2 "register_operand" "v"))]
 
22927
                   UNSPEC_PREDICATE))
 
22928
-   (set (match_operand:VI 0 "register_operand" "=v")
 
22929
-       (eq:VI (match_dup 1)
 
22930
-              (match_dup 2)))]
 
22931
-  "VECTOR_UNIT_ALTIVEC_P (<MODE>mode)"
 
22932
+   (set (match_operand:VI2 0 "register_operand" "=v")
 
22933
+       (eq:VI2 (match_dup 1)
 
22934
+               (match_dup 2)))]
 
22935
+  "<VI_unit>"
 
22936
   "vcmpequ<VI_char>. %0,%1,%2"
 
22937
   [(set_attr "type" "veccmp")])
 
22938
 
 
22939
 (define_insn "*altivec_vcmpgts<VI_char>_p"
 
22940
   [(set (reg:CC 74)
 
22941
-       (unspec:CC [(gt:CC (match_operand:VI 1 "register_operand" "v")
 
22942
-                          (match_operand:VI 2 "register_operand" "v"))]
 
22943
+       (unspec:CC [(gt:CC (match_operand:VI2 1 "register_operand" "v")
 
22944
+                          (match_operand:VI2 2 "register_operand" "v"))]
 
22945
                   UNSPEC_PREDICATE))
 
22946
-   (set (match_operand:VI 0 "register_operand" "=v")
 
22947
-       (gt:VI (match_dup 1)
 
22948
-              (match_dup 2)))]
 
22949
-  "VECTOR_UNIT_ALTIVEC_P (<MODE>mode)"
 
22950
+   (set (match_operand:VI2 0 "register_operand" "=v")
 
22951
+       (gt:VI2 (match_dup 1)
 
22952
+               (match_dup 2)))]
 
22953
+  "<VI_unit>"
 
22954
   "vcmpgts<VI_char>. %0,%1,%2"
 
22955
   [(set_attr "type" "veccmp")])
 
22956
 
 
22957
 (define_insn "*altivec_vcmpgtu<VI_char>_p"
 
22958
   [(set (reg:CC 74)
 
22959
-       (unspec:CC [(gtu:CC (match_operand:VI 1 "register_operand" "v")
 
22960
-                           (match_operand:VI 2 "register_operand" "v"))]
 
22961
+       (unspec:CC [(gtu:CC (match_operand:VI2 1 "register_operand" "v")
 
22962
+                           (match_operand:VI2 2 "register_operand" "v"))]
 
22963
                   UNSPEC_PREDICATE))
 
22964
-   (set (match_operand:VI 0 "register_operand" "=v")
 
22965
-       (gtu:VI (match_dup 1)
 
22966
-               (match_dup 2)))]
 
22967
-  "VECTOR_UNIT_ALTIVEC_P (<MODE>mode)"
 
22968
+   (set (match_operand:VI2 0 "register_operand" "=v")
 
22969
+       (gtu:VI2 (match_dup 1)
 
22970
+                (match_dup 2)))]
 
22971
+  "<VI_unit>"
 
22972
   "vcmpgtu<VI_char>. %0,%1,%2"
 
22973
   [(set_attr "type" "veccmp")])
 
22974
 
 
22975
@@ -1779,20 +1851,28 @@
 
22976
   [(set_attr "type" "vecstore")])
 
22977
 
 
22978
 ;; Generate
 
22979
-;;    vspltis? SCRATCH0,0
 
22980
+;;    xxlxor/vxor SCRATCH0,SCRATCH0,SCRATCH0
 
22981
 ;;    vsubu?m SCRATCH2,SCRATCH1,%1
 
22982
 ;;    vmaxs? %0,%1,SCRATCH2"
 
22983
 (define_expand "abs<mode>2"
 
22984
-  [(set (match_dup 2) (vec_duplicate:VI (const_int 0)))
 
22985
-   (set (match_dup 3)
 
22986
-        (minus:VI (match_dup 2)
 
22987
-                  (match_operand:VI 1 "register_operand" "v")))
 
22988
-   (set (match_operand:VI 0 "register_operand" "=v")
 
22989
-        (smax:VI (match_dup 1) (match_dup 3)))]
 
22990
-  "TARGET_ALTIVEC"
 
22991
+  [(set (match_dup 2) (match_dup 3))
 
22992
+   (set (match_dup 4)
 
22993
+        (minus:VI2 (match_dup 2)
 
22994
+                  (match_operand:VI2 1 "register_operand" "v")))
 
22995
+   (set (match_operand:VI2 0 "register_operand" "=v")
 
22996
+        (smax:VI2 (match_dup 1) (match_dup 4)))]
 
22997
+  "<VI_unit>"
 
22998
 {
 
22999
-  operands[2] = gen_reg_rtx (GET_MODE (operands[0]));
 
23000
-  operands[3] = gen_reg_rtx (GET_MODE (operands[0]));
 
23001
+  int i, n_elt = GET_MODE_NUNITS (<MODE>mode);
 
23002
+  rtvec v = rtvec_alloc (n_elt);
 
23003
+
 
23004
+  /* Create an all 0 constant.  */
 
23005
+  for (i = 0; i < n_elt; ++i)
 
23006
+    RTVEC_ELT (v, i) = const0_rtx;
 
23007
+
 
23008
+  operands[2] = gen_reg_rtx (<MODE>mode);
 
23009
+  operands[3] = gen_rtx_CONST_VECTOR (<MODE>mode, v);
 
23010
+  operands[4] = gen_reg_rtx (<MODE>mode);
 
23011
 })
 
23012
 
 
23013
 ;; Generate
 
23014
@@ -1950,50 +2030,20 @@
 
23015
   DONE;
 
23016
 }")
 
23017
 
 
23018
-(define_expand "vec_unpacks_hi_v16qi"
 
23019
-  [(set (match_operand:V8HI 0 "register_operand" "=v")
 
23020
-        (unspec:V8HI [(match_operand:V16QI 1 "register_operand" "v")]
 
23021
-                     UNSPEC_VUPKHSB))]
 
23022
-  "TARGET_ALTIVEC"
 
23023
-  "
 
23024
-{
 
23025
-  emit_insn (gen_altivec_vupkhsb (operands[0], operands[1]));
 
23026
-  DONE;
 
23027
-}")
 
23028
+(define_expand "vec_unpacks_hi_<VP_small_lc>"
 
23029
+  [(set (match_operand:VP 0 "register_operand" "=v")
 
23030
+        (unspec:VP [(match_operand:<VP_small> 1 "register_operand" "v")]
 
23031
+                  UNSPEC_VUNPACK_HI_SIGN))]
 
23032
+  "<VI_unit>"
 
23033
+  "")
 
23034
 
 
23035
-(define_expand "vec_unpacks_hi_v8hi"
 
23036
-  [(set (match_operand:V4SI 0 "register_operand" "=v")
 
23037
-        (unspec:V4SI [(match_operand:V8HI 1 "register_operand" "v")]
 
23038
-                     UNSPEC_VUPKHSH))]
 
23039
-  "TARGET_ALTIVEC"
 
23040
-  "
 
23041
-{
 
23042
-  emit_insn (gen_altivec_vupkhsh (operands[0], operands[1]));
 
23043
-  DONE;
 
23044
-}")
 
23045
+(define_expand "vec_unpacks_lo_<VP_small_lc>"
 
23046
+  [(set (match_operand:VP 0 "register_operand" "=v")
 
23047
+        (unspec:VP [(match_operand:<VP_small> 1 "register_operand" "v")]
 
23048
+                  UNSPEC_VUNPACK_LO_SIGN))]
 
23049
+  "<VI_unit>"
 
23050
+  "")
 
23051
 
 
23052
-(define_expand "vec_unpacks_lo_v16qi"
 
23053
-  [(set (match_operand:V8HI 0 "register_operand" "=v")
 
23054
-        (unspec:V8HI [(match_operand:V16QI 1 "register_operand" "v")]
 
23055
-                     UNSPEC_VUPKLSB))]
 
23056
-  "TARGET_ALTIVEC"
 
23057
-  "
 
23058
-{
 
23059
-  emit_insn (gen_altivec_vupklsb (operands[0], operands[1]));
 
23060
-  DONE;
 
23061
-}")
 
23062
-
 
23063
-(define_expand "vec_unpacks_lo_v8hi"
 
23064
-  [(set (match_operand:V4SI 0 "register_operand" "=v")
 
23065
-        (unspec:V4SI [(match_operand:V8HI 1 "register_operand" "v")]
 
23066
-                     UNSPEC_VUPKLSH))]
 
23067
-  "TARGET_ALTIVEC"
 
23068
-  "
 
23069
-{
 
23070
-  emit_insn (gen_altivec_vupklsh (operands[0], operands[1]));
 
23071
-  DONE;
 
23072
-}")
 
23073
-
 
23074
 (define_insn "vperm_v8hiv4si"
 
23075
   [(set (match_operand:V4SI 0 "register_operand" "=v")
 
23076
         (unspec:V4SI [(match_operand:V8HI 1 "register_operand" "v")
 
23077
@@ -2025,25 +2075,26 @@
 
23078
   rtx vzero = gen_reg_rtx (V8HImode);
 
23079
   rtx mask = gen_reg_rtx (V16QImode);
 
23080
   rtvec v = rtvec_alloc (16);
 
23081
+  bool be = BYTES_BIG_ENDIAN;
 
23082
    
 
23083
   emit_insn (gen_altivec_vspltish (vzero, const0_rtx));
 
23084
    
 
23085
-  RTVEC_ELT (v, 0) = gen_rtx_CONST_INT (QImode, 16);
 
23086
-  RTVEC_ELT (v, 1) = gen_rtx_CONST_INT (QImode, 0);
 
23087
-  RTVEC_ELT (v, 2) = gen_rtx_CONST_INT (QImode, 16);
 
23088
-  RTVEC_ELT (v, 3) = gen_rtx_CONST_INT (QImode, 1);
 
23089
-  RTVEC_ELT (v, 4) = gen_rtx_CONST_INT (QImode, 16);
 
23090
-  RTVEC_ELT (v, 5) = gen_rtx_CONST_INT (QImode, 2);
 
23091
-  RTVEC_ELT (v, 6) = gen_rtx_CONST_INT (QImode, 16);
 
23092
-  RTVEC_ELT (v, 7) = gen_rtx_CONST_INT (QImode, 3);
 
23093
-  RTVEC_ELT (v, 8) = gen_rtx_CONST_INT (QImode, 16);
 
23094
-  RTVEC_ELT (v, 9) = gen_rtx_CONST_INT (QImode, 4);
 
23095
-  RTVEC_ELT (v, 10) = gen_rtx_CONST_INT (QImode, 16);
 
23096
-  RTVEC_ELT (v, 11) = gen_rtx_CONST_INT (QImode, 5);
 
23097
-  RTVEC_ELT (v, 12) = gen_rtx_CONST_INT (QImode, 16);
 
23098
-  RTVEC_ELT (v, 13) = gen_rtx_CONST_INT (QImode, 6);
 
23099
-  RTVEC_ELT (v, 14) = gen_rtx_CONST_INT (QImode, 16);
 
23100
-  RTVEC_ELT (v, 15) = gen_rtx_CONST_INT (QImode, 7);
 
23101
+  RTVEC_ELT (v,  0) = gen_rtx_CONST_INT (QImode, be ? 16 :  7);
 
23102
+  RTVEC_ELT (v,  1) = gen_rtx_CONST_INT (QImode, be ?  0 : 16);
 
23103
+  RTVEC_ELT (v,  2) = gen_rtx_CONST_INT (QImode, be ? 16 :  6);
 
23104
+  RTVEC_ELT (v,  3) = gen_rtx_CONST_INT (QImode, be ?  1 : 16);
 
23105
+  RTVEC_ELT (v,  4) = gen_rtx_CONST_INT (QImode, be ? 16 :  5);
 
23106
+  RTVEC_ELT (v,  5) = gen_rtx_CONST_INT (QImode, be ?  2 : 16);
 
23107
+  RTVEC_ELT (v,  6) = gen_rtx_CONST_INT (QImode, be ? 16 :  4);
 
23108
+  RTVEC_ELT (v,  7) = gen_rtx_CONST_INT (QImode, be ?  3 : 16);
 
23109
+  RTVEC_ELT (v,  8) = gen_rtx_CONST_INT (QImode, be ? 16 :  3);
 
23110
+  RTVEC_ELT (v,  9) = gen_rtx_CONST_INT (QImode, be ?  4 : 16);
 
23111
+  RTVEC_ELT (v, 10) = gen_rtx_CONST_INT (QImode, be ? 16 :  2);
 
23112
+  RTVEC_ELT (v, 11) = gen_rtx_CONST_INT (QImode, be ?  5 : 16);
 
23113
+  RTVEC_ELT (v, 12) = gen_rtx_CONST_INT (QImode, be ? 16 :  1);
 
23114
+  RTVEC_ELT (v, 13) = gen_rtx_CONST_INT (QImode, be ?  6 : 16);
 
23115
+  RTVEC_ELT (v, 14) = gen_rtx_CONST_INT (QImode, be ? 16 :  0);
 
23116
+  RTVEC_ELT (v, 15) = gen_rtx_CONST_INT (QImode, be ?  7 : 16);
 
23117
 
 
23118
   emit_insn (gen_vec_initv16qi (mask, gen_rtx_PARALLEL (V16QImode, v)));
 
23119
   emit_insn (gen_vperm_v16qiv8hi (operands[0], operands[1], vzero, mask));
 
23120
@@ -2060,25 +2111,26 @@
 
23121
   rtx vzero = gen_reg_rtx (V4SImode);
 
23122
   rtx mask = gen_reg_rtx (V16QImode);
 
23123
   rtvec v = rtvec_alloc (16);
 
23124
+  bool be = BYTES_BIG_ENDIAN;
 
23125
 
 
23126
   emit_insn (gen_altivec_vspltisw (vzero, const0_rtx));
 
23127
  
 
23128
-  RTVEC_ELT (v, 0) = gen_rtx_CONST_INT (QImode, 16);
 
23129
-  RTVEC_ELT (v, 1) = gen_rtx_CONST_INT (QImode, 17);
 
23130
-  RTVEC_ELT (v, 2) = gen_rtx_CONST_INT (QImode, 0);
 
23131
-  RTVEC_ELT (v, 3) = gen_rtx_CONST_INT (QImode, 1);
 
23132
-  RTVEC_ELT (v, 4) = gen_rtx_CONST_INT (QImode, 16);
 
23133
-  RTVEC_ELT (v, 5) = gen_rtx_CONST_INT (QImode, 17);
 
23134
-  RTVEC_ELT (v, 6) = gen_rtx_CONST_INT (QImode, 2);
 
23135
-  RTVEC_ELT (v, 7) = gen_rtx_CONST_INT (QImode, 3);
 
23136
-  RTVEC_ELT (v, 8) = gen_rtx_CONST_INT (QImode, 16);
 
23137
-  RTVEC_ELT (v, 9) = gen_rtx_CONST_INT (QImode, 17);
 
23138
-  RTVEC_ELT (v, 10) = gen_rtx_CONST_INT (QImode, 4);
 
23139
-  RTVEC_ELT (v, 11) = gen_rtx_CONST_INT (QImode, 5);
 
23140
-  RTVEC_ELT (v, 12) = gen_rtx_CONST_INT (QImode, 16);
 
23141
-  RTVEC_ELT (v, 13) = gen_rtx_CONST_INT (QImode, 17);
 
23142
-  RTVEC_ELT (v, 14) = gen_rtx_CONST_INT (QImode, 6);
 
23143
-  RTVEC_ELT (v, 15) = gen_rtx_CONST_INT (QImode, 7);
 
23144
+  RTVEC_ELT (v,  0) = gen_rtx_CONST_INT (QImode, be ? 16 :  7);
 
23145
+  RTVEC_ELT (v,  1) = gen_rtx_CONST_INT (QImode, be ? 17 :  6);
 
23146
+  RTVEC_ELT (v,  2) = gen_rtx_CONST_INT (QImode, be ?  0 : 17);
 
23147
+  RTVEC_ELT (v,  3) = gen_rtx_CONST_INT (QImode, be ?  1 : 16);
 
23148
+  RTVEC_ELT (v,  4) = gen_rtx_CONST_INT (QImode, be ? 16 :  5);
 
23149
+  RTVEC_ELT (v,  5) = gen_rtx_CONST_INT (QImode, be ? 17 :  4);
 
23150
+  RTVEC_ELT (v,  6) = gen_rtx_CONST_INT (QImode, be ?  2 : 17);
 
23151
+  RTVEC_ELT (v,  7) = gen_rtx_CONST_INT (QImode, be ?  3 : 16);
 
23152
+  RTVEC_ELT (v,  8) = gen_rtx_CONST_INT (QImode, be ? 16 :  3);
 
23153
+  RTVEC_ELT (v,  9) = gen_rtx_CONST_INT (QImode, be ? 17 :  2);
 
23154
+  RTVEC_ELT (v, 10) = gen_rtx_CONST_INT (QImode, be ?  4 : 17);
 
23155
+  RTVEC_ELT (v, 11) = gen_rtx_CONST_INT (QImode, be ?  5 : 16);
 
23156
+  RTVEC_ELT (v, 12) = gen_rtx_CONST_INT (QImode, be ? 16 :  1);
 
23157
+  RTVEC_ELT (v, 13) = gen_rtx_CONST_INT (QImode, be ? 17 :  0);
 
23158
+  RTVEC_ELT (v, 14) = gen_rtx_CONST_INT (QImode, be ?  6 : 17);
 
23159
+  RTVEC_ELT (v, 15) = gen_rtx_CONST_INT (QImode, be ?  7 : 16);
 
23160
 
 
23161
   emit_insn (gen_vec_initv16qi (mask, gen_rtx_PARALLEL (V16QImode, v)));
 
23162
   emit_insn (gen_vperm_v8hiv4si (operands[0], operands[1], vzero, mask));
 
23163
@@ -2095,25 +2147,26 @@
 
23164
   rtx vzero = gen_reg_rtx (V8HImode);
 
23165
   rtx mask = gen_reg_rtx (V16QImode);
 
23166
   rtvec v = rtvec_alloc (16);
 
23167
+  bool be = BYTES_BIG_ENDIAN;
 
23168
 
 
23169
   emit_insn (gen_altivec_vspltish (vzero, const0_rtx));
 
23170
 
 
23171
-  RTVEC_ELT (v, 0) = gen_rtx_CONST_INT (QImode, 16);
 
23172
-  RTVEC_ELT (v, 1) = gen_rtx_CONST_INT (QImode, 8);
 
23173
-  RTVEC_ELT (v, 2) = gen_rtx_CONST_INT (QImode, 16);
 
23174
-  RTVEC_ELT (v, 3) = gen_rtx_CONST_INT (QImode, 9);
 
23175
-  RTVEC_ELT (v, 4) = gen_rtx_CONST_INT (QImode, 16);
 
23176
-  RTVEC_ELT (v, 5) = gen_rtx_CONST_INT (QImode, 10);
 
23177
-  RTVEC_ELT (v, 6) = gen_rtx_CONST_INT (QImode, 16);
 
23178
-  RTVEC_ELT (v, 7) = gen_rtx_CONST_INT (QImode, 11);
 
23179
-  RTVEC_ELT (v, 8) = gen_rtx_CONST_INT (QImode, 16);
 
23180
-  RTVEC_ELT (v, 9) = gen_rtx_CONST_INT (QImode, 12);
 
23181
-  RTVEC_ELT (v, 10) = gen_rtx_CONST_INT (QImode, 16);
 
23182
-  RTVEC_ELT (v, 11) = gen_rtx_CONST_INT (QImode, 13);
 
23183
-  RTVEC_ELT (v, 12) = gen_rtx_CONST_INT (QImode, 16);
 
23184
-  RTVEC_ELT (v, 13) = gen_rtx_CONST_INT (QImode, 14);
 
23185
-  RTVEC_ELT (v, 14) = gen_rtx_CONST_INT (QImode, 16);
 
23186
-  RTVEC_ELT (v, 15) = gen_rtx_CONST_INT (QImode, 15);
 
23187
+  RTVEC_ELT (v,  0) = gen_rtx_CONST_INT (QImode, be ? 16 : 15);
 
23188
+  RTVEC_ELT (v,  1) = gen_rtx_CONST_INT (QImode, be ?  8 : 16);
 
23189
+  RTVEC_ELT (v,  2) = gen_rtx_CONST_INT (QImode, be ? 16 : 14);
 
23190
+  RTVEC_ELT (v,  3) = gen_rtx_CONST_INT (QImode, be ?  9 : 16);
 
23191
+  RTVEC_ELT (v,  4) = gen_rtx_CONST_INT (QImode, be ? 16 : 13);
 
23192
+  RTVEC_ELT (v,  5) = gen_rtx_CONST_INT (QImode, be ? 10 : 16);
 
23193
+  RTVEC_ELT (v,  6) = gen_rtx_CONST_INT (QImode, be ? 16 : 12);
 
23194
+  RTVEC_ELT (v,  7) = gen_rtx_CONST_INT (QImode, be ? 11 : 16);
 
23195
+  RTVEC_ELT (v,  8) = gen_rtx_CONST_INT (QImode, be ? 16 : 11);
 
23196
+  RTVEC_ELT (v,  9) = gen_rtx_CONST_INT (QImode, be ? 12 : 16);
 
23197
+  RTVEC_ELT (v, 10) = gen_rtx_CONST_INT (QImode, be ? 16 : 10);
 
23198
+  RTVEC_ELT (v, 11) = gen_rtx_CONST_INT (QImode, be ? 13 : 16);
 
23199
+  RTVEC_ELT (v, 12) = gen_rtx_CONST_INT (QImode, be ? 16 :  9);
 
23200
+  RTVEC_ELT (v, 13) = gen_rtx_CONST_INT (QImode, be ? 14 : 16);
 
23201
+  RTVEC_ELT (v, 14) = gen_rtx_CONST_INT (QImode, be ? 16 :  8);
 
23202
+  RTVEC_ELT (v, 15) = gen_rtx_CONST_INT (QImode, be ? 15 : 16);
 
23203
 
 
23204
   emit_insn (gen_vec_initv16qi (mask, gen_rtx_PARALLEL (V16QImode, v)));
 
23205
   emit_insn (gen_vperm_v16qiv8hi (operands[0], operands[1], vzero, mask));
 
23206
@@ -2130,25 +2183,26 @@
 
23207
   rtx vzero = gen_reg_rtx (V4SImode);
 
23208
   rtx mask = gen_reg_rtx (V16QImode);
 
23209
   rtvec v = rtvec_alloc (16);
 
23210
+  bool be = BYTES_BIG_ENDIAN;
 
23211
 
 
23212
   emit_insn (gen_altivec_vspltisw (vzero, const0_rtx));
 
23213
  
 
23214
-  RTVEC_ELT (v, 0) = gen_rtx_CONST_INT (QImode, 16);
 
23215
-  RTVEC_ELT (v, 1) = gen_rtx_CONST_INT (QImode, 17);
 
23216
-  RTVEC_ELT (v, 2) = gen_rtx_CONST_INT (QImode, 8);
 
23217
-  RTVEC_ELT (v, 3) = gen_rtx_CONST_INT (QImode, 9);
 
23218
-  RTVEC_ELT (v, 4) = gen_rtx_CONST_INT (QImode, 16);
 
23219
-  RTVEC_ELT (v, 5) = gen_rtx_CONST_INT (QImode, 17);
 
23220
-  RTVEC_ELT (v, 6) = gen_rtx_CONST_INT (QImode, 10);
 
23221
-  RTVEC_ELT (v, 7) = gen_rtx_CONST_INT (QImode, 11);
 
23222
-  RTVEC_ELT (v, 8) = gen_rtx_CONST_INT (QImode, 16);
 
23223
-  RTVEC_ELT (v, 9) = gen_rtx_CONST_INT (QImode, 17);
 
23224
-  RTVEC_ELT (v, 10) = gen_rtx_CONST_INT (QImode, 12);
 
23225
-  RTVEC_ELT (v, 11) = gen_rtx_CONST_INT (QImode, 13);
 
23226
-  RTVEC_ELT (v, 12) = gen_rtx_CONST_INT (QImode, 16);
 
23227
-  RTVEC_ELT (v, 13) = gen_rtx_CONST_INT (QImode, 17);
 
23228
-  RTVEC_ELT (v, 14) = gen_rtx_CONST_INT (QImode, 14);
 
23229
-  RTVEC_ELT (v, 15) = gen_rtx_CONST_INT (QImode, 15);
 
23230
+  RTVEC_ELT (v,  0) = gen_rtx_CONST_INT (QImode, be ? 16 : 15);
 
23231
+  RTVEC_ELT (v,  1) = gen_rtx_CONST_INT (QImode, be ? 17 : 14);
 
23232
+  RTVEC_ELT (v,  2) = gen_rtx_CONST_INT (QImode, be ?  8 : 17);
 
23233
+  RTVEC_ELT (v,  3) = gen_rtx_CONST_INT (QImode, be ?  9 : 16);
 
23234
+  RTVEC_ELT (v,  4) = gen_rtx_CONST_INT (QImode, be ? 16 : 13);
 
23235
+  RTVEC_ELT (v,  5) = gen_rtx_CONST_INT (QImode, be ? 17 : 12);
 
23236
+  RTVEC_ELT (v,  6) = gen_rtx_CONST_INT (QImode, be ? 10 : 17);
 
23237
+  RTVEC_ELT (v,  7) = gen_rtx_CONST_INT (QImode, be ? 11 : 16);
 
23238
+  RTVEC_ELT (v,  8) = gen_rtx_CONST_INT (QImode, be ? 16 : 11);
 
23239
+  RTVEC_ELT (v,  9) = gen_rtx_CONST_INT (QImode, be ? 17 : 10);
 
23240
+  RTVEC_ELT (v, 10) = gen_rtx_CONST_INT (QImode, be ? 12 : 17);
 
23241
+  RTVEC_ELT (v, 11) = gen_rtx_CONST_INT (QImode, be ? 13 : 16);
 
23242
+  RTVEC_ELT (v, 12) = gen_rtx_CONST_INT (QImode, be ? 16 :  9);
 
23243
+  RTVEC_ELT (v, 13) = gen_rtx_CONST_INT (QImode, be ? 17 :  8);
 
23244
+  RTVEC_ELT (v, 14) = gen_rtx_CONST_INT (QImode, be ? 14 : 17);
 
23245
+  RTVEC_ELT (v, 15) = gen_rtx_CONST_INT (QImode, be ? 15 : 16);
 
23246
 
 
23247
   emit_insn (gen_vec_initv16qi (mask, gen_rtx_PARALLEL (V16QImode, v)));
 
23248
   emit_insn (gen_vperm_v8hiv4si (operands[0], operands[1], vzero, mask));
 
23249
@@ -2168,7 +2222,10 @@
 
23250
   
 
23251
   emit_insn (gen_vec_widen_umult_even_v16qi (ve, operands[1], operands[2]));
 
23252
   emit_insn (gen_vec_widen_umult_odd_v16qi (vo, operands[1], operands[2]));
 
23253
-  emit_insn (gen_altivec_vmrghh (operands[0], ve, vo));
 
23254
+  if (BYTES_BIG_ENDIAN)
 
23255
+    emit_insn (gen_altivec_vmrghh (operands[0], ve, vo));
 
23256
+  else
 
23257
+    emit_insn (gen_altivec_vmrghh (operands[0], vo, ve));
 
23258
   DONE;
 
23259
 }")
 
23260
 
 
23261
@@ -2185,7 +2242,10 @@
 
23262
   
 
23263
   emit_insn (gen_vec_widen_umult_even_v16qi (ve, operands[1], operands[2]));
 
23264
   emit_insn (gen_vec_widen_umult_odd_v16qi (vo, operands[1], operands[2]));
 
23265
-  emit_insn (gen_altivec_vmrglh (operands[0], ve, vo));
 
23266
+  if (BYTES_BIG_ENDIAN)
 
23267
+    emit_insn (gen_altivec_vmrglh (operands[0], ve, vo));
 
23268
+  else
 
23269
+    emit_insn (gen_altivec_vmrglh (operands[0], vo, ve));
 
23270
   DONE;
 
23271
 }")
 
23272
 
 
23273
@@ -2202,7 +2262,10 @@
 
23274
   
 
23275
   emit_insn (gen_vec_widen_smult_even_v16qi (ve, operands[1], operands[2]));
 
23276
   emit_insn (gen_vec_widen_smult_odd_v16qi (vo, operands[1], operands[2]));
 
23277
-  emit_insn (gen_altivec_vmrghh (operands[0], ve, vo));
 
23278
+  if (BYTES_BIG_ENDIAN)
 
23279
+    emit_insn (gen_altivec_vmrghh (operands[0], ve, vo));
 
23280
+  else
 
23281
+    emit_insn (gen_altivec_vmrghh (operands[0], vo, ve));
 
23282
   DONE;
 
23283
 }")
 
23284
 
 
23285
@@ -2219,7 +2282,10 @@
 
23286
   
 
23287
   emit_insn (gen_vec_widen_smult_even_v16qi (ve, operands[1], operands[2]));
 
23288
   emit_insn (gen_vec_widen_smult_odd_v16qi (vo, operands[1], operands[2]));
 
23289
-  emit_insn (gen_altivec_vmrglh (operands[0], ve, vo));
 
23290
+  if (BYTES_BIG_ENDIAN)
 
23291
+    emit_insn (gen_altivec_vmrglh (operands[0], ve, vo));
 
23292
+  else
 
23293
+    emit_insn (gen_altivec_vmrglh (operands[0], vo, ve));
 
23294
   DONE;
 
23295
 }")
 
23296
 
 
23297
@@ -2236,7 +2302,10 @@
 
23298
   
 
23299
   emit_insn (gen_vec_widen_umult_even_v8hi (ve, operands[1], operands[2]));
 
23300
   emit_insn (gen_vec_widen_umult_odd_v8hi (vo, operands[1], operands[2]));
 
23301
-  emit_insn (gen_altivec_vmrghw (operands[0], ve, vo));
 
23302
+  if (BYTES_BIG_ENDIAN)
 
23303
+    emit_insn (gen_altivec_vmrghw (operands[0], ve, vo));
 
23304
+  else
 
23305
+    emit_insn (gen_altivec_vmrghw (operands[0], vo, ve));
 
23306
   DONE;
 
23307
 }")
 
23308
 
 
23309
@@ -2253,7 +2322,10 @@
 
23310
   
 
23311
   emit_insn (gen_vec_widen_umult_even_v8hi (ve, operands[1], operands[2]));
 
23312
   emit_insn (gen_vec_widen_umult_odd_v8hi (vo, operands[1], operands[2]));
 
23313
-  emit_insn (gen_altivec_vmrglw (operands[0], ve, vo));
 
23314
+  if (BYTES_BIG_ENDIAN)
 
23315
+    emit_insn (gen_altivec_vmrglw (operands[0], ve, vo));
 
23316
+  else
 
23317
+    emit_insn (gen_altivec_vmrglw (operands[0], vo, ve));
 
23318
   DONE;
 
23319
 }")
 
23320
 
 
23321
@@ -2270,7 +2342,10 @@
 
23322
   
 
23323
   emit_insn (gen_vec_widen_smult_even_v8hi (ve, operands[1], operands[2]));
 
23324
   emit_insn (gen_vec_widen_smult_odd_v8hi (vo, operands[1], operands[2]));
 
23325
-  emit_insn (gen_altivec_vmrghw (operands[0], ve, vo));
 
23326
+  if (BYTES_BIG_ENDIAN)
 
23327
+    emit_insn (gen_altivec_vmrghw (operands[0], ve, vo));
 
23328
+  else
 
23329
+    emit_insn (gen_altivec_vmrghw (operands[0], vo, ve));
 
23330
   DONE;
 
23331
 }")
 
23332
 
 
23333
@@ -2287,33 +2362,20 @@
 
23334
   
 
23335
   emit_insn (gen_vec_widen_smult_even_v8hi (ve, operands[1], operands[2]));
 
23336
   emit_insn (gen_vec_widen_smult_odd_v8hi (vo, operands[1], operands[2]));
 
23337
-  emit_insn (gen_altivec_vmrglw (operands[0], ve, vo));
 
23338
+  if (BYTES_BIG_ENDIAN)
 
23339
+    emit_insn (gen_altivec_vmrglw (operands[0], ve, vo));
 
23340
+  else
 
23341
+    emit_insn (gen_altivec_vmrglw (operands[0], vo, ve));
 
23342
   DONE;
 
23343
 }")
 
23344
 
 
23345
-(define_expand "vec_pack_trunc_v8hi"
 
23346
-  [(set (match_operand:V16QI 0 "register_operand" "=v")
 
23347
-        (unspec:V16QI [(match_operand:V8HI 1 "register_operand" "v")
 
23348
-                       (match_operand:V8HI 2 "register_operand" "v")]
 
23349
-                      UNSPEC_VPKUHUM))]
 
23350
-  "TARGET_ALTIVEC"
 
23351
-  "
 
23352
-{
 
23353
-  emit_insn (gen_altivec_vpkuhum (operands[0], operands[1], operands[2]));
 
23354
-  DONE;
 
23355
-}")
 
23356
-                                                                                
 
23357
-(define_expand "vec_pack_trunc_v4si"
 
23358
-  [(set (match_operand:V8HI 0 "register_operand" "=v")
 
23359
-        (unspec:V8HI [(match_operand:V4SI 1 "register_operand" "v")
 
23360
-                      (match_operand:V4SI 2 "register_operand" "v")]
 
23361
-                     UNSPEC_VPKUWUM))]
 
23362
-  "TARGET_ALTIVEC"
 
23363
-  "
 
23364
-{
 
23365
-  emit_insn (gen_altivec_vpkuwum (operands[0], operands[1], operands[2]));
 
23366
-  DONE;
 
23367
-}")
 
23368
+(define_expand "vec_pack_trunc_<mode>"
 
23369
+  [(set (match_operand:<VP_small> 0 "register_operand" "=v")
 
23370
+        (unspec:<VP_small> [(match_operand:VP 1 "register_operand" "v")
 
23371
+                           (match_operand:VP 2 "register_operand" "v")]
 
23372
+                      UNSPEC_VPACK_UNS_UNS_MOD))]
 
23373
+  "<VI_unit>"
 
23374
+  "")
 
23375
 
 
23376
 (define_expand "altivec_negv4sf2"
 
23377
   [(use (match_operand:V4SF 0 "register_operand" ""))
 
23378
@@ -2460,3 +2522,34 @@
 
23379
   emit_insn (gen_altivec_vcfux (operands[0], tmp, const0_rtx));
 
23380
   DONE;
 
23381
 }")
 
23382
+
 
23383
+
 
23384
+;; Power8 vector instructions encoded as Altivec instructions
 
23385
+
 
23386
+;; Vector count leading zeros
 
23387
+(define_insn "*p8v_clz<mode>2"
 
23388
+  [(set (match_operand:VI2 0 "register_operand" "=v")
 
23389
+       (clz:VI2 (match_operand:VI2 1 "register_operand" "v")))]
 
23390
+  "TARGET_P8_VECTOR"
 
23391
+  "vclz<wd> %0,%1"
 
23392
+  [(set_attr "length" "4")
 
23393
+   (set_attr "type" "vecsimple")])
 
23394
+
 
23395
+;; Vector population count
 
23396
+(define_insn "*p8v_popcount<mode>2"
 
23397
+  [(set (match_operand:VI2 0 "register_operand" "=v")
 
23398
+        (popcount:VI2 (match_operand:VI2 1 "register_operand" "v")))]
 
23399
+  "TARGET_P8_VECTOR"
 
23400
+  "vpopcnt<wd> %0,%1"
 
23401
+  [(set_attr "length" "4")
 
23402
+   (set_attr "type" "vecsimple")])
 
23403
+
 
23404
+;; Vector Gather Bits by Bytes by Doubleword
 
23405
+(define_insn "p8v_vgbbd"
 
23406
+  [(set (match_operand:V16QI 0 "register_operand" "=v")
 
23407
+       (unspec:V16QI [(match_operand:V16QI 1 "register_operand" "v")]
 
23408
+                     UNSPEC_VGBBD))]
 
23409
+  "TARGET_P8_VECTOR"
 
23410
+  "vgbbd %0,%1"
 
23411
+  [(set_attr "length" "4")
 
23412
+   (set_attr "type" "vecsimple")])
 
23413
--- a/src/gcc/config/rs6000/sysv4le.h
 
23414
+++ b/src/gcc/config/rs6000/sysv4le.h
 
23415
@@ -34,3 +34,7 @@
 
23416
 
 
23417
 #undef MULTILIB_DEFAULTS
 
23418
 #define        MULTILIB_DEFAULTS { "mlittle", "mcall-sysv" }
 
23419
+
 
23420
+/* Little-endian PowerPC64 Linux uses the ELF v2 ABI by default.  */
 
23421
+#define LINUX64_DEFAULT_ABI_ELFv2
 
23422
+
 
23423
--- a/src/gcc/config/rs6000/dfp.md
 
23424
+++ b/src/gcc/config/rs6000/dfp.md
 
23425
@@ -29,77 +29,6 @@
 
23426
   ])
 
23427
 
 
23428
 
 
23429
-(define_expand "movsd"
 
23430
-  [(set (match_operand:SD 0 "nonimmediate_operand" "")
 
23431
-       (match_operand:SD 1 "any_operand" ""))]
 
23432
-  "TARGET_HARD_FLOAT && TARGET_FPRS"
 
23433
-  "{ rs6000_emit_move (operands[0], operands[1], SDmode); DONE; }")
 
23434
-
 
23435
-(define_split
 
23436
-  [(set (match_operand:SD 0 "gpc_reg_operand" "")
 
23437
-       (match_operand:SD 1 "const_double_operand" ""))]
 
23438
-  "reload_completed
 
23439
-   && ((GET_CODE (operands[0]) == REG && REGNO (operands[0]) <= 31)
 
23440
-       || (GET_CODE (operands[0]) == SUBREG
 
23441
-          && GET_CODE (SUBREG_REG (operands[0])) == REG
 
23442
-          && REGNO (SUBREG_REG (operands[0])) <= 31))"
 
23443
-  [(set (match_dup 2) (match_dup 3))]
 
23444
-  "
 
23445
-{
 
23446
-  long l;
 
23447
-  REAL_VALUE_TYPE rv;
 
23448
-
 
23449
-  REAL_VALUE_FROM_CONST_DOUBLE (rv, operands[1]);
 
23450
-  REAL_VALUE_TO_TARGET_DECIMAL32 (rv, l);
 
23451
-
 
23452
-  if (! TARGET_POWERPC64)
 
23453
-    operands[2] = operand_subword (operands[0], 0, 0, SDmode);
 
23454
-  else
 
23455
-    operands[2] = gen_lowpart (SImode, operands[0]);
 
23456
-
 
23457
-  operands[3] = gen_int_mode (l, SImode);
 
23458
-}")
 
23459
-
 
23460
-(define_insn "movsd_hardfloat"
 
23461
-  [(set (match_operand:SD 0 "nonimmediate_operand" "=r,r,m,f,*c*l,!r,*h,!r,!r")
 
23462
-       (match_operand:SD 1 "input_operand"        "r,m,r,f,r,h,0,G,Fn"))]
 
23463
-  "(gpc_reg_operand (operands[0], SDmode)
 
23464
-   || gpc_reg_operand (operands[1], SDmode))
 
23465
-   && (TARGET_HARD_FLOAT && TARGET_FPRS)"
 
23466
-  "@
 
23467
-   mr %0,%1
 
23468
-   lwz%U1%X1 %0,%1
 
23469
-   stw%U0%X0 %1,%0
 
23470
-   fmr %0,%1
 
23471
-   mt%0 %1
 
23472
-   mf%1 %0
 
23473
-   nop
 
23474
-   #
 
23475
-   #"
 
23476
-  [(set_attr "type" "*,load,store,fp,mtjmpr,mfjmpr,*,*,*")
 
23477
-   (set_attr "length" "4,4,4,4,4,4,4,4,8")])
 
23478
-
 
23479
-(define_insn "movsd_softfloat"
 
23480
-  [(set (match_operand:SD 0 "nonimmediate_operand" "=r,cl,r,r,m,r,r,r,r,r,*h")
 
23481
-       (match_operand:SD 1 "input_operand" "r,r,h,m,r,I,L,R,G,Fn,0"))]
 
23482
-  "(gpc_reg_operand (operands[0], SDmode)
 
23483
-   || gpc_reg_operand (operands[1], SDmode))
 
23484
-   && (TARGET_SOFT_FLOAT || !TARGET_FPRS)"
 
23485
-  "@
 
23486
-   mr %0,%1
 
23487
-   mt%0 %1
 
23488
-   mf%1 %0
 
23489
-   lwz%U1%X1 %0,%1
 
23490
-   stw%U0%X0 %1,%0
 
23491
-   li %0,%1
 
23492
-   lis %0,%v1
 
23493
-   la %0,%a1
 
23494
-   #
 
23495
-   #
 
23496
-   nop"
 
23497
-  [(set_attr "type" "*,mtjmpr,mfjmpr,load,store,*,*,*,*,*,*")
 
23498
-   (set_attr "length" "4,4,4,4,4,4,4,4,4,8,4")])
 
23499
-
 
23500
 (define_insn "movsd_store"
 
23501
   [(set (match_operand:DD 0 "nonimmediate_operand" "=m")
 
23502
        (unspec:DD [(match_operand:SD 1 "input_operand" "d")]
 
23503
@@ -108,7 +37,14 @@
 
23504
    || gpc_reg_operand (operands[1], SDmode))
 
23505
    && TARGET_HARD_FLOAT && TARGET_FPRS"
 
23506
   "stfd%U0%X0 %1,%0"
 
23507
-  [(set_attr "type" "fpstore")
 
23508
+  [(set (attr "type")
 
23509
+      (if_then_else
 
23510
+       (match_test "update_indexed_address_mem (operands[0], VOIDmode)")
 
23511
+       (const_string "fpstore_ux")
 
23512
+       (if_then_else
 
23513
+         (match_test "update_address_mem (operands[0], VOIDmode)")
 
23514
+         (const_string "fpstore_u")
 
23515
+         (const_string "fpstore"))))
 
23516
    (set_attr "length" "4")])
 
23517
 
 
23518
 (define_insn "movsd_load"
 
23519
@@ -119,7 +55,14 @@
 
23520
    || gpc_reg_operand (operands[1], DDmode))
 
23521
    && TARGET_HARD_FLOAT && TARGET_FPRS"
 
23522
   "lfd%U1%X1 %0,%1"
 
23523
-  [(set_attr "type" "fpload")
 
23524
+  [(set (attr "type")
 
23525
+      (if_then_else
 
23526
+       (match_test "update_indexed_address_mem (operands[1], VOIDmode)")
 
23527
+       (const_string "fpload_ux")
 
23528
+       (if_then_else
 
23529
+         (match_test "update_address_mem (operands[1], VOIDmode)")
 
23530
+         (const_string "fpload_u")
 
23531
+         (const_string "fpload"))))
 
23532
    (set_attr "length" "4")])
 
23533
 
 
23534
 ;; Hardware support for decimal floating point operations.
 
23535
@@ -182,211 +125,6 @@
 
23536
   "fnabs %0,%1"
 
23537
   [(set_attr "type" "fp")])
 
23538
 
 
23539
-(define_expand "movdd"
 
23540
-  [(set (match_operand:DD 0 "nonimmediate_operand" "")
 
23541
-       (match_operand:DD 1 "any_operand" ""))]
 
23542
-  ""
 
23543
-  "{ rs6000_emit_move (operands[0], operands[1], DDmode); DONE; }")
 
23544
-
 
23545
-(define_split
 
23546
-  [(set (match_operand:DD 0 "gpc_reg_operand" "")
 
23547
-       (match_operand:DD 1 "const_int_operand" ""))]
 
23548
-  "! TARGET_POWERPC64 && reload_completed
 
23549
-   && ((GET_CODE (operands[0]) == REG && REGNO (operands[0]) <= 31)
 
23550
-       || (GET_CODE (operands[0]) == SUBREG
 
23551
-          && GET_CODE (SUBREG_REG (operands[0])) == REG
 
23552
-          && REGNO (SUBREG_REG (operands[0])) <= 31))"
 
23553
-  [(set (match_dup 2) (match_dup 4))
 
23554
-   (set (match_dup 3) (match_dup 1))]
 
23555
-  "
 
23556
-{
 
23557
-  int endian = (WORDS_BIG_ENDIAN == 0);
 
23558
-  HOST_WIDE_INT value = INTVAL (operands[1]);
 
23559
-
 
23560
-  operands[2] = operand_subword (operands[0], endian, 0, DDmode);
 
23561
-  operands[3] = operand_subword (operands[0], 1 - endian, 0, DDmode);
 
23562
-#if HOST_BITS_PER_WIDE_INT == 32
 
23563
-  operands[4] = (value & 0x80000000) ? constm1_rtx : const0_rtx;
 
23564
-#else
 
23565
-  operands[4] = GEN_INT (value >> 32);
 
23566
-  operands[1] = GEN_INT (((value & 0xffffffff) ^ 0x80000000) - 0x80000000);
 
23567
-#endif
 
23568
-}")
 
23569
-
 
23570
-(define_split
 
23571
-  [(set (match_operand:DD 0 "gpc_reg_operand" "")
 
23572
-       (match_operand:DD 1 "const_double_operand" ""))]
 
23573
-  "! TARGET_POWERPC64 && reload_completed
 
23574
-   && ((GET_CODE (operands[0]) == REG && REGNO (operands[0]) <= 31)
 
23575
-       || (GET_CODE (operands[0]) == SUBREG
 
23576
-          && GET_CODE (SUBREG_REG (operands[0])) == REG
 
23577
-          && REGNO (SUBREG_REG (operands[0])) <= 31))"
 
23578
-  [(set (match_dup 2) (match_dup 4))
 
23579
-   (set (match_dup 3) (match_dup 5))]
 
23580
-  "
 
23581
-{
 
23582
-  int endian = (WORDS_BIG_ENDIAN == 0);
 
23583
-  long l[2];
 
23584
-  REAL_VALUE_TYPE rv;
 
23585
-
 
23586
-  REAL_VALUE_FROM_CONST_DOUBLE (rv, operands[1]);
 
23587
-  REAL_VALUE_TO_TARGET_DECIMAL64 (rv, l);
 
23588
-
 
23589
-  operands[2] = operand_subword (operands[0], endian, 0, DDmode);
 
23590
-  operands[3] = operand_subword (operands[0], 1 - endian, 0, DDmode);
 
23591
-  operands[4] = gen_int_mode (l[endian], SImode);
 
23592
-  operands[5] = gen_int_mode (l[1 - endian], SImode);
 
23593
-}")
 
23594
-
 
23595
-(define_split
 
23596
-  [(set (match_operand:DD 0 "gpc_reg_operand" "")
 
23597
-       (match_operand:DD 1 "const_double_operand" ""))]
 
23598
-  "TARGET_POWERPC64 && reload_completed
 
23599
-   && ((GET_CODE (operands[0]) == REG && REGNO (operands[0]) <= 31)
 
23600
-       || (GET_CODE (operands[0]) == SUBREG
 
23601
-          && GET_CODE (SUBREG_REG (operands[0])) == REG
 
23602
-          && REGNO (SUBREG_REG (operands[0])) <= 31))"
 
23603
-  [(set (match_dup 2) (match_dup 3))]
 
23604
-  "
 
23605
-{
 
23606
-  int endian = (WORDS_BIG_ENDIAN == 0);
 
23607
-  long l[2];
 
23608
-  REAL_VALUE_TYPE rv;
 
23609
-#if HOST_BITS_PER_WIDE_INT >= 64
 
23610
-  HOST_WIDE_INT val;
 
23611
-#endif
 
23612
-
 
23613
-  REAL_VALUE_FROM_CONST_DOUBLE (rv, operands[1]);
 
23614
-  REAL_VALUE_TO_TARGET_DECIMAL64 (rv, l);
 
23615
-
 
23616
-  operands[2] = gen_lowpart (DImode, operands[0]);
 
23617
-  /* HIGHPART is lower memory address when WORDS_BIG_ENDIAN.  */
 
23618
-#if HOST_BITS_PER_WIDE_INT >= 64
 
23619
-  val = ((HOST_WIDE_INT)(unsigned long)l[endian] << 32
 
23620
-        | ((HOST_WIDE_INT)(unsigned long)l[1 - endian]));
 
23621
-
 
23622
-  operands[3] = gen_int_mode (val, DImode);
 
23623
-#else
 
23624
-  operands[3] = immed_double_const (l[1 - endian], l[endian], DImode);
 
23625
-#endif
 
23626
-}")
 
23627
-
 
23628
-;; Don't have reload use general registers to load a constant.  First,
 
23629
-;; it might not work if the output operand is the equivalent of
 
23630
-;; a non-offsettable memref, but also it is less efficient than loading
 
23631
-;; the constant into an FP register, since it will probably be used there.
 
23632
-;; The "??" is a kludge until we can figure out a more reasonable way
 
23633
-;; of handling these non-offsettable values.
 
23634
-(define_insn "*movdd_hardfloat32"
 
23635
-  [(set (match_operand:DD 0 "nonimmediate_operand" "=!r,??r,m,d,d,m,!r,!r,!r")
 
23636
-       (match_operand:DD 1 "input_operand" "r,m,r,d,m,d,G,H,F"))]
 
23637
-  "! TARGET_POWERPC64 && TARGET_HARD_FLOAT && TARGET_FPRS
 
23638
-   && (gpc_reg_operand (operands[0], DDmode)
 
23639
-       || gpc_reg_operand (operands[1], DDmode))"
 
23640
-  "*
 
23641
-{
 
23642
-  switch (which_alternative)
 
23643
-    {
 
23644
-    default:
 
23645
-      gcc_unreachable ();
 
23646
-    case 0:
 
23647
-    case 1:
 
23648
-    case 2:
 
23649
-      return \"#\";
 
23650
-    case 3:
 
23651
-      return \"fmr %0,%1\";
 
23652
-    case 4:
 
23653
-      return \"lfd%U1%X1 %0,%1\";
 
23654
-    case 5:
 
23655
-      return \"stfd%U0%X0 %1,%0\";
 
23656
-    case 6:
 
23657
-    case 7:
 
23658
-    case 8:
 
23659
-      return \"#\";
 
23660
-    }
 
23661
-}"
 
23662
-  [(set_attr "type" "two,load,store,fp,fpload,fpstore,*,*,*")
 
23663
-   (set_attr "length" "8,16,16,4,4,4,8,12,16")])
 
23664
-
 
23665
-(define_insn "*movdd_softfloat32"
 
23666
-  [(set (match_operand:DD 0 "nonimmediate_operand" "=r,r,m,r,r,r")
 
23667
-       (match_operand:DD 1 "input_operand" "r,m,r,G,H,F"))]
 
23668
-  "! TARGET_POWERPC64 && (TARGET_SOFT_FLOAT || !TARGET_FPRS)
 
23669
-   && (gpc_reg_operand (operands[0], DDmode)
 
23670
-       || gpc_reg_operand (operands[1], DDmode))"
 
23671
-  "#"
 
23672
-  [(set_attr "type" "two,load,store,*,*,*")
 
23673
-   (set_attr "length" "8,8,8,8,12,16")])
 
23674
-
 
23675
-; ld/std require word-aligned displacements -> 'Y' constraint.
 
23676
-; List Y->r and r->Y before r->r for reload.
 
23677
-(define_insn "*movdd_hardfloat64_mfpgpr"
 
23678
-  [(set (match_operand:DD 0 "nonimmediate_operand" "=Y,r,!r,d,d,m,*c*l,!r,*h,!r,!r,!r,r,d")
 
23679
-       (match_operand:DD 1 "input_operand" "r,Y,r,d,m,d,r,h,0,G,H,F,d,r"))]
 
23680
-  "TARGET_POWERPC64 && TARGET_MFPGPR && TARGET_HARD_FLOAT && TARGET_FPRS
 
23681
-   && (gpc_reg_operand (operands[0], DDmode)
 
23682
-       || gpc_reg_operand (operands[1], DDmode))"
 
23683
-  "@
 
23684
-   std%U0%X0 %1,%0
 
23685
-   ld%U1%X1 %0,%1
 
23686
-   mr %0,%1
 
23687
-   fmr %0,%1
 
23688
-   lfd%U1%X1 %0,%1
 
23689
-   stfd%U0%X0 %1,%0
 
23690
-   mt%0 %1
 
23691
-   mf%1 %0
 
23692
-   nop
 
23693
-   #
 
23694
-   #
 
23695
-   #
 
23696
-   mftgpr %0,%1
 
23697
-   mffgpr %0,%1"
 
23698
-  [(set_attr "type" "store,load,*,fp,fpload,fpstore,mtjmpr,mfjmpr,*,*,*,*,mftgpr,mffgpr")
 
23699
-   (set_attr "length" "4,4,4,4,4,4,4,4,4,8,12,16,4,4")])
 
23700
-
 
23701
-; ld/std require word-aligned displacements -> 'Y' constraint.
 
23702
-; List Y->r and r->Y before r->r for reload.
 
23703
-(define_insn "*movdd_hardfloat64"
 
23704
-  [(set (match_operand:DD 0 "nonimmediate_operand" "=Y,r,!r,d,d,m,*c*l,!r,*h,!r,!r,!r")
 
23705
-       (match_operand:DD 1 "input_operand" "r,Y,r,d,m,d,r,h,0,G,H,F"))]
 
23706
-  "TARGET_POWERPC64 && !TARGET_MFPGPR && TARGET_HARD_FLOAT && TARGET_FPRS
 
23707
-   && (gpc_reg_operand (operands[0], DDmode)
 
23708
-       || gpc_reg_operand (operands[1], DDmode))"
 
23709
-  "@
 
23710
-   std%U0%X0 %1,%0
 
23711
-   ld%U1%X1 %0,%1
 
23712
-   mr %0,%1
 
23713
-   fmr %0,%1
 
23714
-   lfd%U1%X1 %0,%1
 
23715
-   stfd%U0%X0 %1,%0
 
23716
-   mt%0 %1
 
23717
-   mf%1 %0
 
23718
-   nop
 
23719
-   #
 
23720
-   #
 
23721
-   #"
 
23722
-  [(set_attr "type" "store,load,*,fp,fpload,fpstore,mtjmpr,mfjmpr,*,*,*,*")
 
23723
-   (set_attr "length" "4,4,4,4,4,4,4,4,4,8,12,16")])
 
23724
-
 
23725
-(define_insn "*movdd_softfloat64"
 
23726
-  [(set (match_operand:DD 0 "nonimmediate_operand" "=r,Y,r,cl,r,r,r,r,*h")
 
23727
-       (match_operand:DD 1 "input_operand" "Y,r,r,r,h,G,H,F,0"))]
 
23728
-  "TARGET_POWERPC64 && (TARGET_SOFT_FLOAT || !TARGET_FPRS)
 
23729
-   && (gpc_reg_operand (operands[0], DDmode)
 
23730
-       || gpc_reg_operand (operands[1], DDmode))"
 
23731
-  "@
 
23732
-   ld%U1%X1 %0,%1
 
23733
-   std%U0%X0 %1,%0
 
23734
-   mr %0,%1
 
23735
-   mt%0 %1
 
23736
-   mf%1 %0
 
23737
-   #
 
23738
-   #
 
23739
-   #
 
23740
-   nop"
 
23741
-  [(set_attr "type" "load,store,*,mtjmpr,mfjmpr,*,*,*,*")
 
23742
-   (set_attr "length" "4,4,4,4,4,8,12,16,4")])
 
23743
-
 
23744
 (define_expand "negtd2"
 
23745
   [(set (match_operand:TD 0 "gpc_reg_operand" "")
 
23746
        (neg:TD (match_operand:TD 1 "gpc_reg_operand" "")))]
 
23747
@@ -410,40 +148,25 @@
 
23748
   "")
 
23749
 
 
23750
 (define_insn "*abstd2_fpr"
 
23751
-  [(set (match_operand:TD 0 "gpc_reg_operand" "=d")
 
23752
-       (abs:TD (match_operand:TD 1 "gpc_reg_operand" "d")))]
 
23753
+  [(set (match_operand:TD 0 "gpc_reg_operand" "=d,d")
 
23754
+       (abs:TD (match_operand:TD 1 "gpc_reg_operand" "0,d")))]
 
23755
   "TARGET_HARD_FLOAT && TARGET_FPRS"
 
23756
-  "fabs %0,%1"
 
23757
-  [(set_attr "type" "fp")])
 
23758
+  "@
 
23759
+   fabs %0,%1
 
23760
+   fabs %0,%1\;fmr %L0,%L1"
 
23761
+  [(set_attr "type" "fp")
 
23762
+   (set_attr "length" "4,8")])
 
23763
 
 
23764
 (define_insn "*nabstd2_fpr"
 
23765
-  [(set (match_operand:TD 0 "gpc_reg_operand" "=d")
 
23766
-       (neg:TD (abs:TD (match_operand:TD 1 "gpc_reg_operand" "d"))))]
 
23767
+  [(set (match_operand:TD 0 "gpc_reg_operand" "=d,d")
 
23768
+       (neg:TD (abs:TD (match_operand:TD 1 "gpc_reg_operand" "0,d"))))]
 
23769
   "TARGET_HARD_FLOAT && TARGET_FPRS"
 
23770
-  "fnabs %0,%1"
 
23771
-  [(set_attr "type" "fp")])
 
23772
+  "@
 
23773
+   fnabs %0,%1
 
23774
+   fnabs %0,%1\;fmr %L0,%L1"
 
23775
+  [(set_attr "type" "fp")
 
23776
+   (set_attr "length" "4,8")])
 
23777
 
 
23778
-(define_expand "movtd"
 
23779
-  [(set (match_operand:TD 0 "general_operand" "")
 
23780
-       (match_operand:TD 1 "any_operand" ""))]
 
23781
-  "TARGET_HARD_FLOAT && TARGET_FPRS"
 
23782
-  "{ rs6000_emit_move (operands[0], operands[1], TDmode); DONE; }")
 
23783
-
 
23784
-; It's important to list the Y->r and r->Y moves before r->r because
 
23785
-; otherwise reload, given m->r, will try to pick r->r and reload it,
 
23786
-; which doesn't make progress.
 
23787
-(define_insn_and_split "*movtd_internal"
 
23788
-  [(set (match_operand:TD 0 "nonimmediate_operand" "=m,d,d,Y,r,r")
 
23789
-       (match_operand:TD 1 "input_operand"         "d,m,d,r,YGHF,r"))]
 
23790
-  "TARGET_HARD_FLOAT && TARGET_FPRS
 
23791
-   && (gpc_reg_operand (operands[0], TDmode)
 
23792
-       || gpc_reg_operand (operands[1], TDmode))"
 
23793
-  "#"
 
23794
-  "&& reload_completed"
 
23795
-  [(pc)]
 
23796
-{ rs6000_split_multireg_move (operands[0], operands[1]); DONE; }
 
23797
-  [(set_attr "length" "8,8,8,20,20,16")])
 
23798
-
 
23799
 ;; Hardware support for decimal floating point operations.
 
23800
 
 
23801
 (define_insn "extendddtd2"
 
23802
--- a/src/gcc/config/rs6000/sync.md
 
23803
+++ b/src/gcc/config/rs6000/sync.md
 
23804
@@ -18,14 +18,23 @@
 
23805
 ;; along with GCC; see the file COPYING3.  If not see
 
23806
 ;; <http://www.gnu.org/licenses/>.
 
23807
 
 
23808
-(define_mode_attr larx [(SI "lwarx") (DI "ldarx")])
 
23809
-(define_mode_attr stcx [(SI "stwcx.") (DI "stdcx.")])
 
23810
+(define_mode_attr larx [(QI "lbarx")
 
23811
+                       (HI "lharx")
 
23812
+                       (SI "lwarx")
 
23813
+                       (DI "ldarx")
 
23814
+                       (TI "lqarx")])
 
23815
 
 
23816
+(define_mode_attr stcx [(QI "stbcx.")
 
23817
+                       (HI "sthcx.")
 
23818
+                       (SI "stwcx.")
 
23819
+                       (DI "stdcx.")
 
23820
+                       (TI "stqcx.")])
 
23821
+
 
23822
 (define_code_iterator FETCHOP [plus minus ior xor and])
 
23823
 (define_code_attr fetchop_name
 
23824
   [(plus "add") (minus "sub") (ior "or") (xor "xor") (and "and")])
 
23825
 (define_code_attr fetchop_pred
 
23826
-  [(plus "add_operand") (minus "gpc_reg_operand")
 
23827
+  [(plus "add_operand") (minus "int_reg_operand")
 
23828
    (ior "logical_operand") (xor "logical_operand") (and "and_operand")])
 
23829
 
 
23830
 (define_expand "mem_thread_fence"
 
23831
@@ -129,16 +138,7 @@
 
23832
     case MEMMODEL_CONSUME:
 
23833
     case MEMMODEL_ACQUIRE:
 
23834
     case MEMMODEL_SEQ_CST:
 
23835
-      if (GET_MODE (operands[0]) == QImode)
 
23836
-       emit_insn (gen_loadsync_qi (operands[0]));
 
23837
-      else if (GET_MODE (operands[0]) == HImode)
 
23838
-       emit_insn (gen_loadsync_hi (operands[0]));
 
23839
-      else if (GET_MODE (operands[0]) == SImode)
 
23840
-       emit_insn (gen_loadsync_si (operands[0]));
 
23841
-      else if (GET_MODE (operands[0]) == DImode)
 
23842
-       emit_insn (gen_loadsync_di (operands[0]));
 
23843
-      else
 
23844
-       gcc_unreachable ();
 
23845
+      emit_insn (gen_loadsync_<mode> (operands[0]));
 
23846
       break;
 
23847
     default:
 
23848
       gcc_unreachable ();
 
23849
@@ -170,35 +170,109 @@
 
23850
   DONE;
 
23851
 })
 
23852
 
 
23853
-;; ??? Power ISA 2.06B says that there *is* a load-{byte,half}-and-reserve
 
23854
-;; opcode that is "phased-in".  Not implemented as of Power7, so not yet used,
 
23855
-;; but let's prepare the macros anyway.
 
23856
+;; Any supported integer mode that has atomic l<x>arx/st<x>cx. instrucitons
 
23857
+;; other than the quad memory operations, which have special restrictions.
 
23858
+;; Byte/halfword atomic instructions were added in ISA 2.06B, but were phased
 
23859
+;; in and did not show up until power8.  TImode atomic lqarx/stqcx. require
 
23860
+;; special handling due to even/odd register requirements.
 
23861
+(define_mode_iterator ATOMIC [(QI "TARGET_SYNC_HI_QI")
 
23862
+                             (HI "TARGET_SYNC_HI_QI")
 
23863
+                             SI
 
23864
+                             (DI "TARGET_POWERPC64")])
 
23865
 
 
23866
-(define_mode_iterator ATOMIC    [SI (DI "TARGET_POWERPC64")])
 
23867
+;; Types that we should provide atomic instructions for.
 
23868
 
 
23869
+(define_mode_iterator AINT [QI
 
23870
+                           HI
 
23871
+                           SI
 
23872
+                           (DI "TARGET_POWERPC64")
 
23873
+                           (TI "TARGET_SYNC_TI")])
 
23874
+
 
23875
 (define_insn "load_locked<mode>"
 
23876
-  [(set (match_operand:ATOMIC 0 "gpc_reg_operand" "=r")
 
23877
+  [(set (match_operand:ATOMIC 0 "int_reg_operand" "=r")
 
23878
        (unspec_volatile:ATOMIC
 
23879
          [(match_operand:ATOMIC 1 "memory_operand" "Z")] UNSPECV_LL))]
 
23880
   ""
 
23881
   "<larx> %0,%y1"
 
23882
   [(set_attr "type" "load_l")])
 
23883
 
 
23884
+(define_insn "load_locked<QHI:mode>_si"
 
23885
+  [(set (match_operand:SI 0 "int_reg_operand" "=r")
 
23886
+       (unspec_volatile:SI
 
23887
+         [(match_operand:QHI 1 "memory_operand" "Z")] UNSPECV_LL))]
 
23888
+  "TARGET_SYNC_HI_QI"
 
23889
+  "<QHI:larx> %0,%y1"
 
23890
+  [(set_attr "type" "load_l")])
 
23891
+
 
23892
+;; Use PTImode to get even/odd register pairs
 
23893
+(define_expand "load_lockedti"
 
23894
+  [(use (match_operand:TI 0 "quad_int_reg_operand" ""))
 
23895
+   (use (match_operand:TI 1 "memory_operand" ""))]
 
23896
+  "TARGET_SYNC_TI"
 
23897
+{
 
23898
+  /* Use a temporary register to force getting an even register for the
 
23899
+     lqarx/stqcrx. instructions.  Normal optimizations will eliminate this
 
23900
+     extra copy.  */
 
23901
+  rtx pti = gen_reg_rtx (PTImode);
 
23902
+  emit_insn (gen_load_lockedpti (pti, operands[1]));
 
23903
+  emit_move_insn (operands[0], gen_lowpart (TImode, pti));
 
23904
+  DONE;
 
23905
+})
 
23906
+
 
23907
+(define_insn "load_lockedpti"
 
23908
+  [(set (match_operand:PTI 0 "quad_int_reg_operand" "=&r")
 
23909
+       (unspec_volatile:PTI
 
23910
+         [(match_operand:TI 1 "memory_operand" "Z")] UNSPECV_LL))]
 
23911
+  "TARGET_SYNC_TI
 
23912
+   && !reg_mentioned_p (operands[0], operands[1])
 
23913
+   && quad_int_reg_operand (operands[0], PTImode)"
 
23914
+  "lqarx %0,%y1"
 
23915
+  [(set_attr "type" "load_l")])
 
23916
+
 
23917
 (define_insn "store_conditional<mode>"
 
23918
   [(set (match_operand:CC 0 "cc_reg_operand" "=x")
 
23919
        (unspec_volatile:CC [(const_int 0)] UNSPECV_SC))
 
23920
    (set (match_operand:ATOMIC 1 "memory_operand" "=Z")
 
23921
-       (match_operand:ATOMIC 2 "gpc_reg_operand" "r"))]
 
23922
+       (match_operand:ATOMIC 2 "int_reg_operand" "r"))]
 
23923
   ""
 
23924
   "<stcx> %2,%y1"
 
23925
   [(set_attr "type" "store_c")])
 
23926
 
 
23927
+(define_expand "store_conditionalti"
 
23928
+  [(use (match_operand:CC 0 "cc_reg_operand" ""))
 
23929
+   (use (match_operand:TI 1 "memory_operand" ""))
 
23930
+   (use (match_operand:TI 2 "quad_int_reg_operand" ""))]
 
23931
+  "TARGET_SYNC_TI"
 
23932
+{
 
23933
+  rtx op0 = operands[0];
 
23934
+  rtx op1 = operands[1];
 
23935
+  rtx op2 = operands[2];
 
23936
+  rtx pti_op1 = change_address (op1, PTImode, XEXP (op1, 0));
 
23937
+  rtx pti_op2 = gen_reg_rtx (PTImode);
 
23938
+
 
23939
+  /* Use a temporary register to force getting an even register for the
 
23940
+     lqarx/stqcrx. instructions.  Normal optimizations will eliminate this
 
23941
+     extra copy.  */
 
23942
+  emit_move_insn (pti_op2, gen_lowpart (PTImode, op2));
 
23943
+  emit_insn (gen_store_conditionalpti (op0, pti_op1, pti_op2));
 
23944
+  DONE;
 
23945
+})
 
23946
+
 
23947
+(define_insn "store_conditionalpti"
 
23948
+  [(set (match_operand:CC 0 "cc_reg_operand" "=x")
 
23949
+       (unspec_volatile:CC [(const_int 0)] UNSPECV_SC))
 
23950
+   (set (match_operand:PTI 1 "memory_operand" "=Z")
 
23951
+       (match_operand:PTI 2 "quad_int_reg_operand" "r"))]
 
23952
+  "TARGET_SYNC_TI && quad_int_reg_operand (operands[2], PTImode)"
 
23953
+  "stqcx. %2,%y1"
 
23954
+  [(set_attr "type" "store_c")])
 
23955
+
 
23956
 (define_expand "atomic_compare_and_swap<mode>"
 
23957
-  [(match_operand:SI 0 "gpc_reg_operand" "")           ;; bool out
 
23958
-   (match_operand:INT1 1 "gpc_reg_operand" "")         ;; val out
 
23959
-   (match_operand:INT1 2 "memory_operand" "")          ;; memory
 
23960
-   (match_operand:INT1 3 "reg_or_short_operand" "")    ;; expected
 
23961
-   (match_operand:INT1 4 "gpc_reg_operand" "")         ;; desired
 
23962
+  [(match_operand:SI 0 "int_reg_operand" "")           ;; bool out
 
23963
+   (match_operand:AINT 1 "int_reg_operand" "")         ;; val out
 
23964
+   (match_operand:AINT 2 "memory_operand" "")          ;; memory
 
23965
+   (match_operand:AINT 3 "reg_or_short_operand" "")    ;; expected
 
23966
+   (match_operand:AINT 4 "int_reg_operand" "")         ;; desired
 
23967
    (match_operand:SI 5 "const_int_operand" "")         ;; is_weak
 
23968
    (match_operand:SI 6 "const_int_operand" "")         ;; model succ
 
23969
    (match_operand:SI 7 "const_int_operand" "")]                ;; model fail
 
23970
@@ -209,9 +283,9 @@
 
23971
 })
 
23972
 
 
23973
 (define_expand "atomic_exchange<mode>"
 
23974
-  [(match_operand:INT1 0 "gpc_reg_operand" "")         ;; output
 
23975
-   (match_operand:INT1 1 "memory_operand" "")          ;; memory
 
23976
-   (match_operand:INT1 2 "gpc_reg_operand" "")         ;; input
 
23977
+  [(match_operand:AINT 0 "int_reg_operand" "")         ;; output
 
23978
+   (match_operand:AINT 1 "memory_operand" "")          ;; memory
 
23979
+   (match_operand:AINT 2 "int_reg_operand" "")         ;; input
 
23980
    (match_operand:SI 3 "const_int_operand" "")]                ;; model
 
23981
   ""
 
23982
 {
 
23983
@@ -220,9 +294,9 @@
 
23984
 })
 
23985
 
 
23986
 (define_expand "atomic_<fetchop_name><mode>"
 
23987
-  [(match_operand:INT1 0 "memory_operand" "")          ;; memory
 
23988
-   (FETCHOP:INT1 (match_dup 0)
 
23989
-     (match_operand:INT1 1 "<fetchop_pred>" ""))       ;; operand
 
23990
+  [(match_operand:AINT 0 "memory_operand" "")          ;; memory
 
23991
+   (FETCHOP:AINT (match_dup 0)
 
23992
+     (match_operand:AINT 1 "<fetchop_pred>" ""))       ;; operand
 
23993
    (match_operand:SI 2 "const_int_operand" "")]                ;; model
 
23994
   ""
 
23995
 {
 
23996
@@ -232,8 +306,8 @@
 
23997
 })
 
23998
 
 
23999
 (define_expand "atomic_nand<mode>"
 
24000
-  [(match_operand:INT1 0 "memory_operand" "")          ;; memory
 
24001
-   (match_operand:INT1 1 "gpc_reg_operand" "")         ;; operand
 
24002
+  [(match_operand:AINT 0 "memory_operand" "")          ;; memory
 
24003
+   (match_operand:AINT 1 "int_reg_operand" "")         ;; operand
 
24004
    (match_operand:SI 2 "const_int_operand" "")]                ;; model
 
24005
   ""
 
24006
 {
 
24007
@@ -243,10 +317,10 @@
 
24008
 })
 
24009
 
 
24010
 (define_expand "atomic_fetch_<fetchop_name><mode>"
 
24011
-  [(match_operand:INT1 0 "gpc_reg_operand" "")         ;; output
 
24012
-   (match_operand:INT1 1 "memory_operand" "")          ;; memory
 
24013
-   (FETCHOP:INT1 (match_dup 1)
 
24014
-     (match_operand:INT1 2 "<fetchop_pred>" ""))       ;; operand
 
24015
+  [(match_operand:AINT 0 "int_reg_operand" "")         ;; output
 
24016
+   (match_operand:AINT 1 "memory_operand" "")          ;; memory
 
24017
+   (FETCHOP:AINT (match_dup 1)
 
24018
+     (match_operand:AINT 2 "<fetchop_pred>" ""))       ;; operand
 
24019
    (match_operand:SI 3 "const_int_operand" "")]                ;; model
 
24020
   ""
 
24021
 { 
 
24022
@@ -256,9 +330,9 @@
 
24023
 })
 
24024
 
 
24025
 (define_expand "atomic_fetch_nand<mode>"
 
24026
-  [(match_operand:INT1 0 "gpc_reg_operand" "")         ;; output
 
24027
-   (match_operand:INT1 1 "memory_operand" "")          ;; memory
 
24028
-   (match_operand:INT1 2 "gpc_reg_operand" "")         ;; operand
 
24029
+  [(match_operand:AINT 0 "int_reg_operand" "")         ;; output
 
24030
+   (match_operand:AINT 1 "memory_operand" "")          ;; memory
 
24031
+   (match_operand:AINT 2 "int_reg_operand" "")         ;; operand
 
24032
    (match_operand:SI 3 "const_int_operand" "")]                ;; model
 
24033
   ""
 
24034
 {
 
24035
@@ -268,10 +342,10 @@
 
24036
 })
 
24037
 
 
24038
 (define_expand "atomic_<fetchop_name>_fetch<mode>"
 
24039
-  [(match_operand:INT1 0 "gpc_reg_operand" "")         ;; output
 
24040
-   (match_operand:INT1 1 "memory_operand" "")          ;; memory
 
24041
-   (FETCHOP:INT1 (match_dup 1)
 
24042
-     (match_operand:INT1 2 "<fetchop_pred>" ""))       ;; operand
 
24043
+  [(match_operand:AINT 0 "int_reg_operand" "")         ;; output
 
24044
+   (match_operand:AINT 1 "memory_operand" "")          ;; memory
 
24045
+   (FETCHOP:AINT (match_dup 1)
 
24046
+     (match_operand:AINT 2 "<fetchop_pred>" ""))       ;; operand
 
24047
    (match_operand:SI 3 "const_int_operand" "")]                ;; model
 
24048
   ""
 
24049
 {
 
24050
@@ -281,9 +355,9 @@
 
24051
 })
 
24052
 
 
24053
 (define_expand "atomic_nand_fetch<mode>"
 
24054
-  [(match_operand:INT1 0 "gpc_reg_operand" "")         ;; output
 
24055
-   (match_operand:INT1 1 "memory_operand" "")          ;; memory
 
24056
-   (match_operand:INT1 2 "gpc_reg_operand" "")         ;; operand
 
24057
+  [(match_operand:AINT 0 "int_reg_operand" "")         ;; output
 
24058
+   (match_operand:AINT 1 "memory_operand" "")          ;; memory
 
24059
+   (match_operand:AINT 2 "int_reg_operand" "")         ;; operand
 
24060
    (match_operand:SI 3 "const_int_operand" "")]                ;; model
 
24061
   ""
 
24062
 {
 
24063
--- a/src/gcc/config/rs6000/crypto.md
 
24064
+++ b/src/gcc/config/rs6000/crypto.md
 
24065
@@ -0,0 +1,101 @@
 
24066
+;; Cryptographic instructions added in ISA 2.07
 
24067
+;; Copyright (C) 2012-2013 Free Software Foundation, Inc.
 
24068
+;; Contributed by Michael Meissner (meissner@linux.vnet.ibm.com)
 
24069
+
 
24070
+;; This file is part of GCC.
 
24071
+
 
24072
+;; GCC is free software; you can redistribute it and/or modify it
 
24073
+;; under the terms of the GNU General Public License as published
 
24074
+;; by the Free Software Foundation; either version 3, or (at your
 
24075
+;; option) any later version.
 
24076
+
 
24077
+;; GCC is distributed in the hope that it will be useful, but WITHOUT
 
24078
+;; ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
 
24079
+;; or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public
 
24080
+;; License for more details.
 
24081
+
 
24082
+;; You should have received a copy of the GNU General Public License
 
24083
+;; along with GCC; see the file COPYING3.  If not see
 
24084
+;; <http://www.gnu.org/licenses/>.
 
24085
+
 
24086
+(define_c_enum "unspec"
 
24087
+  [UNSPEC_VCIPHER
 
24088
+   UNSPEC_VNCIPHER
 
24089
+   UNSPEC_VCIPHERLAST
 
24090
+   UNSPEC_VNCIPHERLAST
 
24091
+   UNSPEC_VSBOX
 
24092
+   UNSPEC_VSHASIGMA
 
24093
+   UNSPEC_VPERMXOR
 
24094
+   UNSPEC_VPMSUM])
 
24095
+
 
24096
+;; Iterator for VPMSUM/VPERMXOR
 
24097
+(define_mode_iterator CR_mode [V16QI V8HI V4SI V2DI])
 
24098
+
 
24099
+(define_mode_attr CR_char [(V16QI "b")
 
24100
+                          (V8HI  "h")
 
24101
+                          (V4SI  "w")
 
24102
+                          (V2DI  "d")])
 
24103
+
 
24104
+;; Iterator for VSHASIGMAD/VSHASIGMAW
 
24105
+(define_mode_iterator CR_hash [V4SI V2DI])
 
24106
+
 
24107
+;; Iterator for the other crypto functions
 
24108
+(define_int_iterator CR_code   [UNSPEC_VCIPHER
 
24109
+                               UNSPEC_VNCIPHER
 
24110
+                               UNSPEC_VCIPHERLAST
 
24111
+                               UNSPEC_VNCIPHERLAST])
 
24112
+
 
24113
+(define_int_attr CR_insn [(UNSPEC_VCIPHER      "vcipher")
 
24114
+                         (UNSPEC_VNCIPHER     "vncipher")
 
24115
+                         (UNSPEC_VCIPHERLAST  "vcipherlast")
 
24116
+                         (UNSPEC_VNCIPHERLAST "vncipherlast")])
 
24117
+
 
24118
+;; 2 operand crypto instructions
 
24119
+(define_insn "crypto_<CR_insn>"
 
24120
+  [(set (match_operand:V2DI 0 "register_operand" "=v")
 
24121
+       (unspec:V2DI [(match_operand:V2DI 1 "register_operand" "v")
 
24122
+                     (match_operand:V2DI 2 "register_operand" "v")]
 
24123
+                    CR_code))]
 
24124
+  "TARGET_CRYPTO"
 
24125
+  "<CR_insn> %0,%1,%2"
 
24126
+  [(set_attr "type" "crypto")])
 
24127
+
 
24128
+(define_insn "crypto_vpmsum<CR_char>"
 
24129
+  [(set (match_operand:CR_mode 0 "register_operand" "=v")
 
24130
+       (unspec:CR_mode [(match_operand:CR_mode 1 "register_operand" "v")
 
24131
+                        (match_operand:CR_mode 2 "register_operand" "v")]
 
24132
+                       UNSPEC_VPMSUM))]
 
24133
+  "TARGET_CRYPTO"
 
24134
+  "vpmsum<CR_char> %0,%1,%2"
 
24135
+  [(set_attr "type" "crypto")])
 
24136
+
 
24137
+;; 3 operand crypto instructions
 
24138
+(define_insn "crypto_vpermxor_<mode>"
 
24139
+  [(set (match_operand:CR_mode 0 "register_operand" "=v")
 
24140
+       (unspec:CR_mode [(match_operand:CR_mode 1 "register_operand" "v")
 
24141
+                        (match_operand:CR_mode 2 "register_operand" "v")
 
24142
+                        (match_operand:CR_mode 3 "register_operand" "v")]
 
24143
+                       UNSPEC_VPERMXOR))]
 
24144
+  "TARGET_CRYPTO"
 
24145
+  "vpermxor %0,%1,%2,%3"
 
24146
+  [(set_attr "type" "crypto")])
 
24147
+
 
24148
+;; 1 operand crypto instruction
 
24149
+(define_insn "crypto_vsbox"
 
24150
+  [(set (match_operand:V2DI 0 "register_operand" "=v")
 
24151
+       (unspec:V2DI [(match_operand:V2DI 1 "register_operand" "v")]
 
24152
+                    UNSPEC_VSBOX))]
 
24153
+  "TARGET_CRYPTO"
 
24154
+  "vsbox %0,%1"
 
24155
+  [(set_attr "type" "crypto")])
 
24156
+
 
24157
+;; Hash crypto instructions
 
24158
+(define_insn "crypto_vshasigma<CR_char>"
 
24159
+  [(set (match_operand:CR_hash 0 "register_operand" "=v")
 
24160
+       (unspec:CR_hash [(match_operand:CR_hash 1 "register_operand" "v")
 
24161
+                        (match_operand:SI 2 "const_0_to_1_operand" "n")
 
24162
+                        (match_operand:SI 3 "const_0_to_15_operand" "n")]
 
24163
+                       UNSPEC_VSHASIGMA))]
 
24164
+  "TARGET_CRYPTO"
 
24165
+  "vshasigma<CR_char> %0,%1,%2,%3"
 
24166
+  [(set_attr "type" "crypto")])
 
24167
--- a/src/gcc/config/rs6000/rs6000.md
 
24168
+++ b/src/gcc/config/rs6000/rs6000.md
 
24169
@@ -25,10 +25,14 @@
 
24170
 ;;
 
24171
 
 
24172
 (define_constants
 
24173
-  [(STACK_POINTER_REGNUM       1)
 
24174
+  [(FIRST_GPR_REGNO            0)
 
24175
+   (STACK_POINTER_REGNUM       1)
 
24176
    (TOC_REGNUM                 2)
 
24177
    (STATIC_CHAIN_REGNUM                11)
 
24178
    (HARD_FRAME_POINTER_REGNUM  31)
 
24179
+   (LAST_GPR_REGNO             31)
 
24180
+   (FIRST_FPR_REGNO            32)
 
24181
+   (LAST_FPR_REGNO             63)
 
24182
    (LR_REGNO                   65)
 
24183
    (CTR_REGNO                  66)
 
24184
    (ARG_POINTER_REGNUM         67)
 
24185
@@ -49,18 +53,9 @@
 
24186
    (SPE_ACC_REGNO              111)
 
24187
    (SPEFSCR_REGNO              112)
 
24188
    (FRAME_POINTER_REGNUM       113)
 
24189
-
 
24190
-   ; ABI defined stack offsets for storing the TOC pointer with AIX calls.
 
24191
-   (TOC_SAVE_OFFSET_32BIT      20)
 
24192
-   (TOC_SAVE_OFFSET_64BIT      40)
 
24193
-
 
24194
-   ; Function TOC offset in the AIX function descriptor.
 
24195
-   (AIX_FUNC_DESC_TOC_32BIT    4)
 
24196
-   (AIX_FUNC_DESC_TOC_64BIT    8)
 
24197
-
 
24198
-   ; Static chain offset in the AIX function descriptor.
 
24199
-   (AIX_FUNC_DESC_SC_32BIT     8)
 
24200
-   (AIX_FUNC_DESC_SC_64BIT     16)
 
24201
+   (TFHAR_REGNO                        114)
 
24202
+   (TFIAR_REGNO                        115)
 
24203
+   (TEXASR_REGNO               116)
 
24204
   ])
 
24205
 
 
24206
 ;;
 
24207
@@ -123,6 +118,12 @@
 
24208
    UNSPEC_LFIWZX
 
24209
    UNSPEC_FCTIWUZ
 
24210
    UNSPEC_GRP_END_NOP
 
24211
+   UNSPEC_P8V_FMRGOW
 
24212
+   UNSPEC_P8V_MTVSRWZ
 
24213
+   UNSPEC_P8V_RELOAD_FROM_GPR
 
24214
+   UNSPEC_P8V_MTVSRD
 
24215
+   UNSPEC_P8V_XXPERMDI
 
24216
+   UNSPEC_P8V_RELOAD_FROM_VSX
 
24217
   ])
 
24218
 
 
24219
 ;;
 
24220
@@ -142,7 +143,7 @@
 
24221
 
 
24222
 ;; Define an insn type attribute.  This is used in function unit delay
 
24223
 ;; computations.
 
24224
-(define_attr "type" "integer,two,three,load,load_ext,load_ext_u,load_ext_ux,load_ux,load_u,store,store_ux,store_u,fpload,fpload_ux,fpload_u,fpstore,fpstore_ux,fpstore_u,vecload,vecstore,imul,imul2,imul3,lmul,idiv,ldiv,insert_word,branch,cmp,fast_compare,compare,var_delayed_compare,delayed_compare,imul_compare,lmul_compare,fpcompare,cr_logical,delayed_cr,mfcr,mfcrf,mtcr,mfjmpr,mtjmpr,fp,fpsimple,dmul,sdiv,ddiv,ssqrt,dsqrt,jmpreg,brinc,vecsimple,veccomplex,vecdiv,veccmp,veccmpsimple,vecperm,vecfloat,vecfdiv,vecdouble,isync,sync,load_l,store_c,shift,trap,insert_dword,var_shift_rotate,cntlz,exts,mffgpr,mftgpr,isel,popcnt"
 
24225
+(define_attr "type" "integer,two,three,load,load_ext,load_ext_u,load_ext_ux,load_ux,load_u,store,store_ux,store_u,fpload,fpload_ux,fpload_u,fpstore,fpstore_ux,fpstore_u,vecload,vecstore,imul,imul2,imul3,lmul,idiv,ldiv,insert_word,branch,cmp,fast_compare,compare,var_delayed_compare,delayed_compare,imul_compare,lmul_compare,fpcompare,cr_logical,delayed_cr,mfcr,mfcrf,mtcr,mfjmpr,mtjmpr,fp,fpsimple,dmul,sdiv,ddiv,ssqrt,dsqrt,jmpreg,brinc,vecsimple,veccomplex,vecdiv,veccmp,veccmpsimple,vecperm,vecfloat,vecfdiv,vecdouble,isync,sync,load_l,store_c,shift,trap,insert_dword,var_shift_rotate,cntlz,exts,mffgpr,mftgpr,isel,popcnt,crypto,htm"
 
24226
   (const_string "integer"))
 
24227
 
 
24228
 ;; Define floating point instruction sub-types for use with Xfpu.md
 
24229
@@ -164,7 +165,7 @@
 
24230
 ;; Processor type -- this attribute must exactly match the processor_type
 
24231
 ;; enumeration in rs6000.h.
 
24232
 
 
24233
-(define_attr "cpu" "rs64a,mpccore,ppc403,ppc405,ppc440,ppc476,ppc601,ppc603,ppc604,ppc604e,ppc620,ppc630,ppc750,ppc7400,ppc7450,ppc8540,ppc8548,ppce300c2,ppce300c3,ppce500mc,ppce500mc64,ppce5500,ppce6500,power4,power5,power6,power7,cell,ppca2,titan"
 
24234
+(define_attr "cpu" "rs64a,mpccore,ppc403,ppc405,ppc440,ppc476,ppc601,ppc603,ppc604,ppc604e,ppc620,ppc630,ppc750,ppc7400,ppc7450,ppc8540,ppc8548,ppce300c2,ppce300c3,ppce500mc,ppce500mc64,ppce5500,ppce6500,power4,power5,power6,power7,cell,ppca2,titan,power8"
 
24235
   (const (symbol_ref "rs6000_cpu_attr")))
 
24236
 
 
24237
 
 
24238
@@ -197,6 +198,7 @@
 
24239
 (include "power5.md")
 
24240
 (include "power6.md")
 
24241
 (include "power7.md")
 
24242
+(include "power8.md")
 
24243
 (include "cell.md")
 
24244
 (include "xfpu.md")
 
24245
 (include "a2.md")
 
24246
@@ -215,7 +217,7 @@
 
24247
 (define_mode_iterator GPR [SI (DI "TARGET_POWERPC64")])
 
24248
 
 
24249
 ; Any supported integer mode.
 
24250
-(define_mode_iterator INT [QI HI SI DI TI])
 
24251
+(define_mode_iterator INT [QI HI SI DI TI PTI])
 
24252
 
 
24253
 ; Any supported integer mode that fits in one register.
 
24254
 (define_mode_iterator INT1 [QI HI SI (DI "TARGET_POWERPC64")])
 
24255
@@ -223,6 +225,12 @@
 
24256
 ; extend modes for DImode
 
24257
 (define_mode_iterator QHSI [QI HI SI])
 
24258
 
 
24259
+; QImode or HImode for small atomic ops
 
24260
+(define_mode_iterator QHI [QI HI])
 
24261
+
 
24262
+; HImode or SImode for sign extended fusion ops
 
24263
+(define_mode_iterator HSI [HI SI])
 
24264
+
 
24265
 ; SImode or DImode, even if DImode doesn't fit in GPRs.
 
24266
 (define_mode_iterator SDI [SI DI])
 
24267
 
 
24268
@@ -230,6 +238,10 @@
 
24269
 ; (one with a '.') will compare; and the size used for arithmetic carries.
 
24270
 (define_mode_iterator P [(SI "TARGET_32BIT") (DI "TARGET_64BIT")])
 
24271
 
 
24272
+; Iterator to add PTImode along with TImode (TImode can go in VSX registers,
 
24273
+; PTImode is GPR only)
 
24274
+(define_mode_iterator TI2 [TI PTI])
 
24275
+
 
24276
 ; Any hardware-supported floating-point mode
 
24277
 (define_mode_iterator FP [
 
24278
   (SF "TARGET_HARD_FLOAT 
 
24279
@@ -253,6 +265,49 @@
 
24280
   (V2DF "VECTOR_UNIT_ALTIVEC_OR_VSX_P (V2DFmode)")
 
24281
   ])
 
24282
 
 
24283
+; Floating point move iterators to combine binary and decimal moves
 
24284
+(define_mode_iterator FMOVE32 [SF SD])
 
24285
+(define_mode_iterator FMOVE64 [DF DD])
 
24286
+(define_mode_iterator FMOVE64X [DI DF DD])
 
24287
+(define_mode_iterator FMOVE128 [(TF "!TARGET_IEEEQUAD && TARGET_LONG_DOUBLE_128")
 
24288
+                               (TD "TARGET_HARD_FLOAT && TARGET_FPRS")])
 
24289
+
 
24290
+; Iterators for 128 bit types for direct move
 
24291
+(define_mode_iterator FMOVE128_GPR [(TI    "TARGET_VSX_TIMODE")
 
24292
+                                   (V16QI "")
 
24293
+                                   (V8HI  "")
 
24294
+                                   (V4SI  "")
 
24295
+                                   (V4SF  "")
 
24296
+                                   (V2DI  "")
 
24297
+                                   (V2DF  "")])
 
24298
+
 
24299
+; Whether a floating point move is ok, don't allow SD without hardware FP
 
24300
+(define_mode_attr fmove_ok [(SF "")
 
24301
+                           (DF "")
 
24302
+                           (SD "TARGET_HARD_FLOAT && TARGET_FPRS")
 
24303
+                           (DD "")])
 
24304
+
 
24305
+; Convert REAL_VALUE to the appropriate bits
 
24306
+(define_mode_attr real_value_to_target [(SF "REAL_VALUE_TO_TARGET_SINGLE")
 
24307
+                                       (DF "REAL_VALUE_TO_TARGET_DOUBLE")
 
24308
+                                       (SD "REAL_VALUE_TO_TARGET_DECIMAL32")
 
24309
+                                       (DD "REAL_VALUE_TO_TARGET_DECIMAL64")])
 
24310
+
 
24311
+; Definitions for load to 32-bit fpr register
 
24312
+(define_mode_attr f32_lr [(SF "f")              (SD "wz")])
 
24313
+(define_mode_attr f32_lm [(SF "m")              (SD "Z")])
 
24314
+(define_mode_attr f32_li [(SF "lfs%U1%X1 %0,%1") (SD "lfiwzx %0,%y1")])
 
24315
+(define_mode_attr f32_lv [(SF "lxsspx %x0,%y1")         (SD "lxsiwzx %x0,%y1")])
 
24316
+
 
24317
+; Definitions for store from 32-bit fpr register
 
24318
+(define_mode_attr f32_sr [(SF "f")               (SD "wx")])
 
24319
+(define_mode_attr f32_sm [(SF "m")               (SD "Z")])
 
24320
+(define_mode_attr f32_si [(SF "stfs%U0%X0 %1,%0") (SD "stfiwx %1,%y0")])
 
24321
+(define_mode_attr f32_sv [(SF "stxsspx %x1,%y0")  (SD "stxsiwzx %x1,%y0")])
 
24322
+
 
24323
+; Definitions for 32-bit fpr direct move
 
24324
+(define_mode_attr f32_dm [(SF "wn") (SD "wm")])
 
24325
+
 
24326
 ; These modes do not fit in integer registers in 32-bit mode.
 
24327
 ; but on e500v2, the gpr are 64 bit registers
 
24328
 (define_mode_iterator DIFD [DI (DF "!TARGET_E500_DOUBLE") DD])
 
24329
@@ -263,6 +318,25 @@
 
24330
 ; Iterator for just SF/DF
 
24331
 (define_mode_iterator SFDF [SF DF])
 
24332
 
 
24333
+; SF/DF suffix for traditional floating instructions
 
24334
+(define_mode_attr Ftrad                [(SF "s") (DF "")])
 
24335
+
 
24336
+; SF/DF suffix for VSX instructions
 
24337
+(define_mode_attr Fvsx         [(SF "sp") (DF  "dp")])
 
24338
+
 
24339
+; SF/DF constraint for arithmetic on traditional floating point registers
 
24340
+(define_mode_attr Ff           [(SF "f") (DF "d")])
 
24341
+
 
24342
+; SF/DF constraint for arithmetic on VSX registers
 
24343
+(define_mode_attr Fv           [(SF "wy") (DF "ws")])
 
24344
+
 
24345
+; s/d suffix for things like fp_addsub_s/fp_addsub_d
 
24346
+(define_mode_attr Fs           [(SF "s")  (DF "d")])
 
24347
+
 
24348
+; FRE/FRES support
 
24349
+(define_mode_attr Ffre         [(SF "fres") (DF "fre")])
 
24350
+(define_mode_attr FFRE         [(SF "FRES") (DF "FRE")])
 
24351
+
 
24352
 ; Conditional returns.
 
24353
 (define_code_iterator any_return [return simple_return])
 
24354
 (define_code_attr return_pred [(return "direct_return ()")
 
24355
@@ -271,7 +345,14 @@
 
24356
 
 
24357
 ; Various instructions that come in SI and DI forms.
 
24358
 ; A generic w/d attribute, for things like cmpw/cmpd.
 
24359
-(define_mode_attr wd [(QI "b") (HI "h") (SI "w") (DI "d")])
 
24360
+(define_mode_attr wd [(QI    "b")
 
24361
+                     (HI    "h")
 
24362
+                     (SI    "w")
 
24363
+                     (DI    "d")
 
24364
+                     (V16QI "b")
 
24365
+                     (V8HI  "h")
 
24366
+                     (V4SI  "w")
 
24367
+                     (V2DI  "d")])
 
24368
 
 
24369
 ; DImode bits
 
24370
 (define_mode_attr dbits [(QI "56") (HI "48") (SI "32")])
 
24371
@@ -311,6 +392,77 @@
 
24372
 
 
24373
 (define_mode_attr TARGET_FLOAT [(SF "TARGET_SINGLE_FLOAT")
 
24374
                                (DF "TARGET_DOUBLE_FLOAT")])
 
24375
+
 
24376
+;; Mode iterator for logical operations on 128-bit types
 
24377
+(define_mode_iterator BOOL_128         [TI
 
24378
+                                        PTI
 
24379
+                                        (V16QI "TARGET_ALTIVEC")
 
24380
+                                        (V8HI  "TARGET_ALTIVEC")
 
24381
+                                        (V4SI  "TARGET_ALTIVEC")
 
24382
+                                        (V4SF  "TARGET_ALTIVEC")
 
24383
+                                        (V2DI  "TARGET_ALTIVEC")
 
24384
+                                        (V2DF  "TARGET_ALTIVEC")])
 
24385
+
 
24386
+;; For the GPRs we use 3 constraints for register outputs, two that are the
 
24387
+;; same as the output register, and a third where the output register is an
 
24388
+;; early clobber, so we don't have to deal with register overlaps.  For the
 
24389
+;; vector types, we prefer to use the vector registers.  For TI mode, allow
 
24390
+;; either.
 
24391
+
 
24392
+;; Mode attribute for boolean operation register constraints for output
 
24393
+(define_mode_attr BOOL_REGS_OUTPUT     [(TI    "&r,r,r,wa,v")
 
24394
+                                        (PTI   "&r,r,r")
 
24395
+                                        (V16QI "wa,v,&?r,?r,?r")
 
24396
+                                        (V8HI  "wa,v,&?r,?r,?r")
 
24397
+                                        (V4SI  "wa,v,&?r,?r,?r")
 
24398
+                                        (V4SF  "wa,v,&?r,?r,?r")
 
24399
+                                        (V2DI  "wa,v,&?r,?r,?r")
 
24400
+                                        (V2DF  "wa,v,&?r,?r,?r")])
 
24401
+
 
24402
+;; Mode attribute for boolean operation register constraints for operand1
 
24403
+(define_mode_attr BOOL_REGS_OP1                [(TI    "r,0,r,wa,v")
 
24404
+                                        (PTI   "r,0,r")
 
24405
+                                        (V16QI "wa,v,r,0,r")
 
24406
+                                        (V8HI  "wa,v,r,0,r")
 
24407
+                                        (V4SI  "wa,v,r,0,r")
 
24408
+                                        (V4SF  "wa,v,r,0,r")
 
24409
+                                        (V2DI  "wa,v,r,0,r")
 
24410
+                                        (V2DF  "wa,v,r,0,r")])
 
24411
+
 
24412
+;; Mode attribute for boolean operation register constraints for operand2
 
24413
+(define_mode_attr BOOL_REGS_OP2                [(TI    "r,r,0,wa,v")
 
24414
+                                        (PTI   "r,r,0")
 
24415
+                                        (V16QI "wa,v,r,r,0")
 
24416
+                                        (V8HI  "wa,v,r,r,0")
 
24417
+                                        (V4SI  "wa,v,r,r,0")
 
24418
+                                        (V4SF  "wa,v,r,r,0")
 
24419
+                                        (V2DI  "wa,v,r,r,0")
 
24420
+                                        (V2DF  "wa,v,r,r,0")])
 
24421
+
 
24422
+;; Mode attribute for boolean operation register constraints for operand1
 
24423
+;; for one_cmpl.  To simplify things, we repeat the constraint where 0
 
24424
+;; is used for operand1 or operand2
 
24425
+(define_mode_attr BOOL_REGS_UNARY      [(TI    "r,0,0,wa,v")
 
24426
+                                        (PTI   "r,0,0")
 
24427
+                                        (V16QI "wa,v,r,0,0")
 
24428
+                                        (V8HI  "wa,v,r,0,0")
 
24429
+                                        (V4SI  "wa,v,r,0,0")
 
24430
+                                        (V4SF  "wa,v,r,0,0")
 
24431
+                                        (V2DI  "wa,v,r,0,0")
 
24432
+                                        (V2DF  "wa,v,r,0,0")])
 
24433
+
 
24434
+;; Mode attribute for the clobber of CC0 for AND expansion.
 
24435
+;; For the 128-bit types, we never do AND immediate, but we need to
 
24436
+;; get the correct number of X's for the number of operands.
 
24437
+(define_mode_attr BOOL_REGS_AND_CR0    [(TI    "X,X,X,X,X")
 
24438
+                                        (PTI   "X,X,X")
 
24439
+                                        (V16QI "X,X,X,X,X")
 
24440
+                                        (V8HI  "X,X,X,X,X")
 
24441
+                                        (V4SI  "X,X,X,X,X")
 
24442
+                                        (V4SF  "X,X,X,X,X")
 
24443
+                                        (V2DI  "X,X,X,X,X")
 
24444
+                                        (V2DF  "X,X,X,X,X")])
 
24445
+
 
24446
 
 
24447
 ;; Start with fixed-point load and store insns.  Here we put only the more
 
24448
 ;; complex forms.  Basic data transfer is done later.
 
24449
@@ -324,11 +476,19 @@
 
24450
 (define_insn "*zero_extend<mode>di2_internal1"
 
24451
   [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
 
24452
        (zero_extend:DI (match_operand:QHSI 1 "reg_or_mem_operand" "m,r")))]
 
24453
-  "TARGET_POWERPC64"
 
24454
+  "TARGET_POWERPC64 && (<MODE>mode != SImode || !TARGET_LFIWZX)"
 
24455
   "@
 
24456
    l<wd>z%U1%X1 %0,%1
 
24457
    rldicl %0,%1,0,<dbits>"
 
24458
-  [(set_attr "type" "load,*")])
 
24459
+  [(set_attr_alternative "type"
 
24460
+      [(if_then_else
 
24461
+        (match_test "update_indexed_address_mem (operands[1], VOIDmode)")
 
24462
+        (const_string "load_ux")
 
24463
+        (if_then_else
 
24464
+          (match_test "update_address_mem (operands[1], VOIDmode)")
 
24465
+          (const_string "load_u")
 
24466
+          (const_string "load")))
 
24467
+       (const_string "*")])])
 
24468
 
 
24469
 (define_insn "*zero_extend<mode>di2_internal2"
 
24470
   [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
 
24471
@@ -382,6 +542,29 @@
 
24472
                    (const_int 0)))]
 
24473
   "")
 
24474
 
 
24475
+(define_insn "*zero_extendsidi2_lfiwzx"
 
24476
+  [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r,??wm,!wz,!wu")
 
24477
+       (zero_extend:DI (match_operand:SI 1 "reg_or_mem_operand" "m,r,r,Z,Z")))]
 
24478
+  "TARGET_POWERPC64 && TARGET_LFIWZX"
 
24479
+  "@
 
24480
+   lwz%U1%X1 %0,%1
 
24481
+   rldicl %0,%1,0,32
 
24482
+   mtvsrwz %x0,%1
 
24483
+   lfiwzx %0,%y1
 
24484
+   lxsiwzx %x0,%y1"
 
24485
+  [(set_attr_alternative "type"
 
24486
+      [(if_then_else
 
24487
+        (match_test "update_indexed_address_mem (operands[1], VOIDmode)")
 
24488
+        (const_string "load_ux")
 
24489
+        (if_then_else
 
24490
+          (match_test "update_address_mem (operands[1], VOIDmode)")
 
24491
+          (const_string "load_u")
 
24492
+          (const_string "load")))
 
24493
+       (const_string "*")
 
24494
+       (const_string "mffgpr")
 
24495
+       (const_string "fpload")
 
24496
+       (const_string "fpload")])])
 
24497
+
 
24498
 (define_insn "extendqidi2"
 
24499
   [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
 
24500
        (sign_extend:DI (match_operand:QI 1 "gpc_reg_operand" "r")))]
 
24501
@@ -454,7 +637,15 @@
 
24502
   "@
 
24503
    lha%U1%X1 %0,%1
 
24504
    extsh %0,%1"
 
24505
-  [(set_attr "type" "load_ext,exts")])
 
24506
+  [(set_attr_alternative "type"
 
24507
+      [(if_then_else
 
24508
+        (match_test "update_indexed_address_mem (operands[1], VOIDmode)")
 
24509
+        (const_string "load_ext_ux")
 
24510
+        (if_then_else
 
24511
+          (match_test "update_address_mem (operands[1], VOIDmode)")
 
24512
+          (const_string "load_ext_u")
 
24513
+          (const_string "load_ext")))
 
24514
+       (const_string "exts")])])
 
24515
 
 
24516
 (define_insn ""
 
24517
   [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
 
24518
@@ -521,16 +712,47 @@
 
24519
   "TARGET_POWERPC64"
 
24520
   "")
 
24521
 
 
24522
-(define_insn ""
 
24523
+(define_insn "*extendsidi2_lfiwax"
 
24524
+  [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r,??wm,!wl,!wu")
 
24525
+       (sign_extend:DI (match_operand:SI 1 "lwa_operand" "m,r,r,Z,Z")))]
 
24526
+  "TARGET_POWERPC64 && TARGET_LFIWAX"
 
24527
+  "@
 
24528
+   lwa%U1%X1 %0,%1
 
24529
+   extsw %0,%1
 
24530
+   mtvsrwa %x0,%1
 
24531
+   lfiwax %0,%y1
 
24532
+   lxsiwax %x0,%y1"
 
24533
+  [(set_attr_alternative "type"
 
24534
+      [(if_then_else
 
24535
+        (match_test "update_indexed_address_mem (operands[1], VOIDmode)")
 
24536
+        (const_string "load_ext_ux")
 
24537
+        (if_then_else
 
24538
+          (match_test "update_address_mem (operands[1], VOIDmode)")
 
24539
+          (const_string "load_ext_u")
 
24540
+          (const_string "load_ext")))
 
24541
+       (const_string "exts")
 
24542
+       (const_string "mffgpr")
 
24543
+       (const_string "fpload")
 
24544
+       (const_string "fpload")])])
 
24545
+
 
24546
+(define_insn "*extendsidi2_nocell"
 
24547
   [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
 
24548
        (sign_extend:DI (match_operand:SI 1 "lwa_operand" "m,r")))]
 
24549
-  "TARGET_POWERPC64 && rs6000_gen_cell_microcode"
 
24550
+  "TARGET_POWERPC64 && rs6000_gen_cell_microcode && !TARGET_LFIWAX"
 
24551
   "@
 
24552
    lwa%U1%X1 %0,%1
 
24553
    extsw %0,%1"
 
24554
-  [(set_attr "type" "load_ext,exts")])
 
24555
+  [(set_attr_alternative "type"
 
24556
+      [(if_then_else
 
24557
+        (match_test "update_indexed_address_mem (operands[1], VOIDmode)")
 
24558
+        (const_string "load_ext_ux")
 
24559
+        (if_then_else
 
24560
+          (match_test "update_address_mem (operands[1], VOIDmode)")
 
24561
+          (const_string "load_ext_u")
 
24562
+          (const_string "load_ext")))
 
24563
+       (const_string "exts")])])
 
24564
 
 
24565
-(define_insn ""
 
24566
+(define_insn "*extendsidi2_nocell"
 
24567
   [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
 
24568
        (sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" "r")))]
 
24569
   "TARGET_POWERPC64 && !rs6000_gen_cell_microcode"
 
24570
@@ -602,7 +824,15 @@
 
24571
   "@
 
24572
    lbz%U1%X1 %0,%1
 
24573
    rlwinm %0,%1,0,0xff"
 
24574
-  [(set_attr "type" "load,*")])
 
24575
+  [(set_attr_alternative "type"
 
24576
+      [(if_then_else
 
24577
+        (match_test "update_indexed_address_mem (operands[1], VOIDmode)")
 
24578
+        (const_string "load_ux")
 
24579
+        (if_then_else
 
24580
+          (match_test "update_address_mem (operands[1], VOIDmode)")
 
24581
+          (const_string "load_u")
 
24582
+          (const_string "load")))
 
24583
+       (const_string "*")])])
 
24584
 
 
24585
 (define_insn ""
 
24586
   [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
 
24587
@@ -722,7 +952,15 @@
 
24588
   "@
 
24589
    lbz%U1%X1 %0,%1
 
24590
    rlwinm %0,%1,0,0xff"
 
24591
-  [(set_attr "type" "load,*")])
 
24592
+  [(set_attr_alternative "type"
 
24593
+      [(if_then_else
 
24594
+        (match_test "update_indexed_address_mem (operands[1], VOIDmode)")
 
24595
+        (const_string "load_ux")
 
24596
+        (if_then_else
 
24597
+          (match_test "update_address_mem (operands[1], VOIDmode)")
 
24598
+          (const_string "load_u")
 
24599
+          (const_string "load")))
 
24600
+       (const_string "*")])])
 
24601
 
 
24602
 (define_insn ""
 
24603
   [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
 
24604
@@ -848,7 +1086,15 @@
 
24605
   "@
 
24606
    lhz%U1%X1 %0,%1
 
24607
    rlwinm %0,%1,0,0xffff"
 
24608
-  [(set_attr "type" "load,*")])
 
24609
+  [(set_attr_alternative "type"
 
24610
+      [(if_then_else
 
24611
+        (match_test "update_indexed_address_mem (operands[1], VOIDmode)")
 
24612
+        (const_string "load_ux")
 
24613
+        (if_then_else
 
24614
+          (match_test "update_address_mem (operands[1], VOIDmode)")
 
24615
+          (const_string "load_u")
 
24616
+          (const_string "load")))
 
24617
+       (const_string "*")])])
 
24618
 
 
24619
 (define_insn ""
 
24620
   [(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
 
24621
@@ -915,7 +1161,15 @@
 
24622
   "@
 
24623
    lha%U1%X1 %0,%1
 
24624
    extsh %0,%1"
 
24625
-  [(set_attr "type" "load_ext,exts")])
 
24626
+  [(set_attr_alternative "type"
 
24627
+      [(if_then_else
 
24628
+        (match_test "update_indexed_address_mem (operands[1], VOIDmode)")
 
24629
+        (const_string "load_ext_ux")
 
24630
+        (if_then_else
 
24631
+          (match_test "update_address_mem (operands[1], VOIDmode)")
 
24632
+          (const_string "load_ext_u")
 
24633
+          (const_string "load_ext")))
 
24634
+       (const_string "exts")])])
 
24635
 
 
24636
 (define_insn ""
 
24637
   [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
 
24638
@@ -1658,7 +1912,19 @@
 
24639
     FAIL;
 
24640
 })
 
24641
 
 
24642
-(define_insn "one_cmpl<mode>2"
 
24643
+(define_expand "one_cmpl<mode>2"
 
24644
+  [(set (match_operand:SDI 0 "gpc_reg_operand" "")
 
24645
+       (not:SDI (match_operand:SDI 1 "gpc_reg_operand" "")))]
 
24646
+  ""
 
24647
+{
 
24648
+  if (<MODE>mode == DImode && !TARGET_POWERPC64)
 
24649
+    {
 
24650
+      rs6000_split_logical (operands, NOT, false, false, false, NULL_RTX);
 
24651
+      DONE;
 
24652
+    }
 
24653
+})
 
24654
+
 
24655
+(define_insn "*one_cmpl<mode>2"
 
24656
   [(set (match_operand:GPR 0 "gpc_reg_operand" "=r")
 
24657
        (not:GPR (match_operand:GPR 1 "gpc_reg_operand" "r")))]
 
24658
   ""
 
24659
@@ -1935,7 +2201,9 @@
 
24660
   [(set (match_operand:GPR 0 "gpc_reg_operand" "=r")
 
24661
        (unspec:GPR [(match_operand:GPR 1 "gpc_reg_operand" "r")] UNSPEC_PARITY))]
 
24662
   "TARGET_CMPB && TARGET_POPCNTB"
 
24663
-  "prty<wd> %0,%1")
 
24664
+  "prty<wd> %0,%1"
 
24665
+  [(set_attr "length" "4")
 
24666
+   (set_attr "type" "popcnt")])
 
24667
 
 
24668
 (define_expand "parity<mode>2"
 
24669
   [(set (match_operand:GPR 0 "gpc_reg_operand" "")
 
24670
@@ -4054,7 +4322,7 @@
 
24671
    #
 
24672
    #
 
24673
    #"
 
24674
-  [(set_attr "type" "delayed_compare,var_delayed_compare,delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
 
24675
+  [(set_attr "type" "fast_compare,var_delayed_compare,delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
 
24676
    (set_attr "length" "4,4,4,8,8,8")])
 
24677
 
 
24678
 (define_split
 
24679
@@ -4086,7 +4354,7 @@
 
24680
    #
 
24681
    #
 
24682
    #"
 
24683
-  [(set_attr "type" "delayed_compare,var_delayed_compare,delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
 
24684
+  [(set_attr "type" "fast_compare,var_delayed_compare,delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
 
24685
    (set_attr "length" "4,4,4,8,8,8")])
 
24686
 
 
24687
 (define_split
 
24688
@@ -4455,224 +4723,226 @@
 
24689
                    (const_int 0)))]
 
24690
   "")
 
24691
 
 
24692
-;; Floating-point insns, excluding normal data motion.
 
24693
-;;
 
24694
-;; PowerPC has a full set of single-precision floating point instructions.
 
24695
-;;
 
24696
-;; For the POWER architecture, we pretend that we have both SFmode and
 
24697
-;; DFmode insns, while, in fact, all fp insns are actually done in double.
 
24698
-;; The only conversions we will do will be when storing to memory.  In that
 
24699
-;; case, we will use the "frsp" instruction before storing.
 
24700
-;;
 
24701
-;; Note that when we store into a single-precision memory location, we need to
 
24702
-;; use the frsp insn first.  If the register being stored isn't dead, we
 
24703
-;; need a scratch register for the frsp.  But this is difficult when the store
 
24704
-;; is done by reload.  It is not incorrect to do the frsp on the register in
 
24705
-;; this case, we just lose precision that we would have otherwise gotten but
 
24706
-;; is not guaranteed.  Perhaps this should be tightened up at some point.
 
24707
+
 
24708
+;; Floating-point insns, excluding normal data motion.  We combine the SF/DF
 
24709
+;; modes here, and also add in conditional vsx/power8-vector support to access
 
24710
+;; values in the traditional Altivec registers if the appropriate
 
24711
+;; -mupper-regs-{df,sf} option is enabled.
 
24712
 
 
24713
-(define_expand "extendsfdf2"
 
24714
-  [(set (match_operand:DF 0 "gpc_reg_operand" "")
 
24715
-       (float_extend:DF (match_operand:SF 1 "reg_or_none500mem_operand" "")))]
 
24716
-  "TARGET_HARD_FLOAT && ((TARGET_FPRS && TARGET_DOUBLE_FLOAT) || TARGET_E500_DOUBLE)"
 
24717
+(define_expand "abs<mode>2"
 
24718
+  [(set (match_operand:SFDF 0 "gpc_reg_operand" "")
 
24719
+       (abs:SFDF (match_operand:SFDF 1 "gpc_reg_operand" "")))]
 
24720
+  "TARGET_<MODE>_INSN"
 
24721
   "")
 
24722
 
 
24723
-(define_insn_and_split "*extendsfdf2_fpr"
 
24724
-  [(set (match_operand:DF 0 "gpc_reg_operand" "=d,?d,d")
 
24725
-       (float_extend:DF (match_operand:SF 1 "reg_or_mem_operand" "0,f,m")))]
 
24726
-  "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT"
 
24727
+(define_insn "*abs<mode>2_fpr"
 
24728
+  [(set (match_operand:SFDF 0 "gpc_reg_operand" "=<Ff>,<Fv>")
 
24729
+       (abs:SFDF (match_operand:SFDF 1 "gpc_reg_operand" "<Ff>,<Fv>")))]
 
24730
+  "TARGET_<MODE>_FPR"
 
24731
   "@
 
24732
-   #
 
24733
-   fmr %0,%1
 
24734
-   lfs%U1%X1 %0,%1"
 
24735
-  "&& reload_completed && REG_P (operands[1]) && REGNO (operands[0]) == REGNO (operands[1])"
 
24736
-  [(const_int 0)]
 
24737
-{
 
24738
-  emit_note (NOTE_INSN_DELETED);
 
24739
-  DONE;
 
24740
-}
 
24741
-  [(set_attr "type" "fp,fp,fpload")])
 
24742
+   fabs %0,%1
 
24743
+   xsabsdp %x0,%x1"
 
24744
+  [(set_attr "type" "fp")
 
24745
+   (set_attr "fp_type" "fp_addsub_<Fs>")])
 
24746
 
 
24747
-(define_expand "truncdfsf2"
 
24748
-  [(set (match_operand:SF 0 "gpc_reg_operand" "")
 
24749
-       (float_truncate:SF (match_operand:DF 1 "gpc_reg_operand" "")))]
 
24750
-  "TARGET_HARD_FLOAT && ((TARGET_FPRS && TARGET_DOUBLE_FLOAT) || TARGET_E500_DOUBLE)"
 
24751
-  "")
 
24752
+(define_insn "*nabs<mode>2_fpr"
 
24753
+  [(set (match_operand:SFDF 0 "gpc_reg_operand" "=<Ff>,<Fv>")
 
24754
+       (neg:SFDF
 
24755
+        (abs:SFDF
 
24756
+         (match_operand:SFDF 1 "gpc_reg_operand" "<Ff>,<Fv>"))))]
 
24757
+  "TARGET_<MODE>_FPR"
 
24758
+  "@
 
24759
+   fnabs %0,%1
 
24760
+   xsnabsdp %x0,%x1"
 
24761
+  [(set_attr "type" "fp")
 
24762
+   (set_attr "fp_type" "fp_addsub_<Fs>")])
 
24763
 
 
24764
-(define_insn "*truncdfsf2_fpr"
 
24765
-  [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
 
24766
-       (float_truncate:SF (match_operand:DF 1 "gpc_reg_operand" "d")))]
 
24767
-  "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT"
 
24768
-  "frsp %0,%1"
 
24769
-  [(set_attr "type" "fp")])
 
24770
-
 
24771
-(define_expand "negsf2"
 
24772
-  [(set (match_operand:SF 0 "gpc_reg_operand" "")
 
24773
-       (neg:SF (match_operand:SF 1 "gpc_reg_operand" "")))]
 
24774
-  "TARGET_HARD_FLOAT && TARGET_SINGLE_FLOAT"
 
24775
+(define_expand "neg<mode>2"
 
24776
+  [(set (match_operand:SFDF 0 "gpc_reg_operand" "")
 
24777
+       (neg:SFDF (match_operand:SFDF 1 "gpc_reg_operand" "")))]
 
24778
+  "TARGET_<MODE>_INSN"
 
24779
   "")
 
24780
 
 
24781
-(define_insn "*negsf2"
 
24782
-  [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
 
24783
-       (neg:SF (match_operand:SF 1 "gpc_reg_operand" "f")))]
 
24784
-  "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT"
 
24785
-  "fneg %0,%1"
 
24786
-  [(set_attr "type" "fp")])
 
24787
+(define_insn "*neg<mode>2_fpr"
 
24788
+  [(set (match_operand:SFDF 0 "gpc_reg_operand" "=<Ff>,<Fv>")
 
24789
+       (neg:SFDF (match_operand:SFDF 1 "gpc_reg_operand" "<Ff>,<Fv>")))]
 
24790
+  "TARGET_<MODE>_FPR"
 
24791
+  "@
 
24792
+   fneg %0,%1
 
24793
+   xsnegdp %x0,%x1"
 
24794
+  [(set_attr "type" "fp")
 
24795
+   (set_attr "fp_type" "fp_addsub_<Fs>")])
 
24796
 
 
24797
-(define_expand "abssf2"
 
24798
-  [(set (match_operand:SF 0 "gpc_reg_operand" "")
 
24799
-       (abs:SF (match_operand:SF 1 "gpc_reg_operand" "")))]
 
24800
-  "TARGET_HARD_FLOAT && TARGET_SINGLE_FLOAT"
 
24801
+(define_expand "add<mode>3"
 
24802
+  [(set (match_operand:SFDF 0 "gpc_reg_operand" "")
 
24803
+       (plus:SFDF (match_operand:SFDF 1 "gpc_reg_operand" "")
 
24804
+                  (match_operand:SFDF 2 "gpc_reg_operand" "")))]
 
24805
+  "TARGET_<MODE>_INSN"
 
24806
   "")
 
24807
 
 
24808
-(define_insn "*abssf2"
 
24809
-  [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
 
24810
-       (abs:SF (match_operand:SF 1 "gpc_reg_operand" "f")))]
 
24811
-  "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT"
 
24812
-  "fabs %0,%1"
 
24813
-  [(set_attr "type" "fp")])
 
24814
+(define_insn "*add<mode>3_fpr"
 
24815
+  [(set (match_operand:SFDF 0 "gpc_reg_operand" "=<Ff>,<Fv>")
 
24816
+       (plus:SFDF (match_operand:SFDF 1 "gpc_reg_operand" "%<Ff>,<Fv>")
 
24817
+                  (match_operand:SFDF 2 "gpc_reg_operand" "<Ff>,<Fv>")))]
 
24818
+  "TARGET_<MODE>_FPR"
 
24819
+  "@
 
24820
+   fadd<Ftrad> %0,%1,%2
 
24821
+   xsadd<Fvsx> %x0,%x1,%x2"
 
24822
+  [(set_attr "type" "fp")
 
24823
+   (set_attr "fp_type" "fp_addsub_<Fs>")])
 
24824
 
 
24825
-(define_insn ""
 
24826
-  [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
 
24827
-       (neg:SF (abs:SF (match_operand:SF 1 "gpc_reg_operand" "f"))))]
 
24828
-  "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT"
 
24829
-  "fnabs %0,%1"
 
24830
-  [(set_attr "type" "fp")])
 
24831
-
 
24832
-(define_expand "addsf3"
 
24833
-  [(set (match_operand:SF 0 "gpc_reg_operand" "")
 
24834
-       (plus:SF (match_operand:SF 1 "gpc_reg_operand" "")
 
24835
-                (match_operand:SF 2 "gpc_reg_operand" "")))]
 
24836
-  "TARGET_HARD_FLOAT && TARGET_SINGLE_FLOAT"
 
24837
+(define_expand "sub<mode>3"
 
24838
+  [(set (match_operand:SFDF 0 "gpc_reg_operand" "")
 
24839
+       (minus:SFDF (match_operand:SFDF 1 "gpc_reg_operand" "")
 
24840
+                   (match_operand:SFDF 2 "gpc_reg_operand" "")))]
 
24841
+  "TARGET_<MODE>_INSN"
 
24842
   "")
 
24843
 
 
24844
-(define_insn ""
 
24845
-  [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
 
24846
-       (plus:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
 
24847
-                (match_operand:SF 2 "gpc_reg_operand" "f")))]
 
24848
-  "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT"
 
24849
-  "fadds %0,%1,%2"
 
24850
+(define_insn "*sub<mode>3_fpr"
 
24851
+  [(set (match_operand:SFDF 0 "gpc_reg_operand" "=<Ff>,<Fv>")
 
24852
+       (minus:SFDF (match_operand:SFDF 1 "gpc_reg_operand" "<Ff>,<Fv>")
 
24853
+                   (match_operand:SFDF 2 "gpc_reg_operand" "<Ff>,<Fv>")))]
 
24854
+  "TARGET_<MODE>_FPR"
 
24855
+  "@
 
24856
+   fsub<Ftrad> %0,%1,%2
 
24857
+   xssub<Fvsx> %x0,%x1,%x2"
 
24858
   [(set_attr "type" "fp")
 
24859
-   (set_attr "fp_type" "fp_addsub_s")])
 
24860
+   (set_attr "fp_type" "fp_addsub_<Fs>")])
 
24861
 
 
24862
-(define_expand "subsf3"
 
24863
-  [(set (match_operand:SF 0 "gpc_reg_operand" "")
 
24864
-       (minus:SF (match_operand:SF 1 "gpc_reg_operand" "")
 
24865
-                 (match_operand:SF 2 "gpc_reg_operand" "")))]
 
24866
-  "TARGET_HARD_FLOAT && TARGET_SINGLE_FLOAT"
 
24867
+(define_expand "mul<mode>3"
 
24868
+  [(set (match_operand:SFDF 0 "gpc_reg_operand" "")
 
24869
+       (mult:SFDF (match_operand:SFDF 1 "gpc_reg_operand" "")
 
24870
+                  (match_operand:SFDF 2 "gpc_reg_operand" "")))]
 
24871
+  "TARGET_<MODE>_INSN"
 
24872
   "")
 
24873
 
 
24874
-(define_insn ""
 
24875
-  [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
 
24876
-       (minus:SF (match_operand:SF 1 "gpc_reg_operand" "f")
 
24877
-                 (match_operand:SF 2 "gpc_reg_operand" "f")))]
 
24878
-  "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT"
 
24879
-  "fsubs %0,%1,%2"
 
24880
-  [(set_attr "type" "fp")
 
24881
-   (set_attr "fp_type" "fp_addsub_s")])
 
24882
+(define_insn "*mul<mode>3_fpr"
 
24883
+  [(set (match_operand:SFDF 0 "gpc_reg_operand" "=<Ff>,<Fv>")
 
24884
+       (mult:SFDF (match_operand:SFDF 1 "gpc_reg_operand" "%<Ff>,<Fv>")
 
24885
+                  (match_operand:SFDF 2 "gpc_reg_operand" "<Ff>,<Fv>")))]
 
24886
+  "TARGET_<MODE>_FPR"
 
24887
+  "@
 
24888
+   fmul<Ftrad> %0,%1,%2
 
24889
+   xsmul<Fvsx> %x0,%x1,%x2"
 
24890
+  [(set_attr "type" "dmul")
 
24891
+   (set_attr "fp_type" "fp_mul_<Fs>")])
 
24892
 
 
24893
-(define_expand "mulsf3"
 
24894
-  [(set (match_operand:SF 0 "gpc_reg_operand" "")
 
24895
-       (mult:SF (match_operand:SF 1 "gpc_reg_operand" "")
 
24896
-                (match_operand:SF 2 "gpc_reg_operand" "")))]
 
24897
-  "TARGET_HARD_FLOAT && TARGET_SINGLE_FLOAT"
 
24898
+(define_expand "div<mode>3"
 
24899
+  [(set (match_operand:SFDF 0 "gpc_reg_operand" "")
 
24900
+       (div:SFDF (match_operand:SFDF 1 "gpc_reg_operand" "")
 
24901
+                 (match_operand:SFDF 2 "gpc_reg_operand" "")))]
 
24902
+  "TARGET_<MODE>_INSN && !TARGET_SIMPLE_FPU"
 
24903
   "")
 
24904
 
 
24905
-(define_insn ""
 
24906
-  [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
 
24907
-       (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
 
24908
-                (match_operand:SF 2 "gpc_reg_operand" "f")))]
 
24909
-  "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT"
 
24910
-  "fmuls %0,%1,%2"
 
24911
-  [(set_attr "type" "fp")
 
24912
-   (set_attr "fp_type" "fp_mul_s")])
 
24913
+(define_insn "*div<mode>3_fpr"
 
24914
+  [(set (match_operand:SFDF 0 "gpc_reg_operand" "=<Ff>,<Fv>")
 
24915
+       (div:SFDF (match_operand:SFDF 1 "gpc_reg_operand" "<Ff>,<Fv>")
 
24916
+                 (match_operand:SFDF 2 "gpc_reg_operand" "<Ff>,<Fv>")))]
 
24917
+  "TARGET_<MODE>_FPR && !TARGET_SIMPLE_FPU"
 
24918
+  "@
 
24919
+   fdiv<Ftrad> %0,%1,%2
 
24920
+   xsdiv<Fvsx> %x0,%x1,%x2"
 
24921
+  [(set_attr "type" "<Fs>div")
 
24922
+   (set_attr "fp_type" "fp_div_<Fs>")])
 
24923
 
 
24924
-(define_expand "divsf3"
 
24925
-  [(set (match_operand:SF 0 "gpc_reg_operand" "")
 
24926
-       (div:SF (match_operand:SF 1 "gpc_reg_operand" "")
 
24927
-               (match_operand:SF 2 "gpc_reg_operand" "")))]
 
24928
-  "TARGET_HARD_FLOAT && TARGET_SINGLE_FLOAT && !TARGET_SIMPLE_FPU"
 
24929
-  "")
 
24930
+(define_insn "sqrt<mode>2"
 
24931
+  [(set (match_operand:SFDF 0 "gpc_reg_operand" "=<Ff>,<Fv>")
 
24932
+       (sqrt:SFDF (match_operand:SFDF 1 "gpc_reg_operand" "<Ff>,<Fv>")))]
 
24933
+  "TARGET_<MODE>_FPR && !TARGET_SIMPLE_FPU
 
24934
+   && (TARGET_PPC_GPOPT || (<MODE>mode == SFmode && TARGET_XILINX_FPU))"
 
24935
+  "@
 
24936
+   fsqrt<Ftrad> %0,%1
 
24937
+   xssqrt<Fvsx> %x0,%x1"
 
24938
+  [(set_attr "type" "<Fs>sqrt")
 
24939
+   (set_attr "fp_type" "fp_sqrt_<Fs>")])
 
24940
 
 
24941
-(define_insn ""
 
24942
-  [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
 
24943
-       (div:SF (match_operand:SF 1 "gpc_reg_operand" "f")
 
24944
-               (match_operand:SF 2 "gpc_reg_operand" "f")))]
 
24945
-  "TARGET_HARD_FLOAT && TARGET_FPRS
 
24946
-   && TARGET_SINGLE_FLOAT && !TARGET_SIMPLE_FPU"
 
24947
-  "fdivs %0,%1,%2"
 
24948
-  [(set_attr "type" "sdiv")])
 
24949
+;; Floating point reciprocal approximation
 
24950
+(define_insn "fre<Fs>"
 
24951
+  [(set (match_operand:SFDF 0 "gpc_reg_operand" "=<Ff>,<Fv>")
 
24952
+       (unspec:SFDF [(match_operand:SFDF 1 "gpc_reg_operand" "<Ff>,<Fv>")]
 
24953
+                    UNSPEC_FRES))]
 
24954
+  "TARGET_<FFRE>"
 
24955
+  "@
 
24956
+   fre<Ftrad> %0,%1
 
24957
+   xsre<Fvsx> %x0,%x1"
 
24958
+  [(set_attr "type" "fp")])
 
24959
 
 
24960
-(define_insn "fres"
 
24961
-  [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
 
24962
-       (unspec:SF [(match_operand:SF 1 "gpc_reg_operand" "f")] UNSPEC_FRES))]
 
24963
-  "TARGET_FRES"
 
24964
-  "fres %0,%1"
 
24965
+(define_insn "*rsqrt<mode>2"
 
24966
+  [(set (match_operand:SFDF 0 "gpc_reg_operand" "=<Ff>,<Fv>")
 
24967
+       (unspec:SFDF [(match_operand:SFDF 1 "gpc_reg_operand" "<Ff>,<Fv>")]
 
24968
+                    UNSPEC_RSQRT))]
 
24969
+  "RS6000_RECIP_HAVE_RSQRTE_P (<MODE>mode)"
 
24970
+  "@
 
24971
+   frsqrte<Ftrad> %0,%1
 
24972
+   xsrsqrte<Fvsx> %x0,%x1"
 
24973
   [(set_attr "type" "fp")])
 
24974
 
 
24975
-; builtin fmaf support
 
24976
-(define_insn "*fmasf4_fpr"
 
24977
-  [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
 
24978
-       (fma:SF (match_operand:SF 1 "gpc_reg_operand" "f")
 
24979
-               (match_operand:SF 2 "gpc_reg_operand" "f")
 
24980
-               (match_operand:SF 3 "gpc_reg_operand" "f")))]
 
24981
-  "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT"
 
24982
-  "fmadds %0,%1,%2,%3"
 
24983
-  [(set_attr "type" "fp")
 
24984
-   (set_attr "fp_type" "fp_maddsub_s")])
 
24985
+;; Floating point comparisons
 
24986
+(define_insn "*cmp<mode>_fpr"
 
24987
+  [(set (match_operand:CCFP 0 "cc_reg_operand" "=y,y")
 
24988
+       (compare:CCFP (match_operand:SFDF 1 "gpc_reg_operand" "<Ff>,<Fv>")
 
24989
+                     (match_operand:SFDF 2 "gpc_reg_operand" "<Ff>,<Fv>")))]
 
24990
+  "TARGET_<MODE>_FPR"
 
24991
+  "@
 
24992
+   fcmpu %0,%1,%2
 
24993
+   xscmpudp %0,%x1,%x2"
 
24994
+  [(set_attr "type" "fpcompare")])
 
24995
 
 
24996
-(define_insn "*fmssf4_fpr"
 
24997
-  [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
 
24998
-       (fma:SF (match_operand:SF 1 "gpc_reg_operand" "f")
 
24999
-               (match_operand:SF 2 "gpc_reg_operand" "f")
 
25000
-               (neg:SF (match_operand:SF 3 "gpc_reg_operand" "f"))))]
 
25001
-  "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT"
 
25002
-  "fmsubs %0,%1,%2,%3"
 
25003
-  [(set_attr "type" "fp")
 
25004
-   (set_attr "fp_type" "fp_maddsub_s")])
 
25005
+;; Floating point conversions
 
25006
+(define_expand "extendsfdf2"
 
25007
+  [(set (match_operand:DF 0 "gpc_reg_operand" "")
 
25008
+       (float_extend:DF (match_operand:SF 1 "reg_or_none500mem_operand" "")))]
 
25009
+  "TARGET_HARD_FLOAT && ((TARGET_FPRS && TARGET_DOUBLE_FLOAT) || TARGET_E500_DOUBLE)"
 
25010
+  "")
 
25011
 
 
25012
-(define_insn "*nfmasf4_fpr"
 
25013
-  [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
 
25014
-       (neg:SF (fma:SF (match_operand:SF 1 "gpc_reg_operand" "f")
 
25015
-                       (match_operand:SF 2 "gpc_reg_operand" "f")
 
25016
-                       (match_operand:SF 3 "gpc_reg_operand" "f"))))]
 
25017
-  "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT"
 
25018
-  "fnmadds %0,%1,%2,%3"
 
25019
-  [(set_attr "type" "fp")
 
25020
-   (set_attr "fp_type" "fp_maddsub_s")])
 
25021
+(define_insn_and_split "*extendsfdf2_fpr"
 
25022
+  [(set (match_operand:DF 0 "gpc_reg_operand" "=d,?d,d,ws,?ws,wv")
 
25023
+       (float_extend:DF (match_operand:SF 1 "reg_or_mem_operand" "0,f,m,0,wy,Z")))]
 
25024
+  "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT"
 
25025
+  "@
 
25026
+   #
 
25027
+   fmr %0,%1
 
25028
+   lfs%U1%X1 %0,%1
 
25029
+   #
 
25030
+   xxlor %x0,%x1,%x1
 
25031
+   lxsspx %x0,%y1"
 
25032
+  "&& reload_completed && REG_P (operands[1]) && REGNO (operands[0]) == REGNO (operands[1])"
 
25033
+  [(const_int 0)]
 
25034
+{
 
25035
+  emit_note (NOTE_INSN_DELETED);
 
25036
+  DONE;
 
25037
+}
 
25038
+  [(set_attr_alternative "type"
 
25039
+      [(const_string "fp")
 
25040
+       (const_string "fp")
 
25041
+       (if_then_else
 
25042
+        (match_test "update_indexed_address_mem (operands[1], VOIDmode)")
 
25043
+        (const_string "fpload_ux")
 
25044
+        (if_then_else
 
25045
+          (match_test "update_address_mem (operands[1], VOIDmode)")
 
25046
+          (const_string "fpload_u")
 
25047
+          (const_string "fpload")))
 
25048
+       (const_string "fp")
 
25049
+       (const_string "vecsimple")
 
25050
+       (if_then_else
 
25051
+       (match_test "update_indexed_address_mem (operands[1], VOIDmode)")
 
25052
+       (const_string "fpload_ux")
 
25053
+       (if_then_else
 
25054
+        (match_test "update_address_mem (operands[1], VOIDmode)")
 
25055
+        (const_string "fpload_u")
 
25056
+        (const_string "fpload")))])])
 
25057
 
 
25058
-(define_insn "*nfmssf4_fpr"
 
25059
-  [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
 
25060
-       (neg:SF (fma:SF (match_operand:SF 1 "gpc_reg_operand" "f")
 
25061
-                       (match_operand:SF 2 "gpc_reg_operand" "f")
 
25062
-                       (neg:SF (match_operand:SF 3 "gpc_reg_operand" "f")))))]
 
25063
-  "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT"
 
25064
-  "fnmsubs %0,%1,%2,%3"
 
25065
-  [(set_attr "type" "fp")
 
25066
-   (set_attr "fp_type" "fp_maddsub_s")])
 
25067
-
 
25068
-(define_expand "sqrtsf2"
 
25069
+(define_expand "truncdfsf2"
 
25070
   [(set (match_operand:SF 0 "gpc_reg_operand" "")
 
25071
-       (sqrt:SF (match_operand:SF 1 "gpc_reg_operand" "")))]
 
25072
-  "(TARGET_PPC_GPOPT || TARGET_XILINX_FPU)
 
25073
-   && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT
 
25074
-   && !TARGET_SIMPLE_FPU"
 
25075
+       (float_truncate:SF (match_operand:DF 1 "gpc_reg_operand" "")))]
 
25076
+  "TARGET_HARD_FLOAT && ((TARGET_FPRS && TARGET_DOUBLE_FLOAT) || TARGET_E500_DOUBLE)"
 
25077
   "")
 
25078
 
 
25079
-(define_insn ""
 
25080
+(define_insn "*truncdfsf2_fpr"
 
25081
   [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
 
25082
-       (sqrt:SF (match_operand:SF 1 "gpc_reg_operand" "f")))]
 
25083
-  "(TARGET_PPC_GPOPT || TARGET_XILINX_FPU) && TARGET_HARD_FLOAT
 
25084
-   && TARGET_FPRS && TARGET_SINGLE_FLOAT && !TARGET_SIMPLE_FPU"
 
25085
-  "fsqrts %0,%1"
 
25086
-  [(set_attr "type" "ssqrt")])
 
25087
-
 
25088
-(define_insn "*rsqrtsf_internal1"
 
25089
-  [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
 
25090
-       (unspec:SF [(match_operand:SF 1 "gpc_reg_operand" "f")]
 
25091
-                  UNSPEC_RSQRT))]
 
25092
-  "TARGET_FRSQRTES"
 
25093
-  "frsqrtes %0,%1"
 
25094
+       (float_truncate:SF (match_operand:DF 1 "gpc_reg_operand" "d")))]
 
25095
+  "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT"
 
25096
+  "frsp %0,%1"
 
25097
   [(set_attr "type" "fp")])
 
25098
 
 
25099
 ;; This expander is here to avoid FLOAT_WORDS_BIGENDIAN tests in
 
25100
@@ -4742,39 +5012,84 @@
 
25101
 ;; Use an unspec rather providing an if-then-else in RTL, to prevent the
 
25102
 ;; compiler from optimizing -0.0
 
25103
 (define_insn "copysign<mode>3_fcpsgn"
 
25104
-  [(set (match_operand:SFDF 0 "gpc_reg_operand" "=<rreg2>")
 
25105
-       (unspec:SFDF [(match_operand:SFDF 1 "gpc_reg_operand" "<rreg2>")
 
25106
-                     (match_operand:SFDF 2 "gpc_reg_operand" "<rreg2>")]
 
25107
+  [(set (match_operand:SFDF 0 "gpc_reg_operand" "=<Ff>,<Fv>")
 
25108
+       (unspec:SFDF [(match_operand:SFDF 1 "gpc_reg_operand" "<Ff>,<Fv>")
 
25109
+                     (match_operand:SFDF 2 "gpc_reg_operand" "<Ff>,<Fv>")]
 
25110
                     UNSPEC_COPYSIGN))]
 
25111
-  "TARGET_CMPB && !VECTOR_UNIT_VSX_P (<MODE>mode)"
 
25112
-  "fcpsgn %0,%2,%1"
 
25113
+  "TARGET_<MODE>_FPR && TARGET_CMPB"
 
25114
+  "@
 
25115
+   fcpsgn %0,%2,%1
 
25116
+   xscpsgn<Fvsx> %x0,%x2,%x1"
 
25117
   [(set_attr "type" "fp")])
 
25118
 
 
25119
 ;; For MIN, MAX, and conditional move, we use DEFINE_EXPAND's that involve a
 
25120
 ;; fsel instruction and some auxiliary computations.  Then we just have a
 
25121
 ;; single DEFINE_INSN for fsel and the define_splits to make them if made by
 
25122
 ;; combine.
 
25123
-(define_expand "smaxsf3"
 
25124
-  [(set (match_operand:SF 0 "gpc_reg_operand" "")
 
25125
-       (if_then_else:SF (ge (match_operand:SF 1 "gpc_reg_operand" "")
 
25126
-                            (match_operand:SF 2 "gpc_reg_operand" ""))
 
25127
-                        (match_dup 1)
 
25128
-                        (match_dup 2)))]
 
25129
-  "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS 
 
25130
-   && TARGET_SINGLE_FLOAT && !flag_trapping_math"
 
25131
-  "{ rs6000_emit_minmax (operands[0], SMAX, operands[1], operands[2]); DONE;}")
 
25132
+;; For MIN, MAX on non-VSX machines, and conditional move all of the time, we
 
25133
+;; use DEFINE_EXPAND's that involve a fsel instruction and some auxiliary
 
25134
+;; computations.  Then we just have a single DEFINE_INSN for fsel and the
 
25135
+;; define_splits to make them if made by combine.  On VSX machines we have the
 
25136
+;; min/max instructions.
 
25137
+;;
 
25138
+;; On VSX, we only check for TARGET_VSX instead of checking for a vsx/p8 vector
 
25139
+;; to allow either DF/SF to use only traditional registers.
 
25140
 
 
25141
-(define_expand "sminsf3"
 
25142
-  [(set (match_operand:SF 0 "gpc_reg_operand" "")
 
25143
-       (if_then_else:SF (ge (match_operand:SF 1 "gpc_reg_operand" "")
 
25144
-                            (match_operand:SF 2 "gpc_reg_operand" ""))
 
25145
-                        (match_dup 2)
 
25146
-                        (match_dup 1)))]
 
25147
-  "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS 
 
25148
-   && TARGET_SINGLE_FLOAT && !flag_trapping_math"
 
25149
-  "{ rs6000_emit_minmax (operands[0], SMIN, operands[1], operands[2]); DONE;}")
 
25150
+(define_expand "smax<mode>3"
 
25151
+  [(set (match_operand:SFDF 0 "gpc_reg_operand" "")
 
25152
+       (if_then_else:SFDF (ge (match_operand:SFDF 1 "gpc_reg_operand" "")
 
25153
+                              (match_operand:SFDF 2 "gpc_reg_operand" ""))
 
25154
+                          (match_dup 1)
 
25155
+                          (match_dup 2)))]
 
25156
+  "TARGET_<MODE>_FPR && TARGET_PPC_GFXOPT && !flag_trapping_math"
 
25157
+{
 
25158
+  rs6000_emit_minmax (operands[0], SMAX, operands[1], operands[2]);
 
25159
+  DONE;
 
25160
+})
 
25161
 
 
25162
+(define_insn "*smax<mode>3_vsx"
 
25163
+  [(set (match_operand:SFDF 0 "gpc_reg_operand" "=<Ff>,<Fv>")
 
25164
+       (smax:SFDF (match_operand:SFDF 1 "gpc_reg_operand" "%<Ff>,<Fv>")
 
25165
+                  (match_operand:SFDF 2 "gpc_reg_operand" "<Ff>,<Fv>")))]
 
25166
+  "TARGET_<MODE>_FPR && TARGET_VSX"
 
25167
+  "xsmaxdp %x0,%x1,%x2"
 
25168
+  [(set_attr "type" "fp")])
 
25169
+
 
25170
+(define_expand "smin<mode>3"
 
25171
+  [(set (match_operand:SFDF 0 "gpc_reg_operand" "")
 
25172
+       (if_then_else:SFDF (ge (match_operand:SFDF 1 "gpc_reg_operand" "")
 
25173
+                              (match_operand:SFDF 2 "gpc_reg_operand" ""))
 
25174
+                          (match_dup 2)
 
25175
+                          (match_dup 1)))]
 
25176
+  "TARGET_<MODE>_FPR && TARGET_PPC_GFXOPT && !flag_trapping_math"
 
25177
+{
 
25178
+  rs6000_emit_minmax (operands[0], SMIN, operands[1], operands[2]);
 
25179
+  DONE;
 
25180
+})
 
25181
+
 
25182
+(define_insn "*smin<mode>3_vsx"
 
25183
+  [(set (match_operand:SFDF 0 "gpc_reg_operand" "=<Ff>,<Fv>")
 
25184
+       (smin:SFDF (match_operand:SFDF 1 "gpc_reg_operand" "%<Ff>,<Fv>")
 
25185
+                  (match_operand:SFDF 2 "gpc_reg_operand" "<Ff>,<Fv>")))]
 
25186
+  "TARGET_<MODE>_FPR && TARGET_VSX"
 
25187
+  "xsmindp %x0,%x1,%x2"
 
25188
+  [(set_attr "type" "fp")])
 
25189
+
 
25190
 (define_split
 
25191
+  [(set (match_operand:SFDF 0 "gpc_reg_operand" "")
 
25192
+       (match_operator:SFDF 3 "min_max_operator"
 
25193
+        [(match_operand:SFDF 1 "gpc_reg_operand" "")
 
25194
+         (match_operand:SFDF 2 "gpc_reg_operand" "")]))]
 
25195
+  "TARGET_<MODE>_FPR && TARGET_PPC_GFXOPT && !flag_trapping_math
 
25196
+   && !TARGET_VSX"
 
25197
+  [(const_int 0)]
 
25198
+{
 
25199
+  rs6000_emit_minmax (operands[0], GET_CODE (operands[3]), operands[1],
 
25200
+                     operands[2]);
 
25201
+  DONE;
 
25202
+})
 
25203
+
 
25204
+(define_split
 
25205
   [(set (match_operand:SF 0 "gpc_reg_operand" "")
 
25206
        (match_operator:SF 3 "min_max_operator"
 
25207
         [(match_operand:SF 1 "gpc_reg_operand" "")
 
25208
@@ -4904,208 +5219,9 @@
 
25209
   "fsel %0,%1,%2,%3"
 
25210
   [(set_attr "type" "fp")])
 
25211
 
 
25212
-(define_expand "negdf2"
 
25213
-  [(set (match_operand:DF 0 "gpc_reg_operand" "")
 
25214
-       (neg:DF (match_operand:DF 1 "gpc_reg_operand" "")))]
 
25215
-  "TARGET_HARD_FLOAT && ((TARGET_FPRS && TARGET_DOUBLE_FLOAT) || TARGET_E500_DOUBLE)"
 
25216
-  "")
 
25217
-
 
25218
-(define_insn "*negdf2_fpr"
 
25219
-  [(set (match_operand:DF 0 "gpc_reg_operand" "=d")
 
25220
-       (neg:DF (match_operand:DF 1 "gpc_reg_operand" "d")))]
 
25221
-  "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
 
25222
-   && !VECTOR_UNIT_VSX_P (DFmode)"
 
25223
-  "fneg %0,%1"
 
25224
-  [(set_attr "type" "fp")])
 
25225
-
 
25226
-(define_expand "absdf2"
 
25227
-  [(set (match_operand:DF 0 "gpc_reg_operand" "")
 
25228
-       (abs:DF (match_operand:DF 1 "gpc_reg_operand" "")))]
 
25229
-  "TARGET_HARD_FLOAT && ((TARGET_FPRS && TARGET_DOUBLE_FLOAT) || TARGET_E500_DOUBLE)"
 
25230
-  "")
 
25231
-
 
25232
-(define_insn "*absdf2_fpr"
 
25233
-  [(set (match_operand:DF 0 "gpc_reg_operand" "=d")
 
25234
-       (abs:DF (match_operand:DF 1 "gpc_reg_operand" "d")))]
 
25235
-  "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
 
25236
-   && !VECTOR_UNIT_VSX_P (DFmode)"
 
25237
-  "fabs %0,%1"
 
25238
-  [(set_attr "type" "fp")])
 
25239
-
 
25240
-(define_insn "*nabsdf2_fpr"
 
25241
-  [(set (match_operand:DF 0 "gpc_reg_operand" "=d")
 
25242
-       (neg:DF (abs:DF (match_operand:DF 1 "gpc_reg_operand" "d"))))]
 
25243
-  "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
 
25244
-   && !VECTOR_UNIT_VSX_P (DFmode)"
 
25245
-  "fnabs %0,%1"
 
25246
-  [(set_attr "type" "fp")])
 
25247
-
 
25248
-(define_expand "adddf3"
 
25249
-  [(set (match_operand:DF 0 "gpc_reg_operand" "")
 
25250
-       (plus:DF (match_operand:DF 1 "gpc_reg_operand" "")
 
25251
-                (match_operand:DF 2 "gpc_reg_operand" "")))]
 
25252
-  "TARGET_HARD_FLOAT && ((TARGET_FPRS && TARGET_DOUBLE_FLOAT) || TARGET_E500_DOUBLE)"
 
25253
-  "")
 
25254
-
 
25255
-(define_insn "*adddf3_fpr"
 
25256
-  [(set (match_operand:DF 0 "gpc_reg_operand" "=d")
 
25257
-       (plus:DF (match_operand:DF 1 "gpc_reg_operand" "%d")
 
25258
-                (match_operand:DF 2 "gpc_reg_operand" "d")))]
 
25259
-  "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
 
25260
-   && !VECTOR_UNIT_VSX_P (DFmode)"
 
25261
-  "fadd %0,%1,%2"
 
25262
-  [(set_attr "type" "fp")
 
25263
-   (set_attr "fp_type" "fp_addsub_d")])
 
25264
-
 
25265
-(define_expand "subdf3"
 
25266
-  [(set (match_operand:DF 0 "gpc_reg_operand" "")
 
25267
-       (minus:DF (match_operand:DF 1 "gpc_reg_operand" "")
 
25268
-                 (match_operand:DF 2 "gpc_reg_operand" "")))]
 
25269
-  "TARGET_HARD_FLOAT && ((TARGET_FPRS && TARGET_DOUBLE_FLOAT) || TARGET_E500_DOUBLE)"
 
25270
-  "")
 
25271
-
 
25272
-(define_insn "*subdf3_fpr"
 
25273
-  [(set (match_operand:DF 0 "gpc_reg_operand" "=d")
 
25274
-       (minus:DF (match_operand:DF 1 "gpc_reg_operand" "d")
 
25275
-                 (match_operand:DF 2 "gpc_reg_operand" "d")))]
 
25276
-  "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
 
25277
-   && !VECTOR_UNIT_VSX_P (DFmode)"
 
25278
-  "fsub %0,%1,%2"
 
25279
-  [(set_attr "type" "fp")
 
25280
-   (set_attr "fp_type" "fp_addsub_d")])
 
25281
-
 
25282
-(define_expand "muldf3"
 
25283
-  [(set (match_operand:DF 0 "gpc_reg_operand" "")
 
25284
-       (mult:DF (match_operand:DF 1 "gpc_reg_operand" "")
 
25285
-                (match_operand:DF 2 "gpc_reg_operand" "")))]
 
25286
-  "TARGET_HARD_FLOAT && ((TARGET_FPRS && TARGET_DOUBLE_FLOAT) || TARGET_E500_DOUBLE)"
 
25287
-  "")
 
25288
-
 
25289
-(define_insn "*muldf3_fpr"
 
25290
-  [(set (match_operand:DF 0 "gpc_reg_operand" "=d")
 
25291
-       (mult:DF (match_operand:DF 1 "gpc_reg_operand" "%d")
 
25292
-                (match_operand:DF 2 "gpc_reg_operand" "d")))]
 
25293
-  "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
 
25294
-   && !VECTOR_UNIT_VSX_P (DFmode)"
 
25295
-  "fmul %0,%1,%2"
 
25296
-  [(set_attr "type" "dmul")
 
25297
-   (set_attr "fp_type" "fp_mul_d")])
 
25298
-
 
25299
-(define_expand "divdf3"
 
25300
-  [(set (match_operand:DF 0 "gpc_reg_operand" "")
 
25301
-       (div:DF (match_operand:DF 1 "gpc_reg_operand" "")
 
25302
-               (match_operand:DF 2 "gpc_reg_operand" "")))]
 
25303
-  "TARGET_HARD_FLOAT
 
25304
-   && ((TARGET_FPRS && TARGET_DOUBLE_FLOAT) || TARGET_E500_DOUBLE)
 
25305
-   && !TARGET_SIMPLE_FPU"
 
25306
-  "")
 
25307
-
 
25308
-(define_insn "*divdf3_fpr"
 
25309
-  [(set (match_operand:DF 0 "gpc_reg_operand" "=d")
 
25310
-       (div:DF (match_operand:DF 1 "gpc_reg_operand" "d")
 
25311
-               (match_operand:DF 2 "gpc_reg_operand" "d")))]
 
25312
-  "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT && !TARGET_SIMPLE_FPU
 
25313
-   && !VECTOR_UNIT_VSX_P (DFmode)"
 
25314
-  "fdiv %0,%1,%2"
 
25315
-  [(set_attr "type" "ddiv")])
 
25316
-
 
25317
-(define_insn "*fred_fpr"
 
25318
-  [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
 
25319
-       (unspec:DF [(match_operand:DF 1 "gpc_reg_operand" "f")] UNSPEC_FRES))]
 
25320
-  "TARGET_FRE && !VECTOR_UNIT_VSX_P (DFmode)"
 
25321
-  "fre %0,%1"
 
25322
-  [(set_attr "type" "fp")])
 
25323
-
 
25324
-(define_insn "*rsqrtdf_internal1"
 
25325
-  [(set (match_operand:DF 0 "gpc_reg_operand" "=d")
 
25326
-       (unspec:DF [(match_operand:DF 1 "gpc_reg_operand" "d")]
 
25327
-                  UNSPEC_RSQRT))]
 
25328
-  "TARGET_FRSQRTE && !VECTOR_UNIT_VSX_P (DFmode)"
 
25329
-  "frsqrte %0,%1"
 
25330
-  [(set_attr "type" "fp")])
 
25331
-
 
25332
-; builtin fma support
 
25333
-(define_insn "*fmadf4_fpr"
 
25334
-  [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
 
25335
-       (fma:DF (match_operand:DF 1 "gpc_reg_operand" "f")
 
25336
-               (match_operand:DF 2 "gpc_reg_operand" "f")
 
25337
-               (match_operand:DF 3 "gpc_reg_operand" "f")))]
 
25338
-  "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
 
25339
-   && VECTOR_UNIT_NONE_P (DFmode)"
 
25340
-  "fmadd %0,%1,%2,%3"
 
25341
-  [(set_attr "type" "fp")
 
25342
-   (set_attr "fp_type" "fp_maddsub_d")])
 
25343
-
 
25344
-(define_insn "*fmsdf4_fpr"
 
25345
-  [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
 
25346
-       (fma:DF (match_operand:DF 1 "gpc_reg_operand" "f")
 
25347
-               (match_operand:DF 2 "gpc_reg_operand" "f")
 
25348
-               (neg:DF (match_operand:DF 3 "gpc_reg_operand" "f"))))]
 
25349
-  "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
 
25350
-   && VECTOR_UNIT_NONE_P (DFmode)"
 
25351
-  "fmsub %0,%1,%2,%3"
 
25352
-  [(set_attr "type" "fp")
 
25353
-   (set_attr "fp_type" "fp_maddsub_d")])
 
25354
-
 
25355
-(define_insn "*nfmadf4_fpr"
 
25356
-  [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
 
25357
-       (neg:DF (fma:DF (match_operand:DF 1 "gpc_reg_operand" "f")
 
25358
-                       (match_operand:DF 2 "gpc_reg_operand" "f")
 
25359
-                       (match_operand:DF 3 "gpc_reg_operand" "f"))))]
 
25360
-  "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
 
25361
-   && VECTOR_UNIT_NONE_P (DFmode)"
 
25362
-  "fnmadd %0,%1,%2,%3"
 
25363
-  [(set_attr "type" "fp")
 
25364
-   (set_attr "fp_type" "fp_maddsub_d")])
 
25365
-
 
25366
-(define_insn "*nfmsdf4_fpr"
 
25367
-  [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
 
25368
-       (neg:DF (fma:DF (match_operand:DF 1 "gpc_reg_operand" "f")
 
25369
-                       (match_operand:DF 2 "gpc_reg_operand" "f")
 
25370
-                       (neg:DF (match_operand:DF 3 "gpc_reg_operand" "f")))))]
 
25371
-  "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
 
25372
-   && VECTOR_UNIT_NONE_P (DFmode)"
 
25373
-  "fnmsub %0,%1,%2,%3"
 
25374
-  [(set_attr "type" "fp")
 
25375
-   (set_attr "fp_type" "fp_maddsub_d")])
 
25376
-
 
25377
-(define_expand "sqrtdf2"
 
25378
-  [(set (match_operand:DF 0 "gpc_reg_operand" "")
 
25379
-       (sqrt:DF (match_operand:DF 1 "gpc_reg_operand" "")))]
 
25380
-  "TARGET_PPC_GPOPT && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT"
 
25381
-  "")
 
25382
-
 
25383
-(define_insn "*sqrtdf2_fpr"
 
25384
-  [(set (match_operand:DF 0 "gpc_reg_operand" "=d")
 
25385
-       (sqrt:DF (match_operand:DF 1 "gpc_reg_operand" "d")))]
 
25386
-  "TARGET_PPC_GPOPT && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
 
25387
-   && !VECTOR_UNIT_VSX_P (DFmode)"
 
25388
-  "fsqrt %0,%1"
 
25389
-  [(set_attr "type" "dsqrt")])
 
25390
-
 
25391
 ;; The conditional move instructions allow us to perform max and min
 
25392
 ;; operations even when
 
25393
 
 
25394
-(define_expand "smaxdf3"
 
25395
-  [(set (match_operand:DF 0 "gpc_reg_operand" "")
 
25396
-       (if_then_else:DF (ge (match_operand:DF 1 "gpc_reg_operand" "")
 
25397
-                            (match_operand:DF 2 "gpc_reg_operand" ""))
 
25398
-                        (match_dup 1)
 
25399
-                        (match_dup 2)))]
 
25400
-  "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT 
 
25401
-   && !flag_trapping_math"
 
25402
-  "{ rs6000_emit_minmax (operands[0], SMAX, operands[1], operands[2]); DONE;}")
 
25403
-
 
25404
-(define_expand "smindf3"
 
25405
-  [(set (match_operand:DF 0 "gpc_reg_operand" "")
 
25406
-       (if_then_else:DF (ge (match_operand:DF 1 "gpc_reg_operand" "")
 
25407
-                            (match_operand:DF 2 "gpc_reg_operand" ""))
 
25408
-                        (match_dup 2)
 
25409
-                        (match_dup 1)))]
 
25410
-  "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT 
 
25411
-   && !flag_trapping_math"
 
25412
-  "{ rs6000_emit_minmax (operands[0], SMIN, operands[1], operands[2]); DONE;}")
 
25413
-
 
25414
 (define_split
 
25415
   [(set (match_operand:DF 0 "gpc_reg_operand" "")
 
25416
        (match_operator:DF 3 "min_max_operator"
 
25417
@@ -5159,12 +5275,15 @@
 
25418
 ; We don't define lfiwax/lfiwzx with the normal definition, because we
 
25419
 ; don't want to support putting SImode in FPR registers.
 
25420
 (define_insn "lfiwax"
 
25421
-  [(set (match_operand:DI 0 "gpc_reg_operand" "=d")
 
25422
-       (unspec:DI [(match_operand:SI 1 "indexed_or_indirect_operand" "Z")]
 
25423
+  [(set (match_operand:DI 0 "gpc_reg_operand" "=d,wm,!wm")
 
25424
+       (unspec:DI [(match_operand:SI 1 "reg_or_indexed_operand" "Z,Z,r")]
 
25425
                   UNSPEC_LFIWAX))]
 
25426
   "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT && TARGET_LFIWAX"
 
25427
-  "lfiwax %0,%y1"
 
25428
-  [(set_attr "type" "fpload")])
 
25429
+  "@
 
25430
+   lfiwax %0,%y1
 
25431
+   lxsiwax %x0,%y1
 
25432
+   mtvsrwa %x0,%1"
 
25433
+  [(set_attr "type" "fpload,fpload,mffgpr")])
 
25434
 
 
25435
 ; This split must be run before register allocation because it allocates the
 
25436
 ; memory slot that is needed to move values to/from the FPR.  We don't allocate
 
25437
@@ -5186,7 +5305,8 @@
 
25438
   rtx src = operands[1];
 
25439
   rtx tmp;
 
25440
 
 
25441
-  if (!MEM_P (src) && TARGET_MFPGPR && TARGET_POWERPC64)
 
25442
+  if (!MEM_P (src) && TARGET_POWERPC64
 
25443
+      && (TARGET_MFPGPR || TARGET_DIRECT_MOVE))
 
25444
     tmp = convert_to_mode (DImode, src, false);
 
25445
   else
 
25446
     {
 
25447
@@ -5235,12 +5355,15 @@
 
25448
    (set_attr "type" "fpload")])
 
25449
 
 
25450
 (define_insn "lfiwzx"
 
25451
-  [(set (match_operand:DI 0 "gpc_reg_operand" "=d")
 
25452
-       (unspec:DI [(match_operand:SI 1 "indexed_or_indirect_operand" "Z")]
 
25453
+  [(set (match_operand:DI 0 "gpc_reg_operand" "=d,wm,!wm")
 
25454
+       (unspec:DI [(match_operand:SI 1 "reg_or_indexed_operand" "Z,Z,r")]
 
25455
                   UNSPEC_LFIWZX))]
 
25456
   "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT && TARGET_LFIWZX"
 
25457
-  "lfiwzx %0,%y1"
 
25458
-  [(set_attr "type" "fpload")])
 
25459
+  "@
 
25460
+   lfiwzx %0,%y1
 
25461
+   lxsiwzx %x0,%y1
 
25462
+   mtvsrwz %x0,%1"
 
25463
+  [(set_attr "type" "fpload,fpload,mftgpr")])
 
25464
 
 
25465
 (define_insn_and_split "floatunssi<mode>2_lfiwzx"
 
25466
   [(set (match_operand:SFDF 0 "gpc_reg_operand" "=d")
 
25467
@@ -5257,7 +5380,8 @@
 
25468
   rtx src = operands[1];
 
25469
   rtx tmp;
 
25470
 
 
25471
-  if (!MEM_P (src) && TARGET_MFPGPR && TARGET_POWERPC64)
 
25472
+  if (!MEM_P (src) && TARGET_POWERPC64
 
25473
+      && (TARGET_MFPGPR || TARGET_DIRECT_MOVE))
 
25474
     tmp = convert_to_mode (DImode, src, true);
 
25475
   else
 
25476
     {
 
25477
@@ -5548,7 +5672,7 @@
 
25478
       emit_insn (gen_stfiwx (dest, tmp));
 
25479
       DONE;
 
25480
     }
 
25481
-  else if (TARGET_MFPGPR && TARGET_POWERPC64)
 
25482
+  else if (TARGET_POWERPC64 && (TARGET_MFPGPR || TARGET_DIRECT_MOVE))
 
25483
     {
 
25484
       dest = gen_lowpart (DImode, dest);
 
25485
       emit_move_insn (dest, tmp);
 
25486
@@ -5642,7 +5766,7 @@
 
25487
       emit_insn (gen_stfiwx (dest, tmp));
 
25488
       DONE;
 
25489
     }
 
25490
-  else if (TARGET_MFPGPR && TARGET_POWERPC64)
 
25491
+  else if (TARGET_POWERPC64 && (TARGET_MFPGPR || TARGET_DIRECT_MOVE))
 
25492
     {
 
25493
       dest = gen_lowpart (DImode, dest);
 
25494
       emit_move_insn (dest, tmp);
 
25495
@@ -5781,66 +5905,52 @@
 
25496
   [(set (match_operand:DI 0 "gpc_reg_operand" "=d")
 
25497
        (unspec:DI [(match_operand:SFDF 1 "gpc_reg_operand" "<rreg2>")]
 
25498
                   UNSPEC_FCTID))]
 
25499
-  "TARGET_FPRND && TARGET_HARD_FLOAT && TARGET_FPRS && <TARGET_FLOAT>"
 
25500
+  "TARGET_<MODE>_FPR && TARGET_FPRND"
 
25501
   "fctid %0,%1"
 
25502
   [(set_attr "type" "fp")])
 
25503
 
 
25504
-(define_expand "btrunc<mode>2"
 
25505
-  [(set (match_operand:SFDF 0 "gpc_reg_operand" "")
 
25506
-       (unspec:SFDF [(match_operand:SFDF 1 "gpc_reg_operand" "")]
 
25507
+(define_insn "btrunc<mode>2"
 
25508
+  [(set (match_operand:SFDF 0 "gpc_reg_operand" "=<Ff>,<Fv>")
 
25509
+       (unspec:SFDF [(match_operand:SFDF 1 "gpc_reg_operand" "<Ff>,<Fv>")]
 
25510
                     UNSPEC_FRIZ))]
 
25511
-  "TARGET_FPRND && TARGET_HARD_FLOAT && TARGET_FPRS && <TARGET_FLOAT>"
 
25512
-  "")
 
25513
+  "TARGET_<MODE>_FPR && TARGET_FPRND"
 
25514
+  "@
 
25515
+   friz %0,%1
 
25516
+   xsrdpiz %x0,%x1"
 
25517
+  [(set_attr "type" "fp")
 
25518
+   (set_attr "fp_type" "fp_addsub_<Fs>")])
 
25519
 
 
25520
-(define_insn "*btrunc<mode>2_fpr"
 
25521
-  [(set (match_operand:SFDF 0 "gpc_reg_operand" "=<rreg2>")
 
25522
-       (unspec:SFDF [(match_operand:SFDF 1 "gpc_reg_operand" "<rreg2>")]
 
25523
-                    UNSPEC_FRIZ))]
 
25524
-  "TARGET_FPRND && TARGET_HARD_FLOAT && TARGET_FPRS && <TARGET_FLOAT>
 
25525
-   && !VECTOR_UNIT_VSX_P (<MODE>mode)"
 
25526
-  "friz %0,%1"
 
25527
-  [(set_attr "type" "fp")])
 
25528
-
 
25529
-(define_expand "ceil<mode>2"
 
25530
-  [(set (match_operand:SFDF 0 "gpc_reg_operand" "")
 
25531
-       (unspec:SFDF [(match_operand:SFDF 1 "gpc_reg_operand" "")]
 
25532
+(define_insn "ceil<mode>2"
 
25533
+  [(set (match_operand:SFDF 0 "gpc_reg_operand" "=<Ff>,<Fv>")
 
25534
+       (unspec:SFDF [(match_operand:SFDF 1 "gpc_reg_operand" "<Ff>,<Fv>")]
 
25535
                     UNSPEC_FRIP))]
 
25536
-  "TARGET_FPRND && TARGET_HARD_FLOAT && TARGET_FPRS && <TARGET_FLOAT>"
 
25537
-  "")
 
25538
+  "TARGET_<MODE>_FPR && TARGET_FPRND"
 
25539
+  "@
 
25540
+   frip %0,%1
 
25541
+   xsrdpip %x0,%x1"
 
25542
+  [(set_attr "type" "fp")
 
25543
+   (set_attr "fp_type" "fp_addsub_<Fs>")])
 
25544
 
 
25545
-(define_insn "*ceil<mode>2_fpr"
 
25546
-  [(set (match_operand:SFDF 0 "gpc_reg_operand" "=<rreg2>")
 
25547
-       (unspec:SFDF [(match_operand:SFDF 1 "gpc_reg_operand" "<rreg2>")]
 
25548
-                    UNSPEC_FRIP))]
 
25549
-  "TARGET_FPRND && TARGET_HARD_FLOAT && TARGET_FPRS && <TARGET_FLOAT>
 
25550
-   && !VECTOR_UNIT_VSX_P (<MODE>mode)"
 
25551
-  "frip %0,%1"
 
25552
-  [(set_attr "type" "fp")])
 
25553
-
 
25554
-(define_expand "floor<mode>2"
 
25555
-  [(set (match_operand:SFDF 0 "gpc_reg_operand" "")
 
25556
-       (unspec:SFDF [(match_operand:SFDF 1 "gpc_reg_operand" "")]
 
25557
+(define_insn "floor<mode>2"
 
25558
+  [(set (match_operand:SFDF 0 "gpc_reg_operand" "=<Ff>,<Fv>")
 
25559
+       (unspec:SFDF [(match_operand:SFDF 1 "gpc_reg_operand" "<Ff>,<Fv>")]
 
25560
                     UNSPEC_FRIM))]
 
25561
-  "TARGET_FPRND && TARGET_HARD_FLOAT && TARGET_FPRS && <TARGET_FLOAT>"
 
25562
-  "")
 
25563
+  "TARGET_<MODE>_FPR && TARGET_FPRND"
 
25564
+  "@
 
25565
+   frim %0,%1
 
25566
+   xsrdpim %x0,%x1"
 
25567
+  [(set_attr "type" "fp")
 
25568
+   (set_attr "fp_type" "fp_addsub_<Fs>")])
 
25569
 
 
25570
-(define_insn "*floor<mode>2_fpr"
 
25571
-  [(set (match_operand:SFDF 0 "gpc_reg_operand" "=<rreg2>")
 
25572
-       (unspec:SFDF [(match_operand:SFDF 1 "gpc_reg_operand" "<rreg2>")]
 
25573
-                    UNSPEC_FRIM))]
 
25574
-  "TARGET_FPRND && TARGET_HARD_FLOAT && TARGET_FPRS && <TARGET_FLOAT>
 
25575
-   && !VECTOR_UNIT_VSX_P (<MODE>mode)"
 
25576
-  "frim %0,%1"
 
25577
-  [(set_attr "type" "fp")])
 
25578
-
 
25579
 ;; No VSX equivalent to frin
 
25580
 (define_insn "round<mode>2"
 
25581
   [(set (match_operand:SFDF 0 "gpc_reg_operand" "=<rreg2>")
 
25582
        (unspec:SFDF [(match_operand:SFDF 1 "gpc_reg_operand" "<rreg2>")]
 
25583
                     UNSPEC_FRIN))]
 
25584
-  "TARGET_FPRND && TARGET_HARD_FLOAT && TARGET_FPRS && <TARGET_FLOAT>"
 
25585
+  "TARGET_<MODE>_FPR && TARGET_FPRND"
 
25586
   "frin %0,%1"
 
25587
-  [(set_attr "type" "fp")])
 
25588
+  [(set_attr "type" "fp")
 
25589
+   (set_attr "fp_type" "fp_addsub_<Fs>")])
 
25590
 
 
25591
 ; An UNSPEC is used so we don't have to support SImode in FP registers.
 
25592
 (define_insn "stfiwx"
 
25593
@@ -7195,10 +7305,19 @@
 
25594
   [(parallel
 
25595
     [(set (match_operand:DI 0 "gpc_reg_operand" "")
 
25596
          (and:DI (match_operand:DI 1 "gpc_reg_operand" "")
 
25597
-                 (match_operand:DI 2 "and64_2_operand" "")))
 
25598
+                 (match_operand:DI 2 "reg_or_cint_operand" "")))
 
25599
      (clobber (match_scratch:CC 3 ""))])]
 
25600
-  "TARGET_POWERPC64"
 
25601
-  "")
 
25602
+  ""
 
25603
+{
 
25604
+  if (!TARGET_POWERPC64)
 
25605
+    {
 
25606
+      rtx cc = gen_rtx_SCRATCH (CCmode);
 
25607
+      rs6000_split_logical (operands, AND, false, false, false, cc);
 
25608
+      DONE;
 
25609
+    }
 
25610
+  else if (!and64_2_operand (operands[2], DImode))
 
25611
+    operands[2] = force_reg (DImode, operands[2]);
 
25612
+})
 
25613
 
 
25614
 (define_insn "anddi3_mc"
 
25615
   [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,r,r,r")
 
25616
@@ -7379,12 +7498,18 @@
 
25617
 (define_expand "iordi3"
 
25618
   [(set (match_operand:DI 0 "gpc_reg_operand" "")
 
25619
        (ior:DI (match_operand:DI 1 "gpc_reg_operand" "")
 
25620
-               (match_operand:DI 2 "reg_or_logical_cint_operand" "")))]
 
25621
-  "TARGET_POWERPC64"
 
25622
-  "
 
25623
+               (match_operand:DI 2 "reg_or_cint_operand" "")))]
 
25624
+  ""
 
25625
 {
 
25626
-  if (non_logical_cint_operand (operands[2], DImode))
 
25627
+  if (!TARGET_POWERPC64)
 
25628
     {
 
25629
+      rs6000_split_logical (operands, IOR, false, false, false, NULL_RTX);
 
25630
+      DONE;
 
25631
+    }
 
25632
+  else if (!reg_or_logical_cint_operand (operands[2], DImode))
 
25633
+    operands[2] = force_reg (DImode, operands[2]);
 
25634
+  else if (non_logical_cint_operand (operands[2], DImode))
 
25635
+    {
 
25636
       HOST_WIDE_INT value;
 
25637
       rtx tmp = ((!can_create_pseudo_p ()
 
25638
                  || rtx_equal_p (operands[0], operands[1]))
 
25639
@@ -7408,15 +7533,21 @@
 
25640
       emit_insn (gen_iordi3 (operands[0], tmp, GEN_INT (value & 0xffff)));
 
25641
       DONE;
 
25642
     }
 
25643
-}")
 
25644
+})
 
25645
 
 
25646
 (define_expand "xordi3"
 
25647
   [(set (match_operand:DI 0 "gpc_reg_operand" "")
 
25648
        (xor:DI (match_operand:DI 1 "gpc_reg_operand" "")
 
25649
-               (match_operand:DI 2 "reg_or_logical_cint_operand" "")))]
 
25650
-  "TARGET_POWERPC64"
 
25651
-  "
 
25652
+               (match_operand:DI 2 "reg_or_cint_operand" "")))]
 
25653
+  ""
 
25654
 {
 
25655
+  if (!TARGET_POWERPC64)
 
25656
+    {
 
25657
+      rs6000_split_logical (operands, XOR, false, false, false, NULL_RTX);
 
25658
+      DONE;
 
25659
+    }
 
25660
+  else if (!reg_or_logical_cint_operand (operands[2], DImode))
 
25661
+    operands[2] = force_reg (DImode, operands[2]);
 
25662
   if (non_logical_cint_operand (operands[2], DImode))
 
25663
     {
 
25664
       HOST_WIDE_INT value;
 
25665
@@ -7442,7 +7573,7 @@
 
25666
       emit_insn (gen_xordi3 (operands[0], tmp, GEN_INT (value & 0xffff)));
 
25667
       DONE;
 
25668
     }
 
25669
-}")
 
25670
+})
 
25671
 
 
25672
 (define_insn "*booldi3_internal1"
 
25673
   [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r")
 
25674
@@ -7678,7 +7809,385 @@
 
25675
        (compare:CC (match_dup 0)
 
25676
                    (const_int 0)))]
 
25677
   "")
 
25678
+
 
25679
+;; Eqv operation.
 
25680
+(define_insn "*eqv<mode>3"
 
25681
+  [(set (match_operand:GPR 0 "gpc_reg_operand" "=r")
 
25682
+       (not:GPR
 
25683
+        (xor:GPR (match_operand:GPR 1 "gpc_reg_operand" "r")
 
25684
+                 (match_operand:GPR 2 "gpc_reg_operand" "r"))))]
 
25685
+  ""
 
25686
+  "eqv %0,%1,%2"
 
25687
+  [(set_attr "type" "integer")
 
25688
+   (set_attr "length" "4")])
 
25689
+
 
25690
 
 
25691
+;; 128-bit logical operations expanders
 
25692
+
 
25693
+(define_expand "and<mode>3"
 
25694
+  [(parallel [(set (match_operand:BOOL_128 0 "vlogical_operand" "")
 
25695
+                  (and:BOOL_128
 
25696
+                   (match_operand:BOOL_128 1 "vlogical_operand" "")
 
25697
+                   (match_operand:BOOL_128 2 "vlogical_operand" "")))
 
25698
+             (clobber (match_scratch:CC 3 ""))])]
 
25699
+  ""
 
25700
+  "")
 
25701
+
 
25702
+(define_expand "ior<mode>3"
 
25703
+  [(set (match_operand:BOOL_128 0 "vlogical_operand" "")
 
25704
+        (ior:BOOL_128 (match_operand:BOOL_128 1 "vlogical_operand" "")
 
25705
+                     (match_operand:BOOL_128 2 "vlogical_operand" "")))]
 
25706
+  ""
 
25707
+  "")
 
25708
+
 
25709
+(define_expand "xor<mode>3"
 
25710
+  [(set (match_operand:BOOL_128 0 "vlogical_operand" "")
 
25711
+        (xor:BOOL_128 (match_operand:BOOL_128 1 "vlogical_operand" "")
 
25712
+                     (match_operand:BOOL_128 2 "vlogical_operand" "")))]
 
25713
+  ""
 
25714
+  "")
 
25715
+
 
25716
+(define_expand "one_cmpl<mode>2"
 
25717
+  [(set (match_operand:BOOL_128 0 "vlogical_operand" "")
 
25718
+        (not:BOOL_128 (match_operand:BOOL_128 1 "vlogical_operand" "")))]
 
25719
+  ""
 
25720
+  "")
 
25721
+
 
25722
+(define_expand "nor<mode>3"
 
25723
+  [(set (match_operand:BOOL_128 0 "vlogical_operand" "")
 
25724
+       (and:BOOL_128
 
25725
+        (not:BOOL_128 (match_operand:BOOL_128 1 "vlogical_operand" ""))
 
25726
+        (not:BOOL_128 (match_operand:BOOL_128 2 "vlogical_operand" ""))))]
 
25727
+  ""
 
25728
+  "")
 
25729
+
 
25730
+(define_expand "andc<mode>3"
 
25731
+  [(set (match_operand:BOOL_128 0 "vlogical_operand" "")
 
25732
+        (and:BOOL_128
 
25733
+        (not:BOOL_128 (match_operand:BOOL_128 2 "vlogical_operand" ""))
 
25734
+        (match_operand:BOOL_128 1 "vlogical_operand" "")))]
 
25735
+  ""
 
25736
+  "")
 
25737
+
 
25738
+;; Power8 vector logical instructions.
 
25739
+(define_expand "eqv<mode>3"
 
25740
+  [(set (match_operand:BOOL_128 0 "vlogical_operand" "")
 
25741
+       (not:BOOL_128
 
25742
+        (xor:BOOL_128 (match_operand:BOOL_128 1 "vlogical_operand" "")
 
25743
+                      (match_operand:BOOL_128 2 "vlogical_operand" ""))))]
 
25744
+  "<MODE>mode == TImode || <MODE>mode == PTImode || TARGET_P8_VECTOR"
 
25745
+  "")
 
25746
+
 
25747
+;; Rewrite nand into canonical form
 
25748
+(define_expand "nand<mode>3"
 
25749
+  [(set (match_operand:BOOL_128 0 "vlogical_operand" "")
 
25750
+       (ior:BOOL_128
 
25751
+        (not:BOOL_128 (match_operand:BOOL_128 1 "vlogical_operand" ""))
 
25752
+        (not:BOOL_128 (match_operand:BOOL_128 2 "vlogical_operand" ""))))]
 
25753
+  "<MODE>mode == TImode || <MODE>mode == PTImode || TARGET_P8_VECTOR"
 
25754
+  "")
 
25755
+
 
25756
+;; The canonical form is to have the negated element first, so we need to
 
25757
+;; reverse arguments.
 
25758
+(define_expand "orc<mode>3"
 
25759
+  [(set (match_operand:BOOL_128 0 "vlogical_operand" "")
 
25760
+       (ior:BOOL_128
 
25761
+        (not:BOOL_128 (match_operand:BOOL_128 2 "vlogical_operand" ""))
 
25762
+        (match_operand:BOOL_128 1 "vlogical_operand" "")))]
 
25763
+  "<MODE>mode == TImode || <MODE>mode == PTImode || TARGET_P8_VECTOR"
 
25764
+  "")
 
25765
+
 
25766
+;; 128-bit logical operations insns and split operations
 
25767
+(define_insn_and_split "*and<mode>3_internal"
 
25768
+  [(set (match_operand:BOOL_128 0 "vlogical_operand" "=<BOOL_REGS_OUTPUT>")
 
25769
+        (and:BOOL_128
 
25770
+        (match_operand:BOOL_128 1 "vlogical_operand" "%<BOOL_REGS_OP1>")
 
25771
+        (match_operand:BOOL_128 2 "vlogical_operand" "<BOOL_REGS_OP2>")))
 
25772
+   (clobber (match_scratch:CC 3 "<BOOL_REGS_AND_CR0>"))]
 
25773
+  ""
 
25774
+{
 
25775
+  if (TARGET_VSX && vsx_register_operand (operands[0], <MODE>mode))
 
25776
+    return "xxland %x0,%x1,%x2";
 
25777
+
 
25778
+  if (TARGET_ALTIVEC && altivec_register_operand (operands[0], <MODE>mode))
 
25779
+    return "vand %0,%1,%2";
 
25780
+
 
25781
+  return "#";
 
25782
+}
 
25783
+  "reload_completed && int_reg_operand (operands[0], <MODE>mode)"
 
25784
+  [(const_int 0)]
 
25785
+{
 
25786
+  rs6000_split_logical (operands, AND, false, false, false, operands[3]);
 
25787
+  DONE;
 
25788
+}
 
25789
+  [(set (attr "type")
 
25790
+      (if_then_else
 
25791
+       (match_test "vsx_register_operand (operands[0], <MODE>mode)")
 
25792
+       (const_string "vecsimple")
 
25793
+       (const_string "integer")))
 
25794
+   (set (attr "length")
 
25795
+      (if_then_else
 
25796
+       (match_test "vsx_register_operand (operands[0], <MODE>mode)")
 
25797
+       (const_string "4")
 
25798
+       (if_then_else
 
25799
+        (match_test "TARGET_POWERPC64")
 
25800
+        (const_string "8")
 
25801
+        (const_string "16"))))])
 
25802
+
 
25803
+;; 128-bit IOR/XOR
 
25804
+(define_insn_and_split "*bool<mode>3_internal"
 
25805
+  [(set (match_operand:BOOL_128 0 "vlogical_operand" "=<BOOL_REGS_OUTPUT>")
 
25806
+       (match_operator:BOOL_128 3 "boolean_or_operator"
 
25807
+        [(match_operand:BOOL_128 1 "vlogical_operand" "%<BOOL_REGS_OP1>")
 
25808
+         (match_operand:BOOL_128 2 "vlogical_operand" "<BOOL_REGS_OP2>")]))]
 
25809
+  ""
 
25810
+{
 
25811
+  if (TARGET_VSX && vsx_register_operand (operands[0], <MODE>mode))
 
25812
+    return "xxl%q3 %x0,%x1,%x2";
 
25813
+
 
25814
+  if (TARGET_ALTIVEC && altivec_register_operand (operands[0], <MODE>mode))
 
25815
+    return "v%q3 %0,%1,%2";
 
25816
+
 
25817
+  return "#";
 
25818
+}
 
25819
+  "reload_completed && int_reg_operand (operands[0], <MODE>mode)"
 
25820
+  [(const_int 0)]
 
25821
+{
 
25822
+  rs6000_split_logical (operands, GET_CODE (operands[3]), false, false, false,
 
25823
+                       NULL_RTX);
 
25824
+  DONE;
 
25825
+}
 
25826
+  [(set (attr "type")
 
25827
+      (if_then_else
 
25828
+       (match_test "vsx_register_operand (operands[0], <MODE>mode)")
 
25829
+       (const_string "vecsimple")
 
25830
+       (const_string "integer")))
 
25831
+   (set (attr "length")
 
25832
+      (if_then_else
 
25833
+       (match_test "vsx_register_operand (operands[0], <MODE>mode)")
 
25834
+       (const_string "4")
 
25835
+       (if_then_else
 
25836
+        (match_test "TARGET_POWERPC64")
 
25837
+        (const_string "8")
 
25838
+        (const_string "16"))))])
 
25839
+
 
25840
+;; 128-bit ANDC/ORC
 
25841
+(define_insn_and_split "*boolc<mode>3_internal1"
 
25842
+  [(set (match_operand:BOOL_128 0 "vlogical_operand" "=<BOOL_REGS_OUTPUT>")
 
25843
+       (match_operator:BOOL_128 3 "boolean_operator"
 
25844
+        [(not:BOOL_128
 
25845
+          (match_operand:BOOL_128 2 "vlogical_operand" "<BOOL_REGS_OP1>"))
 
25846
+         (match_operand:BOOL_128 1 "vlogical_operand" "<BOOL_REGS_OP2>")]))]
 
25847
+  "TARGET_P8_VECTOR || (GET_CODE (operands[3]) == AND)"
 
25848
+{
 
25849
+  if (TARGET_VSX && vsx_register_operand (operands[0], <MODE>mode))
 
25850
+    return "xxl%q3 %x0,%x1,%x2";
 
25851
+
 
25852
+  if (TARGET_ALTIVEC && altivec_register_operand (operands[0], <MODE>mode))
 
25853
+    return "v%q3 %0,%1,%2";
 
25854
+
 
25855
+  return "#";
 
25856
+}
 
25857
+  "(TARGET_P8_VECTOR || (GET_CODE (operands[3]) == AND))
 
25858
+   && reload_completed && int_reg_operand (operands[0], <MODE>mode)"
 
25859
+  [(const_int 0)]
 
25860
+{
 
25861
+  rs6000_split_logical (operands, GET_CODE (operands[3]), false, true, false,
 
25862
+                       NULL_RTX);
 
25863
+  DONE;
 
25864
+}
 
25865
+  [(set (attr "type")
 
25866
+      (if_then_else
 
25867
+       (match_test "vsx_register_operand (operands[0], <MODE>mode)")
 
25868
+       (const_string "vecsimple")
 
25869
+       (const_string "integer")))
 
25870
+   (set (attr "length")
 
25871
+      (if_then_else
 
25872
+       (match_test "vsx_register_operand (operands[0], <MODE>mode)")
 
25873
+       (const_string "4")
 
25874
+       (if_then_else
 
25875
+        (match_test "TARGET_POWERPC64")
 
25876
+        (const_string "8")
 
25877
+        (const_string "16"))))])
 
25878
+
 
25879
+(define_insn_and_split "*boolc<mode>3_internal2"
 
25880
+  [(set (match_operand:TI2 0 "int_reg_operand" "=&r,r,r")
 
25881
+       (match_operator:TI2 3 "boolean_operator"
 
25882
+        [(not:TI2
 
25883
+          (match_operand:TI2 1 "int_reg_operand" "r,0,r"))
 
25884
+         (match_operand:TI2 2 "int_reg_operand" "r,r,0")]))]
 
25885
+  "!TARGET_P8_VECTOR && (GET_CODE (operands[3]) != AND)"
 
25886
+  "#"
 
25887
+  "reload_completed && !TARGET_P8_VECTOR && (GET_CODE (operands[3]) != AND)"
 
25888
+  [(const_int 0)]
 
25889
+{
 
25890
+  rs6000_split_logical (operands, GET_CODE (operands[3]), false, true, false,
 
25891
+                       NULL_RTX);
 
25892
+  DONE;
 
25893
+}
 
25894
+  [(set_attr "type" "integer")
 
25895
+   (set (attr "length")
 
25896
+       (if_then_else
 
25897
+        (match_test "TARGET_POWERPC64")
 
25898
+        (const_string "8")
 
25899
+        (const_string "16")))])
 
25900
+
 
25901
+;; 128-bit NAND/NOR
 
25902
+(define_insn_and_split "*boolcc<mode>3_internal1"
 
25903
+  [(set (match_operand:BOOL_128 0 "vlogical_operand" "=<BOOL_REGS_OUTPUT>")
 
25904
+       (match_operator:BOOL_128 3 "boolean_operator"
 
25905
+        [(not:BOOL_128
 
25906
+          (match_operand:BOOL_128 1 "vlogical_operand" "<BOOL_REGS_OP1>"))
 
25907
+         (not:BOOL_128
 
25908
+          (match_operand:BOOL_128 2 "vlogical_operand" "<BOOL_REGS_OP2>"))]))]
 
25909
+  "TARGET_P8_VECTOR || (GET_CODE (operands[3]) == AND)"
 
25910
+{
 
25911
+  if (TARGET_VSX && vsx_register_operand (operands[0], <MODE>mode))
 
25912
+    return "xxl%q3 %x0,%x1,%x2";
 
25913
+
 
25914
+  if (TARGET_ALTIVEC && altivec_register_operand (operands[0], <MODE>mode))
 
25915
+    return "v%q3 %0,%1,%2";
 
25916
+
 
25917
+  return "#";
 
25918
+}
 
25919
+  "(TARGET_P8_VECTOR || (GET_CODE (operands[3]) == AND))
 
25920
+   && reload_completed && int_reg_operand (operands[0], <MODE>mode)"
 
25921
+  [(const_int 0)]
 
25922
+{
 
25923
+  rs6000_split_logical (operands, GET_CODE (operands[3]), false, true, true,
 
25924
+                       NULL_RTX);
 
25925
+  DONE;
 
25926
+}
 
25927
+  [(set (attr "type")
 
25928
+      (if_then_else
 
25929
+       (match_test "vsx_register_operand (operands[0], <MODE>mode)")
 
25930
+       (const_string "vecsimple")
 
25931
+       (const_string "integer")))
 
25932
+   (set (attr "length")
 
25933
+      (if_then_else
 
25934
+       (match_test "vsx_register_operand (operands[0], <MODE>mode)")
 
25935
+       (const_string "4")
 
25936
+       (if_then_else
 
25937
+        (match_test "TARGET_POWERPC64")
 
25938
+        (const_string "8")
 
25939
+        (const_string "16"))))])
 
25940
+
 
25941
+(define_insn_and_split "*boolcc<mode>3_internal2"
 
25942
+  [(set (match_operand:TI2 0 "int_reg_operand" "=&r,r,r")
 
25943
+       (match_operator:TI2 3 "boolean_operator"
 
25944
+        [(not:TI2
 
25945
+          (match_operand:TI2 1 "int_reg_operand" "r,0,r"))
 
25946
+         (not:TI2
 
25947
+          (match_operand:TI2 2 "int_reg_operand" "r,r,0"))]))]
 
25948
+  "!TARGET_P8_VECTOR && (GET_CODE (operands[3]) != AND)"
 
25949
+  "#"
 
25950
+  "reload_completed && !TARGET_P8_VECTOR && (GET_CODE (operands[3]) != AND)"
 
25951
+  [(const_int 0)]
 
25952
+{
 
25953
+  rs6000_split_logical (operands, GET_CODE (operands[3]), false, true, true,
 
25954
+                       NULL_RTX);
 
25955
+  DONE;
 
25956
+}
 
25957
+  [(set_attr "type" "integer")
 
25958
+   (set (attr "length")
 
25959
+       (if_then_else
 
25960
+        (match_test "TARGET_POWERPC64")
 
25961
+        (const_string "8")
 
25962
+        (const_string "16")))])
 
25963
+
 
25964
+
 
25965
+;; 128-bit EQV
 
25966
+(define_insn_and_split "*eqv<mode>3_internal1"
 
25967
+  [(set (match_operand:BOOL_128 0 "vlogical_operand" "=<BOOL_REGS_OUTPUT>")
 
25968
+       (not:BOOL_128
 
25969
+        (xor:BOOL_128
 
25970
+         (match_operand:BOOL_128 1 "vlogical_operand" "<BOOL_REGS_OP1>")
 
25971
+         (match_operand:BOOL_128 2 "vlogical_operand" "<BOOL_REGS_OP2>"))))]
 
25972
+  "TARGET_P8_VECTOR"
 
25973
+{
 
25974
+  if (vsx_register_operand (operands[0], <MODE>mode))
 
25975
+    return "xxleqv %x0,%x1,%x2";
 
25976
+
 
25977
+  return "#";
 
25978
+}
 
25979
+  "TARGET_P8_VECTOR && reload_completed
 
25980
+   && int_reg_operand (operands[0], <MODE>mode)"
 
25981
+  [(const_int 0)]
 
25982
+{
 
25983
+  rs6000_split_logical (operands, XOR, true, false, false, NULL_RTX);
 
25984
+  DONE;
 
25985
+}
 
25986
+  [(set (attr "type")
 
25987
+      (if_then_else
 
25988
+       (match_test "vsx_register_operand (operands[0], <MODE>mode)")
 
25989
+       (const_string "vecsimple")
 
25990
+       (const_string "integer")))
 
25991
+   (set (attr "length")
 
25992
+      (if_then_else
 
25993
+       (match_test "vsx_register_operand (operands[0], <MODE>mode)")
 
25994
+       (const_string "4")
 
25995
+       (if_then_else
 
25996
+        (match_test "TARGET_POWERPC64")
 
25997
+        (const_string "8")
 
25998
+        (const_string "16"))))])
 
25999
+
 
26000
+(define_insn_and_split "*eqv<mode>3_internal2"
 
26001
+  [(set (match_operand:TI2 0 "int_reg_operand" "=&r,r,r")
 
26002
+       (not:TI2
 
26003
+        (xor:TI2
 
26004
+         (match_operand:TI2 1 "int_reg_operand" "r,0,r")
 
26005
+         (match_operand:TI2 2 "int_reg_operand" "r,r,0"))))]
 
26006
+  "!TARGET_P8_VECTOR"
 
26007
+  "#"
 
26008
+  "reload_completed && !TARGET_P8_VECTOR"
 
26009
+  [(const_int 0)]
 
26010
+{
 
26011
+  rs6000_split_logical (operands, XOR, true, false, false, NULL_RTX);
 
26012
+  DONE;
 
26013
+}
 
26014
+  [(set_attr "type" "integer")
 
26015
+   (set (attr "length")
 
26016
+       (if_then_else
 
26017
+        (match_test "TARGET_POWERPC64")
 
26018
+        (const_string "8")
 
26019
+        (const_string "16")))])
 
26020
+
 
26021
+;; 128-bit one's complement
 
26022
+(define_insn_and_split "*one_cmpl<mode>3_internal"
 
26023
+  [(set (match_operand:BOOL_128 0 "vlogical_operand" "=<BOOL_REGS_OUTPUT>")
 
26024
+       (not:BOOL_128
 
26025
+         (match_operand:BOOL_128 1 "vlogical_operand" "<BOOL_REGS_UNARY>")))]
 
26026
+  ""
 
26027
+{
 
26028
+  if (TARGET_VSX && vsx_register_operand (operands[0], <MODE>mode))
 
26029
+    return "xxlnor %x0,%x1,%x1";
 
26030
+
 
26031
+  if (TARGET_ALTIVEC && altivec_register_operand (operands[0], <MODE>mode))
 
26032
+    return "vnor %0,%1,%1";
 
26033
+
 
26034
+  return "#";
 
26035
+}
 
26036
+  "reload_completed && int_reg_operand (operands[0], <MODE>mode)"
 
26037
+  [(const_int 0)]
 
26038
+{
 
26039
+  rs6000_split_logical (operands, NOT, false, false, false, NULL_RTX);
 
26040
+  DONE;
 
26041
+}
 
26042
+  [(set (attr "type")
 
26043
+      (if_then_else
 
26044
+       (match_test "vsx_register_operand (operands[0], <MODE>mode)")
 
26045
+       (const_string "vecsimple")
 
26046
+       (const_string "integer")))
 
26047
+   (set (attr "length")
 
26048
+      (if_then_else
 
26049
+       (match_test "vsx_register_operand (operands[0], <MODE>mode)")
 
26050
+       (const_string "4")
 
26051
+       (if_then_else
 
26052
+        (match_test "TARGET_POWERPC64")
 
26053
+        (const_string "8")
 
26054
+        (const_string "16"))))])
 
26055
+
 
26056
+
 
26057
 ;; Now define ways of moving data around.
 
26058
 
 
26059
 ;; Set up a register with a value from the GOT table
 
26060
@@ -7765,7 +8274,31 @@
 
26061
    mt%0 %1
 
26062
    mt%0 %1
 
26063
    nop"
 
26064
-  [(set_attr "type" "*,*,load,store,*,*,*,mfjmpr,mtjmpr,*,*")
 
26065
+  [(set_attr_alternative "type"
 
26066
+      [(const_string "*")
 
26067
+       (const_string "*")
 
26068
+       (if_then_else
 
26069
+        (match_test "update_indexed_address_mem (operands[1], VOIDmode)")
 
26070
+        (const_string "load_ux")
 
26071
+        (if_then_else
 
26072
+          (match_test "update_address_mem (operands[1], VOIDmode)")
 
26073
+          (const_string "load_u")
 
26074
+          (const_string "load")))
 
26075
+       (if_then_else
 
26076
+        (match_test "update_indexed_address_mem (operands[0], VOIDmode)")
 
26077
+        (const_string "store_ux")
 
26078
+        (if_then_else
 
26079
+          (match_test "update_address_mem (operands[0], VOIDmode)")
 
26080
+          (const_string "store_u")
 
26081
+          (const_string "store")))
 
26082
+       (const_string "*")
 
26083
+       (const_string "*")
 
26084
+       (const_string "*")
 
26085
+       (const_string "mfjmpr")
 
26086
+       (const_string "mtjmpr")
 
26087
+       (const_string "*")
 
26088
+       (const_string "*")])
 
26089
+
 
26090
    (set_attr "length" "4,4,4,4,4,4,8,4,4,4,4")])
 
26091
 
 
26092
 (define_insn "*movsi_internal1_single"
 
26093
@@ -7787,7 +8320,44 @@
 
26094
    nop
 
26095
    stfs%U0%X0 %1,%0
 
26096
    lfs%U1%X1 %0,%1"
 
26097
-  [(set_attr "type" "*,*,load,store,*,*,*,mfjmpr,mtjmpr,*,*,*,*")
 
26098
+  [(set_attr_alternative "type"
 
26099
+      [(const_string "*")
 
26100
+       (const_string "*")
 
26101
+       (if_then_else
 
26102
+        (match_test "update_indexed_address_mem (operands[1], VOIDmode)")
 
26103
+        (const_string "load_ux")
 
26104
+        (if_then_else
 
26105
+          (match_test "update_address_mem (operands[1], VOIDmode)")
 
26106
+          (const_string "load_u")
 
26107
+          (const_string "load")))
 
26108
+       (if_then_else
 
26109
+        (match_test "update_indexed_address_mem (operands[0], VOIDmode)")
 
26110
+        (const_string "store_ux")
 
26111
+        (if_then_else
 
26112
+          (match_test "update_address_mem (operands[0], VOIDmode)")
 
26113
+          (const_string "store_u")
 
26114
+          (const_string "store")))
 
26115
+       (const_string "*")
 
26116
+       (const_string "*")
 
26117
+       (const_string "*")
 
26118
+       (const_string "mfjmpr")
 
26119
+       (const_string "mtjmpr")
 
26120
+       (const_string "*")
 
26121
+       (const_string "*")
 
26122
+       (if_then_else
 
26123
+        (match_test "update_indexed_address_mem (operands[0], VOIDmode)")
 
26124
+        (const_string "fpstore_ux")
 
26125
+        (if_then_else
 
26126
+          (match_test "update_address_mem (operands[0], VOIDmode)")
 
26127
+          (const_string "fpstore_u")
 
26128
+          (const_string "fpstore")))
 
26129
+       (if_then_else
 
26130
+        (match_test "update_indexed_address_mem (operands[1], VOIDmode)")
 
26131
+        (const_string "fpload_ux")
 
26132
+        (if_then_else
 
26133
+          (match_test "update_address_mem (operands[1], VOIDmode)")
 
26134
+          (const_string "fpload_u")
 
26135
+          (const_string "fpload")))])
 
26136
    (set_attr "length" "4,4,4,4,4,4,8,4,4,4,4,4,4")])
 
26137
 
 
26138
 ;; Split a load of a large constant into the appropriate two-insn
 
26139
@@ -7822,7 +8392,7 @@
 
26140
    cmp<wd>i %2,%0,0
 
26141
    mr. %0,%1
 
26142
    #"
 
26143
-  [(set_attr "type" "cmp,compare,cmp")
 
26144
+  [(set_attr "type" "cmp,fast_compare,cmp")
 
26145
    (set_attr "length" "4,4,8")])
 
26146
 
 
26147
 (define_split
 
26148
@@ -7850,7 +8420,26 @@
 
26149
    mf%1 %0
 
26150
    mt%0 %1
 
26151
    nop"
 
26152
-  [(set_attr "type" "*,load,store,*,mfjmpr,mtjmpr,*")])
 
26153
+  [(set_attr_alternative "type"
 
26154
+      [(const_string "*")
 
26155
+       (if_then_else
 
26156
+        (match_test "update_indexed_address_mem (operands[1], VOIDmode)")
 
26157
+        (const_string "load_ux")
 
26158
+        (if_then_else
 
26159
+          (match_test "update_address_mem (operands[1], VOIDmode)")
 
26160
+          (const_string "load_u")
 
26161
+          (const_string "load")))
 
26162
+       (if_then_else
 
26163
+        (match_test "update_indexed_address_mem (operands[0], VOIDmode)")
 
26164
+        (const_string "store_ux")
 
26165
+        (if_then_else
 
26166
+          (match_test "update_address_mem (operands[0], VOIDmode)")
 
26167
+          (const_string "store_u")
 
26168
+          (const_string "store")))
 
26169
+       (const_string "*")
 
26170
+       (const_string "mfjmpr")
 
26171
+       (const_string "mtjmpr")
 
26172
+       (const_string "*")])])
 
26173
 
 
26174
 (define_expand "mov<mode>"
 
26175
   [(set (match_operand:INT 0 "general_operand" "")
 
26176
@@ -7871,7 +8460,26 @@
 
26177
    mf%1 %0
 
26178
    mt%0 %1
 
26179
    nop"
 
26180
-  [(set_attr "type" "*,load,store,*,mfjmpr,mtjmpr,*")])
 
26181
+  [(set_attr_alternative "type"
 
26182
+      [(const_string "*")
 
26183
+       (if_then_else
 
26184
+        (match_test "update_indexed_address_mem (operands[1], VOIDmode)")
 
26185
+        (const_string "load_ux")
 
26186
+        (if_then_else
 
26187
+          (match_test "update_address_mem (operands[1], VOIDmode)")
 
26188
+          (const_string "load_u")
 
26189
+          (const_string "load")))
 
26190
+       (if_then_else
 
26191
+        (match_test "update_indexed_address_mem (operands[0], VOIDmode)")
 
26192
+        (const_string "store_ux")
 
26193
+        (if_then_else
 
26194
+          (match_test "update_address_mem (operands[0], VOIDmode)")
 
26195
+          (const_string "store_u")
 
26196
+          (const_string "store")))
 
26197
+       (const_string "*")
 
26198
+       (const_string "mfjmpr")
 
26199
+       (const_string "mtjmpr")
 
26200
+       (const_string "*")])])
 
26201
 
 
26202
 ;; Here is how to move condition codes around.  When we store CC data in
 
26203
 ;; an integer register or memory, we store just the high-order 4 bits.
 
26204
@@ -7899,7 +8507,7 @@
 
26205
    mf%1 %0
 
26206
    mt%0 %1
 
26207
    lwz%U1%X1 %0,%1
 
26208
-   stw%U0%U1 %1,%0"
 
26209
+   stw%U0%X0 %1,%0"
 
26210
   [(set (attr "type")
 
26211
      (cond [(eq_attr "alternative" "0,3")
 
26212
                (const_string "cr_logical")
 
26213
@@ -7912,9 +8520,23 @@
 
26214
            (eq_attr "alternative" "9")
 
26215
                (const_string "mtjmpr")
 
26216
            (eq_attr "alternative" "10")
 
26217
-               (const_string "load")
 
26218
+               (if_then_else
 
26219
+                 (match_test "update_indexed_address_mem (operands[1],
 
26220
+                                                          VOIDmode)")
 
26221
+                 (const_string "load_ux")
 
26222
+                 (if_then_else
 
26223
+                   (match_test "update_address_mem (operands[1], VOIDmode)")
 
26224
+                   (const_string "load_u")
 
26225
+                   (const_string "load")))
 
26226
            (eq_attr "alternative" "11")
 
26227
-               (const_string "store")
 
26228
+               (if_then_else
 
26229
+                 (match_test "update_indexed_address_mem (operands[0],
 
26230
+                                                          VOIDmode)")
 
26231
+                 (const_string "store_ux")
 
26232
+                 (if_then_else
 
26233
+                   (match_test "update_address_mem (operands[0], VOIDmode)")
 
26234
+                   (const_string "store_u")
 
26235
+                   (const_string "store")))
 
26236
            (match_test "TARGET_MFCRF")
 
26237
                (const_string "mfcrf")
 
26238
           ]
 
26239
@@ -7926,15 +8548,17 @@
 
26240
 ;; can produce floating-point values in fixed-point registers.  Unless the
 
26241
 ;; value is a simple constant or already in memory, we deal with this by
 
26242
 ;; allocating memory and copying the value explicitly via that memory location.
 
26243
-(define_expand "movsf"
 
26244
-  [(set (match_operand:SF 0 "nonimmediate_operand" "")
 
26245
-       (match_operand:SF 1 "any_operand" ""))]
 
26246
-  ""
 
26247
-  "{ rs6000_emit_move (operands[0], operands[1], SFmode); DONE; }")
 
26248
 
 
26249
+;; Move 32-bit binary/decimal floating point
 
26250
+(define_expand "mov<mode>"
 
26251
+  [(set (match_operand:FMOVE32 0 "nonimmediate_operand" "")
 
26252
+       (match_operand:FMOVE32 1 "any_operand" ""))]
 
26253
+  "<fmove_ok>"
 
26254
+  "{ rs6000_emit_move (operands[0], operands[1], <MODE>mode); DONE; }")
 
26255
+
 
26256
 (define_split
 
26257
-  [(set (match_operand:SF 0 "gpc_reg_operand" "")
 
26258
-       (match_operand:SF 1 "const_double_operand" ""))]
 
26259
+  [(set (match_operand:FMOVE32 0 "gpc_reg_operand" "")
 
26260
+       (match_operand:FMOVE32 1 "const_double_operand" ""))]
 
26261
   "reload_completed
 
26262
    && ((GET_CODE (operands[0]) == REG && REGNO (operands[0]) <= 31)
 
26263
        || (GET_CODE (operands[0]) == SUBREG
 
26264
@@ -7947,42 +8571,89 @@
 
26265
   REAL_VALUE_TYPE rv;
 
26266
 
 
26267
   REAL_VALUE_FROM_CONST_DOUBLE (rv, operands[1]);
 
26268
-  REAL_VALUE_TO_TARGET_SINGLE (rv, l);
 
26269
+  <real_value_to_target> (rv, l);
 
26270
 
 
26271
   if (! TARGET_POWERPC64)
 
26272
-    operands[2] = operand_subword (operands[0], 0, 0, SFmode);
 
26273
+    operands[2] = operand_subword (operands[0], 0, 0, <MODE>mode);
 
26274
   else
 
26275
     operands[2] = gen_lowpart (SImode, operands[0]);
 
26276
 
 
26277
   operands[3] = gen_int_mode (l, SImode);
 
26278
 }")
 
26279
 
 
26280
-(define_insn "*movsf_hardfloat"
 
26281
-  [(set (match_operand:SF 0 "nonimmediate_operand" "=!r,!r,m,f,f,m,*c*l,!r,*h,!r,!r")
 
26282
-       (match_operand:SF 1 "input_operand" "r,m,r,f,m,f,r,h,0,G,Fn"))]
 
26283
-  "(gpc_reg_operand (operands[0], SFmode)
 
26284
-   || gpc_reg_operand (operands[1], SFmode))
 
26285
+(define_insn "mov<mode>_hardfloat"
 
26286
+  [(set (match_operand:FMOVE32 0 "nonimmediate_operand" "=!r,!r,m,f,wa,wa,<f32_lr>,<f32_sm>,wu,Z,?<f32_dm>,?r,*c*l,!r,*h,!r,!r")
 
26287
+       (match_operand:FMOVE32 1 "input_operand" "r,m,r,f,wa,j,<f32_lm>,<f32_sr>,Z,wu,r,<f32_dm>,r,h,0,G,Fn"))]
 
26288
+  "(gpc_reg_operand (operands[0], <MODE>mode)
 
26289
+   || gpc_reg_operand (operands[1], <MODE>mode))
 
26290
    && (TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT)"
 
26291
   "@
 
26292
    mr %0,%1
 
26293
    lwz%U1%X1 %0,%1
 
26294
    stw%U0%X0 %1,%0
 
26295
    fmr %0,%1
 
26296
-   lfs%U1%X1 %0,%1
 
26297
-   stfs%U0%X0 %1,%0
 
26298
+   xxlor %x0,%x1,%x1
 
26299
+   xxlxor %x0,%x0,%x0
 
26300
+   <f32_li>
 
26301
+   <f32_si>
 
26302
+   <f32_lv>
 
26303
+   <f32_sv>
 
26304
+   mtvsrwz %x0,%1
 
26305
+   mfvsrwz %0,%x1
 
26306
    mt%0 %1
 
26307
    mf%1 %0
 
26308
    nop
 
26309
    #
 
26310
    #"
 
26311
-  [(set_attr "type" "*,load,store,fp,fpload,fpstore,mtjmpr,mfjmpr,*,*,*")
 
26312
-   (set_attr "length" "4,4,4,4,4,4,4,4,4,4,8")])
 
26313
+  [(set_attr_alternative "type"
 
26314
+      [(const_string "*")
 
26315
+       (if_then_else
 
26316
+        (match_test "update_indexed_address_mem (operands[1], VOIDmode)")
 
26317
+        (const_string "load_ux")
 
26318
+        (if_then_else
 
26319
+          (match_test "update_address_mem (operands[1], VOIDmode)")
 
26320
+          (const_string "load_u")
 
26321
+          (const_string "load")))
 
26322
+       (if_then_else
 
26323
+        (match_test "update_indexed_address_mem (operands[0], VOIDmode)")
 
26324
+        (const_string "store_ux")
 
26325
+        (if_then_else
 
26326
+          (match_test "update_address_mem (operands[0], VOIDmode)")
 
26327
+          (const_string "store_u")
 
26328
+          (const_string "store")))
 
26329
+       (const_string "fp")
 
26330
+       (const_string "vecsimple")
 
26331
+       (const_string "vecsimple")
 
26332
+       (if_then_else
 
26333
+        (match_test "update_indexed_address_mem (operands[1], VOIDmode)")
 
26334
+        (const_string "fpload_ux")
 
26335
+        (if_then_else
 
26336
+          (match_test "update_address_mem (operands[1], VOIDmode)")
 
26337
+          (const_string "fpload_u")
 
26338
+          (const_string "fpload")))
 
26339
+       (if_then_else
 
26340
+        (match_test "update_indexed_address_mem (operands[0], VOIDmode)")
 
26341
+        (const_string "fpstore_ux")
 
26342
+        (if_then_else
 
26343
+          (match_test "update_address_mem (operands[0], VOIDmode)")
 
26344
+          (const_string "fpstore_u")
 
26345
+          (const_string "fpstore")))
 
26346
+       (const_string "fpload")
 
26347
+       (const_string "fpstore")
 
26348
+       (const_string "mftgpr")
 
26349
+       (const_string "mffgpr")
 
26350
+       (const_string "mtjmpr")
 
26351
+       (const_string "mfjmpr")
 
26352
+       (const_string "*")
 
26353
+       (const_string "*")
 
26354
+       (const_string "*")])
 
26355
+   (set_attr "length" "4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,8")])
 
26356
 
 
26357
-(define_insn "*movsf_softfloat"
 
26358
-  [(set (match_operand:SF 0 "nonimmediate_operand" "=r,cl,r,r,m,r,r,r,r,*h")
 
26359
-       (match_operand:SF 1 "input_operand" "r,r,h,m,r,I,L,G,Fn,0"))]
 
26360
-  "(gpc_reg_operand (operands[0], SFmode)
 
26361
-   || gpc_reg_operand (operands[1], SFmode))
 
26362
+(define_insn "*mov<mode>_softfloat"
 
26363
+  [(set (match_operand:FMOVE32 0 "nonimmediate_operand" "=r,cl,r,r,m,r,r,r,r,*h")
 
26364
+       (match_operand:FMOVE32 1 "input_operand" "r,r,h,m,r,I,L,G,Fn,0"))]
 
26365
+  "(gpc_reg_operand (operands[0], <MODE>mode)
 
26366
+   || gpc_reg_operand (operands[1], <MODE>mode))
 
26367
    && (TARGET_SOFT_FLOAT || !TARGET_FPRS)"
 
26368
   "@
 
26369
    mr %0,%1
 
26370
@@ -7995,19 +8666,42 @@
 
26371
    #
 
26372
    #
 
26373
    nop"
 
26374
-  [(set_attr "type" "*,mtjmpr,mfjmpr,load,store,*,*,*,*,*")
 
26375
+  [(set_attr_alternative "type"
 
26376
+      [(const_string "*")
 
26377
+       (const_string "mtjmpr")
 
26378
+       (const_string "mfjmpr")
 
26379
+       (if_then_else
 
26380
+        (match_test "update_indexed_address_mem (operands[1], VOIDmode)")
 
26381
+        (const_string "load_ux")
 
26382
+        (if_then_else
 
26383
+          (match_test "update_address_mem (operands[1], VOIDmode)")
 
26384
+          (const_string "load_u")
 
26385
+          (const_string "load")))
 
26386
+       (if_then_else
 
26387
+        (match_test "update_indexed_address_mem (operands[0], VOIDmode)")
 
26388
+        (const_string "store_ux")
 
26389
+        (if_then_else
 
26390
+          (match_test "update_address_mem (operands[0], VOIDmode)")
 
26391
+          (const_string "store_u")
 
26392
+          (const_string "store")))
 
26393
+       (const_string "*")
 
26394
+       (const_string "*")
 
26395
+       (const_string "*")
 
26396
+       (const_string "*")
 
26397
+       (const_string "*")])
 
26398
    (set_attr "length" "4,4,4,4,4,4,4,4,8,4")])
 
26399
 
 
26400
 
 
26401
-(define_expand "movdf"
 
26402
-  [(set (match_operand:DF 0 "nonimmediate_operand" "")
 
26403
-       (match_operand:DF 1 "any_operand" ""))]
 
26404
+;; Move 64-bit binary/decimal floating point
 
26405
+(define_expand "mov<mode>"
 
26406
+  [(set (match_operand:FMOVE64 0 "nonimmediate_operand" "")
 
26407
+       (match_operand:FMOVE64 1 "any_operand" ""))]
 
26408
   ""
 
26409
-  "{ rs6000_emit_move (operands[0], operands[1], DFmode); DONE; }")
 
26410
+  "{ rs6000_emit_move (operands[0], operands[1], <MODE>mode); DONE; }")
 
26411
 
 
26412
 (define_split
 
26413
-  [(set (match_operand:DF 0 "gpc_reg_operand" "")
 
26414
-       (match_operand:DF 1 "const_int_operand" ""))]
 
26415
+  [(set (match_operand:FMOVE64 0 "gpc_reg_operand" "")
 
26416
+       (match_operand:FMOVE64 1 "const_int_operand" ""))]
 
26417
   "! TARGET_POWERPC64 && reload_completed
 
26418
    && ((GET_CODE (operands[0]) == REG && REGNO (operands[0]) <= 31)
 
26419
        || (GET_CODE (operands[0]) == SUBREG
 
26420
@@ -8020,8 +8714,8 @@
 
26421
   int endian = (WORDS_BIG_ENDIAN == 0);
 
26422
   HOST_WIDE_INT value = INTVAL (operands[1]);
 
26423
 
 
26424
-  operands[2] = operand_subword (operands[0], endian, 0, DFmode);
 
26425
-  operands[3] = operand_subword (operands[0], 1 - endian, 0, DFmode);
 
26426
+  operands[2] = operand_subword (operands[0], endian, 0, <MODE>mode);
 
26427
+  operands[3] = operand_subword (operands[0], 1 - endian, 0, <MODE>mode);
 
26428
 #if HOST_BITS_PER_WIDE_INT == 32
 
26429
   operands[4] = (value & 0x80000000) ? constm1_rtx : const0_rtx;
 
26430
 #else
 
26431
@@ -8031,8 +8725,8 @@
 
26432
 }")
 
26433
 
 
26434
 (define_split
 
26435
-  [(set (match_operand:DF 0 "gpc_reg_operand" "")
 
26436
-       (match_operand:DF 1 "const_double_operand" ""))]
 
26437
+  [(set (match_operand:FMOVE64 0 "gpc_reg_operand" "")
 
26438
+       (match_operand:FMOVE64 1 "const_double_operand" ""))]
 
26439
   "! TARGET_POWERPC64 && reload_completed
 
26440
    && ((GET_CODE (operands[0]) == REG && REGNO (operands[0]) <= 31)
 
26441
        || (GET_CODE (operands[0]) == SUBREG
 
26442
@@ -8047,17 +8741,17 @@
 
26443
   REAL_VALUE_TYPE rv;
 
26444
 
 
26445
   REAL_VALUE_FROM_CONST_DOUBLE (rv, operands[1]);
 
26446
-  REAL_VALUE_TO_TARGET_DOUBLE (rv, l);
 
26447
+  <real_value_to_target> (rv, l);
 
26448
 
 
26449
-  operands[2] = operand_subword (operands[0], endian, 0, DFmode);
 
26450
-  operands[3] = operand_subword (operands[0], 1 - endian, 0, DFmode);
 
26451
+  operands[2] = operand_subword (operands[0], endian, 0, <MODE>mode);
 
26452
+  operands[3] = operand_subword (operands[0], 1 - endian, 0, <MODE>mode);
 
26453
   operands[4] = gen_int_mode (l[endian], SImode);
 
26454
   operands[5] = gen_int_mode (l[1 - endian], SImode);
 
26455
 }")
 
26456
 
 
26457
 (define_split
 
26458
-  [(set (match_operand:DF 0 "gpc_reg_operand" "")
 
26459
-       (match_operand:DF 1 "const_double_operand" ""))]
 
26460
+  [(set (match_operand:FMOVE64 0 "gpc_reg_operand" "")
 
26461
+       (match_operand:FMOVE64 1 "const_double_operand" ""))]
 
26462
   "TARGET_POWERPC64 && reload_completed
 
26463
    && ((GET_CODE (operands[0]) == REG && REGNO (operands[0]) <= 31)
 
26464
        || (GET_CODE (operands[0]) == SUBREG
 
26465
@@ -8074,7 +8768,7 @@
 
26466
 #endif
 
26467
 
 
26468
   REAL_VALUE_FROM_CONST_DOUBLE (rv, operands[1]);
 
26469
-  REAL_VALUE_TO_TARGET_DOUBLE (rv, l);
 
26470
+  <real_value_to_target> (rv, l);
 
26471
 
 
26472
   operands[2] = gen_lowpart (DImode, operands[0]);
 
26473
   /* HIGHPART is lower memory address when WORDS_BIG_ENDIAN.  */
 
26474
@@ -8099,22 +8793,19 @@
 
26475
 ;; since the D-form version of the memory instructions does not need a GPR for
 
26476
 ;; reloading.
 
26477
 
 
26478
-(define_insn "*movdf_hardfloat32"
 
26479
-  [(set (match_operand:DF 0 "nonimmediate_operand" "=m,d,d,ws,?wa,Z,?Z,ws,?wa,wa,Y,r,!r,!r,!r,!r")
 
26480
-       (match_operand:DF 1 "input_operand" "d,m,d,Z,Z,ws,wa,ws,wa,j,r,Y,r,G,H,F"))]
 
26481
+(define_insn "*mov<mode>_hardfloat32"
 
26482
+  [(set (match_operand:FMOVE64 0 "nonimmediate_operand" "=m,d,d,wv,Z,wa,wa,Y,r,!r,!r,!r,!r")
 
26483
+       (match_operand:FMOVE64 1 "input_operand" "d,m,d,Z,wv,wa,j,r,Y,r,G,H,F"))]
 
26484
   "! TARGET_POWERPC64 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT 
 
26485
-   && (gpc_reg_operand (operands[0], DFmode)
 
26486
-       || gpc_reg_operand (operands[1], DFmode))"
 
26487
+   && (gpc_reg_operand (operands[0], <MODE>mode)
 
26488
+       || gpc_reg_operand (operands[1], <MODE>mode))"
 
26489
   "@
 
26490
    stfd%U0%X0 %1,%0
 
26491
    lfd%U1%X1 %0,%1
 
26492
    fmr %0,%1
 
26493
    lxsd%U1x %x0,%y1
 
26494
-   lxsd%U1x %x0,%y1
 
26495
    stxsd%U0x %x1,%y0
 
26496
-   stxsd%U0x %x1,%y0
 
26497
    xxlor %x0,%x1,%x1
 
26498
-   xxlor %x0,%x1,%x1
 
26499
    xxlxor %x0,%x0,%x0
 
26500
    #
 
26501
    #
 
26502
@@ -8122,115 +8813,140 @@
 
26503
    #
 
26504
    #
 
26505
    #"
 
26506
-  [(set_attr "type" "fpstore,fpload,fp,fpload,fpload,fpstore,fpstore,vecsimple,vecsimple,vecsimple,store,load,two,fp,fp,*")
 
26507
-   (set_attr "length" "4,4,4,4,4,4,4,4,4,4,8,8,8,8,12,16")])
 
26508
+  [(set_attr_alternative "type"
 
26509
+      [(if_then_else
 
26510
+        (match_test "update_indexed_address_mem (operands[0], VOIDmode)")
 
26511
+        (const_string "fpstore_ux")
 
26512
+        (if_then_else
 
26513
+          (match_test "update_address_mem (operands[0], VOIDmode)")
 
26514
+          (const_string "fpstore_u")
 
26515
+          (const_string "fpstore")))
 
26516
+       (if_then_else
 
26517
+        (match_test "update_indexed_address_mem (operands[1], VOIDmode)")
 
26518
+        (const_string "fpload_ux")
 
26519
+        (if_then_else
 
26520
+          (match_test "update_address_mem (operands[1], VOIDmode)")
 
26521
+          (const_string "fpload_u")
 
26522
+          (const_string "fpload")))
 
26523
+       (const_string "fp")
 
26524
+       (if_then_else
 
26525
+        (match_test "update_indexed_address_mem (operands[1], VOIDmode)")
 
26526
+        (const_string "fpload_ux")
 
26527
+        (const_string "fpload"))
 
26528
+       (if_then_else
 
26529
+        (match_test "update_indexed_address_mem (operands[0], VOIDmode)")
 
26530
+        (const_string "fpstore_ux")
 
26531
+        (const_string "fpstore"))
 
26532
+       (const_string "vecsimple")
 
26533
+       (const_string "vecsimple")
 
26534
+       (const_string "store")
 
26535
+       (const_string "load")
 
26536
+       (const_string "two")
 
26537
+       (const_string "fp")
 
26538
+       (const_string "fp")
 
26539
+       (const_string "*")])
 
26540
+   (set_attr "length" "4,4,4,4,4,4,4,8,8,8,8,12,16")])
 
26541
 
 
26542
-(define_insn "*movdf_softfloat32"
 
26543
-  [(set (match_operand:DF 0 "nonimmediate_operand" "=Y,r,r,r,r,r")
 
26544
-       (match_operand:DF 1 "input_operand" "r,Y,r,G,H,F"))]
 
26545
+(define_insn "*mov<mode>_softfloat32"
 
26546
+  [(set (match_operand:FMOVE64 0 "nonimmediate_operand" "=Y,r,r,r,r,r")
 
26547
+       (match_operand:FMOVE64 1 "input_operand" "r,Y,r,G,H,F"))]
 
26548
   "! TARGET_POWERPC64 
 
26549
    && ((TARGET_FPRS && TARGET_SINGLE_FLOAT) 
 
26550
        || TARGET_SOFT_FLOAT || TARGET_E500_SINGLE)
 
26551
-   && (gpc_reg_operand (operands[0], DFmode)
 
26552
-       || gpc_reg_operand (operands[1], DFmode))"
 
26553
+   && (gpc_reg_operand (operands[0], <MODE>mode)
 
26554
+       || gpc_reg_operand (operands[1], <MODE>mode))"
 
26555
   "#"
 
26556
   [(set_attr "type" "store,load,two,*,*,*")
 
26557
    (set_attr "length" "8,8,8,8,12,16")])
 
26558
 
 
26559
-;; Reload patterns to support gpr load/store with misaligned mem.
 
26560
-;; and multiple gpr load/store at offset >= 0xfffc
 
26561
-(define_expand "reload_<mode>_store"
 
26562
-  [(parallel [(match_operand 0 "memory_operand" "=m")
 
26563
-              (match_operand 1 "gpc_reg_operand" "r")
 
26564
-              (match_operand:GPR 2 "register_operand" "=&b")])]
 
26565
-  ""
 
26566
-{
 
26567
-  rs6000_secondary_reload_gpr (operands[1], operands[0], operands[2], true);
 
26568
-  DONE;
 
26569
-})
 
26570
-
 
26571
-(define_expand "reload_<mode>_load"
 
26572
-  [(parallel [(match_operand 0 "gpc_reg_operand" "=r")
 
26573
-              (match_operand 1 "memory_operand" "m")
 
26574
-              (match_operand:GPR 2 "register_operand" "=b")])]
 
26575
-  ""
 
26576
-{
 
26577
-  rs6000_secondary_reload_gpr (operands[0], operands[1], operands[2], false);
 
26578
-  DONE;
 
26579
-})
 
26580
-
 
26581
 ; ld/std require word-aligned displacements -> 'Y' constraint.
 
26582
 ; List Y->r and r->Y before r->r for reload.
 
26583
-(define_insn "*movdf_hardfloat64_mfpgpr"
 
26584
-  [(set (match_operand:DF 0 "nonimmediate_operand" "=Y,r,!r,ws,?wa,ws,?wa,Z,?Z,m,d,d,wa,*c*l,!r,*h,!r,!r,!r,r,d")
 
26585
-       (match_operand:DF 1 "input_operand" "r,Y,r,ws,?wa,Z,Z,ws,wa,d,m,d,j,r,h,0,G,H,F,d,r"))]
 
26586
-  "TARGET_POWERPC64 && TARGET_MFPGPR && TARGET_HARD_FLOAT && TARGET_FPRS 
 
26587
-   && TARGET_DOUBLE_FLOAT
 
26588
-   && (gpc_reg_operand (operands[0], DFmode)
 
26589
-       || gpc_reg_operand (operands[1], DFmode))"
 
26590
+(define_insn "*mov<mode>_hardfloat64"
 
26591
+  [(set (match_operand:FMOVE64 0 "nonimmediate_operand" "=m,d,d,wv,Z,wa,wa,Y,r,!r,*c*l,!r,*h,!r,!r,!r,r,wg,r,wm")
 
26592
+       (match_operand:FMOVE64 1 "input_operand" "d,m,d,Z,wv,wa,j,r,Y,r,r,h,0,G,H,F,wg,r,wm,r"))]
 
26593
+  "TARGET_POWERPC64 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
 
26594
+   && (gpc_reg_operand (operands[0], <MODE>mode)
 
26595
+       || gpc_reg_operand (operands[1], <MODE>mode))"
 
26596
   "@
 
26597
-   std%U0%X0 %1,%0
 
26598
-   ld%U1%X1 %0,%1
 
26599
-   mr %0,%1
 
26600
-   xxlor %x0,%x1,%x1
 
26601
-   xxlor %x0,%x1,%x1
 
26602
-   lxsd%U1x %x0,%y1
 
26603
-   lxsd%U1x %x0,%y1
 
26604
-   stxsd%U0x %x1,%y0
 
26605
-   stxsd%U0x %x1,%y0
 
26606
    stfd%U0%X0 %1,%0
 
26607
    lfd%U1%X1 %0,%1
 
26608
    fmr %0,%1
 
26609
+   lxsd%U1x %x0,%y1
 
26610
+   stxsd%U0x %x1,%y0
 
26611
+   xxlor %x0,%x1,%x1
 
26612
    xxlxor %x0,%x0,%x0
 
26613
-   mt%0 %1
 
26614
-   mf%1 %0
 
26615
-   nop
 
26616
-   #
 
26617
-   #
 
26618
-   #
 
26619
-   mftgpr %0,%1
 
26620
-   mffgpr %0,%1"
 
26621
-  [(set_attr "type" "store,load,*,fp,fp,fpload,fpload,fpstore,fpstore,fpstore,fpload,fp,vecsimple,mtjmpr,mfjmpr,*,*,*,*,mftgpr,mffgpr")
 
26622
-   (set_attr "length" "4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,8,12,16,4,4")])
 
26623
-
 
26624
-; ld/std require word-aligned displacements -> 'Y' constraint.
 
26625
-; List Y->r and r->Y before r->r for reload.
 
26626
-(define_insn "*movdf_hardfloat64"
 
26627
-  [(set (match_operand:DF 0 "nonimmediate_operand" "=m,d,d,Y,r,!r,ws,?wa,Z,?Z,ws,?wa,wa,*c*l,!r,*h,!r,!r,!r")
 
26628
-       (match_operand:DF 1 "input_operand" "d,m,d,r,Y,r,Z,Z,ws,wa,ws,wa,j,r,h,0,G,H,F"))]
 
26629
-  "TARGET_POWERPC64 && !TARGET_MFPGPR && TARGET_HARD_FLOAT && TARGET_FPRS 
 
26630
-   && TARGET_DOUBLE_FLOAT
 
26631
-   && (gpc_reg_operand (operands[0], DFmode)
 
26632
-       || gpc_reg_operand (operands[1], DFmode))"
 
26633
-  "@
 
26634
-   stfd%U0%X0 %1,%0
 
26635
-   lfd%U1%X1 %0,%1
 
26636
-   fmr %0,%1
 
26637
    std%U0%X0 %1,%0
 
26638
    ld%U1%X1 %0,%1
 
26639
    mr %0,%1
 
26640
-   lxsd%U1x %x0,%y1
 
26641
-   lxsd%U1x %x0,%y1
 
26642
-   stxsd%U0x %x1,%y0
 
26643
-   stxsd%U0x %x1,%y0
 
26644
-   xxlor %x0,%x1,%x1
 
26645
-   xxlor %x0,%x1,%x1
 
26646
-   xxlxor %x0,%x0,%x0
 
26647
    mt%0 %1
 
26648
    mf%1 %0
 
26649
    nop
 
26650
    #
 
26651
    #
 
26652
-   #"
 
26653
-  [(set_attr "type" "fpstore,fpload,fp,store,load,*,fpload,fpload,fpstore,fpstore,vecsimple,vecsimple,vecsimple,mtjmpr,mfjmpr,*,*,*,*")
 
26654
-   (set_attr "length" "4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,8,12,16")])
 
26655
+   #
 
26656
+   mftgpr %0,%1
 
26657
+   mffgpr %0,%1
 
26658
+   mfvsrd %0,%x1
 
26659
+   mtvsrd %x0,%1"
 
26660
+  [(set_attr_alternative "type"
 
26661
+      [(if_then_else
 
26662
+        (match_test "update_indexed_address_mem (operands[0], VOIDmode)")
 
26663
+        (const_string "fpstore_ux")
 
26664
+        (if_then_else
 
26665
+          (match_test "update_address_mem (operands[0], VOIDmode)")
 
26666
+          (const_string "fpstore_u")
 
26667
+          (const_string "fpstore")))
 
26668
+       (if_then_else
 
26669
+        (match_test "update_indexed_address_mem (operands[1], VOIDmode)")
 
26670
+        (const_string "fpload_ux")
 
26671
+        (if_then_else
 
26672
+          (match_test "update_address_mem (operands[1], VOIDmode)")
 
26673
+          (const_string "fpload_u")
 
26674
+          (const_string "fpload")))
 
26675
+       (const_string "fp")
 
26676
+       (if_then_else
 
26677
+        (match_test "update_indexed_address_mem (operands[1], VOIDmode)")
 
26678
+        (const_string "fpload_ux")
 
26679
+        (const_string "fpload"))
 
26680
+       (if_then_else
 
26681
+        (match_test "update_indexed_address_mem (operands[0], VOIDmode)")
 
26682
+        (const_string "fpstore_ux")
 
26683
+        (const_string "fpstore"))
 
26684
+       (const_string "vecsimple")
 
26685
+       (const_string "vecsimple")
 
26686
+       (if_then_else
 
26687
+        (match_test "update_indexed_address_mem (operands[0], VOIDmode)")
 
26688
+        (const_string "store_ux")
 
26689
+        (if_then_else
 
26690
+          (match_test "update_address_mem (operands[0], VOIDmode)")
 
26691
+          (const_string "store_u")
 
26692
+          (const_string "store")))
 
26693
+       (if_then_else
 
26694
+        (match_test "update_indexed_address_mem (operands[1], VOIDmode)")
 
26695
+        (const_string "load_ux")
 
26696
+        (if_then_else
 
26697
+          (match_test "update_address_mem (operands[1], VOIDmode)")
 
26698
+          (const_string "load_u")
 
26699
+          (const_string "load")))
 
26700
+       (const_string "*")
 
26701
+       (const_string "mtjmpr")
 
26702
+       (const_string "mfjmpr")
 
26703
+       (const_string "*")
 
26704
+       (const_string "*")
 
26705
+       (const_string "*")
 
26706
+       (const_string "*")
 
26707
+       (const_string "mftgpr")
 
26708
+       (const_string "mffgpr")
 
26709
+       (const_string "mftgpr")
 
26710
+       (const_string "mffgpr")])
 
26711
+   (set_attr "length" "4,4,4,4,4,4,4,4,4,4,4,4,4,8,12,16,4,4,4,4")])
 
26712
 
 
26713
-(define_insn "*movdf_softfloat64"
 
26714
-  [(set (match_operand:DF 0 "nonimmediate_operand" "=Y,r,r,cl,r,r,r,r,*h")
 
26715
-       (match_operand:DF 1 "input_operand" "r,Y,r,r,h,G,H,F,0"))]
 
26716
+(define_insn "*mov<mode>_softfloat64"
 
26717
+  [(set (match_operand:FMOVE64 0 "nonimmediate_operand" "=Y,r,r,cl,r,r,r,r,*h")
 
26718
+       (match_operand:FMOVE64 1 "input_operand" "r,Y,r,r,h,G,H,F,0"))]
 
26719
   "TARGET_POWERPC64 && (TARGET_SOFT_FLOAT || !TARGET_FPRS)
 
26720
-   && (gpc_reg_operand (operands[0], DFmode)
 
26721
-       || gpc_reg_operand (operands[1], DFmode))"
 
26722
+   && (gpc_reg_operand (operands[0], <MODE>mode)
 
26723
+       || gpc_reg_operand (operands[1], <MODE>mode))"
 
26724
   "@
 
26725
    std%U0%X0 %1,%0
 
26726
    ld%U1%X1 %0,%1
 
26727
@@ -8241,38 +8957,57 @@
 
26728
    #
 
26729
    #
 
26730
    nop"
 
26731
-  [(set_attr "type" "store,load,*,mtjmpr,mfjmpr,*,*,*,*")
 
26732
+  [(set_attr_alternative "type"
 
26733
+      [(if_then_else
 
26734
+        (match_test "update_indexed_address_mem (operands[0], VOIDmode)")
 
26735
+        (const_string "store_ux")
 
26736
+        (if_then_else
 
26737
+          (match_test "update_address_mem (operands[0], VOIDmode)")
 
26738
+          (const_string "store_u")
 
26739
+          (const_string "store")))
 
26740
+       (if_then_else
 
26741
+        (match_test "update_indexed_address_mem (operands[1], VOIDmode)")
 
26742
+        (const_string "load_ux")
 
26743
+        (if_then_else
 
26744
+          (match_test "update_address_mem (operands[1], VOIDmode)")
 
26745
+          (const_string "load_u")
 
26746
+          (const_string "load")))
 
26747
+       (const_string "*")
 
26748
+       (const_string "mtjmpr")
 
26749
+       (const_string "mfjmpr")
 
26750
+       (const_string "*")
 
26751
+       (const_string "*")
 
26752
+       (const_string "*")
 
26753
+       (const_string "*")])
 
26754
    (set_attr "length" "4,4,4,4,4,8,12,16,4")])
 
26755
 
 
26756
-(define_expand "movtf"
 
26757
-  [(set (match_operand:TF 0 "general_operand" "")
 
26758
-       (match_operand:TF 1 "any_operand" ""))]
 
26759
-  "!TARGET_IEEEQUAD && TARGET_LONG_DOUBLE_128"
 
26760
-  "{ rs6000_emit_move (operands[0], operands[1], TFmode); DONE; }")
 
26761
+(define_expand "mov<mode>"
 
26762
+  [(set (match_operand:FMOVE128 0 "general_operand" "")
 
26763
+       (match_operand:FMOVE128 1 "any_operand" ""))]
 
26764
+  ""
 
26765
+  "{ rs6000_emit_move (operands[0], operands[1], <MODE>mode); DONE; }")
 
26766
 
 
26767
 ;; It's important to list Y->r and r->Y before r->r because otherwise
 
26768
 ;; reload, given m->r, will try to pick r->r and reload it, which
 
26769
 ;; doesn't make progress.
 
26770
-(define_insn_and_split "*movtf_internal"
 
26771
-  [(set (match_operand:TF 0 "nonimmediate_operand" "=m,d,d,Y,r,r")
 
26772
-       (match_operand:TF 1 "input_operand" "d,m,d,r,YGHF,r"))]
 
26773
-  "!TARGET_IEEEQUAD
 
26774
-   && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_LONG_DOUBLE_128
 
26775
-   && (gpc_reg_operand (operands[0], TFmode)
 
26776
-       || gpc_reg_operand (operands[1], TFmode))"
 
26777
+(define_insn_and_split "*mov<mode>_internal"
 
26778
+  [(set (match_operand:FMOVE128 0 "nonimmediate_operand" "=m,d,d,Y,r,r")
 
26779
+       (match_operand:FMOVE128 1 "input_operand" "d,m,d,r,YGHF,r"))]
 
26780
+  "TARGET_HARD_FLOAT && TARGET_FPRS
 
26781
+   && (gpc_reg_operand (operands[0], <MODE>mode)
 
26782
+       || gpc_reg_operand (operands[1], <MODE>mode))"
 
26783
   "#"
 
26784
   "&& reload_completed"
 
26785
   [(pc)]
 
26786
 { rs6000_split_multireg_move (operands[0], operands[1]); DONE; }
 
26787
   [(set_attr "length" "8,8,8,20,20,16")])
 
26788
 
 
26789
-(define_insn_and_split "*movtf_softfloat"
 
26790
-  [(set (match_operand:TF 0 "rs6000_nonimmediate_operand" "=Y,r,r")
 
26791
-       (match_operand:TF 1 "input_operand"         "r,YGHF,r"))]
 
26792
-  "!TARGET_IEEEQUAD
 
26793
-   && (TARGET_SOFT_FLOAT || !TARGET_FPRS) && TARGET_LONG_DOUBLE_128
 
26794
-   && (gpc_reg_operand (operands[0], TFmode)
 
26795
-       || gpc_reg_operand (operands[1], TFmode))"
 
26796
+(define_insn_and_split "*mov<mode>_softfloat"
 
26797
+  [(set (match_operand:FMOVE128 0 "rs6000_nonimmediate_operand" "=Y,r,r")
 
26798
+       (match_operand:FMOVE128 1 "input_operand" "r,YGHF,r"))]
 
26799
+  "(TARGET_SOFT_FLOAT || !TARGET_FPRS)
 
26800
+   && (gpc_reg_operand (operands[0], <MODE>mode)
 
26801
+       || gpc_reg_operand (operands[1], <MODE>mode))"
 
26802
   "#"
 
26803
   "&& reload_completed"
 
26804
   [(pc)]
 
26805
@@ -8557,6 +9292,243 @@
 
26806
   operands[6] = simplify_gen_subreg (DFmode, operands[0], TFmode, lo_word);
 
26807
 }")
 
26808
 
 
26809
+;; Reload helper functions used by rs6000_secondary_reload.  The patterns all
 
26810
+;; must have 3 arguments, and scratch register constraint must be a single
 
26811
+;; constraint.
 
26812
+
 
26813
+;; Reload patterns to support gpr load/store with misaligned mem.
 
26814
+;; and multiple gpr load/store at offset >= 0xfffc
 
26815
+(define_expand "reload_<mode>_store"
 
26816
+  [(parallel [(match_operand 0 "memory_operand" "=m")
 
26817
+              (match_operand 1 "gpc_reg_operand" "r")
 
26818
+              (match_operand:GPR 2 "register_operand" "=&b")])]
 
26819
+  ""
 
26820
+{
 
26821
+  rs6000_secondary_reload_gpr (operands[1], operands[0], operands[2], true);
 
26822
+  DONE;
 
26823
+})
 
26824
+
 
26825
+(define_expand "reload_<mode>_load"
 
26826
+  [(parallel [(match_operand 0 "gpc_reg_operand" "=r")
 
26827
+              (match_operand 1 "memory_operand" "m")
 
26828
+              (match_operand:GPR 2 "register_operand" "=b")])]
 
26829
+  ""
 
26830
+{
 
26831
+  rs6000_secondary_reload_gpr (operands[0], operands[1], operands[2], false);
 
26832
+  DONE;
 
26833
+})
 
26834
+
 
26835
+
 
26836
+;; Power8 merge instructions to allow direct move to/from floating point
 
26837
+;; registers in 32-bit mode.  We use TF mode to get two registers to move the
 
26838
+;; individual 32-bit parts across.  Subreg doesn't work too well on the TF
 
26839
+;; value, since it is allocated in reload and not all of the flow information
 
26840
+;; is setup for it.  We have two patterns to do the two moves between gprs and
 
26841
+;; fprs.  There isn't a dependancy between the two, but we could potentially
 
26842
+;; schedule other instructions between the two instructions.  TFmode is
 
26843
+;; currently limited to traditional FPR registers.  If/when this is changed, we
 
26844
+;; will need to revist %L to make sure it works with VSX registers, or add an
 
26845
+;; %x version of %L.
 
26846
+
 
26847
+(define_insn "p8_fmrgow_<mode>"
 
26848
+  [(set (match_operand:FMOVE64X 0 "register_operand" "=d")
 
26849
+       (unspec:FMOVE64X [(match_operand:TF 1 "register_operand" "d")]
 
26850
+                        UNSPEC_P8V_FMRGOW))]
 
26851
+  "!TARGET_POWERPC64 && TARGET_DIRECT_MOVE"
 
26852
+  "fmrgow %0,%1,%L1"
 
26853
+  [(set_attr "type" "vecperm")])
 
26854
+
 
26855
+(define_insn "p8_mtvsrwz_1"
 
26856
+  [(set (match_operand:TF 0 "register_operand" "=d")
 
26857
+       (unspec:TF [(match_operand:SI 1 "register_operand" "r")]
 
26858
+                  UNSPEC_P8V_MTVSRWZ))]
 
26859
+  "!TARGET_POWERPC64 && TARGET_DIRECT_MOVE"
 
26860
+  "mtvsrwz %x0,%1"
 
26861
+  [(set_attr "type" "mftgpr")])
 
26862
+
 
26863
+(define_insn "p8_mtvsrwz_2"
 
26864
+  [(set (match_operand:TF 0 "register_operand" "+d")
 
26865
+       (unspec:TF [(match_dup 0)
 
26866
+                   (match_operand:SI 1 "register_operand" "r")]
 
26867
+                  UNSPEC_P8V_MTVSRWZ))]
 
26868
+  "!TARGET_POWERPC64 && TARGET_DIRECT_MOVE"
 
26869
+  "mtvsrwz %L0,%1"
 
26870
+  [(set_attr "type" "mftgpr")])
 
26871
+
 
26872
+(define_insn_and_split "reload_fpr_from_gpr<mode>"
 
26873
+  [(set (match_operand:FMOVE64X 0 "register_operand" "=ws")
 
26874
+       (unspec:FMOVE64X [(match_operand:FMOVE64X 1 "register_operand" "r")]
 
26875
+                        UNSPEC_P8V_RELOAD_FROM_GPR))
 
26876
+   (clobber (match_operand:TF 2 "register_operand" "=d"))]
 
26877
+  "!TARGET_POWERPC64 && TARGET_DIRECT_MOVE"
 
26878
+  "#"
 
26879
+  "&& reload_completed"
 
26880
+  [(const_int 0)]
 
26881
+{
 
26882
+  rtx dest = operands[0];
 
26883
+  rtx src = operands[1];
 
26884
+  rtx tmp = operands[2];
 
26885
+  rtx gpr_hi_reg = gen_highpart (SImode, src);
 
26886
+  rtx gpr_lo_reg = gen_lowpart (SImode, src);
 
26887
+
 
26888
+  emit_insn (gen_p8_mtvsrwz_1 (tmp, gpr_hi_reg));
 
26889
+  emit_insn (gen_p8_mtvsrwz_2 (tmp, gpr_lo_reg));
 
26890
+  emit_insn (gen_p8_fmrgow_<mode> (dest, tmp));
 
26891
+  DONE;
 
26892
+}
 
26893
+  [(set_attr "length" "12")
 
26894
+   (set_attr "type" "three")])
 
26895
+
 
26896
+;; Move 128 bit values from GPRs to VSX registers in 64-bit mode
 
26897
+(define_insn "p8_mtvsrd_1"
 
26898
+  [(set (match_operand:TF 0 "register_operand" "=ws")
 
26899
+       (unspec:TF [(match_operand:DI 1 "register_operand" "r")]
 
26900
+                  UNSPEC_P8V_MTVSRD))]
 
26901
+  "TARGET_POWERPC64 && TARGET_DIRECT_MOVE"
 
26902
+  "mtvsrd %0,%1"
 
26903
+  [(set_attr "type" "mftgpr")])
 
26904
+
 
26905
+(define_insn "p8_mtvsrd_2"
 
26906
+  [(set (match_operand:TF 0 "register_operand" "+ws")
 
26907
+       (unspec:TF [(match_dup 0)
 
26908
+                   (match_operand:DI 1 "register_operand" "r")]
 
26909
+                  UNSPEC_P8V_MTVSRD))]
 
26910
+  "TARGET_POWERPC64 && TARGET_DIRECT_MOVE"
 
26911
+  "mtvsrd %L0,%1"
 
26912
+  [(set_attr "type" "mftgpr")])
 
26913
+
 
26914
+(define_insn "p8_xxpermdi_<mode>"
 
26915
+  [(set (match_operand:FMOVE128_GPR 0 "register_operand" "=wa")
 
26916
+       (unspec:FMOVE128_GPR [(match_operand:TF 1 "register_operand" "ws")]
 
26917
+                            UNSPEC_P8V_XXPERMDI))]
 
26918
+  "TARGET_POWERPC64 && TARGET_DIRECT_MOVE"
 
26919
+  "xxpermdi %x0,%1,%L1,0"
 
26920
+  [(set_attr "type" "vecperm")])
 
26921
+
 
26922
+(define_insn_and_split "reload_vsx_from_gpr<mode>"
 
26923
+  [(set (match_operand:FMOVE128_GPR 0 "register_operand" "=wa")
 
26924
+       (unspec:FMOVE128_GPR
 
26925
+        [(match_operand:FMOVE128_GPR 1 "register_operand" "r")]
 
26926
+        UNSPEC_P8V_RELOAD_FROM_GPR))
 
26927
+   (clobber (match_operand:TF 2 "register_operand" "=ws"))]
 
26928
+  "TARGET_POWERPC64 && TARGET_DIRECT_MOVE"
 
26929
+  "#"
 
26930
+  "&& reload_completed"
 
26931
+  [(const_int 0)]
 
26932
+{
 
26933
+  rtx dest = operands[0];
 
26934
+  rtx src = operands[1];
 
26935
+  rtx tmp = operands[2];
 
26936
+  rtx gpr_hi_reg = gen_highpart (DImode, src);
 
26937
+  rtx gpr_lo_reg = gen_lowpart (DImode, src);
 
26938
+
 
26939
+  emit_insn (gen_p8_mtvsrd_1 (tmp, gpr_hi_reg));
 
26940
+  emit_insn (gen_p8_mtvsrd_2 (tmp, gpr_lo_reg));
 
26941
+  emit_insn (gen_p8_xxpermdi_<mode> (dest, tmp));
 
26942
+}
 
26943
+  [(set_attr "length" "12")
 
26944
+   (set_attr "type" "three")])
 
26945
+
 
26946
+;; Move SFmode to a VSX from a GPR register.  Because scalar floating point
 
26947
+;; type is stored internally as double precision in the VSX registers, we have
 
26948
+;; to convert it from the vector format.
 
26949
+
 
26950
+(define_insn_and_split "reload_vsx_from_gprsf"
 
26951
+  [(set (match_operand:SF 0 "register_operand" "=wa")
 
26952
+       (unspec:SF [(match_operand:SF 1 "register_operand" "r")]
 
26953
+                  UNSPEC_P8V_RELOAD_FROM_GPR))
 
26954
+   (clobber (match_operand:DI 2 "register_operand" "=r"))]
 
26955
+  "TARGET_POWERPC64 && TARGET_DIRECT_MOVE && WORDS_BIG_ENDIAN"
 
26956
+  "#"
 
26957
+  "&& reload_completed"
 
26958
+  [(const_int 0)]
 
26959
+{
 
26960
+  rtx op0 = operands[0];
 
26961
+  rtx op1 = operands[1];
 
26962
+  rtx op2 = operands[2];
 
26963
+  rtx op0_di = simplify_gen_subreg (DImode, op0, SFmode, 0);
 
26964
+  rtx op1_di = simplify_gen_subreg (DImode, op1, SFmode, 0);
 
26965
+
 
26966
+  /* Move SF value to upper 32-bits for xscvspdpn.  */
 
26967
+  emit_insn (gen_ashldi3 (op2, op1_di, GEN_INT (32)));
 
26968
+  emit_move_insn (op0_di, op2);
 
26969
+  emit_insn (gen_vsx_xscvspdpn_directmove (op0, op0));
 
26970
+  DONE;
 
26971
+}
 
26972
+  [(set_attr "length" "8")
 
26973
+   (set_attr "type" "two")])
 
26974
+
 
26975
+;; Move 128 bit values from VSX registers to GPRs in 64-bit mode by doing a
 
26976
+;; normal 64-bit move, followed by an xxpermdi to get the bottom 64-bit value,
 
26977
+;; and then doing a move of that.
 
26978
+(define_insn "p8_mfvsrd_3_<mode>"
 
26979
+  [(set (match_operand:DF 0 "register_operand" "=r")
 
26980
+       (unspec:DF [(match_operand:FMOVE128_GPR 1 "register_operand" "wa")]
 
26981
+                  UNSPEC_P8V_RELOAD_FROM_VSX))]
 
26982
+  "TARGET_POWERPC64 && TARGET_DIRECT_MOVE && WORDS_BIG_ENDIAN"
 
26983
+  "mfvsrd %0,%x1"
 
26984
+  [(set_attr "type" "mftgpr")])
 
26985
+
 
26986
+(define_insn_and_split "reload_gpr_from_vsx<mode>"
 
26987
+  [(set (match_operand:FMOVE128_GPR 0 "register_operand" "=r")
 
26988
+       (unspec:FMOVE128_GPR
 
26989
+        [(match_operand:FMOVE128_GPR 1 "register_operand" "wa")]
 
26990
+        UNSPEC_P8V_RELOAD_FROM_VSX))
 
26991
+   (clobber (match_operand:FMOVE128_GPR 2 "register_operand" "=wa"))]
 
26992
+  "TARGET_POWERPC64 && TARGET_DIRECT_MOVE && WORDS_BIG_ENDIAN"
 
26993
+  "#"
 
26994
+  "&& reload_completed"
 
26995
+  [(const_int 0)]
 
26996
+{
 
26997
+  rtx dest = operands[0];
 
26998
+  rtx src = operands[1];
 
26999
+  rtx tmp = operands[2];
 
27000
+  rtx gpr_hi_reg = gen_highpart (DFmode, dest);
 
27001
+  rtx gpr_lo_reg = gen_lowpart (DFmode, dest);
 
27002
+
 
27003
+  emit_insn (gen_p8_mfvsrd_3_<mode> (gpr_hi_reg, src));
 
27004
+  emit_insn (gen_vsx_xxpermdi_<mode> (tmp, src, src, GEN_INT (3)));
 
27005
+  emit_insn (gen_p8_mfvsrd_3_<mode> (gpr_lo_reg, tmp));
 
27006
+}
 
27007
+  [(set_attr "length" "12")
 
27008
+   (set_attr "type" "three")])
 
27009
+
 
27010
+;; Move SFmode to a GPR from a VSX register.  Because scalar floating point
 
27011
+;; type is stored internally as double precision, we have to convert it to the
 
27012
+;; vector format.
 
27013
+
 
27014
+(define_insn_and_split "reload_gpr_from_vsxsf"
 
27015
+  [(set (match_operand:SF 0 "register_operand" "=r")
 
27016
+       (unspec:SF [(match_operand:SF 1 "register_operand" "wa")]
 
27017
+                  UNSPEC_P8V_RELOAD_FROM_VSX))
 
27018
+   (clobber (match_operand:V4SF 2 "register_operand" "=wa"))]
 
27019
+  "TARGET_POWERPC64 && TARGET_DIRECT_MOVE && WORDS_BIG_ENDIAN"
 
27020
+  "#"
 
27021
+  "&& reload_completed"
 
27022
+  [(const_int 0)]
 
27023
+{
 
27024
+  rtx op0 = operands[0];
 
27025
+  rtx op1 = operands[1];
 
27026
+  rtx op2 = operands[2];
 
27027
+  rtx diop0 = simplify_gen_subreg (DImode, op0, SFmode, 0);
 
27028
+
 
27029
+  emit_insn (gen_vsx_xscvdpspn_scalar (op2, op1));
 
27030
+  emit_insn (gen_p8_mfvsrd_4_disf (diop0, op2));
 
27031
+  emit_insn (gen_lshrdi3 (diop0, diop0, GEN_INT (32)));
 
27032
+  DONE;
 
27033
+}
 
27034
+  [(set_attr "length" "12")
 
27035
+   (set_attr "type" "three")])
 
27036
+
 
27037
+(define_insn "p8_mfvsrd_4_disf"
 
27038
+  [(set (match_operand:DI 0 "register_operand" "=r")
 
27039
+       (unspec:DI [(match_operand:V4SF 1 "register_operand" "wa")]
 
27040
+                  UNSPEC_P8V_RELOAD_FROM_VSX))]
 
27041
+  "TARGET_POWERPC64 && TARGET_DIRECT_MOVE && WORDS_BIG_ENDIAN"
 
27042
+  "mfvsrd %0,%x1"
 
27043
+  [(set_attr "type" "mftgpr")])
 
27044
+
 
27045
+
 
27046
 ;; Next come the multi-word integer load and store and the load and store
 
27047
 ;; multiple insns.
 
27048
 
 
27049
@@ -8565,8 +9537,8 @@
 
27050
 ;; Use of fprs is disparaged slightly otherwise reload prefers to reload
 
27051
 ;; a gpr into a fpr instead of reloading an invalid 'Y' address
 
27052
 (define_insn "*movdi_internal32"
 
27053
-  [(set (match_operand:DI 0 "rs6000_nonimmediate_operand" "=Y,r,r,?m,?*d,?*d,r,?wa")
 
27054
-       (match_operand:DI 1 "input_operand" "r,Y,r,d,m,d,IJKnGHF,O"))]
 
27055
+  [(set (match_operand:DI 0 "rs6000_nonimmediate_operand" "=Y,r,r,?m,?*d,?*d,r")
 
27056
+       (match_operand:DI 1 "input_operand" "r,Y,r,d,m,d,IJKnGHF"))]
 
27057
   "! TARGET_POWERPC64
 
27058
    && (gpc_reg_operand (operands[0], DImode)
 
27059
        || gpc_reg_operand (operands[1], DImode))"
 
27060
@@ -8577,15 +9549,34 @@
 
27061
    stfd%U0%X0 %1,%0
 
27062
    lfd%U1%X1 %0,%1
 
27063
    fmr %0,%1
 
27064
-   #
 
27065
-   xxlxor %x0,%x0,%x0"
 
27066
-  [(set_attr "type" "store,load,*,fpstore,fpload,fp,*,vecsimple")])
 
27067
+   #"
 
27068
+  [(set_attr_alternative "type"
 
27069
+      [(const_string "store")
 
27070
+       (const_string "load")
 
27071
+       (const_string "*")
 
27072
+       (if_then_else
 
27073
+        (match_test "update_indexed_address_mem (operands[0], VOIDmode)")
 
27074
+        (const_string "fpstore_ux")
 
27075
+        (if_then_else
 
27076
+          (match_test "update_address_mem (operands[0], VOIDmode)")
 
27077
+          (const_string "fpstore_u")
 
27078
+          (const_string "fpstore")))
 
27079
+       (if_then_else
 
27080
+        (match_test "update_indexed_address_mem (operands[1], VOIDmode)")
 
27081
+        (const_string "fpload_ux")
 
27082
+        (if_then_else
 
27083
+          (match_test "update_address_mem (operands[1], VOIDmode)")
 
27084
+          (const_string "fpload_u")
 
27085
+          (const_string "fpload")))
 
27086
+       (const_string "fp")
 
27087
+       (const_string "*")])])
 
27088
 
 
27089
 (define_split
 
27090
   [(set (match_operand:DI 0 "gpc_reg_operand" "")
 
27091
        (match_operand:DI 1 "const_int_operand" ""))]
 
27092
   "! TARGET_POWERPC64 && reload_completed
 
27093
-   && gpr_or_gpr_p (operands[0], operands[1])"
 
27094
+   && gpr_or_gpr_p (operands[0], operands[1])
 
27095
+   && !direct_move_p (operands[0], operands[1])"
 
27096
   [(set (match_dup 2) (match_dup 4))
 
27097
    (set (match_dup 3) (match_dup 1))]
 
27098
   "
 
27099
@@ -8607,14 +9598,15 @@
 
27100
   [(set (match_operand:DIFD 0 "rs6000_nonimmediate_operand" "")
 
27101
         (match_operand:DIFD 1 "input_operand" ""))]
 
27102
   "reload_completed && !TARGET_POWERPC64
 
27103
-   && gpr_or_gpr_p (operands[0], operands[1])"
 
27104
+   && gpr_or_gpr_p (operands[0], operands[1])
 
27105
+   && !direct_move_p (operands[0], operands[1])"
 
27106
   [(pc)]
 
27107
 { rs6000_split_multireg_move (operands[0], operands[1]); DONE; })
 
27108
 
 
27109
-(define_insn "*movdi_mfpgpr"
 
27110
-  [(set (match_operand:DI 0 "nonimmediate_operand" "=Y,r,r,r,r,r,?m,?*d,?*d,r,*h,*h,r,?*d")
 
27111
-       (match_operand:DI 1 "input_operand" "r,Y,r,I,L,nF,d,m,d,*h,r,0,*d,r"))]
 
27112
-  "TARGET_POWERPC64 && TARGET_MFPGPR && TARGET_HARD_FLOAT && TARGET_FPRS
 
27113
+(define_insn "*movdi_internal64"
 
27114
+  [(set (match_operand:DI 0 "nonimmediate_operand" "=Y,r,r,r,r,r,?m,?*d,?*d,r,*h,*h,r,?*wg,r,?*wm")
 
27115
+       (match_operand:DI 1 "input_operand" "r,Y,r,I,L,nF,d,m,d,*h,r,0,*wg,r,*wm,r"))]
 
27116
+  "TARGET_POWERPC64
 
27117
    && (gpc_reg_operand (operands[0], DImode)
 
27118
        || gpc_reg_operand (operands[1], DImode))"
 
27119
   "@
 
27120
@@ -8631,33 +9623,52 @@
 
27121
    mt%0 %1
 
27122
    nop
 
27123
    mftgpr %0,%1
 
27124
-   mffgpr %0,%1"
 
27125
-  [(set_attr "type" "store,load,*,*,*,*,fpstore,fpload,fp,mfjmpr,mtjmpr,*,mftgpr,mffgpr")
 
27126
-   (set_attr "length" "4,4,4,4,4,20,4,4,4,4,4,4,4,4")])
 
27127
+   mffgpr %0,%1
 
27128
+   mfvsrd %0,%x1
 
27129
+   mtvsrd %x0,%1"
 
27130
+  [(set_attr_alternative "type"
 
27131
+      [(if_then_else
 
27132
+        (match_test "update_indexed_address_mem (operands[0], VOIDmode)")
 
27133
+        (const_string "store_ux")
 
27134
+        (if_then_else
 
27135
+          (match_test "update_address_mem (operands[0], VOIDmode)")
 
27136
+          (const_string "store_u")
 
27137
+          (const_string "store")))
 
27138
+       (if_then_else
 
27139
+        (match_test "update_indexed_address_mem (operands[1], VOIDmode)")
 
27140
+        (const_string "load_ux")
 
27141
+        (if_then_else
 
27142
+          (match_test "update_address_mem (operands[1], VOIDmode)")
 
27143
+          (const_string "load_u")
 
27144
+          (const_string "load")))
 
27145
+       (const_string "*")
 
27146
+       (const_string "*")
 
27147
+       (const_string "*")
 
27148
+       (const_string "*")
 
27149
+       (if_then_else
 
27150
+        (match_test "update_indexed_address_mem (operands[0], VOIDmode)")
 
27151
+        (const_string "fpstore_ux")
 
27152
+        (if_then_else
 
27153
+          (match_test "update_address_mem (operands[0], VOIDmode)")
 
27154
+          (const_string "fpstore_u")
 
27155
+          (const_string "fpstore")))
 
27156
+       (if_then_else
 
27157
+        (match_test "update_indexed_address_mem (operands[1], VOIDmode)")
 
27158
+        (const_string "fpload_ux")
 
27159
+        (if_then_else
 
27160
+          (match_test "update_address_mem (operands[1], VOIDmode)")
 
27161
+          (const_string "fpload_u")
 
27162
+          (const_string "fpload")))
 
27163
+       (const_string "fp")
 
27164
+       (const_string "mfjmpr")
 
27165
+       (const_string "mtjmpr")
 
27166
+       (const_string "*")
 
27167
+       (const_string "mftgpr")
 
27168
+       (const_string "mffgpr")
 
27169
+       (const_string "mftgpr")
 
27170
+       (const_string "mffgpr")])
 
27171
+   (set_attr "length" "4,4,4,4,4,20,4,4,4,4,4,4,4,4,4,4")])
 
27172
 
 
27173
-(define_insn "*movdi_internal64"
 
27174
-  [(set (match_operand:DI 0 "nonimmediate_operand" "=Y,r,r,r,r,r,?m,?*d,?*d,r,*h,*h,?wa")
 
27175
-       (match_operand:DI 1 "input_operand" "r,Y,r,I,L,nF,d,m,d,*h,r,0,O"))]
 
27176
-  "TARGET_POWERPC64 && (!TARGET_MFPGPR || !TARGET_HARD_FLOAT || !TARGET_FPRS)
 
27177
-   && (gpc_reg_operand (operands[0], DImode)
 
27178
-       || gpc_reg_operand (operands[1], DImode))"
 
27179
-  "@
 
27180
-   std%U0%X0 %1,%0
 
27181
-   ld%U1%X1 %0,%1
 
27182
-   mr %0,%1
 
27183
-   li %0,%1
 
27184
-   lis %0,%v1
 
27185
-   #
 
27186
-   stfd%U0%X0 %1,%0
 
27187
-   lfd%U1%X1 %0,%1
 
27188
-   fmr %0,%1
 
27189
-   mf%1 %0
 
27190
-   mt%0 %1
 
27191
-   nop
 
27192
-   xxlxor %x0,%x0,%x0"
 
27193
-  [(set_attr "type" "store,load,*,*,*,*,fpstore,fpload,fp,mfjmpr,mtjmpr,*,vecsimple")
 
27194
-   (set_attr "length" "4,4,4,4,4,20,4,4,4,4,4,4,4")])
 
27195
-
 
27196
 ;; immediate value valid for a single instruction hiding in a const_double
 
27197
 (define_insn ""
 
27198
   [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
 
27199
@@ -8719,14 +9730,16 @@
 
27200
     FAIL;
 
27201
 }")
 
27202
 
 
27203
-;; TImode is similar, except that we usually want to compute the address into
 
27204
-;; a register and use lsi/stsi (the exception is during reload).
 
27205
+;; TImode/PTImode is similar, except that we usually want to compute the
 
27206
+;; address into a register and use lsi/stsi (the exception is during reload).
 
27207
 
 
27208
-(define_insn "*movti_string"
 
27209
-  [(set (match_operand:TI 0 "reg_or_mem_operand" "=Q,Y,????r,????r,????r,r")
 
27210
-       (match_operand:TI 1 "input_operand" "r,r,Q,Y,r,n"))]
 
27211
+(define_insn "*mov<mode>_string"
 
27212
+  [(set (match_operand:TI2 0 "reg_or_mem_operand" "=Q,Y,????r,????r,????r,r")
 
27213
+       (match_operand:TI2 1 "input_operand" "r,r,Q,Y,r,n"))]
 
27214
   "! TARGET_POWERPC64
 
27215
-   && (gpc_reg_operand (operands[0], TImode) || gpc_reg_operand (operands[1], TImode))"
 
27216
+   && (<MODE>mode != TImode || VECTOR_MEM_NONE_P (TImode))
 
27217
+   && (gpc_reg_operand (operands[0], <MODE>mode)
 
27218
+       || gpc_reg_operand (operands[1], <MODE>mode))"
 
27219
   "*
 
27220
 {
 
27221
   switch (which_alternative)
 
27222
@@ -8756,27 +9769,32 @@
 
27223
                                          (const_string "always")
 
27224
                                          (const_string "conditional")))])
 
27225
 
 
27226
-(define_insn "*movti_ppc64"
 
27227
-  [(set (match_operand:TI 0 "nonimmediate_operand" "=Y,r,r")
 
27228
-       (match_operand:TI 1 "input_operand" "r,Y,r"))]
 
27229
-  "(TARGET_POWERPC64 && (gpc_reg_operand (operands[0], TImode)
 
27230
-    || gpc_reg_operand (operands[1], TImode)))
 
27231
-   && VECTOR_MEM_NONE_P (TImode)"
 
27232
-  "#"
 
27233
-  [(set_attr "type" "store,load,*")])
 
27234
+(define_insn "*mov<mode>_ppc64"
 
27235
+  [(set (match_operand:TI2 0 "nonimmediate_operand" "=wQ,Y,r,r,r,r")
 
27236
+       (match_operand:TI2 1 "input_operand" "r,r,wQ,Y,r,n"))]
 
27237
+  "(TARGET_POWERPC64 && VECTOR_MEM_NONE_P (<MODE>mode)
 
27238
+   && (gpc_reg_operand (operands[0], <MODE>mode)
 
27239
+       || gpc_reg_operand (operands[1], <MODE>mode)))"
 
27240
+{
 
27241
+  return rs6000_output_move_128bit (operands);
 
27242
+}
 
27243
+  [(set_attr "type" "store,store,load,load,*,*")
 
27244
+   (set_attr "length" "8")])
 
27245
 
 
27246
 (define_split
 
27247
-  [(set (match_operand:TI 0 "gpc_reg_operand" "")
 
27248
-       (match_operand:TI 1 "const_double_operand" ""))]
 
27249
-  "TARGET_POWERPC64 && VECTOR_MEM_NONE_P (TImode)"
 
27250
+  [(set (match_operand:TI2 0 "int_reg_operand" "")
 
27251
+       (match_operand:TI2 1 "const_double_operand" ""))]
 
27252
+  "TARGET_POWERPC64
 
27253
+   && (VECTOR_MEM_NONE_P (<MODE>mode)
 
27254
+       || (reload_completed && INT_REGNO_P (REGNO (operands[0]))))"
 
27255
   [(set (match_dup 2) (match_dup 4))
 
27256
    (set (match_dup 3) (match_dup 5))]
 
27257
   "
 
27258
 {
 
27259
   operands[2] = operand_subword_force (operands[0], WORDS_BIG_ENDIAN == 0,
 
27260
-                                      TImode);
 
27261
+                                      <MODE>mode);
 
27262
   operands[3] = operand_subword_force (operands[0], WORDS_BIG_ENDIAN != 0,
 
27263
-                                      TImode);
 
27264
+                                      <MODE>mode);
 
27265
   if (GET_CODE (operands[1]) == CONST_DOUBLE)
 
27266
     {
 
27267
       operands[4] = GEN_INT (CONST_DOUBLE_HIGH (operands[1]));
 
27268
@@ -8792,10 +9810,12 @@
 
27269
 }")
 
27270
 
 
27271
 (define_split
 
27272
-  [(set (match_operand:TI 0 "nonimmediate_operand" "")
 
27273
-        (match_operand:TI 1 "input_operand" ""))]
 
27274
-  "reload_completed && VECTOR_MEM_NONE_P (TImode)
 
27275
-   && gpr_or_gpr_p (operands[0], operands[1])"
 
27276
+  [(set (match_operand:TI2 0 "nonimmediate_operand" "")
 
27277
+        (match_operand:TI2 1 "input_operand" ""))]
 
27278
+  "reload_completed
 
27279
+   && gpr_or_gpr_p (operands[0], operands[1])
 
27280
+   && !direct_move_p (operands[0], operands[1])
 
27281
+   && !quad_load_store_p (operands[0], operands[1])"
 
27282
   [(pc)]
 
27283
 { rs6000_split_multireg_move (operands[0], operands[1]); DONE; })
 
27284
 
 
27285
@@ -9651,7 +10671,7 @@
 
27286
                    (match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
 
27287
                   UNSPEC_TLSGD)
 
27288
    (clobber (reg:SI LR_REGNO))]
 
27289
-  "HAVE_AS_TLS && DEFAULT_ABI == ABI_AIX"
 
27290
+  "HAVE_AS_TLS && (DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_ELFv2)"
 
27291
 {
 
27292
   if (TARGET_CMODEL != CMODEL_SMALL)
 
27293
     return "addis %0,%1,%2@got@tlsgd@ha\;addi %0,%0,%2@got@tlsgd@l\;"
 
27294
@@ -9759,7 +10779,8 @@
 
27295
    (unspec:TLSmode [(match_operand:TLSmode 3 "rs6000_tls_symbol_ref" "")]
 
27296
                   UNSPEC_TLSGD)
 
27297
    (clobber (reg:SI LR_REGNO))]
 
27298
-  "HAVE_AS_TLS && DEFAULT_ABI == ABI_AIX && TARGET_TLS_MARKERS"
 
27299
+  "HAVE_AS_TLS && TARGET_TLS_MARKERS
 
27300
+   && (DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_ELFv2)"
 
27301
   "bl %z1(%3@tlsgd)\;nop"
 
27302
   [(set_attr "type" "branch")
 
27303
    (set_attr "length" "8")])
 
27304
@@ -9791,7 +10812,7 @@
 
27305
    (unspec:TLSmode [(match_operand:TLSmode 1 "gpc_reg_operand" "b")]
 
27306
                   UNSPEC_TLSLD)
 
27307
    (clobber (reg:SI LR_REGNO))]
 
27308
-  "HAVE_AS_TLS && DEFAULT_ABI == ABI_AIX"
 
27309
+  "HAVE_AS_TLS && (DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_ELFv2)"
 
27310
 {
 
27311
   if (TARGET_CMODEL != CMODEL_SMALL)
 
27312
     return "addis %0,%1,%&@got@tlsld@ha\;addi %0,%0,%&@got@tlsld@l\;"
 
27313
@@ -9892,7 +10913,8 @@
 
27314
              (match_operand 2 "" "g")))
 
27315
    (unspec:TLSmode [(const_int 0)] UNSPEC_TLSLD)
 
27316
    (clobber (reg:SI LR_REGNO))]
 
27317
-  "HAVE_AS_TLS && DEFAULT_ABI == ABI_AIX && TARGET_TLS_MARKERS"
 
27318
+  "HAVE_AS_TLS && TARGET_TLS_MARKERS
 
27319
+   && (DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_ELFv2)"
 
27320
   "bl %z1(%&@tlsld)\;nop"
 
27321
   [(set_attr "type" "branch")
 
27322
    (set_attr "length" "8")])
 
27323
@@ -10261,7 +11283,7 @@
 
27324
   [(parallel [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
 
27325
                   (unspec:SI [(const_int 0)] UNSPEC_TOC))
 
27326
              (use (reg:SI 2))])]
 
27327
-  "DEFAULT_ABI == ABI_AIX && TARGET_32BIT"
 
27328
+  "(DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_ELFv2) && TARGET_32BIT"
 
27329
   "*
 
27330
 {
 
27331
   char buf[30];
 
27332
@@ -10276,7 +11298,7 @@
 
27333
   [(parallel [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
 
27334
                   (unspec:DI [(const_int 0)] UNSPEC_TOC))
 
27335
              (use (reg:DI 2))])]
 
27336
-  "DEFAULT_ABI == ABI_AIX && TARGET_64BIT"
 
27337
+  "(DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_ELFv2) && TARGET_64BIT"
 
27338
   "*
 
27339
 {
 
27340
   char buf[30];
 
27341
@@ -10306,7 +11328,7 @@
 
27342
   [(parallel [(set (reg:SI LR_REGNO)
 
27343
                   (match_operand:SI 0 "immediate_operand" "s"))
 
27344
              (use (unspec [(match_dup 0)] UNSPEC_TOC))])]
 
27345
-  "TARGET_ELF && DEFAULT_ABI != ABI_AIX
 
27346
+  "TARGET_ELF && DEFAULT_ABI == ABI_V4
 
27347
    && (flag_pic == 2 || (flag_pic && TARGET_SECURE_PLT))"
 
27348
   "")
 
27349
 
 
27350
@@ -10314,7 +11336,7 @@
 
27351
   [(set (reg:SI LR_REGNO)
 
27352
        (match_operand:SI 0 "immediate_operand" "s"))
 
27353
    (use (unspec [(match_dup 0)] UNSPEC_TOC))]
 
27354
-  "!TARGET_LINK_STACK && TARGET_ELF && DEFAULT_ABI != ABI_AIX
 
27355
+  "!TARGET_LINK_STACK && TARGET_ELF && DEFAULT_ABI == ABI_V4
 
27356
    && (flag_pic == 2 || (flag_pic && TARGET_SECURE_PLT))"
 
27357
   "bcl 20,31,%0\\n%0:"
 
27358
   [(set_attr "type" "branch")
 
27359
@@ -10324,7 +11346,7 @@
 
27360
   [(set (reg:SI LR_REGNO)
 
27361
        (match_operand:SI 0 "immediate_operand" "s"))
 
27362
    (use (unspec [(match_dup 0)] UNSPEC_TOC))]
 
27363
-  "TARGET_LINK_STACK && TARGET_ELF && DEFAULT_ABI != ABI_AIX
 
27364
+  "TARGET_LINK_STACK && TARGET_ELF && DEFAULT_ABI == ABI_V4
 
27365
    && (flag_pic == 2 || (flag_pic && TARGET_SECURE_PLT))"
 
27366
   "*
 
27367
 {
 
27368
@@ -10344,7 +11366,7 @@
 
27369
                               (label_ref (match_operand 1 "" ""))]
 
27370
                           UNSPEC_TOCPTR))
 
27371
              (match_dup 1)])]
 
27372
-  "TARGET_ELF && DEFAULT_ABI != ABI_AIX && flag_pic == 2"
 
27373
+  "TARGET_ELF && DEFAULT_ABI == ABI_V4 && flag_pic == 2"
 
27374
   "")
 
27375
 
 
27376
 (define_insn "load_toc_v4_PIC_1b_normal"
 
27377
@@ -10353,7 +11375,7 @@
 
27378
                    (label_ref (match_operand 1 "" ""))]
 
27379
                UNSPEC_TOCPTR))
 
27380
    (match_dup 1)]
 
27381
-  "!TARGET_LINK_STACK && TARGET_ELF && DEFAULT_ABI != ABI_AIX && flag_pic == 2"
 
27382
+  "!TARGET_LINK_STACK && TARGET_ELF && DEFAULT_ABI == ABI_V4 && flag_pic == 2"
 
27383
   "bcl 20,31,$+8\;.long %0-$"
 
27384
   [(set_attr "type" "branch")
 
27385
    (set_attr "length" "8")])
 
27386
@@ -10364,7 +11386,7 @@
 
27387
                    (label_ref (match_operand 1 "" ""))]
 
27388
                UNSPEC_TOCPTR))
 
27389
    (match_dup 1)]
 
27390
-  "TARGET_LINK_STACK && TARGET_ELF && DEFAULT_ABI != ABI_AIX && flag_pic == 2"
 
27391
+  "TARGET_LINK_STACK && TARGET_ELF && DEFAULT_ABI == ABI_V4 && flag_pic == 2"
 
27392
   "*
 
27393
 {
 
27394
   char name[32];
 
27395
@@ -10382,7 +11404,7 @@
 
27396
        (mem:SI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "b")
 
27397
                   (minus:SI (match_operand:SI 2 "immediate_operand" "s")
 
27398
                             (match_operand:SI 3 "immediate_operand" "s")))))]
 
27399
-  "TARGET_ELF && DEFAULT_ABI != ABI_AIX && flag_pic == 2"
 
27400
+  "TARGET_ELF && DEFAULT_ABI == ABI_V4 && flag_pic == 2"
 
27401
   "lwz %0,%2-%3(%1)"
 
27402
   [(set_attr "type" "load")])
 
27403
 
 
27404
@@ -10392,7 +11414,7 @@
 
27405
                 (high:SI
 
27406
                   (minus:SI (match_operand:SI 2 "symbol_ref_operand" "s")
 
27407
                             (match_operand:SI 3 "symbol_ref_operand" "s")))))]
 
27408
-  "TARGET_ELF && TARGET_SECURE_PLT && DEFAULT_ABI != ABI_AIX && flag_pic"
 
27409
+  "TARGET_ELF && TARGET_SECURE_PLT && DEFAULT_ABI == ABI_V4 && flag_pic"
 
27410
   "addis %0,%1,%2-%3@ha")
 
27411
 
 
27412
 (define_insn "load_toc_v4_PIC_3c"
 
27413
@@ -10400,7 +11422,7 @@
 
27414
        (lo_sum:SI (match_operand:SI 1 "gpc_reg_operand" "b")
 
27415
                   (minus:SI (match_operand:SI 2 "symbol_ref_operand" "s")
 
27416
                             (match_operand:SI 3 "symbol_ref_operand" "s"))))]
 
27417
-  "TARGET_ELF && TARGET_SECURE_PLT && DEFAULT_ABI != ABI_AIX && flag_pic"
 
27418
+  "TARGET_ELF && TARGET_SECURE_PLT && DEFAULT_ABI == ABI_V4 && flag_pic"
 
27419
   "addi %0,%1,%2-%3@l")
 
27420
 
 
27421
 ;; If the TOC is shared over a translation unit, as happens with all
 
27422
@@ -10542,8 +11564,13 @@
 
27423
 
 
27424
   operands[0] = XEXP (operands[0], 0);
 
27425
 
 
27426
+  if (DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_ELFv2)
 
27427
+    {
 
27428
+      rs6000_call_aix (NULL_RTX, operands[0], operands[1], operands[2]);
 
27429
+      DONE;
 
27430
+    }
 
27431
+
 
27432
   if (GET_CODE (operands[0]) != SYMBOL_REF
 
27433
-      || (DEFAULT_ABI == ABI_AIX && !SYMBOL_REF_FUNCTION_P (operands[0]))
 
27434
       || (DEFAULT_ABI != ABI_DARWIN && (INTVAL (operands[2]) & CALL_LONG) != 0))
 
27435
     {
 
27436
       if (INTVAL (operands[2]) & CALL_LONG)
 
27437
@@ -10556,12 +11583,6 @@
 
27438
          operands[0] = force_reg (Pmode, operands[0]);
 
27439
          break;
 
27440
 
 
27441
-       case ABI_AIX:
 
27442
-         /* AIX function pointers are really pointers to a three word
 
27443
-            area.  */
 
27444
-         rs6000_call_indirect_aix (NULL_RTX, operands[0], operands[1]);
 
27445
-         DONE;
 
27446
-
 
27447
        default:
 
27448
          gcc_unreachable ();
 
27449
        }
 
27450
@@ -10587,8 +11608,13 @@
 
27451
 
 
27452
   operands[1] = XEXP (operands[1], 0);
 
27453
 
 
27454
+  if (DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_ELFv2)
 
27455
+    {
 
27456
+      rs6000_call_aix (operands[0], operands[1], operands[2], operands[3]);
 
27457
+      DONE;
 
27458
+    }
 
27459
+
 
27460
   if (GET_CODE (operands[1]) != SYMBOL_REF
 
27461
-      || (DEFAULT_ABI == ABI_AIX && !SYMBOL_REF_FUNCTION_P (operands[1]))
 
27462
       || (DEFAULT_ABI != ABI_DARWIN && (INTVAL (operands[3]) & CALL_LONG) != 0))
 
27463
     {
 
27464
       if (INTVAL (operands[3]) & CALL_LONG)
 
27465
@@ -10601,12 +11627,6 @@
 
27466
          operands[1] = force_reg (Pmode, operands[1]);
 
27467
          break;
 
27468
 
 
27469
-       case ABI_AIX:
 
27470
-         /* AIX function pointers are really pointers to a three word
 
27471
-            area.  */
 
27472
-         rs6000_call_indirect_aix (operands[0], operands[1], operands[2]);
 
27473
-         DONE;
 
27474
-
 
27475
        default:
 
27476
          gcc_unreachable ();
 
27477
        }
 
27478
@@ -10698,136 +11718,7 @@
 
27479
   [(set_attr "type" "branch")
 
27480
    (set_attr "length" "4,8")])
 
27481
 
 
27482
-;; Call to indirect functions with the AIX abi using a 3 word descriptor.
 
27483
-;; Operand0 is the addresss of the function to call
 
27484
-;; Operand1 is the flag for System V.4 for unprototyped or FP registers
 
27485
-;; Operand2 is the location in the function descriptor to load r2 from
 
27486
-;; Operand3 is the stack location to hold the current TOC pointer
 
27487
 
 
27488
-(define_insn "call_indirect_aix<ptrsize>"
 
27489
-  [(call (mem:SI (match_operand:P 0 "register_operand" "c,*l"))
 
27490
-        (match_operand 1 "" "g,g"))
 
27491
-   (use (match_operand:P 2 "memory_operand" "<ptrm>,<ptrm>"))
 
27492
-   (set (reg:P TOC_REGNUM) (match_operand:P 3 "memory_operand" "<ptrm>,<ptrm>"))
 
27493
-   (use (reg:P STATIC_CHAIN_REGNUM))
 
27494
-   (clobber (reg:P LR_REGNO))]
 
27495
-  "DEFAULT_ABI == ABI_AIX && TARGET_POINTERS_TO_NESTED_FUNCTIONS"
 
27496
-  "<ptrload> 2,%2\;b%T0l\;<ptrload> 2,%3"
 
27497
-  [(set_attr "type" "jmpreg")
 
27498
-   (set_attr "length" "12")])
 
27499
-
 
27500
-;; Like call_indirect_aix<ptrsize>, but no use of the static chain
 
27501
-;; Operand0 is the addresss of the function to call
 
27502
-;; Operand1 is the flag for System V.4 for unprototyped or FP registers
 
27503
-;; Operand2 is the location in the function descriptor to load r2 from
 
27504
-;; Operand3 is the stack location to hold the current TOC pointer
 
27505
-
 
27506
-(define_insn "call_indirect_aix<ptrsize>_nor11"
 
27507
-  [(call (mem:SI (match_operand:P 0 "register_operand" "c,*l"))
 
27508
-        (match_operand 1 "" "g,g"))
 
27509
-   (use (match_operand:P 2 "memory_operand" "<ptrm>,<ptrm>"))
 
27510
-   (set (reg:P TOC_REGNUM) (match_operand:P 3 "memory_operand" "<ptrm>,<ptrm>"))
 
27511
-   (clobber (reg:P LR_REGNO))]
 
27512
-  "DEFAULT_ABI == ABI_AIX && !TARGET_POINTERS_TO_NESTED_FUNCTIONS"
 
27513
-  "<ptrload> 2,%2\;b%T0l\;<ptrload> 2,%3"
 
27514
-  [(set_attr "type" "jmpreg")
 
27515
-   (set_attr "length" "12")])
 
27516
-
 
27517
-;; Operand0 is the return result of the function
 
27518
-;; Operand1 is the addresss of the function to call
 
27519
-;; Operand2 is the flag for System V.4 for unprototyped or FP registers
 
27520
-;; Operand3 is the location in the function descriptor to load r2 from
 
27521
-;; Operand4 is the stack location to hold the current TOC pointer
 
27522
-
 
27523
-(define_insn "call_value_indirect_aix<ptrsize>"
 
27524
-  [(set (match_operand 0 "" "")
 
27525
-       (call (mem:SI (match_operand:P 1 "register_operand" "c,*l"))
 
27526
-             (match_operand 2 "" "g,g")))
 
27527
-   (use (match_operand:P 3 "memory_operand" "<ptrm>,<ptrm>"))
 
27528
-   (set (reg:P TOC_REGNUM) (match_operand:P 4 "memory_operand" "<ptrm>,<ptrm>"))
 
27529
-   (use (reg:P STATIC_CHAIN_REGNUM))
 
27530
-   (clobber (reg:P LR_REGNO))]
 
27531
-  "DEFAULT_ABI == ABI_AIX && TARGET_POINTERS_TO_NESTED_FUNCTIONS"
 
27532
-  "<ptrload> 2,%3\;b%T1l\;<ptrload> 2,%4"
 
27533
-  [(set_attr "type" "jmpreg")
 
27534
-   (set_attr "length" "12")])
 
27535
-
 
27536
-;; Like call_value_indirect_aix<ptrsize>, but no use of the static chain
 
27537
-;; Operand0 is the return result of the function
 
27538
-;; Operand1 is the addresss of the function to call
 
27539
-;; Operand2 is the flag for System V.4 for unprototyped or FP registers
 
27540
-;; Operand3 is the location in the function descriptor to load r2 from
 
27541
-;; Operand4 is the stack location to hold the current TOC pointer
 
27542
-
 
27543
-(define_insn "call_value_indirect_aix<ptrsize>_nor11"
 
27544
-  [(set (match_operand 0 "" "")
 
27545
-       (call (mem:SI (match_operand:P 1 "register_operand" "c,*l"))
 
27546
-             (match_operand 2 "" "g,g")))
 
27547
-   (use (match_operand:P 3 "memory_operand" "<ptrm>,<ptrm>"))
 
27548
-   (set (reg:P TOC_REGNUM) (match_operand:P 4 "memory_operand" "<ptrm>,<ptrm>"))
 
27549
-   (clobber (reg:P LR_REGNO))]
 
27550
-  "DEFAULT_ABI == ABI_AIX && !TARGET_POINTERS_TO_NESTED_FUNCTIONS"
 
27551
-  "<ptrload> 2,%3\;b%T1l\;<ptrload> 2,%4"
 
27552
-  [(set_attr "type" "jmpreg")
 
27553
-   (set_attr "length" "12")])
 
27554
-
 
27555
-;; Call to function which may be in another module.  Restore the TOC
 
27556
-;; pointer (r2) after the call unless this is System V.
 
27557
-;; Operand2 is nonzero if we are using the V.4 calling sequence and
 
27558
-;; either the function was not prototyped, or it was prototyped as a
 
27559
-;; variable argument function.  It is > 0 if FP registers were passed
 
27560
-;; and < 0 if they were not.
 
27561
-
 
27562
-(define_insn "*call_nonlocal_aix32"
 
27563
-  [(call (mem:SI (match_operand:SI 0 "symbol_ref_operand" "s"))
 
27564
-        (match_operand 1 "" "g"))
 
27565
-   (use (match_operand:SI 2 "immediate_operand" "O"))
 
27566
-   (clobber (reg:SI LR_REGNO))]
 
27567
-  "TARGET_32BIT
 
27568
-   && DEFAULT_ABI == ABI_AIX
 
27569
-   && (INTVAL (operands[2]) & CALL_LONG) == 0"
 
27570
-  "bl %z0\;nop"
 
27571
-  [(set_attr "type" "branch")
 
27572
-   (set_attr "length" "8")])
 
27573
-   
 
27574
-(define_insn "*call_nonlocal_aix64"
 
27575
-  [(call (mem:SI (match_operand:DI 0 "symbol_ref_operand" "s"))
 
27576
-        (match_operand 1 "" "g"))
 
27577
-   (use (match_operand:SI 2 "immediate_operand" "O"))
 
27578
-   (clobber (reg:SI LR_REGNO))]
 
27579
-  "TARGET_64BIT
 
27580
-   && DEFAULT_ABI == ABI_AIX
 
27581
-   && (INTVAL (operands[2]) & CALL_LONG) == 0"
 
27582
-  "bl %z0\;nop"
 
27583
-  [(set_attr "type" "branch")
 
27584
-   (set_attr "length" "8")])
 
27585
-
 
27586
-(define_insn "*call_value_nonlocal_aix32"
 
27587
-  [(set (match_operand 0 "" "")
 
27588
-       (call (mem:SI (match_operand:SI 1 "symbol_ref_operand" "s"))
 
27589
-             (match_operand 2 "" "g")))
 
27590
-   (use (match_operand:SI 3 "immediate_operand" "O"))
 
27591
-   (clobber (reg:SI LR_REGNO))]
 
27592
-  "TARGET_32BIT
 
27593
-   && DEFAULT_ABI == ABI_AIX
 
27594
-   && (INTVAL (operands[3]) & CALL_LONG) == 0"
 
27595
-  "bl %z1\;nop"
 
27596
-  [(set_attr "type" "branch")
 
27597
-   (set_attr "length" "8")])
 
27598
-
 
27599
-(define_insn "*call_value_nonlocal_aix64"
 
27600
-  [(set (match_operand 0 "" "")
 
27601
-       (call (mem:SI (match_operand:DI 1 "symbol_ref_operand" "s"))
 
27602
-             (match_operand 2 "" "g")))
 
27603
-   (use (match_operand:SI 3 "immediate_operand" "O"))
 
27604
-   (clobber (reg:SI LR_REGNO))]
 
27605
-  "TARGET_64BIT
 
27606
-   && DEFAULT_ABI == ABI_AIX
 
27607
-   && (INTVAL (operands[3]) & CALL_LONG) == 0"
 
27608
-  "bl %z1\;nop"
 
27609
-  [(set_attr "type" "branch")
 
27610
-   (set_attr "length" "8")])
 
27611
-
 
27612
 ;; A function pointer under System V is just a normal pointer
 
27613
 ;; operands[0] is the function pointer
 
27614
 ;; operands[1] is the stack size to clean up
 
27615
@@ -11009,6 +11900,104 @@
 
27616
   [(set_attr "type" "branch,branch")
 
27617
    (set_attr "length" "4,8")])
 
27618
 
 
27619
+
 
27620
+;; Call to AIX abi function in the same module.
 
27621
+
 
27622
+(define_insn "*call_local_aix<mode>"
 
27623
+  [(call (mem:SI (match_operand:P 0 "current_file_function_operand" "s"))
 
27624
+        (match_operand 1 "" "g"))
 
27625
+   (clobber (reg:P LR_REGNO))]
 
27626
+  "DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_ELFv2"
 
27627
+  "bl %z0"
 
27628
+  [(set_attr "type" "branch")
 
27629
+   (set_attr "length" "4")])
 
27630
+
 
27631
+(define_insn "*call_value_local_aix<mode>"
 
27632
+  [(set (match_operand 0 "" "")
 
27633
+       (call (mem:SI (match_operand:P 1 "current_file_function_operand" "s"))
 
27634
+             (match_operand 2 "" "g")))
 
27635
+   (clobber (reg:P LR_REGNO))]
 
27636
+  "DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_ELFv2"
 
27637
+  "bl %z1"
 
27638
+  [(set_attr "type" "branch")
 
27639
+   (set_attr "length" "4")])
 
27640
+
 
27641
+;; Call to AIX abi function which may be in another module.
 
27642
+;; Restore the TOC pointer (r2) after the call.
 
27643
+
 
27644
+(define_insn "*call_nonlocal_aix<mode>"
 
27645
+  [(call (mem:SI (match_operand:P 0 "symbol_ref_operand" "s"))
 
27646
+        (match_operand 1 "" "g"))
 
27647
+   (clobber (reg:P LR_REGNO))]
 
27648
+  "DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_ELFv2"
 
27649
+  "bl %z0\;nop"
 
27650
+  [(set_attr "type" "branch")
 
27651
+   (set_attr "length" "8")])
 
27652
+
 
27653
+(define_insn "*call_value_nonlocal_aix<mode>"
 
27654
+  [(set (match_operand 0 "" "")
 
27655
+       (call (mem:SI (match_operand:P 1 "symbol_ref_operand" "s"))
 
27656
+             (match_operand 2 "" "g")))
 
27657
+   (clobber (reg:P LR_REGNO))]
 
27658
+  "DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_ELFv2"
 
27659
+  "bl %z1\;nop"
 
27660
+  [(set_attr "type" "branch")
 
27661
+   (set_attr "length" "8")])
 
27662
+
 
27663
+;; Call to indirect functions with the AIX abi using a 3 word descriptor.
 
27664
+;; Operand0 is the addresss of the function to call
 
27665
+;; Operand2 is the location in the function descriptor to load r2 from
 
27666
+;; Operand3 is the stack location to hold the current TOC pointer
 
27667
+
 
27668
+(define_insn "*call_indirect_aix<mode>"
 
27669
+  [(call (mem:SI (match_operand:P 0 "register_operand" "c,*l"))
 
27670
+        (match_operand 1 "" "g,g"))
 
27671
+   (use (match_operand:P 2 "memory_operand" "<ptrm>,<ptrm>"))
 
27672
+   (set (reg:P TOC_REGNUM) (match_operand:P 3 "memory_operand" "<ptrm>,<ptrm>"))
 
27673
+   (clobber (reg:P LR_REGNO))]
 
27674
+  "DEFAULT_ABI == ABI_AIX"
 
27675
+  "<ptrload> 2,%2\;b%T0l\;<ptrload> 2,%3"
 
27676
+  [(set_attr "type" "jmpreg")
 
27677
+   (set_attr "length" "12")])
 
27678
+
 
27679
+(define_insn "*call_value_indirect_aix<mode>"
 
27680
+  [(set (match_operand 0 "" "")
 
27681
+       (call (mem:SI (match_operand:P 1 "register_operand" "c,*l"))
 
27682
+             (match_operand 2 "" "g,g")))
 
27683
+   (use (match_operand:P 3 "memory_operand" "<ptrm>,<ptrm>"))
 
27684
+   (set (reg:P TOC_REGNUM) (match_operand:P 4 "memory_operand" "<ptrm>,<ptrm>"))
 
27685
+   (clobber (reg:P LR_REGNO))]
 
27686
+  "DEFAULT_ABI == ABI_AIX"
 
27687
+  "<ptrload> 2,%3\;b%T1l\;<ptrload> 2,%4"
 
27688
+  [(set_attr "type" "jmpreg")
 
27689
+   (set_attr "length" "12")])
 
27690
+
 
27691
+;; Call to indirect functions with the ELFv2 ABI.
 
27692
+;; Operand0 is the addresss of the function to call
 
27693
+;; Operand2 is the stack location to hold the current TOC pointer
 
27694
+
 
27695
+(define_insn "*call_indirect_elfv2<mode>"
 
27696
+  [(call (mem:SI (match_operand:P 0 "register_operand" "c,*l"))
 
27697
+        (match_operand 1 "" "g,g"))
 
27698
+   (set (reg:P TOC_REGNUM) (match_operand:P 2 "memory_operand" "<ptrm>,<ptrm>"))
 
27699
+   (clobber (reg:P LR_REGNO))]
 
27700
+  "DEFAULT_ABI == ABI_ELFv2"
 
27701
+  "b%T0l\;<ptrload> 2,%2"
 
27702
+  [(set_attr "type" "jmpreg")
 
27703
+   (set_attr "length" "8")])
 
27704
+
 
27705
+(define_insn "*call_value_indirect_elfv2<mode>"
 
27706
+  [(set (match_operand 0 "" "")
 
27707
+       (call (mem:SI (match_operand:P 1 "register_operand" "c,*l"))
 
27708
+             (match_operand 2 "" "g,g")))
 
27709
+   (set (reg:P TOC_REGNUM) (match_operand:P 3 "memory_operand" "<ptrm>,<ptrm>"))
 
27710
+   (clobber (reg:P LR_REGNO))]
 
27711
+  "DEFAULT_ABI == ABI_ELFv2"
 
27712
+  "b%T1l\;<ptrload> 2,%3"
 
27713
+  [(set_attr "type" "jmpreg")
 
27714
+   (set_attr "length" "8")])
 
27715
+
 
27716
+
 
27717
 ;; Call subroutine returning any type.
 
27718
 (define_expand "untyped_call"
 
27719
   [(parallel [(call (match_operand 0 "" "")
 
27720
@@ -11056,8 +12045,41 @@
 
27721
   gcc_assert (GET_CODE (operands[1]) == CONST_INT);
 
27722
 
 
27723
   operands[0] = XEXP (operands[0], 0);
 
27724
+
 
27725
+  if (DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_ELFv2)
 
27726
+    {
 
27727
+      rs6000_sibcall_aix (NULL_RTX, operands[0], operands[1], operands[2]);
 
27728
+      DONE;
 
27729
+    }
 
27730
 }")
 
27731
 
 
27732
+(define_expand "sibcall_value"
 
27733
+  [(parallel [(set (match_operand 0 "register_operand" "")
 
27734
+               (call (mem:SI (match_operand 1 "address_operand" ""))
 
27735
+                     (match_operand 2 "" "")))
 
27736
+             (use (match_operand 3 "" ""))
 
27737
+             (use (reg:SI LR_REGNO))
 
27738
+             (simple_return)])]
 
27739
+  ""
 
27740
+  "
 
27741
+{
 
27742
+#if TARGET_MACHO
 
27743
+  if (MACHOPIC_INDIRECT)
 
27744
+    operands[1] = machopic_indirect_call_target (operands[1]);
 
27745
+#endif
 
27746
+
 
27747
+  gcc_assert (GET_CODE (operands[1]) == MEM);
 
27748
+  gcc_assert (GET_CODE (operands[2]) == CONST_INT);
 
27749
+
 
27750
+  operands[1] = XEXP (operands[1], 0);
 
27751
+
 
27752
+  if (DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_ELFv2)
 
27753
+    {
 
27754
+      rs6000_sibcall_aix (operands[0], operands[1], operands[2], operands[3]);
 
27755
+      DONE;
 
27756
+    }
 
27757
+}")
 
27758
+
 
27759
 ;; this and similar patterns must be marked as using LR, otherwise
 
27760
 ;; dataflow will try to delete the store into it.  This is true
 
27761
 ;; even when the actual reg to jump to is in CTR, when LR was
 
27762
@@ -11123,7 +12145,6 @@
 
27763
   [(set_attr "type" "branch")
 
27764
    (set_attr "length" "4,8")])
 
27765
 
 
27766
-
 
27767
 (define_insn "*sibcall_value_local64"
 
27768
   [(set (match_operand 0 "" "")
 
27769
        (call (mem:SI (match_operand:DI 1 "current_file_function_operand" "s,s"))
 
27770
@@ -11145,35 +12166,6 @@
 
27771
   [(set_attr "type" "branch")
 
27772
    (set_attr "length" "4,8")])
 
27773
 
 
27774
-(define_insn "*sibcall_nonlocal_aix<mode>"
 
27775
-  [(call (mem:SI (match_operand:P 0 "call_operand" "s,c"))
 
27776
-        (match_operand 1 "" "g,g"))
 
27777
-   (use (match_operand:SI 2 "immediate_operand" "O,O"))
 
27778
-   (use (reg:SI LR_REGNO))
 
27779
-   (simple_return)]
 
27780
-  "DEFAULT_ABI == ABI_AIX
 
27781
-   && (INTVAL (operands[2]) & CALL_LONG) == 0"
 
27782
-  "@
 
27783
-   b %z0
 
27784
-   b%T0"
 
27785
-  [(set_attr "type" "branch")
 
27786
-   (set_attr "length" "4")])
 
27787
-
 
27788
-(define_insn "*sibcall_value_nonlocal_aix<mode>"
 
27789
-  [(set (match_operand 0 "" "")
 
27790
-       (call (mem:SI (match_operand:P 1 "call_operand" "s,c"))
 
27791
-             (match_operand 2 "" "g,g")))
 
27792
-   (use (match_operand:SI 3 "immediate_operand" "O,O"))
 
27793
-   (use (reg:SI LR_REGNO))
 
27794
-   (simple_return)]
 
27795
-  "DEFAULT_ABI == ABI_AIX
 
27796
-   && (INTVAL (operands[3]) & CALL_LONG) == 0"
 
27797
-  "@
 
27798
-   b %z1
 
27799
-   b%T1"
 
27800
-  [(set_attr "type" "branch")
 
27801
-   (set_attr "length" "4")])
 
27802
-
 
27803
 (define_insn "*sibcall_nonlocal_sysv<mode>"
 
27804
   [(call (mem:SI (match_operand:P 0 "call_operand" "s,s,c,c"))
 
27805
         (match_operand 1 "" ""))
 
27806
@@ -11204,27 +12196,6 @@
 
27807
   [(set_attr "type" "branch")
 
27808
    (set_attr "length" "4,8,4,8")])
 
27809
 
 
27810
-(define_expand "sibcall_value"
 
27811
-  [(parallel [(set (match_operand 0 "register_operand" "")
 
27812
-               (call (mem:SI (match_operand 1 "address_operand" ""))
 
27813
-                     (match_operand 2 "" "")))
 
27814
-             (use (match_operand 3 "" ""))
 
27815
-             (use (reg:SI LR_REGNO))
 
27816
-             (simple_return)])]
 
27817
-  ""
 
27818
-  "
 
27819
-{
 
27820
-#if TARGET_MACHO
 
27821
-  if (MACHOPIC_INDIRECT)
 
27822
-    operands[1] = machopic_indirect_call_target (operands[1]);
 
27823
-#endif
 
27824
-
 
27825
-  gcc_assert (GET_CODE (operands[1]) == MEM);
 
27826
-  gcc_assert (GET_CODE (operands[2]) == CONST_INT);
 
27827
-
 
27828
-  operands[1] = XEXP (operands[1], 0);
 
27829
-}")
 
27830
-
 
27831
 (define_insn "*sibcall_value_nonlocal_sysv<mode>"
 
27832
   [(set (match_operand 0 "" "")
 
27833
        (call (mem:SI (match_operand:P 1 "call_operand" "s,s,c,c"))
 
27834
@@ -11256,6 +12227,31 @@
 
27835
   [(set_attr "type" "branch")
 
27836
    (set_attr "length" "4,8,4,8")])
 
27837
 
 
27838
+;; AIX ABI sibling call patterns.
 
27839
+
 
27840
+(define_insn "*sibcall_aix<mode>"
 
27841
+  [(call (mem:SI (match_operand:P 0 "call_operand" "s,c"))
 
27842
+        (match_operand 1 "" "g,g"))
 
27843
+   (simple_return)]
 
27844
+  "DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_ELFv2"
 
27845
+  "@
 
27846
+   b %z0
 
27847
+   b%T0"
 
27848
+  [(set_attr "type" "branch")
 
27849
+   (set_attr "length" "4")])
 
27850
+
 
27851
+(define_insn "*sibcall_value_aix<mode>"
 
27852
+  [(set (match_operand 0 "" "")
 
27853
+       (call (mem:SI (match_operand:P 1 "call_operand" "s,c"))
 
27854
+             (match_operand 2 "" "g,g")))
 
27855
+   (simple_return)]
 
27856
+  "DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_ELFv2"
 
27857
+  "@
 
27858
+   b %z1
 
27859
+   b%T1"
 
27860
+  [(set_attr "type" "branch")
 
27861
+   (set_attr "length" "4")])
 
27862
+
 
27863
 (define_expand "sibcall_epilogue"
 
27864
   [(use (const_int 0))]
 
27865
   ""
 
27866
@@ -11294,7 +12290,14 @@
 
27867
   operands[1] = gen_rtx_REG (Pmode, 0);
 
27868
   return "st<wd>%U0%X0 %1,%0";
 
27869
 }
 
27870
-  [(set_attr "type" "store")
 
27871
+  [(set (attr "type")
 
27872
+      (if_then_else
 
27873
+       (match_test "update_indexed_address_mem (operands[0], VOIDmode)")
 
27874
+       (const_string "store_ux")
 
27875
+       (if_then_else
 
27876
+         (match_test "update_address_mem (operands[0], VOIDmode)")
 
27877
+         (const_string "store_u")
 
27878
+         (const_string "store"))))
 
27879
    (set_attr "length" "4")])
 
27880
 
 
27881
 (define_insn "probe_stack_range<P:mode>"
 
27882
@@ -11589,23 +12592,6 @@
 
27883
   [(set (match_dup 3) (compare:CCUNS (match_dup 1) (match_dup 2)))
 
27884
    (set (match_dup 0) (plus:SI (match_dup 1) (match_dup 4)))])
 
27885
 
 
27886
-(define_insn "*cmpsf_internal1"
 
27887
-  [(set (match_operand:CCFP 0 "cc_reg_operand" "=y")
 
27888
-       (compare:CCFP (match_operand:SF 1 "gpc_reg_operand" "f")
 
27889
-                     (match_operand:SF 2 "gpc_reg_operand" "f")))]
 
27890
-  "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT"
 
27891
-  "fcmpu %0,%1,%2"
 
27892
-  [(set_attr "type" "fpcompare")])
 
27893
-
 
27894
-(define_insn "*cmpdf_internal1"
 
27895
-  [(set (match_operand:CCFP 0 "cc_reg_operand" "=y")
 
27896
-       (compare:CCFP (match_operand:DF 1 "gpc_reg_operand" "d")
 
27897
-                     (match_operand:DF 2 "gpc_reg_operand" "d")))]
 
27898
-  "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
 
27899
-   && !VECTOR_UNIT_VSX_P (DFmode)"
 
27900
-  "fcmpu %0,%1,%2"
 
27901
-  [(set_attr "type" "fpcompare")])
 
27902
-
 
27903
 ;; Only need to compare second words if first words equal
 
27904
 (define_insn "*cmptf_internal1"
 
27905
   [(set (match_operand:CCFP 0 "cc_reg_operand" "=y")
 
27906
@@ -13501,6 +14487,14 @@
 
27907
   "mfcr %0"
 
27908
   [(set_attr "type" "mfcr")])
 
27909
 
 
27910
+(define_insn "*crsave"
 
27911
+  [(match_parallel 0 "crsave_operation"
 
27912
+                  [(set (match_operand:SI 1 "memory_operand" "=m")
 
27913
+                        (match_operand:SI 2 "gpc_reg_operand" "r"))])]
 
27914
+  ""
 
27915
+  "stw %2,%1"
 
27916
+  [(set_attr "type" "store")])
 
27917
+
 
27918
 (define_insn "*stmw"
 
27919
   [(match_parallel 0 "stmw_operation"
 
27920
                   [(set (match_operand:SI 1 "memory_operand" "=m")
 
27921
@@ -13885,7 +14879,7 @@
 
27922
                   (match_operand:P 2 "gpc_reg_operand" "r")] UNSPEC_BPERM))]
 
27923
   "TARGET_POPCNTD"
 
27924
   "bpermd %0,%1,%2"
 
27925
-  [(set_attr "type" "integer")])
 
27926
+  [(set_attr "type" "popcnt")])
 
27927
 
 
27928
 
 
27929
 ;; Builtin fma support.  Handle 
 
27930
@@ -13900,6 +14894,20 @@
 
27931
   ""
 
27932
   "")
 
27933
 
 
27934
+(define_insn "*fma<mode>4_fpr"
 
27935
+  [(set (match_operand:SFDF 0 "gpc_reg_operand" "=<Ff>,<Fv>,<Fv>")
 
27936
+       (fma:SFDF
 
27937
+         (match_operand:SFDF 1 "gpc_reg_operand" "%<Ff>,<Fv>,<Fv>")
 
27938
+         (match_operand:SFDF 2 "gpc_reg_operand" "<Ff>,<Fv>,0")
 
27939
+         (match_operand:SFDF 3 "gpc_reg_operand" "<Ff>,0,<Fv>")))]
 
27940
+  "TARGET_<MODE>_FPR"
 
27941
+  "@
 
27942
+   fmadd<Ftrad> %0,%1,%2,%3
 
27943
+   xsmadda<Fvsx> %x0,%x1,%x2
 
27944
+   xsmaddm<Fvsx> %x0,%x1,%x3"
 
27945
+  [(set_attr "type" "fp")
 
27946
+   (set_attr "fp_type" "fp_maddsub_<Fs>")])
 
27947
+
 
27948
 ; Altivec only has fma and nfms.
 
27949
 (define_expand "fms<mode>4"
 
27950
   [(set (match_operand:FMA_F 0 "register_operand" "")
 
27951
@@ -13910,6 +14918,20 @@
 
27952
   "!VECTOR_UNIT_ALTIVEC_P (<MODE>mode)"
 
27953
   "")
 
27954
 
 
27955
+(define_insn "*fms<mode>4_fpr"
 
27956
+  [(set (match_operand:SFDF 0 "gpc_reg_operand" "=<Ff>,<Fv>,<Fv>")
 
27957
+       (fma:SFDF
 
27958
+        (match_operand:SFDF 1 "gpc_reg_operand" "<Ff>,<Fv>,<Fv>")
 
27959
+        (match_operand:SFDF 2 "gpc_reg_operand" "<Ff>,<Fv>,0")
 
27960
+        (neg:SFDF (match_operand:SFDF 3 "gpc_reg_operand" "<Ff>,0,<Fv>"))))]
 
27961
+  "TARGET_<MODE>_FPR"
 
27962
+  "@
 
27963
+   fmsub<Ftrad> %0,%1,%2,%3
 
27964
+   xsmsuba<Fvsx> %x0,%x1,%x2
 
27965
+   xsmsubm<Fvsx> %x0,%x1,%x3"
 
27966
+  [(set_attr "type" "fp")
 
27967
+   (set_attr "fp_type" "fp_maddsub_<Fs>")])
 
27968
+
 
27969
 ;; If signed zeros are ignored, -(a * b - c) = -a * b + c.
 
27970
 (define_expand "fnma<mode>4"
 
27971
   [(set (match_operand:FMA_F 0 "register_operand" "")
 
27972
@@ -13943,6 +14965,21 @@
 
27973
   "!VECTOR_UNIT_ALTIVEC_P (<MODE>mode)"
 
27974
   "")
 
27975
 
 
27976
+(define_insn "*nfma<mode>4_fpr"
 
27977
+  [(set (match_operand:SFDF 0 "gpc_reg_operand" "=<Ff>,<Fv>,<Fv>")
 
27978
+       (neg:SFDF
 
27979
+        (fma:SFDF
 
27980
+         (match_operand:SFDF 1 "gpc_reg_operand" "<Ff>,<Fv>,<Fv>")
 
27981
+         (match_operand:SFDF 2 "gpc_reg_operand" "<Ff>,<Fv>,0")
 
27982
+         (match_operand:SFDF 3 "gpc_reg_operand" "<Ff>,0,<Fv>"))))]
 
27983
+  "TARGET_<MODE>_FPR"
 
27984
+  "@
 
27985
+   fnmadd<Ftrad> %0,%1,%2,%3
 
27986
+   xsnmadda<Fvsx> %x0,%x1,%x2
 
27987
+   xsnmaddm<Fvsx> %x0,%x1,%x3"
 
27988
+  [(set_attr "type" "fp")
 
27989
+   (set_attr "fp_type" "fp_maddsub_<Fs>")])
 
27990
+
 
27991
 ; Not an official optab name, but used from builtins.
 
27992
 (define_expand "nfms<mode>4"
 
27993
   [(set (match_operand:FMA_F 0 "register_operand" "")
 
27994
@@ -13954,6 +14991,23 @@
 
27995
   ""
 
27996
   "")
 
27997
 
 
27998
+(define_insn "*nfmssf4_fpr"
 
27999
+  [(set (match_operand:SFDF 0 "gpc_reg_operand" "=<Ff>,<Fv>,<Fv>")
 
28000
+       (neg:SFDF
 
28001
+        (fma:SFDF
 
28002
+         (match_operand:SFDF 1 "gpc_reg_operand" "<Ff>,<Fv>,<Fv>")
 
28003
+         (match_operand:SFDF 2 "gpc_reg_operand" "<Ff>,<Fv>,0")
 
28004
+         (neg:SFDF
 
28005
+          (match_operand:SFDF 3 "gpc_reg_operand" "<Ff>,0,<Fv>")))))]
 
28006
+  "TARGET_<MODE>_FPR"
 
28007
+  "@
 
28008
+   fnmsub<Ftrad> %0,%1,%2,%3
 
28009
+   xsnmsuba<Fvsx> %x0,%x1,%x2
 
28010
+   xsnmsubm<Fvsx> %x0,%x1,%x3"
 
28011
+  [(set_attr "type" "fp")
 
28012
+   (set_attr "fp_type" "fp_maddsub_<Fs>")])
 
28013
+
 
28014
+
 
28015
 (define_expand "rs6000_get_timebase"
 
28016
   [(use (match_operand:DI 0 "gpc_reg_operand" ""))]
 
28017
   ""
 
28018
@@ -14020,7 +15074,44 @@
 
28019
 })
 
28020
 
 
28021
 
 
28022
+;; Power8 fusion support for fusing an addis instruction with a D-form load of
 
28023
+;; a GPR.  The addis instruction must be adjacent to the load, and use the same
 
28024
+;; register that is being loaded.  The fused ops must be physically adjacent.
 
28025
 
 
28026
+;; We use define_peephole for the actual addis/load, and the register used to
 
28027
+;; hold the addis value must be the same as the register being loaded.  We use
 
28028
+;; define_peephole2 to change the register used for addis to be the register
 
28029
+;; being loaded, since we can look at whether it is dead after the load insn.
 
28030
+
 
28031
+(define_peephole
 
28032
+  [(set (match_operand:P 0 "base_reg_operand" "")
 
28033
+       (match_operand:P 1 "fusion_gpr_addis" ""))
 
28034
+   (set (match_operand:INT1 2 "base_reg_operand" "")
 
28035
+       (match_operand:INT1 3 "fusion_gpr_mem_load" ""))]
 
28036
+  "TARGET_P8_FUSION && fusion_gpr_load_p (operands, false)"
 
28037
+{
 
28038
+  return emit_fusion_gpr_load (operands);
 
28039
+}
 
28040
+  [(set_attr "type" "load")
 
28041
+   (set_attr "length" "8")])
 
28042
+
 
28043
+(define_peephole2
 
28044
+  [(set (match_operand:P 0 "base_reg_operand" "")
 
28045
+       (match_operand:P 1 "fusion_gpr_addis" ""))
 
28046
+   (set (match_operand:INT1 2 "base_reg_operand" "")
 
28047
+       (match_operand:INT1 3 "fusion_gpr_mem_load" ""))]
 
28048
+  "TARGET_P8_FUSION
 
28049
+   && (REGNO (operands[0]) != REGNO (operands[2])
 
28050
+       || GET_CODE (operands[3]) == SIGN_EXTEND)
 
28051
+   && fusion_gpr_load_p (operands, true)"
 
28052
+  [(const_int 0)]
 
28053
+{
 
28054
+  expand_fusion_gpr_load (operands);
 
28055
+  DONE;
 
28056
+})
 
28057
+
 
28058
+
 
28059
+
 
28060
 (include "sync.md")
 
28061
 (include "vector.md")
 
28062
 (include "vsx.md")
 
28063
@@ -14028,3 +15119,5 @@
 
28064
 (include "spe.md")
 
28065
 (include "dfp.md")
 
28066
 (include "paired.md")
 
28067
+(include "crypto.md")
 
28068
+(include "htm.md")
 
28069
--- a/src/gcc/config/rs6000/option-defaults.h
 
28070
+++ b/src/gcc/config/rs6000/option-defaults.h
 
28071
@@ -54,6 +54,7 @@
 
28072
    --with-float is ignored if -mhard-float or -msoft-float are
 
28073
      specified.  */
 
28074
 #define OPTION_DEFAULT_SPECS \
 
28075
+  {"abi", "%{!mabi=elfv*:-mabi=%(VALUE)}" }, \
 
28076
   {"tune", "%{!mtune=*:%{!mcpu=*:-mtune=%(VALUE)}}" }, \
 
28077
   {"tune_32", "%{" OPT_ARCH32 ":%{!mtune=*:%{!mcpu=*:-mtune=%(VALUE)}}}" }, \
 
28078
   {"tune_64", "%{" OPT_ARCH64 ":%{!mtune=*:%{!mcpu=*:-mtune=%(VALUE)}}}" }, \
 
28079
--- a/src/gcc/config/rs6000/rs6000-opts.h
 
28080
+++ b/src/gcc/config/rs6000/rs6000-opts.h
 
28081
@@ -59,7 +59,8 @@
 
28082
    PROCESSOR_POWER7,
 
28083
    PROCESSOR_CELL,
 
28084
    PROCESSOR_PPCA2,
 
28085
-   PROCESSOR_TITAN
 
28086
+   PROCESSOR_TITAN,
 
28087
+   PROCESSOR_POWER8
 
28088
 };
 
28089
 
 
28090
 /* FP processor type.  */
 
28091
@@ -100,7 +101,8 @@
 
28092
 /* Enumeration to give which calling sequence to use.  */
 
28093
 enum rs6000_abi {
 
28094
   ABI_NONE,
 
28095
-  ABI_AIX,                     /* IBM's AIX */
 
28096
+  ABI_AIX,                     /* IBM's AIX, or Linux ELFv1 */
 
28097
+  ABI_ELFv2,                   /* Linux ELFv2 ABI */
 
28098
   ABI_V4,                      /* System V.4/eabi */
 
28099
   ABI_DARWIN                   /* Apple's Darwin (OS X kernel) */
 
28100
 };
 
28101
@@ -131,11 +133,14 @@
 
28102
   CMODEL_LARGE
 
28103
 };
 
28104
 
 
28105
-/* Describe which vector unit to use for a given machine mode.  */
 
28106
+/* Describe which vector unit to use for a given machine mode.  The
 
28107
+   VECTOR_MEM_* and VECTOR_UNIT_* macros assume that Altivec, VSX, and
 
28108
+   P8_VECTOR are contiguous.  */
 
28109
 enum rs6000_vector {
 
28110
   VECTOR_NONE,                 /* Type is not  a vector or not supported */
 
28111
   VECTOR_ALTIVEC,              /* Use altivec for vector processing */
 
28112
   VECTOR_VSX,                  /* Use VSX for vector processing */
 
28113
+  VECTOR_P8_VECTOR,            /* Use ISA 2.07 VSX for vector processing */
 
28114
   VECTOR_PAIRED,               /* Use paired floating point for vectors */
 
28115
   VECTOR_SPE,                  /* Use SPE for vector processing */
 
28116
   VECTOR_OTHER                 /* Some other vector unit */
 
28117
--- a/src/gcc/config/rs6000/driver-rs6000.c
 
28118
+++ b/src/gcc/config/rs6000/driver-rs6000.c
 
28119
@@ -167,7 +167,7 @@
 
28120
 
 
28121
   if (fd != -1)
 
28122
     {
 
28123
-      char buf[1024];
 
28124
+      static char buf[1024];
 
28125
       ElfW(auxv_t) *av;
 
28126
       ssize_t n;
 
28127
 
 
28128
--- a/src/gcc/config/rs6000/altivec.h
 
28129
+++ b/src/gcc/config/rs6000/altivec.h
 
28130
@@ -321,6 +321,42 @@
 
28131
 #define vec_vsx_st __builtin_vec_vsx_st
 
28132
 #endif
 
28133
 
 
28134
+#ifdef _ARCH_PWR8
 
28135
+/* Vector additions added in ISA 2.07.  */
 
28136
+#define vec_eqv __builtin_vec_eqv
 
28137
+#define vec_nand __builtin_vec_nand
 
28138
+#define vec_orc __builtin_vec_orc
 
28139
+#define vec_vaddudm __builtin_vec_vaddudm
 
28140
+#define vec_vclz __builtin_vec_vclz
 
28141
+#define vec_vclzb __builtin_vec_vclzb
 
28142
+#define vec_vclzd __builtin_vec_vclzd
 
28143
+#define vec_vclzh __builtin_vec_vclzh
 
28144
+#define vec_vclzw __builtin_vec_vclzw
 
28145
+#define vec_vgbbd __builtin_vec_vgbbd
 
28146
+#define vec_vmaxsd __builtin_vec_vmaxsd
 
28147
+#define vec_vmaxud __builtin_vec_vmaxud
 
28148
+#define vec_vminsd __builtin_vec_vminsd
 
28149
+#define vec_vminud __builtin_vec_vminud
 
28150
+#define vec_vmrgew __builtin_vec_vmrgew
 
28151
+#define vec_vmrgow __builtin_vec_vmrgow
 
28152
+#define vec_vpksdss __builtin_vec_vpksdss
 
28153
+#define vec_vpksdus __builtin_vec_vpksdus
 
28154
+#define vec_vpkudum __builtin_vec_vpkudum
 
28155
+#define vec_vpkudus __builtin_vec_vpkudus
 
28156
+#define vec_vpopcnt __builtin_vec_vpopcnt
 
28157
+#define vec_vpopcntb __builtin_vec_vpopcntb
 
28158
+#define vec_vpopcntd __builtin_vec_vpopcntd
 
28159
+#define vec_vpopcnth __builtin_vec_vpopcnth
 
28160
+#define vec_vpopcntw __builtin_vec_vpopcntw
 
28161
+#define vec_vrld __builtin_vec_vrld
 
28162
+#define vec_vsld __builtin_vec_vsld
 
28163
+#define vec_vsrad __builtin_vec_vsrad
 
28164
+#define vec_vsrd __builtin_vec_vsrd
 
28165
+#define vec_vsubudm __builtin_vec_vsubudm
 
28166
+#define vec_vupkhsw __builtin_vec_vupkhsw
 
28167
+#define vec_vupklsw __builtin_vec_vupklsw
 
28168
+#endif
 
28169
+
 
28170
 /* Predicates.
 
28171
    For C++, we use templates in order to allow non-parenthesized arguments.
 
28172
    For C, instead, we use macros since non-parenthesized arguments were
 
28173
--- a/src/gcc/config/rs6000/sysv4.h
 
28174
+++ b/src/gcc/config/rs6000/sysv4.h
 
28175
@@ -45,7 +45,7 @@
 
28176
                                      & (OPTION_MASK_RELOCATABLE        \
 
28177
                                         | OPTION_MASK_MINIMAL_TOC))    \
 
28178
                                     && flag_pic > 1)                   \
 
28179
-                                || DEFAULT_ABI == ABI_AIX)
 
28180
+                                || DEFAULT_ABI != ABI_V4)
 
28181
 
 
28182
 #define        TARGET_BITFIELD_TYPE    (! TARGET_NO_BITFIELD_TYPE)
 
28183
 #define        TARGET_BIG_ENDIAN       (! TARGET_LITTLE_ENDIAN)
 
28184
@@ -147,7 +147,7 @@
 
28185
             rs6000_sdata_name);                                        \
 
28186
     }                                                                  \
 
28187
                                                                        \
 
28188
-  else if (flag_pic && DEFAULT_ABI != ABI_AIX                          \
 
28189
+  else if (flag_pic && DEFAULT_ABI == ABI_V4                           \
 
28190
           && (rs6000_sdata == SDATA_EABI                               \
 
28191
               || rs6000_sdata == SDATA_SYSV))                          \
 
28192
     {                                                                  \
 
28193
@@ -173,14 +173,14 @@
 
28194
       error ("-mrelocatable and -mno-minimal-toc are incompatible");   \
 
28195
     }                                                                  \
 
28196
                                                                        \
 
28197
-  if (TARGET_RELOCATABLE && rs6000_current_abi == ABI_AIX)             \
 
28198
+  if (TARGET_RELOCATABLE && rs6000_current_abi != ABI_V4)              \
 
28199
     {                                                                  \
 
28200
       rs6000_isa_flags &= ~OPTION_MASK_RELOCATABLE;                    \
 
28201
       error ("-mrelocatable and -mcall-%s are incompatible",           \
 
28202
             rs6000_abi_name);                                          \
 
28203
     }                                                                  \
 
28204
                                                                        \
 
28205
-  if (!TARGET_64BIT && flag_pic > 1 && rs6000_current_abi == ABI_AIX)  \
 
28206
+  if (!TARGET_64BIT && flag_pic > 1 && rs6000_current_abi != ABI_V4)   \
 
28207
     {                                                                  \
 
28208
       flag_pic = 0;                                                    \
 
28209
       error ("-fPIC and -mcall-%s are incompatible",                   \
 
28210
@@ -193,7 +193,7 @@
 
28211
     }                                                                  \
 
28212
                                                                        \
 
28213
   /* Treat -fPIC the same as -mrelocatable.  */                                \
 
28214
-  if (flag_pic > 1 && DEFAULT_ABI != ABI_AIX)                          \
 
28215
+  if (flag_pic > 1 && DEFAULT_ABI == ABI_V4)                           \
 
28216
     {                                                                  \
 
28217
       rs6000_isa_flags |= OPTION_MASK_RELOCATABLE | OPTION_MASK_MINIMAL_TOC; \
 
28218
       TARGET_NO_FP_IN_TOC = 1;                                         \
 
28219
@@ -317,7 +317,7 @@
 
28220
 
 
28221
 /* Put PC relative got entries in .got2.  */
 
28222
 #define        MINIMAL_TOC_SECTION_ASM_OP \
 
28223
-  (TARGET_RELOCATABLE || (flag_pic && DEFAULT_ABI != ABI_AIX)          \
 
28224
+  (TARGET_RELOCATABLE || (flag_pic && DEFAULT_ABI == ABI_V4)           \
 
28225
    ? "\t.section\t\".got2\",\"aw\"" : "\t.section\t\".got1\",\"aw\"")
 
28226
 
 
28227
 #define        SDATA_SECTION_ASM_OP "\t.section\t\".sdata\",\"aw\""
 
28228
@@ -538,12 +538,7 @@
 
28229
 
 
28230
 #define        CC1_ENDIAN_BIG_SPEC ""
 
28231
 
 
28232
-#define        CC1_ENDIAN_LITTLE_SPEC "\
 
28233
-%{!mstrict-align: %{!mno-strict-align: \
 
28234
-    %{!mcall-i960-old: \
 
28235
-       -mstrict-align \
 
28236
-    } \
 
28237
-}}"
 
28238
+#define        CC1_ENDIAN_LITTLE_SPEC ""
 
28239
 
 
28240
 #define        CC1_ENDIAN_DEFAULT_SPEC "%(cc1_endian_big)"
 
28241
 
 
28242
--- a/src/libgo/configure
 
28243
+++ b/src/libgo/configure
 
28244
@@ -6501,7 +6501,7 @@
 
28245
   rm -rf conftest*
 
28246
   ;;
 
28247
 
 
28248
-x86_64-*kfreebsd*-gnu|x86_64-*linux*|ppc*-*linux*|powerpc*-*linux*| \
 
28249
+x86_64-*kfreebsd*-gnu|x86_64-*linux*|powerpc*-*linux*| \
 
28250
 s390*-*linux*|s390*-*tpf*|sparc*-*linux*)
 
28251
   # Find out which ABI we are using.
 
28252
   echo 'int i;' > conftest.$ac_ext
 
28253
@@ -6519,7 +6519,10 @@
 
28254
          x86_64-*linux*)
 
28255
            LD="${LD-ld} -m elf_i386"
 
28256
            ;;
 
28257
-         ppc64-*linux*|powerpc64-*linux*)
 
28258
+         powerpc64le-*linux*)
 
28259
+           LD="${LD-ld} -m elf32lppclinux"
 
28260
+           ;;
 
28261
+         powerpc64-*linux*)
 
28262
            LD="${LD-ld} -m elf32ppclinux"
 
28263
            ;;
 
28264
          s390x-*linux*)
 
28265
@@ -6538,7 +6541,10 @@
 
28266
          x86_64-*linux*)
 
28267
            LD="${LD-ld} -m elf_x86_64"
 
28268
            ;;
 
28269
-         ppc*-*linux*|powerpc*-*linux*)
 
28270
+         powerpcle-*linux*)
 
28271
+           LD="${LD-ld} -m elf64lppc"
 
28272
+           ;;
 
28273
+         powerpc-*linux*)
 
28274
            LD="${LD-ld} -m elf64ppc"
 
28275
            ;;
 
28276
          s390*-*linux*|s390*-*tpf*)
 
28277
@@ -11105,7 +11111,7 @@
 
28278
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
 
28279
   lt_status=$lt_dlunknown
 
28280
   cat > conftest.$ac_ext <<_LT_EOF
 
28281
-#line 11108 "configure"
 
28282
+#line 11114 "configure"
 
28283
 #include "confdefs.h"
 
28284
 
 
28285
 #if HAVE_DLFCN_H
 
28286
@@ -11211,7 +11217,7 @@
 
28287
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
 
28288
   lt_status=$lt_dlunknown
 
28289
   cat > conftest.$ac_ext <<_LT_EOF
 
28290
-#line 11214 "configure"
 
28291
+#line 11220 "configure"
 
28292
 #include "confdefs.h"
 
28293
 
 
28294
 #if HAVE_DLFCN_H
 
28295
--- a/src/libgo/config/libtool.m4
 
28296
+++ b/src/libgo/config/libtool.m4
 
28297
@@ -1225,7 +1225,7 @@
 
28298
   rm -rf conftest*
 
28299
   ;;
 
28300
 
 
28301
-x86_64-*kfreebsd*-gnu|x86_64-*linux*|ppc*-*linux*|powerpc*-*linux*| \
 
28302
+x86_64-*kfreebsd*-gnu|x86_64-*linux*|powerpc*-*linux*| \
 
28303
 s390*-*linux*|s390*-*tpf*|sparc*-*linux*)
 
28304
   # Find out which ABI we are using.
 
28305
   echo 'int i;' > conftest.$ac_ext
 
28306
@@ -1239,7 +1239,10 @@
 
28307
          x86_64-*linux*)
 
28308
            LD="${LD-ld} -m elf_i386"
 
28309
            ;;
 
28310
-         ppc64-*linux*|powerpc64-*linux*)
 
28311
+         powerpc64le-*linux*)
 
28312
+           LD="${LD-ld} -m elf32lppclinux"
 
28313
+           ;;
 
28314
+         powerpc64-*linux*)
 
28315
            LD="${LD-ld} -m elf32ppclinux"
 
28316
            ;;
 
28317
          s390x-*linux*)
 
28318
@@ -1258,7 +1261,10 @@
 
28319
          x86_64-*linux*)
 
28320
            LD="${LD-ld} -m elf_x86_64"
 
28321
            ;;
 
28322
-         ppc*-*linux*|powerpc*-*linux*)
 
28323
+         powerpcle-*linux*)
 
28324
+           LD="${LD-ld} -m elf64lppc"
 
28325
+           ;;
 
28326
+         powerpc-*linux*)
 
28327
            LD="${LD-ld} -m elf64ppc"
 
28328
            ;;
 
28329
          s390*-*linux*|s390*-*tpf*)
 
28330
--- a/src/config.sub
 
28331
+++ b/src/config.sub
 
28332
@@ -1,10 +1,8 @@
 
28333
 #! /bin/sh
 
28334
 # Configuration validation subroutine script.
 
28335
-#   Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
 
28336
-#   2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010,
 
28337
-#   2011, 2012, 2013 Free Software Foundation, Inc.
 
28338
+#   Copyright 1992-2013 Free Software Foundation, Inc.
 
28339
 
 
28340
-timestamp='2013-01-11'
 
28341
+timestamp='2013-10-01'
 
28342
 
 
28343
 # This file is free software; you can redistribute it and/or modify it
 
28344
 # under the terms of the GNU General Public License as published by
 
28345
@@ -70,9 +68,7 @@
 
28346
 version="\
 
28347
 GNU config.sub ($timestamp)
 
28348
 
 
28349
-Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
 
28350
-2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011,
 
28351
-2012, 2013 Free Software Foundation, Inc.
 
28352
+Copyright 1992-2013 Free Software Foundation, Inc.
 
28353
 
 
28354
 This is free software; see the source for copying conditions.  There is NO
 
28355
 warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
 
28356
@@ -256,12 +252,12 @@
 
28357
        | alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \
 
28358
        | alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \
 
28359
        | am33_2.0 \
 
28360
-       | arc \
 
28361
+       | arc | arceb \
 
28362
        | arm | arm[bl]e | arme[lb] | armv[2-8] | armv[3-8][lb] | armv7[arm] \
 
28363
        | avr | avr32 \
 
28364
        | be32 | be64 \
 
28365
        | bfin \
 
28366
-       | c4x | clipper \
 
28367
+       | c4x | c8051 | clipper \
 
28368
        | d10v | d30v | dlx | dsp16xx \
 
28369
        | epiphany \
 
28370
        | fido | fr30 | frv \
 
28371
@@ -269,6 +265,7 @@
 
28372
        | hexagon \
 
28373
        | i370 | i860 | i960 | ia64 \
 
28374
        | ip2k | iq2000 \
 
28375
+       | k1om \
 
28376
        | le32 | le64 \
 
28377
        | lm32 \
 
28378
        | m32c | m32r | m32rle | m68000 | m68k | m88k \
 
28379
@@ -297,10 +294,10 @@
 
28380
        | mt \
 
28381
        | msp430 \
 
28382
        | nds32 | nds32le | nds32be \
 
28383
-       | nios | nios2 \
 
28384
+       | nios | nios2 | nios2eb | nios2el \
 
28385
        | ns16k | ns32k \
 
28386
        | open8 \
 
28387
-       | or32 \
 
28388
+       | or1k | or32 \
 
28389
        | pdp10 | pdp11 | pj | pjl \
 
28390
        | powerpc | powerpc64 | powerpc64le | powerpcle \
 
28391
        | pyramid \
 
28392
@@ -328,7 +325,7 @@
 
28393
        c6x)
 
28394
                basic_machine=tic6x-unknown
 
28395
                ;;
 
28396
-       m6811 | m68hc11 | m6812 | m68hc12 | m68hcs12x | picochip)
 
28397
+       m6811 | m68hc11 | m6812 | m68hc12 | m68hcs12x | nvptx | picochip)
 
28398
                basic_machine=$basic_machine-unknown
 
28399
                os=-none
 
28400
                ;;
 
28401
@@ -370,13 +367,13 @@
 
28402
        | aarch64-* | aarch64_be-* \
 
28403
        | alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \
 
28404
        | alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \
 
28405
-       | alphapca5[67]-* | alpha64pca5[67]-* | arc-* \
 
28406
+       | alphapca5[67]-* | alpha64pca5[67]-* | arc-* | arceb-* \
 
28407
        | arm-*  | armbe-* | armle-* | armeb-* | armv*-* \
 
28408
        | avr-* | avr32-* \
 
28409
        | be32-* | be64-* \
 
28410
        | bfin-* | bs2000-* \
 
28411
        | c[123]* | c30-* | [cjt]90-* | c4x-* \
 
28412
-       | clipper-* | craynv-* | cydra-* \
 
28413
+       | c8051-* | clipper-* | craynv-* | cydra-* \
 
28414
        | d10v-* | d30v-* | dlx-* \
 
28415
        | elxsi-* \
 
28416
        | f30[01]-* | f700-* | fido-* | fr30-* | frv-* | fx80-* \
 
28417
@@ -385,6 +382,7 @@
 
28418
        | hexagon-* \
 
28419
        | i*86-* | i860-* | i960-* | ia64-* \
 
28420
        | ip2k-* | iq2000-* \
 
28421
+       | k1om-* \
 
28422
        | le32-* | le64-* \
 
28423
        | lm32-* \
 
28424
        | m32c-* | m32r-* | m32rle-* \
 
28425
@@ -414,7 +412,7 @@
 
28426
        | mt-* \
 
28427
        | msp430-* \
 
28428
        | nds32-* | nds32le-* | nds32be-* \
 
28429
-       | nios-* | nios2-* \
 
28430
+       | nios-* | nios2-* | nios2eb-* | nios2el-* \
 
28431
        | none-* | np1-* | ns16k-* | ns32k-* \
 
28432
        | open8-* \
 
28433
        | orion-* \
 
28434
@@ -798,7 +796,7 @@
 
28435
                os=-mingw64
 
28436
                ;;
 
28437
        mingw32)
 
28438
-               basic_machine=i386-pc
 
28439
+               basic_machine=i686-pc
 
28440
                os=-mingw32
 
28441
                ;;
 
28442
        mingw32ce)
 
28443
@@ -834,7 +832,7 @@
 
28444
                basic_machine=`echo $basic_machine | sed -e 's/ms1-/mt-/'`
 
28445
                ;;
 
28446
        msys)
 
28447
-               basic_machine=i386-pc
 
28448
+               basic_machine=i686-pc
 
28449
                os=-msys
 
28450
                ;;
 
28451
        mvs)
 
28452
@@ -1550,6 +1548,9 @@
 
28453
        c4x-* | tic4x-*)
 
28454
                os=-coff
 
28455
                ;;
 
28456
+       c8051-*)
 
28457
+               os=-elf
 
28458
+               ;;
 
28459
        hexagon-*)
 
28460
                os=-elf
 
28461
                ;;
 
28462
@@ -1593,6 +1594,9 @@
 
28463
        mips*-*)
 
28464
                os=-elf
 
28465
                ;;
 
28466
+       or1k-*)
 
28467
+               os=-elf
 
28468
+               ;;
 
28469
        or32-*)
 
28470
                os=-coff
 
28471
                ;;
 
28472
--- a/src/ChangeLog.ibm
 
28473
+++ b/src/ChangeLog.ibm
 
28474
@@ -0,0 +1,71 @@
 
28475
+2013-11-22  Ulrich Weigand  <Ulrich.Weigand@de.ibm.com>
 
28476
+
 
28477
+       * libgo/config/libtool.m4: Update to mainline version.
 
28478
+       * libgo/configure: Regenerate.
 
28479
+
 
28480
+2013-11-19  Ulrich Weigand  <Ulrich.Weigand@de.ibm.com>
 
28481
+
 
28482
+       Backport from mainline r205000.
 
28483
+
 
28484
+       gotest: Recognize PPC ELF v2 function pointers in text section.
 
28485
+
 
28486
+2013-11-18  Alan Modra  <amodra@gmail.com>
 
28487
+
 
28488
+       * libffi/src/powerpc/ppc_closure.S: Don't bl .Luint128.
 
28489
+
 
28490
+       * libffi/src/powerpc/ffitarget.h: Import from upstream.
 
28491
+       * libffi/src/powerpc/ffi.c: Likewise.
 
28492
+       * libffi/src/powerpc/linux64.S: Likewise.
 
28493
+       * libffi/src/powerpc/linux64_closure.S: Likewise.
 
28494
+       * libffi/doc/libffi.texi: Likewise.
 
28495
+       * libffi/testsuite/libffi.call/cls_double_va.c: Likewise.
 
28496
+       * libffi/testsuite/libffi.call/cls_longdouble_va.c: Likewise.
 
28497
+
 
28498
+2013-11-17  Ulrich Weigand  <Ulrich.Weigand@de.ibm.com>
 
28499
+
 
28500
+       * libgo/config/libtool.m4: Update to mainline version.
 
28501
+       * libgo/configure: Regenerate.
 
28502
+
 
28503
+2013-11-15  Ulrich Weigand  <Ulrich.Weigand@de.ibm.com>
 
28504
+
 
28505
+       * libtool.m4: Update to mainline version.
 
28506
+       * libjava/libltdl/acinclude.m4: Likewise.
 
28507
+
 
28508
+       * gcc/configure: Regenerate.
 
28509
+       * boehm-gc/configure: Regenerate.
 
28510
+       * libatomic/configure: Regenerate.
 
28511
+       * libbacktrace/configure: Regenerate.
 
28512
+       * libffi/configure: Regenerate.
 
28513
+       * libgfortran/configure: Regenerate.
 
28514
+       * libgomp/configure: Regenerate.
 
28515
+       * libitm/configure: Regenerate.
 
28516
+       * libjava/configure: Regenerate.
 
28517
+       * libjava/libltdl/configure: Regenerate.
 
28518
+       * libjava/classpath/configure: Regenerate.
 
28519
+       * libmudflap/configure: Regenerate.
 
28520
+       * libobjc/configure: Regenerate.
 
28521
+       * libquadmath/configure: Regenerate.
 
28522
+       * libsanitizer/configure: Regenerate.
 
28523
+       * libssp/configure: Regenerate.
 
28524
+       * libstdc++-v3/configure: Regenerate.
 
28525
+       * lto-plugin/configure: Regenerate.
 
28526
+       * zlib/configure: Regenerate.
 
28527
+
 
28528
+2013-11-15  Ulrich Weigand  <Ulrich.Weigand@de.ibm.com>
 
28529
+
 
28530
+       Backport from mainline r203071:
 
28531
+
 
28532
+       2013-10-01  Joern Rennecke  <joern.rennecke@embecosm.com>
 
28533
+
 
28534
+       Import from savannah.gnu.org:
 
28535
+       * config.guess: Update to 2013-06-10 version.
 
28536
+       * config.sub: Update to 2013-10-01 version.
 
28537
+
 
28538
+2013-11-12  Bill Schmidt  <wschmidt@linux.ibm.com>
 
28539
+
 
28540
+       Backport from mainline
 
28541
+       2013-09-20  Alan Modra  <amodra@gmail.com>
 
28542
+
 
28543
+       * libtool.m4 (_LT_ENABLE_LOCK <ld -m flags>): Remove non-canonical
 
28544
+       ppc host match.  Support little-endian powerpc linux hosts.
 
28545
+
 
28546
--- a/src/libobjc/configure
 
28547
+++ b/src/libobjc/configure
 
28548
@@ -6056,7 +6056,7 @@
 
28549
   rm -rf conftest*
 
28550
   ;;
 
28551
 
 
28552
-x86_64-*kfreebsd*-gnu|x86_64-*linux*|ppc*-*linux*|powerpc*-*linux*| \
 
28553
+x86_64-*kfreebsd*-gnu|x86_64-*linux*|powerpc*-*linux*| \
 
28554
 s390*-*linux*|s390*-*tpf*|sparc*-*linux*)
 
28555
   # Find out which ABI we are using.
 
28556
   echo 'int i;' > conftest.$ac_ext
 
28557
@@ -6081,7 +6081,10 @@
 
28558
                ;;
 
28559
            esac
 
28560
            ;;
 
28561
-         ppc64-*linux*|powerpc64-*linux*)
 
28562
+         powerpc64le-*linux*)
 
28563
+           LD="${LD-ld} -m elf32lppclinux"
 
28564
+           ;;
 
28565
+         powerpc64-*linux*)
 
28566
            LD="${LD-ld} -m elf32ppclinux"
 
28567
            ;;
 
28568
          s390x-*linux*)
 
28569
@@ -6100,7 +6103,10 @@
 
28570
          x86_64-*linux*)
 
28571
            LD="${LD-ld} -m elf_x86_64"
 
28572
            ;;
 
28573
-         ppc*-*linux*|powerpc*-*linux*)
 
28574
+         powerpcle-*linux*)
 
28575
+           LD="${LD-ld} -m elf64lppc"
 
28576
+           ;;
 
28577
+         powerpc-*linux*)
 
28578
            LD="${LD-ld} -m elf64ppc"
 
28579
            ;;
 
28580
          s390*-*linux*|s390*-*tpf*)
 
28581
@@ -10595,7 +10601,7 @@
 
28582
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
 
28583
   lt_status=$lt_dlunknown
 
28584
   cat > conftest.$ac_ext <<_LT_EOF
 
28585
-#line 10598 "configure"
 
28586
+#line 10604 "configure"
 
28587
 #include "confdefs.h"
 
28588
 
 
28589
 #if HAVE_DLFCN_H
 
28590
@@ -10701,7 +10707,7 @@
 
28591
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
 
28592
   lt_status=$lt_dlunknown
 
28593
   cat > conftest.$ac_ext <<_LT_EOF
 
28594
-#line 10704 "configure"
 
28595
+#line 10710 "configure"
 
28596
 #include "confdefs.h"
 
28597
 
 
28598
 #if HAVE_DLFCN_H
 
28599
@@ -11472,7 +11478,7 @@
 
28600
   enableval=$enable_sjlj_exceptions; :
 
28601
 else
 
28602
   cat > conftest.$ac_ext << EOF
 
28603
-#line 11475 "configure"
 
28604
+#line 11481 "configure"
 
28605
 @interface Frob
 
28606
 @end
 
28607
 @implementation Frob
 
28608
--- a/src/libgfortran/configure
 
28609
+++ b/src/libgfortran/configure
 
28610
@@ -8062,7 +8062,7 @@
 
28611
   rm -rf conftest*
 
28612
   ;;
 
28613
 
 
28614
-x86_64-*kfreebsd*-gnu|x86_64-*linux*|ppc*-*linux*|powerpc*-*linux*| \
 
28615
+x86_64-*kfreebsd*-gnu|x86_64-*linux*|powerpc*-*linux*| \
 
28616
 s390*-*linux*|s390*-*tpf*|sparc*-*linux*)
 
28617
   # Find out which ABI we are using.
 
28618
   echo 'int i;' > conftest.$ac_ext
 
28619
@@ -8087,7 +8087,10 @@
 
28620
                ;;
 
28621
            esac
 
28622
            ;;
 
28623
-         ppc64-*linux*|powerpc64-*linux*)
 
28624
+         powerpc64le-*linux*)
 
28625
+           LD="${LD-ld} -m elf32lppclinux"
 
28626
+           ;;
 
28627
+         powerpc64-*linux*)
 
28628
            LD="${LD-ld} -m elf32ppclinux"
 
28629
            ;;
 
28630
          s390x-*linux*)
 
28631
@@ -8106,7 +8109,10 @@
 
28632
          x86_64-*linux*)
 
28633
            LD="${LD-ld} -m elf_x86_64"
 
28634
            ;;
 
28635
-         ppc*-*linux*|powerpc*-*linux*)
 
28636
+         powerpcle-*linux*)
 
28637
+           LD="${LD-ld} -m elf64lppc"
 
28638
+           ;;
 
28639
+         powerpc-*linux*)
 
28640
            LD="${LD-ld} -m elf64ppc"
 
28641
            ;;
 
28642
          s390*-*linux*|s390*-*tpf*)
 
28643
@@ -12333,7 +12339,7 @@
 
28644
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
 
28645
   lt_status=$lt_dlunknown
 
28646
   cat > conftest.$ac_ext <<_LT_EOF
 
28647
-#line 12336 "configure"
 
28648
+#line 12342 "configure"
 
28649
 #include "confdefs.h"
 
28650
 
 
28651
 #if HAVE_DLFCN_H
 
28652
@@ -12439,7 +12445,7 @@
 
28653
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
 
28654
   lt_status=$lt_dlunknown
 
28655
   cat > conftest.$ac_ext <<_LT_EOF
 
28656
-#line 12442 "configure"
 
28657
+#line 12448 "configure"
 
28658
 #include "confdefs.h"
 
28659
 
 
28660
 #if HAVE_DLFCN_H
 
28661
--- a/src/libffi/configure
 
28662
+++ b/src/libffi/configure
 
28663
@@ -6392,7 +6392,7 @@
 
28664
   rm -rf conftest*
 
28665
   ;;
 
28666
 
 
28667
-x86_64-*kfreebsd*-gnu|x86_64-*linux*|ppc*-*linux*|powerpc*-*linux*| \
 
28668
+x86_64-*kfreebsd*-gnu|x86_64-*linux*|powerpc*-*linux*| \
 
28669
 s390*-*linux*|s390*-*tpf*|sparc*-*linux*)
 
28670
   # Find out which ABI we are using.
 
28671
   echo 'int i;' > conftest.$ac_ext
 
28672
@@ -6417,7 +6417,10 @@
 
28673
                ;;
 
28674
            esac
 
28675
            ;;
 
28676
-         ppc64-*linux*|powerpc64-*linux*)
 
28677
+         powerpc64le-*linux*)
 
28678
+           LD="${LD-ld} -m elf32lppclinux"
 
28679
+           ;;
 
28680
+         powerpc64-*linux*)
 
28681
            LD="${LD-ld} -m elf32ppclinux"
 
28682
            ;;
 
28683
          s390x-*linux*)
 
28684
@@ -6436,7 +6439,10 @@
 
28685
          x86_64-*linux*)
 
28686
            LD="${LD-ld} -m elf_x86_64"
 
28687
            ;;
 
28688
-         ppc*-*linux*|powerpc*-*linux*)
 
28689
+         powerpcle-*linux*)
 
28690
+           LD="${LD-ld} -m elf64lppc"
 
28691
+           ;;
 
28692
+         powerpc-*linux*)
 
28693
            LD="${LD-ld} -m elf64ppc"
 
28694
            ;;
 
28695
          s390*-*linux*|s390*-*tpf*)
 
28696
@@ -10900,7 +10906,7 @@
 
28697
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
 
28698
   lt_status=$lt_dlunknown
 
28699
   cat > conftest.$ac_ext <<_LT_EOF
 
28700
-#line 10903 "configure"
 
28701
+#line 10909 "configure"
 
28702
 #include "confdefs.h"
 
28703
 
 
28704
 #if HAVE_DLFCN_H
 
28705
@@ -11006,7 +11012,7 @@
 
28706
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
 
28707
   lt_status=$lt_dlunknown
 
28708
   cat > conftest.$ac_ext <<_LT_EOF
 
28709
-#line 11009 "configure"
 
28710
+#line 11015 "configure"
 
28711
 #include "confdefs.h"
 
28712
 
 
28713
 #if HAVE_DLFCN_H
 
28714
--- a/src/libffi/src/powerpc/ppc_closure.S
 
28715
+++ b/src/libffi/src/powerpc/ppc_closure.S
 
28716
@@ -238,7 +238,7 @@
 
28717
        lwz %r3,112+0(%r1)
 
28718
        lwz %r4,112+4(%r1)
 
28719
        lwz %r5,112+8(%r1)
 
28720
-       bl .Luint128
 
28721
+       b .Luint128
 
28722
 
 
28723
 # The return types below are only used when the ABI type is FFI_SYSV.
 
28724
 # case FFI_SYSV_TYPE_SMALL_STRUCT + 1. One byte struct.
 
28725
--- a/src/libffi/src/powerpc/ffitarget.h
 
28726
+++ b/src/libffi/src/powerpc/ffitarget.h
 
28727
@@ -106,6 +106,10 @@
 
28728
 
 
28729
 #define FFI_CLOSURES 1
 
28730
 #define FFI_NATIVE_RAW_API 0
 
28731
+#if defined (POWERPC) || defined (POWERPC_FREEBSD)
 
28732
+# define FFI_TARGET_SPECIFIC_VARIADIC 1
 
28733
+# define FFI_EXTRA_CIF_FIELDS unsigned nfixedargs
 
28734
+#endif
 
28735
 
 
28736
 /* For additional types like the below, take care about the order in
 
28737
    ppc_closures.S. They must follow after the FFI_TYPE_LAST.  */
 
28738
@@ -118,14 +122,23 @@
 
28739
    defined in ffi.c, to determine the exact return type and its size.  */
 
28740
 #define FFI_SYSV_TYPE_SMALL_STRUCT (FFI_TYPE_LAST + 2)
 
28741
 
 
28742
-#if defined(POWERPC64) || defined(POWERPC_AIX)
 
28743
+/* Used by ELFv2 for homogenous structure returns.  */
 
28744
+#define FFI_V2_TYPE_FLOAT_HOMOG                (FFI_TYPE_LAST + 1)
 
28745
+#define FFI_V2_TYPE_DOUBLE_HOMOG       (FFI_TYPE_LAST + 2)
 
28746
+#define FFI_V2_TYPE_SMALL_STRUCT       (FFI_TYPE_LAST + 3)
 
28747
+
 
28748
+#if _CALL_ELF == 2
 
28749
+# define FFI_TRAMPOLINE_SIZE 32
 
28750
+#else
 
28751
+# if defined(POWERPC64) || defined(POWERPC_AIX)
 
28752
 #  if defined(POWERPC_DARWIN64)
 
28753
 #    define FFI_TRAMPOLINE_SIZE 48
 
28754
 #  else
 
28755
 #    define FFI_TRAMPOLINE_SIZE 24
 
28756
 #  endif
 
28757
-#else /* POWERPC || POWERPC_AIX */
 
28758
+# else /* POWERPC || POWERPC_AIX */
 
28759
 #  define FFI_TRAMPOLINE_SIZE 40
 
28760
+# endif
 
28761
 #endif
 
28762
 
 
28763
 #ifndef LIBFFI_ASM
 
28764
--- a/src/libffi/src/powerpc/ffi.c
 
28765
+++ b/src/libffi/src/powerpc/ffi.c
 
28766
@@ -49,6 +49,7 @@
 
28767
   FLAG_RETURNS_128BITS  = 1 << (31-27), /* cr6  */
 
28768
 
 
28769
   FLAG_ARG_NEEDS_COPY   = 1 << (31- 7),
 
28770
+  FLAG_ARG_NEEDS_PSAVE  = FLAG_ARG_NEEDS_COPY, /* Used by ELFv2 */
 
28771
 #ifndef __NO_FPRS__
 
28772
   FLAG_FP_ARGUMENTS     = 1 << (31- 6), /* cr1.eq; specified by ABI */
 
28773
 #endif
 
28774
@@ -369,7 +370,13 @@
 
28775
   /* Check that we didn't overrun the stack...  */
 
28776
   FFI_ASSERT (copy_space.c >= next_arg.c);
 
28777
   FFI_ASSERT (gpr_base.u <= stacktop.u - ASM_NEEDS_REGISTERS);
 
28778
+  /* The assert below is testing that the number of integer arguments agrees
 
28779
+     with the number found in ffi_prep_cif_machdep().  However, intarg_count
 
28780
+     is incremented whenever we place an FP arg on the stack, so account for
 
28781
+     that before our assert test.  */
 
28782
 #ifndef __NO_FPRS__
 
28783
+  if (fparg_count > NUM_FPR_ARG_REGISTERS)
 
28784
+    intarg_count -= fparg_count - NUM_FPR_ARG_REGISTERS;
 
28785
   FFI_ASSERT (fpr_base.u
 
28786
              <= stacktop.u - ASM_NEEDS_REGISTERS - NUM_GPR_ARG_REGISTERS);
 
28787
 #endif
 
28788
@@ -383,6 +390,45 @@
 
28789
 };
 
28790
 enum { ASM_NEEDS_REGISTERS64 = 4 };
 
28791
 
 
28792
+#if _CALL_ELF == 2
 
28793
+static unsigned int
 
28794
+discover_homogeneous_aggregate (const ffi_type *t, unsigned int *elnum)
 
28795
+{
 
28796
+  switch (t->type)
 
28797
+    {
 
28798
+    case FFI_TYPE_FLOAT:
 
28799
+    case FFI_TYPE_DOUBLE:
 
28800
+      *elnum = 1;
 
28801
+      return (int) t->type;
 
28802
+
 
28803
+    case FFI_TYPE_STRUCT:;
 
28804
+      {
 
28805
+       unsigned int base_elt = 0, total_elnum = 0;
 
28806
+       ffi_type **el = t->elements;
 
28807
+       while (*el)
 
28808
+         {
 
28809
+           unsigned int el_elt, el_elnum = 0;
 
28810
+           el_elt = discover_homogeneous_aggregate (*el, &el_elnum);
 
28811
+           if (el_elt == 0
 
28812
+               || (base_elt && base_elt != el_elt))
 
28813
+             return 0;
 
28814
+           base_elt = el_elt;
 
28815
+           total_elnum += el_elnum;
 
28816
+           if (total_elnum > 8)
 
28817
+             return 0;
 
28818
+           el++;
 
28819
+         }
 
28820
+       *elnum = total_elnum;
 
28821
+       return base_elt;
 
28822
+      }
 
28823
+
 
28824
+    default:
 
28825
+      return 0;
 
28826
+    }
 
28827
+}
 
28828
+#endif
 
28829
+
 
28830
+
 
28831
 /* ffi_prep_args64 is called by the assembly routine once stack space
 
28832
    has been allocated for the function's arguments.
 
28833
 
 
28834
@@ -428,6 +474,7 @@
 
28835
     unsigned long *ul;
 
28836
     float *f;
 
28837
     double *d;
 
28838
+    size_t p;
 
28839
   } valp;
 
28840
 
 
28841
   /* 'stacktop' points at the previous backchain pointer.  */
 
28842
@@ -443,9 +490,9 @@
 
28843
   /* 'fpr_base' points at the space for fpr3, and grows upwards as
 
28844
      we use FPR registers.  */
 
28845
   valp fpr_base;
 
28846
-  int fparg_count;
 
28847
+  unsigned int fparg_count;
 
28848
 
 
28849
-  int i, words;
 
28850
+  unsigned int i, words, nargs, nfixedargs;
 
28851
   ffi_type **ptr;
 
28852
   double double_tmp;
 
28853
   union {
 
28854
@@ -462,11 +509,18 @@
 
28855
     double **d;
 
28856
   } p_argv;
 
28857
   unsigned long gprvalue;
 
28858
+#ifdef __STRUCT_PARM_ALIGN__
 
28859
+  unsigned long align;
 
28860
+#endif
 
28861
 
 
28862
   stacktop.c = (char *) stack + bytes;
 
28863
   gpr_base.ul = stacktop.ul - ASM_NEEDS_REGISTERS64 - NUM_GPR_ARG_REGISTERS64;
 
28864
   gpr_end.ul = gpr_base.ul + NUM_GPR_ARG_REGISTERS64;
 
28865
+#if _CALL_ELF == 2
 
28866
+  rest.ul = stack + 4 + NUM_GPR_ARG_REGISTERS64;
 
28867
+#else
 
28868
   rest.ul = stack + 6 + NUM_GPR_ARG_REGISTERS64;
 
28869
+#endif
 
28870
   fpr_base.d = gpr_base.d - NUM_FPR_ARG_REGISTERS64;
 
28871
   fparg_count = 0;
 
28872
   next_arg.ul = gpr_base.ul;
 
28873
@@ -482,30 +536,36 @@
 
28874
 
 
28875
   /* Now for the arguments.  */
 
28876
   p_argv.v = ecif->avalue;
 
28877
-  for (ptr = ecif->cif->arg_types, i = ecif->cif->nargs;
 
28878
-       i > 0;
 
28879
-       i--, ptr++, p_argv.v++)
 
28880
+  nargs = ecif->cif->nargs;
 
28881
+  nfixedargs = ecif->cif->nfixedargs;
 
28882
+  for (ptr = ecif->cif->arg_types, i = 0;
 
28883
+       i < nargs;
 
28884
+       i++, ptr++, p_argv.v++)
 
28885
     {
 
28886
+      unsigned int elt, elnum;
 
28887
+
 
28888
       switch ((*ptr)->type)
 
28889
        {
 
28890
        case FFI_TYPE_FLOAT:
 
28891
          double_tmp = **p_argv.f;
 
28892
-         *next_arg.f = (float) double_tmp;
 
28893
+         if (fparg_count < NUM_FPR_ARG_REGISTERS64 && i < nfixedargs)
 
28894
+           *fpr_base.d++ = double_tmp;
 
28895
+         else
 
28896
+           *next_arg.f = (float) double_tmp;
 
28897
          if (++next_arg.ul == gpr_end.ul)
 
28898
            next_arg.ul = rest.ul;
 
28899
-         if (fparg_count < NUM_FPR_ARG_REGISTERS64)
 
28900
-           *fpr_base.d++ = double_tmp;
 
28901
          fparg_count++;
 
28902
          FFI_ASSERT (flags & FLAG_FP_ARGUMENTS);
 
28903
          break;
 
28904
 
 
28905
        case FFI_TYPE_DOUBLE:
 
28906
          double_tmp = **p_argv.d;
 
28907
-         *next_arg.d = double_tmp;
 
28908
+         if (fparg_count < NUM_FPR_ARG_REGISTERS64 && i < nfixedargs)
 
28909
+           *fpr_base.d++ = double_tmp;
 
28910
+         else
 
28911
+           *next_arg.d = double_tmp;
 
28912
          if (++next_arg.ul == gpr_end.ul)
 
28913
            next_arg.ul = rest.ul;
 
28914
-         if (fparg_count < NUM_FPR_ARG_REGISTERS64)
 
28915
-           *fpr_base.d++ = double_tmp;
 
28916
          fparg_count++;
 
28917
          FFI_ASSERT (flags & FLAG_FP_ARGUMENTS);
 
28918
          break;
 
28919
@@ -513,18 +573,20 @@
 
28920
 #if FFI_TYPE_LONGDOUBLE != FFI_TYPE_DOUBLE
 
28921
        case FFI_TYPE_LONGDOUBLE:
 
28922
          double_tmp = (*p_argv.d)[0];
 
28923
-         *next_arg.d = double_tmp;
 
28924
+         if (fparg_count < NUM_FPR_ARG_REGISTERS64 && i < nfixedargs)
 
28925
+           *fpr_base.d++ = double_tmp;
 
28926
+         else
 
28927
+           *next_arg.d = double_tmp;
 
28928
          if (++next_arg.ul == gpr_end.ul)
 
28929
            next_arg.ul = rest.ul;
 
28930
-         if (fparg_count < NUM_FPR_ARG_REGISTERS64)
 
28931
-           *fpr_base.d++ = double_tmp;
 
28932
          fparg_count++;
 
28933
          double_tmp = (*p_argv.d)[1];
 
28934
-         *next_arg.d = double_tmp;
 
28935
+         if (fparg_count < NUM_FPR_ARG_REGISTERS64 && i < nfixedargs)
 
28936
+           *fpr_base.d++ = double_tmp;
 
28937
+         else
 
28938
+           *next_arg.d = double_tmp;
 
28939
          if (++next_arg.ul == gpr_end.ul)
 
28940
            next_arg.ul = rest.ul;
 
28941
-         if (fparg_count < NUM_FPR_ARG_REGISTERS64)
 
28942
-           *fpr_base.d++ = double_tmp;
 
28943
          fparg_count++;
 
28944
          FFI_ASSERT (__LDBL_MANT_DIG__ == 106);
 
28945
          FFI_ASSERT (flags & FLAG_FP_ARGUMENTS);
 
28946
@@ -532,28 +594,86 @@
 
28947
 #endif
 
28948
 
 
28949
        case FFI_TYPE_STRUCT:
 
28950
-         words = ((*ptr)->size + 7) / 8;
 
28951
-         if (next_arg.ul >= gpr_base.ul && next_arg.ul + words > gpr_end.ul)
 
28952
+#ifdef __STRUCT_PARM_ALIGN__
 
28953
+         align = (*ptr)->alignment;
 
28954
+         if (align > __STRUCT_PARM_ALIGN__)
 
28955
+           align = __STRUCT_PARM_ALIGN__;
 
28956
+         if (align > 1)
 
28957
+           next_arg.p = ALIGN (next_arg.p, align);
 
28958
+#endif
 
28959
+         elt = 0;
 
28960
+#if _CALL_ELF == 2
 
28961
+         elt = discover_homogeneous_aggregate (*ptr, &elnum);
 
28962
+#endif
 
28963
+         if (elt)
 
28964
            {
 
28965
-             size_t first = gpr_end.c - next_arg.c;
 
28966
-             memcpy (next_arg.c, *p_argv.c, first);
 
28967
-             memcpy (rest.c, *p_argv.c + first, (*ptr)->size - first);
 
28968
-             next_arg.c = rest.c + words * 8 - first;
 
28969
+             union {
 
28970
+               void *v;
 
28971
+               float *f;
 
28972
+               double *d;
 
28973
+             } arg;
 
28974
+
 
28975
+             arg.v = *p_argv.v;
 
28976
+             if (elt == FFI_TYPE_FLOAT)
 
28977
+               {
 
28978
+                 do
 
28979
+                   {
 
28980
+                     double_tmp = *arg.f++;
 
28981
+                     if (fparg_count < NUM_FPR_ARG_REGISTERS64
 
28982
+                         && i < nfixedargs)
 
28983
+                       *fpr_base.d++ = double_tmp;
 
28984
+                     else
 
28985
+                       *next_arg.f = (float) double_tmp;
 
28986
+                     if (++next_arg.f == gpr_end.f)
 
28987
+                       next_arg.f = rest.f;
 
28988
+                     fparg_count++;
 
28989
+                   }
 
28990
+                 while (--elnum != 0);
 
28991
+                 if ((next_arg.p & 3) != 0)
 
28992
+                   {
 
28993
+                     if (++next_arg.f == gpr_end.f)
 
28994
+                       next_arg.f = rest.f;
 
28995
+                   }
 
28996
+               }
 
28997
+             else
 
28998
+               do
 
28999
+                 {
 
29000
+                   double_tmp = *arg.d++;
 
29001
+                   if (fparg_count < NUM_FPR_ARG_REGISTERS64 && i < nfixedargs)
 
29002
+                     *fpr_base.d++ = double_tmp;
 
29003
+                   else
 
29004
+                     *next_arg.d = double_tmp;
 
29005
+                   if (++next_arg.d == gpr_end.d)
 
29006
+                     next_arg.d = rest.d;
 
29007
+                   fparg_count++;
 
29008
+                 }
 
29009
+               while (--elnum != 0);
 
29010
            }
 
29011
          else
 
29012
            {
 
29013
-             char *where = next_arg.c;
 
29014
+             words = ((*ptr)->size + 7) / 8;
 
29015
+             if (next_arg.ul >= gpr_base.ul && next_arg.ul + words > gpr_end.ul)
 
29016
+               {
 
29017
+                 size_t first = gpr_end.c - next_arg.c;
 
29018
+                 memcpy (next_arg.c, *p_argv.c, first);
 
29019
+                 memcpy (rest.c, *p_argv.c + first, (*ptr)->size - first);
 
29020
+                 next_arg.c = rest.c + words * 8 - first;
 
29021
+               }
 
29022
+             else
 
29023
+               {
 
29024
+                 char *where = next_arg.c;
 
29025
 
 
29026
 #ifndef __LITTLE_ENDIAN__
 
29027
-             /* Structures with size less than eight bytes are passed
 
29028
-                left-padded.  */
 
29029
-             if ((*ptr)->size < 8)
 
29030
-               where += 8 - (*ptr)->size;
 
29031
+                 /* Structures with size less than eight bytes are passed
 
29032
+                    left-padded.  */
 
29033
+                 if ((*ptr)->size < 8)
 
29034
+                   where += 8 - (*ptr)->size;
 
29035
 #endif
 
29036
-             memcpy (where, *p_argv.c, (*ptr)->size);
 
29037
-             next_arg.ul += words;
 
29038
-             if (next_arg.ul == gpr_end.ul)
 
29039
-               next_arg.ul = rest.ul;
 
29040
+                 memcpy (where, *p_argv.c, (*ptr)->size);
 
29041
+                 next_arg.ul += words;
 
29042
+                 if (next_arg.ul == gpr_end.ul)
 
29043
+                   next_arg.ul = rest.ul;
 
29044
+               }
 
29045
            }
 
29046
          break;
 
29047
 
 
29048
@@ -597,24 +717,22 @@
 
29049
 
 
29050
 
 
29051
 /* Perform machine dependent cif processing */
 
29052
-ffi_status
 
29053
-ffi_prep_cif_machdep (ffi_cif *cif)
 
29054
+static ffi_status
 
29055
+ffi_prep_cif_machdep_core (ffi_cif *cif)
 
29056
 {
 
29057
   /* All this is for the SYSV and LINUX64 ABI.  */
 
29058
-  int i;
 
29059
   ffi_type **ptr;
 
29060
   unsigned bytes;
 
29061
-  int fparg_count = 0, intarg_count = 0;
 
29062
-  unsigned flags = 0;
 
29063
+  unsigned i, fparg_count = 0, intarg_count = 0;
 
29064
+  unsigned flags = cif->flags;
 
29065
   unsigned struct_copy_size = 0;
 
29066
   unsigned type = cif->rtype->type;
 
29067
   unsigned size = cif->rtype->size;
 
29068
 
 
29069
+  /* The machine-independent calculation of cif->bytes doesn't work
 
29070
+     for us.  Redo the calculation.  */
 
29071
   if (cif->abi != FFI_LINUX64)
 
29072
     {
 
29073
-      /* All the machine-independent calculation of cif->bytes will be wrong.
 
29074
-        Redo the calculation for SYSV.  */
 
29075
-
 
29076
       /* Space for the frame pointer, callee's LR, and the asm's temp regs.  */
 
29077
       bytes = (2 + ASM_NEEDS_REGISTERS) * sizeof (int);
 
29078
 
 
29079
@@ -624,13 +742,20 @@
 
29080
   else
 
29081
     {
 
29082
       /* 64-bit ABI.  */
 
29083
+#if _CALL_ELF == 2
 
29084
+      /* Space for backchain, CR, LR, TOC and the asm's temp regs.  */
 
29085
+      bytes = (4 + ASM_NEEDS_REGISTERS64) * sizeof (long);
 
29086
 
 
29087
+      /* Space for the general registers.  */
 
29088
+      bytes += NUM_GPR_ARG_REGISTERS64 * sizeof (long);
 
29089
+#else
 
29090
       /* Space for backchain, CR, LR, cc/ld doubleword, TOC and the asm's temp
 
29091
         regs.  */
 
29092
       bytes = (6 + ASM_NEEDS_REGISTERS64) * sizeof (long);
 
29093
 
 
29094
       /* Space for the mandatory parm save area and general registers.  */
 
29095
       bytes += 2 * NUM_GPR_ARG_REGISTERS64 * sizeof (long);
 
29096
+#endif
 
29097
     }
 
29098
 
 
29099
   /* Return value handling.  The rules for SYSV are as follows:
 
29100
@@ -650,19 +775,23 @@
 
29101
      - soft-float float/doubles are treated as UINT32/UINT64 respectivley.
 
29102
      - soft-float long doubles are returned in gpr3-gpr6.  */
 
29103
   /* First translate for softfloat/nonlinux */
 
29104
-  if (cif->abi == FFI_LINUX_SOFT_FLOAT) {
 
29105
-       if (type == FFI_TYPE_FLOAT)
 
29106
-               type = FFI_TYPE_UINT32;
 
29107
-       if (type == FFI_TYPE_DOUBLE)
 
29108
-               type = FFI_TYPE_UINT64;
 
29109
-       if (type == FFI_TYPE_LONGDOUBLE)
 
29110
-               type = FFI_TYPE_UINT128;
 
29111
-  } else if (cif->abi != FFI_LINUX && cif->abi != FFI_LINUX64) {
 
29112
+  if (cif->abi == FFI_LINUX_SOFT_FLOAT)
 
29113
+    {
 
29114
+      if (type == FFI_TYPE_FLOAT)
 
29115
+       type = FFI_TYPE_UINT32;
 
29116
+      if (type == FFI_TYPE_DOUBLE)
 
29117
+       type = FFI_TYPE_UINT64;
 
29118
+      if (type == FFI_TYPE_LONGDOUBLE)
 
29119
+       type = FFI_TYPE_UINT128;
 
29120
+    }
 
29121
+  else if (cif->abi != FFI_LINUX
 
29122
+          && cif->abi != FFI_LINUX64)
 
29123
+    {
 
29124
 #if FFI_TYPE_LONGDOUBLE != FFI_TYPE_DOUBLE
 
29125
-       if (type == FFI_TYPE_LONGDOUBLE)
 
29126
-               type = FFI_TYPE_STRUCT;
 
29127
+      if (type == FFI_TYPE_LONGDOUBLE)
 
29128
+       type = FFI_TYPE_STRUCT;
 
29129
 #endif
 
29130
-  }
 
29131
+    }
 
29132
 
 
29133
   switch (type)
 
29134
     {
 
29135
@@ -691,7 +820,7 @@
 
29136
     case FFI_TYPE_STRUCT:
 
29137
       /*
 
29138
        * The final SYSV ABI says that structures smaller or equal 8 bytes
 
29139
-       * are returned in r3/r4. The FFI_GCC_SYSV ABI instead returns them
 
29140
+       * are returned in r3/r4.  The FFI_GCC_SYSV ABI instead returns them
 
29141
        * in memory.
 
29142
        *
 
29143
        * NOTE: The assembly code can safely assume that it just needs to
 
29144
@@ -700,7 +829,29 @@
 
29145
        *       set.
 
29146
        */
 
29147
       if (cif->abi == FFI_SYSV && size <= 8)
 
29148
-       flags |= FLAG_RETURNS_SMST;
 
29149
+       {
 
29150
+         flags |= FLAG_RETURNS_SMST;
 
29151
+         break;
 
29152
+       }
 
29153
+#if _CALL_ELF == 2
 
29154
+      if (cif->abi == FFI_LINUX64)
 
29155
+       {
 
29156
+         unsigned int elt, elnum;
 
29157
+         elt = discover_homogeneous_aggregate (cif->rtype, &elnum);
 
29158
+         if (elt)
 
29159
+           {
 
29160
+             if (elt == FFI_TYPE_DOUBLE)
 
29161
+               flags |= FLAG_RETURNS_64BITS;
 
29162
+             flags |= FLAG_RETURNS_FP | FLAG_RETURNS_SMST;
 
29163
+             break;
 
29164
+           }
 
29165
+         if (size <= 16)
 
29166
+           {
 
29167
+             flags |= FLAG_RETURNS_SMST;
 
29168
+             break;
 
29169
+           }
 
29170
+       }
 
29171
+#endif
 
29172
       intarg_count++;
 
29173
       flags |= FLAG_RETVAL_REFERENCE;
 
29174
       /* Fall through.  */
 
29175
@@ -816,27 +967,54 @@
 
29176
   else
 
29177
     for (ptr = cif->arg_types, i = cif->nargs; i > 0; i--, ptr++)
 
29178
       {
 
29179
+       unsigned int elt, elnum;
 
29180
+#ifdef __STRUCT_PARM_ALIGN__
 
29181
+       unsigned int align;
 
29182
+#endif
 
29183
+
 
29184
        switch ((*ptr)->type)
 
29185
          {
 
29186
 #if FFI_TYPE_LONGDOUBLE != FFI_TYPE_DOUBLE
 
29187
          case FFI_TYPE_LONGDOUBLE:
 
29188
-           if (cif->abi == FFI_LINUX_SOFT_FLOAT)
 
29189
-             intarg_count += 4;
 
29190
-           else
 
29191
-             {
 
29192
-               fparg_count += 2;
 
29193
-               intarg_count += 2;
 
29194
-             }
 
29195
+           fparg_count += 2;
 
29196
+           intarg_count += 2;
 
29197
+           if (fparg_count > NUM_FPR_ARG_REGISTERS)
 
29198
+             flags |= FLAG_ARG_NEEDS_PSAVE;
 
29199
            break;
 
29200
 #endif
 
29201
          case FFI_TYPE_FLOAT:
 
29202
          case FFI_TYPE_DOUBLE:
 
29203
            fparg_count++;
 
29204
            intarg_count++;
 
29205
+           if (fparg_count > NUM_FPR_ARG_REGISTERS)
 
29206
+             flags |= FLAG_ARG_NEEDS_PSAVE;
 
29207
            break;
 
29208
 
 
29209
          case FFI_TYPE_STRUCT:
 
29210
+#ifdef __STRUCT_PARM_ALIGN__
 
29211
+           align = (*ptr)->alignment;
 
29212
+           if (align > __STRUCT_PARM_ALIGN__)
 
29213
+             align = __STRUCT_PARM_ALIGN__;
 
29214
+           align = align / 8;
 
29215
+           if (align > 1)
 
29216
+             intarg_count = ALIGN (intarg_count, align);
 
29217
+#endif
 
29218
            intarg_count += ((*ptr)->size + 7) / 8;
 
29219
+           elt = 0;
 
29220
+#if _CALL_ELF == 2
 
29221
+           elt = discover_homogeneous_aggregate (*ptr, &elnum);
 
29222
+#endif
 
29223
+           if (elt)
 
29224
+             {
 
29225
+               fparg_count += elnum;
 
29226
+               if (fparg_count > NUM_FPR_ARG_REGISTERS)
 
29227
+                 flags |= FLAG_ARG_NEEDS_PSAVE;
 
29228
+             }
 
29229
+           else
 
29230
+             {
 
29231
+               if (intarg_count > NUM_GPR_ARG_REGISTERS)
 
29232
+                 flags |= FLAG_ARG_NEEDS_PSAVE;
 
29233
+             }
 
29234
            break;
 
29235
 
 
29236
          case FFI_TYPE_POINTER:
 
29237
@@ -852,9 +1030,11 @@
 
29238
            /* Everything else is passed as a 8-byte word in a GPR, either
 
29239
               the object itself or a pointer to it.  */
 
29240
            intarg_count++;
 
29241
+           if (intarg_count > NUM_GPR_ARG_REGISTERS)
 
29242
+             flags |= FLAG_ARG_NEEDS_PSAVE;
 
29243
            break;
 
29244
          default:
 
29245
-               FFI_ASSERT (0);
 
29246
+           FFI_ASSERT (0);
 
29247
          }
 
29248
       }
 
29249
 
 
29250
@@ -892,8 +1072,13 @@
 
29251
 #endif
 
29252
 
 
29253
       /* Stack space.  */
 
29254
+#if _CALL_ELF == 2
 
29255
+      if ((flags & FLAG_ARG_NEEDS_PSAVE) != 0)
 
29256
+       bytes += intarg_count * sizeof (long);
 
29257
+#else
 
29258
       if (intarg_count > NUM_GPR_ARG_REGISTERS64)
 
29259
        bytes += (intarg_count - NUM_GPR_ARG_REGISTERS64) * sizeof (long);
 
29260
+#endif
 
29261
     }
 
29262
 
 
29263
   /* The stack space allocated needs to be a multiple of 16 bytes.  */
 
29264
@@ -908,6 +1093,26 @@
 
29265
   return FFI_OK;
 
29266
 }
 
29267
 
 
29268
+ffi_status
 
29269
+ffi_prep_cif_machdep (ffi_cif *cif)
 
29270
+{
 
29271
+  cif->nfixedargs = cif->nargs;
 
29272
+  return ffi_prep_cif_machdep_core (cif);
 
29273
+}
 
29274
+
 
29275
+ffi_status
 
29276
+ffi_prep_cif_machdep_var (ffi_cif *cif,
 
29277
+                         unsigned int nfixedargs,
 
29278
+                         unsigned int ntotalargs MAYBE_UNUSED)
 
29279
+{
 
29280
+  cif->nfixedargs = nfixedargs;
 
29281
+#if _CALL_ELF == 2
 
29282
+  if (cif->abi == FFI_LINUX64)
 
29283
+    cif->flags |= FLAG_ARG_NEEDS_PSAVE;
 
29284
+#endif
 
29285
+  return ffi_prep_cif_machdep_core (cif);
 
29286
+}
 
29287
+
 
29288
 extern void ffi_call_SYSV(extended_cif *, unsigned, unsigned, unsigned *,
 
29289
                          void (*fn)(void));
 
29290
 extern void FFI_HIDDEN ffi_call_LINUX64(extended_cif *, unsigned long,
 
29291
@@ -919,30 +1124,28 @@
 
29292
 {
 
29293
   /*
 
29294
    * The final SYSV ABI says that structures smaller or equal 8 bytes
 
29295
-   * are returned in r3/r4. The FFI_GCC_SYSV ABI instead returns them
 
29296
+   * are returned in r3/r4.  The FFI_GCC_SYSV ABI instead returns them
 
29297
    * in memory.
 
29298
    *
 
29299
-   * Just to keep things simple for the assembly code, we will always
 
29300
-   * bounce-buffer struct return values less than or equal to 8 bytes.
 
29301
-   * This allows the ASM to handle SYSV small structures by directly
 
29302
-   * writing r3 and r4 to memory without worrying about struct size.
 
29303
+   * We bounce-buffer SYSV small struct return values so that sysv.S
 
29304
+   * can write r3 and r4 to memory without worrying about struct size.
 
29305
+   *
 
29306
+   * For ELFv2 ABI, use a bounce buffer for homogeneous structs too,
 
29307
+   * for similar reasons.
 
29308
    */
 
29309
-  unsigned int smst_buffer[2];
 
29310
+  unsigned long smst_buffer[8];
 
29311
   extended_cif ecif;
 
29312
-  unsigned int rsize = 0;
 
29313
 
 
29314
   ecif.cif = cif;
 
29315
   ecif.avalue = avalue;
 
29316
 
 
29317
-  /* Ensure that we have a valid struct return value */
 
29318
   ecif.rvalue = rvalue;
 
29319
-  if (cif->rtype->type == FFI_TYPE_STRUCT) {
 
29320
-    rsize = cif->rtype->size;
 
29321
-    if (rsize <= 8)
 
29322
-      ecif.rvalue = smst_buffer;
 
29323
-    else if (!rvalue)
 
29324
-      ecif.rvalue = alloca(rsize);
 
29325
-  }
 
29326
+  if ((cif->flags & FLAG_RETURNS_SMST) != 0)
 
29327
+    ecif.rvalue = smst_buffer;
 
29328
+  /* Ensure that we have a valid struct return value.
 
29329
+     FIXME: Isn't this just papering over a user problem?  */
 
29330
+  else if (!rvalue && cif->rtype->type == FFI_TYPE_STRUCT)
 
29331
+    ecif.rvalue = alloca (cif->rtype->size);
 
29332
 
 
29333
   switch (cif->abi)
 
29334
     {
 
29335
@@ -967,11 +1170,26 @@
 
29336
 
 
29337
   /* Check for a bounce-buffered return value */
 
29338
   if (rvalue && ecif.rvalue == smst_buffer)
 
29339
-    memcpy(rvalue, smst_buffer, rsize);
 
29340
+    {
 
29341
+      unsigned int rsize = cif->rtype->size;
 
29342
+#ifndef __LITTLE_ENDIAN__
 
29343
+      /* The SYSV ABI returns a structure of up to 4 bytes in size
 
29344
+        left-padded in r3.  */
 
29345
+      if (cif->abi == FFI_SYSV && rsize <= 4)
 
29346
+       memcpy (rvalue, (char *) smst_buffer + 4 - rsize, rsize);
 
29347
+      /* The SYSV ABI returns a structure of up to 8 bytes in size
 
29348
+        left-padded in r3/r4, and the ELFv2 ABI similarly returns a
 
29349
+        structure of up to 8 bytes in size left-padded in r3.  */
 
29350
+      else if (rsize <= 8)
 
29351
+       memcpy (rvalue, (char *) smst_buffer + 8 - rsize, rsize);
 
29352
+      else
 
29353
+#endif
 
29354
+       memcpy (rvalue, smst_buffer, rsize);
 
29355
+    }
 
29356
 }
 
29357
 
 
29358
 
 
29359
-#ifndef POWERPC64
 
29360
+#if !defined POWERPC64 || _CALL_ELF == 2
 
29361
 #define MIN_CACHE_LINE_SIZE 8
 
29362
 
 
29363
 static void
 
29364
@@ -995,6 +1213,22 @@
 
29365
                      void *codeloc)
 
29366
 {
 
29367
 #ifdef POWERPC64
 
29368
+# if _CALL_ELF == 2
 
29369
+  unsigned int *tramp = (unsigned int *) &closure->tramp[0];
 
29370
+
 
29371
+  if (cif->abi != FFI_LINUX64)
 
29372
+    return FFI_BAD_ABI;
 
29373
+
 
29374
+  tramp[0] = 0xe96c0018;       /* 0:   ld      11,2f-0b(12)    */
 
29375
+  tramp[1] = 0xe98c0010;       /*      ld      12,1f-0b(12)    */
 
29376
+  tramp[2] = 0x7d8903a6;       /*      mtctr   12              */
 
29377
+  tramp[3] = 0x4e800420;       /*      bctr                    */
 
29378
+                               /* 1:   .quad   function_addr   */
 
29379
+                               /* 2:   .quad   context         */
 
29380
+  *(void **) &tramp[4] = (void *) ffi_closure_LINUX64;
 
29381
+  *(void **) &tramp[6] = codeloc;
 
29382
+  flush_icache ((char *)tramp, (char *)codeloc, FFI_TRAMPOLINE_SIZE);
 
29383
+# else
 
29384
   void **tramp = (void **) &closure->tramp[0];
 
29385
 
 
29386
   if (cif->abi != FFI_LINUX64)
 
29387
@@ -1002,6 +1236,7 @@
 
29388
   /* Copy function address and TOC from ffi_closure_LINUX64.  */
 
29389
   memcpy (tramp, (char *) ffi_closure_LINUX64, 16);
 
29390
   tramp[2] = codeloc;
 
29391
+# endif
 
29392
 #else
 
29393
   unsigned int *tramp;
 
29394
 
 
29395
@@ -1226,6 +1461,7 @@
 
29396
            }
 
29397
          break;
 
29398
 #endif
 
29399
+
 
29400
        case FFI_TYPE_SINT16:
 
29401
        case FFI_TYPE_UINT16:
 
29402
 #ifndef __LITTLE_ENDIAN__
 
29403
@@ -1243,6 +1479,7 @@
 
29404
            }
 
29405
          break;
 
29406
 #endif
 
29407
+
 
29408
        case FFI_TYPE_SINT32:
 
29409
        case FFI_TYPE_UINT32:
 
29410
        case FFI_TYPE_POINTER:
 
29411
@@ -1346,16 +1583,20 @@
 
29412
 
 
29413
   void **avalue;
 
29414
   ffi_type **arg_types;
 
29415
-  long i, avn;
 
29416
+  unsigned long i, avn, nfixedargs;
 
29417
   ffi_cif *cif;
 
29418
   ffi_dblfl *end_pfr = pfr + NUM_FPR_ARG_REGISTERS64;
 
29419
+#ifdef __STRUCT_PARM_ALIGN__
 
29420
+  unsigned long align;
 
29421
+#endif
 
29422
 
 
29423
   cif = closure->cif;
 
29424
   avalue = alloca (cif->nargs * sizeof (void *));
 
29425
 
 
29426
-  /* Copy the caller's structure return value address so that the closure
 
29427
-     returns the data directly to the caller.  */
 
29428
-  if (cif->rtype->type == FFI_TYPE_STRUCT)
 
29429
+  /* Copy the caller's structure return value address so that the
 
29430
+     closure returns the data directly to the caller.  */
 
29431
+  if (cif->rtype->type == FFI_TYPE_STRUCT
 
29432
+      && (cif->flags & FLAG_RETURNS_SMST) == 0)
 
29433
     {
 
29434
       rvalue = (void *) *pst;
 
29435
       pst++;
 
29436
@@ -1363,11 +1604,14 @@
 
29437
 
 
29438
   i = 0;
 
29439
   avn = cif->nargs;
 
29440
+  nfixedargs = cif->nfixedargs;
 
29441
   arg_types = cif->arg_types;
 
29442
 
 
29443
   /* Grab the addresses of the arguments from the stack frame.  */
 
29444
   while (i < avn)
 
29445
     {
 
29446
+      unsigned int elt, elnum;
 
29447
+
 
29448
       switch (arg_types[i]->type)
 
29449
        {
 
29450
        case FFI_TYPE_SINT8:
 
29451
@@ -1377,6 +1621,7 @@
 
29452
          pst++;
 
29453
          break;
 
29454
 #endif
 
29455
+
 
29456
        case FFI_TYPE_SINT16:
 
29457
        case FFI_TYPE_UINT16:
 
29458
 #ifndef __LITTLE_ENDIAN__
 
29459
@@ -1384,6 +1629,7 @@
 
29460
          pst++;
 
29461
          break;
 
29462
 #endif
 
29463
+
 
29464
        case FFI_TYPE_SINT32:
 
29465
        case FFI_TYPE_UINT32:
 
29466
 #ifndef __LITTLE_ENDIAN__
 
29467
@@ -1391,6 +1637,7 @@
 
29468
          pst++;
 
29469
          break;
 
29470
 #endif
 
29471
+
 
29472
        case FFI_TYPE_SINT64:
 
29473
        case FFI_TYPE_UINT64:
 
29474
        case FFI_TYPE_POINTER:
 
29475
@@ -1399,14 +1646,82 @@
 
29476
          break;
 
29477
 
 
29478
        case FFI_TYPE_STRUCT:
 
29479
+#ifdef __STRUCT_PARM_ALIGN__
 
29480
+         align = arg_types[i]->alignment;
 
29481
+         if (align > __STRUCT_PARM_ALIGN__)
 
29482
+           align = __STRUCT_PARM_ALIGN__;
 
29483
+         if (align > 1)
 
29484
+           pst = (unsigned long *) ALIGN ((size_t) pst, align);
 
29485
+#endif
 
29486
+         elt = 0;
 
29487
+#if _CALL_ELF == 2
 
29488
+         elt = discover_homogeneous_aggregate (arg_types[i], &elnum);
 
29489
+#endif
 
29490
+         if (elt)
 
29491
+           {
 
29492
+             union {
 
29493
+               void *v;
 
29494
+               unsigned long *ul;
 
29495
+               float *f;
 
29496
+               double *d;
 
29497
+               size_t p;
 
29498
+             } to, from;
 
29499
+
 
29500
+             /* Repackage the aggregate from its parts.  The
 
29501
+                aggregate size is not greater than the space taken by
 
29502
+                the registers so store back to the register/parameter
 
29503
+                save arrays.  */
 
29504
+             if (pfr + elnum <= end_pfr)
 
29505
+               to.v = pfr;
 
29506
+             else
 
29507
+               to.v = pst;
 
29508
+
 
29509
+             avalue[i] = to.v;
 
29510
+             from.ul = pst;
 
29511
+             if (elt == FFI_TYPE_FLOAT)
 
29512
+               {
 
29513
+                 do
 
29514
+                   {
 
29515
+                     if (pfr < end_pfr && i < nfixedargs)
 
29516
+                       {
 
29517
+                         *to.f = (float) pfr->d;
 
29518
+                         pfr++;
 
29519
+                       }
 
29520
+                     else
 
29521
+                       *to.f = *from.f;
 
29522
+                     to.f++;
 
29523
+                     from.f++;
 
29524
+                   }
 
29525
+                 while (--elnum != 0);
 
29526
+               }
 
29527
+             else
 
29528
+               {
 
29529
+                 do
 
29530
+                   {
 
29531
+                     if (pfr < end_pfr && i < nfixedargs)
 
29532
+                       {
 
29533
+                         *to.d = pfr->d;
 
29534
+                         pfr++;
 
29535
+                       }
 
29536
+                     else
 
29537
+                       *to.d = *from.d;
 
29538
+                     to.d++;
 
29539
+                     from.d++;
 
29540
+                   }
 
29541
+                 while (--elnum != 0);
 
29542
+               }
 
29543
+           }
 
29544
+         else
 
29545
+           {
 
29546
 #ifndef __LITTLE_ENDIAN__
 
29547
-         /* Structures with size less than eight bytes are passed
 
29548
-            left-padded.  */
 
29549
-         if (arg_types[i]->size < 8)
 
29550
-           avalue[i] = (char *) pst + 8 - arg_types[i]->size;
 
29551
-         else
 
29552
+             /* Structures with size less than eight bytes are passed
 
29553
+                left-padded.  */
 
29554
+             if (arg_types[i]->size < 8)
 
29555
+               avalue[i] = (char *) pst + 8 - arg_types[i]->size;
 
29556
+             else
 
29557
 #endif
 
29558
-           avalue[i] = pst;
 
29559
+               avalue[i] = pst;
 
29560
+           }
 
29561
          pst += (arg_types[i]->size + 7) / 8;
 
29562
          break;
 
29563
 
 
29564
@@ -1418,7 +1733,7 @@
 
29565
 
 
29566
          /* there are 13 64bit floating point registers */
 
29567
 
 
29568
-         if (pfr < end_pfr)
 
29569
+         if (pfr < end_pfr && i < nfixedargs)
 
29570
            {
 
29571
              double temp = pfr->d;
 
29572
              pfr->f = (float) temp;
 
29573
@@ -1434,7 +1749,7 @@
 
29574
          /* On the outgoing stack all values are aligned to 8 */
 
29575
          /* there are 13 64bit floating point registers */
 
29576
 
 
29577
-         if (pfr < end_pfr)
 
29578
+         if (pfr < end_pfr && i < nfixedargs)
 
29579
            {
 
29580
              avalue[i] = pfr;
 
29581
              pfr++;
 
29582
@@ -1446,14 +1761,14 @@
 
29583
 
 
29584
 #if FFI_TYPE_LONGDOUBLE != FFI_TYPE_DOUBLE
 
29585
        case FFI_TYPE_LONGDOUBLE:
 
29586
-         if (pfr + 1 < end_pfr)
 
29587
+         if (pfr + 1 < end_pfr && i + 1 < nfixedargs)
 
29588
            {
 
29589
              avalue[i] = pfr;
 
29590
              pfr += 2;
 
29591
            }
 
29592
          else
 
29593
            {
 
29594
-             if (pfr < end_pfr)
 
29595
+             if (pfr < end_pfr && i < nfixedargs)
 
29596
                {
 
29597
                  /* Passed partly in f13 and partly on the stack.
 
29598
                     Move it all to the stack.  */
 
29599
@@ -1477,5 +1792,14 @@
 
29600
   (closure->fun) (cif, rvalue, avalue, closure->user_data);
 
29601
 
 
29602
   /* Tell ffi_closure_LINUX64 how to perform return type promotions.  */
 
29603
+  if ((cif->flags & FLAG_RETURNS_SMST) != 0)
 
29604
+    {
 
29605
+      if ((cif->flags & FLAG_RETURNS_FP) == 0)
 
29606
+       return FFI_V2_TYPE_SMALL_STRUCT + cif->rtype->size - 1;
 
29607
+      else if ((cif->flags & FLAG_RETURNS_64BITS) != 0)
 
29608
+       return FFI_V2_TYPE_DOUBLE_HOMOG;
 
29609
+      else
 
29610
+       return FFI_V2_TYPE_FLOAT_HOMOG;
 
29611
+    }
 
29612
   return cif->rtype->type;
 
29613
 }
 
29614
--- a/src/libffi/src/powerpc/linux64_closure.S
 
29615
+++ b/src/libffi/src/powerpc/linux64_closure.S
 
29616
@@ -33,15 +33,22 @@
 
29617
 #ifdef __powerpc64__
 
29618
        FFI_HIDDEN (ffi_closure_LINUX64)
 
29619
        .globl  ffi_closure_LINUX64
 
29620
+# if _CALL_ELF == 2
 
29621
+       .text
 
29622
+ffi_closure_LINUX64:
 
29623
+       addis   %r2, %r12, .TOC.-ffi_closure_LINUX64@ha
 
29624
+       addi    %r2, %r2, .TOC.-ffi_closure_LINUX64@l
 
29625
+       .localentry ffi_closure_LINUX64, . - ffi_closure_LINUX64
 
29626
+# else
 
29627
        .section        ".opd","aw"
 
29628
        .align  3
 
29629
 ffi_closure_LINUX64:
 
29630
-#ifdef _CALL_LINUX
 
29631
+#  ifdef _CALL_LINUX
 
29632
        .quad   .L.ffi_closure_LINUX64,.TOC.@tocbase,0
 
29633
        .type   ffi_closure_LINUX64,@function
 
29634
        .text
 
29635
 .L.ffi_closure_LINUX64:
 
29636
-#else
 
29637
+#  else
 
29638
        FFI_HIDDEN (.ffi_closure_LINUX64)
 
29639
        .globl  .ffi_closure_LINUX64
 
29640
        .quad   .ffi_closure_LINUX64,.TOC.@tocbase,0
 
29641
@@ -49,61 +56,103 @@
 
29642
        .type   .ffi_closure_LINUX64,@function
 
29643
        .text
 
29644
 .ffi_closure_LINUX64:
 
29645
-#endif
 
29646
+#  endif
 
29647
+# endif
 
29648
+
 
29649
+# if _CALL_ELF == 2
 
29650
+#  32 byte special reg save area + 64 byte parm save area and retval
 
29651
+#  + 13*8 fpr save area + round to 16
 
29652
+#  define STACKFRAME 208
 
29653
+#  define PARMSAVE 32
 
29654
+#  No parameter save area is needed for the call to ffi_closure_helper_LINUX64,
 
29655
+#  so return value can start there.
 
29656
+#  define RETVAL PARMSAVE
 
29657
+# else
 
29658
+#  48 bytes special reg save area + 64 bytes parm save area
 
29659
+#  + 16 bytes retval area + 13*8 bytes fpr save area + round to 16
 
29660
+#  define STACKFRAME 240
 
29661
+#  define PARMSAVE 48
 
29662
+#  define RETVAL PARMSAVE+64
 
29663
+# endif
 
29664
+
 
29665
 .LFB1:
 
29666
-       # save general regs into parm save area
 
29667
-       std     %r3, 48(%r1)
 
29668
-       std     %r4, 56(%r1)
 
29669
-       std     %r5, 64(%r1)
 
29670
-       std     %r6, 72(%r1)
 
29671
+# if _CALL_ELF == 2
 
29672
+       ld      %r12, FFI_TRAMPOLINE_SIZE(%r11)         # closure->cif
 
29673
        mflr    %r0
 
29674
+       lwz     %r12, 28(%r12)                          # cif->flags
 
29675
+       mtcrf   0x40, %r12
 
29676
+       addi    %r12, %r1, PARMSAVE
 
29677
+       bt      7, .Lparmsave
 
29678
+       # Our caller has not allocated a parameter save area.
 
29679
+       # We need to allocate one here and use it to pass gprs to
 
29680
+       # ffi_closure_helper_LINUX64.  The return value area will do.
 
29681
+       addi    %r12, %r1, -STACKFRAME+RETVAL
 
29682
+.Lparmsave:
 
29683
+       std     %r0, 16(%r1)
 
29684
+       # Save general regs into parm save area
 
29685
+       std     %r3, 0(%r12)
 
29686
+       std     %r4, 8(%r12)
 
29687
+       std     %r5, 16(%r12)
 
29688
+       std     %r6, 24(%r12)
 
29689
+       std     %r7, 32(%r12)
 
29690
+       std     %r8, 40(%r12)
 
29691
+       std     %r9, 48(%r12)
 
29692
+       std     %r10, 56(%r12)
 
29693
 
 
29694
-       std     %r7, 80(%r1)
 
29695
-       std     %r8, 88(%r1)
 
29696
-       std     %r9, 96(%r1)
 
29697
-       std     %r10, 104(%r1)
 
29698
+       # load up the pointer to the parm save area
 
29699
+       mr      %r5, %r12
 
29700
+# else
 
29701
+       mflr    %r0
 
29702
+       # Save general regs into parm save area
 
29703
+       # This is the parameter save area set up by our caller.
 
29704
+       std     %r3, PARMSAVE+0(%r1)
 
29705
+       std     %r4, PARMSAVE+8(%r1)
 
29706
+       std     %r5, PARMSAVE+16(%r1)
 
29707
+       std     %r6, PARMSAVE+24(%r1)
 
29708
+       std     %r7, PARMSAVE+32(%r1)
 
29709
+       std     %r8, PARMSAVE+40(%r1)
 
29710
+       std     %r9, PARMSAVE+48(%r1)
 
29711
+       std     %r10, PARMSAVE+56(%r1)
 
29712
+
 
29713
        std     %r0, 16(%r1)
 
29714
 
 
29715
-       # mandatory 48 bytes special reg save area + 64 bytes parm save area
 
29716
-       # + 16 bytes retval area + 13*8 bytes fpr save area + round to 16
 
29717
-       stdu    %r1, -240(%r1)
 
29718
-.LCFI0:
 
29719
+       # load up the pointer to the parm save area
 
29720
+       addi    %r5, %r1, PARMSAVE
 
29721
+# endif
 
29722
 
 
29723
        # next save fpr 1 to fpr 13
 
29724
-       stfd  %f1, 128+(0*8)(%r1)
 
29725
-       stfd  %f2, 128+(1*8)(%r1)
 
29726
-       stfd  %f3, 128+(2*8)(%r1)
 
29727
-       stfd  %f4, 128+(3*8)(%r1)
 
29728
-       stfd  %f5, 128+(4*8)(%r1)
 
29729
-       stfd  %f6, 128+(5*8)(%r1)
 
29730
-       stfd  %f7, 128+(6*8)(%r1)
 
29731
-       stfd  %f8, 128+(7*8)(%r1)
 
29732
-       stfd  %f9, 128+(8*8)(%r1)
 
29733
-       stfd  %f10, 128+(9*8)(%r1)
 
29734
-       stfd  %f11, 128+(10*8)(%r1)
 
29735
-       stfd  %f12, 128+(11*8)(%r1)
 
29736
-       stfd  %f13, 128+(12*8)(%r1)
 
29737
+       stfd    %f1, -104+(0*8)(%r1)
 
29738
+       stfd    %f2, -104+(1*8)(%r1)
 
29739
+       stfd    %f3, -104+(2*8)(%r1)
 
29740
+       stfd    %f4, -104+(3*8)(%r1)
 
29741
+       stfd    %f5, -104+(4*8)(%r1)
 
29742
+       stfd    %f6, -104+(5*8)(%r1)
 
29743
+       stfd    %f7, -104+(6*8)(%r1)
 
29744
+       stfd    %f8, -104+(7*8)(%r1)
 
29745
+       stfd    %f9, -104+(8*8)(%r1)
 
29746
+       stfd    %f10, -104+(9*8)(%r1)
 
29747
+       stfd    %f11, -104+(10*8)(%r1)
 
29748
+       stfd    %f12, -104+(11*8)(%r1)
 
29749
+       stfd    %f13, -104+(12*8)(%r1)
 
29750
 
 
29751
-       # set up registers for the routine that actually does the work
 
29752
-       # get the context pointer from the trampoline
 
29753
-       mr %r3, %r11
 
29754
+       # load up the pointer to the saved fpr registers */
 
29755
+       addi    %r6, %r1, -104
 
29756
 
 
29757
-       # now load up the pointer to the result storage
 
29758
-       addi %r4, %r1, 112
 
29759
+       # load up the pointer to the result storage
 
29760
+       addi    %r4, %r1, -STACKFRAME+RETVAL
 
29761
 
 
29762
-       # now load up the pointer to the parameter save area
 
29763
-       # in the previous frame
 
29764
-       addi %r5, %r1, 240 + 48
 
29765
+       stdu    %r1, -STACKFRAME(%r1)
 
29766
+.LCFI0:
 
29767
 
 
29768
-       # now load up the pointer to the saved fpr registers */
 
29769
-       addi %r6, %r1, 128
 
29770
+       # get the context pointer from the trampoline
 
29771
+       mr      %r3, %r11
 
29772
 
 
29773
        # make the call
 
29774
-#ifdef _CALL_LINUX
 
29775
+# if defined _CALL_LINUX || _CALL_ELF == 2
 
29776
        bl ffi_closure_helper_LINUX64
 
29777
-#else
 
29778
+# else
 
29779
        bl .ffi_closure_helper_LINUX64
 
29780
-#endif
 
29781
+# endif
 
29782
 .Lret:
 
29783
 
 
29784
        # now r3 contains the return type
 
29785
@@ -112,10 +161,12 @@
 
29786
 
 
29787
        # look up the proper starting point in table
 
29788
        # by using return type as offset
 
29789
+       ld %r0, STACKFRAME+16(%r1)
 
29790
+       cmpldi %r3, FFI_V2_TYPE_SMALL_STRUCT
 
29791
+       bge .Lsmall
 
29792
        mflr %r4                # move address of .Lret to r4
 
29793
        sldi %r3, %r3, 4        # now multiply return type by 16
 
29794
        addi %r4, %r4, .Lret_type0 - .Lret
 
29795
-       ld %r0, 240+16(%r1)
 
29796
        add %r3, %r3, %r4       # add contents of table to table address
 
29797
        mtctr %r3
 
29798
        bctr                    # jump to it
 
29799
@@ -128,117 +179,175 @@
 
29800
 .Lret_type0:
 
29801
 # case FFI_TYPE_VOID
 
29802
        mtlr %r0
 
29803
-       addi %r1, %r1, 240
 
29804
+       addi %r1, %r1, STACKFRAME
 
29805
        blr
 
29806
        nop
 
29807
 # case FFI_TYPE_INT
 
29808
-#ifdef __LITTLE_ENDIAN__
 
29809
-       lwa %r3, 112+0(%r1)
 
29810
-#else
 
29811
-       lwa %r3, 112+4(%r1)
 
29812
-#endif
 
29813
+# ifdef __LITTLE_ENDIAN__
 
29814
+       lwa %r3, RETVAL+0(%r1)
 
29815
+# else
 
29816
+       lwa %r3, RETVAL+4(%r1)
 
29817
+# endif
 
29818
        mtlr %r0
 
29819
-       addi %r1, %r1, 240
 
29820
+       addi %r1, %r1, STACKFRAME
 
29821
        blr
 
29822
 # case FFI_TYPE_FLOAT
 
29823
-       lfs %f1, 112+0(%r1)
 
29824
+       lfs %f1, RETVAL+0(%r1)
 
29825
        mtlr %r0
 
29826
-       addi %r1, %r1, 240
 
29827
+       addi %r1, %r1, STACKFRAME
 
29828
        blr
 
29829
 # case FFI_TYPE_DOUBLE
 
29830
-       lfd %f1, 112+0(%r1)
 
29831
+       lfd %f1, RETVAL+0(%r1)
 
29832
        mtlr %r0
 
29833
-       addi %r1, %r1, 240
 
29834
+       addi %r1, %r1, STACKFRAME
 
29835
        blr
 
29836
 # case FFI_TYPE_LONGDOUBLE
 
29837
-       lfd %f1, 112+0(%r1)
 
29838
+       lfd %f1, RETVAL+0(%r1)
 
29839
        mtlr %r0
 
29840
-       lfd %f2, 112+8(%r1)
 
29841
+       lfd %f2, RETVAL+8(%r1)
 
29842
        b .Lfinish
 
29843
 # case FFI_TYPE_UINT8
 
29844
-#ifdef __LITTLE_ENDIAN__
 
29845
-       lbz %r3, 112+0(%r1)
 
29846
-#else
 
29847
-       lbz %r3, 112+7(%r1)
 
29848
-#endif
 
29849
+# ifdef __LITTLE_ENDIAN__
 
29850
+       lbz %r3, RETVAL+0(%r1)
 
29851
+# else
 
29852
+       lbz %r3, RETVAL+7(%r1)
 
29853
+# endif
 
29854
        mtlr %r0
 
29855
-       addi %r1, %r1, 240
 
29856
+       addi %r1, %r1, STACKFRAME
 
29857
        blr
 
29858
 # case FFI_TYPE_SINT8
 
29859
-#ifdef __LITTLE_ENDIAN__
 
29860
-       lbz %r3, 112+0(%r1)
 
29861
-#else
 
29862
-       lbz %r3, 112+7(%r1)
 
29863
-#endif
 
29864
+# ifdef __LITTLE_ENDIAN__
 
29865
+       lbz %r3, RETVAL+0(%r1)
 
29866
+# else
 
29867
+       lbz %r3, RETVAL+7(%r1)
 
29868
+# endif
 
29869
        extsb %r3,%r3
 
29870
        mtlr %r0
 
29871
        b .Lfinish
 
29872
 # case FFI_TYPE_UINT16
 
29873
-#ifdef __LITTLE_ENDIAN__
 
29874
-       lhz %r3, 112+0(%r1)
 
29875
-#else
 
29876
-       lhz %r3, 112+6(%r1)
 
29877
-#endif
 
29878
+# ifdef __LITTLE_ENDIAN__
 
29879
+       lhz %r3, RETVAL+0(%r1)
 
29880
+# else
 
29881
+       lhz %r3, RETVAL+6(%r1)
 
29882
+# endif
 
29883
        mtlr %r0
 
29884
 .Lfinish:
 
29885
-       addi %r1, %r1, 240
 
29886
+       addi %r1, %r1, STACKFRAME
 
29887
        blr
 
29888
 # case FFI_TYPE_SINT16
 
29889
-#ifdef __LITTLE_ENDIAN__
 
29890
-       lha %r3, 112+0(%r1)
 
29891
-#else
 
29892
-       lha %r3, 112+6(%r1)
 
29893
-#endif
 
29894
+# ifdef __LITTLE_ENDIAN__
 
29895
+       lha %r3, RETVAL+0(%r1)
 
29896
+# else
 
29897
+       lha %r3, RETVAL+6(%r1)
 
29898
+# endif
 
29899
        mtlr %r0
 
29900
-       addi %r1, %r1, 240
 
29901
+       addi %r1, %r1, STACKFRAME
 
29902
        blr
 
29903
 # case FFI_TYPE_UINT32
 
29904
-#ifdef __LITTLE_ENDIAN__
 
29905
-       lwz %r3, 112+0(%r1)
 
29906
-#else
 
29907
-       lwz %r3, 112+4(%r1)
 
29908
-#endif
 
29909
+# ifdef __LITTLE_ENDIAN__
 
29910
+       lwz %r3, RETVAL+0(%r1)
 
29911
+# else
 
29912
+       lwz %r3, RETVAL+4(%r1)
 
29913
+# endif
 
29914
        mtlr %r0
 
29915
-       addi %r1, %r1, 240
 
29916
+       addi %r1, %r1, STACKFRAME
 
29917
        blr
 
29918
 # case FFI_TYPE_SINT32
 
29919
-#ifdef __LITTLE_ENDIAN__
 
29920
-       lwa %r3, 112+0(%r1)
 
29921
-#else
 
29922
-       lwa %r3, 112+4(%r1)
 
29923
-#endif
 
29924
+# ifdef __LITTLE_ENDIAN__
 
29925
+       lwa %r3, RETVAL+0(%r1)
 
29926
+# else
 
29927
+       lwa %r3, RETVAL+4(%r1)
 
29928
+# endif
 
29929
        mtlr %r0
 
29930
-       addi %r1, %r1, 240
 
29931
+       addi %r1, %r1, STACKFRAME
 
29932
        blr
 
29933
 # case FFI_TYPE_UINT64
 
29934
-       ld %r3, 112+0(%r1)
 
29935
+       ld %r3, RETVAL+0(%r1)
 
29936
        mtlr %r0
 
29937
-       addi %r1, %r1, 240
 
29938
+       addi %r1, %r1, STACKFRAME
 
29939
        blr
 
29940
 # case FFI_TYPE_SINT64
 
29941
-       ld %r3, 112+0(%r1)
 
29942
+       ld %r3, RETVAL+0(%r1)
 
29943
        mtlr %r0
 
29944
-       addi %r1, %r1, 240
 
29945
+       addi %r1, %r1, STACKFRAME
 
29946
        blr
 
29947
 # case FFI_TYPE_STRUCT
 
29948
        mtlr %r0
 
29949
-       addi %r1, %r1, 240
 
29950
+       addi %r1, %r1, STACKFRAME
 
29951
        blr
 
29952
        nop
 
29953
 # case FFI_TYPE_POINTER
 
29954
-       ld %r3, 112+0(%r1)
 
29955
+       ld %r3, RETVAL+0(%r1)
 
29956
        mtlr %r0
 
29957
-       addi %r1, %r1, 240
 
29958
+       addi %r1, %r1, STACKFRAME
 
29959
        blr
 
29960
-# esac
 
29961
+# case FFI_V2_TYPE_FLOAT_HOMOG
 
29962
+       lfs %f1, RETVAL+0(%r1)
 
29963
+       lfs %f2, RETVAL+4(%r1)
 
29964
+       lfs %f3, RETVAL+8(%r1)
 
29965
+       b .Lmorefloat
 
29966
+# case FFI_V2_TYPE_DOUBLE_HOMOG
 
29967
+       lfd %f1, RETVAL+0(%r1)
 
29968
+       lfd %f2, RETVAL+8(%r1)
 
29969
+       lfd %f3, RETVAL+16(%r1)
 
29970
+       lfd %f4, RETVAL+24(%r1)
 
29971
+       mtlr %r0
 
29972
+       lfd %f5, RETVAL+32(%r1)
 
29973
+       lfd %f6, RETVAL+40(%r1)
 
29974
+       lfd %f7, RETVAL+48(%r1)
 
29975
+       lfd %f8, RETVAL+56(%r1)
 
29976
+       addi %r1, %r1, STACKFRAME
 
29977
+       blr
 
29978
+.Lmorefloat:
 
29979
+       lfs %f4, RETVAL+12(%r1)
 
29980
+       mtlr %r0
 
29981
+       lfs %f5, RETVAL+16(%r1)
 
29982
+       lfs %f6, RETVAL+20(%r1)
 
29983
+       lfs %f7, RETVAL+24(%r1)
 
29984
+       lfs %f8, RETVAL+28(%r1)
 
29985
+       addi %r1, %r1, STACKFRAME
 
29986
+       blr
 
29987
+.Lsmall:
 
29988
+# ifdef __LITTLE_ENDIAN__
 
29989
+       ld %r3,RETVAL+0(%r1)
 
29990
+       mtlr %r0
 
29991
+       ld %r4,RETVAL+8(%r1)
 
29992
+       addi %r1, %r1, STACKFRAME
 
29993
+       blr
 
29994
+# else
 
29995
+       # A struct smaller than a dword is returned in the low bits of r3
 
29996
+       # ie. right justified.  Larger structs are passed left justified
 
29997
+       # in r3 and r4.  The return value area on the stack will have
 
29998
+       # the structs as they are usually stored in memory.
 
29999
+       cmpldi %r3, FFI_V2_TYPE_SMALL_STRUCT + 7 # size 8 bytes?
 
30000
+       neg %r5, %r3
 
30001
+       ld %r3,RETVAL+0(%r1)
 
30002
+       blt .Lsmalldown
 
30003
+       mtlr %r0
 
30004
+       ld %r4,RETVAL+8(%r1)
 
30005
+       addi %r1, %r1, STACKFRAME
 
30006
+       blr
 
30007
+.Lsmalldown:
 
30008
+       addi %r5, %r5, FFI_V2_TYPE_SMALL_STRUCT + 7
 
30009
+       mtlr %r0
 
30010
+       sldi %r5, %r5, 3
 
30011
+       addi %r1, %r1, STACKFRAME
 
30012
+       srd %r3, %r3, %r5
 
30013
+       blr
 
30014
+# endif
 
30015
+
 
30016
 .LFE1:
 
30017
        .long   0
 
30018
        .byte   0,12,0,1,128,0,0,0
 
30019
-#ifdef _CALL_LINUX
 
30020
+# if _CALL_ELF == 2
 
30021
+       .size   ffi_closure_LINUX64,.-ffi_closure_LINUX64
 
30022
+# else
 
30023
+#  ifdef _CALL_LINUX
 
30024
        .size   ffi_closure_LINUX64,.-.L.ffi_closure_LINUX64
 
30025
-#else
 
30026
+#  else
 
30027
        .size   .ffi_closure_LINUX64,.-.ffi_closure_LINUX64
 
30028
-#endif
 
30029
+#  endif
 
30030
+# endif
 
30031
 
 
30032
        .section        .eh_frame,EH_FRAME_FLAGS,@progbits
 
30033
 .Lframe1:
 
30034
@@ -267,14 +376,14 @@
 
30035
        .byte   0x2      # DW_CFA_advance_loc1
 
30036
        .byte   .LCFI0-.LFB1
 
30037
        .byte   0xe      # DW_CFA_def_cfa_offset
 
30038
-       .uleb128 240
 
30039
+       .uleb128 STACKFRAME
 
30040
        .byte   0x11     # DW_CFA_offset_extended_sf
 
30041
        .uleb128 0x41
 
30042
        .sleb128 -2
 
30043
        .align 3
 
30044
 .LEFDE1:
 
30045
-#endif
 
30046
 
 
30047
-#if defined __ELF__ && defined __linux__
 
30048
+# if defined __ELF__ && defined __linux__
 
30049
        .section        .note.GNU-stack,"",@progbits
 
30050
+# endif
 
30051
 #endif
 
30052
--- a/src/libffi/src/powerpc/linux64.S
 
30053
+++ b/src/libffi/src/powerpc/linux64.S
 
30054
@@ -32,15 +32,22 @@
 
30055
 #ifdef __powerpc64__
 
30056
        .hidden ffi_call_LINUX64
 
30057
        .globl  ffi_call_LINUX64
 
30058
+# if _CALL_ELF == 2
 
30059
+       .text
 
30060
+ffi_call_LINUX64:
 
30061
+       addis   %r2, %r12, .TOC.-ffi_call_LINUX64@ha
 
30062
+       addi    %r2, %r2, .TOC.-ffi_call_LINUX64@l
 
30063
+       .localentry ffi_call_LINUX64, . - ffi_call_LINUX64
 
30064
+# else
 
30065
        .section        ".opd","aw"
 
30066
        .align  3
 
30067
 ffi_call_LINUX64:
 
30068
-#ifdef _CALL_LINUX
 
30069
+#  ifdef _CALL_LINUX
 
30070
        .quad   .L.ffi_call_LINUX64,.TOC.@tocbase,0
 
30071
        .type   ffi_call_LINUX64,@function
 
30072
        .text
 
30073
 .L.ffi_call_LINUX64:
 
30074
-#else
 
30075
+#  else
 
30076
        .hidden .ffi_call_LINUX64
 
30077
        .globl  .ffi_call_LINUX64
 
30078
        .quad   .ffi_call_LINUX64,.TOC.@tocbase,0
 
30079
@@ -48,7 +55,8 @@
 
30080
        .type   .ffi_call_LINUX64,@function
 
30081
        .text
 
30082
 .ffi_call_LINUX64:
 
30083
-#endif
 
30084
+#  endif
 
30085
+# endif
 
30086
 .LFB1:
 
30087
        mflr    %r0
 
30088
        std     %r28, -32(%r1)
 
30089
@@ -63,26 +71,35 @@
 
30090
        mr      %r31, %r5       /* flags, */
 
30091
        mr      %r30, %r6       /* rvalue, */
 
30092
        mr      %r29, %r7       /* function address.  */
 
30093
+/* Save toc pointer, not for the ffi_prep_args64 call, but for the later
 
30094
+   bctrl function call.  */
 
30095
+# if _CALL_ELF == 2
 
30096
+       std     %r2, 24(%r1)
 
30097
+# else
 
30098
        std     %r2, 40(%r1)
 
30099
+# endif
 
30100
 
 
30101
        /* Call ffi_prep_args64.  */
 
30102
        mr      %r4, %r1
 
30103
-#ifdef _CALL_LINUX
 
30104
+# if defined _CALL_LINUX || _CALL_ELF == 2
 
30105
        bl      ffi_prep_args64
 
30106
-#else
 
30107
+# else
 
30108
        bl      .ffi_prep_args64
 
30109
-#endif
 
30110
+# endif
 
30111
 
 
30112
-       ld      %r0, 0(%r29)
 
30113
+# if _CALL_ELF == 2
 
30114
+       mr      %r12, %r29
 
30115
+# else
 
30116
+       ld      %r12, 0(%r29)
 
30117
        ld      %r2, 8(%r29)
 
30118
        ld      %r11, 16(%r29)
 
30119
-
 
30120
+# endif
 
30121
        /* Now do the call.  */
 
30122
        /* Set up cr1 with bits 4-7 of the flags.  */
 
30123
        mtcrf   0x40, %r31
 
30124
 
 
30125
        /* Get the address to call into CTR.  */
 
30126
-       mtctr   %r0
 
30127
+       mtctr   %r12
 
30128
        /* Load all those argument registers.  */
 
30129
        ld      %r3, -32-(8*8)(%r28)
 
30130
        ld      %r4, -32-(7*8)(%r28)
 
30131
@@ -117,12 +134,17 @@
 
30132
 
 
30133
        /* This must follow the call immediately, the unwinder
 
30134
           uses this to find out if r2 has been saved or not.  */
 
30135
+# if _CALL_ELF == 2
 
30136
+       ld      %r2, 24(%r1)
 
30137
+# else
 
30138
        ld      %r2, 40(%r1)
 
30139
+# endif
 
30140
 
 
30141
        /* Now, deal with the return value.  */
 
30142
        mtcrf   0x01, %r31
 
30143
-       bt-     30, .Ldone_return_value
 
30144
-       bt-     29, .Lfp_return_value
 
30145
+       bt      31, .Lstruct_return_value
 
30146
+       bt      30, .Ldone_return_value
 
30147
+       bt      29, .Lfp_return_value
 
30148
        std     %r3, 0(%r30)
 
30149
        /* Fall through...  */
 
30150
 
 
30151
@@ -130,7 +152,7 @@
 
30152
        /* Restore the registers we used and return.  */
 
30153
        mr      %r1, %r28
 
30154
        ld      %r0, 16(%r28)
 
30155
-       ld      %r28, -32(%r1)
 
30156
+       ld      %r28, -32(%r28)
 
30157
        mtlr    %r0
 
30158
        ld      %r29, -24(%r1)
 
30159
        ld      %r30, -16(%r1)
 
30160
@@ -147,14 +169,48 @@
 
30161
 .Lfloat_return_value:
 
30162
        stfs    %f1, 0(%r30)
 
30163
        b       .Ldone_return_value
 
30164
+
 
30165
+.Lstruct_return_value:
 
30166
+       bf      29, .Lsmall_struct
 
30167
+       bf      28, .Lfloat_homog_return_value
 
30168
+       stfd    %f1, 0(%r30)
 
30169
+       stfd    %f2, 8(%r30)
 
30170
+       stfd    %f3, 16(%r30)
 
30171
+       stfd    %f4, 24(%r30)
 
30172
+       stfd    %f5, 32(%r30)
 
30173
+       stfd    %f6, 40(%r30)
 
30174
+       stfd    %f7, 48(%r30)
 
30175
+       stfd    %f8, 56(%r30)
 
30176
+       b       .Ldone_return_value
 
30177
+
 
30178
+.Lfloat_homog_return_value:
 
30179
+       stfs    %f1, 0(%r30)
 
30180
+       stfs    %f2, 4(%r30)
 
30181
+       stfs    %f3, 8(%r30)
 
30182
+       stfs    %f4, 12(%r30)
 
30183
+       stfs    %f5, 16(%r30)
 
30184
+       stfs    %f6, 20(%r30)
 
30185
+       stfs    %f7, 24(%r30)
 
30186
+       stfs    %f8, 28(%r30)
 
30187
+       b       .Ldone_return_value
 
30188
+
 
30189
+.Lsmall_struct:
 
30190
+       std     %r3, 0(%r30)
 
30191
+       std     %r4, 8(%r30)
 
30192
+       b       .Ldone_return_value
 
30193
+
 
30194
 .LFE1:
 
30195
        .long   0
 
30196
        .byte   0,12,0,1,128,4,0,0
 
30197
-#ifdef _CALL_LINUX
 
30198
+# if _CALL_ELF == 2
 
30199
+       .size   ffi_call_LINUX64,.-ffi_call_LINUX64
 
30200
+# else
 
30201
+#  ifdef _CALL_LINUX
 
30202
        .size   ffi_call_LINUX64,.-.L.ffi_call_LINUX64
 
30203
-#else
 
30204
+#  else
 
30205
        .size   .ffi_call_LINUX64,.-.ffi_call_LINUX64
 
30206
-#endif
 
30207
+#  endif
 
30208
+# endif
 
30209
 
 
30210
        .section        .eh_frame,EH_FRAME_FLAGS,@progbits
 
30211
 .Lframe1:
 
30212
@@ -197,8 +253,8 @@
 
30213
        .uleb128 0x4
 
30214
        .align 3
 
30215
 .LEFDE1:
 
30216
-#endif
 
30217
 
 
30218
-#if defined __ELF__ && defined __linux__
 
30219
+# if (defined __ELF__ && defined __linux__) || _CALL_ELF == 2
 
30220
        .section        .note.GNU-stack,"",@progbits
 
30221
+# endif
 
30222
 #endif
 
30223
--- a/src/libffi/testsuite/libffi.call/cls_double_va.c
 
30224
+++ b/src/libffi/testsuite/libffi.call/cls_double_va.c
 
30225
@@ -38,26 +38,24 @@
 
30226
 
 
30227
        /* This printf call is variadic */
 
30228
        CHECK(ffi_prep_cif_var(&cif, FFI_DEFAULT_ABI, 1, 2, &ffi_type_sint,
 
30229
-               arg_types) == FFI_OK);
 
30230
+                              arg_types) == FFI_OK);
 
30231
 
 
30232
        args[0] = &format;
 
30233
        args[1] = &doubleArg;
 
30234
        args[2] = NULL;
 
30235
 
 
30236
        ffi_call(&cif, FFI_FN(printf), &res, args);
 
30237
-       // { dg-output "7.0" }
 
30238
+       /* { dg-output "7.0" } */
 
30239
        printf("res: %d\n", (int) res);
 
30240
-       // { dg-output "\nres: 4" }
 
30241
+       /* { dg-output "\nres: 4" } */
 
30242
 
 
30243
-       /* The call to cls_double_va_fn is static, so have to use a normal prep_cif */
 
30244
-       CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 2, &ffi_type_sint, arg_types) == FFI_OK);
 
30245
+       CHECK(ffi_prep_closure_loc(pcl, &cif, cls_double_va_fn, NULL,
 
30246
+                                  code) == FFI_OK);
 
30247
 
 
30248
-       CHECK(ffi_prep_closure_loc(pcl, &cif, cls_double_va_fn, NULL, code) == FFI_OK);
 
30249
-
 
30250
-       res     = ((int(*)(char*, double))(code))(format, doubleArg);
 
30251
-       // { dg-output "\n7.0" }
 
30252
+       res = ((int(*)(char*, ...))(code))(format, doubleArg);
 
30253
+       /* { dg-output "\n7.0" } */
 
30254
        printf("res: %d\n", (int) res);
 
30255
-       // { dg-output "\nres: 4" }
 
30256
+       /* { dg-output "\nres: 4" } */
 
30257
 
 
30258
        exit(0);
 
30259
 }
 
30260
--- a/src/libffi/testsuite/libffi.call/cls_longdouble_va.c
 
30261
+++ b/src/libffi/testsuite/libffi.call/cls_longdouble_va.c
 
30262
@@ -38,27 +38,24 @@
 
30263
 
 
30264
        /* This printf call is variadic */
 
30265
        CHECK(ffi_prep_cif_var(&cif, FFI_DEFAULT_ABI, 1, 2, &ffi_type_sint,
 
30266
-               arg_types) == FFI_OK);
 
30267
+                              arg_types) == FFI_OK);
 
30268
 
 
30269
        args[0] = &format;
 
30270
        args[1] = &ldArg;
 
30271
        args[2] = NULL;
 
30272
 
 
30273
        ffi_call(&cif, FFI_FN(printf), &res, args);
 
30274
-       // { dg-output "7.0" }
 
30275
+       /* { dg-output "7.0" } */
 
30276
        printf("res: %d\n", (int) res);
 
30277
-       // { dg-output "\nres: 4" }
 
30278
+       /* { dg-output "\nres: 4" } */
 
30279
 
 
30280
-       /* The call to cls_longdouble_va_fn is static, so have to use a normal prep_cif */
 
30281
-       CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 2, &ffi_type_sint,
 
30282
-               arg_types) == FFI_OK);
 
30283
+       CHECK(ffi_prep_closure_loc(pcl, &cif, cls_longdouble_va_fn, NULL,
 
30284
+                                  code) == FFI_OK);
 
30285
 
 
30286
-       CHECK(ffi_prep_closure_loc(pcl, &cif, cls_longdouble_va_fn, NULL, code) == FFI_OK);
 
30287
-
 
30288
-       res     = ((int(*)(char*, long double))(code))(format, ldArg);
 
30289
-       // { dg-output "\n7.0" }
 
30290
+       res = ((int(*)(char*, ...))(code))(format, ldArg);
 
30291
+       /* { dg-output "\n7.0" } */
 
30292
        printf("res: %d\n", (int) res);
 
30293
-       // { dg-output "\nres: 4" }
 
30294
+       /* { dg-output "\nres: 4" } */
 
30295
 
 
30296
        exit(0);
 
30297
 }
 
30298
--- a/src/libffi/doc/libffi.texi
 
30299
+++ b/src/libffi/doc/libffi.texi
 
30300
@@ -184,11 +184,11 @@
 
30301
 
 
30302
 @var{rvalue} is a pointer to a chunk of memory that will hold the
 
30303
 result of the function call.  This must be large enough to hold the
 
30304
-result and must be suitably aligned; it is the caller's responsibility
 
30305
+result, no smaller than the system register size (generally 32 or 64
 
30306
+bits), and must be suitably aligned; it is the caller's responsibility
 
30307
 to ensure this.  If @var{cif} declares that the function returns
 
30308
 @code{void} (using @code{ffi_type_void}), then @var{rvalue} is
 
30309
-ignored.  If @var{rvalue} is @samp{NULL}, then the return value is
 
30310
-discarded.
 
30311
+ignored.
 
30312
 
 
30313
 @var{avalues} is a vector of @code{void *} pointers that point to the
 
30314
 memory locations holding the argument values for a call.  If @var{cif}
 
30315
@@ -214,7 +214,7 @@
 
30316
   ffi_type *args[1];
 
30317
   void *values[1];
 
30318
   char *s;
 
30319
-  int rc;
 
30320
+  ffi_arg rc;
 
30321
   
 
30322
   /* Initialize the argument info vectors */    
 
30323
   args[0] = &ffi_type_pointer;
 
30324
@@ -222,7 +222,7 @@
 
30325
   
 
30326
   /* Initialize the cif */
 
30327
   if (ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 1, 
 
30328
-                      &ffi_type_uint, args) == FFI_OK)
 
30329
+                      &ffi_type_sint, args) == FFI_OK)
 
30330
     @{
 
30331
       s = "Hello World!";
 
30332
       ffi_call(&cif, puts, &rc, values);
 
30333
@@ -360,7 +360,7 @@
 
30334
 new @code{ffi_type} object for it.
 
30335
 
 
30336
 @tindex ffi_type
 
30337
-@deftp ffi_type
 
30338
+@deftp {Data type} ffi_type
 
30339
 The @code{ffi_type} has the following members:
 
30340
 @table @code
 
30341
 @item size_t size
 
30342
@@ -414,6 +414,7 @@
 
30343
       int i;
 
30344
 
 
30345
       tm_type.size = tm_type.alignment = 0;
 
30346
+      tm_type.type = FFI_TYPE_STRUCT;
 
30347
       tm_type.elements = &tm_type_elements;
 
30348
     
 
30349
       for (i = 0; i < 9; i++)
 
30350
@@ -540,21 +541,23 @@
 
30351
 #include <ffi.h>
 
30352
 
 
30353
 /* Acts like puts with the file given at time of enclosure. */
 
30354
-void puts_binding(ffi_cif *cif, unsigned int *ret, void* args[], 
 
30355
-                  FILE *stream)
 
30356
+void puts_binding(ffi_cif *cif, void *ret, void* args[],
 
30357
+                  void *stream)
 
30358
 @{
 
30359
-  *ret = fputs(*(char **)args[0], stream);
 
30360
+  *(ffi_arg *)ret = fputs(*(char **)args[0], (FILE *)stream);
 
30361
 @}
 
30362
 
 
30363
+typedef int (*puts_t)(char *);
 
30364
+
 
30365
 int main()
 
30366
 @{
 
30367
   ffi_cif cif;
 
30368
   ffi_type *args[1];
 
30369
   ffi_closure *closure;
 
30370
 
 
30371
-  int (*bound_puts)(char *);
 
30372
+  void *bound_puts;
 
30373
   int rc;
 
30374
-  
 
30375
+
 
30376
   /* Allocate closure and bound_puts */
 
30377
   closure = ffi_closure_alloc(sizeof(ffi_closure), &bound_puts);
 
30378
 
 
30379
@@ -565,13 +568,13 @@
 
30380
 
 
30381
       /* Initialize the cif */
 
30382
       if (ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 1,
 
30383
-                       &ffi_type_uint, args) == FFI_OK)
 
30384
+                       &ffi_type_sint, args) == FFI_OK)
 
30385
         @{
 
30386
           /* Initialize the closure, setting stream to stdout */
 
30387
-          if (ffi_prep_closure_loc(closure, &cif, puts_binding, 
 
30388
+          if (ffi_prep_closure_loc(closure, &cif, puts_binding,
 
30389
                                    stdout, bound_puts) == FFI_OK)
 
30390
             @{
 
30391
-              rc = bound_puts("Hello World!");
 
30392
+              rc = ((puts_t)bound_puts)("Hello World!");
 
30393
               /* rc now holds the result of the call to fputs */
 
30394
             @}
 
30395
         @}
 
30396
--- a/src/libssp/configure
 
30397
+++ b/src/libssp/configure
 
30398
@@ -6385,7 +6385,7 @@
 
30399
   rm -rf conftest*
 
30400
   ;;
 
30401
 
 
30402
-x86_64-*kfreebsd*-gnu|x86_64-*linux*|ppc*-*linux*|powerpc*-*linux*| \
 
30403
+x86_64-*kfreebsd*-gnu|x86_64-*linux*|powerpc*-*linux*| \
 
30404
 s390*-*linux*|s390*-*tpf*|sparc*-*linux*)
 
30405
   # Find out which ABI we are using.
 
30406
   echo 'int i;' > conftest.$ac_ext
 
30407
@@ -6410,7 +6410,10 @@
 
30408
                ;;
 
30409
            esac
 
30410
            ;;
 
30411
-         ppc64-*linux*|powerpc64-*linux*)
 
30412
+         powerpc64le-*linux*)
 
30413
+           LD="${LD-ld} -m elf32lppclinux"
 
30414
+           ;;
 
30415
+         powerpc64-*linux*)
 
30416
            LD="${LD-ld} -m elf32ppclinux"
 
30417
            ;;
 
30418
          s390x-*linux*)
 
30419
@@ -6429,7 +6432,10 @@
 
30420
          x86_64-*linux*)
 
30421
            LD="${LD-ld} -m elf_x86_64"
 
30422
            ;;
 
30423
-         ppc*-*linux*|powerpc*-*linux*)
 
30424
+         powerpcle-*linux*)
 
30425
+           LD="${LD-ld} -m elf64lppc"
 
30426
+           ;;
 
30427
+         powerpc-*linux*)
 
30428
            LD="${LD-ld} -m elf64ppc"
 
30429
            ;;
 
30430
          s390*-*linux*|s390*-*tpf*)
 
30431
@@ -10658,7 +10664,7 @@
 
30432
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
 
30433
   lt_status=$lt_dlunknown
 
30434
   cat > conftest.$ac_ext <<_LT_EOF
 
30435
-#line 10661 "configure"
 
30436
+#line 10667 "configure"
 
30437
 #include "confdefs.h"
 
30438
 
 
30439
 #if HAVE_DLFCN_H
 
30440
@@ -10764,7 +10770,7 @@
 
30441
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
 
30442
   lt_status=$lt_dlunknown
 
30443
   cat > conftest.$ac_ext <<_LT_EOF
 
30444
-#line 10767 "configure"
 
30445
+#line 10773 "configure"
 
30446
 #include "confdefs.h"
 
30447
 
 
30448
 #if HAVE_DLFCN_H
 
30449
--- a/src/libcpp/ChangeLog.ibm
 
30450
+++ b/src/libcpp/ChangeLog.ibm
 
30451
@@ -0,0 +1,4 @@
 
30452
+2013-11-18  Bill Schmidt  <wschmidt@linux.vnet.ibm.com>
 
30453
+
 
30454
+       * lex.c (search_line_fast): Correct for little endian.
 
30455
+
 
30456
--- a/src/libcpp/lex.c
 
30457
+++ b/src/libcpp/lex.c
 
30458
@@ -559,8 +559,13 @@
 
30459
      beginning with all ones and shifting in zeros according to the
 
30460
      mis-alignment.  The LVSR instruction pulls the exact shift we
 
30461
      want from the address.  */
 
30462
+#ifdef __BIG_ENDIAN__
 
30463
   mask = __builtin_vec_lvsr(0, s);
 
30464
   mask = __builtin_vec_perm(zero, ones, mask);
 
30465
+#else
 
30466
+  mask = __builtin_vec_lvsl(0, s);
 
30467
+  mask = __builtin_vec_perm(ones, zero, mask);
 
30468
+#endif
 
30469
   data &= mask;
 
30470
 
 
30471
   /* While altivec loads mask addresses, we still need to align S so
 
30472
@@ -624,7 +629,11 @@
 
30473
     /* L now contains 0xff in bytes for which we matched one of the
 
30474
        relevant characters.  We can find the byte index by finding
 
30475
        its bit index and dividing by 8.  */
 
30476
+#ifdef __BIG_ENDIAN__
 
30477
     l = __builtin_clzl(l) >> 3;
 
30478
+#else
 
30479
+    l = __builtin_ctzl(l) >> 3;
 
30480
+#endif
 
30481
     return s + l;
 
30482
 
 
30483
 #undef N