1
# DP: Changes from the ibm/gcc-4_8-branch (20131125)
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/
7
--- a/src/libitm/configure
8
+++ b/src/libitm/configure
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 @@
22
- ppc64-*linux*|powerpc64-*linux*)
23
+ powerpc64le-*linux*)
24
+ LD="${LD-ld} -m elf32lppclinux"
27
LD="${LD-ld} -m elf32ppclinux"
30
@@ -7314,7 +7317,10 @@
32
LD="${LD-ld} -m elf_x86_64"
34
- ppc*-*linux*|powerpc*-*linux*)
36
+ LD="${LD-ld} -m elf64lppc"
39
LD="${LD-ld} -m elf64ppc"
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"
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"
60
@@ -17401,7 +17407,44 @@
64
+case "${target_cpu}" in
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
72
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
73
+/* end confdefs.h. */
78
+asm("tbegin. 0; tend. 0");
83
+if ac_fn_c_try_compile "$LINENO"; then :
84
+ libitm_cv_as_htm=yes
88
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
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
95
+$as_echo "#define HAVE_AS_HTM 1" >>confdefs.h
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
108
+2013-11-15 Ulrich Weigand <Ulrich.Weigand@de.ibm.com>
110
+ Backport from mainline r204808:
112
+ 2013-11-14 Ulrich Weigand <Ulrich.Weigand@de.ibm.com>
114
+ * config/powerpc/sjlj.S [__powerpc64__ && _CALL_ELF == 2]:
115
+ (FUNC): Define ELFv2 variant.
117
+ (HIDDEN): Likewise.
120
+ (LR_SAVE): Likewise.
122
+2013-07-15 Peter Bergner <bergner@vnet.ibm.com>
124
+ Backport from mainline
125
+ 2013-07-15 Peter Bergner <bergner@vnet.ibm.com>
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
142
# work out any special compilation flags as necessary.
143
case "${target_cpu}" in
144
alpha*) ARCH=alpha ;;
145
- rs6000 | powerpc*) ARCH=powerpc ;;
147
+ XCFLAGS="${XCFLAGS} -mhtm"
153
--- a/src/libitm/config/powerpc/sjlj.S
154
+++ b/src/libitm/config/powerpc/sjlj.S
159
-#if defined(__powerpc64__) && defined(__ELF__)
160
+#if defined(__powerpc64__) && _CALL_ELF == 2
163
+ .type \name, @function
165
+0: addis 2,12,(.TOC.-0b)@ha
166
+ addi 2,2,(.TOC.-0b)@l
167
+ .localentry \name, . - \name
170
+ .size \name, . - \name
179
+#elif defined(__powerpc64__) && defined(__ELF__)
185
#if defined(_CALL_AIXDESC)
187
# define LR_SAVE 2*WS
188
+#elif _CALL_ELF == 2
190
+# define LR_SAVE 2*WS
191
#elif defined(_CALL_SYSV)
193
# define LR_SAVE 1*WS
194
--- a/src/libitm/config/powerpc/target.h
195
+++ b/src/libitm/config/powerpc/target.h
197
see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
198
<http://www.gnu.org/licenses/>. */
200
+#ifdef HAVE_SYS_AUXV_H
201
+#include <sys/auxv.h>
204
namespace GTM HIDDEN {
206
typedef int v128 __attribute__((vector_size(16), may_alias, aligned(16)));
208
__asm volatile ("" : : : "memory");
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)
219
+#include <htmintrin.h>
221
+#define USE_HTM_FASTPATH
223
+#define _TBEGIN_STARTED 0
224
+#define _TBEGIN_INDETERMINATE 1
225
+#define _TBEGIN_PERSISTENT 2
227
+/* Number of retries for transient failures. */
228
+#define _HTM_RETRIES 10
231
+htm_available (void)
233
+ return (getauxval (AT_HWCAP2) & PPC_FEATURE2_HAS_HTM) ? true : false;
236
+static inline uint32_t
239
+ // Maximum number of times we try to execute a transaction
240
+ // as a HW transaction.
241
+ return htm_available () ? _HTM_RETRIES : 0;
244
+static inline uint32_t
247
+ if (__builtin_expect (__builtin_tbegin (0), 1))
248
+ return _TBEGIN_STARTED;
250
+ if (_TEXASRU_FAILURE_PERSISTENT (__builtin_get_texasru ()))
251
+ return _TBEGIN_PERSISTENT;
253
+ return _TBEGIN_INDETERMINATE;
257
+htm_begin_success (uint32_t begin_ret)
259
+ return begin_ret == _TBEGIN_STARTED;
265
+ __builtin_tend (0);
271
+ __builtin_tabort (0);
275
+htm_abort_should_retry (uint32_t begin_ret)
277
+ return begin_ret != _TBEGIN_PERSISTENT;
280
+/* Returns true iff a hardware transaction is currently being executed. */
282
+htm_transaction_active (void)
284
+ return (_HTM_STATE (__builtin_ttest ()) == _HTM_TRANSACTIONAL);
290
--- a/src/libitm/acinclude.m4
291
+++ b/src/libitm/acinclude.m4
296
+dnl Check if as supports HTM instructions.
297
+AC_DEFUN([LIBITM_CHECK_AS_HTM], [
298
+case "${target_cpu}" in
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])
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.])
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
315
@@ -1220,7 +1220,7 @@
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 @@
328
- ppc64-*linux*|powerpc64-*linux*)
329
+ powerpc64le-*linux*)
330
+ LD="${LD-ld} -m elf32lppclinux"
333
LD="${LD-ld} -m elf32ppclinux"
336
@@ -1260,7 +1263,10 @@
338
LD="${LD-ld} -m elf_x86_64"
340
- ppc*-*linux*|powerpc*-*linux*)
342
+ LD="${LD-ld} -m elf64lppc"
345
LD="${LD-ld} -m elf64ppc"
347
s390*-*linux*|s390*-*tpf*)
348
--- a/src/libgomp/configure
349
+++ b/src/libgomp/configure
350
@@ -6580,7 +6580,7 @@
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 @@
363
- ppc64-*linux*|powerpc64-*linux*)
364
+ powerpc64le-*linux*)
365
+ LD="${LD-ld} -m elf32lppclinux"
368
LD="${LD-ld} -m elf32ppclinux"
371
@@ -6624,7 +6627,10 @@
373
LD="${LD-ld} -m elf_x86_64"
375
- ppc*-*linux*|powerpc*-*linux*)
377
+ LD="${LD-ld} -m elf64lppc"
380
LD="${LD-ld} -m elf64ppc"
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"
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"
401
--- a/src/libquadmath/configure
402
+++ b/src/libquadmath/configure
403
@@ -6248,7 +6248,7 @@
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 @@
416
- ppc64-*linux*|powerpc64-*linux*)
417
+ powerpc64le-*linux*)
418
+ LD="${LD-ld} -m elf32lppclinux"
421
LD="${LD-ld} -m elf32ppclinux"
424
@@ -6292,7 +6295,10 @@
426
LD="${LD-ld} -m elf_x86_64"
428
- ppc*-*linux*|powerpc*-*linux*)
430
+ LD="${LD-ld} -m elf64lppc"
433
LD="${LD-ld} -m elf64ppc"
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"
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"
454
--- a/src/libsanitizer/configure
455
+++ b/src/libsanitizer/configure
456
@@ -6604,7 +6604,7 @@
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 @@
469
- ppc64-*linux*|powerpc64-*linux*)
470
+ powerpc64le-*linux*)
471
+ LD="${LD-ld} -m elf32lppclinux"
474
LD="${LD-ld} -m elf32ppclinux"
477
@@ -6648,7 +6651,10 @@
479
LD="${LD-ld} -m elf_x86_64"
481
- ppc*-*linux*|powerpc*-*linux*)
483
+ LD="${LD-ld} -m elf64lppc"
486
LD="${LD-ld} -m elf64ppc"
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"
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"
507
--- a/src/zlib/configure
508
+++ b/src/zlib/configure
509
@@ -5853,7 +5853,7 @@
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 @@
522
- ppc64-*linux*|powerpc64-*linux*)
523
+ powerpc64le-*linux*)
524
+ LD="${LD-ld} -m elf32lppclinux"
527
LD="${LD-ld} -m elf32ppclinux"
530
@@ -5897,7 +5900,10 @@
532
LD="${LD-ld} -m elf_x86_64"
534
- ppc*-*linux*|powerpc*-*linux*)
536
+ LD="${LD-ld} -m elf64lppc"
539
LD="${LD-ld} -m elf64ppc"
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"
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"
560
--- a/src/libstdc++-v3/configure
561
+++ b/src/libstdc++-v3/configure
562
@@ -7111,7 +7111,7 @@
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 @@
575
- ppc64-*linux*|powerpc64-*linux*)
576
+ powerpc64le-*linux*)
577
+ LD="${LD-ld} -m elf32lppclinux"
580
LD="${LD-ld} -m elf32ppclinux"
583
@@ -7155,7 +7158,10 @@
585
LD="${LD-ld} -m elf_x86_64"
587
- ppc*-*linux*|powerpc*-*linux*)
589
+ LD="${LD-ld} -m elf64lppc"
592
LD="${LD-ld} -m elf64ppc"
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"
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"
613
@@ -15033,7 +15039,7 @@
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"
622
@@ -15383,7 +15389,7 @@
623
# Fake what AC_TRY_COMPILE does.
625
cat > conftest.$ac_ext << EOF
626
-#line 15386 "configure"
627
+#line 15392 "configure"
630
typedef bool atomic_type;
631
@@ -15418,7 +15424,7 @@
634
cat > conftest.$ac_ext << EOF
635
-#line 15421 "configure"
636
+#line 15427 "configure"
639
typedef short atomic_type;
640
@@ -15453,7 +15459,7 @@
643
cat > conftest.$ac_ext << EOF
644
-#line 15456 "configure"
645
+#line 15462 "configure"
648
// NB: _Atomic_word not necessarily int.
649
@@ -15489,7 +15495,7 @@
652
cat > conftest.$ac_ext << EOF
653
-#line 15492 "configure"
654
+#line 15498 "configure"
657
typedef long long atomic_type;
658
@@ -15568,7 +15574,7 @@
659
# unnecessary for this test.
661
cat > conftest.$ac_ext << EOF
662
-#line 15571 "configure"
663
+#line 15577 "configure"
667
@@ -15610,7 +15616,7 @@
668
# unnecessary for this test.
670
cat > conftest.$ac_ext << EOF
671
-#line 15613 "configure"
672
+#line 15619 "configure"
673
template<typename T1, typename T2>
675
{ typedef T2 type; };
676
@@ -15644,7 +15650,7 @@
679
cat > conftest.$ac_ext << EOF
680
-#line 15647 "configure"
681
+#line 15653 "configure"
682
template<typename T1, typename T2>
684
{ typedef T2 type; };
685
--- a/src/libstdc++-v3/scripts/extract_symvers.in
686
+++ b/src/libstdc++-v3/scripts/extract_symvers.in
688
# present on Solaris.
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
698
+2013-11-15 Ulrich Weigand <Ulrich.Weigand@de.ibm.com>
700
+ Backport from mainline r204808:
702
+ 2013-11-14 Ulrich Weigand <Ulrich.Weigand@de.ibm.com>
704
+ * scripts/extract_symvers.in: Ignore <localentry: > fields
705
+ in readelf --symbols output.
707
+2013-08-04 Peter Bergner <bergner@vnet.ibm.com>
709
+ Backport from mainline
710
+ 2013-08-01 Fabien Chêne <fabien@gcc.gnu.org>
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.
717
--- a/src/libstdc++-v3/include/tr1/cmath
718
+++ b/src/libstdc++-v3/include/tr1/cmath
720
nexttoward(_Tp __x, long double __y)
721
{ return __builtin_nexttoward(__x, __y); }
723
- // DR 550. What should the return type of pow(float,int) be?
724
- // NB: C++0x and TR1 != C++03.
728
remainder(float __x, float __y)
729
{ return __builtin_remainderf(__x, __y); }
730
@@ -985,10 +981,19 @@
732
// DR 550. What should the return type of pow(float,int) be?
733
// NB: C++0x and TR1 != C++03.
735
- pow(double __x, double __y)
736
- { return std::pow(__x, __y); }
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
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
756
+// { dg-do compile }
758
+// Copyright (C) 2013 Free Software Foundation, Inc.
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.
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.
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/>.
777
+#include <tr1/cmath>
778
+#include <testsuite_tr1.h>
783
+ using namespace __gnu_test;
785
+ float x = 2080703.375F;
786
+ check_ret_type<float>(std::pow(x, 2));
787
+ check_ret_type<double>(std::tr1::pow(x, 2));
789
--- a/src/libmudflap/configure
790
+++ b/src/libmudflap/configure
791
@@ -6377,7 +6377,7 @@
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 @@
804
- ppc64-*linux*|powerpc64-*linux*)
805
+ powerpc64le-*linux*)
806
+ LD="${LD-ld} -m elf32lppclinux"
809
LD="${LD-ld} -m elf32ppclinux"
812
@@ -6421,7 +6424,10 @@
814
LD="${LD-ld} -m elf_x86_64"
816
- ppc*-*linux*|powerpc*-*linux*)
818
+ LD="${LD-ld} -m elf64lppc"
821
LD="${LD-ld} -m elf64ppc"
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"
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"
842
--- a/src/boehm-gc/configure
843
+++ b/src/boehm-gc/configure
844
@@ -6770,7 +6770,7 @@
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 @@
857
- ppc64-*linux*|powerpc64-*linux*)
858
+ powerpc64le-*linux*)
859
+ LD="${LD-ld} -m elf32lppclinux"
862
LD="${LD-ld} -m elf32ppclinux"
865
@@ -6814,7 +6817,10 @@
867
LD="${LD-ld} -m elf_x86_64"
869
- ppc*-*linux*|powerpc*-*linux*)
871
+ LD="${LD-ld} -m elf64lppc"
874
LD="${LD-ld} -m elf64ppc"
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"
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"
895
--- a/src/lto-plugin/configure
896
+++ b/src/lto-plugin/configure
897
@@ -6044,7 +6044,7 @@
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 @@
910
- ppc64-*linux*|powerpc64-*linux*)
911
+ powerpc64le-*linux*)
912
+ LD="${LD-ld} -m elf32lppclinux"
915
LD="${LD-ld} -m elf32ppclinux"
918
@@ -6088,7 +6091,10 @@
920
LD="${LD-ld} -m elf_x86_64"
922
- ppc*-*linux*|powerpc*-*linux*)
924
+ LD="${LD-ld} -m elf64lppc"
927
LD="${LD-ld} -m elf64ppc"
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"
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"
948
--- a/src/libatomic/configure
949
+++ b/src/libatomic/configure
950
@@ -6505,7 +6505,7 @@
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 @@
963
- ppc64-*linux*|powerpc64-*linux*)
964
+ powerpc64le-*linux*)
965
+ LD="${LD-ld} -m elf32lppclinux"
968
LD="${LD-ld} -m elf32ppclinux"
971
@@ -6549,7 +6552,10 @@
973
LD="${LD-ld} -m elf_x86_64"
975
- ppc*-*linux*|powerpc*-*linux*)
977
+ LD="${LD-ld} -m elf64lppc"
980
LD="${LD-ld} -m elf64ppc"
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"
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"
1001
--- a/src/libbacktrace/configure
1002
+++ b/src/libbacktrace/configure
1003
@@ -6842,7 +6842,7 @@
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 @@
1016
- ppc64-*linux*|powerpc64-*linux*)
1017
+ powerpc64le-*linux*)
1018
+ LD="${LD-ld} -m elf32lppclinux"
1020
+ powerpc64-*linux*)
1021
LD="${LD-ld} -m elf32ppclinux"
1024
@@ -6886,7 +6889,10 @@
1026
LD="${LD-ld} -m elf_x86_64"
1028
- ppc*-*linux*|powerpc*-*linux*)
1029
+ powerpcle-*linux*)
1030
+ LD="${LD-ld} -m elf64lppc"
1033
LD="${LD-ld} -m elf64ppc"
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"
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"
1054
--- a/src/libjava/libltdl/configure
1055
+++ b/src/libjava/libltdl/configure
1056
@@ -4806,7 +4806,7 @@
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 @@
1067
LD="${LD-ld} -m elf_i386"
1069
- ppc64-*linux*|powerpc64-*linux*)
1070
+ powerpc64le-*linux*)
1071
+ LD="${LD-ld} -m elf32lppclinux"
1073
+ powerpc64-*linux*)
1074
LD="${LD-ld} -m elf32ppclinux"
1077
@@ -4836,7 +4839,10 @@
1079
LD="${LD-ld} -m elf_x86_64"
1081
- ppc*-*linux*|powerpc*-*linux*)
1082
+ powerpcle-*linux*)
1083
+ LD="${LD-ld} -m elf64lppc"
1086
LD="${LD-ld} -m elf64ppc"
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)
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)
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)
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
1130
# The compiler can only warn and ignore the option if not recognized
1131
@@ -8099,7 +8105,7 @@
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
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"
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"
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"
1167
--- a/src/libjava/libltdl/acinclude.m4
1168
+++ b/src/libjava/libltdl/acinclude.m4
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 @@
1180
LD="${LD-ld} -m elf_i386"
1182
- ppc64-*linux*|powerpc64-*linux*)
1183
+ powerpc64le-*linux*)
1184
+ LD="${LD-ld} -m elf32lppclinux"
1186
+ powerpc64-*linux*)
1187
LD="${LD-ld} -m elf32ppclinux"
1190
@@ -545,7 +548,10 @@
1192
LD="${LD-ld} -m elf_x86_64"
1194
- ppc*-*linux*|powerpc*-*linux*)
1195
+ powerpcle-*linux*)
1196
+ LD="${LD-ld} -m elf64lppc"
1199
LD="${LD-ld} -m elf64ppc"
1202
--- a/src/libjava/classpath/configure
1203
+++ b/src/libjava/classpath/configure
1204
@@ -7577,7 +7577,7 @@
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 @@
1217
- ppc64-*linux*|powerpc64-*linux*)
1218
+ powerpc64le-*linux*)
1219
+ LD="${LD-ld} -m elf32lppclinux"
1221
+ powerpc64-*linux*)
1222
LD="${LD-ld} -m elf32ppclinux"
1225
@@ -7621,7 +7624,10 @@
1227
LD="${LD-ld} -m elf_x86_64"
1229
- ppc*-*linux*|powerpc*-*linux*)
1230
+ powerpcle-*linux*)
1231
+ LD="${LD-ld} -m elf64lppc"
1234
LD="${LD-ld} -m elf64ppc"
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"
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"
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" */
1264
@@ -25393,7 +25399,7 @@
1265
if uudecode$EXEEXT Test.uue; then
1266
ac_cv_prog_uudecode_base64=yes
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
1272
ac_cv_prog_uudecode_base64=no
1273
@@ -25421,7 +25427,7 @@
1274
CLASS_TEST=Test.class
1276
cat << \EOF > $JAVA_TEST
1277
-/* [#]line 25424 "configure" */
1278
+/* [#]line 25430 "configure" */
1280
public static void main (String args[]) {
1282
@@ -25629,7 +25635,7 @@
1284
CLASS_TEST=Test.class
1285
cat << \EOF > $JAVA_TEST
1286
- /* #line 25632 "configure" */
1287
+ /* #line 25638 "configure" */
1290
public static void main(String args)
1291
--- a/src/libjava/configure
1292
+++ b/src/libjava/configure
1293
@@ -8842,7 +8842,7 @@
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 @@
1306
- ppc64-*linux*|powerpc64-*linux*)
1307
+ powerpc64le-*linux*)
1308
+ LD="${LD-ld} -m elf32lppclinux"
1310
+ powerpc64-*linux*)
1311
LD="${LD-ld} -m elf32ppclinux"
1314
@@ -8886,7 +8889,10 @@
1316
LD="${LD-ld} -m elf_x86_64"
1318
- ppc*-*linux*|powerpc*-*linux*)
1319
+ powerpcle-*linux*)
1320
+ LD="${LD-ld} -m elf64lppc"
1323
LD="${LD-ld} -m elf64ppc"
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"
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"
1344
@@ -19483,7 +19489,7 @@
1345
enableval=$enable_sjlj_exceptions; :
1347
cat > conftest.$ac_ext << EOF
1348
-#line 19486 "configure"
1349
+#line 19492 "configure"
1353
--- a/src/libgcc/config/rs6000/tramp.S
1354
+++ b/src/libgcc/config/rs6000/tramp.S
1355
@@ -116,4 +116,70 @@
1359
+#elif _CALL_ELF == 2
1360
+ .type trampoline_initial,@object
1362
+trampoline_initial:
1363
+ ld r11,.Lchain(r12)
1364
+ ld r12,.Lfunc(r12)
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 */
1372
+trampoline_size = .-trampoline_initial
1373
+ .size trampoline_initial,trampoline_size
1376
+/* R3 = stack address to store trampoline */
1377
+/* R4 = length of trampoline area */
1378
+/* R5 = function address */
1379
+/* R6 = static chain */
1381
+ .pushsection ".toc","aw"
1383
+ .quad trampoline_initial-8
1386
+FUNC_START(__trampoline_setup)
1387
+ addis 7,2,.LC0@toc@ha
1388
+ ld 7,.LC0@toc@l(7) /* trampoline address -8 */
1390
+ li r8,trampoline_size /* verify that the trampoline is big enough */
1392
+ srwi r4,r4,3 /* # doublewords to move */
1393
+ addi r9,r3,-8 /* adjust pointer for stdu */
1397
+ /* Copy the instructions to the stack */
1403
+ /* Store correct function and static chain */
1405
+ std r6,.Lchain(r3)
1407
+ /* Now flush both caches */
1415
+ /* Finally synchronize things & return */
1421
+ bl JUMP_TARGET(abort)
1423
+FUNC_END(__trampoline_setup)
1426
--- a/src/libgcc/config/rs6000/linux-unwind.h
1427
+++ b/src/libgcc/config/rs6000/linux-unwind.h
1435
#define R_VRSAVE 109
1437
+#ifdef __powerpc64__
1439
+#define TOC_SAVE_SLOT 24
1441
+#define TOC_SAVE_SLOT 40
1447
__attribute__ ((vector_size (16))) int vr[32];
1450
else if (pc[1] == 0x380000AC)
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
1458
if ((long) frame24->puc != -21 * 8)
1459
return frame24->puc->regs;
1463
/* This works for 2.4.21 and later kernels. */
1464
struct rt_sigframe {
1467
struct gcc_regs *regs = get_regs (context);
1468
struct gcc_vregs *vregs;
1473
@@ -206,11 +220,21 @@
1474
fs->regs.reg[i].loc.offset = (long) ®s->gpr[i] - new_cfa;
1477
+ /* The CR is saved in the low 32 bits of regs->ccr. */
1478
+ cr_offset = (long) ®s->ccr - new_cfa;
1479
+#ifndef __LITTLE_ENDIAN__
1480
+ cr_offset += sizeof (long) - 4;
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) ®s->ccr - new_cfa
1487
- + sizeof (long) - 4;
1488
+ fs->regs.reg[R_CR2].loc.offset = cr_offset;
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;
1497
fs->regs.reg[R_LR].how = REG_SAVED_OFFSET;
1498
fs->regs.reg[R_LR].loc.offset = (long) ®s->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
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)
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 @@
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);
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)
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));
1541
--- a/src/libgcc/ChangeLog.ibm
1542
+++ b/src/libgcc/ChangeLog.ibm
1544
+2013-11-15 Ulrich Weigand <Ulrich.Weigand@de.ibm.com>
1546
+ Backport from mainline r204808:
1548
+ 2013-11-14 Ulrich Weigand <Ulrich.Weigand@de.ibm.com>
1549
+ Alan Modra <amodra@gmail.com>
1551
+ * config/rs6000/linux-unwind.h (TOC_SAVE_SLOT): Define.
1552
+ (frob_update_context): Use it.
1554
+ 2013-11-14 Ulrich Weigand <Ulrich.Weigand@de.ibm.com>
1555
+ Alan Modra <amodra@gmail.com>
1557
+ * config/rs6000/tramp.S [__powerpc64__ && _CALL_ELF == 2]:
1558
+ (trampoline_initial): Provide ELFv2 variant.
1559
+ (__trampoline_setup): Likewise.
1561
+ * config/rs6000/linux-unwind.h (frob_update_context): Do not
1562
+ check for AIX indirect function call sequence if _CALL_ELF == 2.
1564
+ 2013-11-14 Ulrich Weigand <Ulrich.Weigand@de.ibm.com>
1565
+ Alan Modra <amodra@gmail.com>
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.
1572
+2013-11-15 Ulrich Weigand <Ulrich.Weigand@de.ibm.com>
1574
+ Backport from mainline r204800:
1576
+ 2013-11-14 Ulrich Weigand <Ulrich.Weigand@de.ibm.com>
1577
+ Alan Modra <amodra@gmail.com>
1579
+ * config/rs6000/linux-unwind.h (ppc_fallback_frame_state): Correct
1580
+ location of CR save area for 64-bit little-endian systems.
1582
--- a/src/config.guess
1583
+++ b/src/config.guess
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.
1592
-timestamp='2012-12-30'
1593
+timestamp='2013-06-10'
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
1598
GNU config.guess ($timestamp)
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.
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
1612
+case "${UNAME_SYSTEM}" in
1614
+ # If the system lacks a compiler, then just pick glibc.
1615
+ # We could probably try harder.
1618
+ eval $set_cc_for_build
1619
+ cat <<-EOF > $dummy.c
1620
+ #include <features.h>
1621
+ #if defined(__UCLIBC__)
1623
+ #elif defined(__dietlibc__)
1629
+ eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^LIBC'`
1633
# Note: order is significant - the case branches are not exclusive.
1635
case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
1636
@@ -857,21 +874,21 @@
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,/.*$,,'`
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}
1649
echo ${UNAME_MACHINE}-pc-minix
1652
- echo ${UNAME_MACHINE}-unknown-linux-gnu
1653
+ echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
1655
aarch64_be:Linux:*:*)
1656
UNAME_MACHINE=aarch64_be
1657
- echo ${UNAME_MACHINE}-unknown-linux-gnu
1658
+ echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
1661
case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in
1662
@@ -884,59 +901,54 @@
1663
EV68*) UNAME_MACHINE=alphaev68 ;;
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}
1671
+ arc:Linux:*:* | arceb:Linux:*:*)
1672
+ echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
1675
eval $set_cc_for_build
1676
if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \
1677
| grep -q __ARM_EABI__
1679
- echo ${UNAME_MACHINE}-unknown-linux-gnu
1680
+ echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
1682
if echo __ARM_PCS_VFP | $CC_FOR_BUILD -E - 2>/dev/null \
1683
| grep -q __ARM_PCS_VFP
1685
- echo ${UNAME_MACHINE}-unknown-linux-gnueabi
1686
+ echo ${UNAME_MACHINE}-unknown-linux-${LIBC}eabi
1688
- echo ${UNAME_MACHINE}-unknown-linux-gnueabihf
1689
+ echo ${UNAME_MACHINE}-unknown-linux-${LIBC}eabihf
1694
- echo ${UNAME_MACHINE}-unknown-linux-gnu
1695
+ echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
1698
- echo ${UNAME_MACHINE}-axis-linux-gnu
1699
+ echo ${UNAME_MACHINE}-axis-linux-${LIBC}
1702
- echo ${UNAME_MACHINE}-axis-linux-gnu
1703
+ echo ${UNAME_MACHINE}-axis-linux-${LIBC}
1706
- echo ${UNAME_MACHINE}-unknown-linux-gnu
1707
+ echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
1710
- echo ${UNAME_MACHINE}-unknown-linux-gnu
1711
+ echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
1715
- eval $set_cc_for_build
1716
- sed 's/^ //' << EOF >$dummy.c
1717
- #ifdef __dietlibc__
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}
1726
- echo ${UNAME_MACHINE}-unknown-linux-gnu
1727
+ echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
1730
- echo ${UNAME_MACHINE}-unknown-linux-gnu
1731
+ echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
1734
- echo ${UNAME_MACHINE}-unknown-linux-gnu
1735
+ echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
1737
mips:Linux:*:* | mips64:Linux:*:*)
1738
eval $set_cc_for_build
1739
@@ -955,54 +967,63 @@
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; }
1747
+ echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
1750
- echo ${UNAME_MACHINE}-unknown-linux-gnu
1751
+ echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
1754
- echo sparc-unknown-linux-gnu
1755
+ echo sparc-unknown-linux-${LIBC}
1757
parisc64:Linux:*:* | hppa64:Linux:*:*)
1758
- echo hppa64-unknown-linux-gnu
1759
+ echo hppa64-unknown-linux-${LIBC}
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} ;;
1773
- echo powerpc64-unknown-linux-gnu
1774
+ echo powerpc64-unknown-linux-${LIBC}
1777
- echo powerpc-unknown-linux-gnu
1778
+ echo powerpc-unknown-linux-${LIBC}
1780
+ ppc64le:Linux:*:*)
1781
+ echo powerpc64le-unknown-linux-${LIBC}
1784
+ echo powerpcle-unknown-linux-${LIBC}
1786
s390:Linux:*:* | s390x:Linux:*:*)
1787
- echo ${UNAME_MACHINE}-ibm-linux
1788
+ echo ${UNAME_MACHINE}-ibm-linux-${LIBC}
1791
- echo ${UNAME_MACHINE}-unknown-linux-gnu
1792
+ echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
1795
- echo ${UNAME_MACHINE}-unknown-linux-gnu
1796
+ echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
1798
sparc:Linux:*:* | sparc64:Linux:*:*)
1799
- echo ${UNAME_MACHINE}-unknown-linux-gnu
1800
+ echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
1803
- echo ${UNAME_MACHINE}-unknown-linux-gnu
1804
+ echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
1807
- echo ${UNAME_MACHINE}-dec-linux-gnu
1808
+ echo ${UNAME_MACHINE}-dec-linux-${LIBC}
1811
- echo ${UNAME_MACHINE}-unknown-linux-gnu
1812
+ echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
1815
- echo ${UNAME_MACHINE}-unknown-linux-gnu
1816
+ echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
1818
i*86:DYNIX/ptx:4*:*)
1819
# ptx 4.0 does uname -s correctly, with DYNIX/ptx in there.
1820
@@ -1235,19 +1256,21 @@
1823
UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown
1824
- case $UNAME_PROCESSOR in
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
1832
- UNAME_PROCESSOR="x86_64"
1835
- unknown) UNAME_PROCESSOR=powerpc ;;
1837
+ eval $set_cc_for_build
1838
+ if test "$UNAME_PROCESSOR" = unknown ; then
1839
+ UNAME_PROCESSOR=powerpc
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
1846
+ case $UNAME_PROCESSOR in
1847
+ i386) UNAME_PROCESSOR=x86_64 ;;
1848
+ powerpc) UNAME_PROCESSOR=powerpc64 ;;
1852
echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE}
1854
*:procnto*:*:* | *:QNX:[0123456789]*:*)
1855
--- a/src/gcc/configure
1856
+++ b/src/gcc/configure
1857
@@ -13590,7 +13590,7 @@
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 @@
1870
- ppc64-*linux*|powerpc64-*linux*)
1871
+ powerpc64le-*linux*)
1872
+ LD="${LD-ld} -m elf32lppclinux"
1874
+ powerpc64-*linux*)
1875
LD="${LD-ld} -m elf32ppclinux"
1878
@@ -13634,7 +13637,10 @@
1880
LD="${LD-ld} -m elf_x86_64"
1882
- ppc*-*linux*|powerpc*-*linux*)
1883
+ powerpcle-*linux*)
1884
+ LD="${LD-ld} -m elf64lppc"
1887
LD="${LD-ld} -m elf64ppc"
1889
s390*-*linux*|s390*-*tpf*)
1890
--- a/src/gcc/builtins.c
1891
+++ b/src/gcc/builtins.c
1892
@@ -5846,6 +5846,9 @@
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);
1902
@@ -10298,6 +10301,9 @@
1903
return fold_builtin_strlen (loc, type, arg0);
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);
1912
--- a/src/gcc/testsuite/gcc.target/powerpc/ppc-target-2.c
1913
+++ b/src/gcc/testsuite/gcc.target/powerpc/ppc-target-2.c
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 } } */
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
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" } */
1933
+#define TYPE long long
1937
+#define SIGN_TYPE signed TYPE
1941
+#define UNS_TYPE unsigned TYPE
1944
+typedef vector SIGN_TYPE v_sign;
1945
+typedef vector UNS_TYPE v_uns;
1947
+v_sign sign_add (v_sign a, v_sign b)
1952
+v_sign sign_sub (v_sign a, v_sign b)
1957
+v_sign sign_shift_left (v_sign a, v_sign b)
1962
+v_sign sign_shift_right (v_sign a, v_sign b)
1967
+v_uns uns_add (v_uns a, v_uns b)
1972
+v_uns uns_sub (v_uns a, v_uns b)
1977
+v_uns uns_shift_left (v_uns a, v_uns b)
1982
+v_uns uns_shift_right (v_uns a, v_uns b)
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
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" } */
2009
+#define TYPE long long
2013
+#define SIGN_TYPE signed TYPE
2017
+#define UNS_TYPE unsigned TYPE
2020
+#define ALIGN_ATTR __attribute__((__aligned__(ALIGN)))
2022
+SIGN_TYPE sa[SIZE] ALIGN_ATTR;
2023
+SIGN_TYPE sb[SIZE] ALIGN_ATTR;
2024
+SIGN_TYPE sc[SIZE] ALIGN_ATTR;
2026
+UNS_TYPE ua[SIZE] ALIGN_ATTR;
2027
+UNS_TYPE ub[SIZE] ALIGN_ATTR;
2028
+UNS_TYPE uc[SIZE] ALIGN_ATTR;
2035
+ for (i = 0; i < SIZE; i++)
2036
+ sa[i] = sb[i] + sc[i];
2044
+ for (i = 0; i < SIZE; i++)
2045
+ sa[i] = sb[i] - sc[i];
2049
+sign_shift_left (void)
2053
+ for (i = 0; i < SIZE; i++)
2054
+ sa[i] = sb[i] << sc[i];
2058
+sign_shift_right (void)
2062
+ for (i = 0; i < SIZE; i++)
2063
+ sa[i] = sb[i] >> sc[i];
2071
+ for (i = 0; i < SIZE; i++)
2072
+ sa[i] = (sb[i] > sc[i]) ? sb[i] : sc[i];
2080
+ for (i = 0; i < SIZE; i++)
2081
+ sa[i] = (sb[i] < sc[i]) ? sb[i] : sc[i];
2089
+ for (i = 0; i < SIZE; i++)
2090
+ sa[i] = (sb[i] < 0) ? -sb[i] : sb[i]; /* xor, vsubudm, vmaxsd. */
2094
+sign_eq (SIGN_TYPE val1, SIGN_TYPE val2)
2098
+ for (i = 0; i < SIZE; i++)
2099
+ sa[i] = (sb[i] == sc[i]) ? val1 : val2;
2103
+sign_lt (SIGN_TYPE val1, SIGN_TYPE val2)
2107
+ for (i = 0; i < SIZE; i++)
2108
+ sa[i] = (sb[i] < sc[i]) ? val1 : val2;
2116
+ for (i = 0; i < SIZE; i++)
2117
+ ua[i] = ub[i] + uc[i];
2125
+ for (i = 0; i < SIZE; i++)
2126
+ ua[i] = ub[i] - uc[i];
2130
+uns_shift_left (void)
2134
+ for (i = 0; i < SIZE; i++)
2135
+ ua[i] = ub[i] << uc[i];
2139
+uns_shift_right (void)
2143
+ for (i = 0; i < SIZE; i++)
2144
+ ua[i] = ub[i] >> uc[i];
2152
+ for (i = 0; i < SIZE; i++)
2153
+ ua[i] = (ub[i] > uc[i]) ? ub[i] : uc[i];
2161
+ for (i = 0; i < SIZE; i++)
2162
+ ua[i] = (ub[i] < uc[i]) ? ub[i] : uc[i];
2166
+uns_eq (UNS_TYPE val1, UNS_TYPE val2)
2170
+ for (i = 0; i < SIZE; i++)
2171
+ ua[i] = (ub[i] == uc[i]) ? val1 : val2;
2175
+uns_lt (UNS_TYPE val1, UNS_TYPE val2)
2179
+ for (i = 0; i < SIZE; i++)
2180
+ ua[i] = (ub[i] < uc[i]) ? val1 : val2;
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
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" } */
2205
+typedef unsigned U_16 __attribute__((mode(TI)));
2207
+extern int libat_compare_exchange_16 (U_16 *, U_16 *, U_16, int, int)
2208
+ __attribute__((__noinline__));
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. */
2216
+libat_compare_exchange_16 (U_16 *mptr, U_16 *eptr, U_16 newval,
2217
+ int smodel, int fmodel __attribute__((unused)))
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);
2224
+ return __atomic_compare_exchange_n (mptr, eptr, newval, 0, 5, 0);
2227
+U_16 a = 1, b = 1, c = -2;
2228
+volatile int do_test = 0;
2232
+ if (do_test && !libat_compare_exchange_16 (&a, &b, c, 0, 0))
2237
--- a/src/gcc/testsuite/gcc.target/powerpc/recip-1.c
2238
+++ b/src/gcc/testsuite/gcc.target/powerpc/recip-1.c
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 } } */
2250
--- a/src/gcc/testsuite/gcc.target/powerpc/darwin-longlong.c
2251
+++ b/src/gcc/testsuite/gcc.target/powerpc/darwin-longlong.c
2256
+#ifdef __LITTLE_ENDIAN__
2264
--- a/src/gcc/testsuite/gcc.target/powerpc/bool2-p8.c
2265
+++ b/src/gcc/testsuite/gcc.target/powerpc/bool2-p8.c
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 " } } */
2294
+typedef int v4si __attribute__ ((vector_size (16)));
2299
--- a/src/gcc/testsuite/gcc.target/powerpc/mmfpgpr.c
2300
+++ b/src/gcc/testsuite/gcc.target/powerpc/mmfpgpr.c
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" } } */
2309
+/* Test that we generate the instructions to move between the GPR and FPR
2310
+ registers under power6x. */
2312
+extern long return_long (void);
2313
+extern double return_double (void);
2315
+double return_double2 (void)
2317
+ return (double) return_long ();
2320
+long return_long2 (void)
2322
+ return (long) return_double ();
2324
--- a/src/gcc/testsuite/gcc.target/powerpc/direct-move-vint1.c
2325
+++ b/src/gcc/testsuite/gcc.target/powerpc/direct-move-vint1.c
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" } } */
2335
+/* Check code generation for direct move for vector types. */
2337
+#define TYPE vector int
2338
+#define VSX_REG_ATTR "wa"
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
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 " } } */
2371
+typedef int v4si __attribute__ ((vector_size (16)));
2376
--- a/src/gcc/testsuite/gcc.target/powerpc/pr43154.c
2377
+++ b/src/gcc/testsuite/gcc.target/powerpc/pr43154.c
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" } */
2385
--- a/src/gcc/testsuite/gcc.target/powerpc/pr59054.c
2386
+++ b/src/gcc/testsuite/gcc.target/powerpc/pr59054.c
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" } */
2393
+long foo (void) { return 0; }
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
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" } */
2405
+#include <altivec.h>
2407
+typedef vector long long v_sign;
2408
+typedef vector unsigned long long v_uns;
2409
+typedef vector bool long long v_bool;
2411
+v_sign sign_add_1 (v_sign a, v_sign b)
2413
+ return __builtin_altivec_vaddudm (a, b);
2416
+v_sign sign_add_2 (v_sign a, v_sign b)
2418
+ return vec_add (a, b);
2421
+v_sign sign_add_3 (v_sign a, v_sign b)
2423
+ return vec_vaddudm (a, b);
2426
+v_sign sign_sub_1 (v_sign a, v_sign b)
2428
+ return __builtin_altivec_vsubudm (a, b);
2431
+v_sign sign_sub_2 (v_sign a, v_sign b)
2433
+ return vec_sub (a, b);
2437
+v_sign sign_sub_3 (v_sign a, v_sign b)
2439
+ return vec_vsubudm (a, b);
2442
+v_sign sign_min_1 (v_sign a, v_sign b)
2444
+ return __builtin_altivec_vminsd (a, b);
2447
+v_sign sign_min_2 (v_sign a, v_sign b)
2449
+ return vec_min (a, b);
2452
+v_sign sign_min_3 (v_sign a, v_sign b)
2454
+ return vec_vminsd (a, b);
2457
+v_sign sign_max_1 (v_sign a, v_sign b)
2459
+ return __builtin_altivec_vmaxsd (a, b);
2462
+v_sign sign_max_2 (v_sign a, v_sign b)
2464
+ return vec_max (a, b);
2467
+v_sign sign_max_3 (v_sign a, v_sign b)
2469
+ return vec_vmaxsd (a, b);
2472
+v_sign sign_abs (v_sign a)
2474
+ return vec_abs (a); /* xor, vsubudm, vmaxsd. */
2477
+v_bool sign_eq (v_sign a, v_sign b)
2479
+ return vec_cmpeq (a, b);
2482
+v_bool sign_lt (v_sign a, v_sign b)
2484
+ return vec_cmplt (a, b);
2487
+v_uns uns_add_2 (v_uns a, v_uns b)
2489
+ return vec_add (a, b);
2492
+v_uns uns_add_3 (v_uns a, v_uns b)
2494
+ return vec_vaddudm (a, b);
2497
+v_uns uns_sub_2 (v_uns a, v_uns b)
2499
+ return vec_sub (a, b);
2502
+v_uns uns_sub_3 (v_uns a, v_uns b)
2504
+ return vec_vsubudm (a, b);
2507
+v_uns uns_min_2 (v_uns a, v_uns b)
2509
+ return vec_min (a, b);
2512
+v_uns uns_min_3 (v_uns a, v_uns b)
2514
+ return vec_vminud (a, b);
2517
+v_uns uns_max_2 (v_uns a, v_uns b)
2519
+ return vec_max (a, b);
2522
+v_uns uns_max_3 (v_uns a, v_uns b)
2524
+ return vec_vmaxud (a, b);
2527
+v_bool uns_eq (v_uns a, v_uns b)
2529
+ return vec_cmpeq (a, b);
2532
+v_bool uns_lt (v_uns a, v_uns b)
2534
+ return vec_cmplt (a, b);
2537
+v_sign sign_rl_1 (v_sign a, v_sign b)
2539
+ return __builtin_altivec_vrld (a, b);
2542
+v_sign sign_rl_2 (v_sign a, v_uns b)
2544
+ return vec_rl (a, b);
2547
+v_uns uns_rl_2 (v_uns a, v_uns b)
2549
+ return vec_rl (a, b);
2552
+v_sign sign_sl_1 (v_sign a, v_sign b)
2554
+ return __builtin_altivec_vsld (a, b);
2557
+v_sign sign_sl_2 (v_sign a, v_uns b)
2559
+ return vec_sl (a, b);
2562
+v_sign sign_sl_3 (v_sign a, v_uns b)
2564
+ return vec_vsld (a, b);
2567
+v_uns uns_sl_2 (v_uns a, v_uns b)
2569
+ return vec_sl (a, b);
2572
+v_uns uns_sl_3 (v_uns a, v_uns b)
2574
+ return vec_vsld (a, b);
2577
+v_sign sign_sra_1 (v_sign a, v_sign b)
2579
+ return __builtin_altivec_vsrad (a, b);
2582
+v_sign sign_sra_2 (v_sign a, v_uns b)
2584
+ return vec_sra (a, b);
2587
+v_sign sign_sra_3 (v_sign a, v_uns b)
2589
+ return vec_vsrad (a, b);
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
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" } */
2612
+#include <stddef.h>
2622
+#define ALIGN_ATTR __attribute__((__aligned__(ALIGN)))
2624
+long long sign_ll[SIZE] ALIGN_ATTR;
2625
+int sign_i [SIZE] ALIGN_ATTR;
2627
+void copy_int_to_long_long (void)
2631
+ for (i = 0; i < SIZE; i++)
2632
+ sign_ll[i] = sign_i[i];
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
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" } */
2645
+typedef unsigned char V __attribute__((vector_size(16)));
2649
+ return __builtin_shuffle(x, y,
2650
+ (V){ 1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29, 31 });
2656
+ return __builtin_shuffle(x, y,
2657
+ (V){ 2, 3, 6, 7, 10, 11, 14, 15, 18, 19, 22, 23, 26, 27, 30, 31 });
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
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" } */
2673
+ QIcode, QUcode, HIcode, HUcode, SIcode, SUcode, DIcode, DUcode, SFcode,
2674
+ DFcode, XFcode, Pcode, Tcode, LAST_AND_UNUSED_TYPECODE
2676
+enum bytecode_opcode
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
2710
+struct binary_operator
2712
+ enum bytecode_opcode opcode;
2713
+ enum typecode arg0;
2715
+static struct conversion_recipe
2717
+ unsigned char *opcodes;
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;
2726
+ (conversion_recipe[(int) from][(int) to].
2727
+ opcodes ? 0 : (conversion_recipe[(int) from][(int) to] =
2728
+ deduce_conversion (from, to), 0));
2732
+bc_expand_binary_operation (optab, resulttype, arg0, arg1)
2733
+ struct binary_operator optab[];
2735
+ int i, besti, cost, bestcost;
2736
+ enum typecode resultcode, arg0code;
2737
+ for (i = 0; optab[i].opcode != -1; ++i)
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));
2744
--- a/src/gcc/testsuite/gcc.target/powerpc/no-r11-1.c
2745
+++ b/src/gcc/testsuite/gcc.target/powerpc/no-r11-1.c
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" } */
2753
--- a/src/gcc/testsuite/gcc.target/powerpc/p8vector-fp.c
2754
+++ b/src/gcc/testsuite/gcc.target/powerpc/p8vector-fp.c
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" } */
2761
+float abs_sf (float *p)
2764
+ __asm__ ("# reg %x0" : "+v" (f));
2765
+ return __builtin_fabsf (f);
2768
+float nabs_sf (float *p)
2771
+ __asm__ ("# reg %x0" : "+v" (f));
2772
+ return - __builtin_fabsf (f);
2775
+float neg_sf (float *p)
2778
+ __asm__ ("# reg %x0" : "+v" (f));
2782
+float add_sf (float *p, float *q)
2786
+ __asm__ ("# reg %x0, %x1" : "+v" (f1), "+v" (f2));
2790
+float sub_sf (float *p, float *q)
2794
+ __asm__ ("# reg %x0, %x1" : "+v" (f1), "+v" (f2));
2798
+float mul_sf (float *p, float *q)
2802
+ __asm__ ("# reg %x0, %x1" : "+v" (f1), "+v" (f2));
2806
+float div_sf (float *p, float *q)
2810
+ __asm__ ("# reg %x0, %x1" : "+v" (f1), "+v" (f2));
2814
+float sqrt_sf (float *p)
2817
+ __asm__ ("# reg %x0" : "+v" (f));
2818
+ return __builtin_sqrtf (f);
2822
+double abs_df (double *p)
2825
+ __asm__ ("# reg %x0" : "+v" (d));
2826
+ return __builtin_fabs (d);
2829
+double nabs_df (double *p)
2832
+ __asm__ ("# reg %x0" : "+v" (d));
2833
+ return - __builtin_fabs (d);
2836
+double neg_df (double *p)
2839
+ __asm__ ("# reg %x0" : "+v" (d));
2843
+double add_df (double *p, double *q)
2847
+ __asm__ ("# reg %x0, %x1" : "+v" (d1), "+v" (d2));
2851
+double sub_df (double *p, double *q)
2855
+ __asm__ ("# reg %x0, %x1" : "+v" (d1), "+v" (d2));
2859
+double mul_df (double *p, double *q)
2863
+ __asm__ ("# reg %x0, %x1" : "+v" (d1), "+v" (d2));
2867
+double div_df (double *p, double *q)
2871
+ __asm__ ("# reg %x0, %x1" : "+v" (d1), "+v" (d2));
2875
+double sqrt_df (float *p)
2878
+ __asm__ ("# reg %x0" : "+v" (d));
2879
+ return __builtin_sqrt (d);
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
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" } */
2904
+/* Check whether we get the right bits for direct move at runtime. */
2906
+#define TYPE vector int
2908
+#define VSX_REG_ATTR "wa"
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
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 " } } */
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. */
2943
+#define TYPE __int128_t
2945
+typedef int v4si __attribute__ ((vector_size (16)));
2951
--- a/src/gcc/testsuite/gcc.target/powerpc/p8vector-builtin-3.c
2952
+++ b/src/gcc/testsuite/gcc.target/powerpc/p8vector-builtin-3.c
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" } */
2959
+#include <altivec.h>
2961
+typedef vector long long vll_sign;
2962
+typedef vector unsigned long long vll_uns;
2963
+typedef vector bool long long vll_bool;
2965
+typedef vector int vi_sign;
2966
+typedef vector unsigned int vi_uns;
2967
+typedef vector bool int vi_bool;
2969
+typedef vector short vs_sign;
2970
+typedef vector unsigned short vs_uns;
2971
+typedef vector bool short vs_bool;
2973
+typedef vector signed char vc_sign;
2974
+typedef vector unsigned char vc_uns;
2975
+typedef vector bool char vc_bool;
2978
+vi_sign vi_pack_1 (vll_sign a, vll_sign b)
2980
+ return __builtin_altivec_vpkudum (a, b);
2983
+vi_sign vi_pack_2 (vll_sign a, vll_sign b)
2985
+ return vec_pack (a, b);
2988
+vi_sign vi_pack_3 (vll_sign a, vll_sign b)
2990
+ return vec_vpkudum (a, b);
2993
+vs_sign vs_pack_1 (vi_sign a, vi_sign b)
2995
+ return __builtin_altivec_vpkuwum (a, b);
2998
+vs_sign vs_pack_2 (vi_sign a, vi_sign b)
3000
+ return vec_pack (a, b);
3003
+vs_sign vs_pack_3 (vi_sign a, vi_sign b)
3005
+ return vec_vpkuwum (a, b);
3008
+vc_sign vc_pack_1 (vs_sign a, vs_sign b)
3010
+ return __builtin_altivec_vpkuhum (a, b);
3013
+vc_sign vc_pack_2 (vs_sign a, vs_sign b)
3015
+ return vec_pack (a, b);
3018
+vc_sign vc_pack_3 (vs_sign a, vs_sign b)
3020
+ return vec_vpkuhum (a, b);
3023
+vll_sign vll_unpack_hi_1 (vi_sign a)
3025
+ return __builtin_altivec_vupkhsw (a);
3028
+vll_sign vll_unpack_hi_2 (vi_sign a)
3030
+ return vec_unpackh (a);
3033
+vll_sign vll_unpack_hi_3 (vi_sign a)
3035
+ return __builtin_vec_vupkhsw (a);
3038
+vll_sign vll_unpack_lo_1 (vi_sign a)
3040
+ return vec_vupklsw (a);
3043
+vll_sign vll_unpack_lo_2 (vi_sign a)
3045
+ return vec_unpackl (a);
3048
+vll_sign vll_unpack_lo_3 (vi_sign a)
3050
+ return vec_vupklsw (a);
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
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" } */
3066
+#include <stddef.h>
3076
+#define ALIGN_ATTR __attribute__((__aligned__(ALIGN)))
3078
+long long sign_ll[SIZE] ALIGN_ATTR;
3079
+int sign_i [SIZE] ALIGN_ATTR;
3081
+void copy_long_long_to_int (void)
3085
+ for (i = 0; i < SIZE; i++)
3086
+ sign_i[i] = sign_ll[i];
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
3093
+/* Test functions for direct move support. */
3096
+#ifndef VSX_REG_ATTR
3097
+#define VSX_REG_ATTR "wa"
3100
+void __attribute__((__noinline__))
3101
+copy (TYPE *a, TYPE *b)
3107
+void __attribute__((__noinline__))
3108
+load_gpr (TYPE *a, TYPE *b)
3111
+ __asm__ ("# gpr, reg = %0" : "+b" (c));
3117
+void __attribute__((__noinline__))
3118
+load_fpr (TYPE *a, TYPE *b)
3121
+ __asm__ ("# fpr, reg = %0" : "+d" (c));
3127
+void __attribute__((__noinline__))
3128
+load_altivec (TYPE *a, TYPE *b)
3131
+ __asm__ ("# altivec, reg = %0" : "+v" (c));
3137
+void __attribute__((__noinline__))
3138
+load_vsx (TYPE *a, TYPE *b)
3141
+ __asm__ ("# vsx, reg = %x0" : "+" VSX_REG_ATTR (c));
3146
+#ifndef NO_GPR_TO_VSX
3147
+void __attribute__((__noinline__))
3148
+load_gpr_to_vsx (TYPE *a, TYPE *b)
3152
+ __asm__ ("# gpr, reg = %0" : "+b" (c));
3154
+ __asm__ ("# vsx, reg = %x0" : "+" VSX_REG_ATTR (d));
3159
+#ifndef NO_VSX_TO_GPR
3160
+void __attribute__((__noinline__))
3161
+load_vsx_to_gpr (TYPE *a, TYPE *b)
3165
+ __asm__ ("# vsx, reg = %x0" : "+" VSX_REG_ATTR (c));
3167
+ __asm__ ("# gpr, reg = %0" : "+b" (d));
3173
+typedef void (fn_type (TYPE *, TYPE *));
3175
+struct test_struct {
3180
+const struct test_struct test_functions[] = {
3183
+ { load_gpr, "load_gpr" },
3186
+ { load_fpr, "load_fpr" },
3189
+ { load_altivec, "load_altivec" },
3192
+ { load_vsx, "load_vsx" },
3194
+#ifndef NO_GPR_TO_VSX
3195
+ { load_gpr_to_vsx, "load_gpr_to_vsx" },
3197
+#ifndef NO_VSX_TO_GPR
3198
+ { load_vsx_to_gpr, "load_vsx_to_gpr" },
3202
+/* Test a given value for each of the functions. */
3203
+void __attribute__((__noinline__))
3204
+test_value (TYPE a)
3208
+ for (i = 0; i < sizeof (test_functions) / sizeof (test_functions[0]); i++)
3212
+ test_functions[i].func (&a, &b);
3213
+ if (memcmp ((void *)&a, (void *)&b, sizeof (TYPE)) != 0)
3218
+/* Main program. */
3226
+ unsigned char bytes[sizeof (TYPE)];
3230
+ TYPE value = (TYPE)-5;
3231
+ for (i = 0; i < 12; i++)
3233
+ test_value (value);
3237
+ for (i = 0; i < 8*sizeof (TYPE); i++)
3238
+ test_value (((TYPE)1) << i);
3241
+ TYPE value = (TYPE)0;
3242
+ for (i = 0; i < 10; i++)
3244
+ test_value (value);
3245
+ test_value (~ value);
3249
+ for (i = 0; i < 8*sizeof (TYPE); i++)
3250
+ test_value (((TYPE)1) << i);
3253
+ TYPE value = (TYPE)-5;
3254
+ for (i = 0; i < 12; i++)
3256
+ test_value (value);
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);
3268
+ for (j = 0; j < 10; j++)
3270
+ for (i = 0; i < sizeof (TYPE); i++)
3271
+ u.bytes[i] = (unsigned char) (random () >> 4);
3273
+ test_value (u.value);
3280
--- a/src/gcc/testsuite/gcc.target/powerpc/sd-vsx.c
3281
+++ b/src/gcc/testsuite/gcc.target/powerpc/sd-vsx.c
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 } } */
3295
+/* Test that power7 can directly load/store SDmode variables without using a
3299
+void inc_dec32 (void)
3301
+ a += (_Decimal32) 1.0;
3303
--- a/src/gcc/testsuite/gcc.target/powerpc/pr58673-2.c
3304
+++ b/src/gcc/testsuite/gcc.target/powerpc/pr58673-2.c
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" } */
3311
+#include <stddef.h>
3312
+#include <stdlib.h>
3314
+#include <string.h>
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];
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
3340
+ real rA, krA, rB, krB;
3347
+ t_iparams *iparams;
3372
+ eoPres, eoEpot, eoVir, eoDist, eoMu, eoForce, eoFx, eoFy, eoFz, eoPx, eoPy,
3373
+ eoPz, eoPolarizability, eoDipole, eoObsNR, eoMemory =
3374
+ eoObsNR, eoInter, eoUseVirial, eoNR
3376
+extern char *eoNames[eoNR];
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;
3399
+pr_ff (t_coupl_rec * tcr, real time, t_idef * idef, t_commrec * cr, int nfile,
3402
+ static FILE *prop;
3403
+ static FILE **out = ((void *) 0);
3404
+ static FILE **qq = ((void *) 0);
3405
+ static FILE **ip = ((void *) 0);
3412
+ if ((prop == ((void *) 0)) && (out == ((void *) 0)) && (qq == ((void *) 0))
3413
+ && (ip == ((void *) 0)))
3415
+ for (i = j = 0; (i < eoObsNR); i++)
3417
+ if (tcr->bObsUsed[i])
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,
3444
+ )): __strdup (eoNames[i])));
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,
3469
+ )): __strdup (buf)));
3474
+ for (i = 0; (i < tcr->nLJ); i++)
3476
+ if (tcr->tcLJ[i].bPrint)
3478
+ xvgr_legend (out[i], (sizeof (leg) / sizeof ((leg)[0])),
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)
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;
3500
+ pr_ff (tcr, t, idef, cr, nfile, fnm);
3502
+ for (i = 0; (i < eoObsNR); 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];
3510
+ pr_dev (tcr, t, prdev, cr, nfile, fnm);
3511
+ for (i = 0; (i < atnr2); i++)
3513
+ factor = dt * deviation[tip->eObs];
3517
+ if (fabs (tip->xi.harmonic.krA) > 1.2e-38)
3518
+ idef->iparams[type].harmonic.krA *=
3519
+ (1 + factor / tip->xi.harmonic.krA);
3523
--- a/src/gcc/testsuite/gcc.target/powerpc/atomic-p7.c
3524
+++ b/src/gcc/testsuite/gcc.target/powerpc/atomic-p7.c
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" } } */
3549
+/* Test for the byte atomic operations on power8 using lbarx/stbcx. */
3551
+char_fetch_add_relaxed (char *ptr, int value)
3553
+ return __atomic_fetch_add (ptr, value, __ATOMIC_RELAXED);
3557
+char_fetch_sub_consume (char *ptr, int value)
3559
+ return __atomic_fetch_sub (ptr, value, __ATOMIC_CONSUME);
3563
+char_fetch_and_acquire (char *ptr, int value)
3565
+ return __atomic_fetch_and (ptr, value, __ATOMIC_ACQUIRE);
3569
+char_fetch_ior_release (char *ptr, int value)
3571
+ return __atomic_fetch_or (ptr, value, __ATOMIC_RELEASE);
3575
+char_fetch_xor_acq_rel (char *ptr, int value)
3577
+ return __atomic_fetch_xor (ptr, value, __ATOMIC_ACQ_REL);
3581
+char_fetch_nand_seq_cst (char *ptr, int value)
3583
+ return __atomic_fetch_nand (ptr, value, __ATOMIC_SEQ_CST);
3586
+/* Test for the half word atomic operations on power8 using lharx/sthcx. */
3588
+short_fetch_add_relaxed (short *ptr, int value)
3590
+ return __atomic_fetch_add (ptr, value, __ATOMIC_RELAXED);
3594
+short_fetch_sub_consume (short *ptr, int value)
3596
+ return __atomic_fetch_sub (ptr, value, __ATOMIC_CONSUME);
3600
+short_fetch_and_acquire (short *ptr, int value)
3602
+ return __atomic_fetch_and (ptr, value, __ATOMIC_ACQUIRE);
3606
+short_fetch_ior_release (short *ptr, int value)
3608
+ return __atomic_fetch_or (ptr, value, __ATOMIC_RELEASE);
3612
+short_fetch_xor_acq_rel (short *ptr, int value)
3614
+ return __atomic_fetch_xor (ptr, value, __ATOMIC_ACQ_REL);
3618
+short_fetch_nand_seq_cst (short *ptr, int value)
3620
+ return __atomic_fetch_nand (ptr, value, __ATOMIC_SEQ_CST);
3623
+/* Test for the word atomic operations on power8 using lwarx/stwcx. */
3625
+int_fetch_add_relaxed (int *ptr, int value)
3627
+ return __atomic_fetch_add (ptr, value, __ATOMIC_RELAXED);
3631
+int_fetch_sub_consume (int *ptr, int value)
3633
+ return __atomic_fetch_sub (ptr, value, __ATOMIC_CONSUME);
3637
+int_fetch_and_acquire (int *ptr, int value)
3639
+ return __atomic_fetch_and (ptr, value, __ATOMIC_ACQUIRE);
3643
+int_fetch_ior_release (int *ptr, int value)
3645
+ return __atomic_fetch_or (ptr, value, __ATOMIC_RELEASE);
3649
+int_fetch_xor_acq_rel (int *ptr, int value)
3651
+ return __atomic_fetch_xor (ptr, value, __ATOMIC_ACQ_REL);
3655
+int_fetch_nand_seq_cst (int *ptr, int value)
3657
+ return __atomic_fetch_nand (ptr, value, __ATOMIC_SEQ_CST);
3660
+/* Test for the double word atomic operations on power8 using ldarx/stdcx. */
3662
+long_fetch_add_relaxed (long *ptr, long value)
3664
+ return __atomic_fetch_add (ptr, value, __ATOMIC_RELAXED);
3668
+long_fetch_sub_consume (long *ptr, long value)
3670
+ return __atomic_fetch_sub (ptr, value, __ATOMIC_CONSUME);
3674
+long_fetch_and_acquire (long *ptr, long value)
3676
+ return __atomic_fetch_and (ptr, value, __ATOMIC_ACQUIRE);
3680
+long_fetch_ior_release (long *ptr, long value)
3682
+ return __atomic_fetch_or (ptr, value, __ATOMIC_RELEASE);
3686
+long_fetch_xor_acq_rel (long *ptr, long value)
3688
+ return __atomic_fetch_xor (ptr, value, __ATOMIC_ACQ_REL);
3692
+long_fetch_nand_seq_cst (long *ptr, long value)
3694
+ return __atomic_fetch_nand (ptr, value, __ATOMIC_SEQ_CST);
3697
+/* Test for the quad word atomic operations on power8 using ldarx/stdcx. */
3699
+quad_fetch_add_relaxed (__int128_t *ptr, __int128_t value)
3701
+ return __atomic_fetch_add (ptr, value, __ATOMIC_RELAXED);
3705
+quad_fetch_sub_consume (__int128_t *ptr, __int128_t value)
3707
+ return __atomic_fetch_sub (ptr, value, __ATOMIC_CONSUME);
3711
+quad_fetch_and_acquire (__int128_t *ptr, __int128_t value)
3713
+ return __atomic_fetch_and (ptr, value, __ATOMIC_ACQUIRE);
3717
+quad_fetch_ior_release (__int128_t *ptr, __int128_t value)
3719
+ return __atomic_fetch_or (ptr, value, __ATOMIC_RELEASE);
3723
+quad_fetch_xor_acq_rel (__int128_t *ptr, __int128_t value)
3725
+ return __atomic_fetch_xor (ptr, value, __ATOMIC_ACQ_REL);
3729
+quad_fetch_nand_seq_cst (__int128_t *ptr, __int128_t value)
3731
+ return __atomic_fetch_nand (ptr, value, __ATOMIC_SEQ_CST);
3733
--- a/src/gcc/testsuite/gcc.target/powerpc/recip-3.c
3734
+++ b/src/gcc/testsuite/gcc.target/powerpc/recip-3.c
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 } } */
3756
--- a/src/gcc/testsuite/gcc.target/powerpc/no-r11-2.c
3757
+++ b/src/gcc/testsuite/gcc.target/powerpc/no-r11-2.c
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" } */
3765
--- a/src/gcc/testsuite/gcc.target/powerpc/p8vector-ldst.c
3766
+++ b/src/gcc/testsuite/gcc.target/powerpc/p8vector-ldst.c
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" } */
3773
+float load_sf (float *p)
3776
+ __asm__ ("# reg %x0" : "+v" (f));
3780
+double load_df (double *p)
3783
+ __asm__ ("# reg %x0" : "+v" (d));
3787
+double load_dfsf (float *p)
3789
+ double d = (double) *p;
3790
+ __asm__ ("# reg %x0" : "+v" (d));
3794
+void store_sf (float *p, float f)
3796
+ __asm__ ("# reg %x0" : "+v" (f));
3800
+void store_df (double *p, double d)
3802
+ __asm__ ("# reg %x0" : "+v" (d));
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
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 " } } */
3841
+#define TYPE __int128_t
3843
+typedef int v4si __attribute__ ((vector_size (16)));
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
3852
+/* This checks the availability of the XL compiler intrinsics for
3853
+ transactional execution with the expected prototypes. */
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" } */
3860
+#include <htmxlintrin.h>
3863
+foo (void *TM_buff, long *result, unsigned char *code)
3865
+ *result++ = __TM_simple_begin ();
3866
+ *result++ = __TM_begin (TM_buff);
3867
+ *result++ = __TM_end ();
3869
+ __TM_named_abort (*code);
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);
3884
--- a/src/gcc/testsuite/gcc.target/powerpc/p8vector-builtin-4.c
3885
+++ b/src/gcc/testsuite/gcc.target/powerpc/p8vector-builtin-4.c
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" } */
3892
+#include <altivec.h>
3894
+typedef vector long long vll_sign;
3895
+typedef vector unsigned long long vll_uns;
3896
+typedef vector bool long long vll_bool;
3898
+typedef vector int vi_sign;
3899
+typedef vector unsigned int vi_uns;
3900
+typedef vector bool int vi_bool;
3902
+typedef vector short vs_sign;
3903
+typedef vector unsigned short vs_uns;
3904
+typedef vector bool short vs_bool;
3906
+typedef vector signed char vc_sign;
3907
+typedef vector unsigned char vc_uns;
3908
+typedef vector bool char vc_bool;
3910
+vll_sign vll_clz_1 (vll_sign a)
3912
+ return __builtin_altivec_vclzd (a);
3915
+vll_sign vll_clz_2 (vll_sign a)
3917
+ return vec_vclz (a);
3920
+vll_sign vll_clz_3 (vll_sign a)
3922
+ return vec_vclzd (a);
3925
+vll_uns vll_clz_4 (vll_uns a)
3927
+ return vec_vclz (a);
3930
+vll_uns vll_clz_5 (vll_uns a)
3932
+ return vec_vclzd (a);
3935
+vi_sign vi_clz_1 (vi_sign a)
3937
+ return __builtin_altivec_vclzw (a);
3940
+vi_sign vi_clz_2 (vi_sign a)
3942
+ return vec_vclz (a);
3945
+vi_sign vi_clz_3 (vi_sign a)
3947
+ return vec_vclzw (a);
3950
+vi_uns vi_clz_4 (vi_uns a)
3952
+ return vec_vclz (a);
3955
+vi_uns vi_clz_5 (vi_uns a)
3957
+ return vec_vclzw (a);
3960
+vs_sign vs_clz_1 (vs_sign a)
3962
+ return __builtin_altivec_vclzh (a);
3965
+vs_sign vs_clz_2 (vs_sign a)
3967
+ return vec_vclz (a);
3970
+vs_sign vs_clz_3 (vs_sign a)
3972
+ return vec_vclzh (a);
3975
+vs_uns vs_clz_4 (vs_uns a)
3977
+ return vec_vclz (a);
3980
+vs_uns vs_clz_5 (vs_uns a)
3982
+ return vec_vclzh (a);
3985
+vc_sign vc_clz_1 (vc_sign a)
3987
+ return __builtin_altivec_vclzb (a);
3990
+vc_sign vc_clz_2 (vc_sign a)
3992
+ return vec_vclz (a);
3995
+vc_sign vc_clz_3 (vc_sign a)
3997
+ return vec_vclzb (a);
4000
+vc_uns vc_clz_4 (vc_uns a)
4002
+ return vec_vclz (a);
4005
+vc_uns vc_clz_5 (vc_uns a)
4007
+ return vec_vclzb (a);
4010
+vll_sign vll_popcnt_1 (vll_sign a)
4012
+ return __builtin_altivec_vpopcntd (a);
4015
+vll_sign vll_popcnt_2 (vll_sign a)
4017
+ return vec_vpopcnt (a);
4020
+vll_sign vll_popcnt_3 (vll_sign a)
4022
+ return vec_vpopcntd (a);
4025
+vll_uns vll_popcnt_4 (vll_uns a)
4027
+ return vec_vpopcnt (a);
4030
+vll_uns vll_popcnt_5 (vll_uns a)
4032
+ return vec_vpopcntd (a);
4035
+vi_sign vi_popcnt_1 (vi_sign a)
4037
+ return __builtin_altivec_vpopcntw (a);
4040
+vi_sign vi_popcnt_2 (vi_sign a)
4042
+ return vec_vpopcnt (a);
4045
+vi_sign vi_popcnt_3 (vi_sign a)
4047
+ return vec_vpopcntw (a);
4050
+vi_uns vi_popcnt_4 (vi_uns a)
4052
+ return vec_vpopcnt (a);
4055
+vi_uns vi_popcnt_5 (vi_uns a)
4057
+ return vec_vpopcntw (a);
4060
+vs_sign vs_popcnt_1 (vs_sign a)
4062
+ return __builtin_altivec_vpopcnth (a);
4065
+vs_sign vs_popcnt_2 (vs_sign a)
4067
+ return vec_vpopcnt (a);
4070
+vs_sign vs_popcnt_3 (vs_sign a)
4072
+ return vec_vpopcnth (a);
4075
+vs_uns vs_popcnt_4 (vs_uns a)
4077
+ return vec_vpopcnt (a);
4080
+vs_uns vs_popcnt_5 (vs_uns a)
4082
+ return vec_vpopcnth (a);
4085
+vc_sign vc_popcnt_1 (vc_sign a)
4087
+ return __builtin_altivec_vpopcntb (a);
4090
+vc_sign vc_popcnt_2 (vc_sign a)
4092
+ return vec_vpopcnt (a);
4095
+vc_sign vc_popcnt_3 (vc_sign a)
4097
+ return vec_vpopcntb (a);
4100
+vc_uns vc_popcnt_4 (vc_uns a)
4102
+ return vec_vpopcnt (a);
4105
+vc_uns vc_popcnt_5 (vc_uns a)
4107
+ return vec_vpopcntb (a);
4110
+vc_uns vc_gbb_1 (vc_uns a)
4112
+ return __builtin_altivec_vgbbd (a);
4115
+vc_sign vc_gbb_2 (vc_sign a)
4117
+ return vec_vgbbd (a);
4120
+vc_uns vc_gbb_3 (vc_uns a)
4122
+ return vec_vgbbd (a);
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 } } */
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 } } */
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
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 " } } */
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. */
4168
+#define TYPE __int128_t
4170
+typedef int v4si __attribute__ ((vector_size (16)));
4176
--- a/src/gcc/testsuite/gcc.target/powerpc/p8vector-vectorize-4.c
4177
+++ b/src/gcc/testsuite/gcc.target/powerpc/p8vector-vectorize-4.c
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" } */
4192
+#define ALIGN_ATTR __attribute__((__aligned__(ALIGN)))
4194
+#define DO_BUILTIN(PREFIX, TYPE, CLZ, POPCNT) \
4195
+TYPE PREFIX ## _a[SIZE] ALIGN_ATTR; \
4196
+TYPE PREFIX ## _b[SIZE] ALIGN_ATTR; \
4199
+PREFIX ## _clz (void) \
4201
+ unsigned long i; \
4203
+ for (i = 0; i < SIZE; i++) \
4204
+ PREFIX ## _a[i] = CLZ (PREFIX ## _b[i]); \
4208
+PREFIX ## _popcnt (void) \
4210
+ unsigned long i; \
4212
+ for (i = 0; i < SIZE; i++) \
4213
+ PREFIX ## _a[i] = POPCNT (PREFIX ## _b[i]); \
4216
+#if !defined(DO_LONG_LONG) && !defined(DO_LONG) && !defined(DO_INT) && !defined(DO_SHORT) && !defined(DO_CHAR)
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)
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)
4232
+DO_BUILTIN (si, int, __builtin_clz, __builtin_popcount)
4233
+DO_BUILTIN (ui, unsigned int, __builtin_clz, __builtin_popcount)
4237
+DO_BUILTIN (ss, short, __builtin_clz, __builtin_popcount)
4238
+DO_BUILTIN (us, unsigned short, __builtin_clz, __builtin_popcount)
4242
+DO_BUILTIN (sc, signed char, __builtin_clz, __builtin_popcount)
4243
+DO_BUILTIN (uc, unsigned char, __builtin_clz, __builtin_popcount)
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
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" } */
4256
+/* Verify that vs is 16-byte aligned with -mcompat-align-parm. */
4258
+typedef float v4sf __attribute__ ((vector_size (16)));
4259
+struct s { long m; v4sf v; };
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) {
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
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" } } */
4297
+/* Test for the byte atomic operations on power8 using lbarx/stbcx. */
4299
+char_fetch_add_relaxed (char *ptr, int value)
4301
+ return __atomic_fetch_add (ptr, value, __ATOMIC_RELAXED);
4305
+char_fetch_sub_consume (char *ptr, int value)
4307
+ return __atomic_fetch_sub (ptr, value, __ATOMIC_CONSUME);
4311
+char_fetch_and_acquire (char *ptr, int value)
4313
+ return __atomic_fetch_and (ptr, value, __ATOMIC_ACQUIRE);
4317
+char_fetch_ior_release (char *ptr, int value)
4319
+ return __atomic_fetch_or (ptr, value, __ATOMIC_RELEASE);
4323
+char_fetch_xor_acq_rel (char *ptr, int value)
4325
+ return __atomic_fetch_xor (ptr, value, __ATOMIC_ACQ_REL);
4329
+char_fetch_nand_seq_cst (char *ptr, int value)
4331
+ return __atomic_fetch_nand (ptr, value, __ATOMIC_SEQ_CST);
4335
+char_val_compare_and_swap (char *p, int i, int j, char *q)
4337
+ *q = __sync_val_compare_and_swap (p, i, j);
4340
+/* Test for the half word atomic operations on power8 using lharx/sthcx. */
4342
+short_fetch_add_relaxed (short *ptr, int value)
4344
+ return __atomic_fetch_add (ptr, value, __ATOMIC_RELAXED);
4348
+short_fetch_sub_consume (short *ptr, int value)
4350
+ return __atomic_fetch_sub (ptr, value, __ATOMIC_CONSUME);
4354
+short_fetch_and_acquire (short *ptr, int value)
4356
+ return __atomic_fetch_and (ptr, value, __ATOMIC_ACQUIRE);
4360
+short_fetch_ior_release (short *ptr, int value)
4362
+ return __atomic_fetch_or (ptr, value, __ATOMIC_RELEASE);
4366
+short_fetch_xor_acq_rel (short *ptr, int value)
4368
+ return __atomic_fetch_xor (ptr, value, __ATOMIC_ACQ_REL);
4372
+short_fetch_nand_seq_cst (short *ptr, int value)
4374
+ return __atomic_fetch_nand (ptr, value, __ATOMIC_SEQ_CST);
4378
+short_val_compare_and_swap (short *p, int i, int j, short *q)
4380
+ *q = __sync_val_compare_and_swap (p, i, j);
4383
+/* Test for the word atomic operations on power8 using lwarx/stwcx. */
4385
+int_fetch_add_relaxed (int *ptr, int value)
4387
+ return __atomic_fetch_add (ptr, value, __ATOMIC_RELAXED);
4391
+int_fetch_sub_consume (int *ptr, int value)
4393
+ return __atomic_fetch_sub (ptr, value, __ATOMIC_CONSUME);
4397
+int_fetch_and_acquire (int *ptr, int value)
4399
+ return __atomic_fetch_and (ptr, value, __ATOMIC_ACQUIRE);
4403
+int_fetch_ior_release (int *ptr, int value)
4405
+ return __atomic_fetch_or (ptr, value, __ATOMIC_RELEASE);
4409
+int_fetch_xor_acq_rel (int *ptr, int value)
4411
+ return __atomic_fetch_xor (ptr, value, __ATOMIC_ACQ_REL);
4415
+int_fetch_nand_seq_cst (int *ptr, int value)
4417
+ return __atomic_fetch_nand (ptr, value, __ATOMIC_SEQ_CST);
4421
+int_val_compare_and_swap (int *p, int i, int j, int *q)
4423
+ *q = __sync_val_compare_and_swap (p, i, j);
4426
+/* Test for the double word atomic operations on power8 using ldarx/stdcx. */
4428
+long_fetch_add_relaxed (long *ptr, long value)
4430
+ return __atomic_fetch_add (ptr, value, __ATOMIC_RELAXED);
4434
+long_fetch_sub_consume (long *ptr, long value)
4436
+ return __atomic_fetch_sub (ptr, value, __ATOMIC_CONSUME);
4440
+long_fetch_and_acquire (long *ptr, long value)
4442
+ return __atomic_fetch_and (ptr, value, __ATOMIC_ACQUIRE);
4446
+long_fetch_ior_release (long *ptr, long value)
4448
+ return __atomic_fetch_or (ptr, value, __ATOMIC_RELEASE);
4452
+long_fetch_xor_acq_rel (long *ptr, long value)
4454
+ return __atomic_fetch_xor (ptr, value, __ATOMIC_ACQ_REL);
4458
+long_fetch_nand_seq_cst (long *ptr, long value)
4460
+ return __atomic_fetch_nand (ptr, value, __ATOMIC_SEQ_CST);
4464
+long_val_compare_and_swap (long *p, long i, long j, long *q)
4466
+ *q = __sync_val_compare_and_swap (p, i, j);
4469
+/* Test for the quad word atomic operations on power8 using ldarx/stdcx. */
4471
+quad_fetch_add_relaxed (__int128_t *ptr, __int128_t value)
4473
+ return __atomic_fetch_add (ptr, value, __ATOMIC_RELAXED);
4477
+quad_fetch_sub_consume (__int128_t *ptr, __int128_t value)
4479
+ return __atomic_fetch_sub (ptr, value, __ATOMIC_CONSUME);
4483
+quad_fetch_and_acquire (__int128_t *ptr, __int128_t value)
4485
+ return __atomic_fetch_and (ptr, value, __ATOMIC_ACQUIRE);
4489
+quad_fetch_ior_release (__int128_t *ptr, __int128_t value)
4491
+ return __atomic_fetch_or (ptr, value, __ATOMIC_RELEASE);
4495
+quad_fetch_xor_acq_rel (__int128_t *ptr, __int128_t value)
4497
+ return __atomic_fetch_xor (ptr, value, __ATOMIC_ACQ_REL);
4501
+quad_fetch_nand_seq_cst (__int128_t *ptr, __int128_t value)
4503
+ return __atomic_fetch_nand (ptr, value, __ATOMIC_SEQ_CST);
4507
+quad_val_compare_and_swap (__int128_t *p, __int128_t i, __int128_t j, __int128_t *q)
4509
+ *q = __sync_val_compare_and_swap (p, i, j);
4511
--- a/src/gcc/testsuite/gcc.target/powerpc/sd-pwr6.c
4512
+++ b/src/gcc/testsuite/gcc.target/powerpc/sd-pwr6.c
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 } } */
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. */
4529
+void inc_dec32 (void)
4531
+ a += (_Decimal32) 1.0;
4533
--- a/src/gcc/testsuite/gcc.target/powerpc/recip-4.c
4534
+++ b/src/gcc/testsuite/gcc.target/powerpc/recip-4.c
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 } } */
4546
--- a/src/gcc/testsuite/gcc.target/powerpc/no-r11-3.c
4547
+++ b/src/gcc/testsuite/gcc.target/powerpc/no-r11-3.c
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" } */
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
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" } */
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;
4569
+crypto_t crpyto1 (crypto_t a)
4571
+ return __builtin_crypto_vsbox (a);
4574
+crypto_t crypto2 (crypto_t a, crypto_t b)
4576
+ return __builtin_crypto_vcipher (a, b);
4579
+crypto_t crypto3 (crypto_t a, crypto_t b)
4581
+ return __builtin_crypto_vcipherlast (a, b);
4584
+crypto_t crypto4 (crypto_t a, crypto_t b)
4586
+ return __builtin_crypto_vncipher (a, b);
4589
+crypto_t crypto5 (crypto_t a, crypto_t b)
4591
+ return __builtin_crypto_vncipherlast (a, b);
4594
+v16qi_t crypto6a (v16qi_t a, v16qi_t b, v16qi_t c)
4596
+ return __builtin_crypto_vpermxor (a, b, c);
4599
+v8hi_t crypto6b (v8hi_t a, v8hi_t b, v8hi_t c)
4601
+ return __builtin_crypto_vpermxor (a, b, c);
4604
+v4si_t crypto6c (v4si_t a, v4si_t b, v4si_t c)
4606
+ return __builtin_crypto_vpermxor (a, b, c);
4609
+v2di_t crypto6d (v2di_t a, v2di_t b, v2di_t c)
4611
+ return __builtin_crypto_vpermxor (a, b, c);
4614
+v16qi_t crypto7a (v16qi_t a, v16qi_t b)
4616
+ return __builtin_crypto_vpmsumb (a, b);
4619
+v16qi_t crypto7b (v16qi_t a, v16qi_t b)
4621
+ return __builtin_crypto_vpmsum (a, b);
4624
+v8hi_t crypto7c (v8hi_t a, v8hi_t b)
4626
+ return __builtin_crypto_vpmsumh (a, b);
4629
+v8hi_t crypto7d (v8hi_t a, v8hi_t b)
4631
+ return __builtin_crypto_vpmsum (a, b);
4634
+v4si_t crypto7e (v4si_t a, v4si_t b)
4636
+ return __builtin_crypto_vpmsumw (a, b);
4639
+v4si_t crypto7f (v4si_t a, v4si_t b)
4641
+ return __builtin_crypto_vpmsum (a, b);
4644
+v2di_t crypto7g (v2di_t a, v2di_t b)
4646
+ return __builtin_crypto_vpmsumd (a, b);
4649
+v2di_t crypto7h (v2di_t a, v2di_t b)
4651
+ return __builtin_crypto_vpmsum (a, b);
4654
+v2di_t crypto8a (v2di_t a)
4656
+ return __builtin_crypto_vshasigmad (a, 0, 8);
4659
+v2di_t crypto8b (v2di_t a)
4661
+ return __builtin_crypto_vshasigma (a, 0, 8);
4664
+v4si_t crypto8c (v4si_t a)
4666
+ return __builtin_crypto_vshasigmaw (a, 1, 15);
4669
+v4si_t crypto8d (v4si_t a)
4671
+ return __builtin_crypto_vshasigma (a, 1, 15);
4674
+/* Note space is used after the instruction so that vcipherlast does not match
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
4692
double foo (double x) { return __builtin_sqrt (x); }
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
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" } */
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 } } */
4709
+func1 (_Decimal64 a, _Decimal64 b)
4715
+func2 (_Decimal64 a, _Decimal64 b)
4717
+ return __builtin_fabsd64 (b);
4721
+func3 (_Decimal64 a, _Decimal64 b)
4723
+ return - __builtin_fabsd64 (b);
4725
--- a/src/gcc/testsuite/gcc.target/powerpc/direct-move-float1.c
4726
+++ b/src/gcc/testsuite/gcc.target/powerpc/direct-move-float1.c
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" } } */
4738
+/* Check code generation for direct move for float types. */
4742
+#define NO_ALTIVEC 1
4743
+#define VSX_REG_ATTR "ww"
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
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" } */
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 } } */
4758
+/* These tests verify we only generate fneg, fabs and fnabs
4759
+ instructions and no fmr's since these are done in place. */
4762
+func1 (_Decimal128 a)
4768
+func2 (_Decimal128 a)
4770
+ return __builtin_fabsd128 (a);
4774
+func3 (_Decimal128 a)
4776
+ return - __builtin_fabsd128 (a);
4778
--- a/src/gcc/testsuite/gcc.target/powerpc/p8vector-builtin-5.c
4779
+++ b/src/gcc/testsuite/gcc.target/powerpc/p8vector-builtin-5.c
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" } */
4786
+#include <altivec.h>
4797
+#define ATTR_ALIGN __attribute__((__aligned__(ALIGN)))
4800
+#define DOIT(TYPE, PREFIX) \
4801
+TYPE PREFIX ## _eqv_builtin (TYPE a, TYPE b) \
4803
+ return vec_eqv (a, b); \
4806
+TYPE PREFIX ## _eqv_arith (TYPE a, TYPE b) \
4808
+ return ~(a ^ b); \
4811
+TYPE PREFIX ## _nand_builtin (TYPE a, TYPE b) \
4813
+ return vec_nand (a, b); \
4816
+TYPE PREFIX ## _nand_arith1 (TYPE a, TYPE b) \
4818
+ return ~(a & b); \
4821
+TYPE PREFIX ## _nand_arith2 (TYPE a, TYPE b) \
4823
+ return (~a) | (~b); \
4826
+TYPE PREFIX ## _orc_builtin (TYPE a, TYPE b) \
4828
+ return vec_orc (a, b); \
4831
+TYPE PREFIX ## _orc_arith1 (TYPE a, TYPE b) \
4833
+ return (~ a) | b; \
4836
+TYPE PREFIX ## _orc_arith2 (TYPE a, TYPE b) \
4838
+ return a | (~ b); \
4841
+#define DOIT_FLOAT(TYPE, PREFIX) \
4842
+TYPE PREFIX ## _eqv_builtin (TYPE a, TYPE b) \
4844
+ return vec_eqv (a, b); \
4847
+TYPE PREFIX ## _nand_builtin (TYPE a, TYPE b) \
4849
+ return vec_nand (a, b); \
4852
+TYPE PREFIX ## _orc_builtin (TYPE a, TYPE b) \
4854
+ return vec_orc (a, b); \
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;
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;
4867
+typedef vector float float_vec;
4868
+typedef vector double double_vec;
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)
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)
4880
+DOIT_FLOAT(float_vec, float)
4881
+DOIT_FLOAT(double_vec, double)
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
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" } */
4903
+#define ATTR_ALIGN __attribute__((__aligned__(ALIGN)))
4907
+#define TYPE unsigned int
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;
4923
+ for (i = 0; i < SIZE; i++)
4925
+ eqv[i] = ~(in1[i] ^ in2[i]);
4934
+ for (i = 0; i < SIZE; i++)
4936
+ nand1[i] = ~(in1[i] & in2[i]);
4945
+ for (i = 0; i < SIZE; i++)
4947
+ nand2[i] = (~in1[i]) | (~in2[i]);
4956
+ for (i = 0; i < SIZE; i++)
4958
+ orc1[i] = (~in1[i]) | in2[i];
4967
+ for (i = 0; i < SIZE; i++)
4969
+ orc1[i] = in1[i] | (~in2[i]);
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
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" } */
4984
+/* Verify that vs is not 16-byte aligned in the absence of -mno-compat-align-parm. */
4986
+typedef float v4sf __attribute__ ((vector_size (16)));
4987
+struct s { long m; v4sf v; };
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) {
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
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 } } */
5018
#include <altivec.h>
5020
--- a/src/gcc/testsuite/gcc.target/powerpc/ppc64-abi-1.c
5021
+++ b/src/gcc/testsuite/gcc.target/powerpc/ppc64-abi-1.c
5033
--- a/src/gcc/testsuite/gcc.target/powerpc/direct-move-float2.c
5034
+++ b/src/gcc/testsuite/gcc.target/powerpc/direct-move-float2.c
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" } */
5042
+/* Check whether we get the right bits for direct move at runtime. */
5046
+#define NO_ALTIVEC 1
5048
+#define VSX_REG_ATTR "ww"
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
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" } } */
5062
+/* Check code generation for direct move for double types. */
5064
+#define TYPE double
5066
+#define NO_ALTIVEC 1
5067
+#define VSX_REG_ATTR "ws"
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
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" } */
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 } } */
5082
+/* These tests verify we generate fneg, fabs and fnabs and
5083
+ associated fmr's since these are not done in place. */
5086
+func1 (_Decimal128 a, _Decimal128 b)
5092
+func2 (_Decimal128 a, _Decimal128 b)
5094
+ return __builtin_fabsd128 (b);
5098
+func3 (_Decimal128 a, _Decimal128 b)
5100
+ return - __builtin_fabsd128 (b);
5102
--- a/src/gcc/testsuite/gcc.target/powerpc/p8vector-builtin-6.c
5103
+++ b/src/gcc/testsuite/gcc.target/powerpc/p8vector-builtin-6.c
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" } */
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); }
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
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
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" } */
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 } } */
5152
+void use_builtins (long *p, char code, long *a, long *b)
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);
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);
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. */
5174
+ p[16] = __builtin_get_texasr ();
5175
+ p[17] = __builtin_get_texasru ();
5176
+ p[18] = __builtin_get_tfhar ();
5177
+ p[19] = __builtin_get_tfiar ();
5179
+ __builtin_set_texasr (a[20]);
5180
+ __builtin_set_texasru (a[21]);
5181
+ __builtin_set_tfhar (a[22]);
5182
+ __builtin_set_tfiar (a[23]);
5184
--- a/src/gcc/testsuite/gcc.target/powerpc/bool.c
5185
+++ b/src/gcc/testsuite/gcc.target/powerpc/bool.c
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" } } */
5194
+#define TYPE unsigned long
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 */
5201
--- a/src/gcc/testsuite/gcc.target/powerpc/bool2-p5.c
5202
+++ b/src/gcc/testsuite/gcc.target/powerpc/bool2-p5.c
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 " } } */
5231
+typedef int v4si __attribute__ ((vector_size (16)));
5236
--- a/src/gcc/testsuite/gcc.target/powerpc/fusion.c
5237
+++ b/src/gcc/testsuite/gcc.target/powerpc/fusion.c
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" } */
5245
+#define LARGE 0x12345
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]; }
5254
+vector double fusion_vector (vector double *p) { return p[2]; }
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 @@
5276
@@ -119,6 +121,12 @@
5280
+#ifdef __LITTLE_ENDIAN__
5281
+#define MAKE_SLOT(x, y) ((long)x | ((long)y << 32))
5283
+#define MAKE_SLOT(x, y) ((long)y | ((long)x << 32))
5286
/* Paramter passing.
5290
sp = __builtin_frame_address(0);
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))
5301
sp = __builtin_frame_address(0);
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))
5312
sp = __builtin_frame_address(0);
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))
5322
--- a/src/gcc/testsuite/gcc.target/powerpc/direct-move-long1.c
5323
+++ b/src/gcc/testsuite/gcc.target/powerpc/direct-move-long1.c
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" } } */
5333
+/* Check code generation for direct move for long types. */
5337
+#define NO_ALTIVEC 1
5338
+#define VSX_REG_ATTR "d"
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
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" } */
5350
+/* Check whether we get the right bits for direct move at runtime. */
5352
+#define TYPE double
5354
+#define NO_ALTIVEC 1
5356
+#define VSX_REG_ATTR "ws"
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
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" } */
5367
+#include <altivec.h>
5369
+typedef vector int v_sign;
5370
+typedef vector unsigned int v_uns;
5372
+v_sign even_sign (v_sign a, v_sign b)
5374
+ return vec_vmrgew (a, b);
5377
+v_uns even_uns (v_uns a, v_uns b)
5379
+ return vec_vmrgew (a, b);
5382
+v_sign odd_sign (v_sign a, v_sign b)
5384
+ return vec_vmrgow (a, b);
5387
+v_uns odd_uns (v_uns a, v_uns b)
5389
+ return vec_vmrgow (a, b);
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
5397
+/* Test various logical operations. */
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 */
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
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
5440
/* Wrapper to save the GPRs and FPRs and then jump to the real function. */
5442
+#define FUNC_START(NAME) \
5443
+ "\t.globl\t" NAME "\n\t" \
5444
+ ".section \".opd\",\"aw\"\n\t" \
5447
+ ".quad .L." NAME ",.TOC.@tocbase,0\n\t" \
5449
+ ".type " NAME ", @function\n" \
5450
+ ".L." NAME ":\n\t"
5452
+#define FUNC_START(NAME) \
5453
+ "\t.globl\t" NAME "\n\t" \
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"
5460
#define WRAPPER(NAME) \
5461
-__asm__ ("\t.globl\t" #NAME "_asm\n\t" \
5462
- ".section \".opd\",\"aw\"\n\t" \
5464
- #NAME "_asm:\n\t" \
5465
- ".quad .L." #NAME "_asm,.TOC.@tocbase,0\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" \
5481
unsigned long slot[100];
5484
--- a/src/gcc/testsuite/gcc.target/powerpc/direct-move-long2.c
5485
+++ b/src/gcc/testsuite/gcc.target/powerpc/direct-move-long2.c
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" } */
5493
+/* Check whether we get the right bits for direct move at runtime. */
5497
+#define NO_ALTIVEC 1
5499
+#define VSX_REG_ATTR "d"
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
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" } } */
5511
+/* Test that we generate xxlor to clear a SFmode register. */
5513
+float sum (float *p, unsigned long n)
5515
+ float sum = 0.0f; /* generate xxlxor instead of load */
5521
--- a/src/gcc/testsuite/gcc.target/powerpc/ppc-target-1.c
5522
+++ b/src/gcc/testsuite/gcc.target/powerpc/ppc-target-1.c
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 } } */
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
5536
+/* Test forcing 128-bit logical types into GPR registers. */
5538
+#if defined(NO_ASM)
5539
+#define FORCE_REG1(X)
5540
+#define FORCE_REG2(X,Y)
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"
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"
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"
5559
+#define REG_CLASS "+r"
5560
+#define PRINT_REG1 "# gpr reg %0"
5561
+#define PRINT_REG2 "# gpr reg %0, %1"
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))
5568
+void ptr1 (TYPE *p)
5574
+ FORCE_REG2 (a, b);
5575
+ c = a & b; /* AND */
5580
+void ptr2 (TYPE *p)
5586
+ FORCE_REG2 (a, b);
5587
+ c = a | b; /* OR */
5592
+void ptr3 (TYPE *p)
5598
+ FORCE_REG2 (a, b);
5599
+ c = a ^ b; /* XOR */
5604
+void ptr4 (TYPE *p)
5615
+void ptr5 (TYPE *p)
5621
+ FORCE_REG2 (a, b);
5622
+ c = ~(a & b); /* NAND */
5627
+void ptr6 (TYPE *p)
5633
+ FORCE_REG2 (a, b);
5634
+ c = ~(a | b); /* AND */
5639
+void ptr7 (TYPE *p)
5645
+ FORCE_REG2 (a, b);
5646
+ c = ~(a ^ b); /* EQV */
5651
+void ptr8 (TYPE *p)
5657
+ FORCE_REG2 (a, b);
5658
+ c = (~a) & b; /* ANDC */
5663
+void ptr9 (TYPE *p)
5669
+ FORCE_REG2 (a, b);
5670
+ c = (~a) | b; /* ORC */
5675
+void ptr10 (TYPE *p)
5681
+ FORCE_REG2 (a, b);
5682
+ c = (~a) ^ b; /* EQV */
5687
+void ptr11 (TYPE *p)
5693
+ FORCE_REG2 (a, b);
5694
+ c = a & (~b); /* ANDC */
5699
+void ptr12 (TYPE *p)
5705
+ FORCE_REG2 (a, b);
5706
+ c = a | (~b); /* ORC */
5711
+void ptr13 (TYPE *p)
5717
+ FORCE_REG2 (a, b);
5718
+ c = a ^ (~b); /* AND */
5722
--- a/src/gcc/testsuite/gcc.target/powerpc/altivec-perm-1.c
5723
+++ b/src/gcc/testsuite/gcc.target/powerpc/altivec-perm-1.c
5725
return __builtin_shuffle(x, (V){ 4,5,6,7, 4,5,6,7, 4,5,6,7, 4,5,6,7, });
5730
- return __builtin_shuffle(x, y,
5731
- (V){ 1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29, 31 });
5737
- return __builtin_shuffle(x, y,
5738
- (V){ 2, 3, 6, 7, 10, 11, 14, 15, 18, 19, 22, 23, 26, 27, 30, 31 });
5743
return __builtin_shuffle(x, y,
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
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 " } } */
5779
+typedef int v4si __attribute__ ((vector_size (16)));
5784
--- a/src/gcc/testsuite/ChangeLog.ibm
5785
+++ b/src/gcc/testsuite/ChangeLog.ibm
5787
+2013-11-22 Michael Meissner <meissner@linux.vnet.ibm.com>
5789
+ Backport from mainline
5790
+ 2013-11-22 Michael Meissner <meissner@linux.vnet.ibm.com>
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.
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.
5814
+ * gcc.target/powerpc/p8vector-ldst.c: Just check that the
5815
+ appropriate instructions are generated, don't check the count.
5817
+ 2013-11-12 Michael Meissner <meissner@linux.vnet.ibm.com>
5820
+ * gcc.target/powerpc/pr59054.c: New test.
5822
+2013-11-20 Bill Schmidt <wschmidt@linux.vnet.ibm.com>
5824
+ Backport from mainline r205146
5825
+ 2013-11-20 Bill Schmidt <wschmidt@linux.vnet.ibm.com>
5827
+ * gcc.target/powerpc/pr48258-1.c: Skip for little endian.
5829
+2013-11-20 Ulrich Weigand <Ulrich.Weigand@de.ibm.com>
5831
+ Backport from mainline r205106:
5833
+ 2013-11-20 Ulrich Weigand <Ulrich.Weigand@de.ibm.com>
5835
+ * gcc.target/powerpc/darwin-longlong.c (msw): Make endian-safe.
5837
+2013-11-19 Ulrich Weigand <Ulrich.Weigand@de.ibm.com>
5839
+ Backport from mainline r205046:
5841
+ 2013-11-19 Ulrich Weigand <Ulrich.Weigand@de.ibm.com>
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.
5847
+2013-11-15 Bill Schmidt <wschmidt@linux.vnet.ibm.com>
5849
+ Backport from mainline r204862
5850
+ 2013-11-15 Bill Schmidt <wschmidt@linux.vnet.ibm.com>
5852
+ * gcc.dg/vmx/3b-15.c: Revise for little endian.
5854
+2013-11-15 Ulrich Weigand <Ulrich.Weigand@de.ibm.com>
5856
+ Backport from mainline r204808:
5858
+ 2013-11-14 Ulrich Weigand <Ulrich.Weigand@de.ibm.com>
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.
5866
+ 2013-11-14 Ulrich Weigand <Ulrich.Weigand@de.ibm.com>
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.
5874
+ 2013-11-14 Ulrich Weigand <Ulrich.Weigand@de.ibm.com>
5876
+ * lib/target-supports.exp (check_effective_target_powerpc_elfv2):
5878
+ * gcc.target/powerpc/pr57949-1.c: Disable for powerpc_elfv2.
5879
+ * gcc.target/powerpc/pr57949-2.c: Likewise.
5881
+2013-11-15 Ulrich Weigand <Ulrich.Weigand@de.ibm.com>
5883
+ Backport from mainline r204799:
5885
+ 2013-11-14 Ulrich Weigand <Ulrich.Weigand@de.ibm.com>
5887
+ * g++.dg/eh/ppc64-sighandle-cr.C: New test.
5889
+2013-11-15 Ulrich Weigand <Ulrich.Weigand@de.ibm.com>
5891
+ Backport from mainline r201750.
5892
+ Note: Default setting of -mcompat-align-parm inverted!
5894
+ 2013-08-14 Bill Schmidt <wschmidt@linux.vnet.ibm.com>
5897
+ * gcc.target/powerpc/pr57949-1.c: New.
5898
+ * gcc.target/powerpc/pr57949-2.c: New.
5900
+2013-11-15 Ulrich Weigand <Ulrich.Weigand@de.ibm.com>
5902
+ Backport from mainline r201040 and r201929:
5904
+ 2013-08-22 Michael Meissner <meissner@linux.vnet.ibm.com>
5906
+ * gcc.target/powerpc/pr57744.c: Declare abort.
5908
+ 2013-07-18 Pat Haugen <pthaugen@us.ibm.com>
5910
+ * gcc.target/powerpc/pr57744.c: Fix typo.
5912
+2013-11-10 Bill Schmidt <wschmidt@linux.vnet.ibm.com>
5914
+ Backport from mainline r204321
5915
+ 2013-11-02 Bill Schmidt <wschmidt@vnet.linux.ibm.com>
5917
+ * gcc.dg/vmx/vec-set.c: New.
5919
+2013-11-10 Bill Schmidt <wschmidt@linux.vnet.ibm.com>
5921
+ Backport from mainline r204138
5922
+ 2013-10-28 Bill Schmidt <wschmidt@linux.vnet.ibm.com>
5924
+ * gcc.dg/vmx/gcc-bug-i.c: Add little endian variant.
5925
+ * gcc.dg/vmx/eg-5.c: Likewise.
5927
+2013-11-08 Bill Schmidt <wschmidt@linux.vnet.ibm.com>
5929
+ Backport from mainline r203930
5930
+ 2013-10-22 Bill Schmidt <wschmidt@vnet.ibm.com>
5932
+ * gcc.target/powerpc/altivec-perm-1.c: Move the two vector pack
5934
+ * gcc.target/powerpc/altivec-perm-3.c: ...this new test, which is
5935
+ restricted to big-endian targets.
5937
+2013-11-08 Bill Schmidt <wschmidt@linux.vnet.ibm.com>
5939
+ Backport from mainline r203246
5940
+ 2013-10-07 Bill Schmidt <wschmidt@linux.vnet.ibm.com>
5942
+ * gcc.target/powerpc/pr43154.c: Skip for ppc64 little endian.
5943
+ * gcc.target/powerpc/fusion.c: Likewise.
5945
+2013-10-21 Bill Schmidt <wschmidt@linux.vnet.ibm.com>
5947
+ Backport from mainline
5948
+ 2013-04-05 Bill Schmidt <wschmidt@linux.vnet.ibm.com>
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.
5956
+2013-10-17 Michael Meissner <meissner@linux.vnet.ibm.com>
5958
+ Back port from mainline
5959
+ 2013-10-03 Michael Meissner <meissner@linux.vnet.ibm.com>
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
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.
5972
+ Back port from mainline
5973
+ 2013-09-27 Michael Meissner <meissner@linux.vnet.ibm.com>
5975
+ * gcc.target/powerpc/p8vector-ldst.c: New test for -mupper-regs-sf
5976
+ and -mupper-regs-df.
5978
+ Back port from mainline
5979
+ 2013-10-17 Michael Meissner <meissner@linux.vnet.ibm.com>
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.
5986
+2013-08-19 Peter Bergner <bergner@vnet.ibm.com>
5988
+ Back port from mainline
5989
+ 2013-08-19 Peter Bergner <bergner@vnet.ibm.com>
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.
5995
+2013-08-16 Michael Meissner <meissner@linux.vnet.ibm.com>
5997
+ Backport from trunk.
5998
+ 2013-07-23 Michael Meissner <meissner@linux.vnet.ibm.com>
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.
6011
+2013-08-16 Michael Meissner <meissner@linux.vnet.ibm.com>
6013
+ Backport from trunk.
6014
+ 2013-07-31 Michael Meissner <meissner@linux.vnet.ibm.com>
6016
+ * gcc.target/powerpc/fusion.c: New file, test power8 fusion support.
6018
+2013-08-05 Michael Meissner <meissner@linux.vnet.ibm.com>
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>
6025
+ * lib/target-supports.exp (check_p8vector_hw_available) Add power8
6027
+ (check_effective_target_powerpc_p8vector_ok): Likewise.
6028
+ (is-effective-target): Likewise.
6029
+ (check_vect_support_and_set_flags): Likewise.
6031
+2013-08-04 Peter Bergner <bergner@vnet.ibm.com>
6033
+ Back port from mainline
6034
+ 2013-08-01 Fabien Chêne <fabien@gcc.gnu.org>
6035
+ Peter Bergner <bergner@vnet.ibm.com>
6038
+ * g++.dg/overload/using3.C: New.
6039
+ * g++.dg/overload/using2.C: Adjust.
6040
+ * g++.dg/lookup/using9.C: Likewise.
6042
+2013-07-31 Michael Meissner <meissner@linux.vnet.ibm.com>
6044
+ Back port from mainline
6045
+ 2013-07-31 Michael Meissner <meissner@linux.vnet.ibm.com>
6047
+ * gcc.target/powerpc/fusion.c: New file, test power8 fusion
6050
+2013-07-15 Peter Bergner <bergner@vnet.ibm.com>
6052
+ Back port from mainline
6053
+ 2013-07-15 Peter Bergner <bergner@vnet.ibm.com>
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.
6060
+2013-06-28 Michael Meissner <meissner@linux.vnet.ibm.com>
6062
+ Back port from the trunk
6063
+ 2013-06-28 Michael Meissner <meissner@linux.vnet.ibm.com>
6066
+ * gcc.target/powerpc/pr57744.c: New test to make sure lqarx and
6067
+ stqcx. get even registers.
6069
+2013-06-12 Michael Meissner <meissner@linux.vnet.ibm.com>
6071
+ Back port from the trunk
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>
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.
6081
+2013-06-11 Michael Meissner <meissner@linux.vnet.ibm.com>
6083
+ Back port from the trunk
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>
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.
6093
+ Back port from the trunk
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>
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.
6110
+2013-06-06 Michael Meissner <meissner@linux.vnet.ibm.com>
6112
+ Backport from the trunk
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>
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.
6133
+ * gcc.target/powerpc/crypto-builtin-1.c: Use effective target
6134
+ powerpc_p8vector_ok instead of powerpc_vsx_ok.
6136
+ * gcc.target/powerpc/bool.c: New file, add eqv, nand, nor tests.
6138
+ * lib/target-supports.exp (check_p8vector_hw_available) Add power8
6140
+ (check_effective_target_powerpc_p8vector_ok): Likewise.
6141
+ (is-effective-target): Likewise.
6142
+ (check_vect_support_and_set_flags): Likewise.
6144
+2013-06-06 Peter Bergner <bergner@vnet.ibm.com>
6146
+ Backport from trunk
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>
6152
+ * gcc.target/powerpc/crypto-builtin-1.c: New file, test for power8
6155
+2013-05-06 Michael Meissner <meissner@linux.vnet.ibm.com>
6157
+ Backport from trunk
6158
+ 2013-05-03 Michael Meissner <meissner@linux.vnet.ibm.com>
6161
+ * gcc.target/powerpc/pr57150.c: New file.
6163
+2013-03-20 Michael Meissner <meissner@linux.vnet.ibm.com>
6165
+ Backport from mainline
6166
+ 2013-03-20 Michael Meissner <meissner@linux.vnet.ibm.com>
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.
6173
+2013-03-20 Michael Meissner <meissner@linux.vnet.ibm.com>
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 @@
6182
+# Return 1 if the target supports executing power8 vector instructions, 0
6183
+# otherwise. Cache the result.
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*]} {
6192
+ set options "-mpower8-vector"
6193
+ check_runtime_nocache p8vector_hw_available {
6197
+ asm volatile ("xxlorc vs0,vs0,vs0");
6199
+ asm volatile ("xxlorc 0,0,0");
6208
# Return 1 if the target supports executing VSX instructions, 0
6209
# otherwise. Cache the result.
6211
@@ -2672,6 +2698,33 @@
6215
+# Return 1 if this is a PowerPC target supporting -mpower8-vector
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*] } {
6227
+ return [check_no_compiler_messages powerpc_p8vector_ok object {
6230
+ asm volatile ("xxlorc vs0,vs0,vs0");
6232
+ asm volatile ("xxlorc 0,0,0");
6236
+ } "-mpower8-vector"]
6242
# Return 1 if this is a PowerPC target supporting -mvsx
6244
proc check_effective_target_powerpc_vsx_ok { } {
6245
@@ -2699,6 +2752,27 @@
6249
+# Return 1 if this is a PowerPC target supporting -mhtm
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*] } {
6259
+ return [check_no_compiler_messages powerpc_htm_ok object {
6261
+ asm volatile ("tbegin. 0");
6270
# Return 1 if this is a PowerPC target supporting -mcpu=cell.
6272
proc check_effective_target_powerpc_ppu_ok { } {
6273
@@ -2794,6 +2868,22 @@
6277
+# Return 1 if this is a PowerPC target using the ELFv2 ABI.
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
6293
# Return 1 if this is a SPU target with a toolchain that
6294
# supports automatic overlay generation.
6296
@@ -4499,6 +4589,7 @@
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 @@
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 @@
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"
6323
--- a/src/gcc/testsuite/gcc.dg/vmx/3b-15.c
6324
+++ b/src/gcc/testsuite/gcc.dg/vmx/3b-15.c
6326
vector unsigned char
6327
f (vector unsigned char a, vector unsigned char b, vector unsigned char c)
6329
+#ifdef __BIG_ENDIAN__
6330
return vec_perm(a,b,c);
6332
+ return vec_perm(b,a,c);
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})),
6345
+ ((vector unsigned char){0x1e,0xb,0x7,0xf,0x9,0xa,0x6,0x5,
6346
+ 0x3,0x3,0x3,0xd,0x17,0x2,0x4,0x11})),
6348
((vector unsigned char){1,74,78,70,76,75,79,80,82,82,82,72,8,83,81,14})),
6351
--- a/src/gcc/testsuite/gcc.dg/vmx/vec-set.c
6352
+++ b/src/gcc/testsuite/gcc.dg/vmx/vec-set.c
6354
+#include "harness.h"
6359
+ return (vector short){m, 0, 0, 0, 0, 0, 0, 0};
6364
+ check (vec_all_eq (vec_set (7),
6365
+ ((vector short){7, 0, 0, 0, 0, 0, 0, 0})),
6368
--- a/src/gcc/testsuite/gcc.dg/vmx/gcc-bug-i.c
6369
+++ b/src/gcc/testsuite/gcc.dg/vmx/gcc-bug-i.c
6371
#define DO_INLINE __attribute__ ((always_inline))
6372
#define DONT_INLINE __attribute__ ((noinline))
6374
+#ifdef __LITTLE_ENDIAN__
6375
+static inline DO_INLINE int inline_me(vector signed short data)
6377
+ union {vector signed short v; signed short s[8];} u;
6379
+ unsigned char x1, x2;
6383
+ x1 = (x >> 8) & 0xff;
6385
+ return ((x2 << 8) | x1);
6388
static inline DO_INLINE int inline_me(vector signed short data)
6390
union {vector signed short v; signed short s[8];} u;
6396
static DONT_INLINE int foo(vector signed short data)
6398
--- a/src/gcc/testsuite/gcc.dg/vmx/eg-5.c
6399
+++ b/src/gcc/testsuite/gcc.dg/vmx/eg-5.c
6401
/* Set result to a vector of f32 0's */
6402
vector float result = ((vector float){0.,0.,0.,0.});
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);
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);
6418
--- a/src/gcc/testsuite/gcc.dg/stack-usage-1.c
6419
+++ b/src/gcc/testsuite/gcc.dg/stack-usage-1.c
6422
#elif defined (__powerpc64__) || defined (__ppc64__) || defined (__POWERPC64__) \
6423
|| defined (__PPC64__)
6425
+# if _CALL_ELF == 2
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
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" }
6446
- using B::f; // { dg-error "already declared" }
6447
+ using B::f; // { dg-error "previous declaration" }
6449
--- a/src/gcc/testsuite/g++.dg/eh/ppc64-sighandle-cr.C
6450
+++ b/src/gcc/testsuite/g++.dg/eh/ppc64-sighandle-cr.C
6452
+// { dg-do run { target { powerpc64*-*-linux* } } }
6453
+// { dg-options "-fexceptions -fnon-call-exceptions" }
6455
+#include <signal.h>
6456
+#include <stdlib.h>
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; })
6462
+void sighandler (int signo, siginfo_t * si, void * uc)
6471
+float test (float a, float b) __attribute__ ((__noinline__));
6472
+float test (float a, float b)
6475
+ asm ("mtcrf %1,%2" : "=f" (x) : "n" (1 << (7-3)), "r" (0), "0" (b) : "cr3");
6481
+ struct sigaction sa;
6484
+ sa.sa_sigaction = sighandler;
6485
+ sa.sa_flags = SA_SIGINFO;
6487
+ status = sigaction (SIGFPE, & sa, NULL);
6489
+ feenableexcept (FE_DIVBYZERO);
6499
+ return GET_CR(2) != 6 || GET_CR(3) != 9 || GET_CR(4) != 12;
6506
--- a/src/gcc/testsuite/g++.dg/overload/using3.C
6507
+++ b/src/gcc/testsuite/g++.dg/overload/using3.C
6509
+// { dg-do compile }
6518
+ void f(int); // { dg-message "previous" }
6523
+ using a::f; // { dg-error "conflicts" }
6525
--- a/src/gcc/testsuite/g++.dg/overload/using2.C
6526
+++ b/src/gcc/testsuite/g++.dg/overload/using2.C
6528
extern "C" void exit (int) throw ();
6529
extern "C" void *malloc (__SIZE_TYPE__) throw () __attribute__((malloc));
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 }
6537
// { dg-message "void C1" "C1" { target *-*-* } 53 }
6539
extern "C" void c2 (void) throw ();
6540
- void C2 (void) throw ();
6541
+ void C2 (void) throw (); // { dg-message "previous" }
6543
int C3 (int) throw ();
6546
-using std::abort; // { dg-error "already declared" }
6547
+using std::abort; // { dg-error "conflicts" }
6549
-using std::C2; // { dg-error "already declared" }
6550
+using std::C2; // { dg-error "conflicts" }
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
6557
+2013-08-04 Peter Bergner <bergner@vnet.ibm.com>
6559
+ Back port from mainline
6560
+ 2013-08-01 Fabien Chêne <fabien@gcc.gnu.org>
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
6568
--- a/src/gcc/cp/cp-tree.h
6569
+++ b/src/gcc/cp/cp-tree.h
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",
6587
+ diagnose_name_conflict (decl, fn);
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. */
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 @@
6604
- error ("%qD is already declared in this scope", name);
6605
+ diagnose_name_conflict (new_fn, old_fn);
6609
--- a/src/gcc/builtins.def
6610
+++ b/src/gcc/builtins.def
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
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 *);
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 @@
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);
6644
@@ -3485,11 +3486,7 @@
6645
/* Adjust function incoming argument size for alignment and
6648
-#ifdef REG_PARM_STACK_SPACE
6649
- crtl->args.size = MAX (crtl->args.size,
6650
- REG_PARM_STACK_SPACE (fndecl));
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);
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.
6661
+ REG_PARM_STACK_SPACE is the number of bytes of stack space reserved
6662
+ for arguments which are passed in registers.
6664
FNDECL is the function in which the argument was defined.
6666
There are two types of rounding that are done. The first, controlled by
6667
@@ -3713,19 +3713,16 @@
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)
6678
enum direction where_pad;
6679
unsigned int boundary, round_boundary;
6680
- int reg_parm_stack_space = 0;
6681
int part_size_in_regs;
6683
-#ifdef REG_PARM_STACK_SPACE
6684
- reg_parm_stack_space = REG_PARM_STACK_SPACE (fndecl);
6686
/* If we have found a stack parm before we reach the end of the
6687
area reserved for registers, skip that area. */
6689
@@ -3743,7 +3740,6 @@
6690
initial_offset_ptr->constant = reg_parm_stack_space;
6693
-#endif /* REG_PARM_STACK_SPACE */
6695
part_size_in_regs = (reg_parm_stack_space == 0 ? partial : 0);
6697
@@ -3806,11 +3802,7 @@
6699
locate->slot_offset.constant += part_size_in_regs;
6702
-#ifdef REG_PARM_STACK_SPACE
6703
- || REG_PARM_STACK_SPACE (fndecl) > 0
6706
+ if (!in_regs || reg_parm_stack_space > 0)
6707
pad_to_arg_alignment (&locate->slot_offset, boundary,
6708
&locate->alignment_pad);
6710
@@ -3830,11 +3822,7 @@
6711
pad_below (&locate->offset, passed_mode, sizetree);
6713
#else /* !ARGS_GROW_DOWNWARD */
6715
-#ifdef REG_PARM_STACK_SPACE
6716
- || REG_PARM_STACK_SPACE (fndecl) > 0
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
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)))
6730
emit_move_insn (gen_rtx_REG (GET_MODE (decl_rtl),
6731
--- a/src/gcc/ChangeLog.ibm
6732
+++ b/src/gcc/ChangeLog.ibm
6734
+2013-11-24 Bill Schmidt <wschmidt@linux.vnet.ibm.com>
6736
+ Backport from mainline r205333
6737
+ 2013-11-24 Bill Schmidt <wschmidt@linux.vnet.ibm.com>
6739
+ * config/rs6000/rs6000.c (rs6000_expand_vec_perm_const_1): Correct
6740
+ for little endian.
6742
+2013-11-23 Alan Modra <amodra@gmail.com>
6744
+ Apply mainline r205299.
6745
+ * config/rs6000/vsx.md (fusion peepholes): Disable when !TARGET_VSX.
6747
+2013-11-22 Michael Meissner <meissner@linux.vnet.ibm.com>
6749
+ Backport from mainline
6750
+ 2013-11-12 Michael Meissner <meissner@linux.vnet.ibm.com>
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
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.
6762
+2013-11-21 Bill Schmidt <wschmidt@linux.vnet.ibm.com>
6764
+ Backport from mainline r205241
6765
+ 2013-11-21 Bill Schmidt <wschmidt@vnet.ibm.com>
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.
6774
+2013-11-21 Peter Bergner <bergner@vnet.ibm.com>
6776
+ Backport from mainline r205233.
6777
+ 2013-11-21 Peter Bergner <bergner@vnet.ibm.com>
6779
+ * doc/extend.texi: Document htm builtins.
6781
+2013-11-20 Bill Schmidt <wschmidt@linux.vnet.ibm.com>
6783
+ Backport from mainline r205146
6784
+ 2013-11-20 Bill Schmidt <wschmidt@linux.vnet.ibm.com>
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.
6792
+2013-11-20 Ulrich Weigand <Ulrich.Weigand@de.ibm.com>
6794
+ Backport from mainline r205123:
6796
+ 2013-11-20 Ulrich Weigand <Ulrich.Weigand@de.ibm.com>
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.
6803
+2013-11-19 Bill Schmidt <wschmidt@linux.vnet.ibm.com>
6805
+ Backport from mainline r205080
6806
+ 2013-11-19 Bill Schmidt <wschmidt@linux.vnet.ibm.com>
6808
+ * config/rs6000/rs6000.c (altivec_expand_vec_perm_const): Adjust
6809
+ V16QI vector splat case for little endian.
6811
+2013-11-20 Alan Modra <amodra@gmail.com>
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
6820
+2013-11-19 Ulrich Weigand <Ulrich.Weigand@de.ibm.com>
6822
+ Backport from mainline r205045:
6824
+ 2013-11-19 Ulrich Weigand <Ulrich.Weigand@de.ibm.com>
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.
6831
+2013-11-18 Peter Bergner <bergner@vnet.ibm.com>
6833
+ Merge up to 204974.
6834
+ * REVISION: Update subversion id.
6836
+2013-11-17 Ulrich Weigand <Ulrich.Weigand@de.ibm.com>
6838
+ Backport from mainline r204927:
6840
+ 2013-11-17 Ulrich Weigand <Ulrich.Weigand@de.ibm.com>
6842
+ * config/rs6000/rs6000.c (rs6000_emit_move): Use low word of
6843
+ sdmode_stack_slot also in little-endian mode.
6845
+2013-11-17 Bill Schmidt <wschmidt@linux.vnet.ibm.com>
6847
+ Backport from mainline r204920
6848
+ 2011-11-17 Bill Schmidt <wschmidt@linux.vnet.ibm.com>
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
6854
+ (rs6000_emit_prologue): Likewise, but for little endian VSX
6855
+ stores, pass the source register of the store instead.
6857
+2013-11-15 Bill Schmidt <wschmidt@linux.vnet.ibm.com>
6859
+ Backport from mainline r204862
6860
+ 2013-11-15 Bill Schmidt <wschmidt@linux.vnet.ibm.com>
6862
+ * config/rs6000/altivec.md (UNSPEC_VPERM_X, UNSPEC_VPERM_UNS_X):
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
6871
+2013-11-15 Ulrich Weigand <Ulrich.Weigand@de.ibm.com>
6873
+ Backport from mainline r204842:
6875
+ 2013-11-15 Ulrich Weigand <Ulrich.Weigand@de.ibm.com>
6877
+ * doc/invoke.texi (-mabi=elfv1, -mabi=elfv2): Document.
6879
+2013-11-15 Ulrich Weigand <Ulrich.Weigand@de.ibm.com>
6881
+ Backport from mainline r204809:
6883
+ 2013-11-14 Ulrich Weigand <Ulrich.Weigand@de.ibm.com>
6885
+ * config/rs6000/sysv4le.h (LINUX64_DEFAULT_ABI_ELFv2): Define.
6887
+2013-11-15 Ulrich Weigand <Ulrich.Weigand@de.ibm.com>
6889
+ Backport from mainline r204808:
6891
+ 2013-11-14 Ulrich Weigand <Ulrich.Weigand@de.ibm.com>
6892
+ Alan Modra <amodra@gmail.com>
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.
6906
+ 2013-11-14 Ulrich Weigand <Ulrich.Weigand@de.ibm.com>
6907
+ Alan Modra <amodra@gmail.com>
6909
+ * config/rs6000/rs6000-protos.h (rs6000_reg_parm_stack_space):
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.
6919
+ 2013-11-14 Ulrich Weigand <Ulrich.Weigand@de.ibm.com>
6920
+ Michael Gschwind <mkg@us.ibm.com>
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.
6931
+ 2013-11-14 Ulrich Weigand <Ulrich.Weigand@de.ibm.com>
6932
+ Michael Gschwind <mkg@us.ibm.com>
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.
6943
+ 2013-11-14 Ulrich Weigand <Ulrich.Weigand@de.ibm.com>
6944
+ Michael Gschwind <mkg@us.ibm.com>
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.
6955
+ 2013-11-14 Ulrich Weigand <Ulrich.Weigand@de.ibm.com>
6957
+ * config/rs6000/rs6000.c (machine_function): New member
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.
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.
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
6980
+ (rs6000_call_aix): Handle ELFv2 indirect calls. Do not check
6981
+ for function descriptors in ABI_ELFv2.
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.
6989
+ * config/rs6000/predicates.md ("symbol_ref_operand"): Do not
6990
+ check for function descriptors in ABI_ELFv2.
6991
+ ("current_file_function_operand"): Likewise.
6993
+ * config/rs6000/ppc-asm.h [__powerpc64__ && _CALL_ELF == 2]:
6995
+ (FUNC_NAME): Define ELFv2 variant.
6996
+ (JUMP_TARGET): Likewise.
6997
+ (FUNC_START): Likewise.
6998
+ (HIDDEN_FUNC): Likewise.
6999
+ (FUNC_END): Likeiwse.
7001
+ 2013-11-14 Ulrich Weigand <Ulrich.Weigand@de.ibm.com>
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.
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.
7074
+2013-11-15 Ulrich Weigand <Ulrich.Weigand@de.ibm.com>
7076
+ Backport from mainline r204807:
7078
+ 2013-11-14 Ulrich Weigand <Ulrich.Weigand@de.ibm.com>
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.
7085
+2013-11-15 Ulrich Weigand <Ulrich.Weigand@de.ibm.com>
7087
+ Backport from mainline r204806:
7089
+ 2013-11-14 Ulrich Weigand <Ulrich.Weigand@de.ibm.com>
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.
7097
+2013-11-15 Ulrich Weigand <Ulrich.Weigand@de.ibm.com>
7099
+ Backport from mainline r204805:
7101
+ 2013-11-14 Ulrich Weigand <Ulrich.Weigand@de.ibm.com>
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.
7111
+2013-11-15 Ulrich Weigand <Ulrich.Weigand@de.ibm.com>
7113
+ Backport from mainline r204804:
7115
+ 2013-11-14 Ulrich Weigand <Ulrich.Weigand@de.ibm.com>
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
7142
+ (SUBTARGET_OVERRIDE_OPTIONS): Likewise.
7143
+ (MINIMAL_TOC_SECTION_ASM_OP): Likewise.
7145
+2013-11-15 Ulrich Weigand <Ulrich.Weigand@de.ibm.com>
7147
+ Backport from mainline r204803:
7149
+ 2013-11-14 Ulrich Weigand <Ulrich.Weigand@de.ibm.com>
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.
7186
+2013-11-15 Ulrich Weigand <Ulrich.Weigand@de.ibm.com>
7188
+ Backport from mainline r204799:
7190
+ 2013-11-14 Ulrich Weigand <Ulrich.Weigand@de.ibm.com>
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.
7200
+2013-11-15 Ulrich Weigand <Ulrich.Weigand@de.ibm.com>
7202
+ Backport from mainline r204798:
7204
+ 2013-11-14 Ulrich Weigand <Ulrich.Weigand@de.ibm.com>
7205
+ Alan Modra <amodra@gmail.com>
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.
7216
+2013-11-15 Ulrich Weigand <Ulrich.Weigand@de.ibm.com>
7218
+ Backport from mainline r204797:
7220
+ 2013-11-14 Ulrich Weigand <Ulrich.Weigand@de.ibm.com>
7222
+ * calls.c (store_unaligned_arguments_into_pseudos): Skip PARALLEL
7225
+2013-11-15 Ulrich Weigand <Ulrich.Weigand@de.ibm.com>
7227
+ Backport from mainline r197003:
7229
+ 2013-03-23 Eric Botcazou <ebotcazou@adacore.com>
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.
7235
+2013-11-15 Ulrich Weigand <Ulrich.Weigand@de.ibm.com>
7237
+ Backport from mainline r201750.
7238
+ Note: Default setting of -mcompat-align-parm inverted!
7240
+ 2013-08-14 Bill Schmidt <wschmidt@linux.vnet.ibm.com>
7243
+ * doc/invoke.texi: Add documentation of mcompat-align-parm
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
7253
+2013-11-12 Bill Schmidt <wschmidt@linux.vnet.ibm.com>
7255
+ * configure: Regenerate.
7257
+2013-11-10 Bill Schmidt <wschmidt@linux.vnet.ibm.com>
7259
+ Backport from mainline r204441
7260
+ 2013-11-05 Bill Schmidt <wschmidt@linux.vnet.ibm.com>
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.
7266
+2013-11-10 Bill Schmidt <wschmidt@linux.vnet.ibm.com>
7268
+ Backport from mainline r204440
7269
+ 2013-11-05 Bill Schmidt <wschmidt@linux.vnet.ibm.com>
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.
7276
+2013-11-10 Bill Schmidt <wschmidt@linux.vnet.ibm.com>
7278
+ Backport from mainline r204439
7279
+ 2013-11-05 Bill Schmidt <wschmidt@linux.vnet.ibm.com>
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.
7300
+2013-11-10 Bill Schmidt <wschmidt@linux.vnet.ibm.com>
7302
+ Backport from mainline r204395
7303
+ 2013-11-05 Bill Schmidt <wschmidt@linux.vnet.ibm.com>
7305
+ * config/rs6000/vector.md (vec_pack_sfix_trunc_v2df): Adjust for
7307
+ (vec_pack_ufix_trunc_v2df): Likewise.
7309
+2013-11-10 Bill Schmidt <wschmidt@linux.vnet.ibm.com>
7311
+ Backport from mainline r204363
7312
+ 2013-11-04 Bill Schmidt <wschmidt@linux.vnet.ibm.com>
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.
7324
+2013-11-10 Bill Schmidt <wschmidt@linux.vnet.ibm.com>
7326
+ Backport from mainline r204350
7327
+ 2013-11-04 Bill Schmidt <wschmidt@linux.vnet.ibm.com>
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.
7337
+2013-11-10 Bill Schmidt <wschmidt@linux.vnet.ibm.com>
7339
+ Backport from mainline r204321
7340
+ 2013-11-04 Bill Schmidt <wschmidt@linux.vnet.ibm.com>
7342
+ * config/rs6000/vector.md (vec_pack_trunc_v2df): Adjust for
7345
+2013-11-10 Bill Schmidt <wschmidt@linux.vnet.ibm.com>
7347
+ Backport from mainline r204321
7348
+ 2013-11-02 Bill Schmidt <wschmidt@vnet.linux.ibm.com>
7350
+ * config/rs6000/rs6000.c (rs6000_expand_vector_set): Adjust for
7353
+2013-11-10 Bill Schmidt <wschmidt@linux.vnet.ibm.com>
7355
+ Backport from mainline r203980
7356
+ 2013-10-23 Bill Schmidt <wschmidt@linux.vnet.ibm.com>
7358
+ * config/rs6000/altivec.md (mulv8hi3): Adjust for little endian.
7360
+2013-11-08 Bill Schmidt <wschmidt@linux.vnet.ibm.com>
7362
+ Backport from mainline r203930
7363
+ 2013-10-22 Bill Schmidt <wschmidt@vnet.ibm.com>
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.
7369
+2013-11-08 Bill Schmidt <wschmidt@linux.vnet.ibm.com>
7371
+ Backport from mainline r203877
7372
+ 2013-10-20 Bill Schmidt <wschmidt@linux.vnet.ibm.com>
7374
+ * config/rs6000/altivec.md (vec_unpacku_hi_v16qi): Adjust for
7376
+ (vec_unpacku_hi_v8hi): Likewise.
7377
+ (vec_unpacku_lo_v16qi): Likewise.
7378
+ (vec_unpacku_lo_v8hi): Likewise.
7380
+2013-11-08 Bill Schmidt <wschmidt@linux.vnet.ibm.com>
7382
+ Backport from mainline r203863
7383
+ 2013-10-19 Bill Schmidt <wschmidt@linux.vnet.ibm.com>
7385
+ * config/rs6000/rs6000.c (vspltis_constant): Make sure we check
7386
+ all elements for both endian flavors.
7388
+2013-11-08 Bill Schmidt <wschmidt@linux.vnet.ibm.com>
7390
+ Backport from mainline r203714
7391
+ 2013-10-16 Bill Schmidt <wschmidt@linux.vnet.ibm.com>
7393
+ * gcc/config/rs6000/vector.md (vec_unpacks_hi_v4sf): Correct for
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.
7401
+2013-11-08 Bill Schmidt <wschmidt@linux.vnet.ibm.com>
7403
+ Backport from mainline r203713
7404
+ 2013-10-16 Bill Schmidt <wschmidt@linux.vnet.ibm.com>
7406
+ * config/rs6000/vsx.md (vsx_concat_<mode>): Adjust output for LE.
7407
+ (vsx_concat_v2sf): Likewise.
7409
+2013-11-08 Bill Schmidt <wschmidt@linux.vnet.ibm.com>
7411
+ Backport from mainline r203458
7412
+ 2013-10-11 Bill Schmidt <wschmidt@linux.vnet.ibm.com>
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.
7420
+2013-11-08 Bill Schmidt <wschmidt@linux.vnet.ibm.com>
7422
+ Backport from mainline r203457
7423
+ 2013-10-11 Bill Schmidt <wschmidt@linux.vnet.ibm.com>
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
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.
7440
+2013-11-08 Bill Schmidt <wschmidt@linux.vnet.ibm.com>
7442
+ Backport from mainline r203247
7443
+ 2013-10-07 Bill Schmidt <wschmidt@linux.vnet.ibm.com>
7445
+ * config/rs6000/rs6000.c (altivec_expand_vec_perm_const_le): New.
7446
+ (altivec_expand_vec_perm_const): Call it.
7448
+2013-11-08 Bill Schmidt <wschmidt@linux.vnet.ibm.com>
7450
+ Backport from mainline r203246
7451
+ 2013-10-07 Bill Schmidt <wschmidt@linux.vnet.ibm.com>
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
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.
7483
+2013-11-08 Bill Schmidt <wschmidt@linux.vnet.ibm.com>
7485
+ Backport from mainline r201235
7486
+ 2013-07-24 Bill Schmidt <wschmidt@linux.ibm.com>
7487
+ Anton Blanchard <anton@au1.ibm.com>
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.
7495
+2013-11-08 Bill Schmidt <wschmidt@linux.vnet.ibm.com>
7497
+ Backport from mainline r201208
7498
+ 2013-07-24 Bill Schmidt <wschmidt@vnet.linux.ibm.com>
7499
+ Anton Blanchard <anton@au1.ibm.com>
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.
7506
+2013-11-08 Bill Schmidt <wschmidt@linux.vnet.ibm.com>
7508
+ Backport from mainline r201195
7509
+ 2013-07-23 Bill Schmidt <wschmidt@linux.vnet.ibm.com>
7510
+ Anton Blanchard <anton@au1.ibm.com>
7512
+ * config/rs6000/rs6000.c (altivec_expand_vec_perm_const): Reverse
7513
+ two operands for little-endian.
7515
+2013-11-08 Bill Schmidt <wschmidt@linux.vnet.ibm.com>
7517
+ Backport from mainline r201193
7518
+ 2013-07-23 Bill Schmidt <wschmidt@linux.vnet.ibm.com>
7519
+ Anton Blanchard <anton@au1.ibm.com>
7521
+ * config/rs6000/rs6000.c (altivec_expand_vec_perm_const): Correct
7522
+ selection of field for vector splat in little endian mode.
7524
+2013-11-08 Bill Schmidt <wschmidt@linux.vnet.ibm.com>
7526
+ Backport from mainline r201149
7527
+ 2013-07-22 Bill Schmidt <wschmidt@vnet.linux.ibm.com>
7528
+ Anton Blanchard <anton@au1.ibm.com>
7530
+ * config/rs6000/rs6000.c (rs6000_expand_vector_init): Fix
7531
+ endianness when selecting field to splat.
7533
+2013-10-21 Bill Schmidt <wschmidt@linux.vnet.ibm.com>
7535
+ Backport from mainline
7536
+ 2013-04-05 Bill Schmidt <wschmidt@linux.vnet.ibm.com>
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.
7546
+2013-10-17 Michael Meissner <meissner@linux.vnet.ibm.com>
7548
+ Backport from mainline
7549
+ 2013-10-17 Michael Meissner <meissner@linux.vnet.ibm.com>
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.
7584
+ Backport from mainline
7585
+ 2013-10-03 Michael Meissner <meissner@linux.vnet.ibm.com>
7587
+ * config/rs6000/rs6000-builtin.def (XSRDPIM): Use floatdf2,
7588
+ ceildf2, btruncdf2, instead of vsx_* name.
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.
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.
7630
+ * config/rs6000/rs6000.c (Ftrad): New mode attributes to allow
7631
+ combining of SF/DF mode operations, using both traditional and VSX
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.
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.
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.
7718
+ Backport from mainline
7719
+ 2013-09-27 Michael Meissner <meissner@linux.vnet.ibm.com>
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.
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.
7739
+ Backport from mainline
7740
+ 2013-09-23 Michael Meissner <meissner@linux.vnet.ibm.com>
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.
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.
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.
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.
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
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.
7797
+ Backport from mainline
7798
+ 2013-10-17 Michael Meissner <meissner@linux.vnet.ibm.com>
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
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.
7813
+2013-10-02 Michael Meissner <meissner@linux.vnet.ibm.com>
7815
+ Backport from mainline
7816
+ 2013-10-02 Michael Meissner <meissner@linux.vnet.ibm.com>
7819
+ * config/rs6000/rs6000-cpus.def (ISA_2_6_MASKS_SERVER): Turn off
7820
+ setting -mvsx-timode by default until the underlying problem is
7822
+ (RS6000_CPU, power7 defaults): Likewise.
7824
+2013-08-19 Peter Bergner <bergner@vnet.ibm.com>
7826
+ Backport from mainline
7827
+ 2013-08-19 Peter Bergner <bergner@vnet.ibm.com>
7828
+ Jakub Jelinek <jakub@redhat.com>
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.
7845
+2013-08-16 Michael Meissner <meissner@linux.vnet.ibm.com>
7847
+ Backport from trunk
7848
+ 2013-08-16 Michael Meissner <meissner@linux.vnet.ibm.com>
7851
+ * config/rs6000/predicates.md (fusion_gpr_mem_load): Allow the
7852
+ memory rtx to contain ZERO_EXTEND and SIGN_EXTEND.
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.
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
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.
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
7879
+ Backport from trunk
7880
+ 2013-07-23 Michael Meissner <meissner@linux.vnet.ibm.com>
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.
7893
+ * config/rs6000/rs6000-protos.h (rs6000_split_logical): New
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.
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.
7922
+ * config/rs6000/rs6000.h (VLOGICAL_REGNO_P): Always allow vector
7923
+ logical types in GPRs.
7925
+ * config/rs6000/altivec.md (altivec_and<mode>3): Move 128-bit
7926
+ logical insns to rs6000.md, and allow TImode operations in
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.
7934
+ * config/rs6000/rs6000.md (BOOL_128): New mode iterators and mode
7935
+ attributes for moving the 128-bit logical operations into
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.
7970
+2013-07-31 Michael Meissner <meissner@linux.vnet.ibm.com>
7972
+ Backport from mainline
7973
+ 2013-07-31 Michael Meissner <meissner@linux.vnet.ibm.com>
7975
+ * config/rs6000/predicates.md (fusion_gpr_addis): New predicates
7976
+ to support power8 load fusion.
7977
+ (fusion_gpr_mem_load): Likewise.
7979
+ * config/rs6000/rs6000-modes.def (PTImode): Update a comment.
7981
+ * config/rs6000/rs6000-protos.h (fusion_gpr_load_p): New
7982
+ declarations for power8 load fusion.
7983
+ (emit_fusion_gpr_load): Likewise.
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
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
7994
+ * config/rs6000/vsx.md (VSX_M2): New iterator for fusion
7996
+ (VSX load fusion peepholes): New peepholes to fuse together an
7997
+ addi instruction with a VSX load instruction.
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
8005
+2013-07-19 Pat Haugen <pthaugen@us.ibm.com>
8007
+ Backport from mainline
8008
+ 2013-07-18 Pat Haugen <pthaugen@us.ibm.com>
8010
+ * config/rs6000/rs6000.c (rs6000_option_override_internal): Adjust flag
8011
+ interaction for new Power8 flags and VSX.
8013
+2013-07-17 Peter Bergner <bergner@vnet.ibm.com>
8015
+ Backport from mainline
8016
+ 2013-07-17 Iain Sandoe <iain@codesourcery.com>
8018
+ * config/rs6000/darwin.h (REGISTER_NAMES): Add HTM registers.
8020
+2013-07-16 Peter Bergner <bergner@vnet.ibm.com>
8022
+ Merge up to 200989.
8023
+ * REVISION: Update subversion id.
8025
+2013-07-16 Peter Bergner <bergner@vnet.ibm.com>
8027
+ Backport from mainline
8028
+ 2013-07-16 Peter Bergner <bergner@vnet.ibm.com>
8030
+ * config/rs6000/rs6000.c (rs6000_option_override_internal): Do not
8031
+ enable extra ISA flags with TARGET_HTM.
8033
+ 2013-07-16 Jakub Jelinek <jakub@redhat.com>
8034
+ Peter Bergner <bergner@vnet.ibm.com>
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.
8042
+2013-07-15 Peter Bergner <bergner@vnet.ibm.com>
8044
+ Backport from mainline
8045
+ 2013-07-15 Peter Bergner <bergner@vnet.ibm.com>
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.
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.
8095
+2013-06-28 Michael Meissner <meissner@linux.vnet.ibm.com>
8097
+ Back port from the trunk
8098
+ 2013-06-28 Michael Meissner <meissner@linux.vnet.ibm.com>
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.
8107
+2013-06-28 Pat Haugen <pthaugen@us.ibm.com>
8109
+ * config/rs6000/rs6000.md (define_insn ""): Fix insn type.
8111
+2013-06-26 Pat Haugen <pthaugen@us.ibm.com>
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>
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
8126
+ (force_new_group): Adjust comment.
8127
+ * config/rs6000/rs6000.md: Include power8.md.
8129
+2013-06-14 Michael Meissner <meissner@linux.vnet.ibm.com>
8131
+ Back port from the trunk
8132
+ 2013-06-14 Michael Meissner <meissner@linux.vnet.ibm.com>
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.
8139
+2013-06-13 Michael Meissner <meissner@linux.vnet.ibm.com>
8141
+ Back port from the trunk
8142
+ 2013-06-13 Michael Meissner <meissner@linux.vnet.ibm.com>
8144
+ * config/rs6000/rs6000.c (rs6000_option_override_internal): Move
8145
+ test for clearing quad memory on 32-bit later.
8147
+2013-06-12 Michael Meissner <meissner@linux.vnet.ibm.com>
8149
+ Back port from the trunk
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>
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.
8162
+ * config/rs6000/sync.md (larx): Add new modes for power8.
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
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
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.
8188
+ * config/rs6000/rs6000.md (QHI): New mode iterator for power8
8189
+ atomic load/store instructions.
8192
+2013-06-11 Michael Meissner <meissner@linux.vnet.ibm.com>
8194
+ Back port from the trunk
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>
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.
8206
+ * config/rs6000/sync.md (larx): Add new modes for power8.
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
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
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.
8232
+ * config/rs6000/rs6000.md (QHI): New mode iterator for power8
8233
+ atomic load/store instructions.
8237
+ * config/rs6000/driver-rs6000.c (elf_platform): Make buffer static
8238
+ to allow returning address to AT_PLATFORM name.
8240
+ Back port from the trunk
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>
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
8250
+ * config/rs6000/rs6000-protos.h (rs6000_output_move_128bit): Add
8252
+ (direct_move_p): Likewise.
8253
+ (quad_load_store_p): Likewise.
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.
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.
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
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
8343
+2013-06-06 Michael Meissner <meissner@linux.vnet.ibm.com>
8345
+ Backport from the trunk
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>
8351
+ * doc/extend.texi (PowerPC AltiVec/VSX Built-in Functions):
8352
+ Document new power8 builtins.
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.
8365
+ * config/rs6000/predicates.md (int_reg_operand): Rework tests so
8366
+ that only the GPRs are recognized.
8368
+ * config/rs6000/rs6000-c.c (altivec_overloaded_builtins): Add
8369
+ support for new power8 builtins.
8371
+ * config/rs6000/rs6000-builtin.def (xscvspdpn): Add new power8
8372
+ builtin functions.
8373
+ (xscvdpspn): 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.
8388
+ (eqv_v16qi3): Likewise.
8389
+ (eqv_v8hi3): Likewise.
8390
+ (eqv_v4si3): Likewise.
8391
+ (eqv_v2di3): Likewise.
8392
+ (eqv_v4sf3): Likewise.
8393
+ (eqv_v2df3): 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.
8402
+ (orc_v16qi3): Likewise.
8403
+ (orc_v8hi3): Likewise.
8404
+ (orc_v4si3): Likewise.
8405
+ (orc_v2di3): Likewise.
8406
+ (orc_v4sf3): Likewise.
8407
+ (orc_v2df3): Likewise.
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
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
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
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.
8461
+ * config/rs6000/rs6000.h (VLOGICAL_REGNO_P): Update comment.
8463
+ * config/rs6000/altivec.md (UNSPEC_VGBBD): Add power8 vgbbd
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
8474
+ * config/rs6000/rs6000.md (eqv<mode>3): Add support for powerp eqv
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.
8494
+2013-06-06 Peter Bergner <bergner@vnet.ibm.com>
8496
+ Merge up to 199753.
8497
+ * REVISION: Update subversion id.
8499
+2013-06-06 Peter Bergner <bergner@vnet.ibm.com>
8501
+ Backport from trunk
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>
8507
+ * config/rs6000/vector.md (VEC_I): Add support for new power8 V2DI
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.
8516
+ * config/rs6000/rs6000-c.c (altivec_overloaded_builtins): Add
8517
+ support for power8 V2DI builtins.
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.
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.
8556
+ (vsrad): Likewise.
8558
+ (vsubudm): Likewise.
8560
+ * config/rs6000/rs6000.c (rs6000_init_hard_regno_mode_ok): Add
8561
+ support for power8 V2DI instructions.
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.
8585
+ (VI_char): Likewise.
8586
+ (VI_scalar): Likewise.
8587
+ (VI_unit): 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.
8646
+ * config/rs6000/altivec.h (vec_vaddudm): Add defines for power8
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.
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>
8668
+ * doc/extend.texi (PowerPC AltiVec/VSX Built-in Functions): Add
8669
+ documentation for the power8 crypto builtins.
8671
+ * config/rs6000/t-rs6000 (MD_INCLUDES): Add crypto.md.
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.
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
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.
8714
+ * config/rs6000/crypto.md: New file, define power8 crypto
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>
8721
+ * doc/invoke.texi (Option Summary): Add power8 options.
8722
+ (RS/6000 and PowerPC Options): Likewise.
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.
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.
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.
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
8756
+ * gcc/config/rs6000/rs6000-c.c (rs6000_target_modify_macros):
8757
+ Define _ARCH_PWR8 and __POWER8_VECTOR__ for power8.
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.
8767
+ * gcc/config/rs6000/rs6000.c (power8_cost): Initial definition for
8769
+ (rs6000_hard_regno_mode_ok): Make PTImode only match even GPR
8771
+ (rs6000_debug_reg_print): Print the base register class if
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.
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
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.
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.
8824
+2013-05-06 Michael Meissner <meissner@linux.vnet.ibm.com>
8826
+ Merge up to 198656.
8827
+ * REVISION: Update subversion id.
8829
+ Backport from trunk
8830
+ 2013-05-03 Michael Meissner <meissner@linux.vnet.ibm.com>
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
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.
8843
+2013-04-09 Michael Meissner <meissner@linux.vnet.ibm.com>
8845
+ Merge up to 197642.
8846
+ * REVISION: Update subversion id.
8848
+2013-03-20 Michael Meissner <meissner@linux.vnet.ibm.com>
8850
+ Backport from mainline
8851
+ 2013-03-20 Pat Haugen <pthaugen@us.ibm.com>
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
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.
8883
+ Backport from mainline
8884
+ 2013-03-20 Michael Meissner <meissner@linux.vnet.ibm.com>
8886
+ * config/rs6000/vector.md (VEC_R): Add 32-bit integer, binary
8887
+ floating point, and decimal floating point to reload iterator.
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.
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
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
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.
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.
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
8919
+ (movsd splitter): Likewise.
8920
+ (movsd_hardfloat): Likewise.
8921
+ (movsd_softfloat): Likewise.
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
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
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.
8946
+ * doc/md.texi (PowerPC and IBM RS6000 constraints): Document wl,
8947
+ wx and wz constraints.
8949
+ * config/rs6000/constraints.md (wg constraint): New constraint to
8950
+ return FLOAT_REGS if -mmfpgpr (power6x) was used.
8952
+ * config/rs6000/rs6000.h (enum r6000_reg_class_enum): Add wg
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
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
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.
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.
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.
9002
+ * doc/md.texi (PowerPC and IBM RS6000 constraints): Document wg
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.
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.
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.
9022
+ * config/rs6000/rs6000.md (movdi_mfpgpr): Delete, combine with
9023
+ movdi_internal64, using wg constraint for move direct operations.
9024
+ (movdi_internal64): Likewise.
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
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.
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.
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
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.
9062
+ * config/rs6000/constraints.md (wt constraint): New constraint
9063
+ that returns VSX_REGS if TImode is allowed in VSX registers.
9065
+ * config/rs6000/predicates.md (easy_fp_constant): 0.0f is an easy
9066
+ constant under VSX.
9068
+ * config/rs6000/rs6000-modes.def (PTImode): Define, PTImode is
9069
+ similar to TImode, but it is restricted to being in the GPRs.
9071
+ * config/rs6000/rs6000.opt (-mvsx-timode): New switch to allow
9072
+ TImode to occupy a single VSX register.
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.
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
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
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.
9119
+ * config/rs6000/vsx.md (VSm): Change to use 64-bit aligned moves
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.
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.
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
9150
+ (mov<mode>_string, TImode/PTImode): Likewise.
9151
+ (movti_ppc64): Likewise.
9152
+ (mov<mode>_ppc64, TImode/PTImode): Likewise.
9153
+ (TI mode splitters): Likewise.
9155
+ * doc/md.texi (PowerPC and IBM RS6000 constraints): Document wt
9158
+2013-03-20 Michael Meissner <meissner@linux.vnet.ibm.com>
9160
+ Clone branch from gcc-4_8-branch, subversion id 196835.
9161
+ * REVISION: New file, track subversion id.
9163
--- a/src/gcc/calls.c
9164
+++ b/src/gcc/calls.c
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 @@
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
9188
&& targetm.calls.return_in_msb (rettype))
9190
if (shift_return_value (TYPE_MODE (rettype), false, valreg))
9191
@@ -3734,7 +3738,8 @@
9193
argvec[count].reg != 0,
9195
- 0, NULL_TREE, &args_size, &argvec[count].locate);
9196
+ reg_parm_stack_space, 0,
9197
+ NULL_TREE, &args_size, &argvec[count].locate);
9199
if (argvec[count].reg == 0 || argvec[count].partial != 0
9200
|| reg_parm_stack_space > 0)
9201
@@ -3821,7 +3826,7 @@
9203
argvec[count].reg != 0,
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
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
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
9224
xpowerpc64|xdefault64|x6[23]0|x970|xG5|xpower[345678]|xpower6x|xrs64a|xcell|xa2|xe500mc64|xe5500|Xe6500)
9225
@@ -3494,7 +3494,7 @@
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"
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 @@
9239
+ case "$with_abi" in
9240
+ "" | elfv1 | elfv2 )
9244
+ echo "Unknown ABI used in --with-abi=$with_abi"
9251
--- a/src/gcc/config/rs6000/power8.md
9252
+++ b/src/gcc/config/rs6000/power8.md
9254
+;; Scheduling description for IBM POWER8 processor.
9255
+;; Copyright (C) 2013 Free Software Foundation, Inc.
9257
+;; Contributed by Pat Haugen (pthaugen@us.ibm.com).
9259
+;; This file is part of GCC.
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.
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.
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/>.
9275
+(define_automaton "power8fxu,power8lsu,power8vsu,power8misc")
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")
9286
+; Dispatch group reservations
9287
+(define_reservation "DU_any_power8"
9288
+ "du0_power8|du1_power8|du2_power8|du3_power8|du4_power8|\
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")
9296
+; Insns that are first in group
9297
+(define_reservation "DU_first_power8"
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")
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,\
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")
9316
+; Execution unit reservations
9317
+(define_reservation "FXU_power8"
9318
+ "fxu0_power8|fxu1_power8")
9320
+(define_reservation "LU_power8"
9321
+ "lu0_power8|lu1_power8")
9323
+(define_reservation "LSU_power8"
9324
+ "lsu0_power8|lsu1_power8")
9326
+(define_reservation "LU_or_LSU_power8"
9327
+ "lu0_power8|lu1_power8|lsu0_power8|lsu1_power8")
9329
+(define_reservation "VSU_power8"
9330
+ "vsu0_power8|vsu1_power8")
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")
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")
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")
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")
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")
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")
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")
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")
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")
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")
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")
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")
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")
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")
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")
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")
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")
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")
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")
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")
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")
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")
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")
9462
+; 5 cycle CR latency
9463
+(define_bypass 5 "power8-fast-compare,power8-compare"
9464
+ "power8-crlogical,power8-mfcr,power8-mfcrf,power8-branch")
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")
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")
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")
9481
+; 7 cycle CR latency
9482
+(define_bypass 7 "power8-mul,power8-mul-compare"
9483
+ "power8-crlogical,power8-mfcr,power8-mfcrf,power8-branch")
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")
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")
9496
+(define_insn_reservation "power8-mtjmpr" 5
9497
+ (and (eq_attr "type" "mtjmpr")
9498
+ (eq_attr "cpu" "power8"))
9499
+ "DU_first_power8,FXU_power8")
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")
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")
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")
9519
+(define_insn_reservation "power8-mfcr" 5
9520
+ (and (eq_attr "type" "mfcr")
9521
+ (eq_attr "cpu" "power8"))
9522
+ "DU_both_power8,cru_power8")
9524
+(define_insn_reservation "power8-mfcrf" 3
9525
+ (and (eq_attr "type" "mfcrf")
9526
+ (eq_attr "cpu" "power8"))
9527
+ "DU_first_power8,cru_power8")
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"))
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")
9545
+; Branch updating LR/CTR feeding mf[lr|ctr]
9546
+(define_bypass 4 "power8-branch" "power8-mfjmpr")
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")
9555
+; Additional 3 cycles for any CR result
9556
+(define_bypass 9 "power8-fp" "power8-crlogical,power8-mfcr*,power8-branch")
9558
+(define_insn_reservation "power8-fpcompare" 8
9559
+ (and (eq_attr "type" "fpcompare")
9560
+ (eq_attr "cpu" "power8"))
9561
+ "DU_any_power8,VSU_power8")
9563
+(define_insn_reservation "power8-sdiv" 27
9564
+ (and (eq_attr "type" "sdiv")
9565
+ (eq_attr "cpu" "power8"))
9566
+ "DU_any_power8,VSU_power8")
9568
+(define_insn_reservation "power8-ddiv" 33
9569
+ (and (eq_attr "type" "ddiv")
9570
+ (eq_attr "cpu" "power8"))
9571
+ "DU_any_power8,VSU_power8")
9573
+(define_insn_reservation "power8-sqrt" 32
9574
+ (and (eq_attr "type" "ssqrt")
9575
+ (eq_attr "cpu" "power8"))
9576
+ "DU_any_power8,VSU_power8")
9578
+(define_insn_reservation "power8-dsqrt" 44
9579
+ (and (eq_attr "type" "dsqrt")
9580
+ (eq_attr "cpu" "power8"))
9581
+ "DU_any_power8,VSU_power8")
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")
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")
9593
+(define_bypass 7 "power8-vecnormal"
9594
+ "power8-vecsimple,power8-veccomplex,power8-fpstore*,\
9597
+(define_insn_reservation "power8-veccomplex" 7
9598
+ (and (eq_attr "type" "veccomplex")
9599
+ (eq_attr "cpu" "power8"))
9600
+ "DU_any_power8,VSU_power8")
9602
+(define_insn_reservation "power8-vecfdiv" 25
9603
+ (and (eq_attr "type" "vecfdiv")
9604
+ (eq_attr "cpu" "power8"))
9605
+ "DU_any_power8,VSU_power8")
9607
+(define_insn_reservation "power8-vecdiv" 31
9608
+ (and (eq_attr "type" "vecdiv")
9609
+ (eq_attr "cpu" "power8"))
9610
+ "DU_any_power8,VSU_power8")
9612
+(define_insn_reservation "power8-mffgpr" 5
9613
+ (and (eq_attr "type" "mffgpr")
9614
+ (eq_attr "cpu" "power8"))
9615
+ "DU_any_power8,VSU_power8")
9617
+(define_insn_reservation "power8-mftgpr" 6
9618
+ (and (eq_attr "type" "mftgpr")
9619
+ (eq_attr "cpu" "power8"))
9620
+ "DU_any_power8,VSU_power8")
9622
+(define_insn_reservation "power8-crypto" 7
9623
+ (and (eq_attr "type" "crypto")
9624
+ (eq_attr "cpu" "power8"))
9625
+ "DU_any_power8,VSU_power8")
9627
--- a/src/gcc/config/rs6000/vector.md
9628
+++ b/src/gcc/config/rs6000/vector.md
9633
-(define_mode_iterator VEC_I [V16QI V8HI V4SI])
9634
+(define_mode_iterator VEC_I [V16QI V8HI V4SI V2DI])
9636
;; Vector float modes
9637
(define_mode_iterator VEC_F [V4SF V2DF])
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])
9643
;; Vector modes that need alginment via permutes
9644
(define_mode_iterator VEC_K [V16QI V8HI V4SI V4SF])
9646
(define_mode_iterator VEC_N [V4SI V4SF V2DI V2DF])
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])
9652
;; Vector init/extract modes
9653
(define_mode_iterator VEC_E [V16QI V8HI V4SI V2DI V4SF V2DF])
9655
(define_mode_iterator VEC_64 [V2DI V2DF])
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])
9661
;; Base type from vector mode
9662
(define_mode_attr VEC_base [(V16QI "QI")
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]);
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)))
9684
+ rs6000_emit_le_vsx_move (operands[0], operands[1], <MODE>mode);
9689
;; Generic vector floating point load/store instructions. These will match
9691
(match_operand:VEC_L 1 "input_operand" ""))]
9692
"VECTOR_MEM_ALTIVEC_OR_VSX_P (<MODE>mode)
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])"
9700
rs6000_split_multireg_move (operands[0], operands[1]);
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)"
9708
if (<MODE>mode == V4SFmode && VECTOR_UNIT_ALTIVEC_P (<MODE>mode))
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)"
9718
if (rs6000_emit_vector_cond_expr (operands[0], operands[1], operands[2],
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)"
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)"
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)"
9744
(define_insn_and_split "*vector_uneq<mode>"
9745
@@ -708,48 +721,19 @@
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)"
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")
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)"
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")
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)"
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)"
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)"
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)"
9802
;; Same size conversions
9803
(define_expand "float<VEC_int><mode>2"
9804
[(set (match_operand:VEC_F 0 "vfloat_operand" "")
9807
rtx reg = gen_reg_rtx (V4SFmode);
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));
9816
rtx reg = gen_reg_rtx (V4SFmode);
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));
9825
rtx reg = gen_reg_rtx (V4SImode);
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));
9834
rtx reg = gen_reg_rtx (V4SImode);
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));
9843
rtx reg = gen_reg_rtx (V4SImode);
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));
9852
rtx reg = gen_reg_rtx (V4SImode);
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));
9859
@@ -963,8 +947,19 @@
9860
(match_operand:V16QI 3 "vlogical_operand" "")]
9861
"VECTOR_MEM_ALTIVEC_OR_VSX_P (<MODE>mode)"
9863
- emit_insn (gen_altivec_vperm_<mode> (operands[0], operands[1], operands[2],
9865
+ if (BYTES_BIG_ENDIAN)
9866
+ emit_insn (gen_altivec_vperm_<mode> (operands[0], operands[1],
9867
+ operands[2], operands[3]));
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]),
9876
+ emit_move_insn (operands[0], unspec);
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" "")))]
9886
+ "VECTOR_UNIT_ALTIVEC_OR_VSX_P (<MODE>mode)"
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" "")))]
9895
+ "VECTOR_UNIT_ALTIVEC_OR_VSX_P (<MODE>mode)"
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" "")))]
9904
+ "VECTOR_UNIT_ALTIVEC_OR_VSX_P (<MODE>mode)"
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" "")))]
9913
+ "VECTOR_UNIT_ALTIVEC_OR_VSX_P (<MODE>mode)"
9916
;; Vector reduction expanders for VSX
9917
--- a/src/gcc/config/rs6000/constraints.md
9918
+++ b/src/gcc/config/rs6000/constraints.md
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.")
9928
(define_register_constraint "wd" "rs6000_constraints[RS6000_CONSTRAINT_wd]"
9930
+ "VSX vector register to hold vector double data or NO_REGS.")
9932
-;; vector float (V4SF)
9933
(define_register_constraint "wf" "rs6000_constraints[RS6000_CONSTRAINT_wf]"
9935
+ "VSX vector register to hold vector float data or NO_REGS.")
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.")
9941
+(define_register_constraint "wl" "rs6000_constraints[RS6000_CONSTRAINT_wl]"
9942
+ "Floating point register if the LFIWAX instruction is enabled or NO_REGS.")
9944
+(define_register_constraint "wm" "rs6000_constraints[RS6000_CONSTRAINT_wm]"
9945
+ "VSX register if direct move instructions are enabled, or NO_REGS.")
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).")
9952
+(define_register_constraint "wr" "rs6000_constraints[RS6000_CONSTRAINT_wr]"
9953
+ "General purpose register if 64-bit instructions are enabled or NO_REGS.")
9955
(define_register_constraint "ws" "rs6000_constraints[RS6000_CONSTRAINT_ws]"
9957
+ "VSX vector register to hold scalar double values or NO_REGS.")
9959
-;; any VSX register
9960
-(define_register_constraint "wa" "rs6000_constraints[RS6000_CONSTRAINT_wa]"
9962
+(define_register_constraint "wt" "rs6000_constraints[RS6000_CONSTRAINT_wt]"
9963
+ "VSX vector register to hold 128 bit integer or NO_REGS.")
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.")
9968
+(define_register_constraint "wv" "rs6000_constraints[RS6000_CONSTRAINT_wv]"
9969
+ "Altivec register to use for double loads/stores or NO_REGS.")
9971
+(define_register_constraint "ww" "rs6000_constraints[RS6000_CONSTRAINT_ww]"
9972
+ "FP or VSX register to perform float operations under -mvsx or NO_REGS.")
9974
+(define_register_constraint "wx" "rs6000_constraints[RS6000_CONSTRAINT_wx]"
9975
+ "Floating point register if the STFIWX instruction is enabled or NO_REGS.")
9977
+(define_register_constraint "wy" "rs6000_constraints[RS6000_CONSTRAINT_wy]"
9978
+ "VSX vector register to hold scalar float values or NO_REGS.")
9980
+(define_register_constraint "wz" "rs6000_constraints[RS6000_CONSTRAINT_wz]"
9981
+ "Floating point register if the LFIWZX instruction is enabled or NO_REGS.")
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"))
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")))
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")))
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")))
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")))
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)")))
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)")))
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)))
10033
+ if (TARGET_VSX && VSX_REGNO_P (REGNO (op)))
10036
return INT_REGNO_P (REGNO (op)) || FP_REGNO_P (REGNO (op));
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")
10044
+ if ((TARGET_E500_DOUBLE || TARGET_SPE) && invalid_e500_subreg (op, mode))
10047
+ if (GET_CODE (op) == SUBREG)
10048
+ op = SUBREG_REG (op);
10053
+ if (REGNO (op) >= FIRST_PSEUDO_REGISTER)
10056
+ return INT_REGNO_P (REGNO (op));
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")
10063
+ if (GET_CODE (op) == SUBREG)
10064
+ op = SUBREG_REG (op);
10069
+ return (REGNO (op) != FIRST_GPR_REGNO);
10072
+;; Return 1 if op is a HTM specific SPR register.
10073
+(define_predicate "htm_spr_reg_operand"
10074
+ (match_operand 0 "register_operand")
10079
+ if (GET_CODE (op) == SUBREG)
10080
+ op = SUBREG_REG (op);
10085
+ switch (REGNO (op))
10087
+ case TFHAR_REGNO:
10088
+ case TFIAR_REGNO:
10089
+ case TEXASR_REGNO:
10095
+ /* Unknown SPR. */
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")
10106
+ if (!TARGET_QUAD_MEMORY)
10109
+ if (GET_CODE (op) == SUBREG)
10110
+ op = SUBREG_REG (op);
10116
+ if (r >= FIRST_PSEUDO_REGISTER)
10119
+ return (INT_REGNO_P (r) && ((r & 1) == 0));
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"))))
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")))
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 @@
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))
10146
if (DECIMAL_FLOAT_MODE_P (mode))
10149
@@ -521,6 +632,54 @@
10150
(and (match_operand 0 "memory_operand")
10151
(match_test "offsettable_nonstrict_memref_p (op)")))
10153
+;; Return 1 if the operand is suitable for load/store quad memory.
10154
+(define_predicate "quad_memory_operand"
10155
+ (match_code "mem")
10157
+ rtx addr, op0, op1;
10160
+ if (!TARGET_QUAD_MEMORY)
10163
+ else if (!memory_operand (op, mode))
10166
+ else if (GET_MODE_SIZE (GET_MODE (op)) != 16)
10169
+ else if (MEM_ALIGN (op) < 128)
10174
+ addr = XEXP (op, 0);
10175
+ if (int_reg_operand (addr, Pmode))
10178
+ else if (GET_CODE (addr) != PLUS)
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);
10192
+ if (TARGET_DEBUG_ADDR)
10194
+ fprintf (stderr, "\nquad_memory_operand, ret = %s\n", ret ? "true" : "false");
10201
;; Return 1 if the operand is an indexed or indirect memory operand.
10202
(define_predicate "indexed_or_indirect_operand"
10204
@@ -535,6 +694,19 @@
10205
return indexed_or_indirect_address (op, mode);
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")
10214
+ return indexed_or_indirect_operand (op, mode);
10215
+ else if (TARGET_DIRECT_MOVE)
10216
+ return register_operand (op, mode);
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")))
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)))"))
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))"))
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))"))
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),
10263
@@ -1364,6 +1559,26 @@
10267
+;; Return 1 if OP is valid for crsave insn, known to be a PARALLEL.
10268
+(define_predicate "crsave_operation"
10269
+ (match_code "parallel")
10271
+ int count = XVECLEN (op, 0);
10274
+ for (i = 1; i < count; i++)
10276
+ rtx exp = XVECEXP (op, 0, i);
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))))
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 @@
10292
return GET_CODE (op) == UNSPEC && XINT (op, 1) == UNSPEC_TOCREL;
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")
10300
+ HOST_WIDE_INT value;
10303
+ if (GET_CODE (op) == HIGH)
10306
+ if (CONST_INT_P (op))
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);
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)
10323
+ if ((value & (HOST_WIDE_INT)0xffff0000) == 0)
10326
+ return (IN_RANGE (value >> 16, -32, 31));
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")
10336
+ /* Handle sign/zero extend. */
10337
+ if (GET_CODE (op) == ZERO_EXTEND
10338
+ || (TARGET_P8_FUSION_SIGN && GET_CODE (op) == SIGN_EXTEND))
10340
+ op = XEXP (op, 0);
10341
+ mode = GET_MODE (op);
10355
+ if (!TARGET_POWERPC64)
10363
+ addr = XEXP (op, 0);
10364
+ if (GET_CODE (addr) == PLUS)
10366
+ rtx base = XEXP (addr, 0);
10367
+ rtx offset = XEXP (addr, 1);
10369
+ return (base_reg_operand (base, GET_MODE (base))
10370
+ && satisfies_constraint_I (offset));
10373
+ else if (GET_CODE (addr) == LO_SUM)
10375
+ rtx base = XEXP (addr, 0);
10376
+ rtx offset = XEXP (addr, 1);
10378
+ if (!base_reg_operand (base, GET_MODE (base)))
10381
+ else if (TARGET_XCOFF || (TARGET_ELF && TARGET_POWERPC64))
10382
+ return small_toc_ref (offset, GET_MODE (offset));
10384
+ else if (TARGET_ELF && !TARGET_POWERPC64)
10385
+ return CONSTANT_P (offset);
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.
10396
-#if defined (__powerpc64__)
10397
+#if defined(__powerpc64__) && _CALL_ELF == 2
10399
+/* Defining "toc" above breaks @toc in assembler code. */
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)
10412
+#define HIDDEN_FUNC(name) \
10413
+ FUNC_START(name) \
10414
+ .hidden FUNC_NAME(name);
10416
+#define FUNC_END(name) \
10417
+ .size FUNC_NAME(name),.-FUNC_NAME(name)
10419
+#elif defined (__powerpc64__)
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
10427
+;; Hardware Transactional Memory (HTM) patterns.
10428
+;; Copyright (C) 2013 Free Software Foundation, Inc.
10429
+;; Contributed by Peter Bergner <bergner@vnet.ibm.com>.
10431
+;; This file is part of GCC.
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.
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.
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/>.
10451
+ (TEXASRU_SPR 131)
10452
+ (MAX_HTM_OPERANDS 4)
10456
+;; UNSPEC_VOLATILE usage
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
10468
+ UNSPECV_HTM_TRECHKPT
10469
+ UNSPECV_HTM_TRECLAIM
10471
+ UNSPECV_HTM_MFSPR
10472
+ UNSPECV_HTM_MTSPR
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)
10483
+ (set (match_operand:SI 0 "int_reg_operand" "")
10484
+ (minus:SI (const_int 1) (match_dup 3)))]
10487
+ operands[2] = gen_rtx_REG (CCmode, CR0_REGNO);
10488
+ operands[3] = gen_reg_rtx (SImode);
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))]
10497
+ [(set_attr "type" "htm")
10498
+ (set_attr "length" "4")])
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)
10509
+ (set (match_operand:SI 0 "int_reg_operand" "")
10510
+ (minus:SI (const_int 1) (match_dup 5)))]
10513
+ operands[4] = gen_rtx_REG (CCmode, CR0_REGNO);
10514
+ operands[5] = gen_reg_rtx (SImode);
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))]
10524
+ "tabortdc. %0,%1,%2"
10525
+ [(set_attr "type" "htm")
10526
+ (set_attr "length" "4")])
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)
10537
+ (set (match_operand:SI 0 "int_reg_operand" "")
10538
+ (minus:SI (const_int 1) (match_dup 5)))]
10541
+ operands[4] = gen_rtx_REG (CCmode, CR0_REGNO);
10542
+ operands[5] = gen_reg_rtx (SImode);
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))]
10552
+ "tabortdci. %0,%1,%2"
10553
+ [(set_attr "type" "htm")
10554
+ (set_attr "length" "4")])
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)
10565
+ (set (match_operand:SI 0 "int_reg_operand" "")
10566
+ (minus:SI (const_int 1) (match_dup 5)))]
10569
+ operands[4] = gen_rtx_REG (CCmode, CR0_REGNO);
10570
+ operands[5] = gen_reg_rtx (SImode);
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))]
10580
+ "tabortwc. %0,%1,%2"
10581
+ [(set_attr "type" "htm")
10582
+ (set_attr "length" "4")])
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)
10593
+ (set (match_operand:SI 0 "int_reg_operand" "")
10594
+ (minus:SI (const_int 1) (match_dup 5)))]
10597
+ operands[4] = gen_rtx_REG (CCmode, CR0_REGNO);
10598
+ operands[5] = gen_reg_rtx (SImode);
10601
+(define_expand "ttest"
10602
+ [(set (match_dup 1)
10603
+ (unspec_volatile:CC [(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))])]
10614
+ operands[1] = gen_rtx_REG (CCmode, CR0_REGNO);
10615
+ operands[2] = gen_reg_rtx (SImode);
10616
+ operands[3] = gen_reg_rtx (SImode);
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))]
10626
+ "tabortwci. %0,%1,%2"
10627
+ [(set_attr "type" "htm")
10628
+ (set_attr "length" "4")])
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)
10637
+ (set (match_operand:SI 0 "int_reg_operand" "")
10638
+ (minus:SI (const_int 1) (match_dup 3)))]
10641
+ operands[2] = gen_rtx_REG (CCmode, CR0_REGNO);
10642
+ operands[3] = gen_reg_rtx (SImode);
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))]
10651
+ [(set_attr "type" "htm")
10652
+ (set_attr "length" "4")])
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)
10661
+ (set (match_operand:SI 0 "int_reg_operand" "")
10662
+ (minus:SI (const_int 1) (match_dup 3)))]
10665
+ operands[2] = gen_rtx_REG (CCmode, CR0_REGNO);
10666
+ operands[3] = gen_reg_rtx (SImode);
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))]
10675
+ [(set_attr "type" "htm")
10676
+ (set_attr "length" "4")])
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)
10685
+ (set (match_operand:SI 0 "int_reg_operand" "")
10686
+ (minus:SI (const_int 1) (match_dup 3)))]
10689
+ operands[2] = gen_rtx_REG (CCmode, CR0_REGNO);
10690
+ operands[3] = gen_reg_rtx (SImode);
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))]
10699
+ [(set_attr "type" "htm")
10700
+ (set_attr "length" "4")])
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)
10709
+ (set (match_operand:SI 0 "int_reg_operand" "")
10710
+ (minus:SI (const_int 1) (match_dup 2)))]
10713
+ operands[1] = gen_rtx_REG (CCmode, CR0_REGNO);
10714
+ operands[2] = gen_reg_rtx (SImode);
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))]
10723
+ [(set_attr "type" "htm")
10724
+ (set_attr "length" "4")])
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)
10733
+ (set (match_operand:SI 0 "int_reg_operand" "")
10734
+ (minus:SI (const_int 1) (match_dup 3)))]
10737
+ operands[2] = gen_rtx_REG (CCmode, CR0_REGNO);
10738
+ operands[3] = gen_reg_rtx (SImode);
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))]
10747
+ [(set_attr "type" "htm")
10748
+ (set_attr "length" "4")])
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)
10757
+ (set (match_operand:SI 0 "int_reg_operand" "")
10758
+ (minus:SI (const_int 1) (match_dup 3)))]
10761
+ operands[2] = gen_rtx_REG (CCmode, CR0_REGNO);
10762
+ operands[3] = gen_reg_rtx (SImode);
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))]
10771
+ [(set_attr "type" "htm")
10772
+ (set_attr "length" "4")])
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))]
10781
+ [(set_attr "type" "htm")
10782
+ (set_attr "length" "4")])
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))]
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
10796
VECTOR_MODES (FLOAT, 8); /* V4HF V2SF */
10797
VECTOR_MODES (FLOAT, 16); /* V8HF V4SF V2DF */
10798
VECTOR_MODES (FLOAT, 32); /* V16HF V8SF V4DF */
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
10803
+PARTIAL_INT_MODE (TI);
10804
--- a/src/gcc/config/rs6000/rs6000-cpus.def
10805
+++ b/src/gcc/config/rs6000/rs6000-cpus.def
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 @@
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 \
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)
10836
#define POWERPC_7400_MASK (OPTION_MASK_PPC_GFXOPT | OPTION_MASK_ALTIVEC)
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)
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
10886
+/* Hardware Transactional Memory (HTM) intrinsics.
10887
+ Copyright (C) 2013 Free Software Foundation, Inc.
10888
+ Contributed by Peter Bergner <bergner@vnet.ibm.com>.
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.
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.
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.
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/>. */
10910
+# error "HTM instruction set not enabled"
10911
+#endif /* __HTM__ */
10913
+#ifndef _HTMINTRIN_H
10914
+#define _HTMINTRIN_H
10916
+#include <stdint.h>
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;
10924
+#define _HTM_STATE(CR0) ((CR0 >> 1) & 0x3)
10925
+#define _HTM_NONTRANSACTIONAL 0x0
10926
+#define _HTM_SUSPENDED 0x1
10927
+#define _HTM_TRANSACTIONAL 0x2
10929
+/* The following macros use the IBM bit numbering for BITNUM
10930
+ as used in the ISA documentation. */
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))
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)
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)
10947
+#define _TEXASR_DISALLOWED(TEXASR) \
10948
+ _TEXASR_EXTRACT_BITS(TEXASR, 8, 1)
10949
+#define _TEXASRU_DISALLOWED(TEXASRU) \
10950
+ _TEXASRU_EXTRACT_BITS(TEXASRU, 8, 1)
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)
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)
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)
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)
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)
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)
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)
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)
10992
+#define _TEXASR_ABORT(TEXASR) \
10993
+ _TEXASR_EXTRACT_BITS(TEXASR, 31, 1)
10994
+#define _TEXASRU_ABORT(TEXASRU) \
10995
+ _TEXASRU_EXTRACT_BITS(TEXASRU, 31, 1)
10998
+#define _TEXASR_SUSPENDED(TEXASR) \
10999
+ _TEXASR_EXTRACT_BITS(TEXASR, 32, 1)
11001
+#define _TEXASR_PRIVILEGE(TEXASR) \
11002
+ _TEXASR_EXTRACT_BITS(TEXASR, 35, 2)
11004
+#define _TEXASR_FAILURE_SUMMARY(TEXASR) \
11005
+ _TEXASR_EXTRACT_BITS(TEXASR, 36, 1)
11007
+#define _TEXASR_TFIAR_EXACT(TEXASR) \
11008
+ _TEXASR_EXTRACT_BITS(TEXASR, 37, 1)
11010
+#define _TEXASR_ROT(TEXASR) \
11011
+ _TEXASR_EXTRACT_BITS(TEXASR, 38, 1)
11013
+#define _TEXASR_TRANSACTION_LEVEL(TEXASR) \
11014
+ _TEXASR_EXTRACT_BITS(TEXASR, 63, 12)
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);
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,
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 */
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
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 \
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
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>.
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.
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.
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.
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/>. */
11125
+# error "HTM instruction set not enabled"
11126
+#endif /* __HTM__ */
11128
+#ifndef _HTMXLINTRIN_H
11129
+#define _HTMXLINTRIN_H
11131
+#include <stdint.h>
11132
+#include <htmintrin.h>
11134
+#ifdef __cplusplus
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))
11147
+typedef char TM_buff_type[16];
11149
+extern __inline long
11150
+__attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
11151
+__TM_simple_begin (void)
11153
+ if (__builtin_expect (__builtin_tbegin (0), 1))
11158
+extern __inline long
11159
+__attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
11160
+__TM_begin (void* const TM_buff)
11162
+ *_TEXASRL_PTR (TM_buff) = 0;
11163
+ if (__builtin_expect (__builtin_tbegin (0), 1))
11165
+#ifdef __powerpc64__
11166
+ *_TEXASR_PTR (TM_buff) = __builtin_get_texasr ();
11168
+ *_TEXASRU_PTR (TM_buff) = __builtin_get_texasru ();
11169
+ *_TEXASRL_PTR (TM_buff) = __builtin_get_texasr ();
11171
+ *_TFIAR_PTR (TM_buff) = __builtin_get_tfiar ();
11175
+extern __inline long
11176
+__attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
11179
+ if (__builtin_expect (__builtin_tend (0), 1))
11184
+extern __inline void
11185
+__attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
11188
+ __builtin_tabort (0);
11191
+extern __inline void
11192
+__attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
11193
+__TM_named_abort (unsigned char const code)
11195
+ __builtin_tabort (code);
11198
+extern __inline void
11199
+__attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
11200
+__TM_resume (void)
11202
+ __builtin_tresume ();
11205
+extern __inline void
11206
+__attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
11207
+__TM_suspend (void)
11209
+ __builtin_tsuspend ();
11212
+extern __inline long
11213
+__attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
11214
+__TM_is_user_abort (void* const TM_buff)
11216
+ texasru_t texasru = *_TEXASRU_PTR (TM_buff);
11217
+ return _TEXASRU_ABORT (texasru);
11220
+extern __inline long
11221
+__attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
11222
+__TM_is_named_user_abort (void* const TM_buff, unsigned char *code)
11224
+ texasru_t texasru = *_TEXASRU_PTR (TM_buff);
11226
+ *code = _TEXASRU_FAILURE_CODE (texasru);
11227
+ return _TEXASRU_ABORT (texasru);
11230
+extern __inline long
11231
+__attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
11232
+__TM_is_illegal (void* const TM_buff)
11234
+ texasru_t texasru = *_TEXASRU_PTR (TM_buff);
11235
+ return _TEXASRU_DISALLOWED (texasru);
11238
+extern __inline long
11239
+__attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
11240
+__TM_is_footprint_exceeded (void* const TM_buff)
11242
+ texasru_t texasru = *_TEXASRU_PTR (TM_buff);
11243
+ return _TEXASRU_FOOTPRINT_OVERFLOW (texasru);
11246
+extern __inline long
11247
+__attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
11248
+__TM_nesting_depth (void* const TM_buff)
11250
+ texasrl_t texasrl;
11252
+ if (_HTM_STATE (__builtin_ttest ()) == _HTM_NONTRANSACTIONAL)
11254
+ texasrl = *_TEXASRL_PTR (TM_buff);
11255
+ if (!_TEXASR_FAILURE_SUMMARY (texasrl))
11259
+ texasrl = (texasrl_t) __builtin_get_texasr ();
11261
+ return _TEXASR_TRANSACTION_LEVEL (texasrl);
11264
+extern __inline long
11265
+__attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
11266
+__TM_is_nested_too_deep(void* const TM_buff)
11268
+ texasru_t texasru = *_TEXASRU_PTR (TM_buff);
11269
+ return _TEXASRU_NESTING_OVERFLOW (texasru);
11272
+extern __inline long
11273
+__attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
11274
+__TM_is_conflict(void* const TM_buff)
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;
11282
+extern __inline long
11283
+__attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
11284
+__TM_is_failure_persistent(void* const TM_buff)
11286
+ texasru_t texasru = *_TEXASRU_PTR (TM_buff);
11287
+ return _TEXASRU_FAILURE_PERSISTENT (texasru);
11290
+extern __inline long
11291
+__attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
11292
+__TM_failure_address(void* const TM_buff)
11294
+ return *_TFIAR_PTR (TM_buff);
11297
+extern __inline long long
11298
+__attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
11299
+__TM_failure_code(void* const TM_buff)
11301
+ return *_TEXASR_PTR (TM_buff);
11304
+#ifdef __cplusplus
11308
+#endif /* _HTMXLINTRIN_H */
11309
--- a/src/gcc/config/rs6000/rs6000-builtin.def
11310
+++ b/src/gcc/config/rs6000/rs6000-builtin.def
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
11322
#error "RS6000_BUILTIN_E is not defined."
11325
+#ifndef RS6000_BUILTIN_H
11326
+ #error "RS6000_BUILTIN_H is not defined."
11329
#ifndef RS6000_BUILTIN_P
11330
#error "RS6000_BUILTIN_P is not defined."
11332
@@ -301,6 +306,158 @@
11333
| RS6000_BTC_SPECIAL), \
11334
CODE_FOR_nothing) /* ICODE */
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 */
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 */
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 */
11363
+/* For the instructions encoded as VSX instructions use __builtin_vsx as the
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 */
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 */
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 */
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 */
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 */
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 */
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 */
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 */
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 */
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 */
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 */
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 */
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 */
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 */
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 */
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)
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 @@
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)
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")
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)
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)
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)
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)
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)
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)
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)
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)
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")
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")
11621
+/* 1 argument crypto functions. */
11622
+BU_CRYPTO_1 (VSBOX, "vsbox", CONST, crypto_vsbox)
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)
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)
11642
+/* 2 argument crypto overloaded functions. */
11643
+BU_CRYPTO_OVERLOAD_2 (VPMSUM, "vpmsum")
11645
+/* 3 argument crypto overloaded functions. */
11646
+BU_CRYPTO_OVERLOAD_3 (VPERMXOR, "vpermxor")
11647
+BU_CRYPTO_OVERLOAD_3 (VSHASIGMA, "vshasigma")
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)
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)
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 @@
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)
11687
BU_SPECIAL_X (RS6000_BUILTIN_MFTB, "__builtin_ppc_mftb",
11688
- RS6000_BTM_ALWAYS, RS6000_BTC_MISC)
11689
+ RS6000_BTM_ALWAYS, RS6000_BTC_MISC)
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 @@
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__");
11715
/* options from the builtin masks. */
11716
if ((bu_mask & RS6000_BTM_SPE) != 0)
11717
@@ -453,7 +461,11 @@
11719
builtin_define ("_CALL_AIXDESC");
11720
builtin_define ("_CALL_AIX");
11721
+ builtin_define ("_CALL_ELF=1");
11724
+ builtin_define ("_CALL_ELF=2");
11727
builtin_define ("_CALL_DARWIN");
11729
@@ -465,6 +477,13 @@
11730
if (TARGET_SOFT_FLOAT || !TARGET_FPRS)
11731
builtin_define ("__NO_FPRS__");
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");
11740
/* Generate defines for Xilinx FPU. */
11741
if (rs6000_xilinx_fpu)
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 },
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 },
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 },
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 },
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 },
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 },
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 },
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 },
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 },
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 },
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 },
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 },
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 },
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 },
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 },
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 },
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 },
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 },
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 },
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 },
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 },
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 },
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 },
12357
+ { P8V_BUILTIN_VEC_VPKSDSS, P8V_BUILTIN_VPKSDSS,
12358
+ RS6000_BTI_V4SI, RS6000_BTI_V2DI, RS6000_BTI_V2DI, 0 },
12360
+ { P8V_BUILTIN_VEC_VPKUDUS, P8V_BUILTIN_VPKUDUS,
12361
+ RS6000_BTI_unsigned_V4SI, RS6000_BTI_unsigned_V2DI, RS6000_BTI_unsigned_V2DI, 0 },
12363
+ { P8V_BUILTIN_VEC_VPKSDUS, P8V_BUILTIN_VPKSDUS,
12364
+ RS6000_BTI_unsigned_V4SI, RS6000_BTI_V2DI, RS6000_BTI_V2DI, 0 },
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 },
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 },
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 },
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 },
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 },
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 },
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 },
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 },
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 },
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 },
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 },
12448
{ (enum rs6000_builtins) 0, (enum rs6000_builtins) 0, 0, 0, 0, 0 }
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);
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
12468
+Target Undocumented Report Var(TARGET_VSX_SCALAR_FLOAT) Init(1)
12469
+; If -mpower8-vector, use VSX arithmetic instructions for SFmode (on by default)
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)
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)
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
12489
+Target RejectNegative Var(rs6000_elf_abi, 1) Save
12493
+Target RejectNegative Var(rs6000_elf_abi, 2)
12496
; These are here for testing during development only, do not document
12497
; in the manual please.
12499
@@ -514,3 +525,47 @@
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
12505
+Target Undocumented Mask(VSX_TIMODE) Var(rs6000_isa_flags)
12506
+Allow 128-bit integers in VSX registers
12509
+Target Report Mask(P8_FUSION) Var(rs6000_isa_flags)
12510
+Fuse certain integer operations together for better performance on power8
12512
+mpower8-fusion-sign
12513
+Target Undocumented Mask(P8_FUSION_SIGN) Var(rs6000_isa_flags)
12514
+Allow sign extension in fusion operations
12517
+Target Report Mask(P8_VECTOR) Var(rs6000_isa_flags)
12518
+Use/do not use vector and scalar instructions added in ISA 2.07.
12521
+Target Report Mask(CRYPTO) Var(rs6000_isa_flags)
12522
+Use ISA 2.07 crypto instructions
12525
+Target Report Mask(DIRECT_MOVE) Var(rs6000_isa_flags)
12526
+Use ISA 2.07 direct move between GPR & VSX register instructions
12529
+Target Report Mask(HTM) Var(rs6000_isa_flags)
12530
+Use ISA 2.07 transactional memory (HTM) instructions
12533
+Target Report Mask(QUAD_MEMORY) Var(rs6000_isa_flags)
12534
+Generate the quad word memory instructions (lq/stq/lqarx/stqcx).
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.
12541
+Target Undocumented Mask(UPPER_REGS_DF) Var(rs6000_isa_flags)
12542
+Allow double variables in upper registers with -mcpu=power7 or -mvsx
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
12551
#ifndef RS6000_BI_ARCH
12553
-#undef DEFAULT_ABI
12554
-#define DEFAULT_ABI ABI_AIX
12556
#undef TARGET_64BIT
12557
#define TARGET_64BIT 1
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
12566
#define PROCESSOR_DEFAULT64 PROCESSOR_POWER7
12569
/* We don't need to generate entries in .fixup, except when
12570
-mrelocatable or -mrelocatable-lib is given. */
12572
#define INVALID_64BIT "-m%s not supported in this configuration"
12573
#define INVALID_32BIT INVALID_64BIT
12575
+#ifdef LINUX64_DEFAULT_ABI_ELFv2
12576
+#define ELFv2_ABI_CHECK (rs6000_elf_abi != 1)
12578
+#define ELFv2_ABI_CHECK (rs6000_elf_abi == 2)
12581
#undef SUBSUBTARGET_OVERRIDE_OPTIONS
12582
#define SUBSUBTARGET_OVERRIDE_OPTIONS \
12584
@@ -102,6 +109,12 @@
12585
error (INVALID_64BIT, "call"); \
12587
dot_symbols = !strcmp (rs6000_abi_name, "aixdesc"); \
12588
+ if (ELFv2_ABI_CHECK) \
12590
+ rs6000_current_abi = ABI_ELFv2; \
12591
+ if (dot_symbols) \
12592
+ error ("-mcall-aixdesc incompatible with -mabi=elfv2"); \
12594
if (rs6000_isa_flags & OPTION_MASK_RELOCATABLE) \
12596
rs6000_isa_flags &= ~OPTION_MASK_RELOCATABLE; \
12597
@@ -351,7 +364,11 @@
12598
#define LINK_OS_DEFAULT_SPEC "%(link_os_linux)"
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}"
12605
+#define GLIBC_DYNAMIC_LINKER64 "%{mabi=elfv2:/lib64/ld64.so.2;:/lib64/ld64.so.1}"
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", \
12618
+ "tfhar", "tfiar", "texasr" \
12621
/* This outputs NAME to FILE. */
12622
--- a/src/gcc/config/rs6000/rs6000.c
12623
+++ b/src/gcc/config/rs6000/rs6000.c
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;
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];
12645
-/* Reload functions based on the type and the vector unit. */
12646
-static enum insn_code rs6000_vector_reload[NUM_MACHINE_MODES][2];
12648
static int dbg_cost_ctrl;
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);
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). */
12660
+enum rs6000_reg_type {
12665
+ ALTIVEC_REG_TYPE,
12673
+/* Map register class to register type. */
12674
+static enum rs6000_reg_type reg_class_to_reg_type[N_REG_CLASSES];
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)
12680
+#define IS_FP_VECT_REG_TYPE(RTYPE) IN_RANGE(RTYPE, VSX_REG_TYPE, FPR_REG_TYPE)
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. */
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. */
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
12698
+#define FIRST_RELOAD_REG_CLASS RELOAD_REG_GPR
12699
+#define LAST_RELOAD_REG_CLASS RELOAD_REG_VMX
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. */
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. */
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;
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. */
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. */
12736
+static struct rs6000_reg_addr reg_addr[NUM_MACHINE_MODES];
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)
12742
+ return ((reg_addr[mode].addr_mask[RELOAD_REG_ANY] & RELOAD_REG_PRE_INCDEC)
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)
12750
+ return ((reg_addr[mode].addr_mask[RELOAD_REG_ANY] & RELOAD_REG_PRE_MODIFY)
12755
/* Target cpu costs. */
12757
@@ -828,6 +927,25 @@
12758
12, /* prefetch streams */
12761
+/* Instruction costs on POWER8 processors. */
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 */
12780
/* Instruction costs on POWER A2 processors. */
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 },
12795
+#define RS6000_BUILTIN_H(ENUM, NAME, MASK, ATTR, ICODE) \
12796
+ { NAME, ICODE, MASK, ATTR },
12798
#define RS6000_BUILTIN_P(ENUM, NAME, MASK, ATTR, ICODE) \
12799
{ NAME, ICODE, MASK, ATTR },
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 *,
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 *,
12828
/* Hash table stuff for keeping track of TOC entries. */
12830
struct GTY(()) toc_hash_struct
12831
@@ -1068,7 +1199,9 @@
12832
/* SPE registers. */
12833
"spe_acc", "spefscr",
12834
/* Soft frame pointer. */
12837
+ /* HTM SPR registers. */
12838
+ "tfhar", "tfiar", "texasr"
12841
#ifdef TARGET_REGNAMES
12842
@@ -1094,7 +1227,9 @@
12843
/* SPE registers. */
12844
"spe_acc", "spefscr",
12845
/* Soft frame pointer. */
12848
+ /* HTM SPR registers. */
12849
+ "tfhar", "tfiar", "texasr"
12853
@@ -1316,6 +1451,9 @@
12854
#undef TARGET_RETURN_IN_MEMORY
12855
#define TARGET_RETURN_IN_MEMORY rs6000_return_in_memory
12857
+#undef TARGET_RETURN_IN_MSB
12858
+#define TARGET_RETURN_IN_MSB rs6000_return_in_msb
12860
#undef TARGET_SETUP_INCOMING_VARARGS
12861
#define TARGET_SETUP_INCOMING_VARARGS setup_incoming_varargs
12863
@@ -1513,8 +1651,9 @@
12865
unsigned HOST_WIDE_INT reg_size;
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);
12874
@@ -1546,16 +1685,38 @@
12876
int last_regno = regno + rs6000_hard_regno_nregs[mode][regno] - 1;
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));
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
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)))
12899
if (FP_REGNO_P (regno))
12900
return FP_REGNO_P (last_regno);
12902
if (ALTIVEC_REGNO_P (regno))
12903
- return ALTIVEC_REGNO_P (last_regno);
12905
+ if (mode == SFmode && !TARGET_UPPER_REGS_SF)
12908
+ if ((mode == DFmode || mode == DImode) && !TARGET_UPPER_REGS_DF)
12911
+ return ALTIVEC_REGNO_P (last_regno);
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);
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
12922
+ modes and DImode. */
12923
if (FP_REGNO_P (regno))
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))
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. */
12936
return GET_MODE_SIZE (mode) <= UNITS_PER_WORD;
12938
@@ -1674,10 +1833,77 @@
12942
+ len += fprintf (stderr, "%sreg-class = %s", comma,
12943
+ reg_class_names[(int)rs6000_regno_regclass[r]]);
12948
+ fprintf (stderr, ",\n\t");
12952
fprintf (stderr, "%sregno = %d\n", comma, r);
12956
+static const char *
12957
+rs6000_debug_vector_unit (enum rs6000_vector v)
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;
12976
+/* Print the address masks in a human readble fashion. */
12977
+DEBUG_FUNCTION void
12978
+rs6000_debug_print_mode (ssize_t m)
12982
+ fprintf (stderr, "Mode: %-5s", GET_MODE_NAME (m));
12983
+ for (rc = 0; rc < N_RELOAD_REG; rc++)
12985
+ addr_mask_type mask = reg_addr[m].addr_mask[rc];
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 ? '+' : ' ');
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))
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' : '*');
13010
+ fputs ("\n", stderr);
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;
13020
+ size_t m1, m2, v;
13021
char costly_num[20];
13023
char flags_buffer[40];
13024
@@ -1700,20 +1927,67 @@
13025
const char *cmodel_str;
13026
struct cl_target_option cl_opts;
13028
- /* Map enum rs6000_vector to string. */
13029
- static const char *rs6000_debug_vector_unit[] = {
13036
+ /* Modes we want tieable information on. */
13037
+ static const enum machine_mode print_tieable_modes[] = {
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: " },
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,
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");
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);
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"
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]]);
13154
for (m = 0; m < NUM_MACHINE_MODES; ++m)
13155
- if (rs6000_vector_unit[m] || rs6000_vector_mem[m])
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] ]);
13163
+ rs6000_debug_print_mode (m);
13165
+ fputs ("\n", stderr);
13167
+ for (m1 = 0; m1 < ARRAY_SIZE (print_tieable_modes); m1++)
13169
+ enum machine_mode mode1 = print_tieable_modes[m1];
13170
+ bool first_time = true;
13172
+ nl = (const char *)0;
13173
+ for (m2 = 0; m2 < ARRAY_SIZE (print_tieable_modes); m2++)
13175
+ enum machine_mode mode2 = print_tieable_modes[m2];
13176
+ if (mode1 != mode2 && MODES_TIEABLE_P (mode1, mode2))
13180
+ fprintf (stderr, "Tieable modes %s:", GET_MODE_NAME (mode1));
13182
+ first_time = false;
13185
+ fprintf (stderr, " %s", GET_MODE_NAME (mode2));
13190
+ fputs ("\n", stderr);
13194
fputs (nl, stderr);
13196
@@ -1913,6 +2236,7 @@
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");
13208
+ if (targetm.lra_p ())
13209
+ fprintf (stderr, DEBUG_FMT_S, "lra", "true");
13211
+ if (TARGET_P8_FUSION)
13212
+ fprintf (stderr, DEBUG_FMT_S, "p8 fusion",
13213
+ (TARGET_P8_FUSION_SIGN) ? "zero+sign" : "zero");
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);
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
13228
+rs6000_setup_reg_addr_masks (void)
13230
+ ssize_t rc, reg, m, nregs;
13231
+ addr_mask_type any_addr_mask, addr_mask;
13233
+ for (m = 0; m < NUM_MACHINE_MODES; ++m)
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);
13240
+ any_addr_mask = 0;
13241
+ for (rc = FIRST_RELOAD_REG_CLASS; rc <= LAST_RELOAD_REG_CLASS; rc++)
13244
+ reg = reload_reg_map[rc].reg;
13246
+ /* Can mode values go in the GPR/FPR/Altivec registers? */
13247
+ if (reg >= 0 && rs6000_hard_regno_mode_ok_p[m][reg])
13249
+ nregs = rs6000_hard_regno_nregs[m][reg];
13250
+ addr_mask |= RELOAD_REG_VALID;
13252
+ /* Indicate if the mode takes more than 1 physical register. If
13253
+ it takes a single register, indicate it can do REG+REG
13255
+ if (nregs > 1 || m == BLKmode)
13256
+ addr_mask |= RELOAD_REG_MULTIPLE;
13258
+ addr_mask |= RELOAD_REG_INDEXED;
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. */
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))
13277
+ addr_mask |= RELOAD_REG_PRE_INCDEC;
13279
+ /* PRE_MODIFY is more restricted than PRE_INC/PRE_DEC in that
13280
+ we don't allow PRE_MODIFY for some multi-register
13285
+ addr_mask |= RELOAD_REG_PRE_MODIFY;
13289
+ if (TARGET_POWERPC64)
13290
+ addr_mask |= RELOAD_REG_PRE_MODIFY;
13295
+ if (TARGET_DF_INSN)
13296
+ addr_mask |= RELOAD_REG_PRE_MODIFY;
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;
13308
+ reg_addr[m].addr_mask[rc] = addr_mask;
13309
+ any_addr_mask |= addr_mask;
13312
+ reg_addr[m].addr_mask[RELOAD_REG_ANY] = any_addr_mask;
13317
/* Initialize the various global tables that are based on register size. */
13319
rs6000_init_hard_regno_mode_ok (bool global_init_p)
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;
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;
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;
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;
13368
+ reg_class_to_reg_type[(int)FLOAT_REGS] = FPR_REG_TYPE;
13369
+ reg_class_to_reg_type[(int)ALTIVEC_REGS] = ALTIVEC_REG_TYPE;
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
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));
13381
+ gcc_assert ((int)CODE_FOR_nothing == 0);
13382
+ memset ((void *) ®_addr[0], '\0', sizeof (reg_addr));
13384
+ gcc_assert ((int)NO_REGS == 0);
13385
+ memset ((void *) &rs6000_constraints[0], '\0', sizeof (rs6000_constraints));
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 @@
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. */
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;
13407
@@ -2076,14 +2537,48 @@
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;
13416
+ /* Allow TImode in VSX register and set the VSX memory macros. */
13417
+ if (TARGET_VSX && TARGET_VSX_TIMODE)
13419
+ rs6000_vector_mem[TImode] = VECTOR_VSX;
13420
+ rs6000_vector_align[TImode] = align64;
13423
/* TODO add SPE and paired floating point vector support. */
13425
/* Register class constraints for the constraints that depend on compile
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
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. */
13455
if (TARGET_HARD_FLOAT && TARGET_FPRS)
13456
rs6000_constraints[RS6000_CONSTRAINT_f] = FLOAT_REGS;
13458
@@ -2092,64 +2587,158 @@
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
13475
+ if (TARGET_VSX_TIMODE)
13476
+ rs6000_constraints[RS6000_CONSTRAINT_wt] = VSX_REGS;
13478
+ if (TARGET_UPPER_REGS_DF)
13480
+ rs6000_constraints[RS6000_CONSTRAINT_ws] = VSX_REGS;
13481
+ rs6000_constraints[RS6000_CONSTRAINT_wv] = ALTIVEC_REGS;
13484
+ rs6000_constraints[RS6000_CONSTRAINT_ws] = FLOAT_REGS;
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;
13492
- /* Set up the reload helper functions. */
13493
+ if (TARGET_MFPGPR)
13494
+ rs6000_constraints[RS6000_CONSTRAINT_wg] = FLOAT_REGS;
13496
+ if (TARGET_LFIWAX)
13497
+ rs6000_constraints[RS6000_CONSTRAINT_wl] = FLOAT_REGS;
13499
+ if (TARGET_DIRECT_MOVE)
13500
+ rs6000_constraints[RS6000_CONSTRAINT_wm] = VSX_REGS;
13502
+ if (TARGET_POWERPC64)
13503
+ rs6000_constraints[RS6000_CONSTRAINT_wr] = GENERAL_REGS;
13505
+ if (TARGET_P8_VECTOR && TARGET_UPPER_REGS_SF)
13507
+ rs6000_constraints[RS6000_CONSTRAINT_wu] = ALTIVEC_REGS;
13508
+ rs6000_constraints[RS6000_CONSTRAINT_wy] = VSX_REGS;
13509
+ rs6000_constraints[RS6000_CONSTRAINT_ww] = VSX_REGS;
13511
+ else if (TARGET_P8_VECTOR)
13513
+ rs6000_constraints[RS6000_CONSTRAINT_wy] = FLOAT_REGS;
13514
+ rs6000_constraints[RS6000_CONSTRAINT_ww] = FLOAT_REGS;
13516
+ else if (TARGET_VSX)
13517
+ rs6000_constraints[RS6000_CONSTRAINT_ww] = FLOAT_REGS;
13519
+ if (TARGET_STFIWX)
13520
+ rs6000_constraints[RS6000_CONSTRAINT_wx] = FLOAT_REGS;
13522
+ if (TARGET_LFIWZX)
13523
+ rs6000_constraints[RS6000_CONSTRAINT_wz] = FLOAT_REGS;
13525
+ /* Set up the reload helper and direct move functions. */
13526
if (TARGET_VSX || TARGET_ALTIVEC)
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)
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;
13564
+ if (TARGET_P8_VECTOR)
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;
13571
+ if (TARGET_VSX_TIMODE)
13573
+ reg_addr[TImode].reload_store = CODE_FOR_reload_ti_di_store;
13574
+ reg_addr[TImode].reload_load = CODE_FOR_reload_ti_di_load;
13576
+ if (TARGET_DIRECT_MOVE)
13578
+ if (TARGET_POWERPC64)
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;
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;
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;
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)
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;
13642
+ if (TARGET_P8_VECTOR)
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;
13649
+ if (TARGET_VSX_TIMODE)
13651
+ reg_addr[TImode].reload_store = CODE_FOR_reload_ti_si_store;
13652
+ reg_addr[TImode].reload_load = CODE_FOR_reload_ti_si_load;
13657
@@ -2267,6 +2856,11 @@
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
13664
+ rs6000_setup_reg_addr_masks ();
13666
if (global_init_p || TARGET_DEBUG_TARGET)
13668
if (TARGET_DEBUG_REG)
13669
@@ -2369,16 +2963,19 @@
13671
rs6000_builtin_mask_calculate (void)
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));
13698
/* Override command line options. Mostly we process the processor type and
13699
@@ -2609,6 +3206,12 @@
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;
13709
/* Add some warnings for VSX. */
13712
@@ -2619,15 +3222,13 @@
13713
if (rs6000_isa_flags_explicit & OPTION_MASK_VSX)
13714
msg = N_("-mvsx requires hardware floating point");
13716
- rs6000_isa_flags &= ~ OPTION_MASK_VSX;
13718
+ rs6000_isa_flags &= ~ OPTION_MASK_VSX;
13719
+ rs6000_isa_flags_explicit |= OPTION_MASK_VSX;
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 @@
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);
13746
+ if (TARGET_DEBUG_REG || TARGET_DEBUG_TARGET)
13747
+ rs6000_print_isa_options (stderr, 0, "before defaults", rs6000_isa_flags);
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. */
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);
13762
+ if (TARGET_CRYPTO && !TARGET_ALTIVEC)
13764
+ if (rs6000_isa_flags_explicit & OPTION_MASK_CRYPTO)
13765
+ error ("-mcrypto requires -maltivec");
13766
+ rs6000_isa_flags &= ~OPTION_MASK_CRYPTO;
13769
+ if (TARGET_DIRECT_MOVE && !TARGET_VSX)
13771
+ if (rs6000_isa_flags_explicit & OPTION_MASK_DIRECT_MOVE)
13772
+ error ("-mdirect-move requires -mvsx");
13773
+ rs6000_isa_flags &= ~OPTION_MASK_DIRECT_MOVE;
13776
+ if (TARGET_P8_VECTOR && !TARGET_ALTIVEC)
13778
+ if (rs6000_isa_flags_explicit & OPTION_MASK_P8_VECTOR)
13779
+ error ("-mpower8-vector requires -maltivec");
13780
+ rs6000_isa_flags &= ~OPTION_MASK_P8_VECTOR;
13783
+ if (TARGET_P8_VECTOR && !TARGET_VSX)
13785
+ if (rs6000_isa_flags_explicit & OPTION_MASK_P8_VECTOR)
13786
+ error ("-mpower8-vector requires -mvsx");
13787
+ rs6000_isa_flags &= ~OPTION_MASK_P8_VECTOR;
13790
+ if (TARGET_VSX_TIMODE && !TARGET_VSX)
13792
+ if (rs6000_isa_flags_explicit & OPTION_MASK_VSX_TIMODE)
13793
+ error ("-mvsx-timode requires -mvsx");
13794
+ rs6000_isa_flags &= ~OPTION_MASK_VSX_TIMODE;
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)
13801
+ if ((rs6000_isa_flags_explicit & OPTION_MASK_QUAD_MEMORY) != 0)
13802
+ warning (0, N_("-mquad-memory requires 64-bit mode"));
13804
+ rs6000_isa_flags &= ~OPTION_MASK_QUAD_MEMORY;
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);
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;
13822
+ if (TARGET_DEBUG_REG || TARGET_DEBUG_TARGET)
13823
+ rs6000_print_isa_options (stderr, 0, "after defaults", rs6000_isa_flags);
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;
13832
+ if (TARGET_DEBUG_REG || TARGET_DEBUG_TARGET)
13833
+ rs6000_print_isa_options (stderr, 0, "before subtarget", rs6000_isa_flags);
13835
#ifdef SUBTARGET_OVERRIDE_OPTIONS
13836
SUBTARGET_OVERRIDE_OPTIONS;
13838
@@ -2800,6 +3482,9 @@
13839
SUB3TARGET_OVERRIDE_OPTIONS;
13842
+ if (TARGET_DEBUG_REG || TARGET_DEBUG_TARGET)
13843
+ rs6000_print_isa_options (stderr, 0, "after subtarget", rs6000_isa_flags);
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 @@
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;
13878
@@ -3102,6 +3790,10 @@
13879
rs6000_cost = &power7_cost;
13882
+ case PROCESSOR_POWER8:
13883
+ rs6000_cost = &power8_cost;
13886
case PROCESSOR_PPCA2:
13887
rs6000_cost = &ppca2_cost;
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))
13898
return align_loops_log;
13899
@@ -3813,6 +4506,22 @@
13900
enum built_in_function fn = DECL_FUNCTION_CODE (fndecl);
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)
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];
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];
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)
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];
13942
case BUILT_IN_SQRT:
13943
if (VECTOR_UNIT_VSX_P (V2DFmode)
13944
&& out_mode == DFmode && out_n == 2
13945
@@ -4043,7 +4768,11 @@
13949
- if (DEFAULT_ABI == ABI_AIX || (TARGET_ELF && flag_pic == 2))
13950
+ if (DEFAULT_ABI == ABI_ELFv2)
13951
+ fprintf (file, "\t.abiversion 2\n");
13953
+ if (DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_ELFv2
13954
+ || (TARGET_ELF && flag_pic == 2))
13956
switch_to_section (toc_section);
13957
switch_to_section (text_section);
13958
@@ -4274,15 +5003,16 @@
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)
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)
13971
desired_val = msb_val;
13973
- if (desired_val != const_vector_elt_as_int (op, i))
13974
+ if (desired_val != const_vector_elt_as_int (op, elt))
13978
@@ -4698,8 +5428,11 @@
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));
13986
- emit_insn (gen_vsx_xscvdpsp_scalar (freg, sreg));
13988
emit_insn (gen_vsx_xxspltw_v4sf (target, freg, const0_rtx));
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)
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,
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)));
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)),
14021
+ if (BYTES_BIG_ENDIAN)
14022
+ x = gen_rtx_UNSPEC (mode,
14023
+ gen_rtvec (3, target, reg,
14024
+ force_reg (V16QImode, x)),
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);
14036
+ /* Permute with operands reversed and adjusted selector. */
14037
+ x = gen_rtx_UNSPEC (mode, gen_rtvec (3, reg, target, tmp),
14041
emit_insn (gen_rtx_SET (VOIDmode, target, x));
14044
@@ -4938,7 +5691,7 @@
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))
14061
@@ -5087,6 +5841,72 @@
14062
|| (REG_P (op1) && INT_REGNO_P (REGNO (op1))));
14065
+/* Return true if this is a move direct operation between GPR registers and
14066
+ floating point/VSX registers. */
14069
+direct_move_p (rtx op0, rtx op1)
14071
+ int regno0, regno1;
14073
+ if (!REG_P (op0) || !REG_P (op1))
14076
+ if (!TARGET_DIRECT_MOVE && !TARGET_MFPGPR)
14079
+ regno0 = REGNO (op0);
14080
+ regno1 = REGNO (op1);
14081
+ if (regno0 >= FIRST_PSEUDO_REGISTER || regno1 >= FIRST_PSEUDO_REGISTER)
14084
+ if (INT_REGNO_P (regno0))
14085
+ return (TARGET_DIRECT_MOVE) ? VSX_REGNO_P (regno1) : FP_REGNO_P (regno1);
14087
+ else if (INT_REGNO_P (regno1))
14089
+ if (TARGET_MFPGPR && FP_REGNO_P (regno0))
14092
+ else if (TARGET_DIRECT_MOVE && VSX_REGNO_P (regno0))
14099
+/* Return true if this is a load or store quad operation. */
14102
+quad_load_store_p (rtx op0, rtx op1)
14106
+ if (!TARGET_QUAD_MEMORY)
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));
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)));
14121
+ if (TARGET_DEBUG_ADDR)
14123
+ fprintf (stderr, "\n========== quad_load_store, return %s\n",
14124
+ ret ? "true" : "false");
14125
+ debug_rtx (gen_rtx_SET (VOIDmode, op0, op1));
14131
/* Given an address, return a constant offset term if one exists. */
14134
@@ -5170,7 +5990,11 @@
14138
- /* AltiVec/VSX vector modes. Only reg+reg addressing is valid. */
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
14144
if (VECTOR_MEM_ALTIVEC_OR_VSX_P (mode))
14147
@@ -5184,6 +6008,13 @@
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)
14161
@@ -5416,7 +6247,7 @@
14163
/* If we are using VSX scalar loads, restrict ourselves to reg+reg
14165
- if (mode == DFmode && VECTOR_MEM_VSX_P (DFmode))
14166
+ if (VECTOR_MEM_VSX_P (mode))
14170
@@ -5430,6 +6261,7 @@
14175
if (TARGET_E500_DOUBLE)
14176
return (SPE_CONST_OFFSET_OK (offset)
14177
&& SPE_CONST_OFFSET_OK (offset + 8));
14178
@@ -5526,7 +6358,7 @@
14180
if (TARGET_ELF || TARGET_MACHO)
14182
- if (DEFAULT_ABI != ABI_AIX && DEFAULT_ABI != ABI_DARWIN && flag_pic)
14183
+ if (DEFAULT_ABI == ABI_V4 && flag_pic)
14187
@@ -5582,8 +6414,11 @@
14188
if (GET_CODE (x) == PLUS && XEXP (x, 1) == const0_rtx)
14189
return force_reg (Pmode, XEXP (x, 0));
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 @@
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. */
14214
@@ -6099,10 +6935,13 @@
14215
1, const0_rtx, Pmode);
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)
14224
+ if (TARGET_64BIT)
14225
+ insn = gen_tls_gd_aix64 (r3, got, addr, tga, const0_rtx);
14227
+ insn = gen_tls_gd_aix32 (r3, got, addr, tga, const0_rtx);
14229
else if (DEFAULT_ABI == ABI_V4)
14230
insn = gen_tls_gd_sysvsi (r3, got, addr, tga, const0_rtx);
14232
@@ -6121,10 +6960,13 @@
14233
1, const0_rtx, Pmode);
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)
14242
+ if (TARGET_64BIT)
14243
+ insn = gen_tls_ld_aix64 (r3, got, tga, const0_rtx);
14245
+ insn = gen_tls_ld_aix32 (r3, got, tga, const0_rtx);
14247
else if (DEFAULT_ABI == ABI_V4)
14248
insn = gen_tls_ld_sysvsi (r3, got, tga, const0_rtx);
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)))
14257
HOST_WIDE_INT val = INTVAL (XEXP (x, 1));
14258
HOST_WIDE_INT low = ((val & 0xffff) ^ 0x8000) - 0x8000;
14259
@@ -6369,7 +7211,7 @@
14261
if (GET_CODE (x) == SYMBOL_REF
14263
- && VECTOR_MEM_NONE_P (mode)
14264
+ && (!VECTOR_MODE_P (mode) || VECTOR_MEM_NONE_P (mode))
14265
&& !SPE_VECTOR_MODE (mode)
14267
&& DEFAULT_ABI == ABI_DARWIN
14268
@@ -6395,6 +7237,8 @@
14269
mem is sufficiently aligned. */
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 @@
14279
if (legitimate_indirect_address_p (x, reg_ok_strict))
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))
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))
14295
if (virtual_stack_registers_memory_p (x))
14296
@@ -6533,6 +7371,13 @@
14298
&& legitimate_constant_pool_address_p (x, mode, reg_ok_strict))
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)
14307
/* If not REG_OK_STRICT (before reload) let pass any stack offset. */
14308
if (! reg_ok_strict
14310
@@ -6544,31 +7389,20 @@
14312
if (rs6000_legitimate_offset_address_p (mode, x, reg_ok_strict, false))
14314
- if (mode != TImode
14315
- && mode != TFmode
14316
+ if (mode != TFmode
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))
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))
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);
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),
14356
+ (reload_completed
14358
+ : (reload_in_progress ? "progress" : "before")),
14359
GET_RTX_NAME (GET_CODE (x)));
14362
@@ -6758,7 +7595,7 @@
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;
14370
if (DEFAULT_ABI == ABI_V4
14371
@@ -7006,7 +7843,7 @@
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). */
14379
rs6000_eliminate_indexed_memrefs (rtx operands[2])
14380
@@ -7031,6 +7868,107 @@
14381
copy_addr_to_reg (XEXP (operands[1], 0)));
14384
+/* Generate a vector of constants to permute MODE for a little-endian
14385
+ storage operation by swapping the two halves of a vector. */
14387
+rs6000_const_vec (enum machine_mode mode)
14409
+ gcc_unreachable();
14412
+ v = rtvec_alloc (subparts);
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);
14422
+/* Generate a permute rtx that represents an lxvd2x, stxvd2x, or xxpermdi
14423
+ for a VSX load or store operation. */
14425
+rs6000_gen_le_vsx_permute (rtx source, enum machine_mode mode)
14427
+ rtx par = gen_rtx_PARALLEL (VOIDmode, rs6000_const_vec (mode));
14428
+ return gen_rtx_VEC_SELECT (mode, source, par);
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. */
14435
+rs6000_emit_le_vsx_load (rtx dest, rtx source, enum machine_mode mode)
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));
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. */
14448
+rs6000_emit_le_vsx_store (rtx dest, rtx source, enum machine_mode mode)
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));
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. */
14464
+rs6000_emit_le_vsx_move (rtx dest, rtx source, enum machine_mode mode)
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)));
14472
+ if (MEM_P (source))
14474
+ gcc_assert (REG_P (dest));
14475
+ rs6000_emit_le_vsx_load (dest, source, mode);
14479
+ if (!REG_P (source))
14480
+ source = force_reg (mode, source);
14481
+ rs6000_emit_le_vsx_store (dest, source, mode);
14485
/* Emit a move from SOURCE to DEST in mode MODE. */
14487
rs6000_emit_move (rtx dest, rtx source, enum machine_mode mode)
14488
@@ -7151,6 +8089,7 @@
14490
if (reload_in_progress
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 @@
14498
else if (INT_REGNO_P (REGNO (operands[1])))
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]));
14507
@@ -7175,6 +8116,7 @@
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))
14514
if (FP_REGNO_P (REGNO (operands[0])))
14515
@@ -7185,7 +8127,9 @@
14517
else if (INT_REGNO_P (REGNO (operands[0])))
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));
14526
@@ -7388,6 +8332,11 @@
14530
+ if (!VECTOR_MEM_VSX_P (TImode))
14531
+ rs6000_eliminate_indexed_memrefs (operands);
14535
rs6000_eliminate_indexed_memrefs (operands);
14538
@@ -7426,18 +8375,231 @@
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)
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 \
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
14564
+rs6000_aggregate_candidate (const_tree type, enum machine_mode *modep)
14566
+ enum machine_mode mode;
14567
+ HOST_WIDE_INT size;
14569
+ switch (TREE_CODE (type))
14572
+ mode = TYPE_MODE (type);
14573
+ if (!SCALAR_FLOAT_MODE_P (mode))
14576
+ if (*modep == VOIDmode)
14579
+ if (*modep == mode)
14584
+ case COMPLEX_TYPE:
14585
+ mode = TYPE_MODE (TREE_TYPE (type));
14586
+ if (!SCALAR_FLOAT_MODE_P (mode))
14589
+ if (*modep == VOIDmode)
14592
+ if (*modep == mode)
14597
+ case VECTOR_TYPE:
14598
+ if (!TARGET_ALTIVEC_ABI || !TARGET_ALTIVEC)
14601
+ /* Use V4SImode as representative of all 128-bit vector types. */
14602
+ size = int_size_in_bytes (type);
14612
+ if (*modep == VOIDmode)
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)
14626
+ tree index = TYPE_DOMAIN (type);
14628
+ /* Can't handle incomplete types. */
14629
+ if (!COMPLETE_TYPE_P (type))
14632
+ count = rs6000_aggregate_candidate (TREE_TYPE (type), modep);
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)
14642
+ count *= (1 + tree_low_cst (TYPE_MAX_VALUE (index), 1)
14643
+ - tree_low_cst (TYPE_MIN_VALUE (index), 1));
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)))
14654
+ case RECORD_TYPE:
14660
+ /* Can't handle incomplete types. */
14661
+ if (!COMPLETE_TYPE_P (type))
14664
+ for (field = TYPE_FIELDS (type); field; field = TREE_CHAIN (field))
14666
+ if (TREE_CODE (field) != FIELD_DECL)
14669
+ sub_count = rs6000_aggregate_candidate (TREE_TYPE (field), modep);
14670
+ if (sub_count < 0)
14672
+ count += sub_count;
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)))
14685
+ case QUAL_UNION_TYPE:
14687
+ /* These aren't very interesting except in a degenerate case. */
14692
+ /* Can't handle incomplete types. */
14693
+ if (!COMPLETE_TYPE_P (type))
14696
+ for (field = TYPE_FIELDS (type); field; field = TREE_CHAIN (field))
14698
+ if (TREE_CODE (field) != FIELD_DECL)
14701
+ sub_count = rs6000_aggregate_candidate (TREE_TYPE (field), modep);
14702
+ if (sub_count < 0)
14704
+ count = count > sub_count ? count : sub_count;
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)))
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.
14728
+ Otherwise, set *ELT_MODE to MODE and *N_ELTS to 1, and return FALSE. */
14731
+rs6000_discover_homogeneous_aggregate (enum machine_mode mode, const_tree type,
14732
+ enum machine_mode *elt_mode,
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))
14741
+ enum machine_mode field_mode = VOIDmode;
14742
+ int field_count = rs6000_aggregate_candidate (type, &field_mode);
14744
+ if (field_count > 0)
14746
+ int n_regs = (SCALAR_FLOAT_MODE_P (field_mode)?
14747
+ (GET_MODE_SIZE (field_mode) + 7) >> 3 : 1);
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)
14754
+ *elt_mode = field_mode;
14756
+ *n_elts = field_count;
14763
+ *elt_mode = mode;
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. */
14776
+ /* The ELFv2 ABI returns homogeneous VFP aggregates in registers */
14777
+ if (rs6000_discover_homogeneous_aggregate (TYPE_MODE (type), type,
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)
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 @@
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. */
14798
+rs6000_return_in_msb (const_tree valtype)
14800
+ return (DEFAULT_ABI == ABI_ELFv2
14801
+ && BYTES_BIG_ENDIAN
14802
+ && AGGREGATE_TYPE_P (valtype)
14803
+ && FUNCTION_ARG_PADDING (TYPE_MODE (valtype), valtype) == upward);
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 @@
14811
rs6000_must_pass_in_stack (enum machine_mode mode, const_tree type)
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);
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)
14822
+ enum machine_mode elt_mode;
14825
+ rs6000_discover_homogeneous_aggregate (mode, type, &elt_mode, &n_elts);
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))
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))
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))
14845
&& type && TYPE_ALIGN (type) > 64)
14847
@@ -7762,6 +8953,16 @@
14848
return PARM_BOUNDARY;
14851
+/* The offset in words to the start of the parameter save area. */
14853
+static unsigned int
14854
+rs6000_parm_offset (void)
14856
+ return (DEFAULT_ABI == ABI_V4 ? 2
14857
+ : DEFAULT_ABI == ABI_ELFv2 ? 4
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. */
14864
@@ -7770,11 +8971,9 @@
14865
unsigned int nwords)
14867
unsigned int align;
14868
- unsigned int parm_offset;
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);
14876
/* Compute the size (in words) of a function argument. */
14877
@@ -7881,7 +9080,7 @@
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))
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 @@
14888
cum->words += n_fpregs;
14890
- else if (USE_ALTIVEC_FOR_ARG_P (cum, mode, type, 1))
14891
+ else if (USE_ALTIVEC_FOR_ARG_P (cum, mode, 1))
14893
rs6000_darwin64_record_arg_advance_flush (cum, bitpos, 0);
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)
14899
+ enum machine_mode elt_mode;
14902
+ rs6000_discover_homogeneous_aggregate (mode, type, &elt_mode, &n_elts);
14904
/* Only tick off an argument if we're not recursing. */
14906
cum->nargs_prototype--;
14907
@@ -7979,15 +9183,16 @@
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)))
14916
bool stack = false;
14918
- if (USE_ALTIVEC_FOR_ARG_P (cum, mode, type, named))
14919
+ if (USE_ALTIVEC_FOR_ARG_P (cum, elt_mode, named))
14922
+ cum->vregno += n_elts;
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)
14934
|| (cum->stdarg && DEFAULT_ABI != ABI_V4))
14937
@@ -8007,15 +9213,13 @@
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. */
14954
- align = (2 - cum->words) & 3;
14955
+ align = -(rs6000_parm_offset () + cum->words) & 3;
14957
align = cum->words & 1;
14958
cum->words += align + rs6000_arg_size (mode, type);
14959
@@ -8140,15 +9344,15 @@
14961
cum->words = align_words + n_words;
14963
- if (SCALAR_FLOAT_MODE_P (mode)
14964
+ if (SCALAR_FLOAT_MODE_P (elt_mode)
14965
&& TARGET_HARD_FLOAT && TARGET_FPRS)
14967
/* _Decimal128 must be passed in an even/odd float register pair.
14968
This assumes that the register number is odd when fregno is
14970
- if (mode == TDmode && (cum->fregno % 2) == 1)
14971
+ if (elt_mode == TDmode && (cum->fregno % 2) == 1)
14973
- cum->fregno += (GET_MODE_SIZE (mode) + 7) >> 3;
14974
+ cum->fregno += n_elts * ((GET_MODE_SIZE (elt_mode) + 7) >> 3);
14977
if (TARGET_DEBUG_ARG)
14978
@@ -8358,7 +9562,7 @@
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))
14985
unsigned n_fpreg = (GET_MODE_SIZE (mode) + 7) >> 3;
14987
@@ -8386,7 +9590,7 @@
14988
if (mode == TFmode || mode == TDmode)
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))
14994
rs6000_darwin64_record_arg_flush (cum, bitpos, rvec, k);
14996
@@ -8503,6 +9707,84 @@
14997
return gen_rtx_PARALLEL (mode, gen_rtvec_v (k, rvec));
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. */
15006
+rs6000_psave_function_arg (enum machine_mode mode, const_tree type,
15007
+ int align_words, rtx *rvec)
15011
+ if (align_words < GP_ARG_NUM_REG)
15013
+ int n_words = rs6000_arg_size (mode, type);
15015
+ if (align_words + n_words > GP_ARG_NUM_REG
15016
+ || mode == BLKmode
15017
+ || (TARGET_32BIT && TARGET_POWERPC64))
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;
15024
+ if (align_words + n_words > GP_ARG_NUM_REG)
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);
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);
15039
+ while (++align_words < GP_ARG_NUM_REG && --n_words != 0);
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);
15050
+ /* It's entirely in memory. */
15051
+ rvec[k++] = gen_rtx_EXPR_LIST (VOIDmode, NULL_RTX, const0_rtx);
15057
+/* RVEC is a vector of K components of an argument of mode MODE.
15058
+ Construct the final function_arg return value from it. */
15061
+rs6000_finish_function_arg (enum machine_mode mode, rtx *rvec, int k)
15063
+ gcc_assert (k >= 1);
15065
+ /* Avoid returning a PARALLEL in the trivial cases. */
15068
+ if (XEXP (rvec[0], 0) == NULL_RTX)
15071
+ if (GET_MODE (XEXP (rvec[0], 0)) == mode)
15072
+ return XEXP (rvec[0], 0);
15075
+ return gen_rtx_PARALLEL (mode, gen_rtvec_v (k, rvec));
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 @@
15083
CUMULATIVE_ARGS *cum = get_cumulative_args (cum_v);
15084
enum rs6000_abi abi = DEFAULT_ABI;
15085
+ enum machine_mode elt_mode;
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);
15094
+ rs6000_discover_homogeneous_aggregate (mode, type, &elt_mode, &n_elts);
15096
if (TARGET_MACHO && rs6000_darwin64_struct_check_p (mode, type))
15098
rtx rslt = rs6000_darwin64_record_arg (cum, type, named, /*retval= */false);
15099
@@ -8571,33 +9857,30 @@
15100
/* Else fall through to usual handling. */
15103
- if (USE_ALTIVEC_FOR_ARG_P (cum, mode, type, named))
15104
- if (TARGET_64BIT && ! cum->prototype)
15106
- /* Vector parameters get passed in vector register
15107
- and also in GPRs or memory, in absence of prototype. */
15110
- align_words = (cum->words + 1) & ~1;
15111
+ if (USE_ALTIVEC_FOR_ARG_P (cum, elt_mode, named))
15113
+ rtx rvec[GP_ARG_NUM_REG + AGGR_ARG_NUM_REG + 1];
15117
- if (align_words >= GP_ARG_NUM_REG)
15123
- slot = gen_rtx_REG (mode, GP_ARG_MIN_REG + align_words);
15125
- return gen_rtx_PARALLEL (mode,
15127
- gen_rtx_EXPR_LIST (VOIDmode,
15128
- slot, const0_rtx),
15129
- gen_rtx_EXPR_LIST (VOIDmode,
15130
- gen_rtx_REG (mode, cum->vregno),
15134
- return gen_rtx_REG (mode, cum->vregno);
15135
+ /* Do we also need to pass this argument in the parameter
15137
+ if (TARGET_64BIT && ! cum->prototype)
15139
+ int align_words = (cum->words + 1) & ~1;
15140
+ k = rs6000_psave_function_arg (mode, type, align_words, rvec);
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++)
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);
15151
+ return rs6000_finish_function_arg (mode, rvec, k);
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;
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. */
15171
- align = (2 - cum->words) & 3;
15172
+ align = -(rs6000_parm_offset () + cum->words) & 3;
15174
align = cum->words & 1;
15175
align_words = cum->words + align;
15176
@@ -8696,101 +9979,50 @@
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)
15184
- if (USE_FP_FOR_ARG_P (cum, mode, type))
15185
+ if (USE_FP_FOR_ARG_P (cum, elt_mode))
15187
- rtx rvec[GP_ARG_NUM_REG + 1];
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];
15196
+ unsigned long n_fpreg = (GET_MODE_SIZE (elt_mode) + 7) >> 3;
15198
- if (cum->fregno + n_fpreg > FP_ARG_MAX_REG + 1)
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
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);
15212
- /* Long double or _Decimal128 split over regs and memory. */
15213
- fmode = DECIMAL_FLOAT_MODE_P (fmode) ? DDmode : DFmode;
15216
- /* Do we also need to pass this arg in the parameter save
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)));
15224
- if (!needs_psave && mode == fmode)
15225
- return gen_rtx_REG (fmode, cum->fregno);
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++)
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)
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;
15247
- if (align_words + n_words > GP_ARG_NUM_REG
15248
- || (TARGET_32BIT && TARGET_POWERPC64))
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;
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
15262
- rvec[k++] = gen_rtx_EXPR_LIST (VOIDmode, NULL_RTX,
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);
15271
- while (++align_words < GP_ARG_NUM_REG && --n_words != 0);
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);
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);
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);
15292
- return gen_rtx_PARALLEL (mode, gen_rtvec_v (k, rvec));
15293
+ return rs6000_finish_function_arg (mode, rvec, k);
15295
else if (align_words < GP_ARG_NUM_REG)
15297
if (TARGET_32BIT && TARGET_POWERPC64)
15298
return rs6000_mixed_function_arg (mode, type, align_words);
15300
- if (mode == BLKmode)
15303
return gen_rtx_REG (mode, GP_ARG_MIN_REG + align_words);
15306
@@ -8809,42 +10041,62 @@
15307
tree type, bool named)
15309
CUMULATIVE_ARGS *cum = get_cumulative_args (cum_v);
15310
+ bool passed_in_gprs = true;
15313
+ enum machine_mode elt_mode;
15316
+ rs6000_discover_homogeneous_aggregate (mode, type, &elt_mode, &n_elts);
15318
if (DEFAULT_ABI == ABI_V4)
15321
- if (USE_ALTIVEC_FOR_ARG_P (cum, mode, type, named)
15322
- && cum->nargs_prototype >= 0)
15324
+ if (USE_ALTIVEC_FOR_ARG_P (cum, elt_mode, named))
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)
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;
15339
/* In this complicated case we just disable the partial_nregs code. */
15340
if (TARGET_MACHO && rs6000_darwin64_struct_check_p (mode, type))
15343
align_words = rs6000_parm_start (mode, type, cum->words);
15345
- if (USE_FP_FOR_ARG_P (cum, mode, type))
15346
+ if (USE_FP_FOR_ARG_P (cum, elt_mode))
15348
+ unsigned long n_fpreg = (GET_MODE_SIZE (elt_mode) + 7) >> 3;
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. */
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)))
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)
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)));
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);
15383
@@ -8925,6 +10177,139 @@
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. */
15392
+rs6000_parm_needs_stack (cumulative_args_t args_so_far, tree type)
15394
+ enum machine_mode mode;
15398
+ /* Catch errors. */
15399
+ if (type == NULL || type == error_mark_node)
15402
+ /* Handle types with no storage requirement. */
15403
+ if (TYPE_MODE (type) == VOIDmode)
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)));
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));
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);
15421
+ /* Find mode as it is passed by the ABI. */
15422
+ unsignedp = TYPE_UNSIGNED (type);
15423
+ mode = promote_mode (type, TYPE_MODE (type), &unsignedp);
15425
+ /* If we must pass in stack, we need a stack. */
15426
+ if (rs6000_must_pass_in_stack (mode, type))
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)
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)
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)
15443
+ /* Update info on where next arg arrives in registers. */
15444
+ rs6000_function_arg_advance (args_so_far, mode, type, true);
15448
+/* Return true if FUN has no prototype, has a variable argument
15449
+ list, or passes any parameter in memory. */
15452
+rs6000_function_parms_need_stack (tree fun)
15454
+ function_args_iterator args_iter;
15456
+ CUMULATIVE_ARGS args_so_far_v;
15457
+ cumulative_args_t args_so_far;
15460
+ /* Must be a libcall, all of which only use reg parms. */
15462
+ if (!TYPE_P (fun))
15463
+ fun = TREE_TYPE (fun);
15465
+ /* Varargs functions need the parameter save area. */
15466
+ if (!prototype_p (fun) || stdarg_p (fun))
15469
+ INIT_CUMULATIVE_INCOMING_ARGS (args_so_far_v, fun, NULL_RTX);
15470
+ args_so_far = pack_cumulative_args (&args_so_far_v);
15472
+ if (aggregate_value_p (TREE_TYPE (fun), fun))
15474
+ tree type = build_pointer_type (TREE_TYPE (fun));
15475
+ rs6000_parm_needs_stack (args_so_far, type);
15478
+ FOREACH_FUNCTION_ARGS (fun, arg_type, args_iter)
15479
+ if (rs6000_parm_needs_stack (args_so_far, arg_type))
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. */
15492
+rs6000_reg_parm_stack_space (tree fun)
15494
+ int reg_parm_stack_space;
15496
+ switch (DEFAULT_ABI)
15499
+ reg_parm_stack_space = 0;
15504
+ reg_parm_stack_space = TARGET_64BIT ? 64 : 32;
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;
15513
+ reg_parm_stack_space = 0;
15517
+ return reg_parm_stack_space;
15521
rs6000_move_block_from_reg (int regno, rtx x, int nregs)
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. */
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)))
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 },
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 },
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 },
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 @@
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"
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
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 },
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)
15714
+static const struct builtin_description bdesc_htm[] =
15716
+#include "rs6000-builtin.def"
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
15730
/* Return true if a builtin function is overloaded. */
15732
rs6000_overloaded_builtin_p (enum rs6000_builtins fncode)
15733
@@ -10351,7 +11788,198 @@
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)
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;
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)
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;
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)
15778
+ return (TARGET_64BIT) ? CODE_FOR_htm_mfspr_di : CODE_FOR_htm_mfspr_si;
15780
+ return (TARGET_64BIT) ? CODE_FOR_htm_mtspr_di : CODE_FOR_htm_mtspr_si;
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. */
15786
+htm_expand_builtin (tree exp, rtx target, bool * expandedp)
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;
15794
+ *expandedp = false;
15796
+ /* Expand the HTM builtins. */
15798
+ for (i = 0; i < ARRAY_SIZE (bdesc_htm); i++, d++)
15799
+ if (d->code == fcode)
15801
+ rtx op[MAX_HTM_OPERANDS], pat;
15804
+ call_expr_arg_iterator iter;
15805
+ unsigned attr = rs6000_builtin_info[fcode].attr;
15806
+ enum insn_code icode = d->icode;
15808
+ if (attr & RS6000_BTC_SPR)
15809
+ icode = rs6000_htm_spr_icode (nonvoid);
15813
+ enum machine_mode tmode = insn_data[icode].operand[0].mode;
15815
+ || GET_MODE (target) != tmode
15816
+ || !(*insn_data[icode].operand[0].predicate) (target, tmode))
15817
+ target = gen_reg_rtx (tmode);
15818
+ op[nopnds++] = target;
15821
+ FOR_EACH_CALL_EXPR_ARG (arg, iter, exp)
15823
+ const struct insn_operand_data *insn_op;
15825
+ if (arg == error_mark_node || nopnds >= MAX_HTM_OPERANDS)
15828
+ insn_op = &insn_data[icode].operand[nopnds];
15830
+ op[nopnds] = expand_normal (arg);
15832
+ if (!(*insn_op->predicate) (op[nopnds], insn_op->mode))
15834
+ if (!strcmp (insn_op->constraint, "n"))
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);
15840
+ error ("argument %d is an unsigned literal that is "
15841
+ "out of range", arg_num);
15842
+ return const0_rtx;
15844
+ op[nopnds] = copy_to_mode_reg (insn_op->mode, op[nopnds]);
15850
+ /* Handle the builtins for extended mnemonics. These accept
15851
+ no arguments, but map to builtins that take arguments. */
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;
15861
+ case HTM_BUILTIN_TSUSPEND: /* Alias for: tsr. 0 */
15862
+ op[nopnds++] = GEN_INT (0);
15863
+#ifdef ENABLE_CHECKING
15864
+ attr |= RS6000_BTC_UNARY;
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)
15875
+ op[nopnds++] = gen_rtx_CONST_INT (Pmode, htm_spr_num (fcode));
15876
+ op[nopnds++] = gen_rtx_REG (Pmode, htm_spr_regno (fcode));
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;
15892
+ gcc_assert (nopnds == expected_nopnds && nopnds <= MAX_HTM_OPERANDS);
15898
+ pat = GEN_FCN (icode) (NULL_RTX);
15901
+ pat = GEN_FCN (icode) (op[0]);
15904
+ pat = GEN_FCN (icode) (op[0], op[1]);
15907
+ pat = GEN_FCN (icode) (op[0], op[1], op[2]);
15910
+ pat = GEN_FCN (icode) (op[0], op[1], op[2], op[3]);
15913
+ gcc_unreachable ();
15919
+ *expandedp = true;
15922
+ return const0_rtx;
15929
rs6000_expand_ternop_builtin (enum insn_code icode, tree exp, rtx target)
15932
@@ -10427,7 +12055,28 @@
15936
+ else if (icode == CODE_FOR_crypto_vshasigmaw
15937
+ || icode == CODE_FOR_crypto_vshasigmad)
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))
15945
+ error ("argument 2 must be 0 or 1");
15946
+ return const0_rtx;
15949
+ STRIP_NOPS (arg2);
15950
+ if (TREE_CODE (arg2) != INTEGER_CST
15951
+ || !IN_RANGE (TREE_INT_CST_LOW (arg2), 0, 15))
15953
+ error ("argument 3 must be in the range 0..15");
15954
+ return const0_rtx;
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:
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;
15980
@@ -11590,7 +13242,14 @@
15986
+ ret = htm_expand_builtin (exp, target, &success);
15992
gcc_assert (TARGET_ALTIVEC || TARGET_VSX || TARGET_SPE || TARGET_PAIRED_FLOAT);
15994
/* Handle simple unary operations. */
15995
@@ -11772,6 +13431,9 @@
15996
spe_init_builtins ();
15997
if (TARGET_EXTRA_BUILTINS)
15998
altivec_init_builtins ();
16000
+ htm_init_builtins ();
16002
if (TARGET_EXTRA_BUILTINS || TARGET_SPE || TARGET_PAIRED_FLOAT)
16003
rs6000_common_init_builtins ();
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 @@
16027
type = int_ftype_int_opaque_opaque;
16030
+ type = int_ftype_int_v2di_v2di;
16033
type = int_ftype_int_v4si_v4si;
16035
@@ -12367,6 +14038,9 @@
16040
+ type = v2di_ftype_v2di;
16043
type = v4si_ftype_v4si;
16045
@@ -12499,6 +14173,79 @@
16046
def_builtin ("__builtin_vec_ext_v2di", ftype, VSX_BUILTIN_VEC_EXT_V2DI);
16050
+htm_init_builtins (void)
16052
+ HOST_WIDE_INT builtin_mask = rs6000_builtin_mask;
16053
+ const struct builtin_description *d;
16057
+ for (i = 0; i < ARRAY_SIZE (bdesc_htm); i++, d++)
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);
16065
+ tree argtype = (attr & RS6000_BTC_SPR) ? long_unsigned_type_node
16066
+ : unsigned_type_node;
16068
+ if ((mask & builtin_mask) != mask)
16070
+ if (TARGET_DEBUG_BUILTIN)
16071
+ fprintf (stderr, "htm_builtin, skip binary %s\n", d->name);
16075
+ if (d->name == 0)
16077
+ if (TARGET_DEBUG_BUILTIN)
16078
+ fprintf (stderr, "htm_builtin, bdesc_htm[%ld] no name\n",
16079
+ (long unsigned) i);
16083
+ op[nopnds++] = (void_func) ? void_type_node : argtype;
16085
+ if (attr_args == RS6000_BTC_UNARY)
16086
+ op[nopnds++] = argtype;
16087
+ else if (attr_args == RS6000_BTC_BINARY)
16089
+ op[nopnds++] = argtype;
16090
+ op[nopnds++] = argtype;
16092
+ else if (attr_args == RS6000_BTC_TERNARY)
16094
+ op[nopnds++] = argtype;
16095
+ op[nopnds++] = argtype;
16096
+ op[nopnds++] = argtype;
16102
+ type = build_function_type_list (op[0], NULL_TREE);
16105
+ type = build_function_type_list (op[0], op[1], NULL_TREE);
16108
+ type = build_function_type_list (op[0], op[1], op[2], NULL_TREE);
16111
+ type = build_function_type_list (op[0], op[1], op[2], op[3],
16115
+ gcc_unreachable ();
16118
+ def_builtin (d->name, type, d->code);
16122
/* Hash function for builtin functions with up to 3 arguments and a return
16125
@@ -12572,11 +14319,27 @@
16126
are type correct. */
16129
+ /* unsigned 1 argument functions. */
16130
+ case CRYPTO_BUILTIN_VSBOX:
16131
+ case P8V_BUILTIN_VGBBD:
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:
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:
16168
@@ -12740,9 +14511,24 @@
16171
enum insn_code icode = d->icode;
16172
- if (d->name == 0 || icode == CODE_FOR_nothing)
16174
+ if (d->name == 0)
16176
+ if (TARGET_DEBUG_BUILTIN)
16177
+ fprintf (stderr, "rs6000_builtin, bdesc_3arg[%ld] no name\n",
16178
+ (long unsigned)i);
16183
+ if (icode == CODE_FOR_nothing)
16185
+ if (TARGET_DEBUG_BUILTIN)
16186
+ fprintf (stderr, "rs6000_builtin, skip ternary %s (no code)\n",
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 @@
16198
enum insn_code icode = d->icode;
16199
- if (d->name == 0 || icode == CODE_FOR_nothing)
16201
+ if (d->name == 0)
16203
+ if (TARGET_DEBUG_BUILTIN)
16204
+ fprintf (stderr, "rs6000_builtin, bdesc_2arg[%ld] no name\n",
16205
+ (long unsigned)i);
16210
+ if (icode == CODE_FOR_nothing)
16212
+ if (TARGET_DEBUG_BUILTIN)
16213
+ fprintf (stderr, "rs6000_builtin, skip binary %s (no code)\n",
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 @@
16225
enum insn_code icode = d->icode;
16226
- if (d->name == 0 || icode == CODE_FOR_nothing)
16228
+ if (d->name == 0)
16230
+ if (TARGET_DEBUG_BUILTIN)
16231
+ fprintf (stderr, "rs6000_builtin, bdesc_1arg[%ld] no name\n",
16232
+ (long unsigned)i);
16237
+ if (icode == CODE_FOR_nothing)
16239
+ if (TARGET_DEBUG_BUILTIN)
16240
+ fprintf (stderr, "rs6000_builtin, skip unary %s (no code)\n",
16246
mode0 = insn_data[icode].operand[0].mode;
16247
mode1 = insn_data[icode].operand[1].mode;
16249
@@ -13631,7 +15447,7 @@
16250
static bool eliminated = false;
16253
- if (mode != SDmode)
16254
+ if (mode != SDmode || TARGET_NO_SDMODE_STACK)
16255
ret = assign_stack_local (mode, GET_MODE_SIZE (mode), 0);
16258
@@ -13690,31 +15506,228 @@
16262
-enum reload_reg_type {
16263
- GPR_REGISTER_TYPE,
16264
- VECTOR_REGISTER_TYPE,
16265
- OTHER_REGISTER_TYPE
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
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)
16278
+ HOST_WIDE_INT regno;
16279
+ enum reg_class rclass;
16281
+ if (GET_CODE (reg) == SUBREG)
16282
+ reg = SUBREG_REG (reg);
16284
+ if (!REG_P (reg))
16285
+ return NO_REG_TYPE;
16287
+ regno = REGNO (reg);
16288
+ if (regno >= FIRST_PSEUDO_REGISTER)
16290
- case GENERAL_REGS:
16292
- return GPR_REGISTER_TYPE;
16293
+ if (!lra_in_progress && !reload_in_progress && !reload_completed)
16294
+ return PSEUDO_REG_TYPE;
16297
- case ALTIVEC_REGS:
16299
- return VECTOR_REGISTER_TYPE;
16300
+ regno = true_regnum (reg);
16301
+ if (regno < 0 || regno >= FIRST_PSEUDO_REGISTER)
16302
+ return PSEUDO_REG_TYPE;
16306
- return OTHER_REGISTER_TYPE;
16307
+ gcc_assert (regno >= 0);
16309
+ if (is_altivec && ALTIVEC_REGNO_P (regno))
16310
+ *is_altivec = true;
16312
+ rclass = rs6000_regno_regclass[regno];
16313
+ return reg_class_to_reg_type[(int)rclass];
16316
+/* Helper function for rs6000_secondary_reload to return true if a move to a
16317
+ different register classe is really a simple move. */
16320
+rs6000_secondary_reload_simple_move (enum rs6000_reg_type to_type,
16321
+ enum rs6000_reg_type from_type,
16322
+ enum machine_mode mode)
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)))
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)))
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)))
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. */
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,
16364
+ bool ret = false;
16365
+ enum insn_code icode = CODE_FOR_nothing;
16367
+ int size = GET_MODE_SIZE (mode);
16369
+ if (TARGET_POWERPC64)
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)
16378
+ cost = 3; /* 2 mtvsrd's, 1 xxpermdi. */
16379
+ icode = reg_addr[mode].reload_vsx_gpr;
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)
16387
+ cost = 3; /* 2 mfvsrd's, 1 xxpermdi. */
16388
+ icode = reg_addr[mode].reload_gpr_vsx;
16392
+ else if (mode == SFmode)
16394
+ if (to_type == GPR_REG_TYPE && from_type == VSX_REG_TYPE)
16396
+ cost = 3; /* xscvdpspn, mfvsrd, and. */
16397
+ icode = reg_addr[mode].reload_gpr_vsx;
16400
+ else if (to_type == VSX_REG_TYPE && from_type == GPR_REG_TYPE)
16402
+ cost = 2; /* mtvsrz, xscvspdpn. */
16403
+ icode = reg_addr[mode].reload_vsx_gpr;
16408
+ if (TARGET_POWERPC64 && size == 16)
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)
16415
+ cost = 3; /* 2 mtvsrd's, 1 xxpermdi. */
16416
+ icode = reg_addr[mode].reload_vsx_gpr;
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)
16424
+ cost = 3; /* 2 mfvsrd's, 1 xxpermdi. */
16425
+ icode = reg_addr[mode].reload_gpr_vsx;
16429
+ else if (!TARGET_POWERPC64 && size == 8)
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)
16440
+ cost = 3; /* 2 mtvsrwz's, 1 fmrgow. */
16441
+ icode = reg_addr[mode].reload_fpr_gpr;
16445
+ if (icode != CODE_FOR_nothing)
16450
+ sri->icode = icode;
16451
+ sri->extra_cost = cost;
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. */
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,
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)
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)))
16480
+ /* Moves to the same set of registers is a simple move for non-specialized
16482
+ if (to_type == from_type && IS_STD_REG_TYPE (to_type))
16485
+ /* Check whether a simple move can be done directly. */
16486
+ if (rs6000_secondary_reload_simple_move (to_type, from_type, mode))
16490
+ sri->icode = CODE_FOR_nothing;
16491
+ sri->extra_cost = 0;
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,
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;
16507
sri->icode = CODE_FOR_nothing;
16509
+ ? reg_addr[mode].reload_load
16510
+ : reg_addr[mode].reload_store);
16512
- /* Convert vector loads and stores into gprs to use an additional base
16514
- icode = rs6000_vector_reload[mode][in_p != false];
16515
- if (icode != CODE_FOR_nothing)
16516
+ if (REG_P (x) || register_operand (x, mode))
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);
16524
+ enum rs6000_reg_type exchange = to_type;
16525
+ to_type = from_type;
16526
+ from_type = exchange;
16529
+ /* Can we do a direct move of some sort? */
16530
+ if (rs6000_secondary_reload_move (to_type, from_type, mode, sri,
16533
+ icode = (enum insn_code)sri->icode;
16534
+ default_p = false;
16539
+ /* Handle vector moves with reload helper functions. */
16540
+ if (ret == ALL_REGS && icode != CODE_FOR_nothing)
16543
sri->icode = CODE_FOR_nothing;
16544
sri->extra_cost = 0;
16545
@@ -13754,22 +15791,43 @@
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)
16554
- if (!legitimate_indirect_address_p (addr, false)
16555
- && !rs6000_legitimate_offset_address_p (TImode, addr,
16557
+ if (TARGET_POWERPC64 && TARGET_QUAD_MEMORY
16558
+ && GET_MODE_SIZE (mode) == 16
16559
+ && quad_memory_operand (x, mode))
16561
sri->icode = icode;
16562
+ sri->extra_cost = 2;
16565
+ else if (!legitimate_indirect_address_p (addr, false)
16566
+ && !rs6000_legitimate_offset_address_p (PTImode, addr,
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));
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,
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)
16595
@@ -13813,12 +15871,12 @@
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];
16604
/* If memory is needed, use default_secondary_reload to create the
16606
- if (rtype1 != rtype2 || rtype1 == OTHER_REGISTER_TYPE)
16607
+ if (rtype1 != rtype2 || !IS_STD_REG_TYPE (rtype1))
16611
@@ -13828,7 +15886,7 @@
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
16618
&& GET_MODE_SIZE (GET_MODE (x)) >= UNITS_PER_WORD)
16620
@@ -13867,7 +15925,7 @@
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
16627
&& GET_MODE_SIZE (GET_MODE (x)) > UNITS_PER_WORD)
16629
@@ -13945,6 +16003,36 @@
16633
+/* Better tracing for rs6000_secondary_reload_inner. */
16636
+rs6000_secondary_reload_trace (int line, rtx reg, rtx mem, rtx scratch,
16639
+ rtx set, clobber;
16641
+ gcc_assert (reg != NULL_RTX && mem != NULL_RTX && scratch != NULL_RTX);
16643
+ fprintf (stderr, "rs6000_secondary_reload_inner:%d, type = %s\n", line,
16644
+ store_p ? "store" : "load");
16647
+ set = gen_rtx_SET (VOIDmode, mem, reg);
16649
+ set = gen_rtx_SET (VOIDmode, reg, mem);
16651
+ clobber = gen_rtx_CLOBBER (VOIDmode, scratch);
16652
+ debug_rtx (gen_rtx_PARALLEL (VOIDmode, gen_rtvec (2, set, clobber)));
16656
+rs6000_secondary_reload_fail (int line, rtx reg, rtx mem, rtx scratch,
16659
+ rs6000_secondary_reload_trace (line, reg, mem, scratch, store_p);
16660
+ gcc_unreachable ();
16663
/* Fixup reload addresses for Altivec or VSX loads/stores to change SP+offset
16664
to SP+reg addressing. */
16666
@@ -13963,19 +16051,14 @@
16669
if (TARGET_DEBUG_ADDR)
16671
- fprintf (stderr, "\nrs6000_secondary_reload_inner, type = %s\n",
16672
- store_p ? "store" : "load");
16673
- fprintf (stderr, "reg:\n");
16675
- fprintf (stderr, "mem:\n");
16677
- fprintf (stderr, "scratch:\n");
16678
- debug_rtx (scratch);
16680
+ rs6000_secondary_reload_trace (__LINE__, reg, mem, scratch, store_p);
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);
16687
+ if (GET_CODE (mem) != MEM)
16688
+ rs6000_secondary_reload_fail (__LINE__, reg, mem, scratch, store_p);
16690
rclass = REGNO_REG_CLASS (regno);
16691
addr = XEXP (mem, 0);
16693
@@ -13994,19 +16077,24 @@
16694
if (GET_CODE (addr) == PRE_MODIFY)
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);
16702
+ if (GET_CODE (XEXP (addr, 1)) != PLUS)
16703
+ rs6000_secondary_reload_fail (__LINE__, reg, mem, scratch, store_p);
16705
addr = XEXP (addr, 1);
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,
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);
16720
if (!REG_P (addr_op2)
16721
&& (GET_CODE (addr_op2) != CONST_INT
16722
@@ -14034,7 +16122,7 @@
16723
scratch_or_premodify = scratch;
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,
16730
if (TARGET_DEBUG_ADDR)
16731
@@ -14050,9 +16138,21 @@
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. */
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)))
16747
+ /* If this isn't a legacy floating point load/store, fall through to the
16750
+ /* VSX/Altivec registers can only handle reg+reg addressing. Move other
16751
+ addresses into a scratch register. */
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)))
16766
scratch_or_premodify = XEXP (addr, 0);
16767
- gcc_assert (legitimate_indirect_address_p (scratch_or_premodify,
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);
16773
+ if (GET_CODE (XEXP (addr, 1)) != PLUS)
16774
+ rs6000_secondary_reload_fail (__LINE__, reg, mem, scratch, store_p);
16776
addr = XEXP (addr, 1);
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))))
16796
else if (GET_CODE (addr) == PLUS)
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);
16804
if (TARGET_DEBUG_ADDR)
16806
@@ -14120,7 +16222,8 @@
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
16814
if (TARGET_DEBUG_ADDR)
16816
@@ -14136,12 +16239,12 @@
16820
- gcc_unreachable ();
16821
+ rs6000_secondary_reload_fail (__LINE__, reg, mem, scratch, store_p);
16826
- gcc_unreachable ();
16827
+ rs6000_secondary_reload_fail (__LINE__, reg, mem, scratch, store_p);
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))
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");
16840
@@ -14253,8 +16356,10 @@
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. */
16852
rs6000_alloc_sdmode_stack_slot (void)
16853
@@ -14265,6 +16370,9 @@
16855
gcc_assert (cfun->machine->sdmode_stack_slot == NULL_RTX);
16857
+ if (TARGET_NO_SDMODE_STACK)
16861
for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi); gsi_next (&gsi))
16863
@@ -14325,8 +16433,7 @@
16865
enum machine_mode mode = GET_MODE (x);
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))
16872
if (VECTOR_UNIT_ALTIVEC_OR_VSX_P (mode)
16873
@@ -14381,60 +16488,45 @@
16874
set and vice versa. */
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)
16883
- if (class1 == class2)
16885
+ enum rs6000_reg_type from_type, to_type;
16886
+ bool altivec_p = ((from_class == ALTIVEC_REGS)
16887
+ || (to_class == ALTIVEC_REGS));
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. */
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];
16903
- if (class1 == VSX_REGS || class2 == VSX_REGS)
16905
+ if (rs6000_secondary_reload_move (to_type, from_type, mode,
16906
+ (secondary_reload_info *)0, altivec_p))
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))
16919
- if (class2 == FLOAT_REGS
16920
- && (!TARGET_MFPGPR || !TARGET_POWERPC64
16921
- || ((mode != DFmode)
16922
- && (mode != DDmode)
16923
- && (mode != DImode))))
16926
- if (class1 == ALTIVEC_REGS || class2 == ALTIVEC_REGS)
16932
/* Debug version of rs6000_secondary_memory_needed. */
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)
16940
- bool ret = rs6000_secondary_memory_needed (class1, class2, mode);
16941
+ bool ret = rs6000_secondary_memory_needed (from_class, to_class, mode);
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));
16957
@@ -14501,12 +16593,18 @@
16958
return (mode != SDmode) ? NO_REGS : GENERAL_REGS;
16960
/* Memory, and FP/altivec registers can go into fp/altivec registers under
16962
+ VSX. However, for scalar variables, use the traditional floating point
16963
+ registers so that we can use offset+register addressing. */
16965
&& (regno == -1 || VSX_REGNO_P (regno))
16966
&& VSX_REG_CLASS_P (rclass))
16969
+ if (GET_MODE_SIZE (mode) < 16)
16970
+ return FLOAT_REGS;
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)
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));
16985
+ if (reg_classes_intersect_p (xclass, rclass))
16987
+ unsigned to_nregs = hard_regno_nregs[FIRST_FPR_REGNO][to];
16988
+ unsigned from_nregs = hard_regno_nregs[FIRST_FPR_REGNO][from];
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
16997
+ if (TARGET_IEEEQUAD && (to == TFmode || from == TFmode))
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))
17007
+ if (from_size < 8 || to_size < 8)
17010
+ if (from_size == 8 && (8 * to_nregs) != to_size)
17013
+ if (to_size == 8 && (8 * from_nregs) != from_size)
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);
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)
17039
+ return (from_size != 8 && from_size != 16);
17042
if (TARGET_ALTIVEC && rclass == ALTIVEC_REGS
17043
&& (ALTIVEC_VECTOR_MODE (from) + ALTIVEC_VECTOR_MODE (to)) == 1)
17045
@@ -14598,6 +16739,161 @@
17049
+/* Return a string to do a move operation of 128 bits of data. */
17052
+rs6000_output_move_128bit (rtx operands[])
17054
+ rtx dest = operands[0];
17055
+ rtx src = operands[1];
17056
+ enum machine_mode mode = GET_MODE (dest);
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;
17062
+ if (REG_P (dest))
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;
17073
+ dest_gpr_p = dest_fp_p = dest_vmx_p = dest_vsx_p = false;
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;
17087
+ src_gpr_p = src_fp_p = src_vmx_p = src_vsx_p = false;
17090
+ /* Register moves. */
17091
+ if (dest_regno >= 0 && src_regno >= 0)
17098
+ else if (TARGET_VSX && TARGET_DIRECT_MOVE && src_vsx_p)
17102
+ else if (TARGET_VSX && dest_vsx_p)
17105
+ return "xxlor %x0,%x1,%x1";
17107
+ else if (TARGET_DIRECT_MOVE && src_gpr_p)
17111
+ else if (TARGET_ALTIVEC && dest_vmx_p && src_vmx_p)
17112
+ return "vor %0,%1,%1";
17114
+ else if (dest_fp_p && src_fp_p)
17119
+ else if (dest_regno >= 0 && MEM_P (src))
17123
+ if (TARGET_QUAD_MEMORY && quad_load_store_p (dest, src))
17124
+ return "lq %0,%1";
17129
+ else if (TARGET_ALTIVEC && dest_vmx_p
17130
+ && altivec_indexed_or_indirect_operand (src, mode))
17131
+ return "lvx %0,%y1";
17133
+ else if (TARGET_VSX && dest_vsx_p)
17135
+ if (mode == V16QImode || mode == V8HImode || mode == V4SImode)
17136
+ return "lxvw4x %x0,%y1";
17138
+ return "lxvd2x %x0,%y1";
17141
+ else if (TARGET_ALTIVEC && dest_vmx_p)
17142
+ return "lvx %0,%y1";
17144
+ else if (dest_fp_p)
17149
+ else if (src_regno >= 0 && MEM_P (dest))
17153
+ if (TARGET_QUAD_MEMORY && quad_load_store_p (dest, src))
17154
+ return "stq %1,%0";
17159
+ else if (TARGET_ALTIVEC && src_vmx_p
17160
+ && altivec_indexed_or_indirect_operand (src, mode))
17161
+ return "stvx %1,%y0";
17163
+ else if (TARGET_VSX && src_vsx_p)
17165
+ if (mode == V16QImode || mode == V8HImode || mode == V4SImode)
17166
+ return "stxvw4x %x1,%y0";
17168
+ return "stxvd2x %x1,%y0";
17171
+ else if (TARGET_ALTIVEC && src_vmx_p)
17172
+ return "stvx %1,%y0";
17174
+ else if (src_fp_p)
17179
+ else if (dest_regno >= 0
17180
+ && (GET_CODE (src) == CONST_INT
17181
+ || GET_CODE (src) == CONST_DOUBLE
17182
+ || GET_CODE (src) == CONST_VECTOR))
17187
+ else if (TARGET_VSX && dest_vsx_p && zero_constant (src, mode))
17188
+ return "xxlxor %x0,%x0,%x0";
17190
+ else if (TARGET_ALTIVEC && dest_vmx_p)
17191
+ return output_vec_const_move (operands);
17194
+ if (TARGET_DEBUG_ADDR)
17196
+ fprintf (stderr, "\n===== Bad 128 bit move:\n");
17197
+ debug_rtx (gen_rtx_SET (VOIDmode, dest, src));
17200
+ gcc_unreachable ();
17204
/* Given a comparison operation, return the bit number in CCR to test. We
17205
know this is a valid comparison.
17207
@@ -14823,6 +17119,7 @@
17208
ASM_OUTPUT_INTERNAL_LABEL_PREFIX (file, "L.");
17215
@@ -15302,7 +17599,7 @@
17219
- /* Like 'L', for third word of TImode */
17220
+ /* Like 'L', for third word of TImode/PTImode */
17222
fputs (reg_names[REGNO (x) + 2], file);
17223
else if (MEM_P (x))
17224
@@ -15352,7 +17649,7 @@
17228
- /* Like 'L', for last word of TImode. */
17229
+ /* Like 'L', for last word of TImode/PTImode. */
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))
17241
/* Handle [reg]. */
17243
@@ -16766,7 +19064,8 @@
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. */
17252
emit_load_locked (enum machine_mode mode, rtx reg, rtx mem)
17253
@@ -16775,12 +19074,26 @@
17258
+ fn = gen_load_lockedqi;
17261
+ fn = gen_load_lockedhi;
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;
17270
+ fn = gen_load_lockedsi;
17273
fn = gen_load_lockeddi;
17276
+ fn = gen_load_lockedti;
17279
gcc_unreachable ();
17281
@@ -16797,12 +19110,21 @@
17286
+ fn = gen_store_conditionalqi;
17289
+ fn = gen_store_conditionalhi;
17292
fn = gen_store_conditionalsi;
17295
fn = gen_store_conditionaldi;
17298
+ fn = gen_store_conditionalti;
17301
gcc_unreachable ();
17303
@@ -16949,7 +19271,7 @@
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;
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);
17319
mask = shift = NULL_RTX;
17320
if (mode == QImode || mode == HImode)
17322
- mem = rs6000_adjust_atomic_subword (mem, &shift, &mask);
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);
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)
17338
+ mem = rs6000_adjust_atomic_subword (mem, &shift, &mask);
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);
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);
17350
/* Prepare to adjust the return value. */
17351
retval = gen_reg_rtx (SImode);
17353
@@ -17005,7 +19334,25 @@
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);
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);
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);
17377
emit_insn (gen_rtx_SET (VOIDmode, cond, x));
17379
x = gen_rtx_NE (VOIDmode, cond, const0_rtx);
17380
@@ -17015,7 +19362,7 @@
17382
x = rs6000_mask_atomic_subword (retval, newval, mask);
17384
- emit_store_conditional (mode, cond, mem, x);
17385
+ emit_store_conditional (orig_mode, cond, mem, x);
17389
@@ -17033,6 +19380,8 @@
17392
rs6000_finish_atomic_subword (operands[1], retval, shift);
17393
+ else if (mode != GET_MODE (operands[1]))
17394
+ convert_move (operands[1], retval, 1);
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);
17401
mask = shift = NULL_RTX;
17402
- if (mode == QImode || mode == HImode)
17403
+ if (!TARGET_SYNC_HI_QI && (mode == QImode || mode == HImode))
17405
mem = rs6000_adjust_atomic_subword (mem, &shift, &mask);
17407
@@ -17105,53 +19454,70 @@
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;
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
17419
if (mode == QImode || mode == HImode)
17421
- mem = rs6000_adjust_atomic_subword (mem, &shift, &mask);
17422
+ if (TARGET_SYNC_HI_QI)
17424
+ val = convert_modes (SImode, mode, val, 1);
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);
17432
+ /* Prepare to adjust the return value. */
17433
+ before = gen_reg_rtx (SImode);
17435
+ after = gen_reg_rtx (SImode);
17442
- /* We've already zero-extended VAL. That is sufficient to
17443
- make certain that it does not affect other bits. */
17446
+ mem = rs6000_adjust_atomic_subword (mem, &shift, &mask);
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));
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);
17464
- /* These will all affect bits outside the field and need
17465
- adjustment via MASK within the loop. */
17471
+ /* We've already zero-extended VAL. That is sufficient to
17472
+ make certain that it does not affect other bits. */
17477
- gcc_unreachable ();
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));
17490
+ /* These will all affect bits outside the field and need
17491
+ adjustment via MASK within the loop. */
17495
+ gcc_unreachable ();
17498
+ /* Prepare to adjust the return value. */
17499
+ before = gen_reg_rtx (SImode);
17501
+ after = gen_reg_rtx (SImode);
17502
+ store_mode = mode = SImode;
17505
- /* Prepare to adjust the return value. */
17506
- before = gen_reg_rtx (SImode);
17508
- after = gen_reg_rtx (SImode);
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);
17517
+ else if (store_mode != mode)
17518
+ x = convert_modes (store_mode, mode, x, 1);
17520
cond = gen_reg_rtx (CCmode);
17521
- emit_store_conditional (mode, cond, mem, x);
17522
+ emit_store_conditional (store_mode, cond, mem, x);
17524
x = gen_rtx_NE (VOIDmode, cond, const0_rtx);
17525
emit_unlikely_jump (x, label);
17526
@@ -17195,11 +19563,22 @@
17530
+ /* QImode/HImode on machines without lbarx/lharx where we do a lwarx and
17531
+ then do the calcuations in a SImode register. */
17533
rs6000_finish_atomic_subword (orig_before, before, shift);
17535
rs6000_finish_atomic_subword (orig_after, after, shift);
17537
+ else if (store_mode != mode)
17539
+ /* QImode/HImode on machines with lbarx/lharx where we do the native
17540
+ operation and then do the calcuations in a SImode register. */
17542
+ convert_move (orig_before, before, 1);
17544
+ convert_move (orig_after, after, 1);
17546
else if (orig_after && after != orig_after)
17547
emit_move_insn (orig_after, after);
17549
@@ -17239,6 +19618,39 @@
17551
gcc_assert (reg_mode_size * nregs == GET_MODE_SIZE (mode));
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.
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)
17563
+ rtx p_src, p_dst;
17566
+ for (i = 0; i < nregs; i++)
17568
+ if (REG_P (src) && FP_REGNO_P (REGNO (src)))
17569
+ p_src = gen_rtx_REG (reg_mode, REGNO (src) + nregs - 1 - i);
17571
+ p_src = simplify_gen_subreg (reg_mode, src, mode,
17572
+ i * reg_mode_size);
17574
+ if (REG_P (dst) && FP_REGNO_P (REGNO (dst)))
17575
+ p_dst = gen_rtx_REG (reg_mode, REGNO (dst) + nregs - 1 - i);
17577
+ p_dst = simplify_gen_subreg (reg_mode, dst, mode,
17578
+ i * reg_mode_size);
17580
+ emit_insn (gen_rtx_SET (VOIDmode, p_dst, p_src));
17586
if (REG_P (src) && REG_P (dst) && (REGNO (src) < REGNO (dst)))
17588
/* Move register range backwards, if we might have destructive
17589
@@ -17693,7 +20105,7 @@
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)
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
17612
+ The ELFv2 ABI is a variant of the AIX ABI. Stack frames look like:
17614
+ SP----> +---------------------------------------+
17615
+ | Back chain to caller | 0
17616
+ +---------------------------------------+
17617
+ | Save area for CR | 8
17618
+ +---------------------------------------+
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
+ +---------------------------------------+
17641
V.4 stack frames look like:
17643
SP----> +---------------------------------------+
17644
@@ -17897,6 +20338,7 @@
17645
rs6000_stack_t *info_ptr = &stack_info;
17646
int reg_size = TARGET_32BIT ? 4 : 8;
17651
HOST_WIDE_INT non_fixed_size;
17652
@@ -17990,6 +20432,18 @@
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)
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;
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 ();
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 @@
17682
info_ptr->ehrd_offset = info_ptr->gp_save_offset - ehrd_size;
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;
17688
@@ -18120,6 +20577,7 @@
17689
+ info_ptr->spe_gp_size
17690
+ info_ptr->spe_padding_size
17693
+ info_ptr->cr_size
17694
+ info_ptr->vrsave_size,
17696
@@ -18133,7 +20591,7 @@
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)
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;
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))
17719
+ || ((DEFAULT_ABI == ABI_V4 || DEFAULT_ABI == ABI_DARWIN) && flag_pic))
17721
cfun->machine->ra_needs_full_frame = 1;
17723
@@ -18459,13 +20919,13 @@
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)
17740
&& !DECL_EXTERNAL (decl)
17741
&& (*targetm.binds_local_p) (decl))
17742
@@ -18566,7 +21026,7 @@
17744
dest = gen_rtx_REG (Pmode, RS6000_PIC_OFFSET_TABLE_REGNUM);
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)
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));
17755
- else if (TARGET_ELF && DEFAULT_ABI != ABI_AIX && flag_pic == 2)
17756
+ else if (TARGET_ELF && DEFAULT_ABI == ABI_V4 && flag_pic == 2)
17759
rtx temp0 = (fromprolog
17760
@@ -18642,7 +21102,7 @@
17764
- gcc_assert (DEFAULT_ABI == ABI_AIX);
17765
+ gcc_assert (DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_ELFv2);
17768
emit_insn (gen_load_toc_aix_si (dest));
17769
@@ -19047,7 +21507,7 @@
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)
17778
@@ -19138,6 +21598,11 @@
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);
17787
RTX_FRAME_RELATED_P (insn) = 1;
17788
add_reg_note (insn, REG_FRAME_RELATED_EXPR, real);
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);
17798
/* Emit an offset memory reference suitable for a frame store, while
17799
@@ -19361,7 +21826,7 @@
17800
if ((sel & SAVRES_LR))
17803
- else if (DEFAULT_ABI == ABI_AIX)
17804
+ else if (DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_ELFv2)
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)
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;
17817
@@ -19587,6 +22052,43 @@
17821
+/* Emit code to store CR fields that need to be saved into REG. */
17824
+rs6000_emit_move_from_cr (rtx reg)
17826
+ /* Only the ELFv2 ABI allows storing only selected fields. */
17827
+ if (DEFAULT_ABI == ABI_ELFv2 && TARGET_MFCRF)
17829
+ int i, cr_reg[8], count = 0;
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;
17836
+ /* If it's just a single one, use mfcrf. */
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]));
17844
+ = gen_rtx_SET (VOIDmode, reg,
17845
+ gen_rtx_UNSPEC (SImode, r, UNSPEC_MOVESI_FROM_CR));
17847
+ emit_insn (gen_rtx_PARALLEL (VOIDmode, p));
17851
+ /* ??? It might be better to handle count == 2 / 3 cases here
17852
+ as well, using logical operations to combine the values. */
17855
+ emit_insn (gen_movesi_from_cr (reg));
17858
/* Determine whether the gp REG is really used. */
17861
@@ -19652,6 +22154,17 @@
17862
#define NOT_INUSE(R) do {} while (0)
17865
+ if (DEFAULT_ABI == ABI_ELFv2)
17867
+ cfun->machine->r2_setup_needed = df_regs_ever_live_p (TOC_REGNUM);
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;
17876
if (flag_stack_usage_info)
17877
current_function_static_stack_size = info->total_size;
17879
@@ -19766,7 +22279,7 @@
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;
17888
@@ -19851,14 +22364,14 @@
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);
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))
17905
@@ -19867,21 +22380,9 @@
17906
&& REGNO (frame_reg_rtx) != cr_save_regno
17907
&& !(using_static_chain_p && cr_save_regno == 11))
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);
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,
17931
rs6000_frame_related (insn, ptr_reg, sp_off,
17932
- NULL_RTX, NULL_RTX);
17933
+ NULL_RTX, NULL_RTX, NULL_RTX);
17937
@@ -19998,7 +22499,7 @@
17938
SAVRES_SAVE | SAVRES_GPR);
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);
17945
/* Move the static chain pointer back. */
17946
@@ -20048,7 +22549,7 @@
17947
info->lr_save_offset + ptr_off,
17949
rs6000_frame_related (insn, ptr_reg, sp_off - ptr_off,
17950
- NULL_RTX, NULL_RTX);
17951
+ NULL_RTX, NULL_RTX, NULL_RTX);
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);
17962
else if (!WORLD_SAVE_P (info))
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;
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);
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);
17990
/* If we didn't copy cr before, do so now using r0. */
17991
if (cr_save_rtx == NULL_RTX)
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);
18003
- insn = emit_move_insn (mem, cr_save_rtx);
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.
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.
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. */
18022
+ int n_crsave = 0;
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));
18031
+ insn = emit_insn (gen_rtx_PARALLEL (VOIDmode,
18032
+ gen_rtvec_v (n_crsave, crsave_v)));
18033
END_USE (REGNO (cr_save_rtx));
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;
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);
18048
+ if (DEFAULT_ABI == ABI_ELFv2)
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. */
18054
+ int n_crframe = 0;
18056
+ for (i = 0; i < 8; i++)
18057
+ if (save_reg_p (CR0_REGNO + i))
18059
+ crframe[n_crframe]
18060
+ = gen_rtx_SET (VOIDmode, mem,
18061
+ gen_rtx_REG (SImode, CR0_REGNO + i));
18063
+ RTX_FRAME_RELATED_P (crframe[n_crframe]) = 1;
18067
+ add_reg_note (insn, REG_FRAME_RELATED_EXPR,
18068
+ gen_rtx_PARALLEL (VOIDmode,
18069
+ gen_rtvec_v (n_crframe, crframe)));
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);
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)
18087
+ int i, cr_off = info->ehcr_offset;
18090
+ /* ??? We might get better performance by using multiple mfocrf
18092
+ crsave = gen_rtx_REG (SImode, 0);
18093
+ emit_insn (gen_movesi_from_cr (crsave));
18095
+ for (i = 0; i < 8; i++)
18096
+ if (!call_used_regs[CR0_REGNO + i])
18098
+ rtvec p = rtvec_alloc (2);
18100
+ = gen_frame_store (crsave, frame_reg_rtx, cr_off + frame_off);
18102
+ = gen_rtx_USE (VOIDmode, gen_rtx_REG (CCmode, CR0_REGNO + i));
18104
+ insn = emit_insn (gen_rtx_PARALLEL (VOIDmode, p));
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));
18111
+ cr_off += reg_size;
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))
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))
18131
- rtx areg, savereg, mem;
18132
+ rtx areg, savereg, mem, split_reg;
18135
offset = (info->altivec_save_offset + frame_off
18136
@@ -20325,8 +22922,18 @@
18138
insn = emit_move_insn (mem, savereg);
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;
18148
+ split_reg = NULL_RTX;
18150
rs6000_frame_related (insn, frame_reg_rtx, sp_off - frame_off,
18151
- areg, GEN_INT (offset));
18152
+ areg, GEN_INT (offset), split_reg);
18156
@@ -20350,7 +22957,8 @@
18157
be using r12 as frame_reg_rtx and r11 as the static chain
18158
pointer for nested functions. */
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)
18164
else if (REGNO (frame_reg_rtx) == 12)
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
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 ())
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));
18184
@@ -20492,6 +23100,49 @@
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)
18192
+ const char *name = XSTR (XEXP (DECL_RTL (current_function_decl), 0), 0);
18194
+ fprintf (file, "0:\taddis 2,12,.TOC.-0b@ha\n");
18195
+ fprintf (file, "\taddi 2,2,.TOC.-0b@l\n");
18197
+ fputs ("\t.localentry\t", file);
18198
+ assemble_name (file, name);
18199
+ fputs (",.-", file);
18200
+ assemble_name (file, name);
18201
+ fputs ("\n", file);
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)
18209
+ gcc_assert (DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_ELFv2);
18210
+ gcc_assert (!TARGET_32BIT);
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]);
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)
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]);
18228
+ fprintf (file, "\tbl %s\n", RS6000_MCOUNT);
18231
rs6000_pic_labelno++;
18234
@@ -20544,6 +23195,7 @@
18236
if (using_mfcr_multiple && count > 1)
18242
@@ -20561,16 +23213,43 @@
18243
gen_rtx_UNSPEC (CCmode, r, UNSPEC_MOVESI_TO_CR));
18246
- emit_insn (gen_rtx_PARALLEL (VOIDmode, p));
18247
+ insn = emit_insn (gen_rtx_PARALLEL (VOIDmode, p));
18248
gcc_assert (ndx == count);
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)
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));
18259
+ RTX_FRAME_RELATED_P (insn) = 1;
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),
18268
+ rtx insn = emit_insn (gen_movsi_to_cr_one
18269
+ (gen_rtx_REG (CCmode, CR0_REGNO + i), reg));
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)
18277
+ add_reg_note (insn, REG_CFA_RESTORE,
18278
+ gen_rtx_REG (SImode, CR0_REGNO + i));
18280
+ RTX_FRAME_RELATED_P (insn) = 1;
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))
18288
rtx insn = get_last_insn ();
18289
rtx cr = gen_rtx_REG (SImode, CR2_REGNO);
18290
@@ -20611,10 +23290,22 @@
18292
add_crlr_cfa_restore (const rs6000_stack_t *info, rtx cfa_restores)
18294
- if (info->cr_save_p)
18295
+ if (DEFAULT_ABI == ABI_ELFv2)
18298
+ for (i = 0; i < 8; i++)
18299
+ if (save_reg_p (CR0_REGNO + i))
18301
+ rtx cr = gen_rtx_REG (SImode, CR0_REGNO + i);
18302
+ cfa_restores = alloc_reg_note (REG_CFA_RESTORE, cr,
18306
+ else if (info->cr_save_p)
18307
cfa_restores = alloc_reg_note (REG_CFA_RESTORE,
18308
gen_rtx_REG (SImode, CR2_REGNO),
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));
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)
18323
+ int i, cr_off = info->ehcr_offset;
18325
+ for (i = 0; i < 8; i++)
18326
+ if (!call_used_regs[CR0_REGNO + i])
18328
+ rtx reg = gen_rtx_REG (SImode, 0);
18329
+ emit_insn (gen_frame_load (reg, frame_reg_rtx,
18330
+ cr_off + frame_off));
18332
+ insn = emit_insn (gen_movsi_to_cr_one
18333
+ (gen_rtx_REG (CCmode, CR0_REGNO + i), reg));
18335
+ if (!exit_func && flag_shrink_wrap)
18337
+ add_reg_note (insn, REG_CFA_RESTORE,
18338
+ gen_rtx_REG (SImode, CR0_REGNO + i));
18340
+ RTX_FRAME_RELATED_P (insn) = 1;
18343
+ cr_off += reg_size;
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 @@
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));
18359
@@ -21441,6 +24161,7 @@
18360
if (! restoring_FPRs_inline)
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
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));
18378
for (i = 0; i < 64 - info->first_fp_reg_save; i++)
18380
rtx reg = gen_rtx_REG (DFmode, info->first_fp_reg_save + i);
18381
@@ -21530,7 +24250,8 @@
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)
18390
const char *fname = NULL;
18391
@@ -21858,6 +24579,12 @@
18392
SIBLING_CALL_P (insn) = 1;
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;
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)
18408
- if (DEFAULT_ABI == ABI_AIX)
18409
+ if (DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_ELFv2)
18411
#ifndef NO_PROFILE_COUNTERS
18412
# define NO_PROFILE_COUNTERS 0
18413
@@ -22698,29 +25425,9 @@
18419
- if (!TARGET_PROFILE_KERNEL)
18421
- /* Don't do anything, done in output_profile_hook (). */
18425
- gcc_assert (!TARGET_32BIT);
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]);
18430
- if (cfun->static_chain_decl != NULL)
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]);
18439
- fprintf (file, "\tbl %s\n", RS6000_MCOUNT);
18441
+ /* Don't do anything, done in output_profile_hook (). */
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;
18457
- if (rs6000_sched_groups)
18458
+ if (rs6000_sched_groups
18459
+ && (rs6000_cpu == PROCESSOR_POWER4 || rs6000_cpu == PROCESSOR_POWER5))
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)
18467
- if (rs6000_sched_groups)
18468
+ if (rs6000_sched_groups
18469
+ && (rs6000_cpu == PROCESSOR_POWER4 || rs6000_cpu == PROCESSOR_POWER5))
18471
enum attr_type type = get_attr_type (insn);
18472
if (type == TYPE_LOAD_U || type == TYPE_STORE_U
18473
@@ -23432,6 +26142,8 @@
18482
@@ -24059,6 +26771,39 @@
18486
+ case PROCESSOR_POWER8:
18487
+ type = get_attr_type (insn);
18491
+ case TYPE_CR_LOGICAL:
18492
+ case TYPE_DELAYED_CR:
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:
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:
18522
@@ -24137,6 +26882,25 @@
18526
+ case PROCESSOR_POWER8:
18527
+ type = get_attr_type (insn);
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:
18548
@@ -24226,8 +26990,9 @@
18549
if (can_issue_more && !is_branch_slot_insn (next_insn))
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)
18558
nop = gen_group_ending_nop ();
18559
emit_insn_before (nop, next_insn);
18560
@@ -24598,6 +27363,11 @@
18561
ret = (TARGET_32BIT) ? 12 : 24;
18565
+ gcc_assert (!TARGET_32BIT);
18571
ret = (TARGET_32BIT) ? 40 : 48;
18572
@@ -24653,6 +27423,7 @@
18575
/* Under V.4/eabi/darwin, __trampoline_setup does the real work. */
18579
emit_library_call (gen_rtx_SYMBOL_REF (Pmode, "__trampoline_setup"),
18580
@@ -24947,7 +27718,7 @@
18582
rs6000_elf_output_toc_section_asm_op (const void *data ATTRIBUTE_UNUSED)
18584
- if (DEFAULT_ABI == ABI_AIX
18585
+ if ((DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_ELFv2)
18586
&& TARGET_MINIMAL_TOC
18587
&& !TARGET_RELOCATABLE)
18589
@@ -24968,7 +27739,8 @@
18591
fprintf (asm_out_file, "%s\n", MINIMAL_TOC_SECTION_ASM_OP);
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);
18599
@@ -25518,7 +28290,7 @@
18603
- else if (DEFAULT_ABI == ABI_AIX)
18604
+ else if (DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_ELFv2)
18608
@@ -25594,7 +28366,7 @@
18610
rs6000_elf_declare_function_name (FILE *file, const char *name, tree decl)
18612
- if (TARGET_64BIT)
18613
+ if (TARGET_64BIT && DEFAULT_ABI != ABI_ELFv2)
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");
18626
ASM_OUTPUT_LABEL (file, name);
18627
@@ -25690,7 +28461,7 @@
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 ();
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];
18646
@@ -26440,7 +29212,7 @@
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 @@
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));
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. */
18678
-rs6000_emit_swdiv_high_precision (rtx dst, rtx n, rtx d)
18680
+rs6000_emit_swdiv (rtx dst, rtx n, rtx d, bool note_p)
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;
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)
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),
18706
- e0 = gen_reg_rtx (mode);
18707
- rs6000_emit_nmsub (e0, d, x0, one); /* e0 = 1. - (d * x0) */
18709
- e1 = gen_reg_rtx (mode);
18710
- rs6000_emit_madd (e1, e0, e0, e0); /* e1 = (e0 * e0) + e0 */
18712
- y1 = gen_reg_rtx (mode);
18713
- rs6000_emit_madd (y1, e1, x0, x0); /* y1 = (e1 * x0) + x0 */
18715
- u0 = gen_reg_rtx (mode);
18716
- emit_insn (gen_mul (u0, n, y1)); /* u0 = n * y1 */
18718
- v0 = gen_reg_rtx (mode);
18719
- rs6000_emit_nmsub (v0, d, u0, n); /* v0 = n - (d * u0) */
18721
- rs6000_emit_madd (dst, v0, y1, u0); /* dst = (v0 * y1) + u0 */
18724
-/* Newton-Raphson approximation of floating point divide that has a low
18725
- precision estimate. Assumes no trapping math and finite arguments. */
18728
-rs6000_emit_swdiv_low_precision (rtx dst, rtx n, rtx d)
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);
18735
@@ -26704,47 +29449,45 @@
18736
gen_rtx_UNSPEC (mode, gen_rtvec (1, d),
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) {
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);
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);
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) {
18761
+ /* enext = eprev * eprev */
18762
+ enext = gen_reg_rtx (mode);
18763
+ emit_insn (gen_mul (enext, eprev, eprev));
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);
18772
- y3 = gen_reg_rtx (mode);
18773
- rs6000_emit_madd (y3, e2, y2, y2); /* y3 = y2 + e2 * y2 */
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). */
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));
18787
- rs6000_emit_madd (dst, v0, y3, u0); /* dst = u0 + v0 * y3 */
18789
+ /* v = n - (d * u) */
18790
+ v = gen_reg_rtx (mode);
18791
+ rs6000_emit_nmsub (v, d, u, n);
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);
18800
-rs6000_emit_swdiv (rtx dst, rtx n, rtx d, bool note_p)
18802
- enum machine_mode mode = GET_MODE (dst);
18804
- if (RS6000_RECIP_HIGH_PRECISION_P (mode))
18805
- rs6000_emit_swdiv_high_precision (dst, n, d);
18807
- rs6000_emit_swdiv_low_precision (dst, n, d);
18810
add_reg_note (get_last_insn (), REG_EQUAL, gen_rtx_DIV (mode, n, d));
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;
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)
18827
REAL_VALUE_TYPE dconst3_2;
18830
@@ -26920,6 +29672,136 @@
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.
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,
18851
+ places the desired result in vr9. However, in LE mode the
18852
+ vector contents will be
18854
+ vr10 = 00000003 00000002 00000001 00000000
18855
+ vr11 = 00000007 00000006 00000005 00000004
18857
+ The result of the vperm using the same permute control vector is
18859
+ vr9 = 05000000 07000000 01000000 03000000
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.
18864
+ If we change the permute control vector to
18866
+ vr12 = {31,20,29,28,23,22,21,20,15,14,13,12,7,6,5,4}
18872
+ we get the desired
18874
+ vr9 = 00000006 00000004 00000002 00000000. */
18877
+altivec_expand_vec_perm_const_le (rtx operands[4])
18881
+ rtx constv, unspec;
18882
+ rtx target = operands[0];
18883
+ rtx op0 = operands[1];
18884
+ rtx op1 = operands[2];
18885
+ rtx sel = operands[3];
18887
+ /* Unpack and adjust the constant selector. */
18888
+ for (i = 0; i < 16; ++i)
18890
+ rtx e = XVECEXP (sel, 0, i);
18891
+ unsigned int elt = 31 - (INTVAL (e) & 31);
18892
+ perm[i] = GEN_INT (elt);
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);
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),
18906
+ if (!REG_P (target))
18908
+ rtx tmp = gen_reg_rtx (V16QImode);
18909
+ emit_move_insn (tmp, unspec);
18913
+ emit_move_insn (target, unspec);
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. */
18921
+altivec_expand_vec_perm_le (rtx operands[4])
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;
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);
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);
18950
+ /* Permute with operands reversed and adjusted selector. */
18951
+ unspec = gen_rtx_UNSPEC (V16QImode, gen_rtvec (3, op1, op0, tmp),
18954
+ /* Copy into target, possibly by way of a register. */
18955
+ if (!REG_P (target))
18957
+ emit_move_insn (tmp, unspec);
18961
+ emit_move_insn (target, unspec);
18964
/* Expand an Altivec constant permutation. Return true if we match
18965
an efficient implementation; false to fall back to VPERM. */
18967
@@ -26927,26 +29809,37 @@
18968
altivec_expand_vec_perm_const (rtx operands[4])
18970
struct altivec_perm_insn {
18971
+ HOST_WIDE_INT mask;
18972
enum insn_code impl;
18973
unsigned char perm[16];
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 } }
19013
unsigned int i, j, elt, which;
19014
@@ -27003,6 +29896,8 @@
19018
+ if (!BYTES_BIG_ENDIAN)
19020
emit_insn (gen_altivec_vspltb (target, op0, GEN_INT (elt)));
19023
@@ -27014,9 +29909,10 @@
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));
19035
@@ -27032,9 +29928,10 @@
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));
19047
@@ -27046,6 +29943,9 @@
19051
+ if ((patterns[j].mask & rs6000_isa_flags) == 0)
19054
elt = patterns[j].perm[0];
19055
if (perm[0] == elt)
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;
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)))
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)))
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)
19089
@@ -27087,6 +30010,12 @@
19093
+ if (!BYTES_BIG_ENDIAN)
19095
+ altivec_expand_vec_perm_const_le (operands);
19102
@@ -27136,6 +30065,21 @@
19103
gcc_assert (GET_MODE_NUNITS (vmode) == 2);
19104
dmode = mode_for_vector (GET_MODE_INNER (vmode), 4);
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)
19115
+ perm0 = 3 - perm0;
19116
+ perm1 = 3 - perm1;
19117
+ n = perm0, perm0 = perm1, perm1 = n;
19118
+ x = op0, op0 = op1, op1 = x;
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);
19128
- high = (highp == BYTES_BIG_ENDIAN ? 0 : nelt / 2);
19129
+ high = (highp ? 0 : nelt / 2);
19130
for (i = 0; i < nelt / 2; i++)
19132
perm[i * 2] = GEN_INT (i + high);
19133
@@ -27286,6 +30230,8 @@
19135
enum machine_mode mode;
19136
unsigned int regno;
19137
+ enum machine_mode elt_mode;
19140
/* Special handling for structs in darwin64. */
19142
@@ -27305,6 +30251,36 @@
19143
/* Otherwise fall through to standard ABI rules. */
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))
19150
+ int first_reg, n_regs, i;
19153
+ if (SCALAR_FLOAT_MODE_P (elt_mode))
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;
19161
+ first_reg = ALTIVEC_ARG_RETURN;
19165
+ par = gen_rtx_PARALLEL (TYPE_MODE (valtype), rtvec_alloc (n_elts));
19166
+ for (i = 0; i < n_elts; i++)
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);
19176
if (TARGET_32BIT && TARGET_POWERPC64 && TYPE_MODE (valtype) == DImode)
19178
/* Long long return value need be split in -mpowerpc64, 32bit ABI. */
19179
@@ -27679,22 +30655,32 @@
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
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 },
19222
/* Option variables that we want to support inside attribute((target)) and
19223
@@ -28250,7 +31239,6 @@
19225
size_t max_column = 76;
19226
const char *comma = "";
19227
- const char *nl = "\n";
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;
19238
fprintf (file, "%s%s%s%s", comma, prefix, no_str,
19239
@@ -28291,7 +31278,7 @@
19243
- fputs (nl, file);
19244
+ fputs ("\n", file);
19247
/* Helper function to print the current isa options on a line. */
19248
@@ -28467,118 +31454,149 @@
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. */
19258
+/* Expand code to perform a call under the AIX or ELFv2 ABI. */
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)
19264
+ rtx toc_reg = gen_rtx_REG (Pmode, TOC_REGNUM);
19265
+ rtx toc_load = NULL_RTX;
19266
+ rtx toc_restore = NULL_RTX;
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;
19277
+ rtx abi_reg = NULL_RTX;
19281
- rtx (*call_func) (rtx, rtx, rtx, rtx);
19282
- rtx (*call_value_func) (rtx, rtx, rtx, rtx, rtx);
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);
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));
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)))
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);
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)
19314
- call_func = gen_call_indirect_aix32bit;
19315
- call_value_func = gen_call_value_indirect_aix32bit;
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;
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);
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)
19336
+ if (DEFAULT_ABI == ABI_ELFv2)
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;
19348
- call_func = gen_call_indirect_aix64bit_nor11;
19349
- call_value_func = gen_call_value_indirect_aix64bit_nor11;
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. */
19359
- /* Reserved spot to store the TOC. */
19360
- stack_toc_mem = gen_frame_mem (Pmode,
19361
- gen_rtx_PLUS (Pmode,
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));
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);
19381
- /* Can we optimize saving the TOC in the prologue or do we need to do it at
19383
- if (TARGET_SAVE_TOC_INDIRECT && !cfun->calls_alloca)
19384
- cfun->machine->save_toc_in_prologue = true;
19386
+ /* If we have a static chain, load it up. */
19387
+ if (TARGET_POINTERS_TO_NESTED_FUNCTIONS)
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;
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;
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,
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]);
19422
- /* If we have a static chain, load it up. */
19423
- if (TARGET_POINTERS_TO_NESTED_FUNCTIONS)
19425
- func_sc_mem = gen_rtx_MEM (Pmode,
19426
- gen_rtx_PLUS (Pmode,
19428
- func_sc_offset));
19430
+ call[n_call++] = toc_load;
19432
+ call[n_call++] = toc_restore;
19434
- sc_reg = gen_rtx_REG (Pmode, STATIC_CHAIN_REGNUM);
19435
- emit_move_insn (sc_reg, func_sc_mem);
19437
+ call[n_call++] = gen_rtx_CLOBBER (VOIDmode, gen_rtx_REG (Pmode, LR_REGNO));
19439
+ insn = gen_rtx_PARALLEL (VOIDmode, gen_rtvec_v (n_call, call));
19440
+ insn = emit_call_insn (insn);
19442
+ /* Mention all registers defined by the ABI to hold information
19443
+ as uses in CALL_INSN_FUNCTION_USAGE. */
19445
+ use_reg (&CALL_INSN_FUNCTION_USAGE (insn), abi_reg);
19448
+/* Expand code to perform a sibling call under the AIX or ELFv2 ABI. */
19451
+rs6000_sibcall_aix (rtx value, rtx func_desc, rtx flag, rtx cookie)
19456
+ gcc_assert (INTVAL (cookie) == 0);
19458
/* Create the call. */
19460
- insn = call_value_func (value, func_addr, flag, func_toc_mem,
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]);
19468
- emit_call_insn (insn);
19469
+ call[1] = simple_return_rtx;
19471
+ insn = gen_rtx_PARALLEL (VOIDmode, gen_rtvec_v (2, call));
19472
+ insn = emit_call_insn (insn);
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));
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);
19487
+/* Helper function for rs6000_split_logical to emit a logical instruction after
19488
+ spliting the operation to single GPR registers.
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. */
19501
+rs6000_split_logical_inner (rtx dest,
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,
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)
19519
+ HOST_WIDE_INT mask = GET_MODE_MASK (mode);
19520
+ HOST_WIDE_INT value = INTVAL (op2) & mask;
19522
+ /* Optimize AND of 0 to just set 0. Optimize AND of -1 to be a move. */
19527
+ emit_insn (gen_rtx_SET (VOIDmode, dest, const0_rtx));
19531
+ else if (value == mask)
19533
+ if (!rtx_equal_p (dest, op1))
19534
+ emit_insn (gen_rtx_SET (VOIDmode, dest, op1));
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)
19545
+ if (!rtx_equal_p (dest, op1))
19546
+ emit_insn (gen_rtx_SET (VOIDmode, dest, op1));
19552
+ if (complement_op1_p)
19553
+ op1 = gen_rtx_NOT (mode, op1);
19555
+ if (complement_op2_p)
19556
+ op2 = gen_rtx_NOT (mode, op2);
19558
+ bool_rtx = ((code == NOT)
19559
+ ? gen_rtx_NOT (mode, op1)
19560
+ : gen_rtx_fmt_ee (code, mode, op1, op2));
19562
+ if (complement_final_p)
19563
+ bool_rtx = gen_rtx_NOT (mode, bool_rtx);
19565
+ set_rtx = gen_rtx_SET (VOIDmode, dest, bool_rtx);
19567
+ /* Is this AND with an explicit clobber? */
19570
+ rtx clobber = gen_rtx_CLOBBER (VOIDmode, clobber_reg);
19571
+ set_rtx = gen_rtx_PARALLEL (VOIDmode, gen_rtvec (2, set_rtx, clobber));
19574
+ emit_insn (set_rtx);
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.
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. */
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,
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];
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]);
19612
+ op2_hi_lo[hi] = op2_hi_lo[lo] = NULL_RTX;
19615
+ if (GET_CODE (operands[2]) != CONST_INT)
19617
+ op2_hi_lo[hi] = gen_highpart_mode (SImode, DImode, operands[2]);
19618
+ op2_hi_lo[lo] = gen_lowpart (SImode, operands[2]);
19622
+ HOST_WIDE_INT value = INTVAL (operands[2]);
19623
+ HOST_WIDE_INT value_hi_lo[2];
19625
+ gcc_assert (!complement_final_p);
19626
+ gcc_assert (!complement_op1_p);
19627
+ gcc_assert (!complement_op2_p);
19629
+ value_hi_lo[hi] = value >> 32;
19630
+ value_hi_lo[lo] = value & lower_32bits;
19632
+ for (i = 0; i < 2; i++)
19634
+ HOST_WIDE_INT sub_value = value_hi_lo[i];
19636
+ if (sub_value & sign_bit)
19637
+ sub_value |= upper_32bits;
19639
+ op2_hi_lo[i] = GEN_INT (sub_value);
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]);
19650
+ for (i = 0; i < 2; i++)
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))
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);
19666
+ /* Make sure the constant is sign extended. */
19667
+ if ((hi_16bits & sign_bit) != 0)
19668
+ hi_16bits |= upper_32bits;
19670
+ rs6000_split_logical_inner (tmp, op1_hi_lo[i], GEN_INT (hi_16bits),
19671
+ code, SImode, false, false, false,
19674
+ rs6000_split_logical_inner (op0_hi_lo[i], tmp, GEN_INT (lo_16bits),
19675
+ code, SImode, false, false, false,
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,
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.
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. */
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,
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;
19714
+ /* If this is DImode, use the specialized version that can run before
19715
+ register allocation. */
19716
+ if (mode == DImode && !TARGET_POWERPC64)
19718
+ rs6000_split_logical_di (operands, code, complement_final_p,
19719
+ complement_op1_p, complement_op2_p,
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);
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));
19736
+ nregs = rs6000_hard_regno_nregs[(int)mode][regno0];
19737
+ gcc_assert (nregs > 1);
19739
+ if (op2 && REG_P (op2))
19740
+ gcc_assert (IN_RANGE (REGNO (op2), FIRST_GPR_REGNO, LAST_GPR_REGNO));
19742
+ for (i = 0; i < nregs; i++)
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)
19749
+ : simplify_subreg (sub_mode, op2, mode, offset));
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);
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
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].
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. */
19775
+fusion_gpr_load_p (rtx *operands, bool peep2_p)
19777
+ rtx addis_reg = operands[0];
19778
+ rtx addis_value = operands[1];
19779
+ rtx target = operands[2];
19780
+ rtx mem = operands[3];
19784
+ /* Validate arguments. */
19785
+ if (!base_reg_operand (addis_reg, GET_MODE (addis_reg)))
19788
+ if (!base_reg_operand (target, GET_MODE (target)))
19791
+ if (!fusion_gpr_addis (addis_value, GET_MODE (addis_value)))
19794
+ if (!fusion_gpr_mem_load (mem, GET_MODE (mem)))
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);
19802
+ if (!MEM_P (mem))
19805
+ addr = XEXP (mem, 0); /* either PLUS or LO_SUM. */
19806
+ if (GET_CODE (addr) != PLUS && GET_CODE (addr) != LO_SUM)
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.
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))
19821
+ if (reg_mentioned_p (target, mem))
19824
+ if (!peep2_reg_dead_p (2, addis_reg))
19828
+ base_reg = XEXP (addr, 0);
19829
+ return REGNO (addis_reg) == REGNO (base_reg);
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
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]. */
19845
+expand_fusion_gpr_load (rtx *operands)
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)
19858
+ : simplify_subreg (ptr_mode, target, target_mode, 0));
19860
+ if (GET_CODE (orig_mem) == ZERO_EXTEND
19861
+ || (TARGET_P8_FUSION_SIGN && GET_CODE (orig_mem) == SIGN_EXTEND))
19863
+ extend = GET_CODE (orig_mem);
19864
+ orig_mem = XEXP (orig_mem, 0);
19865
+ target_mode = GET_MODE (orig_mem);
19868
+ gcc_assert (MEM_P (orig_mem));
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);
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);
19878
+ if (extend != UNKNOWN)
19879
+ new_mem = gen_rtx_fmt_e (ZERO_EXTEND, extend_mode, new_mem);
19881
+ emit_insn (gen_rtx_SET (VOIDmode, addis_reg, addis_value));
19882
+ emit_insn (gen_rtx_SET (VOIDmode, target, new_mem));
19884
+ if (extend == SIGN_EXTEND)
19886
+ int sub_off = ((BYTES_BIG_ENDIAN)
19887
+ ? GET_MODE_SIZE (extend_mode) - GET_MODE_SIZE (target_mode)
19890
+ = simplify_subreg (target_mode, target, extend_mode, sub_off);
19892
+ emit_insn (gen_rtx_SET (VOIDmode, target,
19893
+ gen_rtx_SIGN_EXTEND (extend_mode, sign_reg)));
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 "".
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]. */
19910
+emit_fusion_gpr_load (rtx *operands)
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];
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;
19928
+ gcc_assert (REG_P (addis_reg) && REG_P (target));
19929
+ gcc_assert (REGNO (addis_reg) == REGNO (target));
19931
+ if (*comment_str == ' ')
19934
+ /* Allow sign/zero extension. */
19935
+ if (GET_CODE (mem) == ZERO_EXTEND)
19936
+ mem = XEXP (mem, 0);
19938
+ else if (GET_CODE (mem) == SIGN_EXTEND && TARGET_P8_FUSION_SIGN)
19941
+ mem = XEXP (mem, 0);
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 ();
19949
+ load_offset = XEXP (addr, 1);
19951
+ /* Now emit the load instruction to the same register. */
19952
+ mode = GET_MODE (mem);
19956
+ mode_name = "char";
19957
+ load_str = "lbz";
19958
+ extend_insn = "extsb %0,%0";
19962
+ mode_name = "short";
19963
+ load_str = "lhz";
19964
+ extend_insn = "extsh %0,%0";
19968
+ mode_name = "int";
19969
+ load_str = "lwz";
19970
+ extend_insn = "extsw %0,%0";
19974
+ if (TARGET_POWERPC64)
19976
+ mode_name = "long";
19980
+ gcc_unreachable ();
19984
+ gcc_unreachable ();
19987
+ /* Emit the addis instruction. */
19988
+ fuse_ops[0] = target;
19989
+ if (satisfies_constraint_L (addis_value))
19991
+ fuse_ops[1] = addis_value;
19992
+ addis_str = "lis %0,%v1";
19995
+ else if (GET_CODE (addis_value) == PLUS)
19997
+ rtx op0 = XEXP (addis_value, 0);
19998
+ rtx op1 = XEXP (addis_value, 1);
20000
+ if (REG_P (op0) && CONST_INT_P (op1)
20001
+ && satisfies_constraint_L (op1))
20003
+ fuse_ops[1] = op0;
20004
+ fuse_ops[2] = op1;
20005
+ addis_str = "addis %0,%1,%v2";
20009
+ else if (GET_CODE (addis_value) == HIGH)
20011
+ rtx value = XEXP (addis_value, 0);
20012
+ if (GET_CODE (value) == UNSPEC && XINT (value, 1) == UNSPEC_TOCREL)
20014
+ fuse_ops[1] = XVECEXP (value, 0, 0); /* symbol ref. */
20015
+ fuse_ops[2] = XVECEXP (value, 0, 1); /* TOC register. */
20017
+ addis_str = "addis %0,%2,%1@toc@ha";
20019
+ else if (TARGET_XCOFF)
20020
+ addis_str = "addis %0,%1@u(%2)";
20023
+ gcc_unreachable ();
20026
+ else if (GET_CODE (value) == PLUS)
20028
+ rtx op0 = XEXP (value, 0);
20029
+ rtx op1 = XEXP (value, 1);
20031
+ if (GET_CODE (op0) == UNSPEC
20032
+ && XINT (op0, 1) == UNSPEC_TOCREL
20033
+ && CONST_INT_P (op1))
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;
20039
+ addis_str = "addis %0,%2,%1+%3@toc@ha";
20041
+ else if (TARGET_XCOFF)
20042
+ addis_str = "addis %0,%1+%3@u(%2)";
20045
+ gcc_unreachable ();
20049
+ else if (satisfies_constraint_L (value))
20051
+ fuse_ops[1] = value;
20052
+ addis_str = "lis %0,%v1";
20055
+ else if (TARGET_ELF && !TARGET_POWERPC64 && CONSTANT_P (value))
20057
+ fuse_ops[1] = value;
20058
+ addis_str = "lis %0,%1@ha";
20063
+ fatal_insn ("Could not generate addis value for fusion", addis_value);
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);
20069
+ /* Emit the D-form load instruction. */
20070
+ if (CONST_INT_P (load_offset) && satisfies_constraint_I (load_offset))
20072
+ sprintf (insn_template, "%s %%0,%%1(%%0)", load_str);
20073
+ fuse_ops[1] = load_offset;
20074
+ output_asm_insn (insn_template, fuse_ops);
20077
+ else if (GET_CODE (load_offset) == UNSPEC
20078
+ && XINT (load_offset, 1) == UNSPEC_TOCREL)
20081
+ sprintf (insn_template, "%s %%0,%%1@toc@l(%%0)", load_str);
20083
+ else if (TARGET_XCOFF)
20084
+ sprintf (insn_template, "%s %%0,%%1@l(%%0)", load_str);
20087
+ gcc_unreachable ();
20089
+ fuse_ops[1] = XVECEXP (load_offset, 0, 0);
20090
+ output_asm_insn (insn_template, fuse_ops);
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)))
20098
+ rtx tocrel_unspec = XEXP (load_offset, 0);
20100
+ sprintf (insn_template, "%s %%0,%%1+%%2@toc@l(%%0)", load_str);
20102
+ else if (TARGET_XCOFF)
20103
+ sprintf (insn_template, "%s %%0,%%1+%%2@l(%%0)", load_str);
20106
+ gcc_unreachable ();
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);
20113
+ else if (TARGET_ELF && !TARGET_POWERPC64 && CONSTANT_P (load_offset))
20115
+ sprintf (insn_template, "%s %%0,%%1@l(%%0)", load_str);
20117
+ fuse_ops[1] = load_offset;
20118
+ output_asm_insn (insn_template, fuse_ops);
20122
+ fatal_insn ("Unable to generate load offset for fusion", load_offset);
20124
+ /* Handle sign extension. The peephole2 pass generates this as a separate
20125
+ insn, but we handle it just in case it got reattached. */
20128
+ gcc_assert (extend_insn != NULL);
20129
+ output_asm_insn (extend_insn, fuse_ops);
20136
struct gcc_target targetm = TARGET_INITIALIZER;
20138
#include "gt-rs6000.h"
20139
--- a/src/gcc/config/rs6000/vsx.md
20140
+++ b/src/gcc/config/rs6000/vsx.md
20142
;; it to use gprs as well as vsx registers.
20143
(define_mode_iterator VSX_M [V16QI V8HI V4SI V2DI V4SF V2DF])
20145
+(define_mode_iterator VSX_M2 [V16QI
20151
+ (TI "TARGET_VSX_TIMODE")])
20153
;; Map into the appropriate load/store name based on the type
20154
(define_mode_attr VSm [(V16QI "vw4")
20163
;; Map into the appropriate suffix based on the type
20164
(define_mode_attr VSs [(V16QI "sp")
20172
;; Map the register class used
20173
(define_mode_attr VSr [(V16QI "v")
20181
;; Map the register class used for float<->int conversions
20182
(define_mode_attr VSr2 [(V2DF "wd")
20183
@@ -115,7 +123,6 @@
20190
;; Appropriate type for add ops (and other simple FP ops)
20191
@@ -192,6 +199,8 @@
20192
UNSPEC_VSX_CVDPSXWS
20193
UNSPEC_VSX_CVDPUXWS
20195
+ UNSPEC_VSX_CVSPDPN
20196
+ UNSPEC_VSX_CVDPSPN
20200
@@ -207,77 +216,393 @@
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))"
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"
20218
+ "!BYTES_BIG_ENDIAN && TARGET_VSX"
20219
+ [(set (match_dup 2)
20220
+ (vec_select:<MODE>
20222
+ (parallel [(const_int 1) (const_int 0)])))
20223
+ (set (match_dup 0)
20224
+ (vec_select:<MODE>
20226
+ (parallel [(const_int 1) (const_int 0)])))]
20229
- switch (which_alternative)
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])
20242
+ [(set_attr "type" "vecload")
20243
+ (set_attr "length" "8")])
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"
20257
+ "!BYTES_BIG_ENDIAN && TARGET_VSX"
20258
+ [(set (match_dup 2)
20259
+ (vec_select:<MODE>
20261
+ (parallel [(const_int 2) (const_int 3)
20262
+ (const_int 0) (const_int 1)])))
20263
+ (set (match_dup 0)
20264
+ (vec_select:<MODE>
20266
+ (parallel [(const_int 2) (const_int 3)
20267
+ (const_int 0) (const_int 1)])))]
20270
+ operands[2] = can_create_pseudo_p () ? gen_reg_rtx_and_attrs (operands[0])
20274
+ [(set_attr "type" "vecload")
20275
+ (set_attr "length" "8")])
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"
20285
+ "!BYTES_BIG_ENDIAN && TARGET_VSX"
20286
+ [(set (match_dup 2)
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)
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)])))]
20302
+ operands[2] = can_create_pseudo_p () ? gen_reg_rtx_and_attrs (operands[0])
20306
+ [(set_attr "type" "vecload")
20307
+ (set_attr "length" "8")])
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"
20319
+ "!BYTES_BIG_ENDIAN && TARGET_VSX"
20320
+ [(set (match_dup 2)
20321
+ (vec_select:V16QI
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
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)])))]
20344
+ operands[2] = can_create_pseudo_p () ? gen_reg_rtx_and_attrs (operands[0])
20348
+ [(set_attr "type" "vecload")
20349
+ (set_attr "length" "8")])
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"
20359
+ [(set_attr "type" "vecstore")
20360
+ (set_attr "length" "12")])
20363
- return output_vec_const_move (operands);
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>
20371
+ (parallel [(const_int 1) (const_int 0)])))
20372
+ (set (match_dup 0)
20373
+ (vec_select:<MODE>
20375
+ (parallel [(const_int 1) (const_int 0)])))]
20377
+ operands[2] = can_create_pseudo_p () ? gen_reg_rtx_and_attrs (operands[1])
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.
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>
20396
+ (parallel [(const_int 1) (const_int 0)])))
20397
+ (set (match_dup 0)
20398
+ (vec_select:<MODE>
20400
+ (parallel [(const_int 1) (const_int 0)])))
20401
+ (set (match_dup 1)
20402
+ (vec_select:<MODE>
20404
+ (parallel [(const_int 1) (const_int 0)])))]
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"
20418
+ [(set_attr "type" "vecstore")
20419
+ (set_attr "length" "12")])
20422
- gcc_unreachable ();
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>
20431
+ (parallel [(const_int 2) (const_int 3)
20432
+ (const_int 0) (const_int 1)])))
20433
+ (set (match_dup 0)
20434
+ (vec_select:<MODE>
20436
+ (parallel [(const_int 2) (const_int 3)
20437
+ (const_int 0) (const_int 1)])))]
20439
+ operands[2] = can_create_pseudo_p () ? gen_reg_rtx_and_attrs (operands[1])
20443
+;; The post-reload split requires that we re-permute the source
20444
+;; register in case it is still live.
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>
20452
+ (parallel [(const_int 2) (const_int 3)
20453
+ (const_int 0) (const_int 1)])))
20454
+ (set (match_dup 0)
20455
+ (vec_select:<MODE>
20457
+ (parallel [(const_int 2) (const_int 3)
20458
+ (const_int 0) (const_int 1)])))
20459
+ (set (match_dup 1)
20460
+ (vec_select:<MODE>
20462
+ (parallel [(const_int 2) (const_int 3)
20463
+ (const_int 0) (const_int 1)])))]
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"
20471
+ [(set_attr "type" "vecstore")
20472
+ (set_attr "length" "12")])
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)
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)
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)])))]
20493
+ operands[2] = can_create_pseudo_p () ? gen_reg_rtx_and_attrs (operands[1])
20497
+;; The post-reload split requires that we re-permute the source
20498
+;; register in case it is still live.
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)
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)
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)
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)])))]
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"
20531
+ [(set_attr "type" "vecstore")
20532
+ (set_attr "length" "12")])
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
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
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)])))]
20561
+ operands[2] = can_create_pseudo_p () ? gen_reg_rtx_and_attrs (operands[1])
20565
+;; The post-reload split requires that we re-permute the source
20566
+;; register in case it is still live.
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
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
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
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)])))]
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))"
20614
+ return rs6000_output_move_128bit (operands);
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")])
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))"
20636
+ return rs6000_output_move_128bit (operands);
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")])
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))"
20648
switch (which_alternative)
20651
@@ -290,27 +615,45 @@
20652
return "xxlor %x0,%x1,%x1";
20655
+ return "xxlxor %x0,%x0,%x0";
20658
+ return output_vec_const_move (operands);
20662
+ return "stvx %1,%y0";
20665
- return "xxlxor %x0,%x0,%x0";
20666
+ return "lvx %0,%y1";
20669
- return output_vec_const_move (operands);
20670
+ if (TARGET_STRING)
20671
+ return \"stswi %1,%P0,16\";
20674
- return "stvx %1,%y0";
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 ... */
20691
gcc_unreachable ();
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")))])
20701
;; Explicit load/store expanders for the builtin functions
20702
(define_expand "vsx_load_<mode>"
20703
@@ -320,46 +663,48 @@
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)"
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
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>")])
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>")])
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>")])
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>")])
20772
@@ -402,94 +747,72 @@
20773
(set_attr "fp_type" "<VSfptype_simple>")])
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")]
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>")])
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>")])
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>")])
20809
(define_insn "vsx_nabs<mode>2"
20810
- [(set (match_operand:VSX_B 0 "vsx_register_operand" "=<VSr>,?wa")
20813
- (match_operand:VSX_B 1 "vsx_register_operand" "<VSr>,wa"))))]
20814
+ [(set (match_operand:VSX_F 0 "vsx_register_operand" "=<VSr>,?wa")
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>")])
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>")])
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>")])
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.
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")])
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")])
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>")])
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")]
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>")])
20895
@@ -528,27 +851,11 @@
20896
[(set_attr "type" "<VStype_simple>")
20897
(set_attr "fp_type" "<VSfptype_simple>")])
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
20908
-(define_insn "*vsx_fmadf4"
20909
- [(set (match_operand:DF 0 "vsx_register_operand" "=ws,ws,?wa,?wa,d")
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)"
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")])
20924
(define_insn "*vsx_fmav4sf4"
20925
[(set (match_operand:V4SF 0 "vsx_register_operand" "=ws,ws,?wa,?wa,v")
20927
@@ -578,23 +885,6 @@
20928
xvmaddmdp %x0,%x1,%x3"
20929
[(set_attr "type" "vecdouble")])
20931
-(define_insn "*vsx_fmsdf4"
20932
- [(set (match_operand:DF 0 "vsx_register_operand" "=ws,ws,?wa,?wa,d")
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")
20937
- (match_operand:DF 3 "vsx_register_operand" "0,ws,0,wa,d"))))]
20938
- "VECTOR_UNIT_VSX_P (DFmode)"
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")])
20948
(define_insn "*vsx_fms<mode>4"
20949
[(set (match_operand:VSX_F 0 "vsx_register_operand" "=<VSr>,<VSr>,?wa,?wa")
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)"
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>")])
20965
-(define_insn "*vsx_nfmadf4"
20966
- [(set (match_operand:DF 0 "vsx_register_operand" "=ws,ws,?wa,?wa,d")
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)"
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")])
20982
(define_insn "*vsx_nfma<mode>4"
20983
[(set (match_operand:VSX_F 0 "vsx_register_operand" "=<VSr>,<VSr>,?wa,?wa")
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)"
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>")])
21000
-(define_insn "*vsx_nfmsdf4"
21001
- [(set (match_operand:DF 0 "vsx_register_operand" "=ws,ws,?wa,?wa,d")
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")
21007
- (match_operand:DF 3 "vsx_register_operand" "0,ws,0,wa,d")))))]
21008
- "VECTOR_UNIT_VSX_P (DFmode)"
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")])
21018
(define_insn "*vsx_nfmsv4sf4"
21019
[(set (match_operand:V4SF 0 "vsx_register_operand" "=wf,wf,?wa,?wa,v")
21021
@@ -722,16 +977,6 @@
21022
[(set_attr "type" "<VStype_simple>")
21023
(set_attr "fp_type" "<VSfptype_simple>")])
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")])
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 @@
21041
(define_insn "vsx_copysign<mode>3"
21042
- [(set (match_operand:VSX_B 0 "vsx_register_operand" "=<VSr>,?wa")
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")
21048
+ [(match_operand:VSX_F 1 "vsx_register_operand" "<VSr>,wa")
21049
+ (match_operand:VSX_F 2 "vsx_register_operand" "<VSr>,wa")]
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>")])
21057
@@ -865,10 +1110,10 @@
21058
(set_attr "fp_type" "<VSfptype_simple>")])
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>")])
21071
@@ -882,20 +1127,20 @@
21072
(set_attr "fp_type" "<VSfptype_simple>")])
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")]
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>")])
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")]
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>")])
21098
@@ -942,6 +1187,40 @@
21100
[(set_attr "type" "fp")])
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")])
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")])
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")])
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")])
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>")])
21143
-;; Logical and permute operations
21144
-(define_insn "*vsx_and<mode>3"
21145
- [(set (match_operand:VSX_L 0 "vsx_register_operand" "=<VSr>,?wa")
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")])
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")])
21161
-(define_insn "*vsx_xor<mode>3"
21162
- [(set (match_operand:VSX_L 0 "vsx_register_operand" "=<VSr>,?wa")
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")])
21170
-(define_insn "*vsx_one_cmpl<mode>2"
21171
- [(set (match_operand:VSX_L 0 "vsx_register_operand" "=<VSr>,?wa")
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")])
21178
-(define_insn "*vsx_nor<mode>3"
21179
- [(set (match_operand:VSX_L 0 "vsx_register_operand" "=<VSr>,?wa")
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")])
21188
-(define_insn "*vsx_andc<mode>3"
21189
- [(set (match_operand:VSX_L 0 "vsx_register_operand" "=<VSr>,?wa")
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")])
21199
;; Permute operations
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")
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"
21215
+ if (BYTES_BIG_ENDIAN)
21216
+ return "xxpermdi %x0,%x1,%x2,0";
21218
+ return "xxpermdi %x0,%x2,%x1,0";
21220
[(set_attr "type" "vecperm")])
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"
21229
+ if (BYTES_BIG_ENDIAN)
21230
+ return "xxpermdi %x0,%x1,%x2,0";
21232
+ return "xxpermdi %x0,%x2,%x1,0";
21234
[(set_attr "type" "vecperm")])
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")])
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")])
21257
+(define_insn "*vsx_xxpermdi8_le_V8HI"
21258
+ [(set (match_operand:V8HI 0 "vsx_register_operand" "=wa")
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")])
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")])
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)"
21294
+ [(set_attr "type" "vecload")])
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)"
21304
+ [(set_attr "type" "vecload")])
21306
+(define_insn "*vsx_lxvd2x8_le_V8HI"
21307
+ [(set (match_operand:V8HI 0 "vsx_register_operand" "=wa")
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)"
21316
+ [(set_attr "type" "vecload")])
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)"
21332
+ [(set_attr "type" "vecload")])
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")])
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")])
21355
+(define_insn "*vsx_stxvd2x8_le_V8HI"
21356
+ [(set (match_operand:V8HI 0 "memory_operand" "=Z")
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")])
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")])
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 @@
21388
"VECTOR_MEM_VSX_P (<MODE>mode)"
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\";
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)"
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\";
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"
21417
- [(set_attr "type" "fpload")
21418
+ [(set (attr "type")
21420
+ (match_test "update_indexed_address_mem (operands[1], VOIDmode)")
21421
+ (const_string "fpload_ux")
21422
+ (const_string "fpload")))
21423
(set_attr "length" "4")])
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")
21435
+ (match_test "update_indexed_address_mem (operands[1], VOIDmode)")
21436
+ (const_string "fpload_ux")
21437
+ (const_string "fpload")))
21438
+ (set_attr "length" "4")])
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];
21447
- HOST_WIDE_INT ele = INTVAL (op2);
21448
+ HOST_WIDE_INT ele = BYTES_BIG_ENDIAN ? INTVAL (op2) : 3 - INTVAL (op2);
21452
@@ -1213,8 +1616,8 @@
21453
if (<MODE>mode != V2DImode)
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);
21462
emit_insn (gen (target, op0, op1, perm0, perm1));
21463
@@ -1483,3 +1886,27 @@
21465
[(set_attr "length" "20")
21466
(set_attr "type" "veccomplex")])
21469
+;; Power8 Vector fusion. The fused ops must be physically adjacent.
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")])
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
21494
#ifdef HAVE_AS_POWER8
21495
#define ASM_CPU_POWER8_SPEC "-mpower8"
21497
-#define ASM_CPU_POWER8_SPEC "-mpower4 -maltivec"
21498
+#define ASM_CPU_POWER8_SPEC ASM_CPU_POWER7_SPEC
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)}} \
21509
#define CPP_DEFAULT_SPEC ""
21510
@@ -277,6 +278,21 @@
21511
#define TARGET_POPCNTD 0
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
21518
+#ifndef HAVE_AS_POWER8
21519
+#undef TARGET_DIRECT_MOVE
21520
+#undef TARGET_CRYPTO
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
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)
21536
+/* Describe the vector unit used for arithmetic operations. */
21537
extern enum rs6000_vector rs6000_vector_unit[];
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)
21544
+#define VECTOR_UNIT_P8_VECTOR_P(MODE) \
21545
+ (rs6000_vector_unit[(MODE)] == VECTOR_P8_VECTOR)
21547
#define VECTOR_UNIT_ALTIVEC_P(MODE) \
21548
(rs6000_vector_unit[(MODE)] == VECTOR_ALTIVEC)
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))
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
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))
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)
21572
+#define VECTOR_MEM_P8_VECTOR_P(MODE) \
21573
+ (rs6000_vector_mem[(MODE)] == VECTOR_VSX)
21575
#define VECTOR_MEM_ALTIVEC_P(MODE) \
21576
(rs6000_vector_mem[(MODE)] == VECTOR_ALTIVEC)
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))
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))
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
21596
+#define TARGET_XSCVDPSPN (TARGET_DIRECT_MOVE || TARGET_P8_VECTOR)
21597
+#define TARGET_XSCVSPDPN (TARGET_DIRECT_MOVE || TARGET_P8_VECTOR)
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
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)
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
21641
#define MASK_POWERPC64 OPTION_MASK_POWERPC64
21642
@@ -558,6 +617,25 @@
21643
|| rs6000_cpu == PROCESSOR_PPC8548)
21646
+/* Whether SF/DF operations are supported on the E500. */
21647
+#define TARGET_SF_SPE (TARGET_HARD_FLOAT && TARGET_SINGLE_FLOAT \
21650
+#define TARGET_DF_SPE (TARGET_HARD_FLOAT && TARGET_DOUBLE_FLOAT \
21651
+ && !TARGET_FPRS && TARGET_E500_DOUBLE)
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)
21658
+#define TARGET_DF_FPR (TARGET_HARD_FLOAT && TARGET_FPRS \
21659
+ && TARGET_DOUBLE_FLOAT)
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)
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)
21672
-#define RS6000_RECIP_HIGH_PRECISION_P(MODE) \
21673
- ((MODE) == SFmode || (MODE) == V4SFmode || TARGET_RECIP_PRECISION)
21675
/* The default CPU for TARGET_OPTION_OVERRIDE. */
21676
#define OPTION_TARGET_CPU_DEFAULT TARGET_CPU_DEFAULT
21678
@@ -842,15 +917,17 @@
21679
in inline functions.
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.
21685
-#define FIRST_PSEUDO_REGISTER 114
21686
+ The 3 HTM registers aren't also included in DWARF_FRAME_REGISTERS. */
21688
+#define FIRST_PSEUDO_REGISTER 117
21690
/* This must be included for pre gcc 3.0 glibc compatibility. */
21691
#define PRE_GCC3_DWARF_FRAME_REGISTERS 77
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)
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))
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, \
21713
+ , 1, 1, 1, 1, 1, 1 \
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, \
21722
+ , 1, 1, 1, 1, 1, 1 \
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, \
21731
+ , 0, 0, 0, 0, 0, 0 \
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)
21745
@@ -1004,7 +1084,9 @@
21747
#define REG_ALLOC_ORDER \
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, \
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, \
21761
+ 111, 112, 113, 114, 115, 116 \
21764
/* True if register is floating-point. */
21765
@@ -1064,8 +1146,11 @@
21766
#define VINT_REGNO_P(N) ALTIVEC_REGNO_P (N)
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))) \
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.
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
21791
+#define MODES_TIEABLE_P(MODE1, MODE2) \
21792
+ ((MODE1) == PTImode \
21793
+ ? (MODE2) == PTImode \
21794
+ : (MODE2) == PTImode \
21796
+ : SCALAR_FLOAT_MODE_P (MODE1) \
21797
? SCALAR_FLOAT_MODE_P (MODE2) \
21798
: SCALAR_FLOAT_MODE_P (MODE2) \
21799
- ? SCALAR_FLOAT_MODE_P (MODE1) \
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 \
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) \
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) \
21822
/* Post-reload, we can't use any new AltiVec registers, as we already
21823
@@ -1240,6 +1329,7 @@
21831
@@ -1270,6 +1360,7 @@
21836
"NON_SPECIAL_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 */ \
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
21875
@@ -1425,21 +1528,14 @@
21877
#define FRAME_GROWS_DOWNWARD (flag_stack_protect != 0 || flag_asan != 0)
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) \
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))
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))
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
21905
-#define REG_PARM_STACK_SPACE(FNDECL) RS6000_REG_SAVE
21906
+#define REG_PARM_STACK_SPACE(FNDECL) rs6000_reg_parm_stack_space((FNDECL))
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)
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)
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)
21935
+/* Maximum number of registers per ELFv2 homogeneous aggregate argument. */
21936
+#define AGGR_ARG_NUM_REG 8
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))
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))
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))
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 */ \
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} }
21995
/* This is how to output an element of a case-vector that is relative. */
21997
@@ -2357,7 +2463,12 @@
21998
#define RS6000_BTC_ATTR_MASK 0x00000700 /* Mask of the attributes. */
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. */
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 @@
22023
#define RS6000_BTM_COMMON (RS6000_BTM_ALTIVEC \
22025
+ | RS6000_BTM_P8_VECTOR \
22026
+ | RS6000_BTM_CRYPTO \
22028
| RS6000_BTM_FRES \
22029
| RS6000_BTM_FRSQRTE \
22030
| RS6000_BTM_FRSQRTES \
22031
+ | RS6000_BTM_HTM \
22032
| RS6000_BTM_POPCNTD \
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 @@
22074
+ UNSPEC_VPACK_SIGN_SIGN_SAT
22075
+ UNSPEC_VPACK_SIGN_UNS_SAT
22076
+ UNSPEC_VPACK_UNS_UNS_SAT
22077
+ UNSPEC_VPACK_UNS_UNS_MOD
22081
@@ -71,12 +67,10 @@
22086
+ UNSPEC_VUNPACK_HI_SIGN
22087
+ UNSPEC_VUNPACK_LO_SIGN
22096
@@ -134,6 +128,7 @@
22103
(define_c_enum "unspecv"
22104
@@ -146,6 +141,8 @@
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])
22113
@@ -159,9 +156,19 @@
22114
;; Like VM, except don't do TImode
22115
(define_mode_iterator VM2 [V4SI V8HI V16QI V4SF V2DF V2DI])
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)")])
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")])
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 @@
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")))]
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")))]
22147
"vaddu<VI_char>m %0,%1,%2"
22148
[(set_attr "type" "vecsimple")])
22150
@@ -398,17 +405,17 @@
22151
(unspec:V4SI [(match_operand:V4SI 1 "register_operand" "v")
22152
(match_operand:V4SI 2 "register_operand" "v")]
22155
+ "VECTOR_UNIT_ALTIVEC_P (V4SImode)"
22157
[(set_attr "type" "vecsimple")])
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")]
22165
(set (reg:SI 110) (unspec:SI [(const_int 0)] UNSPEC_SET_VSCR))]
22168
"vaddu<VI_char>s %0,%1,%2"
22169
[(set_attr "type" "vecsimple")])
22171
@@ -418,16 +425,16 @@
22172
(match_operand:VI 2 "register_operand" "v")]
22174
(set (reg:SI 110) (unspec:SI [(const_int 0)] UNSPEC_SET_VSCR))]
22176
+ "VECTOR_UNIT_ALTIVEC_P (<MODE>mode)"
22177
"vadds<VI_char>s %0,%1,%2"
22178
[(set_attr "type" "vecsimple")])
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")))]
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")))]
22190
"vsubu<VI_char>m %0,%1,%2"
22191
[(set_attr "type" "vecsimple")])
22193
@@ -444,7 +451,7 @@
22194
(unspec:V4SI [(match_operand:V4SI 1 "register_operand" "v")
22195
(match_operand:V4SI 2 "register_operand" "v")]
22198
+ "VECTOR_UNIT_ALTIVEC_P (V4SImode)"
22200
[(set_attr "type" "vecsimple")])
22202
@@ -454,7 +461,7 @@
22203
(match_operand:VI 2 "register_operand" "v")]
22205
(set (reg:SI 110) (unspec:SI [(const_int 0)] UNSPEC_SET_VSCR))]
22207
+ "VECTOR_UNIT_ALTIVEC_P (<MODE>mode)"
22208
"vsubu<VI_char>s %0,%1,%2"
22209
[(set_attr "type" "vecsimple")])
22211
@@ -464,7 +471,7 @@
22212
(match_operand:VI 2 "register_operand" "v")]
22214
(set (reg:SI 110) (unspec:SI [(const_int 0)] UNSPEC_SET_VSCR))]
22216
+ "VECTOR_UNIT_ALTIVEC_P (<MODE>mode)"
22217
"vsubs<VI_char>s %0,%1,%2"
22218
[(set_attr "type" "vecsimple")])
22220
@@ -483,7 +490,7 @@
22221
(unspec:VI [(match_operand:VI 1 "register_operand" "v")
22222
(match_operand:VI 2 "register_operand" "v")]
22225
+ "VECTOR_UNIT_ALTIVEC_P (<MODE>mode)"
22226
"vavgs<VI_char> %0,%1,%2"
22227
[(set_attr "type" "vecsimple")])
22229
@@ -492,31 +499,31 @@
22230
(unspec:V4SI [(match_operand:V4SF 1 "register_operand" "v")
22231
(match_operand:V4SF 2 "register_operand" "v")]
22234
+ "VECTOR_UNIT_ALTIVEC_P (V4SImode)"
22236
[(set_attr "type" "veccmp")])
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")))]
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")))]
22247
"vcmpequ<VI_char> %0,%1,%2"
22248
[(set_attr "type" "veccmp")])
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")))]
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")))]
22259
"vcmpgts<VI_char> %0,%1,%2"
22260
[(set_attr "type" "veccmp")])
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")))]
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")))]
22271
"vcmpgtu<VI_char> %0,%1,%2"
22272
[(set_attr "type" "veccmp")])
22274
@@ -642,7 +649,7 @@
22275
convert_move (small_swap, swap, 0);
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));
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]));
22287
- emit_insn (gen_altivec_vmrghw (high, even, odd));
22288
- emit_insn (gen_altivec_vmrglw (low, even, odd));
22289
+ if (BYTES_BIG_ENDIAN)
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));
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));
22302
- emit_insn (gen_altivec_vpkuwum (operands[0], high, low));
22307
@@ -744,18 +759,18 @@
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")))]
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")))]
22319
"vmaxu<VI_char> %0,%1,%2"
22320
[(set_attr "type" "vecsimple")])
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")))]
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")))]
22331
"vmaxs<VI_char> %0,%1,%2"
22332
[(set_attr "type" "vecsimple")])
22334
@@ -768,18 +783,18 @@
22335
[(set_attr "type" "veccmp")])
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")))]
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")))]
22346
"vminu<VI_char> %0,%1,%2"
22347
[(set_attr "type" "vecsimple")])
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")))]
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")))]
22358
"vmins<VI_char> %0,%1,%2"
22359
[(set_attr "type" "vecsimple")])
22361
@@ -935,7 +950,136 @@
22363
[(set_attr "type" "vecperm")])
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")
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")])
22379
+(define_insn "p8_vmrgow"
22380
+ [(set (match_operand:V4SI 0 "register_operand" "=v")
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")])
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" ""))]
22397
+ if (BYTES_BIG_ENDIAN)
22398
+ emit_insn (gen_altivec_vmuleub (operands[0], operands[1], operands[2]));
22400
+ emit_insn (gen_altivec_vmuloub (operands[0], operands[1], operands[2]));
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" ""))]
22410
+ if (BYTES_BIG_ENDIAN)
22411
+ emit_insn (gen_altivec_vmulesb (operands[0], operands[1], operands[2]));
22413
+ emit_insn (gen_altivec_vmulosb (operands[0], operands[1], operands[2]));
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" ""))]
22423
+ if (BYTES_BIG_ENDIAN)
22424
+ emit_insn (gen_altivec_vmuleuh (operands[0], operands[1], operands[2]));
22426
+ emit_insn (gen_altivec_vmulouh (operands[0], operands[1], operands[2]));
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" ""))]
22436
+ if (BYTES_BIG_ENDIAN)
22437
+ emit_insn (gen_altivec_vmulesh (operands[0], operands[1], operands[2]));
22439
+ emit_insn (gen_altivec_vmulosh (operands[0], operands[1], operands[2]));
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" ""))]
22449
+ if (BYTES_BIG_ENDIAN)
22450
+ emit_insn (gen_altivec_vmuloub (operands[0], operands[1], operands[2]));
22452
+ emit_insn (gen_altivec_vmuleub (operands[0], operands[1], operands[2]));
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" ""))]
22462
+ if (BYTES_BIG_ENDIAN)
22463
+ emit_insn (gen_altivec_vmulosb (operands[0], operands[1], operands[2]));
22465
+ emit_insn (gen_altivec_vmulesb (operands[0], operands[1], operands[2]));
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" ""))]
22475
+ if (BYTES_BIG_ENDIAN)
22476
+ emit_insn (gen_altivec_vmulouh (operands[0], operands[1], operands[2]));
22478
+ emit_insn (gen_altivec_vmuleuh (operands[0], operands[1], operands[2]));
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" ""))]
22488
+ if (BYTES_BIG_ENDIAN)
22489
+ emit_insn (gen_altivec_vmulosh (operands[0], operands[1], operands[2]));
22491
+ emit_insn (gen_altivec_vmulesh (operands[0], operands[1], operands[2]));
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 @@
22501
[(set_attr "type" "veccomplex")])
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))]
22511
- "vmulesb %0,%1,%2"
22512
+ "vmuloub %0,%1,%2"
22513
[(set_attr "type" "veccomplex")])
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))]
22521
- "vmuleuh %0,%1,%2"
22522
- [(set_attr "type" "veccomplex")])
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))]
22530
- "vmulesh %0,%1,%2"
22531
- [(set_attr "type" "veccomplex")])
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))]
22541
- "vmuloub %0,%1,%2"
22542
+ "vmulesb %0,%1,%2"
22543
[(set_attr "type" "veccomplex")])
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 @@
22552
[(set_attr "type" "veccomplex")])
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))]
22561
+ "vmuleuh %0,%1,%2"
22562
+ [(set_attr "type" "veccomplex")])
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")]
22571
[(set_attr "type" "veccomplex")])
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))]
22580
+ "vmulesh %0,%1,%2"
22581
+ [(set_attr "type" "veccomplex")])
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")]
22590
[(set_attr "type" "veccomplex")])
22593
-;; logical ops. Have the logical ops follow the memory ops in
22594
-;; terms of whether to prefer VSX or Altivec
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)"
22602
- [(set_attr "type" "vecsimple")])
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)"
22610
- [(set_attr "type" "vecsimple")])
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)"
22618
- [(set_attr "type" "vecsimple")])
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)"
22625
- [(set_attr "type" "vecsimple")])
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)"
22633
- [(set_attr "type" "vecsimple")])
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)"
22641
- [(set_attr "type" "vecsimple")])
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))]
22649
- "vpkuhum %0,%1,%2"
22650
- [(set_attr "type" "vecperm")])
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))]
22658
- "vpkuwum %0,%1,%2"
22659
- [(set_attr "type" "vecperm")])
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")]
22671
+ if (BYTES_BIG_ENDIAN)
22672
+ return \"vpkpx %0,%1,%2\";
22674
+ return \"vpkpx %0,%2,%1\";
22676
[(set_attr "type" "vecperm")])
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")]
22683
- (set (reg:SI 110) (unspec:SI [(const_int 0)] UNSPEC_SET_VSCR))]
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))]
22694
+ if (BYTES_BIG_ENDIAN)
22695
+ return \"vpks<VI_char>ss %0,%1,%2\";
22697
+ return \"vpks<VI_char>ss %0,%2,%1\";
22699
[(set_attr "type" "vecperm")])
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")]
22706
- (set (reg:SI 110) (unspec:SI [(const_int 0)] UNSPEC_SET_VSCR))]
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))]
22717
+ if (BYTES_BIG_ENDIAN)
22718
+ return \"vpks<VI_char>us %0,%1,%2\";
22720
+ return \"vpks<VI_char>us %0,%2,%1\";
22722
[(set_attr "type" "vecperm")])
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")]
22729
- (set (reg:SI 110) (unspec:SI [(const_int 0)] UNSPEC_SET_VSCR))]
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))]
22740
+ if (BYTES_BIG_ENDIAN)
22741
+ return \"vpku<VI_char>us %0,%1,%2\";
22743
+ return \"vpku<VI_char>us %0,%2,%1\";
22745
[(set_attr "type" "vecperm")])
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")]
22752
- (set (reg:SI 110) (unspec:SI [(const_int 0)] UNSPEC_SET_VSCR))]
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))]
22763
+ if (BYTES_BIG_ENDIAN)
22764
+ return \"vpku<VI_char>um %0,%1,%2\";
22766
+ return \"vpku<VI_char>um %0,%2,%1\";
22768
[(set_attr "type" "vecperm")])
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")]
22775
- (set (reg:SI 110) (unspec:SI [(const_int 0)] UNSPEC_SET_VSCR))]
22777
- "vpkuwus %0,%1,%2"
22778
- [(set_attr "type" "vecperm")])
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")]
22785
- (set (reg:SI 110) (unspec:SI [(const_int 0)] UNSPEC_SET_VSCR))]
22787
- "vpkswus %0,%1,%2"
22788
- [(set_attr "type" "vecperm")])
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")))]
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")))]
22799
"vrl<VI_char> %0,%1,%2"
22800
[(set_attr "type" "vecsimple")])
22802
@@ -1172,26 +1255,26 @@
22803
[(set_attr "type" "vecperm")])
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")))]
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")))]
22814
"vsl<VI_char> %0,%1,%2"
22815
[(set_attr "type" "vecsimple")])
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")))]
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")))]
22826
"vsr<VI_char> %0,%1,%2"
22827
[(set_attr "type" "vecsimple")])
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")))]
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")))]
22838
"vsra<VI_char> %0,%1,%2"
22839
[(set_attr "type" "vecsimple")])
22841
@@ -1335,7 +1418,12 @@
22842
(match_operand:V16QI 3 "register_operand" "")]
22847
+ if (!BYTES_BIG_ENDIAN) {
22848
+ altivec_expand_vec_perm_le (operands);
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")])
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))]
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))]
22870
+ "vupkhs<VU_char> %0,%1"
22871
[(set_attr "type" "vecperm")])
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))]
22878
+ "vupkls<VU_char> %0,%1"
22879
+ [(set_attr "type" "vecperm")])
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 @@
22886
[(set_attr "type" "vecperm")])
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))]
22894
- [(set_attr "type" "vecperm")])
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))]
22902
- [(set_attr "type" "vecperm")])
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 @@
22909
[(set_attr "type" "vecperm")])
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))]
22917
- [(set_attr "type" "vecperm")])
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"
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"))]
22928
- (set (match_operand:VI 0 "register_operand" "=v")
22929
- (eq:VI (match_dup 1)
22931
- "VECTOR_UNIT_ALTIVEC_P (<MODE>mode)"
22932
+ (set (match_operand:VI2 0 "register_operand" "=v")
22933
+ (eq:VI2 (match_dup 1)
22936
"vcmpequ<VI_char>. %0,%1,%2"
22937
[(set_attr "type" "veccmp")])
22939
(define_insn "*altivec_vcmpgts<VI_char>_p"
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"))]
22946
- (set (match_operand:VI 0 "register_operand" "=v")
22947
- (gt:VI (match_dup 1)
22949
- "VECTOR_UNIT_ALTIVEC_P (<MODE>mode)"
22950
+ (set (match_operand:VI2 0 "register_operand" "=v")
22951
+ (gt:VI2 (match_dup 1)
22954
"vcmpgts<VI_char>. %0,%1,%2"
22955
[(set_attr "type" "veccmp")])
22957
(define_insn "*altivec_vcmpgtu<VI_char>_p"
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"))]
22964
- (set (match_operand:VI 0 "register_operand" "=v")
22965
- (gtu:VI (match_dup 1)
22967
- "VECTOR_UNIT_ALTIVEC_P (<MODE>mode)"
22968
+ (set (match_operand:VI2 0 "register_operand" "=v")
22969
+ (gtu:VI2 (match_dup 1)
22972
"vcmpgtu<VI_char>. %0,%1,%2"
22973
[(set_attr "type" "veccmp")])
22975
@@ -1779,20 +1851,28 @@
22976
[(set_attr "type" "vecstore")])
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)))]
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)))]
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);
23004
+ /* Create an all 0 constant. */
23005
+ for (i = 0; i < n_elt; ++i)
23006
+ RTVEC_ELT (v, i) = const0_rtx;
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);
23014
@@ -1950,50 +2030,20 @@
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))]
23025
- emit_insn (gen_altivec_vupkhsb (operands[0], operands[1]));
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))]
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))]
23042
- emit_insn (gen_altivec_vupkhsh (operands[0], operands[1]));
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))]
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))]
23059
- emit_insn (gen_altivec_vupklsb (operands[0], operands[1]));
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))]
23070
- emit_insn (gen_altivec_vupklsh (operands[0], operands[1]));
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;
23083
emit_insn (gen_altivec_vspltish (vzero, const0_rtx));
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);
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;
23126
emit_insn (gen_altivec_vspltisw (vzero, const0_rtx));
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);
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;
23169
emit_insn (gen_altivec_vspltish (vzero, const0_rtx));
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);
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;
23212
emit_insn (gen_altivec_vspltisw (vzero, const0_rtx));
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);
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 @@
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));
23257
+ emit_insn (gen_altivec_vmrghh (operands[0], vo, ve));
23261
@@ -2185,7 +2242,10 @@
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));
23269
+ emit_insn (gen_altivec_vmrglh (operands[0], vo, ve));
23273
@@ -2202,7 +2262,10 @@
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));
23281
+ emit_insn (gen_altivec_vmrghh (operands[0], vo, ve));
23285
@@ -2219,7 +2282,10 @@
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));
23293
+ emit_insn (gen_altivec_vmrglh (operands[0], vo, ve));
23297
@@ -2236,7 +2302,10 @@
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));
23305
+ emit_insn (gen_altivec_vmrghw (operands[0], vo, ve));
23309
@@ -2253,7 +2322,10 @@
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));
23317
+ emit_insn (gen_altivec_vmrglw (operands[0], vo, ve));
23321
@@ -2270,7 +2342,10 @@
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));
23329
+ emit_insn (gen_altivec_vmrghw (operands[0], vo, ve));
23333
@@ -2287,33 +2362,20 @@
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));
23341
+ emit_insn (gen_altivec_vmrglw (operands[0], vo, ve));
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))]
23353
- emit_insn (gen_altivec_vpkuhum (operands[0], operands[1], operands[2]));
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))]
23365
- emit_insn (gen_altivec_vpkuwum (operands[0], operands[1], operands[2]));
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))]
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));
23384
+;; Power8 vector instructions encoded as Altivec instructions
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"
23392
+ [(set_attr "length" "4")
23393
+ (set_attr "type" "vecsimple")])
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")])
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")]
23409
+ "TARGET_P8_VECTOR"
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
23417
#undef MULTILIB_DEFAULTS
23418
#define MULTILIB_DEFAULTS { "mlittle", "mcall-sysv" }
23420
+/* Little-endian PowerPC64 Linux uses the ELF v2 ABI by default. */
23421
+#define LINUX64_DEFAULT_ABI_ELFv2
23423
--- a/src/gcc/config/rs6000/dfp.md
23424
+++ b/src/gcc/config/rs6000/dfp.md
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; }")
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))]
23447
- REAL_VALUE_TYPE rv;
23449
- REAL_VALUE_FROM_CONST_DOUBLE (rv, operands[1]);
23450
- REAL_VALUE_TO_TARGET_DECIMAL32 (rv, l);
23452
- if (! TARGET_POWERPC64)
23453
- operands[2] = operand_subword (operands[0], 0, 0, SDmode);
23455
- operands[2] = gen_lowpart (SImode, operands[0]);
23457
- operands[3] = gen_int_mode (l, SImode);
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)"
23476
- [(set_attr "type" "*,load,store,fp,mtjmpr,mfjmpr,*,*,*")
23477
- (set_attr "length" "4,4,4,4,4,4,4,4,8")])
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)"
23497
- [(set_attr "type" "*,mtjmpr,mfjmpr,load,store,*,*,*,*,*,*")
23498
- (set_attr "length" "4,4,4,4,4,4,4,4,4,8,4")])
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"
23507
- [(set_attr "type" "fpstore")
23508
+ [(set (attr "type")
23510
+ (match_test "update_indexed_address_mem (operands[0], VOIDmode)")
23511
+ (const_string "fpstore_ux")
23513
+ (match_test "update_address_mem (operands[0], VOIDmode)")
23514
+ (const_string "fpstore_u")
23515
+ (const_string "fpstore"))))
23516
(set_attr "length" "4")])
23518
(define_insn "movsd_load"
23519
@@ -119,7 +55,14 @@
23520
|| gpc_reg_operand (operands[1], DDmode))
23521
&& TARGET_HARD_FLOAT && TARGET_FPRS"
23523
- [(set_attr "type" "fpload")
23524
+ [(set (attr "type")
23526
+ (match_test "update_indexed_address_mem (operands[1], VOIDmode)")
23527
+ (const_string "fpload_ux")
23529
+ (match_test "update_address_mem (operands[1], VOIDmode)")
23530
+ (const_string "fpload_u")
23531
+ (const_string "fpload"))))
23532
(set_attr "length" "4")])
23534
;; Hardware support for decimal floating point operations.
23535
@@ -182,211 +125,6 @@
23537
[(set_attr "type" "fp")])
23539
-(define_expand "movdd"
23540
- [(set (match_operand:DD 0 "nonimmediate_operand" "")
23541
- (match_operand:DD 1 "any_operand" ""))]
23543
- "{ rs6000_emit_move (operands[0], operands[1], DDmode); DONE; }")
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))]
23557
- int endian = (WORDS_BIG_ENDIAN == 0);
23558
- HOST_WIDE_INT value = INTVAL (operands[1]);
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;
23565
- operands[4] = GEN_INT (value >> 32);
23566
- operands[1] = GEN_INT (((value & 0xffffffff) ^ 0x80000000) - 0x80000000);
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))]
23582
- int endian = (WORDS_BIG_ENDIAN == 0);
23584
- REAL_VALUE_TYPE rv;
23586
- REAL_VALUE_FROM_CONST_DOUBLE (rv, operands[1]);
23587
- REAL_VALUE_TO_TARGET_DECIMAL64 (rv, l);
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);
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))]
23606
- int endian = (WORDS_BIG_ENDIAN == 0);
23608
- REAL_VALUE_TYPE rv;
23609
-#if HOST_BITS_PER_WIDE_INT >= 64
23610
- HOST_WIDE_INT val;
23613
- REAL_VALUE_FROM_CONST_DOUBLE (rv, operands[1]);
23614
- REAL_VALUE_TO_TARGET_DECIMAL64 (rv, l);
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]));
23622
- operands[3] = gen_int_mode (val, DImode);
23624
- operands[3] = immed_double_const (l[1 - endian], l[endian], DImode);
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))"
23642
- switch (which_alternative)
23645
- gcc_unreachable ();
23651
- return \"fmr %0,%1\";
23653
- return \"lfd%U1%X1 %0,%1\";
23655
- return \"stfd%U0%X0 %1,%0\";
23662
- [(set_attr "type" "two,load,store,fp,fpload,fpstore,*,*,*")
23663
- (set_attr "length" "8,16,16,4,4,4,8,12,16")])
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))"
23672
- [(set_attr "type" "two,load,store,*,*,*")
23673
- (set_attr "length" "8,8,8,8,12,16")])
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))"
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")])
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))"
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")])
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))"
23741
- [(set_attr "type" "load,store,*,mtjmpr,mfjmpr,*,*,*,*")
23742
- (set_attr "length" "4,4,4,4,4,8,12,16,4")])
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 @@
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"
23757
- [(set_attr "type" "fp")])
23760
+ fabs %0,%1\;fmr %L0,%L1"
23761
+ [(set_attr "type" "fp")
23762
+ (set_attr "length" "4,8")])
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"
23771
- [(set_attr "type" "fp")])
23774
+ fnabs %0,%1\;fmr %L0,%L1"
23775
+ [(set_attr "type" "fp")
23776
+ (set_attr "length" "4,8")])
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; }")
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))"
23794
- "&& reload_completed"
23796
-{ rs6000_split_multireg_move (operands[0], operands[1]); DONE; }
23797
- [(set_attr "length" "8,8,8,20,20,16")])
23799
;; Hardware support for decimal floating point operations.
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/>.
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")
23816
+(define_mode_attr stcx [(QI "stbcx.")
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")])
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]));
23844
- gcc_unreachable ();
23845
+ emit_insn (gen_loadsync_<mode> (operands[0]));
23848
gcc_unreachable ();
23849
@@ -170,35 +170,109 @@
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")
23864
+ (DI "TARGET_POWERPC64")])
23866
-(define_mode_iterator ATOMIC [SI (DI "TARGET_POWERPC64")])
23867
+;; Types that we should provide atomic instructions for.
23869
+(define_mode_iterator AINT [QI
23872
+ (DI "TARGET_POWERPC64")
23873
+ (TI "TARGET_SYNC_TI")])
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))]
23882
[(set_attr "type" "load_l")])
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")])
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" ""))]
23898
+ /* Use a temporary register to force getting an even register for the
23899
+ lqarx/stqcrx. instructions. Normal optimizations will eliminate this
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));
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))]
23912
+ && !reg_mentioned_p (operands[0], operands[1])
23913
+ && quad_int_reg_operand (operands[0], PTImode)"
23915
+ [(set_attr "type" "load_l")])
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"))]
23925
[(set_attr "type" "store_c")])
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" ""))]
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);
23939
+ /* Use a temporary register to force getting an even register for the
23940
+ lqarx/stqcrx. instructions. Normal optimizations will eliminate this
23942
+ emit_move_insn (pti_op2, gen_lowpart (PTImode, op2));
23943
+ emit_insn (gen_store_conditionalpti (op0, pti_op1, pti_op2));
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)"
23954
+ [(set_attr "type" "store_c")])
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 @@
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
23983
@@ -220,9 +294,9 @@
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
23996
@@ -232,8 +306,8 @@
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
24007
@@ -243,10 +317,10 @@
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
24022
@@ -256,9 +330,9 @@
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
24035
@@ -268,10 +342,10 @@
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
24050
@@ -281,9 +355,9 @@
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
24063
--- a/src/gcc/config/rs6000/crypto.md
24064
+++ b/src/gcc/config/rs6000/crypto.md
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)
24070
+;; This file is part of GCC.
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.
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.
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/>.
24086
+(define_c_enum "unspec"
24089
+ UNSPEC_VCIPHERLAST
24090
+ UNSPEC_VNCIPHERLAST
24096
+;; Iterator for VPMSUM/VPERMXOR
24097
+(define_mode_iterator CR_mode [V16QI V8HI V4SI V2DI])
24099
+(define_mode_attr CR_char [(V16QI "b")
24104
+;; Iterator for VSHASIGMAD/VSHASIGMAW
24105
+(define_mode_iterator CR_hash [V4SI V2DI])
24107
+;; Iterator for the other crypto functions
24108
+(define_int_iterator CR_code [UNSPEC_VCIPHER
24110
+ UNSPEC_VCIPHERLAST
24111
+ UNSPEC_VNCIPHERLAST])
24113
+(define_int_attr CR_insn [(UNSPEC_VCIPHER "vcipher")
24114
+ (UNSPEC_VNCIPHER "vncipher")
24115
+ (UNSPEC_VCIPHERLAST "vcipherlast")
24116
+ (UNSPEC_VNCIPHERLAST "vncipherlast")])
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")]
24125
+ "<CR_insn> %0,%1,%2"
24126
+ [(set_attr "type" "crypto")])
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")]
24134
+ "vpmsum<CR_char> %0,%1,%2"
24135
+ [(set_attr "type" "crypto")])
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))]
24145
+ "vpermxor %0,%1,%2,%3"
24146
+ [(set_attr "type" "crypto")])
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")]
24155
+ [(set_attr "type" "crypto")])
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))]
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 @@
24173
- [(STACK_POINTER_REGNUM 1)
24174
+ [(FIRST_GPR_REGNO 0)
24175
+ (STACK_POINTER_REGNUM 1)
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)
24184
(ARG_POINTER_REGNUM 67)
24186
(SPE_ACC_REGNO 111)
24187
(SPEFSCR_REGNO 112)
24188
(FRAME_POINTER_REGNUM 113)
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)
24194
- ; Function TOC offset in the AIX function descriptor.
24195
- (AIX_FUNC_DESC_TOC_32BIT 4)
24196
- (AIX_FUNC_DESC_TOC_64BIT 8)
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)
24207
@@ -123,6 +118,12 @@
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
24220
@@ -142,7 +143,7 @@
24222
;; Define an insn type attribute. This is used in function unit delay
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"))
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.
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")))
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")
24246
@@ -215,7 +217,7 @@
24247
(define_mode_iterator GPR [SI (DI "TARGET_POWERPC64")])
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])
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])
24259
+; QImode or HImode for small atomic ops
24260
+(define_mode_iterator QHI [QI HI])
24262
+; HImode or SImode for sign extended fusion ops
24263
+(define_mode_iterator HSI [HI SI])
24265
; SImode or DImode, even if DImode doesn't fit in GPRs.
24266
(define_mode_iterator SDI [SI DI])
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")])
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])
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)")
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")])
24290
+; Iterators for 128 bit types for direct move
24291
+(define_mode_iterator FMOVE128_GPR [(TI "TARGET_VSX_TIMODE")
24299
+; Whether a floating point move is ok, don't allow SD without hardware FP
24300
+(define_mode_attr fmove_ok [(SF "")
24302
+ (SD "TARGET_HARD_FLOAT && TARGET_FPRS")
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")])
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")])
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")])
24323
+; Definitions for 32-bit fpr direct move
24324
+(define_mode_attr f32_dm [(SF "wn") (SD "wm")])
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])
24333
+; SF/DF suffix for traditional floating instructions
24334
+(define_mode_attr Ftrad [(SF "s") (DF "")])
24336
+; SF/DF suffix for VSX instructions
24337
+(define_mode_attr Fvsx [(SF "sp") (DF "dp")])
24339
+; SF/DF constraint for arithmetic on traditional floating point registers
24340
+(define_mode_attr Ff [(SF "f") (DF "d")])
24342
+; SF/DF constraint for arithmetic on VSX registers
24343
+(define_mode_attr Fv [(SF "wy") (DF "ws")])
24345
+; s/d suffix for things like fp_addsub_s/fp_addsub_d
24346
+(define_mode_attr Fs [(SF "s") (DF "d")])
24348
+; FRE/FRES support
24349
+(define_mode_attr Ffre [(SF "fres") (DF "fre")])
24350
+(define_mode_attr FFRE [(SF "FRES") (DF "FRE")])
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 @@
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")
24370
(define_mode_attr dbits [(QI "56") (HI "48") (SI "32")])
24371
@@ -311,6 +392,77 @@
24373
(define_mode_attr TARGET_FLOAT [(SF "TARGET_SINGLE_FLOAT")
24374
(DF "TARGET_DOUBLE_FLOAT")])
24376
+;; Mode iterator for logical operations on 128-bit types
24377
+(define_mode_iterator BOOL_128 [TI
24379
+ (V16QI "TARGET_ALTIVEC")
24380
+ (V8HI "TARGET_ALTIVEC")
24381
+ (V4SI "TARGET_ALTIVEC")
24382
+ (V4SF "TARGET_ALTIVEC")
24383
+ (V2DI "TARGET_ALTIVEC")
24384
+ (V2DF "TARGET_ALTIVEC")])
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
24392
+;; Mode attribute for boolean operation register constraints for output
24393
+(define_mode_attr BOOL_REGS_OUTPUT [(TI "&r,r,r,wa,v")
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")])
24402
+;; Mode attribute for boolean operation register constraints for operand1
24403
+(define_mode_attr BOOL_REGS_OP1 [(TI "r,0,r,wa,v")
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")])
24412
+;; Mode attribute for boolean operation register constraints for operand2
24413
+(define_mode_attr BOOL_REGS_OP2 [(TI "r,r,0,wa,v")
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")])
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")
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")])
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")
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")])
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)"
24457
rldicl %0,%1,0,<dbits>"
24458
- [(set_attr "type" "load,*")])
24459
+ [(set_attr_alternative "type"
24461
+ (match_test "update_indexed_address_mem (operands[1], VOIDmode)")
24462
+ (const_string "load_ux")
24464
+ (match_test "update_address_mem (operands[1], VOIDmode)")
24465
+ (const_string "load_u")
24466
+ (const_string "load")))
24467
+ (const_string "*")])])
24469
(define_insn "*zero_extend<mode>di2_internal2"
24470
[(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
24471
@@ -382,6 +542,29 @@
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"
24481
+ rldicl %0,%1,0,32
24485
+ [(set_attr_alternative "type"
24487
+ (match_test "update_indexed_address_mem (operands[1], VOIDmode)")
24488
+ (const_string "load_ux")
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")])])
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 @@
24505
- [(set_attr "type" "load_ext,exts")])
24506
+ [(set_attr_alternative "type"
24508
+ (match_test "update_indexed_address_mem (operands[1], VOIDmode)")
24509
+ (const_string "load_ext_ux")
24511
+ (match_test "update_address_mem (operands[1], VOIDmode)")
24512
+ (const_string "load_ext_u")
24513
+ (const_string "load_ext")))
24514
+ (const_string "exts")])])
24517
[(set (match_operand:DI 0 "gpc_reg_operand" "=r")
24518
@@ -521,16 +712,47 @@
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"
24533
+ [(set_attr_alternative "type"
24535
+ (match_test "update_indexed_address_mem (operands[1], VOIDmode)")
24536
+ (const_string "load_ext_ux")
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")])])
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"
24554
- [(set_attr "type" "load_ext,exts")])
24555
+ [(set_attr_alternative "type"
24557
+ (match_test "update_indexed_address_mem (operands[1], VOIDmode)")
24558
+ (const_string "load_ext_ux")
24560
+ (match_test "update_address_mem (operands[1], VOIDmode)")
24561
+ (const_string "load_ext_u")
24562
+ (const_string "load_ext")))
24563
+ (const_string "exts")])])
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 @@
24573
rlwinm %0,%1,0,0xff"
24574
- [(set_attr "type" "load,*")])
24575
+ [(set_attr_alternative "type"
24577
+ (match_test "update_indexed_address_mem (operands[1], VOIDmode)")
24578
+ (const_string "load_ux")
24580
+ (match_test "update_address_mem (operands[1], VOIDmode)")
24581
+ (const_string "load_u")
24582
+ (const_string "load")))
24583
+ (const_string "*")])])
24586
[(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
24587
@@ -722,7 +952,15 @@
24590
rlwinm %0,%1,0,0xff"
24591
- [(set_attr "type" "load,*")])
24592
+ [(set_attr_alternative "type"
24594
+ (match_test "update_indexed_address_mem (operands[1], VOIDmode)")
24595
+ (const_string "load_ux")
24597
+ (match_test "update_address_mem (operands[1], VOIDmode)")
24598
+ (const_string "load_u")
24599
+ (const_string "load")))
24600
+ (const_string "*")])])
24603
[(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
24604
@@ -848,7 +1086,15 @@
24607
rlwinm %0,%1,0,0xffff"
24608
- [(set_attr "type" "load,*")])
24609
+ [(set_attr_alternative "type"
24611
+ (match_test "update_indexed_address_mem (operands[1], VOIDmode)")
24612
+ (const_string "load_ux")
24614
+ (match_test "update_address_mem (operands[1], VOIDmode)")
24615
+ (const_string "load_u")
24616
+ (const_string "load")))
24617
+ (const_string "*")])])
24620
[(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
24621
@@ -915,7 +1161,15 @@
24625
- [(set_attr "type" "load_ext,exts")])
24626
+ [(set_attr_alternative "type"
24628
+ (match_test "update_indexed_address_mem (operands[1], VOIDmode)")
24629
+ (const_string "load_ext_ux")
24631
+ (match_test "update_address_mem (operands[1], VOIDmode)")
24632
+ (const_string "load_ext_u")
24633
+ (const_string "load_ext")))
24634
+ (const_string "exts")])])
24637
[(set (match_operand:SI 0 "gpc_reg_operand" "=r")
24638
@@ -1658,7 +1912,19 @@
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" "")))]
24648
+ if (<MODE>mode == DImode && !TARGET_POWERPC64)
24650
+ rs6000_split_logical (operands, NOT, false, false, false, NULL_RTX);
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")))]
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")
24665
+ [(set_attr "length" "4")
24666
+ (set_attr "type" "popcnt")])
24668
(define_expand "parity<mode>2"
24669
[(set (match_operand:GPR 0 "gpc_reg_operand" "")
24670
@@ -4054,7 +4322,7 @@
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")])
24679
@@ -4086,7 +4354,7 @@
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")])
24688
@@ -4455,224 +4723,226 @@
24692
-;; Floating-point insns, excluding normal data motion.
24694
-;; PowerPC has a full set of single-precision floating point instructions.
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.
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.
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.
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"
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"
24735
- "&& reload_completed && REG_P (operands[1]) && REGNO (operands[0]) == REGNO (operands[1])"
24738
- emit_note (NOTE_INSN_DELETED);
24741
- [(set_attr "type" "fp,fp,fpload")])
24744
+ [(set_attr "type" "fp")
24745
+ (set_attr "fp_type" "fp_addsub_<Fs>")])
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)"
24752
+(define_insn "*nabs<mode>2_fpr"
24753
+ [(set (match_operand:SFDF 0 "gpc_reg_operand" "=<Ff>,<Fv>")
24756
+ (match_operand:SFDF 1 "gpc_reg_operand" "<Ff>,<Fv>"))))]
24757
+ "TARGET_<MODE>_FPR"
24760
+ xsnabsdp %x0,%x1"
24761
+ [(set_attr "type" "fp")
24762
+ (set_attr "fp_type" "fp_addsub_<Fs>")])
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"
24769
- [(set_attr "type" "fp")])
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"
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"
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"
24794
+ [(set_attr "type" "fp")
24795
+ (set_attr "fp_type" "fp_addsub_<Fs>")])
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"
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"
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"
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>")])
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"
24830
- [(set_attr "type" "fp")])
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"
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"
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"
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>")])
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"
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"
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"
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>")])
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"
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"
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"
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>")])
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"
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))"
24936
+ fsqrt<Ftrad> %0,%1
24937
+ xssqrt<Fvsx> %x0,%x1"
24938
+ [(set_attr "type" "<Fs>sqrt")
24939
+ (set_attr "fp_type" "fp_sqrt_<Fs>")])
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"
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>")]
24957
+ xsre<Fvsx> %x0,%x1"
24958
+ [(set_attr "type" "fp")])
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))]
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>")]
24969
+ "RS6000_RECIP_HAVE_RSQRTE_P (<MODE>mode)"
24971
+ frsqrte<Ftrad> %0,%1
24972
+ xsrsqrte<Fvsx> %x0,%x1"
24973
[(set_attr "type" "fp")])
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"
24993
+ xscmpudp %0,%x1,%x2"
24994
+ [(set_attr "type" "fpcompare")])
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)"
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"
25030
+ xxlor %x0,%x1,%x1
25032
+ "&& reload_completed && REG_P (operands[1]) && REGNO (operands[0]) == REGNO (operands[1])"
25035
+ emit_note (NOTE_INSN_DELETED);
25038
+ [(set_attr_alternative "type"
25039
+ [(const_string "fp")
25040
+ (const_string "fp")
25042
+ (match_test "update_indexed_address_mem (operands[1], VOIDmode)")
25043
+ (const_string "fpload_ux")
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")
25051
+ (match_test "update_indexed_address_mem (operands[1], VOIDmode)")
25052
+ (const_string "fpload_ux")
25054
+ (match_test "update_address_mem (operands[1], VOIDmode)")
25055
+ (const_string "fpload_u")
25056
+ (const_string "fpload")))])])
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")])
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)"
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"
25086
- [(set_attr "type" "ssqrt")])
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")]
25092
- "TARGET_FRSQRTES"
25094
+ (float_truncate:SF (match_operand:DF 1 "gpc_reg_operand" "d")))]
25095
+ "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT"
25097
[(set_attr "type" "fp")])
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>")]
25111
- "TARGET_CMPB && !VECTOR_UNIT_VSX_P (<MODE>mode)"
25112
- "fcpsgn %0,%2,%1"
25113
+ "TARGET_<MODE>_FPR && TARGET_CMPB"
25116
+ xscpsgn<Fvsx> %x0,%x2,%x1"
25117
[(set_attr "type" "fp")])
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
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" ""))
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.
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.
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" ""))
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" ""))
25156
+ "TARGET_<MODE>_FPR && TARGET_PPC_GFXOPT && !flag_trapping_math"
25158
+ rs6000_emit_minmax (operands[0], SMAX, operands[1], operands[2]);
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")])
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" ""))
25176
+ "TARGET_<MODE>_FPR && TARGET_PPC_GFXOPT && !flag_trapping_math"
25178
+ rs6000_emit_minmax (operands[0], SMIN, operands[1], operands[2]);
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")])
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
25199
+ rs6000_emit_minmax (operands[0], GET_CODE (operands[3]), operands[1],
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 @@
25210
[(set_attr "type" "fp")])
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)"
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)"
25224
- [(set_attr "type" "fp")])
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)"
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)"
25238
- [(set_attr "type" "fp")])
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)"
25246
- [(set_attr "type" "fp")])
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)"
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)"
25262
- [(set_attr "type" "fp")
25263
- (set_attr "fp_type" "fp_addsub_d")])
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)"
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)"
25279
- [(set_attr "type" "fp")
25280
- (set_attr "fp_type" "fp_addsub_d")])
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)"
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)"
25296
- [(set_attr "type" "dmul")
25297
- (set_attr "fp_type" "fp_mul_d")])
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"
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)"
25315
- [(set_attr "type" "ddiv")])
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)"
25322
- [(set_attr "type" "fp")])
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")]
25328
- "TARGET_FRSQRTE && !VECTOR_UNIT_VSX_P (DFmode)"
25330
- [(set_attr "type" "fp")])
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")])
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")])
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")])
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")])
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"
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)"
25389
- [(set_attr "type" "dsqrt")])
25391
;; The conditional move instructions allow us to perform max and min
25392
;; operations even when
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" ""))
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;}")
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" ""))
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;}")
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")]
25426
"TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT && TARGET_LFIWAX"
25428
- [(set_attr "type" "fpload")])
25433
+ [(set_attr "type" "fpload,fpload,mffgpr")])
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];
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);
25447
@@ -5235,12 +5355,15 @@
25448
(set_attr "type" "fpload")])
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")]
25456
"TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT && TARGET_LFIWZX"
25458
- [(set_attr "type" "fpload")])
25463
+ [(set_attr "type" "fpload,fpload,mftgpr")])
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];
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);
25477
@@ -5548,7 +5672,7 @@
25478
emit_insn (gen_stfiwx (dest, tmp));
25481
- else if (TARGET_MFPGPR && TARGET_POWERPC64)
25482
+ else if (TARGET_POWERPC64 && (TARGET_MFPGPR || TARGET_DIRECT_MOVE))
25484
dest = gen_lowpart (DImode, dest);
25485
emit_move_insn (dest, tmp);
25486
@@ -5642,7 +5766,7 @@
25487
emit_insn (gen_stfiwx (dest, tmp));
25490
- else if (TARGET_MFPGPR && TARGET_POWERPC64)
25491
+ else if (TARGET_POWERPC64 && (TARGET_MFPGPR || TARGET_DIRECT_MOVE))
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>")]
25499
- "TARGET_FPRND && TARGET_HARD_FLOAT && TARGET_FPRS && <TARGET_FLOAT>"
25500
+ "TARGET_<MODE>_FPR && TARGET_FPRND"
25502
[(set_attr "type" "fp")])
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>")]
25511
- "TARGET_FPRND && TARGET_HARD_FLOAT && TARGET_FPRS && <TARGET_FLOAT>"
25513
+ "TARGET_<MODE>_FPR && TARGET_FPRND"
25517
+ [(set_attr "type" "fp")
25518
+ (set_attr "fp_type" "fp_addsub_<Fs>")])
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>")]
25524
- "TARGET_FPRND && TARGET_HARD_FLOAT && TARGET_FPRS && <TARGET_FLOAT>
25525
- && !VECTOR_UNIT_VSX_P (<MODE>mode)"
25527
- [(set_attr "type" "fp")])
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>")]
25536
- "TARGET_FPRND && TARGET_HARD_FLOAT && TARGET_FPRS && <TARGET_FLOAT>"
25538
+ "TARGET_<MODE>_FPR && TARGET_FPRND"
25542
+ [(set_attr "type" "fp")
25543
+ (set_attr "fp_type" "fp_addsub_<Fs>")])
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>")]
25549
- "TARGET_FPRND && TARGET_HARD_FLOAT && TARGET_FPRS && <TARGET_FLOAT>
25550
- && !VECTOR_UNIT_VSX_P (<MODE>mode)"
25552
- [(set_attr "type" "fp")])
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>")]
25561
- "TARGET_FPRND && TARGET_HARD_FLOAT && TARGET_FPRS && <TARGET_FLOAT>"
25563
+ "TARGET_<MODE>_FPR && TARGET_FPRND"
25567
+ [(set_attr "type" "fp")
25568
+ (set_attr "fp_type" "fp_addsub_<Fs>")])
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>")]
25574
- "TARGET_FPRND && TARGET_HARD_FLOAT && TARGET_FPRS && <TARGET_FLOAT>
25575
- && !VECTOR_UNIT_VSX_P (<MODE>mode)"
25577
- [(set_attr "type" "fp")])
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>")]
25584
- "TARGET_FPRND && TARGET_HARD_FLOAT && TARGET_FPRS && <TARGET_FLOAT>"
25585
+ "TARGET_<MODE>_FPR && TARGET_FPRND"
25587
- [(set_attr "type" "fp")])
25588
+ [(set_attr "type" "fp")
25589
+ (set_attr "fp_type" "fp_addsub_<Fs>")])
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 @@
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"
25604
+ if (!TARGET_POWERPC64)
25606
+ rtx cc = gen_rtx_SCRATCH (CCmode);
25607
+ rs6000_split_logical (operands, AND, false, false, false, cc);
25610
+ else if (!and64_2_operand (operands[2], DImode))
25611
+ operands[2] = force_reg (DImode, operands[2]);
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"
25623
+ (match_operand:DI 2 "reg_or_cint_operand" "")))]
25626
- if (non_logical_cint_operand (operands[2], DImode))
25627
+ if (!TARGET_POWERPC64)
25629
+ rs6000_split_logical (operands, IOR, false, false, false, NULL_RTX);
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))
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)));
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"
25652
+ (match_operand:DI 2 "reg_or_cint_operand" "")))]
25655
+ if (!TARGET_POWERPC64)
25657
+ rs6000_split_logical (operands, XOR, false, false, false, NULL_RTX);
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))
25664
HOST_WIDE_INT value;
25665
@@ -7442,7 +7573,7 @@
25666
emit_insn (gen_xordi3 (operands[0], tmp, GEN_INT (value & 0xffff)));
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)
25680
+(define_insn "*eqv<mode>3"
25681
+ [(set (match_operand:GPR 0 "gpc_reg_operand" "=r")
25683
+ (xor:GPR (match_operand:GPR 1 "gpc_reg_operand" "r")
25684
+ (match_operand:GPR 2 "gpc_reg_operand" "r"))))]
25687
+ [(set_attr "type" "integer")
25688
+ (set_attr "length" "4")])
25691
+;; 128-bit logical operations expanders
25693
+(define_expand "and<mode>3"
25694
+ [(parallel [(set (match_operand:BOOL_128 0 "vlogical_operand" "")
25696
+ (match_operand:BOOL_128 1 "vlogical_operand" "")
25697
+ (match_operand:BOOL_128 2 "vlogical_operand" "")))
25698
+ (clobber (match_scratch:CC 3 ""))])]
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" "")))]
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" "")))]
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" "")))]
25722
+(define_expand "nor<mode>3"
25723
+ [(set (match_operand:BOOL_128 0 "vlogical_operand" "")
25725
+ (not:BOOL_128 (match_operand:BOOL_128 1 "vlogical_operand" ""))
25726
+ (not:BOOL_128 (match_operand:BOOL_128 2 "vlogical_operand" ""))))]
25730
+(define_expand "andc<mode>3"
25731
+ [(set (match_operand:BOOL_128 0 "vlogical_operand" "")
25733
+ (not:BOOL_128 (match_operand:BOOL_128 2 "vlogical_operand" ""))
25734
+ (match_operand:BOOL_128 1 "vlogical_operand" "")))]
25738
+;; Power8 vector logical instructions.
25739
+(define_expand "eqv<mode>3"
25740
+ [(set (match_operand:BOOL_128 0 "vlogical_operand" "")
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"
25747
+;; Rewrite nand into canonical form
25748
+(define_expand "nand<mode>3"
25749
+ [(set (match_operand:BOOL_128 0 "vlogical_operand" "")
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"
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" "")
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"
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>")
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>"))]
25775
+ if (TARGET_VSX && vsx_register_operand (operands[0], <MODE>mode))
25776
+ return "xxland %x0,%x1,%x2";
25778
+ if (TARGET_ALTIVEC && altivec_register_operand (operands[0], <MODE>mode))
25779
+ return "vand %0,%1,%2";
25783
+ "reload_completed && int_reg_operand (operands[0], <MODE>mode)"
25786
+ rs6000_split_logical (operands, AND, false, false, false, operands[3]);
25789
+ [(set (attr "type")
25791
+ (match_test "vsx_register_operand (operands[0], <MODE>mode)")
25792
+ (const_string "vecsimple")
25793
+ (const_string "integer")))
25794
+ (set (attr "length")
25796
+ (match_test "vsx_register_operand (operands[0], <MODE>mode)")
25797
+ (const_string "4")
25799
+ (match_test "TARGET_POWERPC64")
25800
+ (const_string "8")
25801
+ (const_string "16"))))])
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>")]))]
25811
+ if (TARGET_VSX && vsx_register_operand (operands[0], <MODE>mode))
25812
+ return "xxl%q3 %x0,%x1,%x2";
25814
+ if (TARGET_ALTIVEC && altivec_register_operand (operands[0], <MODE>mode))
25815
+ return "v%q3 %0,%1,%2";
25819
+ "reload_completed && int_reg_operand (operands[0], <MODE>mode)"
25822
+ rs6000_split_logical (operands, GET_CODE (operands[3]), false, false, false,
25826
+ [(set (attr "type")
25828
+ (match_test "vsx_register_operand (operands[0], <MODE>mode)")
25829
+ (const_string "vecsimple")
25830
+ (const_string "integer")))
25831
+ (set (attr "length")
25833
+ (match_test "vsx_register_operand (operands[0], <MODE>mode)")
25834
+ (const_string "4")
25836
+ (match_test "TARGET_POWERPC64")
25837
+ (const_string "8")
25838
+ (const_string "16"))))])
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"
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)"
25849
+ if (TARGET_VSX && vsx_register_operand (operands[0], <MODE>mode))
25850
+ return "xxl%q3 %x0,%x1,%x2";
25852
+ if (TARGET_ALTIVEC && altivec_register_operand (operands[0], <MODE>mode))
25853
+ return "v%q3 %0,%1,%2";
25857
+ "(TARGET_P8_VECTOR || (GET_CODE (operands[3]) == AND))
25858
+ && reload_completed && int_reg_operand (operands[0], <MODE>mode)"
25861
+ rs6000_split_logical (operands, GET_CODE (operands[3]), false, true, false,
25865
+ [(set (attr "type")
25867
+ (match_test "vsx_register_operand (operands[0], <MODE>mode)")
25868
+ (const_string "vecsimple")
25869
+ (const_string "integer")))
25870
+ (set (attr "length")
25872
+ (match_test "vsx_register_operand (operands[0], <MODE>mode)")
25873
+ (const_string "4")
25875
+ (match_test "TARGET_POWERPC64")
25876
+ (const_string "8")
25877
+ (const_string "16"))))])
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"
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)"
25887
+ "reload_completed && !TARGET_P8_VECTOR && (GET_CODE (operands[3]) != AND)"
25890
+ rs6000_split_logical (operands, GET_CODE (operands[3]), false, true, false,
25894
+ [(set_attr "type" "integer")
25895
+ (set (attr "length")
25897
+ (match_test "TARGET_POWERPC64")
25898
+ (const_string "8")
25899
+ (const_string "16")))])
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"
25906
+ (match_operand:BOOL_128 1 "vlogical_operand" "<BOOL_REGS_OP1>"))
25908
+ (match_operand:BOOL_128 2 "vlogical_operand" "<BOOL_REGS_OP2>"))]))]
25909
+ "TARGET_P8_VECTOR || (GET_CODE (operands[3]) == AND)"
25911
+ if (TARGET_VSX && vsx_register_operand (operands[0], <MODE>mode))
25912
+ return "xxl%q3 %x0,%x1,%x2";
25914
+ if (TARGET_ALTIVEC && altivec_register_operand (operands[0], <MODE>mode))
25915
+ return "v%q3 %0,%1,%2";
25919
+ "(TARGET_P8_VECTOR || (GET_CODE (operands[3]) == AND))
25920
+ && reload_completed && int_reg_operand (operands[0], <MODE>mode)"
25923
+ rs6000_split_logical (operands, GET_CODE (operands[3]), false, true, true,
25927
+ [(set (attr "type")
25929
+ (match_test "vsx_register_operand (operands[0], <MODE>mode)")
25930
+ (const_string "vecsimple")
25931
+ (const_string "integer")))
25932
+ (set (attr "length")
25934
+ (match_test "vsx_register_operand (operands[0], <MODE>mode)")
25935
+ (const_string "4")
25937
+ (match_test "TARGET_POWERPC64")
25938
+ (const_string "8")
25939
+ (const_string "16"))))])
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"
25945
+ (match_operand:TI2 1 "int_reg_operand" "r,0,r"))
25947
+ (match_operand:TI2 2 "int_reg_operand" "r,r,0"))]))]
25948
+ "!TARGET_P8_VECTOR && (GET_CODE (operands[3]) != AND)"
25950
+ "reload_completed && !TARGET_P8_VECTOR && (GET_CODE (operands[3]) != AND)"
25953
+ rs6000_split_logical (operands, GET_CODE (operands[3]), false, true, true,
25957
+ [(set_attr "type" "integer")
25958
+ (set (attr "length")
25960
+ (match_test "TARGET_POWERPC64")
25961
+ (const_string "8")
25962
+ (const_string "16")))])
25966
+(define_insn_and_split "*eqv<mode>3_internal1"
25967
+ [(set (match_operand:BOOL_128 0 "vlogical_operand" "=<BOOL_REGS_OUTPUT>")
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"
25974
+ if (vsx_register_operand (operands[0], <MODE>mode))
25975
+ return "xxleqv %x0,%x1,%x2";
25979
+ "TARGET_P8_VECTOR && reload_completed
25980
+ && int_reg_operand (operands[0], <MODE>mode)"
25983
+ rs6000_split_logical (operands, XOR, true, false, false, NULL_RTX);
25986
+ [(set (attr "type")
25988
+ (match_test "vsx_register_operand (operands[0], <MODE>mode)")
25989
+ (const_string "vecsimple")
25990
+ (const_string "integer")))
25991
+ (set (attr "length")
25993
+ (match_test "vsx_register_operand (operands[0], <MODE>mode)")
25994
+ (const_string "4")
25996
+ (match_test "TARGET_POWERPC64")
25997
+ (const_string "8")
25998
+ (const_string "16"))))])
26000
+(define_insn_and_split "*eqv<mode>3_internal2"
26001
+ [(set (match_operand:TI2 0 "int_reg_operand" "=&r,r,r")
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"
26008
+ "reload_completed && !TARGET_P8_VECTOR"
26011
+ rs6000_split_logical (operands, XOR, true, false, false, NULL_RTX);
26014
+ [(set_attr "type" "integer")
26015
+ (set (attr "length")
26017
+ (match_test "TARGET_POWERPC64")
26018
+ (const_string "8")
26019
+ (const_string "16")))])
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>")
26025
+ (match_operand:BOOL_128 1 "vlogical_operand" "<BOOL_REGS_UNARY>")))]
26028
+ if (TARGET_VSX && vsx_register_operand (operands[0], <MODE>mode))
26029
+ return "xxlnor %x0,%x1,%x1";
26031
+ if (TARGET_ALTIVEC && altivec_register_operand (operands[0], <MODE>mode))
26032
+ return "vnor %0,%1,%1";
26036
+ "reload_completed && int_reg_operand (operands[0], <MODE>mode)"
26039
+ rs6000_split_logical (operands, NOT, false, false, false, NULL_RTX);
26042
+ [(set (attr "type")
26044
+ (match_test "vsx_register_operand (operands[0], <MODE>mode)")
26045
+ (const_string "vecsimple")
26046
+ (const_string "integer")))
26047
+ (set (attr "length")
26049
+ (match_test "vsx_register_operand (operands[0], <MODE>mode)")
26050
+ (const_string "4")
26052
+ (match_test "TARGET_POWERPC64")
26053
+ (const_string "8")
26054
+ (const_string "16"))))])
26057
;; Now define ways of moving data around.
26059
;; Set up a register with a value from the GOT table
26060
@@ -7765,7 +8274,31 @@
26064
- [(set_attr "type" "*,*,load,store,*,*,*,mfjmpr,mtjmpr,*,*")
26065
+ [(set_attr_alternative "type"
26066
+ [(const_string "*")
26067
+ (const_string "*")
26069
+ (match_test "update_indexed_address_mem (operands[1], VOIDmode)")
26070
+ (const_string "load_ux")
26072
+ (match_test "update_address_mem (operands[1], VOIDmode)")
26073
+ (const_string "load_u")
26074
+ (const_string "load")))
26076
+ (match_test "update_indexed_address_mem (operands[0], VOIDmode)")
26077
+ (const_string "store_ux")
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 "*")])
26090
(set_attr "length" "4,4,4,4,4,4,8,4,4,4,4")])
26092
(define_insn "*movsi_internal1_single"
26093
@@ -7787,7 +8320,44 @@
26097
- [(set_attr "type" "*,*,load,store,*,*,*,mfjmpr,mtjmpr,*,*,*,*")
26098
+ [(set_attr_alternative "type"
26099
+ [(const_string "*")
26100
+ (const_string "*")
26102
+ (match_test "update_indexed_address_mem (operands[1], VOIDmode)")
26103
+ (const_string "load_ux")
26105
+ (match_test "update_address_mem (operands[1], VOIDmode)")
26106
+ (const_string "load_u")
26107
+ (const_string "load")))
26109
+ (match_test "update_indexed_address_mem (operands[0], VOIDmode)")
26110
+ (const_string "store_ux")
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 "*")
26123
+ (match_test "update_indexed_address_mem (operands[0], VOIDmode)")
26124
+ (const_string "fpstore_ux")
26126
+ (match_test "update_address_mem (operands[0], VOIDmode)")
26127
+ (const_string "fpstore_u")
26128
+ (const_string "fpstore")))
26130
+ (match_test "update_indexed_address_mem (operands[1], VOIDmode)")
26131
+ (const_string "fpload_ux")
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")])
26138
;; Split a load of a large constant into the appropriate two-insn
26139
@@ -7822,7 +8392,7 @@
26143
- [(set_attr "type" "cmp,compare,cmp")
26144
+ [(set_attr "type" "cmp,fast_compare,cmp")
26145
(set_attr "length" "4,4,8")])
26148
@@ -7850,7 +8420,26 @@
26152
- [(set_attr "type" "*,load,store,*,mfjmpr,mtjmpr,*")])
26153
+ [(set_attr_alternative "type"
26154
+ [(const_string "*")
26156
+ (match_test "update_indexed_address_mem (operands[1], VOIDmode)")
26157
+ (const_string "load_ux")
26159
+ (match_test "update_address_mem (operands[1], VOIDmode)")
26160
+ (const_string "load_u")
26161
+ (const_string "load")))
26163
+ (match_test "update_indexed_address_mem (operands[0], VOIDmode)")
26164
+ (const_string "store_ux")
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 "*")])])
26174
(define_expand "mov<mode>"
26175
[(set (match_operand:INT 0 "general_operand" "")
26176
@@ -7871,7 +8460,26 @@
26180
- [(set_attr "type" "*,load,store,*,mfjmpr,mtjmpr,*")])
26181
+ [(set_attr_alternative "type"
26182
+ [(const_string "*")
26184
+ (match_test "update_indexed_address_mem (operands[1], VOIDmode)")
26185
+ (const_string "load_ux")
26187
+ (match_test "update_address_mem (operands[1], VOIDmode)")
26188
+ (const_string "load_u")
26189
+ (const_string "load")))
26191
+ (match_test "update_indexed_address_mem (operands[0], VOIDmode)")
26192
+ (const_string "store_ux")
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 "*")])])
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 @@
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")
26219
+ (match_test "update_indexed_address_mem (operands[1],
26221
+ (const_string "load_ux")
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")
26229
+ (match_test "update_indexed_address_mem (operands[0],
26231
+ (const_string "store_ux")
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")
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" ""))]
26247
- "{ rs6000_emit_move (operands[0], operands[1], SFmode); DONE; }")
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" ""))]
26254
+ "{ rs6000_emit_move (operands[0], operands[1], <MODE>mode); DONE; }")
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" ""))]
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;
26267
REAL_VALUE_FROM_CONST_DOUBLE (rv, operands[1]);
26268
- REAL_VALUE_TO_TARGET_SINGLE (rv, l);
26269
+ <real_value_to_target> (rv, l);
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);
26275
operands[2] = gen_lowpart (SImode, operands[0]);
26277
operands[3] = gen_int_mode (l, SImode);
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)"
26298
+ xxlor %x0,%x1,%x1
26299
+ xxlxor %x0,%x0,%x0
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 "*")
26316
+ (match_test "update_indexed_address_mem (operands[1], VOIDmode)")
26317
+ (const_string "load_ux")
26319
+ (match_test "update_address_mem (operands[1], VOIDmode)")
26320
+ (const_string "load_u")
26321
+ (const_string "load")))
26323
+ (match_test "update_indexed_address_mem (operands[0], VOIDmode)")
26324
+ (const_string "store_ux")
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")
26333
+ (match_test "update_indexed_address_mem (operands[1], VOIDmode)")
26334
+ (const_string "fpload_ux")
26336
+ (match_test "update_address_mem (operands[1], VOIDmode)")
26337
+ (const_string "fpload_u")
26338
+ (const_string "fpload")))
26340
+ (match_test "update_indexed_address_mem (operands[0], VOIDmode)")
26341
+ (const_string "fpstore_ux")
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")])
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)"
26370
@@ -7995,19 +8666,42 @@
26374
- [(set_attr "type" "*,mtjmpr,mfjmpr,load,store,*,*,*,*,*")
26375
+ [(set_attr_alternative "type"
26376
+ [(const_string "*")
26377
+ (const_string "mtjmpr")
26378
+ (const_string "mfjmpr")
26380
+ (match_test "update_indexed_address_mem (operands[1], VOIDmode)")
26381
+ (const_string "load_ux")
26383
+ (match_test "update_address_mem (operands[1], VOIDmode)")
26384
+ (const_string "load_u")
26385
+ (const_string "load")))
26387
+ (match_test "update_indexed_address_mem (operands[0], VOIDmode)")
26388
+ (const_string "store_ux")
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")])
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" ""))]
26409
- "{ rs6000_emit_move (operands[0], operands[1], DFmode); DONE; }")
26410
+ "{ rs6000_emit_move (operands[0], operands[1], <MODE>mode); DONE; }")
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]);
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;
26431
@@ -8031,8 +8725,8 @@
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;
26445
REAL_VALUE_FROM_CONST_DOUBLE (rv, operands[1]);
26446
- REAL_VALUE_TO_TARGET_DOUBLE (rv, l);
26447
+ <real_value_to_target> (rv, l);
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);
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 @@
26468
REAL_VALUE_FROM_CONST_DOUBLE (rv, operands[1]);
26469
- REAL_VALUE_TO_TARGET_DOUBLE (rv, l);
26470
+ <real_value_to_target> (rv, l);
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
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))"
26496
- stxsd%U0x %x1,%y0
26498
- xxlor %x0,%x1,%x1
26502
@@ -8122,115 +8813,140 @@
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"
26510
+ (match_test "update_indexed_address_mem (operands[0], VOIDmode)")
26511
+ (const_string "fpstore_ux")
26513
+ (match_test "update_address_mem (operands[0], VOIDmode)")
26514
+ (const_string "fpstore_u")
26515
+ (const_string "fpstore")))
26517
+ (match_test "update_indexed_address_mem (operands[1], VOIDmode)")
26518
+ (const_string "fpload_ux")
26520
+ (match_test "update_address_mem (operands[1], VOIDmode)")
26521
+ (const_string "fpload_u")
26522
+ (const_string "fpload")))
26523
+ (const_string "fp")
26525
+ (match_test "update_indexed_address_mem (operands[1], VOIDmode)")
26526
+ (const_string "fpload_ux")
26527
+ (const_string "fpload"))
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")])
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))"
26556
[(set_attr "type" "store,load,two,*,*,*")
26557
(set_attr "length" "8,8,8,8,12,16")])
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")])]
26567
- rs6000_secondary_reload_gpr (operands[1], operands[0], operands[2], true);
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")])]
26577
- rs6000_secondary_reload_gpr (operands[0], operands[1], operands[2], false);
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))"
26600
- xxlor %x0,%x1,%x1
26601
- xxlor %x0,%x1,%x1
26604
- stxsd%U0x %x1,%y0
26605
- stxsd%U0x %x1,%y0
26610
+ stxsd%U0x %x1,%y0
26611
+ xxlor %x0,%x1,%x1
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")])
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))"
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
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")])
26660
+ [(set_attr_alternative "type"
26662
+ (match_test "update_indexed_address_mem (operands[0], VOIDmode)")
26663
+ (const_string "fpstore_ux")
26665
+ (match_test "update_address_mem (operands[0], VOIDmode)")
26666
+ (const_string "fpstore_u")
26667
+ (const_string "fpstore")))
26669
+ (match_test "update_indexed_address_mem (operands[1], VOIDmode)")
26670
+ (const_string "fpload_ux")
26672
+ (match_test "update_address_mem (operands[1], VOIDmode)")
26673
+ (const_string "fpload_u")
26674
+ (const_string "fpload")))
26675
+ (const_string "fp")
26677
+ (match_test "update_indexed_address_mem (operands[1], VOIDmode)")
26678
+ (const_string "fpload_ux")
26679
+ (const_string "fpload"))
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")
26687
+ (match_test "update_indexed_address_mem (operands[0], VOIDmode)")
26688
+ (const_string "store_ux")
26690
+ (match_test "update_address_mem (operands[0], VOIDmode)")
26691
+ (const_string "store_u")
26692
+ (const_string "store")))
26694
+ (match_test "update_indexed_address_mem (operands[1], VOIDmode)")
26695
+ (const_string "load_ux")
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")])
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))"
26727
@@ -8241,38 +8957,57 @@
26731
- [(set_attr "type" "store,load,*,mtjmpr,mfjmpr,*,*,*,*")
26732
+ [(set_attr_alternative "type"
26734
+ (match_test "update_indexed_address_mem (operands[0], VOIDmode)")
26735
+ (const_string "store_ux")
26737
+ (match_test "update_address_mem (operands[0], VOIDmode)")
26738
+ (const_string "store_u")
26739
+ (const_string "store")))
26741
+ (match_test "update_indexed_address_mem (operands[1], VOIDmode)")
26742
+ (const_string "load_ux")
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")])
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" ""))]
26765
+ "{ rs6000_emit_move (operands[0], operands[1], <MODE>mode); DONE; }")
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))"
26784
"&& reload_completed"
26786
{ rs6000_split_multireg_move (operands[0], operands[1]); DONE; }
26787
[(set_attr "length" "8,8,8,20,20,16")])
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))"
26803
"&& reload_completed"
26805
@@ -8557,6 +9292,243 @@
26806
operands[6] = simplify_gen_subreg (DFmode, operands[0], TFmode, lo_word);
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
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")])]
26821
+ rs6000_secondary_reload_gpr (operands[1], operands[0], operands[2], true);
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")])]
26831
+ rs6000_secondary_reload_gpr (operands[0], operands[1], operands[2], false);
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.
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")])
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"
26861
+ [(set_attr "type" "mftgpr")])
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"
26870
+ [(set_attr "type" "mftgpr")])
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"
26879
+ "&& reload_completed"
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);
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));
26893
+ [(set_attr "length" "12")
26894
+ (set_attr "type" "three")])
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"
26903
+ [(set_attr "type" "mftgpr")])
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"
26912
+ [(set_attr "type" "mftgpr")])
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")])
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"
26930
+ "&& reload_completed"
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);
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));
26943
+ [(set_attr "length" "12")
26944
+ (set_attr "type" "three")])
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.
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"
26957
+ "&& reload_completed"
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);
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));
26972
+ [(set_attr "length" "8")
26973
+ (set_attr "type" "two")])
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"
26984
+ [(set_attr "type" "mftgpr")])
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"
26994
+ "&& reload_completed"
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);
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));
27007
+ [(set_attr "length" "12")
27008
+ (set_attr "type" "three")])
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
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"
27021
+ "&& reload_completed"
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);
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)));
27034
+ [(set_attr "length" "12")
27035
+ (set_attr "type" "three")])
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"
27043
+ [(set_attr "type" "mftgpr")])
27046
;; Next come the multi-word integer load and store and the load and store
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 @@
27065
- xxlxor %x0,%x0,%x0"
27066
- [(set_attr "type" "store,load,*,fpstore,fpload,fp,*,vecsimple")])
27068
+ [(set_attr_alternative "type"
27069
+ [(const_string "store")
27070
+ (const_string "load")
27071
+ (const_string "*")
27073
+ (match_test "update_indexed_address_mem (operands[0], VOIDmode)")
27074
+ (const_string "fpstore_ux")
27076
+ (match_test "update_address_mem (operands[0], VOIDmode)")
27077
+ (const_string "fpstore_u")
27078
+ (const_string "fpstore")))
27080
+ (match_test "update_indexed_address_mem (operands[1], VOIDmode)")
27081
+ (const_string "fpload_ux")
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 "*")])])
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))]
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])"
27107
{ rs6000_split_multireg_move (operands[0], operands[1]); DONE; })
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))"
27120
@@ -8631,33 +9623,52 @@
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")])
27130
+ [(set_attr_alternative "type"
27132
+ (match_test "update_indexed_address_mem (operands[0], VOIDmode)")
27133
+ (const_string "store_ux")
27135
+ (match_test "update_address_mem (operands[0], VOIDmode)")
27136
+ (const_string "store_u")
27137
+ (const_string "store")))
27139
+ (match_test "update_indexed_address_mem (operands[1], VOIDmode)")
27140
+ (const_string "load_ux")
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 "*")
27150
+ (match_test "update_indexed_address_mem (operands[0], VOIDmode)")
27151
+ (const_string "fpstore_ux")
27153
+ (match_test "update_address_mem (operands[0], VOIDmode)")
27154
+ (const_string "fpstore_u")
27155
+ (const_string "fpstore")))
27157
+ (match_test "update_indexed_address_mem (operands[1], VOIDmode)")
27158
+ (const_string "fpload_ux")
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")])
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))"
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")])
27196
;; immediate value valid for a single instruction hiding in a const_double
27198
[(set (match_operand:DI 0 "gpc_reg_operand" "=r")
27199
@@ -8719,14 +9730,16 @@
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).
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))"
27221
switch (which_alternative)
27222
@@ -8756,27 +9769,32 @@
27223
(const_string "always")
27224
(const_string "conditional")))])
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)"
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)))"
27241
+ return rs6000_output_move_128bit (operands);
27243
+ [(set_attr "type" "store,store,load,load,*,*")
27244
+ (set_attr "length" "8")])
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))]
27259
operands[2] = operand_subword_force (operands[0], WORDS_BIG_ENDIAN == 0,
27262
operands[3] = operand_subword_force (operands[0], WORDS_BIG_ENDIAN != 0,
27265
if (GET_CODE (operands[1]) == CONST_DOUBLE)
27267
operands[4] = GEN_INT (CONST_DOUBLE_HIGH (operands[1]));
27268
@@ -8792,10 +9810,12 @@
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])"
27283
{ rs6000_split_multireg_move (operands[0], operands[1]); DONE; })
27285
@@ -9651,7 +10671,7 @@
27286
(match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
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)"
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" "")]
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")]
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)"
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"
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"
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))"
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))"
27368
@@ -10344,7 +11366,7 @@
27369
(label_ref (match_operand 1 "" ""))]
27372
- "TARGET_ELF && DEFAULT_ABI != ABI_AIX && flag_pic == 2"
27373
+ "TARGET_ELF && DEFAULT_ABI == ABI_V4 && flag_pic == 2"
27376
(define_insn "load_toc_v4_PIC_1b_normal"
27377
@@ -10353,7 +11375,7 @@
27378
(label_ref (match_operand 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 "" ""))]
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"
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"
27402
[(set_attr "type" "load")])
27404
@@ -10392,7 +11414,7 @@
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")
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")
27421
;; If the TOC is shared over a translation unit, as happens with all
27422
@@ -10542,8 +11564,13 @@
27424
operands[0] = XEXP (operands[0], 0);
27426
+ if (DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_ELFv2)
27428
+ rs6000_call_aix (NULL_RTX, operands[0], operands[1], operands[2]);
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))
27436
if (INTVAL (operands[2]) & CALL_LONG)
27437
@@ -10556,12 +11583,6 @@
27438
operands[0] = force_reg (Pmode, operands[0]);
27442
- /* AIX function pointers are really pointers to a three word
27444
- rs6000_call_indirect_aix (NULL_RTX, operands[0], operands[1]);
27448
gcc_unreachable ();
27450
@@ -10587,8 +11608,13 @@
27452
operands[1] = XEXP (operands[1], 0);
27454
+ if (DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_ELFv2)
27456
+ rs6000_call_aix (operands[0], operands[1], operands[2], operands[3]);
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))
27464
if (INTVAL (operands[3]) & CALL_LONG)
27465
@@ -10601,12 +11627,6 @@
27466
operands[1] = force_reg (Pmode, operands[1]);
27470
- /* AIX function pointers are really pointers to a three word
27472
- rs6000_call_indirect_aix (operands[0], operands[1], operands[2]);
27476
gcc_unreachable ();
27478
@@ -10698,136 +11718,7 @@
27479
[(set_attr "type" "branch")
27480
(set_attr "length" "4,8")])
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
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")])
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
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")])
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
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")])
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
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")])
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.
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))]
27568
- && DEFAULT_ABI == ABI_AIX
27569
- && (INTVAL (operands[2]) & CALL_LONG) == 0"
27571
- [(set_attr "type" "branch")
27572
- (set_attr "length" "8")])
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))]
27580
- && DEFAULT_ABI == ABI_AIX
27581
- && (INTVAL (operands[2]) & CALL_LONG) == 0"
27583
- [(set_attr "type" "branch")
27584
- (set_attr "length" "8")])
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))]
27593
- && DEFAULT_ABI == ABI_AIX
27594
- && (INTVAL (operands[3]) & CALL_LONG) == 0"
27596
- [(set_attr "type" "branch")
27597
- (set_attr "length" "8")])
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))]
27606
- && DEFAULT_ABI == ABI_AIX
27607
- && (INTVAL (operands[3]) & CALL_LONG) == 0"
27609
- [(set_attr "type" "branch")
27610
- (set_attr "length" "8")])
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")])
27620
+;; Call to AIX abi function in the same module.
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"
27628
+ [(set_attr "type" "branch")
27629
+ (set_attr "length" "4")])
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"
27638
+ [(set_attr "type" "branch")
27639
+ (set_attr "length" "4")])
27641
+;; Call to AIX abi function which may be in another module.
27642
+;; Restore the TOC pointer (r2) after the call.
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"
27650
+ [(set_attr "type" "branch")
27651
+ (set_attr "length" "8")])
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"
27660
+ [(set_attr "type" "branch")
27661
+ (set_attr "length" "8")])
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
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")])
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")])
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
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")])
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")])
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);
27723
operands[0] = XEXP (operands[0], 0);
27725
+ if (DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_ELFv2)
27727
+ rs6000_sibcall_aix (NULL_RTX, operands[0], operands[1], operands[2]);
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)])]
27743
+ if (MACHOPIC_INDIRECT)
27744
+ operands[1] = machopic_indirect_call_target (operands[1]);
27747
+ gcc_assert (GET_CODE (operands[1]) == MEM);
27748
+ gcc_assert (GET_CODE (operands[2]) == CONST_INT);
27750
+ operands[1] = XEXP (operands[1], 0);
27752
+ if (DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_ELFv2)
27754
+ rs6000_sibcall_aix (operands[0], operands[1], operands[2], operands[3]);
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")])
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")])
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))
27780
- "DEFAULT_ABI == ABI_AIX
27781
- && (INTVAL (operands[2]) & CALL_LONG) == 0"
27785
- [(set_attr "type" "branch")
27786
- (set_attr "length" "4")])
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))
27795
- "DEFAULT_ABI == ABI_AIX
27796
- && (INTVAL (operands[3]) & CALL_LONG) == 0"
27800
- [(set_attr "type" "branch")
27801
- (set_attr "length" "4")])
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")])
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)])]
27821
- if (MACHOPIC_INDIRECT)
27822
- operands[1] = machopic_indirect_call_target (operands[1]);
27825
- gcc_assert (GET_CODE (operands[1]) == MEM);
27826
- gcc_assert (GET_CODE (operands[2]) == CONST_INT);
27828
- operands[1] = XEXP (operands[1], 0);
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")])
27838
+;; AIX ABI sibling call patterns.
27840
+(define_insn "*sibcall_aix<mode>"
27841
+ [(call (mem:SI (match_operand:P 0 "call_operand" "s,c"))
27842
+ (match_operand 1 "" "g,g"))
27844
+ "DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_ELFv2"
27848
+ [(set_attr "type" "branch")
27849
+ (set_attr "length" "4")])
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")))
27856
+ "DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_ELFv2"
27860
+ [(set_attr "type" "branch")
27861
+ (set_attr "length" "4")])
27863
(define_expand "sibcall_epilogue"
27864
[(use (const_int 0))]
27866
@@ -11294,7 +12290,14 @@
27867
operands[1] = gen_rtx_REG (Pmode, 0);
27868
return "st<wd>%U0%X0 %1,%0";
27870
- [(set_attr "type" "store")
27871
+ [(set (attr "type")
27873
+ (match_test "update_indexed_address_mem (operands[0], VOIDmode)")
27874
+ (const_string "store_ux")
27876
+ (match_test "update_address_mem (operands[0], VOIDmode)")
27877
+ (const_string "store_u")
27878
+ (const_string "store"))))
27879
(set_attr "length" "4")])
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)))])
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"
27892
- [(set_attr "type" "fpcompare")])
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)"
27901
- [(set_attr "type" "fpcompare")])
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 @@
27908
[(set_attr "type" "mfcr")])
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"))])]
27916
+ [(set_attr "type" "store")])
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))]
27925
- [(set_attr "type" "integer")])
27926
+ [(set_attr "type" "popcnt")])
27929
;; Builtin fma support. Handle
27930
@@ -13900,6 +14894,20 @@
27934
+(define_insn "*fma<mode>4_fpr"
27935
+ [(set (match_operand:SFDF 0 "gpc_reg_operand" "=<Ff>,<Fv>,<Fv>")
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"
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>")])
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)"
27955
+(define_insn "*fms<mode>4_fpr"
27956
+ [(set (match_operand:SFDF 0 "gpc_reg_operand" "=<Ff>,<Fv>,<Fv>")
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"
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>")])
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)"
27976
+(define_insn "*nfma<mode>4_fpr"
27977
+ [(set (match_operand:SFDF 0 "gpc_reg_operand" "=<Ff>,<Fv>,<Fv>")
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"
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>")])
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 @@
27998
+(define_insn "*nfmssf4_fpr"
27999
+ [(set (match_operand:SFDF 0 "gpc_reg_operand" "=<Ff>,<Fv>,<Fv>")
28002
+ (match_operand:SFDF 1 "gpc_reg_operand" "<Ff>,<Fv>,<Fv>")
28003
+ (match_operand:SFDF 2 "gpc_reg_operand" "<Ff>,<Fv>,0")
28005
+ (match_operand:SFDF 3 "gpc_reg_operand" "<Ff>,0,<Fv>")))))]
28006
+ "TARGET_<MODE>_FPR"
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>")])
28015
(define_expand "rs6000_get_timebase"
28016
[(use (match_operand:DI 0 "gpc_reg_operand" ""))]
28018
@@ -14020,7 +15074,44 @@
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.
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.
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)"
28038
+ return emit_fusion_gpr_load (operands);
28040
+ [(set_attr "type" "load")
28041
+ (set_attr "length" "8")])
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)"
28054
+ expand_fusion_gpr_load (operands);
28060
(include "sync.md")
28061
(include "vector.md")
28063
@@ -14028,3 +15119,5 @@
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
28072
--with-float is ignored if -mhard-float or -msoft-float are
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
28090
/* FP processor type. */
28091
@@ -100,7 +101,8 @@
28092
/* Enumeration to give which calling sequence to use. */
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) */
28101
@@ -131,11 +133,14 @@
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 @@
28124
+ static char buf[1024];
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
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
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
28176
& (OPTION_MASK_RELOCATABLE \
28177
| OPTION_MASK_MINIMAL_TOC)) \
28179
- || DEFAULT_ABI == ABI_AIX)
28180
+ || DEFAULT_ABI != ABI_V4)
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); \
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)) \
28193
@@ -173,14 +173,14 @@
28194
error ("-mrelocatable and -mno-minimal-toc are incompatible"); \
28197
- if (TARGET_RELOCATABLE && rs6000_current_abi == ABI_AIX) \
28198
+ if (TARGET_RELOCATABLE && rs6000_current_abi != ABI_V4) \
28200
rs6000_isa_flags &= ~OPTION_MASK_RELOCATABLE; \
28201
error ("-mrelocatable and -mcall-%s are incompatible", \
28202
rs6000_abi_name); \
28205
- if (!TARGET_64BIT && flag_pic > 1 && rs6000_current_abi == ABI_AIX) \
28206
+ if (!TARGET_64BIT && flag_pic > 1 && rs6000_current_abi != ABI_V4) \
28209
error ("-fPIC and -mcall-%s are incompatible", \
28210
@@ -193,7 +193,7 @@
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) \
28217
rs6000_isa_flags |= OPTION_MASK_RELOCATABLE | OPTION_MASK_MINIMAL_TOC; \
28218
TARGET_NO_FP_IN_TOC = 1; \
28219
@@ -317,7 +317,7 @@
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\"")
28227
#define SDATA_SECTION_ASM_OP "\t.section\t\".sdata\",\"aw\""
28228
@@ -538,12 +538,7 @@
28230
#define CC1_ENDIAN_BIG_SPEC ""
28232
-#define CC1_ENDIAN_LITTLE_SPEC "\
28233
-%{!mstrict-align: %{!mno-strict-align: \
28234
- %{!mcall-i960-old: \
28238
+#define CC1_ENDIAN_LITTLE_SPEC ""
28240
#define CC1_ENDIAN_DEFAULT_SPEC "%(cc1_endian_big)"
28242
--- a/src/libgo/configure
28243
+++ b/src/libgo/configure
28244
@@ -6501,7 +6501,7 @@
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 @@
28255
LD="${LD-ld} -m elf_i386"
28257
- ppc64-*linux*|powerpc64-*linux*)
28258
+ powerpc64le-*linux*)
28259
+ LD="${LD-ld} -m elf32lppclinux"
28261
+ powerpc64-*linux*)
28262
LD="${LD-ld} -m elf32ppclinux"
28265
@@ -6538,7 +6541,10 @@
28267
LD="${LD-ld} -m elf_x86_64"
28269
- ppc*-*linux*|powerpc*-*linux*)
28270
+ powerpcle-*linux*)
28271
+ LD="${LD-ld} -m elf64lppc"
28274
LD="${LD-ld} -m elf64ppc"
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"
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"
28295
--- a/src/libgo/config/libtool.m4
28296
+++ b/src/libgo/config/libtool.m4
28297
@@ -1225,7 +1225,7 @@
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 @@
28308
LD="${LD-ld} -m elf_i386"
28310
- ppc64-*linux*|powerpc64-*linux*)
28311
+ powerpc64le-*linux*)
28312
+ LD="${LD-ld} -m elf32lppclinux"
28314
+ powerpc64-*linux*)
28315
LD="${LD-ld} -m elf32ppclinux"
28318
@@ -1258,7 +1261,10 @@
28320
LD="${LD-ld} -m elf_x86_64"
28322
- ppc*-*linux*|powerpc*-*linux*)
28323
+ powerpcle-*linux*)
28324
+ LD="${LD-ld} -m elf64lppc"
28327
LD="${LD-ld} -m elf64ppc"
28329
s390*-*linux*|s390*-*tpf*)
28330
--- a/src/config.sub
28331
+++ b/src/config.sub
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.
28340
-timestamp='2013-01-11'
28341
+timestamp='2013-10-01'
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
28347
GNU config.sub ($timestamp)
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.
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] \
28362
| arm | arm[bl]e | arme[lb] | armv[2-8] | armv[3-8][lb] | armv7[arm] \
28366
- | c4x | clipper \
28367
+ | c4x | c8051 | clipper \
28368
| d10v | d30v | dlx | dsp16xx \
28370
| fido | fr30 | frv \
28371
@@ -269,6 +265,7 @@
28373
| i370 | i860 | i960 | ia64 \
28378
| m32c | m32r | m32rle | m68000 | m68k | m88k \
28379
@@ -297,10 +294,10 @@
28382
| nds32 | nds32le | nds32be \
28384
+ | nios | nios2 | nios2eb | nios2el \
28389
| pdp10 | pdp11 | pj | pjl \
28390
| powerpc | powerpc64 | powerpc64le | powerpcle \
28392
@@ -328,7 +325,7 @@
28394
basic_machine=tic6x-unknown
28396
- m6811 | m68hc11 | m6812 | m68hc12 | m68hcs12x | picochip)
28397
+ m6811 | m68hc11 | m6812 | m68hc12 | m68hcs12x | nvptx | picochip)
28398
basic_machine=$basic_machine-unknown
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-* \
28416
| f30[01]-* | f700-* | fido-* | fr30-* | frv-* | fx80-* \
28417
@@ -385,6 +382,7 @@
28419
| i*86-* | i860-* | i960-* | ia64-* \
28420
| ip2k-* | iq2000-* \
28422
| le32-* | le64-* \
28424
| m32c-* | m32r-* | m32rle-* \
28425
@@ -414,7 +412,7 @@
28428
| nds32-* | nds32le-* | nds32be-* \
28429
- | nios-* | nios2-* \
28430
+ | nios-* | nios2-* | nios2eb-* | nios2el-* \
28431
| none-* | np1-* | ns16k-* | ns32k-* \
28434
@@ -798,7 +796,7 @@
28438
- basic_machine=i386-pc
28439
+ basic_machine=i686-pc
28443
@@ -834,7 +832,7 @@
28444
basic_machine=`echo $basic_machine | sed -e 's/ms1-/mt-/'`
28447
- basic_machine=i386-pc
28448
+ basic_machine=i686-pc
28452
@@ -1550,6 +1548,9 @@
28462
@@ -1593,6 +1594,9 @@
28472
--- a/src/ChangeLog.ibm
28473
+++ b/src/ChangeLog.ibm
28475
+2013-11-22 Ulrich Weigand <Ulrich.Weigand@de.ibm.com>
28477
+ * libgo/config/libtool.m4: Update to mainline version.
28478
+ * libgo/configure: Regenerate.
28480
+2013-11-19 Ulrich Weigand <Ulrich.Weigand@de.ibm.com>
28482
+ Backport from mainline r205000.
28484
+ gotest: Recognize PPC ELF v2 function pointers in text section.
28486
+2013-11-18 Alan Modra <amodra@gmail.com>
28488
+ * libffi/src/powerpc/ppc_closure.S: Don't bl .Luint128.
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.
28498
+2013-11-17 Ulrich Weigand <Ulrich.Weigand@de.ibm.com>
28500
+ * libgo/config/libtool.m4: Update to mainline version.
28501
+ * libgo/configure: Regenerate.
28503
+2013-11-15 Ulrich Weigand <Ulrich.Weigand@de.ibm.com>
28505
+ * libtool.m4: Update to mainline version.
28506
+ * libjava/libltdl/acinclude.m4: Likewise.
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.
28528
+2013-11-15 Ulrich Weigand <Ulrich.Weigand@de.ibm.com>
28530
+ Backport from mainline r203071:
28532
+ 2013-10-01 Joern Rennecke <joern.rennecke@embecosm.com>
28534
+ Import from savannah.gnu.org:
28535
+ * config.guess: Update to 2013-06-10 version.
28536
+ * config.sub: Update to 2013-10-01 version.
28538
+2013-11-12 Bill Schmidt <wschmidt@linux.ibm.com>
28540
+ Backport from mainline
28541
+ 2013-09-20 Alan Modra <amodra@gmail.com>
28543
+ * libtool.m4 (_LT_ENABLE_LOCK <ld -m flags>): Remove non-canonical
28544
+ ppc host match. Support little-endian powerpc linux hosts.
28546
--- a/src/libobjc/configure
28547
+++ b/src/libobjc/configure
28548
@@ -6056,7 +6056,7 @@
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 @@
28561
- ppc64-*linux*|powerpc64-*linux*)
28562
+ powerpc64le-*linux*)
28563
+ LD="${LD-ld} -m elf32lppclinux"
28565
+ powerpc64-*linux*)
28566
LD="${LD-ld} -m elf32ppclinux"
28569
@@ -6100,7 +6103,10 @@
28571
LD="${LD-ld} -m elf_x86_64"
28573
- ppc*-*linux*|powerpc*-*linux*)
28574
+ powerpcle-*linux*)
28575
+ LD="${LD-ld} -m elf64lppc"
28578
LD="${LD-ld} -m elf64ppc"
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"
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"
28599
@@ -11472,7 +11478,7 @@
28600
enableval=$enable_sjlj_exceptions; :
28602
cat > conftest.$ac_ext << EOF
28603
-#line 11475 "configure"
28604
+#line 11481 "configure"
28607
@implementation Frob
28608
--- a/src/libgfortran/configure
28609
+++ b/src/libgfortran/configure
28610
@@ -8062,7 +8062,7 @@
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 @@
28623
- ppc64-*linux*|powerpc64-*linux*)
28624
+ powerpc64le-*linux*)
28625
+ LD="${LD-ld} -m elf32lppclinux"
28627
+ powerpc64-*linux*)
28628
LD="${LD-ld} -m elf32ppclinux"
28631
@@ -8106,7 +8109,10 @@
28633
LD="${LD-ld} -m elf_x86_64"
28635
- ppc*-*linux*|powerpc*-*linux*)
28636
+ powerpcle-*linux*)
28637
+ LD="${LD-ld} -m elf64lppc"
28640
LD="${LD-ld} -m elf64ppc"
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"
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"
28661
--- a/src/libffi/configure
28662
+++ b/src/libffi/configure
28663
@@ -6392,7 +6392,7 @@
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 @@
28676
- ppc64-*linux*|powerpc64-*linux*)
28677
+ powerpc64le-*linux*)
28678
+ LD="${LD-ld} -m elf32lppclinux"
28680
+ powerpc64-*linux*)
28681
LD="${LD-ld} -m elf32ppclinux"
28684
@@ -6436,7 +6439,10 @@
28686
LD="${LD-ld} -m elf_x86_64"
28688
- ppc*-*linux*|powerpc*-*linux*)
28689
+ powerpcle-*linux*)
28690
+ LD="${LD-ld} -m elf64lppc"
28693
LD="${LD-ld} -m elf64ppc"
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"
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"
28714
--- a/src/libffi/src/powerpc/ppc_closure.S
28715
+++ b/src/libffi/src/powerpc/ppc_closure.S
28716
@@ -238,7 +238,7 @@
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 @@
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
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)
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)
28748
+#if _CALL_ELF == 2
28749
+# define FFI_TRAMPOLINE_SIZE 32
28751
+# if defined(POWERPC64) || defined(POWERPC_AIX)
28752
# if defined(POWERPC_DARWIN64)
28753
# define FFI_TRAMPOLINE_SIZE 48
28755
# define FFI_TRAMPOLINE_SIZE 24
28757
-#else /* POWERPC || POWERPC_AIX */
28758
+# else /* POWERPC || POWERPC_AIX */
28759
# define FFI_TRAMPOLINE_SIZE 40
28764
--- a/src/libffi/src/powerpc/ffi.c
28765
+++ b/src/libffi/src/powerpc/ffi.c
28767
FLAG_RETURNS_128BITS = 1 << (31-27), /* cr6 */
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 */
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);
28788
@@ -383,6 +390,45 @@
28790
enum { ASM_NEEDS_REGISTERS64 = 4 };
28792
+#if _CALL_ELF == 2
28793
+static unsigned int
28794
+discover_homogeneous_aggregate (const ffi_type *t, unsigned int *elnum)
28798
+ case FFI_TYPE_FLOAT:
28799
+ case FFI_TYPE_DOUBLE:
28801
+ return (int) t->type;
28803
+ case FFI_TYPE_STRUCT:;
28805
+ unsigned int base_elt = 0, total_elnum = 0;
28806
+ ffi_type **el = t->elements;
28809
+ unsigned int el_elt, el_elnum = 0;
28810
+ el_elt = discover_homogeneous_aggregate (*el, &el_elnum);
28812
+ || (base_elt && base_elt != el_elt))
28814
+ base_elt = el_elt;
28815
+ total_elnum += el_elnum;
28816
+ if (total_elnum > 8)
28820
+ *elnum = total_elnum;
28831
/* ffi_prep_args64 is called by the assembly routine once stack space
28832
has been allocated for the function's arguments.
28834
@@ -428,6 +474,7 @@
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. */
28847
+ unsigned int fparg_count;
28850
+ unsigned int i, words, nargs, nfixedargs;
28854
@@ -462,11 +509,18 @@
28857
unsigned long gprvalue;
28858
+#ifdef __STRUCT_PARM_ALIGN__
28859
+ unsigned long align;
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;
28868
rest.ul = stack + 6 + NUM_GPR_ARG_REGISTERS64;
28870
fpr_base.d = gpr_base.d - NUM_FPR_ARG_REGISTERS64;
28872
next_arg.ul = gpr_base.ul;
28873
@@ -482,30 +536,36 @@
28875
/* Now for the arguments. */
28876
p_argv.v = ecif->avalue;
28877
- for (ptr = ecif->cif->arg_types, i = ecif->cif->nargs;
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;
28884
+ i++, ptr++, p_argv.v++)
28886
+ unsigned int elt, elnum;
28888
switch ((*ptr)->type)
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;
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;
28902
FFI_ASSERT (flags & FLAG_FP_ARGUMENTS);
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;
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;
28917
FFI_ASSERT (flags & FLAG_FP_ARGUMENTS);
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;
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;
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;
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;
28944
FFI_ASSERT (__LDBL_MANT_DIG__ == 106);
28945
FFI_ASSERT (flags & FLAG_FP_ARGUMENTS);
28946
@@ -532,28 +594,86 @@
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__;
28957
+ next_arg.p = ALIGN (next_arg.p, align);
28960
+#if _CALL_ELF == 2
28961
+ elt = discover_homogeneous_aggregate (*ptr, &elnum);
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;
28975
+ arg.v = *p_argv.v;
28976
+ if (elt == FFI_TYPE_FLOAT)
28980
+ double_tmp = *arg.f++;
28981
+ if (fparg_count < NUM_FPR_ARG_REGISTERS64
28982
+ && i < nfixedargs)
28983
+ *fpr_base.d++ = double_tmp;
28985
+ *next_arg.f = (float) double_tmp;
28986
+ if (++next_arg.f == gpr_end.f)
28987
+ next_arg.f = rest.f;
28990
+ while (--elnum != 0);
28991
+ if ((next_arg.p & 3) != 0)
28993
+ if (++next_arg.f == gpr_end.f)
28994
+ next_arg.f = rest.f;
29000
+ double_tmp = *arg.d++;
29001
+ if (fparg_count < NUM_FPR_ARG_REGISTERS64 && i < nfixedargs)
29002
+ *fpr_base.d++ = double_tmp;
29004
+ *next_arg.d = double_tmp;
29005
+ if (++next_arg.d == gpr_end.d)
29006
+ next_arg.d = rest.d;
29009
+ while (--elnum != 0);
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)
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;
29024
+ char *where = next_arg.c;
29026
#ifndef __LITTLE_ENDIAN__
29027
- /* Structures with size less than eight bytes are passed
29029
- if ((*ptr)->size < 8)
29030
- where += 8 - (*ptr)->size;
29031
+ /* Structures with size less than eight bytes are passed
29033
+ if ((*ptr)->size < 8)
29034
+ where += 8 - (*ptr)->size;
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;
29048
@@ -597,24 +717,22 @@
29051
/* Perform machine dependent cif processing */
29053
-ffi_prep_cif_machdep (ffi_cif *cif)
29055
+ffi_prep_cif_machdep_core (ffi_cif *cif)
29057
/* All this is for the SYSV and LINUX64 ABI. */
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;
29069
+ /* The machine-independent calculation of cif->bytes doesn't work
29070
+ for us. Redo the calculation. */
29071
if (cif->abi != FFI_LINUX64)
29073
- /* All the machine-independent calculation of cif->bytes will be wrong.
29074
- Redo the calculation for SYSV. */
29076
/* Space for the frame pointer, callee's LR, and the asm's temp regs. */
29077
bytes = (2 + ASM_NEEDS_REGISTERS) * sizeof (int);
29079
@@ -624,13 +742,20 @@
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);
29087
+ /* Space for the general registers. */
29088
+ bytes += NUM_GPR_ARG_REGISTERS64 * sizeof (long);
29090
/* Space for backchain, CR, LR, cc/ld doubleword, TOC and the asm's temp
29092
bytes = (6 + ASM_NEEDS_REGISTERS64) * sizeof (long);
29094
/* Space for the mandatory parm save area and general registers. */
29095
bytes += 2 * NUM_GPR_ARG_REGISTERS64 * sizeof (long);
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)
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;
29121
+ else if (cif->abi != FFI_LINUX
29122
+ && cif->abi != FFI_LINUX64)
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;
29135
@@ -691,7 +820,7 @@
29136
case FFI_TYPE_STRUCT:
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
29143
* NOTE: The assembly code can safely assume that it just needs to
29144
@@ -700,7 +829,29 @@
29147
if (cif->abi == FFI_SYSV && size <= 8)
29148
- flags |= FLAG_RETURNS_SMST;
29150
+ flags |= FLAG_RETURNS_SMST;
29153
+#if _CALL_ELF == 2
29154
+ if (cif->abi == FFI_LINUX64)
29156
+ unsigned int elt, elnum;
29157
+ elt = discover_homogeneous_aggregate (cif->rtype, &elnum);
29160
+ if (elt == FFI_TYPE_DOUBLE)
29161
+ flags |= FLAG_RETURNS_64BITS;
29162
+ flags |= FLAG_RETURNS_FP | FLAG_RETURNS_SMST;
29167
+ flags |= FLAG_RETURNS_SMST;
29173
flags |= FLAG_RETVAL_REFERENCE;
29174
/* Fall through. */
29175
@@ -816,27 +967,54 @@
29177
for (ptr = cif->arg_types, i = cif->nargs; i > 0; i--, ptr++)
29179
+ unsigned int elt, elnum;
29180
+#ifdef __STRUCT_PARM_ALIGN__
29181
+ unsigned int align;
29184
switch ((*ptr)->type)
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;
29192
- fparg_count += 2;
29193
- intarg_count += 2;
29195
+ fparg_count += 2;
29196
+ intarg_count += 2;
29197
+ if (fparg_count > NUM_FPR_ARG_REGISTERS)
29198
+ flags |= FLAG_ARG_NEEDS_PSAVE;
29201
case FFI_TYPE_FLOAT:
29202
case FFI_TYPE_DOUBLE:
29205
+ if (fparg_count > NUM_FPR_ARG_REGISTERS)
29206
+ flags |= FLAG_ARG_NEEDS_PSAVE;
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;
29216
+ intarg_count = ALIGN (intarg_count, align);
29218
intarg_count += ((*ptr)->size + 7) / 8;
29220
+#if _CALL_ELF == 2
29221
+ elt = discover_homogeneous_aggregate (*ptr, &elnum);
29225
+ fparg_count += elnum;
29226
+ if (fparg_count > NUM_FPR_ARG_REGISTERS)
29227
+ flags |= FLAG_ARG_NEEDS_PSAVE;
29231
+ if (intarg_count > NUM_GPR_ARG_REGISTERS)
29232
+ flags |= FLAG_ARG_NEEDS_PSAVE;
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. */
29241
+ if (intarg_count > NUM_GPR_ARG_REGISTERS)
29242
+ flags |= FLAG_ARG_NEEDS_PSAVE;
29250
@@ -892,8 +1072,13 @@
29254
+#if _CALL_ELF == 2
29255
+ if ((flags & FLAG_ARG_NEEDS_PSAVE) != 0)
29256
+ bytes += intarg_count * sizeof (long);
29258
if (intarg_count > NUM_GPR_ARG_REGISTERS64)
29259
bytes += (intarg_count - NUM_GPR_ARG_REGISTERS64) * sizeof (long);
29263
/* The stack space allocated needs to be a multiple of 16 bytes. */
29264
@@ -908,6 +1093,26 @@
29269
+ffi_prep_cif_machdep (ffi_cif *cif)
29271
+ cif->nfixedargs = cif->nargs;
29272
+ return ffi_prep_cif_machdep_core (cif);
29276
+ffi_prep_cif_machdep_var (ffi_cif *cif,
29277
+ unsigned int nfixedargs,
29278
+ unsigned int ntotalargs MAYBE_UNUSED)
29280
+ cif->nfixedargs = nfixedargs;
29281
+#if _CALL_ELF == 2
29282
+ if (cif->abi == FFI_LINUX64)
29283
+ cif->flags |= FLAG_ARG_NEEDS_PSAVE;
29285
+ return ffi_prep_cif_machdep_core (cif);
29288
extern void ffi_call_SYSV(extended_cif *, unsigned, unsigned, unsigned *,
29290
extern void FFI_HIDDEN ffi_call_LINUX64(extended_cif *, unsigned long,
29291
@@ -919,30 +1124,28 @@
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
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.
29306
+ * For ELFv2 ABI, use a bounce buffer for homogeneous structs too,
29307
+ * for similar reasons.
29309
- unsigned int smst_buffer[2];
29310
+ unsigned long smst_buffer[8];
29312
- unsigned int rsize = 0;
29315
ecif.avalue = avalue;
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;
29322
- ecif.rvalue = smst_buffer;
29323
- else if (!rvalue)
29324
- ecif.rvalue = alloca(rsize);
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);
29335
@@ -967,11 +1170,26 @@
29337
/* Check for a bounce-buffered return value */
29338
if (rvalue && ecif.rvalue == smst_buffer)
29339
- memcpy(rvalue, smst_buffer, rsize);
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);
29354
+ memcpy (rvalue, smst_buffer, rsize);
29360
+#if !defined POWERPC64 || _CALL_ELF == 2
29361
#define MIN_CACHE_LINE_SIZE 8
29364
@@ -995,6 +1213,22 @@
29368
+# if _CALL_ELF == 2
29369
+ unsigned int *tramp = (unsigned int *) &closure->tramp[0];
29371
+ if (cif->abi != FFI_LINUX64)
29372
+ return FFI_BAD_ABI;
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);
29384
void **tramp = (void **) &closure->tramp[0];
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;
29393
unsigned int *tramp;
29395
@@ -1226,6 +1461,7 @@
29400
case FFI_TYPE_SINT16:
29401
case FFI_TYPE_UINT16:
29402
#ifndef __LITTLE_ENDIAN__
29403
@@ -1243,6 +1479,7 @@
29408
case FFI_TYPE_SINT32:
29409
case FFI_TYPE_UINT32:
29410
case FFI_TYPE_POINTER:
29411
@@ -1346,16 +1583,20 @@
29414
ffi_type **arg_types;
29416
+ unsigned long i, avn, nfixedargs;
29418
ffi_dblfl *end_pfr = pfr + NUM_FPR_ARG_REGISTERS64;
29419
+#ifdef __STRUCT_PARM_ALIGN__
29420
+ unsigned long align;
29423
cif = closure->cif;
29424
avalue = alloca (cif->nargs * sizeof (void *));
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)
29434
rvalue = (void *) *pst;
29436
@@ -1363,11 +1604,14 @@
29440
+ nfixedargs = cif->nfixedargs;
29441
arg_types = cif->arg_types;
29443
/* Grab the addresses of the arguments from the stack frame. */
29446
+ unsigned int elt, elnum;
29448
switch (arg_types[i]->type)
29450
case FFI_TYPE_SINT8:
29451
@@ -1377,6 +1621,7 @@
29456
case FFI_TYPE_SINT16:
29457
case FFI_TYPE_UINT16:
29458
#ifndef __LITTLE_ENDIAN__
29459
@@ -1384,6 +1629,7 @@
29464
case FFI_TYPE_SINT32:
29465
case FFI_TYPE_UINT32:
29466
#ifndef __LITTLE_ENDIAN__
29467
@@ -1391,6 +1637,7 @@
29472
case FFI_TYPE_SINT64:
29473
case FFI_TYPE_UINT64:
29474
case FFI_TYPE_POINTER:
29475
@@ -1399,14 +1646,82 @@
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__;
29484
+ pst = (unsigned long *) ALIGN ((size_t) pst, align);
29487
+#if _CALL_ELF == 2
29488
+ elt = discover_homogeneous_aggregate (arg_types[i], &elnum);
29494
+ unsigned long *ul;
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
29504
+ if (pfr + elnum <= end_pfr)
29509
+ avalue[i] = to.v;
29511
+ if (elt == FFI_TYPE_FLOAT)
29515
+ if (pfr < end_pfr && i < nfixedargs)
29517
+ *to.f = (float) pfr->d;
29525
+ while (--elnum != 0);
29531
+ if (pfr < end_pfr && i < nfixedargs)
29541
+ while (--elnum != 0);
29546
#ifndef __LITTLE_ENDIAN__
29547
- /* Structures with size less than eight bytes are passed
29549
- if (arg_types[i]->size < 8)
29550
- avalue[i] = (char *) pst + 8 - arg_types[i]->size;
29552
+ /* Structures with size less than eight bytes are passed
29554
+ if (arg_types[i]->size < 8)
29555
+ avalue[i] = (char *) pst + 8 - arg_types[i]->size;
29561
pst += (arg_types[i]->size + 7) / 8;
29564
@@ -1418,7 +1733,7 @@
29566
/* there are 13 64bit floating point registers */
29568
- if (pfr < end_pfr)
29569
+ if (pfr < end_pfr && i < nfixedargs)
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 */
29577
- if (pfr < end_pfr)
29578
+ if (pfr < end_pfr && i < nfixedargs)
29582
@@ -1446,14 +1761,14 @@
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)
29594
- if (pfr < end_pfr)
29595
+ if (pfr < end_pfr && i < nfixedargs)
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);
29602
/* Tell ffi_closure_LINUX64 how to perform return type promotions. */
29603
+ if ((cif->flags & FLAG_RETURNS_SMST) != 0)
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;
29610
+ return FFI_V2_TYPE_FLOAT_HOMOG;
29612
return cif->rtype->type;
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
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
29627
.section ".opd","aw"
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
29635
.L.ffi_closure_LINUX64:
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
29644
.ffi_closure_LINUX64:
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
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
29666
- # save general regs into parm save area
29671
+# if _CALL_ELF == 2
29672
+ ld %r12, FFI_TRAMPOLINE_SIZE(%r11) # closure->cif
29674
+ lwz %r12, 28(%r12) # cif->flags
29676
+ addi %r12, %r1, PARMSAVE
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
29684
+ # Save general regs into parm save area
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)
29697
- std %r10, 104(%r1)
29698
+ # load up the pointer to the parm save area
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)
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)
29719
+ # load up the pointer to the parm save area
29720
+ addi %r5, %r1, PARMSAVE
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)
29751
- # set up registers for the routine that actually does the work
29752
- # get the context pointer from the trampoline
29754
+ # load up the pointer to the saved fpr registers */
29755
+ addi %r6, %r1, -104
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
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)
29768
- # now load up the pointer to the saved fpr registers */
29769
- addi %r6, %r1, 128
29770
+ # get the context pointer from the trampoline
29774
-#ifdef _CALL_LINUX
29775
+# if defined _CALL_LINUX || _CALL_ELF == 2
29776
bl ffi_closure_helper_LINUX64
29779
bl .ffi_closure_helper_LINUX64
29784
# now r3 contains the return type
29785
@@ -112,10 +161,12 @@
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
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
29799
@@ -128,117 +179,175 @@
29801
# case FFI_TYPE_VOID
29803
- addi %r1, %r1, 240
29804
+ addi %r1, %r1, STACKFRAME
29807
# case FFI_TYPE_INT
29808
-#ifdef __LITTLE_ENDIAN__
29809
- lwa %r3, 112+0(%r1)
29811
- lwa %r3, 112+4(%r1)
29813
+# ifdef __LITTLE_ENDIAN__
29814
+ lwa %r3, RETVAL+0(%r1)
29816
+ lwa %r3, RETVAL+4(%r1)
29819
- addi %r1, %r1, 240
29820
+ addi %r1, %r1, STACKFRAME
29822
# case FFI_TYPE_FLOAT
29823
- lfs %f1, 112+0(%r1)
29824
+ lfs %f1, RETVAL+0(%r1)
29826
- addi %r1, %r1, 240
29827
+ addi %r1, %r1, STACKFRAME
29829
# case FFI_TYPE_DOUBLE
29830
- lfd %f1, 112+0(%r1)
29831
+ lfd %f1, RETVAL+0(%r1)
29833
- addi %r1, %r1, 240
29834
+ addi %r1, %r1, STACKFRAME
29836
# case FFI_TYPE_LONGDOUBLE
29837
- lfd %f1, 112+0(%r1)
29838
+ lfd %f1, RETVAL+0(%r1)
29840
- lfd %f2, 112+8(%r1)
29841
+ lfd %f2, RETVAL+8(%r1)
29843
# case FFI_TYPE_UINT8
29844
-#ifdef __LITTLE_ENDIAN__
29845
- lbz %r3, 112+0(%r1)
29847
- lbz %r3, 112+7(%r1)
29849
+# ifdef __LITTLE_ENDIAN__
29850
+ lbz %r3, RETVAL+0(%r1)
29852
+ lbz %r3, RETVAL+7(%r1)
29855
- addi %r1, %r1, 240
29856
+ addi %r1, %r1, STACKFRAME
29858
# case FFI_TYPE_SINT8
29859
-#ifdef __LITTLE_ENDIAN__
29860
- lbz %r3, 112+0(%r1)
29862
- lbz %r3, 112+7(%r1)
29864
+# ifdef __LITTLE_ENDIAN__
29865
+ lbz %r3, RETVAL+0(%r1)
29867
+ lbz %r3, RETVAL+7(%r1)
29872
# case FFI_TYPE_UINT16
29873
-#ifdef __LITTLE_ENDIAN__
29874
- lhz %r3, 112+0(%r1)
29876
- lhz %r3, 112+6(%r1)
29878
+# ifdef __LITTLE_ENDIAN__
29879
+ lhz %r3, RETVAL+0(%r1)
29881
+ lhz %r3, RETVAL+6(%r1)
29885
- addi %r1, %r1, 240
29886
+ addi %r1, %r1, STACKFRAME
29888
# case FFI_TYPE_SINT16
29889
-#ifdef __LITTLE_ENDIAN__
29890
- lha %r3, 112+0(%r1)
29892
- lha %r3, 112+6(%r1)
29894
+# ifdef __LITTLE_ENDIAN__
29895
+ lha %r3, RETVAL+0(%r1)
29897
+ lha %r3, RETVAL+6(%r1)
29900
- addi %r1, %r1, 240
29901
+ addi %r1, %r1, STACKFRAME
29903
# case FFI_TYPE_UINT32
29904
-#ifdef __LITTLE_ENDIAN__
29905
- lwz %r3, 112+0(%r1)
29907
- lwz %r3, 112+4(%r1)
29909
+# ifdef __LITTLE_ENDIAN__
29910
+ lwz %r3, RETVAL+0(%r1)
29912
+ lwz %r3, RETVAL+4(%r1)
29915
- addi %r1, %r1, 240
29916
+ addi %r1, %r1, STACKFRAME
29918
# case FFI_TYPE_SINT32
29919
-#ifdef __LITTLE_ENDIAN__
29920
- lwa %r3, 112+0(%r1)
29922
- lwa %r3, 112+4(%r1)
29924
+# ifdef __LITTLE_ENDIAN__
29925
+ lwa %r3, RETVAL+0(%r1)
29927
+ lwa %r3, RETVAL+4(%r1)
29930
- addi %r1, %r1, 240
29931
+ addi %r1, %r1, STACKFRAME
29933
# case FFI_TYPE_UINT64
29934
- ld %r3, 112+0(%r1)
29935
+ ld %r3, RETVAL+0(%r1)
29937
- addi %r1, %r1, 240
29938
+ addi %r1, %r1, STACKFRAME
29940
# case FFI_TYPE_SINT64
29941
- ld %r3, 112+0(%r1)
29942
+ ld %r3, RETVAL+0(%r1)
29944
- addi %r1, %r1, 240
29945
+ addi %r1, %r1, STACKFRAME
29947
# case FFI_TYPE_STRUCT
29949
- addi %r1, %r1, 240
29950
+ addi %r1, %r1, STACKFRAME
29953
# case FFI_TYPE_POINTER
29954
- ld %r3, 112+0(%r1)
29955
+ ld %r3, RETVAL+0(%r1)
29957
- addi %r1, %r1, 240
29958
+ addi %r1, %r1, STACKFRAME
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)
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)
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
29979
+ lfs %f4, RETVAL+12(%r1)
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
29988
+# ifdef __LITTLE_ENDIAN__
29989
+ ld %r3,RETVAL+0(%r1)
29991
+ ld %r4,RETVAL+8(%r1)
29992
+ addi %r1, %r1, STACKFRAME
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?
30001
+ ld %r3,RETVAL+0(%r1)
30004
+ ld %r4,RETVAL+8(%r1)
30005
+ addi %r1, %r1, STACKFRAME
30008
+ addi %r5, %r5, FFI_V2_TYPE_SMALL_STRUCT + 7
30011
+ addi %r1, %r1, STACKFRAME
30012
+ srd %r3, %r3, %r5
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
30023
+# ifdef _CALL_LINUX
30024
.size ffi_closure_LINUX64,.-.L.ffi_closure_LINUX64
30027
.size .ffi_closure_LINUX64,.-.ffi_closure_LINUX64
30032
.section .eh_frame,EH_FRAME_FLAGS,@progbits
30034
@@ -267,14 +376,14 @@
30035
.byte 0x2 # DW_CFA_advance_loc1
30037
.byte 0xe # DW_CFA_def_cfa_offset
30039
+ .uleb128 STACKFRAME
30040
.byte 0x11 # DW_CFA_offset_extended_sf
30047
-#if defined __ELF__ && defined __linux__
30048
+# if defined __ELF__ && defined __linux__
30049
.section .note.GNU-stack,"",@progbits
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
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
30065
.section ".opd","aw"
30068
-#ifdef _CALL_LINUX
30069
+# ifdef _CALL_LINUX
30070
.quad .L.ffi_call_LINUX64,.TOC.@tocbase,0
30071
.type ffi_call_LINUX64,@function
30073
.L.ffi_call_LINUX64:
30076
.hidden .ffi_call_LINUX64
30077
.globl .ffi_call_LINUX64
30078
.quad .ffi_call_LINUX64,.TOC.@tocbase,0
30080
.type .ffi_call_LINUX64,@function
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
30101
/* Call ffi_prep_args64. */
30103
-#ifdef _CALL_LINUX
30104
+# if defined _CALL_LINUX || _CALL_ELF == 2
30108
bl .ffi_prep_args64
30113
+# if _CALL_ELF == 2
30121
/* Now do the call. */
30122
/* Set up cr1 with bits 4-7 of the flags. */
30125
/* Get the address to call into CTR. */
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 @@
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
30141
/* Now, deal with the return value. */
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
30149
/* Fall through... */
30151
@@ -130,7 +152,7 @@
30152
/* Restore the registers we used and return. */
30155
- ld %r28, -32(%r1)
30156
+ ld %r28, -32(%r28)
30160
@@ -147,14 +169,48 @@
30161
.Lfloat_return_value:
30163
b .Ldone_return_value
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
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
30192
+ b .Ldone_return_value
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
30201
+# ifdef _CALL_LINUX
30202
.size ffi_call_LINUX64,.-.L.ffi_call_LINUX64
30205
.size .ffi_call_LINUX64,.-.ffi_call_LINUX64
30210
.section .eh_frame,EH_FRAME_FLAGS,@progbits
30212
@@ -197,8 +253,8 @@
30218
-#if defined __ELF__ && defined __linux__
30219
+# if (defined __ELF__ && defined __linux__) || _CALL_ELF == 2
30220
.section .note.GNU-stack,"",@progbits
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 @@
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);
30233
args[1] = &doubleArg;
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" } */
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);
30248
- CHECK(ffi_prep_closure_loc(pcl, &cif, cls_double_va_fn, NULL, code) == FFI_OK);
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" } */
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 @@
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);
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" } */
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);
30286
- CHECK(ffi_prep_closure_loc(pcl, &cif, cls_longdouble_va_fn, NULL, code) == FFI_OK);
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" } */
30298
--- a/src/libffi/doc/libffi.texi
30299
+++ b/src/libffi/doc/libffi.texi
30300
@@ -184,11 +184,11 @@
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
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 @@
30322
/* Initialize the argument info vectors */
30323
args[0] = &ffi_type_pointer;
30324
@@ -222,7 +222,7 @@
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)
30331
s = "Hello World!";
30332
ffi_call(&cif, puts, &rc, values);
30333
@@ -360,7 +360,7 @@
30334
new @code{ffi_type} object for it.
30338
+@deftp {Data type} ffi_type
30339
The @code{ffi_type} has the following members:
30342
@@ -414,6 +414,7 @@
30345
tm_type.size = tm_type.alignment = 0;
30346
+ tm_type.type = FFI_TYPE_STRUCT;
30347
tm_type.elements = &tm_type_elements;
30349
for (i = 0; i < 9; i++)
30350
@@ -540,21 +541,23 @@
30353
/* Acts like puts with the file given at time of enclosure. */
30354
-void puts_binding(ffi_cif *cif, unsigned int *ret, void* args[],
30356
+void puts_binding(ffi_cif *cif, void *ret, void* args[],
30359
- *ret = fputs(*(char **)args[0], stream);
30360
+ *(ffi_arg *)ret = fputs(*(char **)args[0], (FILE *)stream);
30363
+typedef int (*puts_t)(char *);
30369
ffi_closure *closure;
30371
- int (*bound_puts)(char *);
30372
+ void *bound_puts;
30376
/* Allocate closure and bound_puts */
30377
closure = ffi_closure_alloc(sizeof(ffi_closure), &bound_puts);
30379
@@ -565,13 +568,13 @@
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)
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)
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 */
30396
--- a/src/libssp/configure
30397
+++ b/src/libssp/configure
30398
@@ -6385,7 +6385,7 @@
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 @@
30411
- ppc64-*linux*|powerpc64-*linux*)
30412
+ powerpc64le-*linux*)
30413
+ LD="${LD-ld} -m elf32lppclinux"
30415
+ powerpc64-*linux*)
30416
LD="${LD-ld} -m elf32ppclinux"
30419
@@ -6429,7 +6432,10 @@
30421
LD="${LD-ld} -m elf_x86_64"
30423
- ppc*-*linux*|powerpc*-*linux*)
30424
+ powerpcle-*linux*)
30425
+ LD="${LD-ld} -m elf64lppc"
30428
LD="${LD-ld} -m elf64ppc"
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"
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"
30449
--- a/src/libcpp/ChangeLog.ibm
30450
+++ b/src/libcpp/ChangeLog.ibm
30452
+2013-11-18 Bill Schmidt <wschmidt@linux.vnet.ibm.com>
30454
+ * lex.c (search_line_fast): Correct for little endian.
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);
30466
+ mask = __builtin_vec_lvsl(0, s);
30467
+ mask = __builtin_vec_perm(ones, zero, mask);
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;
30479
+ l = __builtin_ctzl(l) >> 3;