1
# DP: Changes from the ibm/gcc-4_8-branch (20140113)
3
LANG=C svn diff svn://gcc.gnu.org/svn/gcc/branches/gcc-4_8-branch@206579 \
4
svn://gcc.gnu.org/svn/gcc/branches/ibm/gcc-4_8-branch@206581 \
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
@@ -13589,7 +13589,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
@@ -13614,7 +13614,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
@@ -13633,7 +13636,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
@@ -17827,7 +17833,7 @@
1891
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
1892
lt_status=$lt_dlunknown
1893
cat > conftest.$ac_ext <<_LT_EOF
1894
-#line 17830 "configure"
1895
+#line 17836 "configure"
1896
#include "confdefs.h"
1899
@@ -17933,7 +17939,7 @@
1900
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
1901
lt_status=$lt_dlunknown
1902
cat > conftest.$ac_ext <<_LT_EOF
1903
-#line 17936 "configure"
1904
+#line 17942 "configure"
1905
#include "confdefs.h"
1908
--- a/src/gcc/builtins.c
1909
+++ b/src/gcc/builtins.c
1910
@@ -5850,6 +5850,9 @@
1913
CASE_FLT_FN (BUILT_IN_FABS):
1914
+ case BUILT_IN_FABSD32:
1915
+ case BUILT_IN_FABSD64:
1916
+ case BUILT_IN_FABSD128:
1917
target = expand_builtin_fabs (exp, target, subtarget);
1920
@@ -10302,6 +10305,9 @@
1921
return fold_builtin_strlen (loc, type, arg0);
1923
CASE_FLT_FN (BUILT_IN_FABS):
1924
+ case BUILT_IN_FABSD32:
1925
+ case BUILT_IN_FABSD64:
1926
+ case BUILT_IN_FABSD128:
1927
return fold_builtin_fabs (loc, arg0, type);
1930
--- a/src/gcc/testsuite/gcc.target/powerpc/ppc-target-2.c
1931
+++ b/src/gcc/testsuite/gcc.target/powerpc/ppc-target-2.c
1933
/* { dg-final { scan-assembler-times "fabs" 3 } } */
1934
/* { dg-final { scan-assembler-times "fnabs" 3 } } */
1935
/* { dg-final { scan-assembler-times "fsel" 3 } } */
1936
-/* { dg-final { scan-assembler-times "fcpsgn" 3 } } */
1937
-/* { dg-final { scan-assembler-times "xscpsgndp" 1 } } */
1938
+/* { dg-final { scan-assembler-times "fcpsgn\|xscpsgndp" 4 } } */
1940
/* fabs/fnabs/fsel */
1941
double normal1 (double a, double b) { return __builtin_copysign (a, b); }
1942
--- a/src/gcc/testsuite/gcc.target/powerpc/p8vector-builtin-1.c
1943
+++ b/src/gcc/testsuite/gcc.target/powerpc/p8vector-builtin-1.c
1945
+/* { dg-do compile { target { powerpc*-*-* } } } */
1946
+/* { dg-skip-if "" { powerpc*-*-darwin* } { "*" } { "" } } */
1947
+/* { dg-require-effective-target powerpc_p8vector_ok } */
1948
+/* { dg-options "-mcpu=power8 -O2 -ftree-vectorize -fvect-cost-model -fno-unroll-loops -fno-unroll-all-loops" } */
1951
+#define TYPE long long
1955
+#define SIGN_TYPE signed TYPE
1959
+#define UNS_TYPE unsigned TYPE
1962
+typedef vector SIGN_TYPE v_sign;
1963
+typedef vector UNS_TYPE v_uns;
1965
+v_sign sign_add (v_sign a, v_sign b)
1970
+v_sign sign_sub (v_sign a, v_sign b)
1975
+v_sign sign_shift_left (v_sign a, v_sign b)
1980
+v_sign sign_shift_right (v_sign a, v_sign b)
1985
+v_uns uns_add (v_uns a, v_uns b)
1990
+v_uns uns_sub (v_uns a, v_uns b)
1995
+v_uns uns_shift_left (v_uns a, v_uns b)
2000
+v_uns uns_shift_right (v_uns a, v_uns b)
2005
+/* { dg-final { scan-assembler-times "vaddudm" 2 } } */
2006
+/* { dg-final { scan-assembler-times "vsubudm" 2 } } */
2007
+/* { dg-final { scan-assembler-times "vsld" 2 } } */
2008
+/* { dg-final { scan-assembler-times "vsrad" 1 } } */
2009
+/* { dg-final { scan-assembler-times "vsrd" 1 } } */
2010
--- a/src/gcc/testsuite/gcc.target/powerpc/p8vector-vectorize-1.c
2011
+++ b/src/gcc/testsuite/gcc.target/powerpc/p8vector-vectorize-1.c
2013
+/* { dg-do compile { target { powerpc*-*-* } } } */
2014
+/* { dg-skip-if "" { powerpc*-*-darwin* } { "*" } { "" } } */
2015
+/* { dg-require-effective-target powerpc_p8vector_ok } */
2016
+/* { dg-options "-mcpu=power8 -O2 -ftree-vectorize -fvect-cost-model -fno-unroll-loops -fno-unroll-all-loops" } */
2027
+#define TYPE long long
2031
+#define SIGN_TYPE signed TYPE
2035
+#define UNS_TYPE unsigned TYPE
2038
+#define ALIGN_ATTR __attribute__((__aligned__(ALIGN)))
2040
+SIGN_TYPE sa[SIZE] ALIGN_ATTR;
2041
+SIGN_TYPE sb[SIZE] ALIGN_ATTR;
2042
+SIGN_TYPE sc[SIZE] ALIGN_ATTR;
2044
+UNS_TYPE ua[SIZE] ALIGN_ATTR;
2045
+UNS_TYPE ub[SIZE] ALIGN_ATTR;
2046
+UNS_TYPE uc[SIZE] ALIGN_ATTR;
2053
+ for (i = 0; i < SIZE; i++)
2054
+ sa[i] = sb[i] + sc[i];
2062
+ for (i = 0; i < SIZE; i++)
2063
+ sa[i] = sb[i] - sc[i];
2067
+sign_shift_left (void)
2071
+ for (i = 0; i < SIZE; i++)
2072
+ sa[i] = sb[i] << sc[i];
2076
+sign_shift_right (void)
2080
+ for (i = 0; i < SIZE; i++)
2081
+ sa[i] = sb[i] >> sc[i];
2089
+ for (i = 0; i < SIZE; i++)
2090
+ sa[i] = (sb[i] > sc[i]) ? sb[i] : sc[i];
2098
+ for (i = 0; i < SIZE; i++)
2099
+ sa[i] = (sb[i] < sc[i]) ? sb[i] : sc[i];
2107
+ for (i = 0; i < SIZE; i++)
2108
+ sa[i] = (sb[i] < 0) ? -sb[i] : sb[i]; /* xor, vsubudm, vmaxsd. */
2112
+sign_eq (SIGN_TYPE val1, SIGN_TYPE val2)
2116
+ for (i = 0; i < SIZE; i++)
2117
+ sa[i] = (sb[i] == sc[i]) ? val1 : val2;
2121
+sign_lt (SIGN_TYPE val1, SIGN_TYPE val2)
2125
+ for (i = 0; i < SIZE; i++)
2126
+ sa[i] = (sb[i] < sc[i]) ? val1 : val2;
2134
+ for (i = 0; i < SIZE; i++)
2135
+ ua[i] = ub[i] + uc[i];
2143
+ for (i = 0; i < SIZE; i++)
2144
+ ua[i] = ub[i] - uc[i];
2148
+uns_shift_left (void)
2152
+ for (i = 0; i < SIZE; i++)
2153
+ ua[i] = ub[i] << uc[i];
2157
+uns_shift_right (void)
2161
+ for (i = 0; i < SIZE; i++)
2162
+ ua[i] = ub[i] >> uc[i];
2170
+ for (i = 0; i < SIZE; i++)
2171
+ ua[i] = (ub[i] > uc[i]) ? ub[i] : uc[i];
2179
+ for (i = 0; i < SIZE; i++)
2180
+ ua[i] = (ub[i] < uc[i]) ? ub[i] : uc[i];
2184
+uns_eq (UNS_TYPE val1, UNS_TYPE val2)
2188
+ for (i = 0; i < SIZE; i++)
2189
+ ua[i] = (ub[i] == uc[i]) ? val1 : val2;
2193
+uns_lt (UNS_TYPE val1, UNS_TYPE val2)
2197
+ for (i = 0; i < SIZE; i++)
2198
+ ua[i] = (ub[i] < uc[i]) ? val1 : val2;
2201
+/* { dg-final { scan-assembler-times "\[\t \]vaddudm\[\t \]" 2 } } */
2202
+/* { dg-final { scan-assembler-times "\[\t \]vsubudm\[\t \]" 3 } } */
2203
+/* { dg-final { scan-assembler-times "\[\t \]vmaxsd\[\t \]" 2 } } */
2204
+/* { dg-final { scan-assembler-times "\[\t \]vmaxud\[\t \]" 1 } } */
2205
+/* { dg-final { scan-assembler-times "\[\t \]vminsd\[\t \]" 1 } } */
2206
+/* { dg-final { scan-assembler-times "\[\t \]vminud\[\t \]" 1 } } */
2207
+/* { dg-final { scan-assembler-times "\[\t \]vsld\[\t \]" 2 } } */
2208
+/* { dg-final { scan-assembler-times "\[\t \]vsrad\[\t \]" 1 } } */
2209
+/* { dg-final { scan-assembler-times "\[\t \]vsrd\[\t \]" 1 } } */
2210
+/* { dg-final { scan-assembler-times "\[\t \]vcmpequd\[\t \]" 2 } } */
2211
+/* { dg-final { scan-assembler-times "\[\t \]vcmpgtsd\[\t \]" 1 } } */
2212
+/* { dg-final { scan-assembler-times "\[\t \]vcmpgtud\[\t \]" 1 } } */
2213
--- a/src/gcc/testsuite/gcc.target/powerpc/pr57744.c
2214
+++ b/src/gcc/testsuite/gcc.target/powerpc/pr57744.c
2216
+/* { dg-do run { target { powerpc*-*-* && lp64 } } } */
2217
+/* { dg-skip-if "" { powerpc*-*-darwin* } { "*" } { "" } } */
2218
+/* { dg-require-effective-target powerpc_p8vector_ok } */
2219
+/* { dg-options "-mcpu=power8 -O3" } */
2223
+typedef unsigned U_16 __attribute__((mode(TI)));
2225
+extern int libat_compare_exchange_16 (U_16 *, U_16 *, U_16, int, int)
2226
+ __attribute__((__noinline__));
2228
+/* PR 57744: lqarx/stqcx needs even/odd register pairs. The assembler will
2229
+ complain if the compiler gets an odd/even register pair. Create a function
2230
+ which has the 16 byte compare and exchange instructions, but don't actually
2231
+ execute it, so that we can detect these failures on older machines. */
2234
+libat_compare_exchange_16 (U_16 *mptr, U_16 *eptr, U_16 newval,
2235
+ int smodel, int fmodel __attribute__((unused)))
2237
+ if (((smodel) == 0))
2238
+ return __atomic_compare_exchange_n (mptr, eptr, newval, 0, 0, 0);
2239
+ else if (((smodel) != 5))
2240
+ return __atomic_compare_exchange_n (mptr, eptr, newval, 0, 4, 0);
2242
+ return __atomic_compare_exchange_n (mptr, eptr, newval, 0, 5, 0);
2245
+U_16 a = 1, b = 1, c = -2;
2246
+volatile int do_test = 0;
2250
+ if (do_test && !libat_compare_exchange_16 (&a, &b, c, 0, 0))
2255
--- a/src/gcc/testsuite/gcc.target/powerpc/recip-1.c
2256
+++ b/src/gcc/testsuite/gcc.target/powerpc/recip-1.c
2258
/* { dg-options "-O2 -mrecip -ffast-math -mcpu=power6" } */
2259
/* { dg-final { scan-assembler-times "frsqrte" 2 } } */
2260
/* { dg-final { scan-assembler-times "fmsub" 2 } } */
2261
-/* { dg-final { scan-assembler-times "fmul" 8 } } */
2262
-/* { dg-final { scan-assembler-times "fnmsub" 4 } } */
2263
+/* { dg-final { scan-assembler-times "fmul" 6 } } */
2264
+/* { dg-final { scan-assembler-times "fnmsub" 3 } } */
2268
--- a/src/gcc/testsuite/gcc.target/powerpc/darwin-longlong.c
2269
+++ b/src/gcc/testsuite/gcc.target/powerpc/darwin-longlong.c
2274
+#ifdef __LITTLE_ENDIAN__
2282
--- a/src/gcc/testsuite/gcc.target/powerpc/bool2-p8.c
2283
+++ b/src/gcc/testsuite/gcc.target/powerpc/bool2-p8.c
2285
+/* { dg-do compile { target { powerpc*-*-* } } } */
2286
+/* { dg-skip-if "" { powerpc*-*-darwin* } { "*" } { "" } } */
2287
+/* { dg-require-effective-target powerpc_p8vector_ok } */
2288
+/* { dg-options "-O2 -mcpu=power8" } */
2289
+/* { dg-final { scan-assembler-not "\[ \t\]and " } } */
2290
+/* { dg-final { scan-assembler-not "\[ \t\]or " } } */
2291
+/* { dg-final { scan-assembler-not "\[ \t\]xor " } } */
2292
+/* { dg-final { scan-assembler-not "\[ \t\]nor " } } */
2293
+/* { dg-final { scan-assembler-not "\[ \t\]eqv " } } */
2294
+/* { dg-final { scan-assembler-not "\[ \t\]andc " } } */
2295
+/* { dg-final { scan-assembler-not "\[ \t\]orc " } } */
2296
+/* { dg-final { scan-assembler-not "\[ \t\]nand " } } */
2297
+/* { dg-final { scan-assembler-not "\[ \t\]vand " } } */
2298
+/* { dg-final { scan-assembler-not "\[ \t\]vandc " } } */
2299
+/* { dg-final { scan-assembler-not "\[ \t\]vor " } } */
2300
+/* { dg-final { scan-assembler-not "\[ \t\]vxor " } } */
2301
+/* { dg-final { scan-assembler-not "\[ \t\]vnor " } } */
2302
+/* { dg-final { scan-assembler "\[ \t\]xxland " } } */
2303
+/* { dg-final { scan-assembler "\[ \t\]xxlor " } } */
2304
+/* { dg-final { scan-assembler "\[ \t\]xxlxor " } } */
2305
+/* { dg-final { scan-assembler "\[ \t\]xxlnor " } } */
2306
+/* { dg-final { scan-assembler "\[ \t\]xxlandc " } } */
2307
+/* { dg-final { scan-assembler "\[ \t\]xxleqv " } } */
2308
+/* { dg-final { scan-assembler "\[ \t\]xxlorc " } } */
2309
+/* { dg-final { scan-assembler "\[ \t\]xxlnand " } } */
2312
+typedef int v4si __attribute__ ((vector_size (16)));
2317
--- a/src/gcc/testsuite/gcc.target/powerpc/mmfpgpr.c
2318
+++ b/src/gcc/testsuite/gcc.target/powerpc/mmfpgpr.c
2320
+/* { dg-do compile { target { powerpc*-*-* && lp64 } } } */
2321
+/* { dg-skip-if "" { powerpc*-*-darwin* } { "*" } { "" } } */
2322
+/* { dg-require-effective-target powerpc_vsx_ok } */
2323
+/* { dg-options "-O2 -mcpu=power6x -mmfpgpr" } */
2324
+/* { dg-final { scan-assembler "mffgpr" } } */
2325
+/* { dg-final { scan-assembler "mftgpr" } } */
2327
+/* Test that we generate the instructions to move between the GPR and FPR
2328
+ registers under power6x. */
2330
+extern long return_long (void);
2331
+extern double return_double (void);
2333
+double return_double2 (void)
2335
+ return (double) return_long ();
2338
+long return_long2 (void)
2340
+ return (long) return_double ();
2342
--- a/src/gcc/testsuite/gcc.target/powerpc/direct-move-vint1.c
2343
+++ b/src/gcc/testsuite/gcc.target/powerpc/direct-move-vint1.c
2345
+/* { dg-do compile { target { powerpc*-*-linux* && lp64 } } } */
2346
+/* { dg-skip-if "" { powerpc*-*-darwin* } { "*" } { "" } } */
2347
+/* { dg-skip-if "" { powerpc*-*-*spe* } { "*" } { "" } } */
2348
+/* { dg-require-effective-target powerpc_p8vector_ok } */
2349
+/* { dg-options "-mcpu=power8 -O2" } */
2350
+/* { dg-final { scan-assembler "mtvsrd" } } */
2351
+/* { dg-final { scan-assembler "mfvsrd" } } */
2353
+/* Check code generation for direct move for vector types. */
2355
+#define TYPE vector int
2356
+#define VSX_REG_ATTR "wa"
2358
+#include "direct-move.h"
2359
--- a/src/gcc/testsuite/gcc.target/powerpc/bool2-av.c
2360
+++ b/src/gcc/testsuite/gcc.target/powerpc/bool2-av.c
2362
+/* { dg-do compile { target { powerpc*-*-* } } } */
2363
+/* { dg-skip-if "" { powerpc*-*-darwin* } { "*" } { "" } } */
2364
+/* { dg-require-effective-target powerpc_altivec_ok } */
2365
+/* { dg-options "-O2 -mcpu=power6 -maltivec" } */
2366
+/* { dg-final { scan-assembler-not "\[ \t\]and " } } */
2367
+/* { dg-final { scan-assembler-not "\[ \t\]or " } } */
2368
+/* { dg-final { scan-assembler-not "\[ \t\]xor " } } */
2369
+/* { dg-final { scan-assembler-not "\[ \t\]nor " } } */
2370
+/* { dg-final { scan-assembler-not "\[ \t\]andc " } } */
2371
+/* { dg-final { scan-assembler-not "\[ \t\]eqv " } } */
2372
+/* { dg-final { scan-assembler-not "\[ \t\]orc " } } */
2373
+/* { dg-final { scan-assembler-not "\[ \t\]nand " } } */
2374
+/* { dg-final { scan-assembler "\[ \t\]vand " } } */
2375
+/* { dg-final { scan-assembler "\[ \t\]vandc " } } */
2376
+/* { dg-final { scan-assembler "\[ \t\]vor " } } */
2377
+/* { dg-final { scan-assembler "\[ \t\]vxor " } } */
2378
+/* { dg-final { scan-assembler "\[ \t\]vnor " } } */
2379
+/* { dg-final { scan-assembler-not "\[ \t\]xxland " } } */
2380
+/* { dg-final { scan-assembler-not "\[ \t\]xxlor " } } */
2381
+/* { dg-final { scan-assembler-not "\[ \t\]xxlxor " } } */
2382
+/* { dg-final { scan-assembler-not "\[ \t\]xxlnor " } } */
2383
+/* { dg-final { scan-assembler-not "\[ \t\]xxlandc " } } */
2384
+/* { dg-final { scan-assembler-not "\[ \t\]xxleqv " } } */
2385
+/* { dg-final { scan-assembler-not "\[ \t\]xxlorc " } } */
2386
+/* { dg-final { scan-assembler-not "\[ \t\]xxlnand " } } */
2389
+typedef int v4si __attribute__ ((vector_size (16)));
2394
--- a/src/gcc/testsuite/gcc.target/powerpc/pr43154.c
2395
+++ b/src/gcc/testsuite/gcc.target/powerpc/pr43154.c
2397
/* { dg-do compile { target { powerpc*-*-* } } } */
2398
/* { dg-skip-if "" { powerpc*-*-darwin* } { "*" } { "" } } */
2399
+/* { dg-skip-if "" { powerpc*le-*-* } { "*" } { "" } } */
2400
/* { dg-require-effective-target powerpc_vsx_ok } */
2401
/* { dg-options "-O2 -mcpu=power7" } */
2403
--- a/src/gcc/testsuite/gcc.target/powerpc/pr59054.c
2404
+++ b/src/gcc/testsuite/gcc.target/powerpc/pr59054.c
2406
+/* { dg-do compile { target { powerpc*-*-* && lp64 } } } */
2407
+/* { dg-skip-if "" { powerpc*-*-darwin* } { "*" } { "" } } */
2408
+/* { dg-require-effective-target powerpc_vsx_ok } */
2409
+/* { dg-options "-mcpu=power7 -O0 -m64" } */
2411
+long foo (void) { return 0; }
2413
+/* { dg-final { scan-assembler-not "xxlor" } } */
2414
+/* { dg-final { scan-assembler-not "stfd" } } */
2415
--- a/src/gcc/testsuite/gcc.target/powerpc/p8vector-builtin-2.c
2416
+++ b/src/gcc/testsuite/gcc.target/powerpc/p8vector-builtin-2.c
2418
+/* { dg-do compile { target { powerpc*-*-* } } } */
2419
+/* { dg-skip-if "" { powerpc*-*-darwin* } { "*" } { "" } } */
2420
+/* { dg-require-effective-target powerpc_p8vector_ok } */
2421
+/* { dg-options "-mcpu=power8 -O2 -ftree-vectorize -fvect-cost-model -fno-unroll-loops -fno-unroll-all-loops" } */
2423
+#include <altivec.h>
2425
+typedef vector long long v_sign;
2426
+typedef vector unsigned long long v_uns;
2427
+typedef vector bool long long v_bool;
2429
+v_sign sign_add_1 (v_sign a, v_sign b)
2431
+ return __builtin_altivec_vaddudm (a, b);
2434
+v_sign sign_add_2 (v_sign a, v_sign b)
2436
+ return vec_add (a, b);
2439
+v_sign sign_add_3 (v_sign a, v_sign b)
2441
+ return vec_vaddudm (a, b);
2444
+v_sign sign_sub_1 (v_sign a, v_sign b)
2446
+ return __builtin_altivec_vsubudm (a, b);
2449
+v_sign sign_sub_2 (v_sign a, v_sign b)
2451
+ return vec_sub (a, b);
2455
+v_sign sign_sub_3 (v_sign a, v_sign b)
2457
+ return vec_vsubudm (a, b);
2460
+v_sign sign_min_1 (v_sign a, v_sign b)
2462
+ return __builtin_altivec_vminsd (a, b);
2465
+v_sign sign_min_2 (v_sign a, v_sign b)
2467
+ return vec_min (a, b);
2470
+v_sign sign_min_3 (v_sign a, v_sign b)
2472
+ return vec_vminsd (a, b);
2475
+v_sign sign_max_1 (v_sign a, v_sign b)
2477
+ return __builtin_altivec_vmaxsd (a, b);
2480
+v_sign sign_max_2 (v_sign a, v_sign b)
2482
+ return vec_max (a, b);
2485
+v_sign sign_max_3 (v_sign a, v_sign b)
2487
+ return vec_vmaxsd (a, b);
2490
+v_sign sign_abs (v_sign a)
2492
+ return vec_abs (a); /* xor, vsubudm, vmaxsd. */
2495
+v_bool sign_eq (v_sign a, v_sign b)
2497
+ return vec_cmpeq (a, b);
2500
+v_bool sign_lt (v_sign a, v_sign b)
2502
+ return vec_cmplt (a, b);
2505
+v_uns uns_add_2 (v_uns a, v_uns b)
2507
+ return vec_add (a, b);
2510
+v_uns uns_add_3 (v_uns a, v_uns b)
2512
+ return vec_vaddudm (a, b);
2515
+v_uns uns_sub_2 (v_uns a, v_uns b)
2517
+ return vec_sub (a, b);
2520
+v_uns uns_sub_3 (v_uns a, v_uns b)
2522
+ return vec_vsubudm (a, b);
2525
+v_uns uns_min_2 (v_uns a, v_uns b)
2527
+ return vec_min (a, b);
2530
+v_uns uns_min_3 (v_uns a, v_uns b)
2532
+ return vec_vminud (a, b);
2535
+v_uns uns_max_2 (v_uns a, v_uns b)
2537
+ return vec_max (a, b);
2540
+v_uns uns_max_3 (v_uns a, v_uns b)
2542
+ return vec_vmaxud (a, b);
2545
+v_bool uns_eq (v_uns a, v_uns b)
2547
+ return vec_cmpeq (a, b);
2550
+v_bool uns_lt (v_uns a, v_uns b)
2552
+ return vec_cmplt (a, b);
2555
+v_sign sign_rl_1 (v_sign a, v_sign b)
2557
+ return __builtin_altivec_vrld (a, b);
2560
+v_sign sign_rl_2 (v_sign a, v_uns b)
2562
+ return vec_rl (a, b);
2565
+v_uns uns_rl_2 (v_uns a, v_uns b)
2567
+ return vec_rl (a, b);
2570
+v_sign sign_sl_1 (v_sign a, v_sign b)
2572
+ return __builtin_altivec_vsld (a, b);
2575
+v_sign sign_sl_2 (v_sign a, v_uns b)
2577
+ return vec_sl (a, b);
2580
+v_sign sign_sl_3 (v_sign a, v_uns b)
2582
+ return vec_vsld (a, b);
2585
+v_uns uns_sl_2 (v_uns a, v_uns b)
2587
+ return vec_sl (a, b);
2590
+v_uns uns_sl_3 (v_uns a, v_uns b)
2592
+ return vec_vsld (a, b);
2595
+v_sign sign_sra_1 (v_sign a, v_sign b)
2597
+ return __builtin_altivec_vsrad (a, b);
2600
+v_sign sign_sra_2 (v_sign a, v_uns b)
2602
+ return vec_sra (a, b);
2605
+v_sign sign_sra_3 (v_sign a, v_uns b)
2607
+ return vec_vsrad (a, b);
2610
+/* { dg-final { scan-assembler-times "vaddudm" 5 } } */
2611
+/* { dg-final { scan-assembler-times "vsubudm" 6 } } */
2612
+/* { dg-final { scan-assembler-times "vmaxsd" 4 } } */
2613
+/* { dg-final { scan-assembler-times "vminsd" 3 } } */
2614
+/* { dg-final { scan-assembler-times "vmaxud" 2 } } */
2615
+/* { dg-final { scan-assembler-times "vminud" 2 } } */
2616
+/* { dg-final { scan-assembler-times "vcmpequd" 2 } } */
2617
+/* { dg-final { scan-assembler-times "vcmpgtsd" 1 } } */
2618
+/* { dg-final { scan-assembler-times "vcmpgtud" 1 } } */
2619
+/* { dg-final { scan-assembler-times "vrld" 3 } } */
2620
+/* { dg-final { scan-assembler-times "vsld" 5 } } */
2621
+/* { dg-final { scan-assembler-times "vsrad" 3 } } */
2622
--- a/src/gcc/testsuite/gcc.target/powerpc/p8vector-vectorize-2.c
2623
+++ b/src/gcc/testsuite/gcc.target/powerpc/p8vector-vectorize-2.c
2625
+/* { dg-do compile { target { powerpc*-*-* } } } */
2626
+/* { dg-skip-if "" { powerpc*-*-darwin* } { "*" } { "" } } */
2627
+/* { dg-require-effective-target powerpc_p8vector_ok } */
2628
+/* { dg-options "-mcpu=power8 -O2 -ftree-vectorize -fvect-cost-model" } */
2630
+#include <stddef.h>
2640
+#define ALIGN_ATTR __attribute__((__aligned__(ALIGN)))
2642
+long long sign_ll[SIZE] ALIGN_ATTR;
2643
+int sign_i [SIZE] ALIGN_ATTR;
2645
+void copy_int_to_long_long (void)
2649
+ for (i = 0; i < SIZE; i++)
2650
+ sign_ll[i] = sign_i[i];
2653
+/* { dg-final { scan-assembler "vupkhsw" } } */
2654
+/* { dg-final { scan-assembler "vupklsw" } } */
2655
--- a/src/gcc/testsuite/gcc.target/powerpc/altivec-perm-3.c
2656
+++ b/src/gcc/testsuite/gcc.target/powerpc/altivec-perm-3.c
2658
+/* { dg-do compile } */
2659
+/* { dg-require-effective-target powerpc_altivec_ok } */
2660
+/* { dg-skip-if "" { powerpc*le-*-* } { "*" } { "" } } */
2661
+/* { dg-options "-O -maltivec -mno-vsx" } */
2663
+typedef unsigned char V __attribute__((vector_size(16)));
2667
+ return __builtin_shuffle(x, y,
2668
+ (V){ 1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29, 31 });
2674
+ return __builtin_shuffle(x, y,
2675
+ (V){ 2, 3, 6, 7, 10, 11, 14, 15, 18, 19, 22, 23, 26, 27, 30, 31 });
2678
+/* { dg-final { scan-assembler-not "vperm" } } */
2679
+/* { dg-final { scan-assembler "vpkuhum" } } */
2680
+/* { dg-final { scan-assembler "vpkuwum" } } */
2681
--- a/src/gcc/testsuite/gcc.target/powerpc/pr58673-1.c
2682
+++ b/src/gcc/testsuite/gcc.target/powerpc/pr58673-1.c
2684
+/* { dg-do compile { target { powerpc*-*-* && lp64 } } } */
2685
+/* { dg-skip-if "" { powerpc*-*-darwin* } { "*" } { "" } } */
2686
+/* { dg-require-effective-target powerpc_p8vector_ok } */
2687
+/* { dg-options "-mcpu=power8 -m64 -O1" } */
2691
+ QIcode, QUcode, HIcode, HUcode, SIcode, SUcode, DIcode, DUcode, SFcode,
2692
+ DFcode, XFcode, Pcode, Tcode, LAST_AND_UNUSED_TYPECODE
2694
+enum bytecode_opcode
2696
+ neverneverland, drop, duplicate, over, setstackSI, adjstackSI, constQI,
2697
+ constHI, constSI, constDI, constSF, constDF, constXF, constP, loadQI,
2698
+ loadHI, loadSI, loadDI, loadSF, loadDF, loadXF, loadP, storeQI, storeHI,
2699
+ storeSI, storeDI, storeSF, storeDF, storeXF, storeP, storeBLK, clearBLK,
2700
+ addconstPSI, newlocalSI, localP, argP, convertQIHI, convertHISI,
2701
+ convertSIDI, convertQISI, convertQUHU, convertHUSU, convertSUDU,
2702
+ convertQUSU, convertSFDF, convertDFXF, convertHIQI, convertSIHI,
2703
+ convertDISI, convertSIQI, convertSUQU, convertDFSF, convertXFDF,
2704
+ convertSISF, convertSIDF, convertSIXF, convertSUSF, convertSUDF,
2705
+ convertSUXF, convertDISF, convertDIDF, convertDIXF, convertDUSF,
2706
+ convertDUDF, convertDUXF, convertSFSI, convertDFSI, convertXFSI,
2707
+ convertSFSU, convertDFSU, convertXFSU, convertSFDI, convertDFDI,
2708
+ convertXFDI, convertSFDU, convertDFDU, convertXFDU, convertPSI,
2709
+ convertSIP, convertSIT, convertDIT, convertSFT, convertDFT, convertXFT,
2710
+ convertPT, zxloadBI, sxloadBI, sstoreBI, addSI, addDI, addSF, addDF,
2711
+ addXF, addPSI, subSI, subDI, subSF, subDF, subXF, subPP, mulSI, mulDI,
2712
+ mulSU, mulDU, mulSF, mulDF, mulXF, divSI, divDI, divSU, divDU, divSF,
2713
+ divDF, divXF, modSI, modDI, modSU, modDU, andSI, andDI, iorSI, iorDI,
2714
+ xorSI, xorDI, lshiftSI, lshiftSU, lshiftDI, lshiftDU, rshiftSI, rshiftSU,
2715
+ rshiftDI, rshiftDU, ltSI, ltSU, ltDI, ltDU, ltSF, ltDF, ltXF, ltP, leSI,
2716
+ leSU, leDI, leDU, leSF, leDF, leXF, leP, geSI, geSU, geDI, geDU, geSF,
2717
+ geDF, geXF, geP, gtSI, gtSU, gtDI, gtDU, gtSF, gtDF, gtXF, gtP, eqSI,
2718
+ eqDI, eqSF, eqDF, eqXF, eqP, neSI, neDI, neSF, neDF, neXF, neP, negSI,
2719
+ negDI, negSF, negDF, negXF, notSI, notDI, notT, predecQI, predecHI,
2720
+ predecSI, predecDI, predecP, predecSF, predecDF, predecXF, predecBI,
2721
+ preincQI, preincHI, preincSI, preincDI, preincP, preincSF, preincDF,
2722
+ preincXF, preincBI, postdecQI, postdecHI, postdecSI, postdecDI, postdecP,
2723
+ postdecSF, postdecDF, postdecXF, postdecBI, postincQI, postincHI,
2724
+ postincSI, postincDI, postincP, postincSF, postincDF, postincXF,
2725
+ postincBI, xjumpif, xjumpifnot, jump, jumpP, caseSI, caseSU, caseDI,
2726
+ caseDU, call, returnP, ret, linenote, LAST_AND_UNUSED_OPCODE
2728
+struct binary_operator
2730
+ enum bytecode_opcode opcode;
2731
+ enum typecode arg0;
2733
+static struct conversion_recipe
2735
+ unsigned char *opcodes;
2738
+conversion_recipe[((int) LAST_AND_UNUSED_TYPECODE)][((int)
2739
+ LAST_AND_UNUSED_TYPECODE)];
2740
+static struct conversion_recipe
2741
+deduce_conversion (from, to)
2742
+ enum typecode from, to;
2744
+ (conversion_recipe[(int) from][(int) to].
2745
+ opcodes ? 0 : (conversion_recipe[(int) from][(int) to] =
2746
+ deduce_conversion (from, to), 0));
2750
+bc_expand_binary_operation (optab, resulttype, arg0, arg1)
2751
+ struct binary_operator optab[];
2753
+ int i, besti, cost, bestcost;
2754
+ enum typecode resultcode, arg0code;
2755
+ for (i = 0; optab[i].opcode != -1; ++i)
2757
+ (conversion_recipe[(int) arg0code][(int) optab[i].arg0].
2758
+ opcodes ? 0 : (conversion_recipe[(int) arg0code][(int) optab[i].arg0] =
2759
+ deduce_conversion (arg0code, optab[i].arg0), 0));
2762
--- a/src/gcc/testsuite/gcc.target/powerpc/no-r11-1.c
2763
+++ b/src/gcc/testsuite/gcc.target/powerpc/no-r11-1.c
2765
/* { dg-do compile { target { powerpc*-*-* && lp64 } } } */
2766
/* { dg-skip-if "" { *-*-darwin* } { "*" } { "" } } */
2767
+/* { dg-skip-if "" { powerpc_elfv2 } { "*" } { "" } } */
2768
/* { dg-options "-O2 -mno-pointers-to-nested-functions" } */
2771
--- a/src/gcc/testsuite/gcc.target/powerpc/p8vector-fp.c
2772
+++ b/src/gcc/testsuite/gcc.target/powerpc/p8vector-fp.c
2774
+/* { dg-do compile { target { powerpc*-*-* } } } */
2775
+/* { dg-skip-if "" { powerpc*-*-darwin* } { "*" } { "" } } */
2776
+/* { dg-require-effective-target powerpc_p8vector_ok } */
2777
+/* { dg-options "-mcpu=power8 -O2 -mupper-regs-df -mupper-regs-sf -fno-math-errno" } */
2779
+float abs_sf (float *p)
2782
+ __asm__ ("# reg %x0" : "+v" (f));
2783
+ return __builtin_fabsf (f);
2786
+float nabs_sf (float *p)
2789
+ __asm__ ("# reg %x0" : "+v" (f));
2790
+ return - __builtin_fabsf (f);
2793
+float neg_sf (float *p)
2796
+ __asm__ ("# reg %x0" : "+v" (f));
2800
+float add_sf (float *p, float *q)
2804
+ __asm__ ("# reg %x0, %x1" : "+v" (f1), "+v" (f2));
2808
+float sub_sf (float *p, float *q)
2812
+ __asm__ ("# reg %x0, %x1" : "+v" (f1), "+v" (f2));
2816
+float mul_sf (float *p, float *q)
2820
+ __asm__ ("# reg %x0, %x1" : "+v" (f1), "+v" (f2));
2824
+float div_sf (float *p, float *q)
2828
+ __asm__ ("# reg %x0, %x1" : "+v" (f1), "+v" (f2));
2832
+float sqrt_sf (float *p)
2835
+ __asm__ ("# reg %x0" : "+v" (f));
2836
+ return __builtin_sqrtf (f);
2840
+double abs_df (double *p)
2843
+ __asm__ ("# reg %x0" : "+v" (d));
2844
+ return __builtin_fabs (d);
2847
+double nabs_df (double *p)
2850
+ __asm__ ("# reg %x0" : "+v" (d));
2851
+ return - __builtin_fabs (d);
2854
+double neg_df (double *p)
2857
+ __asm__ ("# reg %x0" : "+v" (d));
2861
+double add_df (double *p, double *q)
2865
+ __asm__ ("# reg %x0, %x1" : "+v" (d1), "+v" (d2));
2869
+double sub_df (double *p, double *q)
2873
+ __asm__ ("# reg %x0, %x1" : "+v" (d1), "+v" (d2));
2877
+double mul_df (double *p, double *q)
2881
+ __asm__ ("# reg %x0, %x1" : "+v" (d1), "+v" (d2));
2885
+double div_df (double *p, double *q)
2889
+ __asm__ ("# reg %x0, %x1" : "+v" (d1), "+v" (d2));
2893
+double sqrt_df (float *p)
2896
+ __asm__ ("# reg %x0" : "+v" (d));
2897
+ return __builtin_sqrt (d);
2900
+/* { dg-final { scan-assembler "xsabsdp" } } */
2901
+/* { dg-final { scan-assembler "xsadddp" } } */
2902
+/* { dg-final { scan-assembler "xsaddsp" } } */
2903
+/* { dg-final { scan-assembler "xsdivdp" } } */
2904
+/* { dg-final { scan-assembler "xsdivsp" } } */
2905
+/* { dg-final { scan-assembler "xsmuldp" } } */
2906
+/* { dg-final { scan-assembler "xsmulsp" } } */
2907
+/* { dg-final { scan-assembler "xsnabsdp" } } */
2908
+/* { dg-final { scan-assembler "xsnegdp" } } */
2909
+/* { dg-final { scan-assembler "xssqrtdp" } } */
2910
+/* { dg-final { scan-assembler "xssqrtsp" } } */
2911
+/* { dg-final { scan-assembler "xssubdp" } } */
2912
+/* { dg-final { scan-assembler "xssubsp" } } */
2913
--- a/src/gcc/testsuite/gcc.target/powerpc/direct-move-vint2.c
2914
+++ b/src/gcc/testsuite/gcc.target/powerpc/direct-move-vint2.c
2916
+/* { dg-do run { target { powerpc*-*-linux* && lp64 } } } */
2917
+/* { dg-skip-if "" { powerpc*-*-darwin* } { "*" } { "" } } */
2918
+/* { dg-skip-if "" { powerpc*-*-*spe* } { "*" } { "" } } */
2919
+/* { dg-require-effective-target p8vector_hw } */
2920
+/* { dg-options "-mcpu=power8 -O2" } */
2922
+/* Check whether we get the right bits for direct move at runtime. */
2924
+#define TYPE vector int
2926
+#define VSX_REG_ATTR "wa"
2928
+#include "direct-move.h"
2929
--- a/src/gcc/testsuite/gcc.target/powerpc/bool3-p7.c
2930
+++ b/src/gcc/testsuite/gcc.target/powerpc/bool3-p7.c
2932
+/* { dg-do compile { target { powerpc*-*-* && lp64 } } } */
2933
+/* { dg-skip-if "" { powerpc*-*-darwin* } { "*" } { "" } } */
2934
+/* { dg-require-effective-target powerpc_vsx_ok } */
2935
+/* { dg-options "-O2 -mcpu=power7" } */
2936
+/* { dg-final { scan-assembler "\[ \t\]and " } } */
2937
+/* { dg-final { scan-assembler "\[ \t\]or " } } */
2938
+/* { dg-final { scan-assembler "\[ \t\]xor " } } */
2939
+/* { dg-final { scan-assembler "\[ \t\]nor " } } */
2940
+/* { dg-final { scan-assembler "\[ \t\]andc " } } */
2941
+/* { dg-final { scan-assembler-not "\[ \t\]vand " } } */
2942
+/* { dg-final { scan-assembler-not "\[ \t\]vandc " } } */
2943
+/* { dg-final { scan-assembler-not "\[ \t\]vor " } } */
2944
+/* { dg-final { scan-assembler-not "\[ \t\]vxor " } } */
2945
+/* { dg-final { scan-assembler-not "\[ \t\]vnor " } } */
2946
+/* { dg-final { scan-assembler-not "\[ \t\]xxland " } } */
2947
+/* { dg-final { scan-assembler-not "\[ \t\]xxlor " } } */
2948
+/* { dg-final { scan-assembler-not "\[ \t\]xxlxor " } } */
2949
+/* { dg-final { scan-assembler-not "\[ \t\]xxlnor " } } */
2950
+/* { dg-final { scan-assembler-not "\[ \t\]xxlandc " } } */
2951
+/* { dg-final { scan-assembler-not "\[ \t\]xxleqv " } } */
2952
+/* { dg-final { scan-assembler-not "\[ \t\]xxlorc " } } */
2953
+/* { dg-final { scan-assembler-not "\[ \t\]xxlnand " } } */
2955
+/* On power7, for 128-bit types, ORC/ANDC/EQV might not show up, since the
2956
+ vector unit doesn't support these, so the appropriate combine patterns may
2957
+ not be generated. */
2961
+#define TYPE __int128_t
2963
+typedef int v4si __attribute__ ((vector_size (16)));
2969
--- a/src/gcc/testsuite/gcc.target/powerpc/p8vector-builtin-3.c
2970
+++ b/src/gcc/testsuite/gcc.target/powerpc/p8vector-builtin-3.c
2972
+/* { dg-do compile { target { powerpc*-*-* } } } */
2973
+/* { dg-skip-if "" { powerpc*-*-darwin* } { "*" } { "" } } */
2974
+/* { dg-require-effective-target powerpc_p8vector_ok } */
2975
+/* { dg-options "-mcpu=power8 -O3 -ftree-vectorize -fvect-cost-model" } */
2977
+#include <altivec.h>
2979
+typedef vector long long vll_sign;
2980
+typedef vector unsigned long long vll_uns;
2981
+typedef vector bool long long vll_bool;
2983
+typedef vector int vi_sign;
2984
+typedef vector unsigned int vi_uns;
2985
+typedef vector bool int vi_bool;
2987
+typedef vector short vs_sign;
2988
+typedef vector unsigned short vs_uns;
2989
+typedef vector bool short vs_bool;
2991
+typedef vector signed char vc_sign;
2992
+typedef vector unsigned char vc_uns;
2993
+typedef vector bool char vc_bool;
2996
+vi_sign vi_pack_1 (vll_sign a, vll_sign b)
2998
+ return __builtin_altivec_vpkudum (a, b);
3001
+vi_sign vi_pack_2 (vll_sign a, vll_sign b)
3003
+ return vec_pack (a, b);
3006
+vi_sign vi_pack_3 (vll_sign a, vll_sign b)
3008
+ return vec_vpkudum (a, b);
3011
+vs_sign vs_pack_1 (vi_sign a, vi_sign b)
3013
+ return __builtin_altivec_vpkuwum (a, b);
3016
+vs_sign vs_pack_2 (vi_sign a, vi_sign b)
3018
+ return vec_pack (a, b);
3021
+vs_sign vs_pack_3 (vi_sign a, vi_sign b)
3023
+ return vec_vpkuwum (a, b);
3026
+vc_sign vc_pack_1 (vs_sign a, vs_sign b)
3028
+ return __builtin_altivec_vpkuhum (a, b);
3031
+vc_sign vc_pack_2 (vs_sign a, vs_sign b)
3033
+ return vec_pack (a, b);
3036
+vc_sign vc_pack_3 (vs_sign a, vs_sign b)
3038
+ return vec_vpkuhum (a, b);
3041
+vll_sign vll_unpack_hi_1 (vi_sign a)
3043
+ return __builtin_altivec_vupkhsw (a);
3046
+vll_sign vll_unpack_hi_2 (vi_sign a)
3048
+ return vec_unpackh (a);
3051
+vll_sign vll_unpack_hi_3 (vi_sign a)
3053
+ return __builtin_vec_vupkhsw (a);
3056
+vll_sign vll_unpack_lo_1 (vi_sign a)
3058
+ return vec_vupklsw (a);
3061
+vll_sign vll_unpack_lo_2 (vi_sign a)
3063
+ return vec_unpackl (a);
3066
+vll_sign vll_unpack_lo_3 (vi_sign a)
3068
+ return vec_vupklsw (a);
3071
+/* { dg-final { scan-assembler-times "vpkudum" 3 } } */
3072
+/* { dg-final { scan-assembler-times "vpkuwum" 3 } } */
3073
+/* { dg-final { scan-assembler-times "vpkuhum" 3 } } */
3074
+/* { dg-final { scan-assembler-times "vupklsw" 3 } } */
3075
+/* { dg-final { scan-assembler-times "vupkhsw" 3 } } */
3076
--- a/src/gcc/testsuite/gcc.target/powerpc/p8vector-vectorize-3.c
3077
+++ b/src/gcc/testsuite/gcc.target/powerpc/p8vector-vectorize-3.c
3079
+/* { dg-do compile { target { powerpc*-*-* } } } */
3080
+/* { dg-skip-if "" { powerpc*-*-darwin* } { "*" } { "" } } */
3081
+/* { dg-require-effective-target powerpc_p8vector_ok } */
3082
+/* { dg-options "-mcpu=power8 -O2 -ftree-vectorize -fvect-cost-model" } */
3084
+#include <stddef.h>
3094
+#define ALIGN_ATTR __attribute__((__aligned__(ALIGN)))
3096
+long long sign_ll[SIZE] ALIGN_ATTR;
3097
+int sign_i [SIZE] ALIGN_ATTR;
3099
+void copy_long_long_to_int (void)
3103
+ for (i = 0; i < SIZE; i++)
3104
+ sign_i[i] = sign_ll[i];
3107
+/* { dg-final { scan-assembler "vpkudum" } } */
3108
--- a/src/gcc/testsuite/gcc.target/powerpc/direct-move.h
3109
+++ b/src/gcc/testsuite/gcc.target/powerpc/direct-move.h
3111
+/* Test functions for direct move support. */
3114
+#ifndef VSX_REG_ATTR
3115
+#define VSX_REG_ATTR "wa"
3118
+void __attribute__((__noinline__))
3119
+copy (TYPE *a, TYPE *b)
3125
+void __attribute__((__noinline__))
3126
+load_gpr (TYPE *a, TYPE *b)
3129
+ __asm__ ("# gpr, reg = %0" : "+b" (c));
3135
+void __attribute__((__noinline__))
3136
+load_fpr (TYPE *a, TYPE *b)
3139
+ __asm__ ("# fpr, reg = %0" : "+d" (c));
3145
+void __attribute__((__noinline__))
3146
+load_altivec (TYPE *a, TYPE *b)
3149
+ __asm__ ("# altivec, reg = %0" : "+v" (c));
3155
+void __attribute__((__noinline__))
3156
+load_vsx (TYPE *a, TYPE *b)
3159
+ __asm__ ("# vsx, reg = %x0" : "+" VSX_REG_ATTR (c));
3164
+#ifndef NO_GPR_TO_VSX
3165
+void __attribute__((__noinline__))
3166
+load_gpr_to_vsx (TYPE *a, TYPE *b)
3170
+ __asm__ ("# gpr, reg = %0" : "+b" (c));
3172
+ __asm__ ("# vsx, reg = %x0" : "+" VSX_REG_ATTR (d));
3177
+#ifndef NO_VSX_TO_GPR
3178
+void __attribute__((__noinline__))
3179
+load_vsx_to_gpr (TYPE *a, TYPE *b)
3183
+ __asm__ ("# vsx, reg = %x0" : "+" VSX_REG_ATTR (c));
3185
+ __asm__ ("# gpr, reg = %0" : "+b" (d));
3191
+typedef void (fn_type (TYPE *, TYPE *));
3193
+struct test_struct {
3198
+const struct test_struct test_functions[] = {
3201
+ { load_gpr, "load_gpr" },
3204
+ { load_fpr, "load_fpr" },
3207
+ { load_altivec, "load_altivec" },
3210
+ { load_vsx, "load_vsx" },
3212
+#ifndef NO_GPR_TO_VSX
3213
+ { load_gpr_to_vsx, "load_gpr_to_vsx" },
3215
+#ifndef NO_VSX_TO_GPR
3216
+ { load_vsx_to_gpr, "load_vsx_to_gpr" },
3220
+/* Test a given value for each of the functions. */
3221
+void __attribute__((__noinline__))
3222
+test_value (TYPE a)
3226
+ for (i = 0; i < sizeof (test_functions) / sizeof (test_functions[0]); i++)
3230
+ test_functions[i].func (&a, &b);
3231
+ if (memcmp ((void *)&a, (void *)&b, sizeof (TYPE)) != 0)
3236
+/* Main program. */
3244
+ unsigned char bytes[sizeof (TYPE)];
3248
+ TYPE value = (TYPE)-5;
3249
+ for (i = 0; i < 12; i++)
3251
+ test_value (value);
3255
+ for (i = 0; i < 8*sizeof (TYPE); i++)
3256
+ test_value (((TYPE)1) << i);
3259
+ TYPE value = (TYPE)0;
3260
+ for (i = 0; i < 10; i++)
3262
+ test_value (value);
3263
+ test_value (~ value);
3267
+ for (i = 0; i < 8*sizeof (TYPE); i++)
3268
+ test_value (((TYPE)1) << i);
3271
+ TYPE value = (TYPE)-5;
3272
+ for (i = 0; i < 12; i++)
3274
+ test_value (value);
3278
+ test_value ((TYPE)3.1415926535);
3279
+ test_value ((TYPE)1.23456);
3280
+ test_value ((TYPE)(-0.0));
3281
+ test_value ((TYPE)NAN);
3282
+ test_value ((TYPE)+INFINITY);
3283
+ test_value ((TYPE)-INFINITY);
3286
+ for (j = 0; j < 10; j++)
3288
+ for (i = 0; i < sizeof (TYPE); i++)
3289
+ u.bytes[i] = (unsigned char) (random () >> 4);
3291
+ test_value (u.value);
3298
--- a/src/gcc/testsuite/gcc.target/powerpc/sd-vsx.c
3299
+++ b/src/gcc/testsuite/gcc.target/powerpc/sd-vsx.c
3301
+/* { dg-do compile { target { powerpc*-*-* } } } */
3302
+/* { dg-skip-if "" { powerpc*-*-darwin* } { "*" } { "" } } */
3303
+/* { dg-require-effective-target powerpc_vsx_ok } */
3304
+/* { dg-options "-O2 -mcpu=power7 -mhard-dfp" } */
3305
+/* { dg-final { scan-assembler-times "lfiwzx" 2 } } */
3306
+/* { dg-final { scan-assembler-times "stfiwx" 1 } } */
3307
+/* { dg-final { scan-assembler-not "lfd" } } */
3308
+/* { dg-final { scan-assembler-not "stfd" } } */
3309
+/* { dg-final { scan-assembler-times "dctdp" 2 } } */
3310
+/* { dg-final { scan-assembler-times "dadd" 1 } } */
3311
+/* { dg-final { scan-assembler-times "drsp" 1 } } */
3313
+/* Test that power7 can directly load/store SDmode variables without using a
3317
+void inc_dec32 (void)
3319
+ a += (_Decimal32) 1.0;
3321
--- a/src/gcc/testsuite/gcc.target/powerpc/pr58673-2.c
3322
+++ b/src/gcc/testsuite/gcc.target/powerpc/pr58673-2.c
3324
+/* { dg-do compile { target { powerpc*-*-* && lp64 } } } */
3325
+/* { dg-skip-if "" { powerpc*-*-darwin* } { "*" } { "" } } */
3326
+/* { dg-require-effective-target powerpc_p8vector_ok } */
3327
+/* { dg-options "-mcpu=power8 -O3 -m64 -funroll-loops" } */
3329
+#include <stddef.h>
3330
+#include <stdlib.h>
3332
+#include <string.h>
3334
+typedef long unsigned int size_t;
3335
+typedef struct _IO_FILE FILE;
3336
+typedef float real;
3337
+typedef real rvec[3];
3338
+typedef real matrix[3][3];
3339
+typedef real tensor[3][3];
3342
+ F_BONDS, F_G96BONDS, F_MORSE, F_CUBICBONDS, F_CONNBONDS, F_HARMONIC,
3343
+ F_ANGLES, F_G96ANGLES, F_PDIHS, F_RBDIHS, F_IDIHS, F_LJ14, F_COUL14, F_LJ,
3344
+ F_BHAM, F_LJLR, F_DISPCORR, F_SR, F_LR, F_WPOL, F_POSRES, F_DISRES,
3345
+ F_DISRESVIOL, F_ORIRES, F_ORIRESDEV, F_ANGRES, F_ANGRESZ, F_SHAKE,
3346
+ F_SHAKENC, F_SETTLE, F_DUMMY2, F_DUMMY3, F_DUMMY3FD, F_DUMMY3FAD,
3347
+ F_DUMMY3OUT, F_DUMMY4FD, F_EQM, F_EPOT, F_EKIN, F_ETOT, F_TEMP, F_PRES,
3348
+ F_DVDL, F_DVDLKIN, F_NRE
3358
+ real rA, krA, rB, krB;
3365
+ t_iparams *iparams;
3390
+ eoPres, eoEpot, eoVir, eoDist, eoMu, eoForce, eoFx, eoFy, eoFz, eoPx, eoPy,
3391
+ eoPz, eoPolarizability, eoDipole, eoObsNR, eoMemory =
3392
+ eoObsNR, eoInter, eoUseVirial, eoNR
3394
+extern char *eoNames[eoNR];
3408
+ real act_value[eoObsNR];
3409
+ real av_value[eoObsNR];
3410
+ real ref_value[eoObsNR];
3411
+ int bObsUsed[eoObsNR];
3412
+ int nLJ, nBU, nQ, nIP;
3417
+pr_ff (t_coupl_rec * tcr, real time, t_idef * idef, t_commrec * cr, int nfile,
3420
+ static FILE *prop;
3421
+ static FILE **out = ((void *) 0);
3422
+ static FILE **qq = ((void *) 0);
3423
+ static FILE **ip = ((void *) 0);
3430
+ if ((prop == ((void *) 0)) && (out == ((void *) 0)) && (qq == ((void *) 0))
3431
+ && (ip == ((void *) 0)))
3433
+ for (i = j = 0; (i < eoObsNR); i++)
3435
+ if (tcr->bObsUsed[i])
3439
+ (__builtin_constant_p (eoNames[i])
3440
+ && ((size_t) (const void *) ((eoNames[i]) + 1) -
3441
+ (size_t) (const void *) (eoNames[i]) ==
3442
+ 1) ? (((const char *) (eoNames[i]))[0] ==
3443
+ '\0' ? (char *) calloc ((size_t) 1,
3462
+ )): __strdup (eoNames[i])));
3465
+ (__builtin_constant_p (buf)
3466
+ && ((size_t) (const void *) ((buf) + 1) -
3467
+ (size_t) (const void *) (buf) ==
3468
+ 1) ? (((const char *) (buf))[0] ==
3469
+ '\0' ? (char *) calloc ((size_t) 1,
3487
+ )): __strdup (buf)));
3492
+ for (i = 0; (i < tcr->nLJ); i++)
3494
+ if (tcr->tcLJ[i].bPrint)
3496
+ xvgr_legend (out[i], (sizeof (leg) / sizeof ((leg)[0])),
3505
+do_coupling (FILE * log, int nfile, t_filenm fnm[], t_coupl_rec * tcr, real t,
3506
+ int step, real ener[], t_forcerec * fr, t_inputrec * ir,
3507
+ int bMaster, t_mdatoms * md, t_idef * idef, real mu_aver,
3508
+ int nmols, t_commrec * cr, matrix box, tensor virial,
3509
+ tensor pres, rvec mu_tot, rvec x[], rvec f[], int bDoIt)
3511
+ int i, j, ati, atj, atnr2, type, ftype;
3512
+ real deviation[eoObsNR], prdev[eoObsNR], epot0, dist, rmsf;
3513
+ real ff6, ff12, ffa, ffb, ffc, ffq, factor, dt, mu_ind;
3514
+ int bTest, bPrint;
3515
+ t_coupl_iparams *tip;
3518
+ pr_ff (tcr, t, idef, cr, nfile, fnm);
3520
+ for (i = 0; (i < eoObsNR); i++)
3523
+ calc_deviation (tcr->av_value[i], tcr->act_value[i],
3524
+ tcr->ref_value[i]);
3525
+ prdev[i] = tcr->ref_value[i] - tcr->act_value[i];
3528
+ pr_dev (tcr, t, prdev, cr, nfile, fnm);
3529
+ for (i = 0; (i < atnr2); i++)
3531
+ factor = dt * deviation[tip->eObs];
3535
+ if (fabs (tip->xi.harmonic.krA) > 1.2e-38)
3536
+ idef->iparams[type].harmonic.krA *=
3537
+ (1 + factor / tip->xi.harmonic.krA);
3541
--- a/src/gcc/testsuite/gcc.target/powerpc/atomic-p7.c
3542
+++ b/src/gcc/testsuite/gcc.target/powerpc/atomic-p7.c
3544
+/* { dg-do compile { target { powerpc*-*-* && lp64 } } } */
3545
+/* { dg-skip-if "" { powerpc*-*-darwin* } { "*" } { "" } } */
3546
+/* { dg-require-effective-target powerpc_vsx_ok } */
3547
+/* { dg-options "-mcpu=power7 -O2" } */
3548
+/* { dg-final { scan-assembler-not "lbarx" } } */
3549
+/* { dg-final { scan-assembler-not "lharx" } } */
3550
+/* { dg-final { scan-assembler-times "lwarx" 18 } } */
3551
+/* { dg-final { scan-assembler-times "ldarx" 6 } } */
3552
+/* { dg-final { scan-assembler-not "lqarx" } } */
3553
+/* { dg-final { scan-assembler-not "stbcx" } } */
3554
+/* { dg-final { scan-assembler-not "sthcx" } } */
3555
+/* { dg-final { scan-assembler-times "stwcx" 18 } } */
3556
+/* { dg-final { scan-assembler-times "stdcx" 6 } } */
3557
+/* { dg-final { scan-assembler-not "stqcx" } } */
3558
+/* { dg-final { scan-assembler-times "bl __atomic" 6 } } */
3559
+/* { dg-final { scan-assembler-times "isync" 12 } } */
3560
+/* { dg-final { scan-assembler-times "lwsync" 8 } } */
3561
+/* { dg-final { scan-assembler-not "mtvsrd" } } */
3562
+/* { dg-final { scan-assembler-not "mtvsrwa" } } */
3563
+/* { dg-final { scan-assembler-not "mtvsrwz" } } */
3564
+/* { dg-final { scan-assembler-not "mfvsrd" } } */
3565
+/* { dg-final { scan-assembler-not "mfvsrwz" } } */
3567
+/* Test for the byte atomic operations on power8 using lbarx/stbcx. */
3569
+char_fetch_add_relaxed (char *ptr, int value)
3571
+ return __atomic_fetch_add (ptr, value, __ATOMIC_RELAXED);
3575
+char_fetch_sub_consume (char *ptr, int value)
3577
+ return __atomic_fetch_sub (ptr, value, __ATOMIC_CONSUME);
3581
+char_fetch_and_acquire (char *ptr, int value)
3583
+ return __atomic_fetch_and (ptr, value, __ATOMIC_ACQUIRE);
3587
+char_fetch_ior_release (char *ptr, int value)
3589
+ return __atomic_fetch_or (ptr, value, __ATOMIC_RELEASE);
3593
+char_fetch_xor_acq_rel (char *ptr, int value)
3595
+ return __atomic_fetch_xor (ptr, value, __ATOMIC_ACQ_REL);
3599
+char_fetch_nand_seq_cst (char *ptr, int value)
3601
+ return __atomic_fetch_nand (ptr, value, __ATOMIC_SEQ_CST);
3604
+/* Test for the half word atomic operations on power8 using lharx/sthcx. */
3606
+short_fetch_add_relaxed (short *ptr, int value)
3608
+ return __atomic_fetch_add (ptr, value, __ATOMIC_RELAXED);
3612
+short_fetch_sub_consume (short *ptr, int value)
3614
+ return __atomic_fetch_sub (ptr, value, __ATOMIC_CONSUME);
3618
+short_fetch_and_acquire (short *ptr, int value)
3620
+ return __atomic_fetch_and (ptr, value, __ATOMIC_ACQUIRE);
3624
+short_fetch_ior_release (short *ptr, int value)
3626
+ return __atomic_fetch_or (ptr, value, __ATOMIC_RELEASE);
3630
+short_fetch_xor_acq_rel (short *ptr, int value)
3632
+ return __atomic_fetch_xor (ptr, value, __ATOMIC_ACQ_REL);
3636
+short_fetch_nand_seq_cst (short *ptr, int value)
3638
+ return __atomic_fetch_nand (ptr, value, __ATOMIC_SEQ_CST);
3641
+/* Test for the word atomic operations on power8 using lwarx/stwcx. */
3643
+int_fetch_add_relaxed (int *ptr, int value)
3645
+ return __atomic_fetch_add (ptr, value, __ATOMIC_RELAXED);
3649
+int_fetch_sub_consume (int *ptr, int value)
3651
+ return __atomic_fetch_sub (ptr, value, __ATOMIC_CONSUME);
3655
+int_fetch_and_acquire (int *ptr, int value)
3657
+ return __atomic_fetch_and (ptr, value, __ATOMIC_ACQUIRE);
3661
+int_fetch_ior_release (int *ptr, int value)
3663
+ return __atomic_fetch_or (ptr, value, __ATOMIC_RELEASE);
3667
+int_fetch_xor_acq_rel (int *ptr, int value)
3669
+ return __atomic_fetch_xor (ptr, value, __ATOMIC_ACQ_REL);
3673
+int_fetch_nand_seq_cst (int *ptr, int value)
3675
+ return __atomic_fetch_nand (ptr, value, __ATOMIC_SEQ_CST);
3678
+/* Test for the double word atomic operations on power8 using ldarx/stdcx. */
3680
+long_fetch_add_relaxed (long *ptr, long value)
3682
+ return __atomic_fetch_add (ptr, value, __ATOMIC_RELAXED);
3686
+long_fetch_sub_consume (long *ptr, long value)
3688
+ return __atomic_fetch_sub (ptr, value, __ATOMIC_CONSUME);
3692
+long_fetch_and_acquire (long *ptr, long value)
3694
+ return __atomic_fetch_and (ptr, value, __ATOMIC_ACQUIRE);
3698
+long_fetch_ior_release (long *ptr, long value)
3700
+ return __atomic_fetch_or (ptr, value, __ATOMIC_RELEASE);
3704
+long_fetch_xor_acq_rel (long *ptr, long value)
3706
+ return __atomic_fetch_xor (ptr, value, __ATOMIC_ACQ_REL);
3710
+long_fetch_nand_seq_cst (long *ptr, long value)
3712
+ return __atomic_fetch_nand (ptr, value, __ATOMIC_SEQ_CST);
3715
+/* Test for the quad word atomic operations on power8 using ldarx/stdcx. */
3717
+quad_fetch_add_relaxed (__int128_t *ptr, __int128_t value)
3719
+ return __atomic_fetch_add (ptr, value, __ATOMIC_RELAXED);
3723
+quad_fetch_sub_consume (__int128_t *ptr, __int128_t value)
3725
+ return __atomic_fetch_sub (ptr, value, __ATOMIC_CONSUME);
3729
+quad_fetch_and_acquire (__int128_t *ptr, __int128_t value)
3731
+ return __atomic_fetch_and (ptr, value, __ATOMIC_ACQUIRE);
3735
+quad_fetch_ior_release (__int128_t *ptr, __int128_t value)
3737
+ return __atomic_fetch_or (ptr, value, __ATOMIC_RELEASE);
3741
+quad_fetch_xor_acq_rel (__int128_t *ptr, __int128_t value)
3743
+ return __atomic_fetch_xor (ptr, value, __ATOMIC_ACQ_REL);
3747
+quad_fetch_nand_seq_cst (__int128_t *ptr, __int128_t value)
3749
+ return __atomic_fetch_nand (ptr, value, __ATOMIC_SEQ_CST);
3751
--- a/src/gcc/testsuite/gcc.target/powerpc/recip-3.c
3752
+++ b/src/gcc/testsuite/gcc.target/powerpc/recip-3.c
3754
/* { dg-do compile { target { { powerpc*-*-* } && { ! powerpc*-apple-darwin* } } } } */
3755
/* { dg-require-effective-target powerpc_fprs } */
3756
/* { dg-options "-O2 -mrecip -ffast-math -mcpu=power7" } */
3757
-/* { dg-final { scan-assembler-times "xsrsqrtedp" 1 } } */
3758
+/* { dg-final { scan-assembler-times "xsrsqrtedp\|frsqrte\ " 1 } } */
3759
/* { dg-final { scan-assembler-times "xsmsub.dp\|fmsub\ " 1 } } */
3760
-/* { dg-final { scan-assembler-times "xsmuldp" 4 } } */
3761
+/* { dg-final { scan-assembler-times "xsmuldp\|fmul\ " 4 } } */
3762
/* { dg-final { scan-assembler-times "xsnmsub.dp\|fnmsub\ " 2 } } */
3763
-/* { dg-final { scan-assembler-times "frsqrtes" 1 } } */
3764
-/* { dg-final { scan-assembler-times "fmsubs" 1 } } */
3765
-/* { dg-final { scan-assembler-times "fmuls" 4 } } */
3766
-/* { dg-final { scan-assembler-times "fnmsubs" 2 } } */
3767
+/* { dg-final { scan-assembler-times "xsrsqrtesp\|frsqrtes" 1 } } */
3768
+/* { dg-final { scan-assembler-times "xsmsub.sp\|fmsubs" 1 } } */
3769
+/* { dg-final { scan-assembler-times "xsmulsp\|fmuls" 2 } } */
3770
+/* { dg-final { scan-assembler-times "xsnmsub.sp\|fnmsubs" 1 } } */
3774
--- a/src/gcc/testsuite/gcc.target/powerpc/no-r11-2.c
3775
+++ b/src/gcc/testsuite/gcc.target/powerpc/no-r11-2.c
3777
/* { dg-do compile { target { powerpc*-*-* && lp64 } } } */
3778
/* { dg-skip-if "" { *-*-darwin* } { "*" } { "" } } */
3779
+/* { dg-skip-if "" { powerpc_elfv2 } { "*" } { "" } } */
3780
/* { dg-options "-O2 -mpointers-to-nested-functions" } */
3783
--- a/src/gcc/testsuite/gcc.target/powerpc/p8vector-ldst.c
3784
+++ b/src/gcc/testsuite/gcc.target/powerpc/p8vector-ldst.c
3786
+/* { dg-do compile { target { powerpc*-*-* } } } */
3787
+/* { dg-skip-if "" { powerpc*-*-darwin* } { "*" } { "" } } */
3788
+/* { dg-require-effective-target powerpc_p8vector_ok } */
3789
+/* { dg-options "-mcpu=power8 -O2 -mupper-regs-df -mupper-regs-sf" } */
3791
+float load_sf (float *p)
3794
+ __asm__ ("# reg %x0" : "+v" (f));
3798
+double load_df (double *p)
3801
+ __asm__ ("# reg %x0" : "+v" (d));
3805
+double load_dfsf (float *p)
3807
+ double d = (double) *p;
3808
+ __asm__ ("# reg %x0" : "+v" (d));
3812
+void store_sf (float *p, float f)
3814
+ __asm__ ("# reg %x0" : "+v" (f));
3818
+void store_df (double *p, double d)
3820
+ __asm__ ("# reg %x0" : "+v" (d));
3824
+/* { dg-final { scan-assembler "lxsspx" } } */
3825
+/* { dg-final { scan-assembler "lxsdx" } } */
3826
+/* { dg-final { scan-assembler "stxsspx" } } */
3827
+/* { dg-final { scan-assembler "stxsdx" } } */
3828
--- a/src/gcc/testsuite/gcc.target/powerpc/bool3-p8.c
3829
+++ b/src/gcc/testsuite/gcc.target/powerpc/bool3-p8.c
3831
+/* { dg-do compile { target { powerpc*-*-* && lp64 } } } */
3832
+/* { dg-skip-if "" { powerpc*-*-darwin* } { "*" } { "" } } */
3833
+/* { dg-require-effective-target powerpc_p8vector_ok } */
3834
+/* { dg-options "-O2 -mcpu=power8" } */
3835
+/* { dg-final { scan-assembler "\[ \t\]and " } } */
3836
+/* { dg-final { scan-assembler "\[ \t\]or " } } */
3837
+/* { dg-final { scan-assembler "\[ \t\]xor " } } */
3838
+/* { dg-final { scan-assembler "\[ \t\]nor " } } */
3839
+/* { dg-final { scan-assembler "\[ \t\]andc " } } */
3840
+/* { dg-final { scan-assembler "\[ \t\]eqv " } } */
3841
+/* { dg-final { scan-assembler "\[ \t\]orc " } } */
3842
+/* { dg-final { scan-assembler "\[ \t\]nand " } } */
3843
+/* { dg-final { scan-assembler-not "\[ \t\]vand " } } */
3844
+/* { dg-final { scan-assembler-not "\[ \t\]vandc " } } */
3845
+/* { dg-final { scan-assembler-not "\[ \t\]vor " } } */
3846
+/* { dg-final { scan-assembler-not "\[ \t\]vxor " } } */
3847
+/* { dg-final { scan-assembler-not "\[ \t\]vnor " } } */
3848
+/* { dg-final { scan-assembler-not "\[ \t\]xxland " } } */
3849
+/* { dg-final { scan-assembler-not "\[ \t\]xxlor " } } */
3850
+/* { dg-final { scan-assembler-not "\[ \t\]xxlxor " } } */
3851
+/* { dg-final { scan-assembler-not "\[ \t\]xxlnor " } } */
3852
+/* { dg-final { scan-assembler-not "\[ \t\]xxlandc " } } */
3853
+/* { dg-final { scan-assembler-not "\[ \t\]xxleqv " } } */
3854
+/* { dg-final { scan-assembler-not "\[ \t\]xxlorc " } } */
3855
+/* { dg-final { scan-assembler-not "\[ \t\]xxlnand " } } */
3859
+#define TYPE __int128_t
3861
+typedef int v4si __attribute__ ((vector_size (16)));
3867
--- a/src/gcc/testsuite/gcc.target/powerpc/htm-xl-intrin-1.c
3868
+++ b/src/gcc/testsuite/gcc.target/powerpc/htm-xl-intrin-1.c
3870
+/* This checks the availability of the XL compiler intrinsics for
3871
+ transactional execution with the expected prototypes. */
3873
+/* { dg-do compile { target { powerpc*-*-* } } } */
3874
+/* { dg-skip-if "" { powerpc*-*-darwin* } { "*" } { "" } } */
3875
+/* { dg-require-effective-target powerpc_htm_ok } */
3876
+/* { dg-options "-O2 -mhtm" } */
3878
+#include <htmxlintrin.h>
3881
+foo (void *TM_buff, long *result, unsigned char *code)
3883
+ *result++ = __TM_simple_begin ();
3884
+ *result++ = __TM_begin (TM_buff);
3885
+ *result++ = __TM_end ();
3887
+ __TM_named_abort (*code);
3890
+ *result++ = __TM_is_user_abort (TM_buff);
3891
+ *result++ = __TM_is_named_user_abort (TM_buff, code);
3892
+ *result++ = __TM_is_illegal (TM_buff);
3893
+ *result++ = __TM_is_footprint_exceeded (TM_buff);
3894
+ *result++ = __TM_nesting_depth (TM_buff);
3895
+ *result++ = __TM_is_nested_too_deep (TM_buff);
3896
+ *result++ = __TM_is_conflict (TM_buff);
3897
+ *result++ = __TM_is_failure_persistent (TM_buff);
3898
+ *result++ = __TM_failure_address (TM_buff);
3899
+ *result++ = __TM_failure_code (TM_buff);
3902
--- a/src/gcc/testsuite/gcc.target/powerpc/p8vector-builtin-4.c
3903
+++ b/src/gcc/testsuite/gcc.target/powerpc/p8vector-builtin-4.c
3905
+/* { dg-do compile { target { powerpc*-*-* } } } */
3906
+/* { dg-skip-if "" { powerpc*-*-darwin* } { "*" } { "" } } */
3907
+/* { dg-require-effective-target powerpc_p8vector_ok } */
3908
+/* { dg-options "-mcpu=power8 -O3 -ftree-vectorize -fvect-cost-model" } */
3910
+#include <altivec.h>
3912
+typedef vector long long vll_sign;
3913
+typedef vector unsigned long long vll_uns;
3914
+typedef vector bool long long vll_bool;
3916
+typedef vector int vi_sign;
3917
+typedef vector unsigned int vi_uns;
3918
+typedef vector bool int vi_bool;
3920
+typedef vector short vs_sign;
3921
+typedef vector unsigned short vs_uns;
3922
+typedef vector bool short vs_bool;
3924
+typedef vector signed char vc_sign;
3925
+typedef vector unsigned char vc_uns;
3926
+typedef vector bool char vc_bool;
3928
+vll_sign vll_clz_1 (vll_sign a)
3930
+ return __builtin_altivec_vclzd (a);
3933
+vll_sign vll_clz_2 (vll_sign a)
3935
+ return vec_vclz (a);
3938
+vll_sign vll_clz_3 (vll_sign a)
3940
+ return vec_vclzd (a);
3943
+vll_uns vll_clz_4 (vll_uns a)
3945
+ return vec_vclz (a);
3948
+vll_uns vll_clz_5 (vll_uns a)
3950
+ return vec_vclzd (a);
3953
+vi_sign vi_clz_1 (vi_sign a)
3955
+ return __builtin_altivec_vclzw (a);
3958
+vi_sign vi_clz_2 (vi_sign a)
3960
+ return vec_vclz (a);
3963
+vi_sign vi_clz_3 (vi_sign a)
3965
+ return vec_vclzw (a);
3968
+vi_uns vi_clz_4 (vi_uns a)
3970
+ return vec_vclz (a);
3973
+vi_uns vi_clz_5 (vi_uns a)
3975
+ return vec_vclzw (a);
3978
+vs_sign vs_clz_1 (vs_sign a)
3980
+ return __builtin_altivec_vclzh (a);
3983
+vs_sign vs_clz_2 (vs_sign a)
3985
+ return vec_vclz (a);
3988
+vs_sign vs_clz_3 (vs_sign a)
3990
+ return vec_vclzh (a);
3993
+vs_uns vs_clz_4 (vs_uns a)
3995
+ return vec_vclz (a);
3998
+vs_uns vs_clz_5 (vs_uns a)
4000
+ return vec_vclzh (a);
4003
+vc_sign vc_clz_1 (vc_sign a)
4005
+ return __builtin_altivec_vclzb (a);
4008
+vc_sign vc_clz_2 (vc_sign a)
4010
+ return vec_vclz (a);
4013
+vc_sign vc_clz_3 (vc_sign a)
4015
+ return vec_vclzb (a);
4018
+vc_uns vc_clz_4 (vc_uns a)
4020
+ return vec_vclz (a);
4023
+vc_uns vc_clz_5 (vc_uns a)
4025
+ return vec_vclzb (a);
4028
+vll_sign vll_popcnt_1 (vll_sign a)
4030
+ return __builtin_altivec_vpopcntd (a);
4033
+vll_sign vll_popcnt_2 (vll_sign a)
4035
+ return vec_vpopcnt (a);
4038
+vll_sign vll_popcnt_3 (vll_sign a)
4040
+ return vec_vpopcntd (a);
4043
+vll_uns vll_popcnt_4 (vll_uns a)
4045
+ return vec_vpopcnt (a);
4048
+vll_uns vll_popcnt_5 (vll_uns a)
4050
+ return vec_vpopcntd (a);
4053
+vi_sign vi_popcnt_1 (vi_sign a)
4055
+ return __builtin_altivec_vpopcntw (a);
4058
+vi_sign vi_popcnt_2 (vi_sign a)
4060
+ return vec_vpopcnt (a);
4063
+vi_sign vi_popcnt_3 (vi_sign a)
4065
+ return vec_vpopcntw (a);
4068
+vi_uns vi_popcnt_4 (vi_uns a)
4070
+ return vec_vpopcnt (a);
4073
+vi_uns vi_popcnt_5 (vi_uns a)
4075
+ return vec_vpopcntw (a);
4078
+vs_sign vs_popcnt_1 (vs_sign a)
4080
+ return __builtin_altivec_vpopcnth (a);
4083
+vs_sign vs_popcnt_2 (vs_sign a)
4085
+ return vec_vpopcnt (a);
4088
+vs_sign vs_popcnt_3 (vs_sign a)
4090
+ return vec_vpopcnth (a);
4093
+vs_uns vs_popcnt_4 (vs_uns a)
4095
+ return vec_vpopcnt (a);
4098
+vs_uns vs_popcnt_5 (vs_uns a)
4100
+ return vec_vpopcnth (a);
4103
+vc_sign vc_popcnt_1 (vc_sign a)
4105
+ return __builtin_altivec_vpopcntb (a);
4108
+vc_sign vc_popcnt_2 (vc_sign a)
4110
+ return vec_vpopcnt (a);
4113
+vc_sign vc_popcnt_3 (vc_sign a)
4115
+ return vec_vpopcntb (a);
4118
+vc_uns vc_popcnt_4 (vc_uns a)
4120
+ return vec_vpopcnt (a);
4123
+vc_uns vc_popcnt_5 (vc_uns a)
4125
+ return vec_vpopcntb (a);
4128
+vc_uns vc_gbb_1 (vc_uns a)
4130
+ return __builtin_altivec_vgbbd (a);
4133
+vc_sign vc_gbb_2 (vc_sign a)
4135
+ return vec_vgbbd (a);
4138
+vc_uns vc_gbb_3 (vc_uns a)
4140
+ return vec_vgbbd (a);
4143
+/* { dg-final { scan-assembler-times "vclzd" 5 } } */
4144
+/* { dg-final { scan-assembler-times "vclzw" 5 } } */
4145
+/* { dg-final { scan-assembler-times "vclzh" 5 } } */
4146
+/* { dg-final { scan-assembler-times "vclzb" 5 } } */
4148
+/* { dg-final { scan-assembler-times "vpopcntd" 5 } } */
4149
+/* { dg-final { scan-assembler-times "vpopcntw" 5 } } */
4150
+/* { dg-final { scan-assembler-times "vpopcnth" 5 } } */
4151
+/* { dg-final { scan-assembler-times "vpopcntb" 5 } } */
4153
+/* { dg-final { scan-assembler-times "vgbbd" 3 } } */
4154
--- a/src/gcc/testsuite/gcc.target/powerpc/bool3-av.c
4155
+++ b/src/gcc/testsuite/gcc.target/powerpc/bool3-av.c
4157
+/* { dg-do compile { target { powerpc*-*-* && lp64 } } } */
4158
+/* { dg-skip-if "" { powerpc*-*-darwin* } { "*" } { "" } } */
4159
+/* { dg-require-effective-target powerpc_altivec_ok } */
4160
+/* { dg-options "-O2 -mcpu=power6 -mabi=altivec -maltivec -mno-vsx" } */
4161
+/* { dg-final { scan-assembler "\[ \t\]and " } } */
4162
+/* { dg-final { scan-assembler "\[ \t\]or " } } */
4163
+/* { dg-final { scan-assembler "\[ \t\]xor " } } */
4164
+/* { dg-final { scan-assembler "\[ \t\]nor " } } */
4165
+/* { dg-final { scan-assembler "\[ \t\]andc " } } */
4166
+/* { dg-final { scan-assembler-not "\[ \t\]vand " } } */
4167
+/* { dg-final { scan-assembler-not "\[ \t\]vandc " } } */
4168
+/* { dg-final { scan-assembler-not "\[ \t\]vor " } } */
4169
+/* { dg-final { scan-assembler-not "\[ \t\]vxor " } } */
4170
+/* { dg-final { scan-assembler-not "\[ \t\]vnor " } } */
4171
+/* { dg-final { scan-assembler-not "\[ \t\]xxland " } } */
4172
+/* { dg-final { scan-assembler-not "\[ \t\]xxlor " } } */
4173
+/* { dg-final { scan-assembler-not "\[ \t\]xxlxor " } } */
4174
+/* { dg-final { scan-assembler-not "\[ \t\]xxlnor " } } */
4175
+/* { dg-final { scan-assembler-not "\[ \t\]xxlandc " } } */
4176
+/* { dg-final { scan-assembler-not "\[ \t\]xxleqv " } } */
4177
+/* { dg-final { scan-assembler-not "\[ \t\]xxlorc " } } */
4178
+/* { dg-final { scan-assembler-not "\[ \t\]xxlnand " } } */
4180
+/* On altivec, for 128-bit types, ORC/ANDC/EQV might not show up, since the
4181
+ vector unit doesn't support these, so the appropriate combine patterns may
4182
+ not be generated. */
4186
+#define TYPE __int128_t
4188
+typedef int v4si __attribute__ ((vector_size (16)));
4194
--- a/src/gcc/testsuite/gcc.target/powerpc/p8vector-vectorize-4.c
4195
+++ b/src/gcc/testsuite/gcc.target/powerpc/p8vector-vectorize-4.c
4197
+/* { dg-do compile { target { powerpc*-*-* } } } */
4198
+/* { dg-skip-if "" { powerpc*-*-darwin* } { "*" } { "" } } */
4199
+/* { dg-require-effective-target powerpc_p8vector_ok } */
4200
+/* { dg-options "-mcpu=power8 -O2 -ftree-vectorize -fvect-cost-model -fno-unroll-loops -fno-unroll-all-loops" } */
4210
+#define ALIGN_ATTR __attribute__((__aligned__(ALIGN)))
4212
+#define DO_BUILTIN(PREFIX, TYPE, CLZ, POPCNT) \
4213
+TYPE PREFIX ## _a[SIZE] ALIGN_ATTR; \
4214
+TYPE PREFIX ## _b[SIZE] ALIGN_ATTR; \
4217
+PREFIX ## _clz (void) \
4219
+ unsigned long i; \
4221
+ for (i = 0; i < SIZE; i++) \
4222
+ PREFIX ## _a[i] = CLZ (PREFIX ## _b[i]); \
4226
+PREFIX ## _popcnt (void) \
4228
+ unsigned long i; \
4230
+ for (i = 0; i < SIZE; i++) \
4231
+ PREFIX ## _a[i] = POPCNT (PREFIX ## _b[i]); \
4234
+#if !defined(DO_LONG_LONG) && !defined(DO_LONG) && !defined(DO_INT) && !defined(DO_SHORT) && !defined(DO_CHAR)
4239
+/* At the moment, only int is auto vectorized. */
4240
+DO_BUILTIN (sll, long long, __builtin_clzll, __builtin_popcountll)
4241
+DO_BUILTIN (ull, unsigned long long, __builtin_clzll, __builtin_popcountll)
4244
+#if defined(_ARCH_PPC64) && DO_LONG
4245
+DO_BUILTIN (sl, long, __builtin_clzl, __builtin_popcountl)
4246
+DO_BUILTIN (ul, unsigned long, __builtin_clzl, __builtin_popcountl)
4250
+DO_BUILTIN (si, int, __builtin_clz, __builtin_popcount)
4251
+DO_BUILTIN (ui, unsigned int, __builtin_clz, __builtin_popcount)
4255
+DO_BUILTIN (ss, short, __builtin_clz, __builtin_popcount)
4256
+DO_BUILTIN (us, unsigned short, __builtin_clz, __builtin_popcount)
4260
+DO_BUILTIN (sc, signed char, __builtin_clz, __builtin_popcount)
4261
+DO_BUILTIN (uc, unsigned char, __builtin_clz, __builtin_popcount)
4264
+/* { dg-final { scan-assembler-times "vclzw" 2 } } */
4265
+/* { dg-final { scan-assembler-times "vpopcntw" 2 } } */
4266
--- a/src/gcc/testsuite/gcc.target/powerpc/pr57949-1.c
4267
+++ b/src/gcc/testsuite/gcc.target/powerpc/pr57949-1.c
4269
+/* { dg-do compile { target { powerpc64*-*-* && lp64 } } } */
4270
+/* { dg-skip-if "" { powerpc*-*-darwin* } { "*" } { "" } } */
4271
+/* { dg-skip-if "" { powerpc_elfv2 } { "*" } { "" } } */
4272
+/* { dg-options "-O2 -mcpu=power7 -mno-compat-align-parm" } */
4274
+/* Verify that vs is 16-byte aligned with -mcompat-align-parm. */
4276
+typedef float v4sf __attribute__ ((vector_size (16)));
4277
+struct s { long m; v4sf v; };
4281
+void pr57949 (long d1, long d2, long d3, long d4, long d5, long d6,
4282
+ long d7, long d8, long d9, struct s vs) {
4287
+/* { dg-final { scan-assembler "li \.\*,144" } } */
4288
+/* { dg-final { scan-assembler "ld \.\*,128\\(1\\)" } } */
4289
--- a/src/gcc/testsuite/gcc.target/powerpc/atomic-p8.c
4290
+++ b/src/gcc/testsuite/gcc.target/powerpc/atomic-p8.c
4292
+/* { dg-do compile { target { powerpc*-*-* && lp64 } } } */
4293
+/* { dg-skip-if "" { powerpc*-*-darwin* } { "*" } { "" } } */
4294
+/* { dg-require-effective-target powerpc_p8vector_ok } */
4295
+/* { dg-options "-mcpu=power8 -O2" } */
4296
+/* { dg-final { scan-assembler-times "lbarx" 7 } } */
4297
+/* { dg-final { scan-assembler-times "lharx" 7 } } */
4298
+/* { dg-final { scan-assembler-times "lwarx" 7 } } */
4299
+/* { dg-final { scan-assembler-times "ldarx" 7 } } */
4300
+/* { dg-final { scan-assembler-times "lqarx" 7 } } */
4301
+/* { dg-final { scan-assembler-times "stbcx" 7 } } */
4302
+/* { dg-final { scan-assembler-times "sthcx" 7 } } */
4303
+/* { dg-final { scan-assembler-times "stwcx" 7 } } */
4304
+/* { dg-final { scan-assembler-times "stdcx" 7 } } */
4305
+/* { dg-final { scan-assembler-times "stqcx" 7 } } */
4306
+/* { dg-final { scan-assembler-not "bl __atomic" } } */
4307
+/* { dg-final { scan-assembler-times "isync" 20 } } */
4308
+/* { dg-final { scan-assembler-times "lwsync" 10 } } */
4309
+/* { dg-final { scan-assembler-not "mtvsrd" } } */
4310
+/* { dg-final { scan-assembler-not "mtvsrwa" } } */
4311
+/* { dg-final { scan-assembler-not "mtvsrwz" } } */
4312
+/* { dg-final { scan-assembler-not "mfvsrd" } } */
4313
+/* { dg-final { scan-assembler-not "mfvsrwz" } } */
4315
+/* Test for the byte atomic operations on power8 using lbarx/stbcx. */
4317
+char_fetch_add_relaxed (char *ptr, int value)
4319
+ return __atomic_fetch_add (ptr, value, __ATOMIC_RELAXED);
4323
+char_fetch_sub_consume (char *ptr, int value)
4325
+ return __atomic_fetch_sub (ptr, value, __ATOMIC_CONSUME);
4329
+char_fetch_and_acquire (char *ptr, int value)
4331
+ return __atomic_fetch_and (ptr, value, __ATOMIC_ACQUIRE);
4335
+char_fetch_ior_release (char *ptr, int value)
4337
+ return __atomic_fetch_or (ptr, value, __ATOMIC_RELEASE);
4341
+char_fetch_xor_acq_rel (char *ptr, int value)
4343
+ return __atomic_fetch_xor (ptr, value, __ATOMIC_ACQ_REL);
4347
+char_fetch_nand_seq_cst (char *ptr, int value)
4349
+ return __atomic_fetch_nand (ptr, value, __ATOMIC_SEQ_CST);
4353
+char_val_compare_and_swap (char *p, int i, int j, char *q)
4355
+ *q = __sync_val_compare_and_swap (p, i, j);
4358
+/* Test for the half word atomic operations on power8 using lharx/sthcx. */
4360
+short_fetch_add_relaxed (short *ptr, int value)
4362
+ return __atomic_fetch_add (ptr, value, __ATOMIC_RELAXED);
4366
+short_fetch_sub_consume (short *ptr, int value)
4368
+ return __atomic_fetch_sub (ptr, value, __ATOMIC_CONSUME);
4372
+short_fetch_and_acquire (short *ptr, int value)
4374
+ return __atomic_fetch_and (ptr, value, __ATOMIC_ACQUIRE);
4378
+short_fetch_ior_release (short *ptr, int value)
4380
+ return __atomic_fetch_or (ptr, value, __ATOMIC_RELEASE);
4384
+short_fetch_xor_acq_rel (short *ptr, int value)
4386
+ return __atomic_fetch_xor (ptr, value, __ATOMIC_ACQ_REL);
4390
+short_fetch_nand_seq_cst (short *ptr, int value)
4392
+ return __atomic_fetch_nand (ptr, value, __ATOMIC_SEQ_CST);
4396
+short_val_compare_and_swap (short *p, int i, int j, short *q)
4398
+ *q = __sync_val_compare_and_swap (p, i, j);
4401
+/* Test for the word atomic operations on power8 using lwarx/stwcx. */
4403
+int_fetch_add_relaxed (int *ptr, int value)
4405
+ return __atomic_fetch_add (ptr, value, __ATOMIC_RELAXED);
4409
+int_fetch_sub_consume (int *ptr, int value)
4411
+ return __atomic_fetch_sub (ptr, value, __ATOMIC_CONSUME);
4415
+int_fetch_and_acquire (int *ptr, int value)
4417
+ return __atomic_fetch_and (ptr, value, __ATOMIC_ACQUIRE);
4421
+int_fetch_ior_release (int *ptr, int value)
4423
+ return __atomic_fetch_or (ptr, value, __ATOMIC_RELEASE);
4427
+int_fetch_xor_acq_rel (int *ptr, int value)
4429
+ return __atomic_fetch_xor (ptr, value, __ATOMIC_ACQ_REL);
4433
+int_fetch_nand_seq_cst (int *ptr, int value)
4435
+ return __atomic_fetch_nand (ptr, value, __ATOMIC_SEQ_CST);
4439
+int_val_compare_and_swap (int *p, int i, int j, int *q)
4441
+ *q = __sync_val_compare_and_swap (p, i, j);
4444
+/* Test for the double word atomic operations on power8 using ldarx/stdcx. */
4446
+long_fetch_add_relaxed (long *ptr, long value)
4448
+ return __atomic_fetch_add (ptr, value, __ATOMIC_RELAXED);
4452
+long_fetch_sub_consume (long *ptr, long value)
4454
+ return __atomic_fetch_sub (ptr, value, __ATOMIC_CONSUME);
4458
+long_fetch_and_acquire (long *ptr, long value)
4460
+ return __atomic_fetch_and (ptr, value, __ATOMIC_ACQUIRE);
4464
+long_fetch_ior_release (long *ptr, long value)
4466
+ return __atomic_fetch_or (ptr, value, __ATOMIC_RELEASE);
4470
+long_fetch_xor_acq_rel (long *ptr, long value)
4472
+ return __atomic_fetch_xor (ptr, value, __ATOMIC_ACQ_REL);
4476
+long_fetch_nand_seq_cst (long *ptr, long value)
4478
+ return __atomic_fetch_nand (ptr, value, __ATOMIC_SEQ_CST);
4482
+long_val_compare_and_swap (long *p, long i, long j, long *q)
4484
+ *q = __sync_val_compare_and_swap (p, i, j);
4487
+/* Test for the quad word atomic operations on power8 using ldarx/stdcx. */
4489
+quad_fetch_add_relaxed (__int128_t *ptr, __int128_t value)
4491
+ return __atomic_fetch_add (ptr, value, __ATOMIC_RELAXED);
4495
+quad_fetch_sub_consume (__int128_t *ptr, __int128_t value)
4497
+ return __atomic_fetch_sub (ptr, value, __ATOMIC_CONSUME);
4501
+quad_fetch_and_acquire (__int128_t *ptr, __int128_t value)
4503
+ return __atomic_fetch_and (ptr, value, __ATOMIC_ACQUIRE);
4507
+quad_fetch_ior_release (__int128_t *ptr, __int128_t value)
4509
+ return __atomic_fetch_or (ptr, value, __ATOMIC_RELEASE);
4513
+quad_fetch_xor_acq_rel (__int128_t *ptr, __int128_t value)
4515
+ return __atomic_fetch_xor (ptr, value, __ATOMIC_ACQ_REL);
4519
+quad_fetch_nand_seq_cst (__int128_t *ptr, __int128_t value)
4521
+ return __atomic_fetch_nand (ptr, value, __ATOMIC_SEQ_CST);
4525
+quad_val_compare_and_swap (__int128_t *p, __int128_t i, __int128_t j, __int128_t *q)
4527
+ *q = __sync_val_compare_and_swap (p, i, j);
4529
--- a/src/gcc/testsuite/gcc.target/powerpc/sd-pwr6.c
4530
+++ b/src/gcc/testsuite/gcc.target/powerpc/sd-pwr6.c
4532
+/* { dg-do compile { target { powerpc*-*-* } } } */
4533
+/* { dg-skip-if "" { powerpc*-*-darwin* } { "*" } { "" } } */
4534
+/* { dg-require-effective-target powerpc_vsx_ok } */
4535
+/* { dg-options "-O2 -mcpu=power6 -mhard-dfp" } */
4536
+/* { dg-final { scan-assembler-not "lfiwzx" } } */
4537
+/* { dg-final { scan-assembler-times "lfd" 2 } } */
4538
+/* { dg-final { scan-assembler-times "dctdp" 2 } } */
4539
+/* { dg-final { scan-assembler-times "dadd" 1 } } */
4540
+/* { dg-final { scan-assembler-times "drsp" 1 } } */
4542
+/* Test that for power6 we need to use a bounce buffer on the stack to load
4543
+ SDmode variables because the power6 does not have a way to directly load
4544
+ 32-bit values from memory. */
4547
+void inc_dec32 (void)
4549
+ a += (_Decimal32) 1.0;
4551
--- a/src/gcc/testsuite/gcc.target/powerpc/recip-4.c
4552
+++ b/src/gcc/testsuite/gcc.target/powerpc/recip-4.c
4554
/* { dg-final { scan-assembler-times "xvnmsub.dp" 2 } } */
4555
/* { dg-final { scan-assembler-times "xvrsqrtesp" 1 } } */
4556
/* { dg-final { scan-assembler-times "xvmsub.sp" 1 } } */
4557
-/* { dg-final { scan-assembler-times "xvmulsp" 4 } } */
4558
-/* { dg-final { scan-assembler-times "xvnmsub.sp" 2 } } */
4559
+/* { dg-final { scan-assembler-times "xvmulsp" 2 } } */
4560
+/* { dg-final { scan-assembler-times "xvnmsub.sp" 1 } } */
4564
--- a/src/gcc/testsuite/gcc.target/powerpc/no-r11-3.c
4565
+++ b/src/gcc/testsuite/gcc.target/powerpc/no-r11-3.c
4567
/* { dg-do compile { target { powerpc*-*-* && lp64 } } } */
4568
/* { dg-skip-if "" { *-*-darwin* } { "*" } { "" } } */
4569
+/* { dg-skip-if "" { powerpc_elfv2 } { "*" } { "" } } */
4570
/* { dg-options "-O2 -mno-pointers-to-nested-functions" } */
4572
extern void ext_call (int (func) (void));
4573
--- a/src/gcc/testsuite/gcc.target/powerpc/crypto-builtin-1.c
4574
+++ b/src/gcc/testsuite/gcc.target/powerpc/crypto-builtin-1.c
4576
+/* { dg-do compile { target { powerpc*-*-* } } } */
4577
+/* { dg-skip-if "" { powerpc*-*-darwin* } { "*" } { "" } } */
4578
+/* { dg-require-effective-target powerpc_p8vector_ok } */
4579
+/* { dg-options "-mcpu=power8 -O2 -ftree-vectorize -fvect-cost-model -fno-unroll-loops -fno-unroll-all-loops" } */
4581
+typedef vector unsigned long long crypto_t;
4582
+typedef vector unsigned long long v2di_t;
4583
+typedef vector unsigned int v4si_t;
4584
+typedef vector unsigned short v8hi_t;
4585
+typedef vector unsigned char v16qi_t;
4587
+crypto_t crpyto1 (crypto_t a)
4589
+ return __builtin_crypto_vsbox (a);
4592
+crypto_t crypto2 (crypto_t a, crypto_t b)
4594
+ return __builtin_crypto_vcipher (a, b);
4597
+crypto_t crypto3 (crypto_t a, crypto_t b)
4599
+ return __builtin_crypto_vcipherlast (a, b);
4602
+crypto_t crypto4 (crypto_t a, crypto_t b)
4604
+ return __builtin_crypto_vncipher (a, b);
4607
+crypto_t crypto5 (crypto_t a, crypto_t b)
4609
+ return __builtin_crypto_vncipherlast (a, b);
4612
+v16qi_t crypto6a (v16qi_t a, v16qi_t b, v16qi_t c)
4614
+ return __builtin_crypto_vpermxor (a, b, c);
4617
+v8hi_t crypto6b (v8hi_t a, v8hi_t b, v8hi_t c)
4619
+ return __builtin_crypto_vpermxor (a, b, c);
4622
+v4si_t crypto6c (v4si_t a, v4si_t b, v4si_t c)
4624
+ return __builtin_crypto_vpermxor (a, b, c);
4627
+v2di_t crypto6d (v2di_t a, v2di_t b, v2di_t c)
4629
+ return __builtin_crypto_vpermxor (a, b, c);
4632
+v16qi_t crypto7a (v16qi_t a, v16qi_t b)
4634
+ return __builtin_crypto_vpmsumb (a, b);
4637
+v16qi_t crypto7b (v16qi_t a, v16qi_t b)
4639
+ return __builtin_crypto_vpmsum (a, b);
4642
+v8hi_t crypto7c (v8hi_t a, v8hi_t b)
4644
+ return __builtin_crypto_vpmsumh (a, b);
4647
+v8hi_t crypto7d (v8hi_t a, v8hi_t b)
4649
+ return __builtin_crypto_vpmsum (a, b);
4652
+v4si_t crypto7e (v4si_t a, v4si_t b)
4654
+ return __builtin_crypto_vpmsumw (a, b);
4657
+v4si_t crypto7f (v4si_t a, v4si_t b)
4659
+ return __builtin_crypto_vpmsum (a, b);
4662
+v2di_t crypto7g (v2di_t a, v2di_t b)
4664
+ return __builtin_crypto_vpmsumd (a, b);
4667
+v2di_t crypto7h (v2di_t a, v2di_t b)
4669
+ return __builtin_crypto_vpmsum (a, b);
4672
+v2di_t crypto8a (v2di_t a)
4674
+ return __builtin_crypto_vshasigmad (a, 0, 8);
4677
+v2di_t crypto8b (v2di_t a)
4679
+ return __builtin_crypto_vshasigma (a, 0, 8);
4682
+v4si_t crypto8c (v4si_t a)
4684
+ return __builtin_crypto_vshasigmaw (a, 1, 15);
4687
+v4si_t crypto8d (v4si_t a)
4689
+ return __builtin_crypto_vshasigma (a, 1, 15);
4692
+/* Note space is used after the instruction so that vcipherlast does not match
4694
+/* { dg-final { scan-assembler-times "vcipher " 1 } } */
4695
+/* { dg-final { scan-assembler-times "vcipherlast " 1 } } */
4696
+/* { dg-final { scan-assembler-times "vncipher " 1 } } */
4697
+/* { dg-final { scan-assembler-times "vncipherlast " 1 } } */
4698
+/* { dg-final { scan-assembler-times "vpermxor " 4 } } */
4699
+/* { dg-final { scan-assembler-times "vpmsumb " 2 } } */
4700
+/* { dg-final { scan-assembler-times "vpmsumd " 2 } } */
4701
+/* { dg-final { scan-assembler-times "vpmsumh " 2 } } */
4702
+/* { dg-final { scan-assembler-times "vpmsumw " 2 } } */
4703
+/* { dg-final { scan-assembler-times "vsbox " 1 } } */
4704
+/* { dg-final { scan-assembler-times "vshasigmad " 2 } } */
4705
+/* { dg-final { scan-assembler-times "vshasigmaw " 2 } } */
4706
--- a/src/gcc/testsuite/gcc.target/powerpc/pr42747.c
4707
+++ b/src/gcc/testsuite/gcc.target/powerpc/pr42747.c
4710
double foo (double x) { return __builtin_sqrt (x); }
4712
-/* { dg-final { scan-assembler "xssqrtdp" } } */
4713
+/* { dg-final { scan-assembler "xssqrtdp\|fsqrt" } } */
4714
--- a/src/gcc/testsuite/gcc.target/powerpc/dfp-dd-2.c
4715
+++ b/src/gcc/testsuite/gcc.target/powerpc/dfp-dd-2.c
4717
+/* Test generation of DFP instructions for POWER6. */
4718
+/* { dg-do compile { target { powerpc*-*-linux* && powerpc_fprs } } } */
4719
+/* { dg-options "-std=gnu99 -O1 -mcpu=power6" } */
4721
+/* { dg-final { scan-assembler-times "fneg" 1 } } */
4722
+/* { dg-final { scan-assembler-times "fabs" 1 } } */
4723
+/* { dg-final { scan-assembler-times "fnabs" 1 } } */
4724
+/* { dg-final { scan-assembler-times "fmr" 0 } } */
4727
+func1 (_Decimal64 a, _Decimal64 b)
4733
+func2 (_Decimal64 a, _Decimal64 b)
4735
+ return __builtin_fabsd64 (b);
4739
+func3 (_Decimal64 a, _Decimal64 b)
4741
+ return - __builtin_fabsd64 (b);
4743
--- a/src/gcc/testsuite/gcc.target/powerpc/direct-move-float1.c
4744
+++ b/src/gcc/testsuite/gcc.target/powerpc/direct-move-float1.c
4746
+/* { dg-do compile { target { powerpc*-*-linux* && lp64 } } } */
4747
+/* { dg-skip-if "" { powerpc*-*-darwin* } { "*" } { "" } } */
4748
+/* { dg-skip-if "" { powerpc*-*-*spe* } { "*" } { "" } } */
4749
+/* { dg-require-effective-target powerpc_p8vector_ok } */
4750
+/* { dg-options "-mcpu=power8 -O2" } */
4751
+/* { dg-final { scan-assembler "mtvsrd" } } */
4752
+/* { dg-final { scan-assembler "mfvsrd" } } */
4753
+/* { dg-final { scan-assembler "xscvdpspn" } } */
4754
+/* { dg-final { scan-assembler "xscvspdpn" } } */
4756
+/* Check code generation for direct move for float types. */
4760
+#define NO_ALTIVEC 1
4761
+#define VSX_REG_ATTR "ww"
4763
+#include "direct-move.h"
4764
--- a/src/gcc/testsuite/gcc.target/powerpc/dfp-td-2.c
4765
+++ b/src/gcc/testsuite/gcc.target/powerpc/dfp-td-2.c
4767
+/* Test generation of DFP instructions for POWER6. */
4768
+/* { dg-do compile { target { powerpc*-*-linux* && powerpc_fprs } } } */
4769
+/* { dg-options "-std=gnu99 -O1 -mcpu=power6" } */
4771
+/* { dg-final { scan-assembler-times "fneg" 1 } } */
4772
+/* { dg-final { scan-assembler-times "fabs" 1 } } */
4773
+/* { dg-final { scan-assembler-times "fnabs" 1 } } */
4774
+/* { dg-final { scan-assembler-times "fmr" 0 } } */
4776
+/* These tests verify we only generate fneg, fabs and fnabs
4777
+ instructions and no fmr's since these are done in place. */
4780
+func1 (_Decimal128 a)
4786
+func2 (_Decimal128 a)
4788
+ return __builtin_fabsd128 (a);
4792
+func3 (_Decimal128 a)
4794
+ return - __builtin_fabsd128 (a);
4796
--- a/src/gcc/testsuite/gcc.target/powerpc/p8vector-builtin-5.c
4797
+++ b/src/gcc/testsuite/gcc.target/powerpc/p8vector-builtin-5.c
4799
+/* { dg-do compile { target { powerpc*-*-* } } } */
4800
+/* { dg-skip-if "" { powerpc*-*-darwin* } { "*" } { "" } } */
4801
+/* { dg-require-effective-target powerpc_p8vector_ok } */
4802
+/* { dg-options "-mcpu=power8 -O2 -ftree-vectorize -fvect-cost-model -fno-unroll-loops -fno-unroll-all-loops" } */
4804
+#include <altivec.h>
4815
+#define ATTR_ALIGN __attribute__((__aligned__(ALIGN)))
4818
+#define DOIT(TYPE, PREFIX) \
4819
+TYPE PREFIX ## _eqv_builtin (TYPE a, TYPE b) \
4821
+ return vec_eqv (a, b); \
4824
+TYPE PREFIX ## _eqv_arith (TYPE a, TYPE b) \
4826
+ return ~(a ^ b); \
4829
+TYPE PREFIX ## _nand_builtin (TYPE a, TYPE b) \
4831
+ return vec_nand (a, b); \
4834
+TYPE PREFIX ## _nand_arith1 (TYPE a, TYPE b) \
4836
+ return ~(a & b); \
4839
+TYPE PREFIX ## _nand_arith2 (TYPE a, TYPE b) \
4841
+ return (~a) | (~b); \
4844
+TYPE PREFIX ## _orc_builtin (TYPE a, TYPE b) \
4846
+ return vec_orc (a, b); \
4849
+TYPE PREFIX ## _orc_arith1 (TYPE a, TYPE b) \
4851
+ return (~ a) | b; \
4854
+TYPE PREFIX ## _orc_arith2 (TYPE a, TYPE b) \
4856
+ return a | (~ b); \
4859
+#define DOIT_FLOAT(TYPE, PREFIX) \
4860
+TYPE PREFIX ## _eqv_builtin (TYPE a, TYPE b) \
4862
+ return vec_eqv (a, b); \
4865
+TYPE PREFIX ## _nand_builtin (TYPE a, TYPE b) \
4867
+ return vec_nand (a, b); \
4870
+TYPE PREFIX ## _orc_builtin (TYPE a, TYPE b) \
4872
+ return vec_orc (a, b); \
4875
+typedef vector signed char sign_char_vec;
4876
+typedef vector short sign_short_vec;
4877
+typedef vector int sign_int_vec;
4878
+typedef vector long long sign_llong_vec;
4880
+typedef vector unsigned char uns_char_vec;
4881
+typedef vector unsigned short uns_short_vec;
4882
+typedef vector unsigned int uns_int_vec;
4883
+typedef vector unsigned long long uns_llong_vec;
4885
+typedef vector float float_vec;
4886
+typedef vector double double_vec;
4888
+DOIT(sign_char_vec, sign_char)
4889
+DOIT(sign_short_vec, sign_short)
4890
+DOIT(sign_int_vec, sign_int)
4891
+DOIT(sign_llong_vec, sign_llong)
4893
+DOIT(uns_char_vec, uns_char)
4894
+DOIT(uns_short_vec, uns_short)
4895
+DOIT(uns_int_vec, uns_int)
4896
+DOIT(uns_llong_vec, uns_llong)
4898
+DOIT_FLOAT(float_vec, float)
4899
+DOIT_FLOAT(double_vec, double)
4901
+/* { dg-final { scan-assembler-times "xxleqv" 18 } } */
4902
+/* { dg-final { scan-assembler-times "xxlnand" 26 } } */
4903
+/* { dg-final { scan-assembler-times "xxlorc" 26 } } */
4904
--- a/src/gcc/testsuite/gcc.target/powerpc/p8vector-vectorize-5.c
4905
+++ b/src/gcc/testsuite/gcc.target/powerpc/p8vector-vectorize-5.c
4907
+/* { dg-do compile { target { powerpc*-*-* } } } */
4908
+/* { dg-skip-if "" { powerpc*-*-darwin* } { "*" } { "" } } */
4909
+/* { dg-require-effective-target powerpc_p8vector_ok } */
4910
+/* { dg-options "-mcpu=power8 -O2 -ftree-vectorize -fvect-cost-model -fno-unroll-loops -fno-unroll-all-loops" } */
4921
+#define ATTR_ALIGN __attribute__((__aligned__(ALIGN)))
4925
+#define TYPE unsigned int
4928
+TYPE in1 [SIZE] ATTR_ALIGN;
4929
+TYPE in2 [SIZE] ATTR_ALIGN;
4930
+TYPE eqv [SIZE] ATTR_ALIGN;
4931
+TYPE nand1[SIZE] ATTR_ALIGN;
4932
+TYPE nand2[SIZE] ATTR_ALIGN;
4933
+TYPE orc1 [SIZE] ATTR_ALIGN;
4934
+TYPE orc2 [SIZE] ATTR_ALIGN;
4941
+ for (i = 0; i < SIZE; i++)
4943
+ eqv[i] = ~(in1[i] ^ in2[i]);
4952
+ for (i = 0; i < SIZE; i++)
4954
+ nand1[i] = ~(in1[i] & in2[i]);
4963
+ for (i = 0; i < SIZE; i++)
4965
+ nand2[i] = (~in1[i]) | (~in2[i]);
4974
+ for (i = 0; i < SIZE; i++)
4976
+ orc1[i] = (~in1[i]) | in2[i];
4985
+ for (i = 0; i < SIZE; i++)
4987
+ orc1[i] = in1[i] | (~in2[i]);
4991
+/* { dg-final { scan-assembler-times "xxleqv" 1 } } */
4992
+/* { dg-final { scan-assembler-times "xxlnand" 2 } } */
4993
+/* { dg-final { scan-assembler-times "xxlorc" 2 } } */
4994
--- a/src/gcc/testsuite/gcc.target/powerpc/pr57949-2.c
4995
+++ b/src/gcc/testsuite/gcc.target/powerpc/pr57949-2.c
4997
+/* { dg-do compile { target { powerpc64*-*-* && lp64 } } } */
4998
+/* { dg-skip-if "" { powerpc*-*-darwin* } { "*" } { "" } } */
4999
+/* { dg-skip-if "" { powerpc_elfv2 } { "*" } { "" } } */
5000
+/* { dg-options "-O2 -mcpu=power7" } */
5002
+/* Verify that vs is not 16-byte aligned in the absence of -mno-compat-align-parm. */
5004
+typedef float v4sf __attribute__ ((vector_size (16)));
5005
+struct s { long m; v4sf v; };
5009
+void pr57949 (long d1, long d2, long d3, long d4, long d5, long d6,
5010
+ long d7, long d8, long d9, struct s vs) {
5015
+/* { dg-final { scan-assembler "ld .\*,136\\(1\\)" } } */
5016
+/* { dg-final { scan-assembler "ld .\*,120\\(1\\)" } } */
5017
--- a/src/gcc/testsuite/gcc.target/powerpc/recip-5.c
5018
+++ b/src/gcc/testsuite/gcc.target/powerpc/recip-5.c
5020
/* { dg-options "-O3 -ftree-vectorize -mrecip=all -ffast-math -mcpu=power7 -fno-unroll-loops" } */
5021
/* { dg-final { scan-assembler-times "xvredp" 4 } } */
5022
/* { dg-final { scan-assembler-times "xvresp" 5 } } */
5023
-/* { dg-final { scan-assembler-times "xsredp" 2 } } */
5024
-/* { dg-final { scan-assembler-times "fres" 2 } } */
5025
+/* { dg-final { scan-assembler-times "xsredp\|fre\ " 2 } } */
5026
+/* { dg-final { scan-assembler-times "xsresp\|fres" 2 } } */
5027
+/* { dg-final { scan-assembler-times "xsmulsp\|fmuls" 2 } } */
5028
+/* { dg-final { scan-assembler-times "xsnmsub.sp\|fnmsubs" 2 } } */
5029
+/* { dg-final { scan-assembler-times "xsmuldp\|fmul\ " 2 } } */
5030
+/* { dg-final { scan-assembler-times "xsnmsub.dp\|fnmsub\ " 4 } } */
5031
+/* { dg-final { scan-assembler-times "xvmulsp" 7 } } */
5032
+/* { dg-final { scan-assembler-times "xvnmsub.sp" 5 } } */
5033
+/* { dg-final { scan-assembler-times "xvmuldp" 6 } } */
5034
+/* { dg-final { scan-assembler-times "xvnmsub.dp" 8 } } */
5036
#include <altivec.h>
5038
--- a/src/gcc/testsuite/gcc.target/powerpc/ppc64-abi-1.c
5039
+++ b/src/gcc/testsuite/gcc.target/powerpc/ppc64-abi-1.c
5051
--- a/src/gcc/testsuite/gcc.target/powerpc/direct-move-float2.c
5052
+++ b/src/gcc/testsuite/gcc.target/powerpc/direct-move-float2.c
5054
+/* { dg-do run { target { powerpc*-*-linux* && lp64 } } } */
5055
+/* { dg-skip-if "" { powerpc*-*-darwin* } { "*" } { "" } } */
5056
+/* { dg-skip-if "" { powerpc*-*-*spe* } { "*" } { "" } } */
5057
+/* { dg-require-effective-target p8vector_hw } */
5058
+/* { dg-options "-mcpu=power8 -O2" } */
5060
+/* Check whether we get the right bits for direct move at runtime. */
5064
+#define NO_ALTIVEC 1
5066
+#define VSX_REG_ATTR "ww"
5068
+#include "direct-move.h"
5069
--- a/src/gcc/testsuite/gcc.target/powerpc/direct-move-double1.c
5070
+++ b/src/gcc/testsuite/gcc.target/powerpc/direct-move-double1.c
5072
+/* { dg-do compile { target { powerpc*-*-linux* && lp64 } } } */
5073
+/* { dg-skip-if "" { powerpc*-*-darwin* } { "*" } { "" } } */
5074
+/* { dg-skip-if "" { powerpc*-*-*spe* } { "*" } { "" } } */
5075
+/* { dg-require-effective-target powerpc_p8vector_ok } */
5076
+/* { dg-options "-mcpu=power8 -O2" } */
5077
+/* { dg-final { scan-assembler "mtvsrd" } } */
5078
+/* { dg-final { scan-assembler "mfvsrd" } } */
5080
+/* Check code generation for direct move for double types. */
5082
+#define TYPE double
5084
+#define NO_ALTIVEC 1
5085
+#define VSX_REG_ATTR "ws"
5087
+#include "direct-move.h"
5088
--- a/src/gcc/testsuite/gcc.target/powerpc/dfp-td-3.c
5089
+++ b/src/gcc/testsuite/gcc.target/powerpc/dfp-td-3.c
5091
+/* Test generation of DFP instructions for POWER6. */
5092
+/* { dg-do compile { target { powerpc*-*-linux* && powerpc_fprs } } } */
5093
+/* { dg-options "-std=gnu99 -O1 -mcpu=power6" } */
5095
+/* { dg-final { scan-assembler-times "fneg" 1 } } */
5096
+/* { dg-final { scan-assembler-times "fabs" 1 } } */
5097
+/* { dg-final { scan-assembler-times "fnabs" 1 } } */
5098
+/* { dg-final { scan-assembler-times "fmr" 3 } } */
5100
+/* These tests verify we generate fneg, fabs and fnabs and
5101
+ associated fmr's since these are not done in place. */
5104
+func1 (_Decimal128 a, _Decimal128 b)
5110
+func2 (_Decimal128 a, _Decimal128 b)
5112
+ return __builtin_fabsd128 (b);
5116
+func3 (_Decimal128 a, _Decimal128 b)
5118
+ return - __builtin_fabsd128 (b);
5120
--- a/src/gcc/testsuite/gcc.target/powerpc/p8vector-builtin-6.c
5121
+++ b/src/gcc/testsuite/gcc.target/powerpc/p8vector-builtin-6.c
5123
+/* { dg-do compile { target { powerpc*-*-* } } } */
5124
+/* { dg-skip-if "" { powerpc*-*-darwin* } { "*" } { "" } } */
5125
+/* { dg-require-effective-target powerpc_p8vector_ok } */
5126
+/* { dg-options "-mcpu=power8 -O2" } */
5128
+vector float dbl_to_float_p8 (double x) { return __builtin_vsx_xscvdpspn (x); }
5129
+double float_to_dbl_p8 (vector float x) { return __builtin_vsx_xscvspdpn (x); }
5131
+/* { dg-final { scan-assembler "xscvdpspn" } } */
5132
+/* { dg-final { scan-assembler "xscvspdpn" } } */
5133
--- a/src/gcc/testsuite/gcc.target/powerpc/vsx-builtin-3.c
5134
+++ b/src/gcc/testsuite/gcc.target/powerpc/vsx-builtin-3.c
5136
/* { dg-final { scan-assembler "xvrspiz" } } */
5137
/* { dg-final { scan-assembler "xsrdpi" } } */
5138
/* { dg-final { scan-assembler "xsrdpic" } } */
5139
-/* { dg-final { scan-assembler "xsrdpim" } } */
5140
-/* { dg-final { scan-assembler "xsrdpip" } } */
5141
-/* { dg-final { scan-assembler "xsrdpiz" } } */
5142
+/* { dg-final { scan-assembler "xsrdpim\|frim" } } */
5143
+/* { dg-final { scan-assembler "xsrdpip\|frip" } } */
5144
+/* { dg-final { scan-assembler "xsrdpiz\|friz" } } */
5145
/* { dg-final { scan-assembler "xsmaxdp" } } */
5146
/* { dg-final { scan-assembler "xsmindp" } } */
5147
/* { dg-final { scan-assembler "xxland" } } */
5148
--- a/src/gcc/testsuite/gcc.target/powerpc/htm-builtin-1.c
5149
+++ b/src/gcc/testsuite/gcc.target/powerpc/htm-builtin-1.c
5151
+/* { dg-do compile { target { powerpc*-*-* } } } */
5152
+/* { dg-skip-if "" { powerpc*-*-darwin* } { "*" } { "" } } */
5153
+/* { dg-require-effective-target powerpc_htm_ok } */
5154
+/* { dg-options "-O2 -mhtm" } */
5156
+/* { dg-final { scan-assembler-times "tbegin\\." 1 } } */
5157
+/* { dg-final { scan-assembler-times "tend\\." 2 } } */
5158
+/* { dg-final { scan-assembler-times "tabort\\." 2 } } */
5159
+/* { dg-final { scan-assembler-times "tabortdc\\." 1 } } */
5160
+/* { dg-final { scan-assembler-times "tabortdci\\." 1 } } */
5161
+/* { dg-final { scan-assembler-times "tabortwc\\." 1 } } */
5162
+/* { dg-final { scan-assembler-times "tabortwci\\." 2 } } */
5163
+/* { dg-final { scan-assembler-times "tcheck\\." 1 } } */
5164
+/* { dg-final { scan-assembler-times "trechkpt\\." 1 } } */
5165
+/* { dg-final { scan-assembler-times "treclaim\\." 1 } } */
5166
+/* { dg-final { scan-assembler-times "tsr\\." 3 } } */
5167
+/* { dg-final { scan-assembler-times "mfspr" 4 } } */
5168
+/* { dg-final { scan-assembler-times "mtspr" 4 } } */
5170
+void use_builtins (long *p, char code, long *a, long *b)
5172
+ p[0] = __builtin_tbegin (0);
5173
+ p[1] = __builtin_tend (0);
5174
+ p[2] = __builtin_tendall ();
5175
+ p[3] = __builtin_tabort (0);
5176
+ p[4] = __builtin_tabort (code);
5178
+ p[5] = __builtin_tabortdc (0xf, a[5], b[5]);
5179
+ p[6] = __builtin_tabortdci (0xf, a[6], 13);
5180
+ p[7] = __builtin_tabortwc (0xf, a[7], b[7]);
5181
+ p[8] = __builtin_tabortwci (0xf, a[8], 13);
5183
+ p[9] = __builtin_tcheck (5);
5184
+ p[10] = __builtin_trechkpt ();
5185
+ p[11] = __builtin_treclaim (0);
5186
+ p[12] = __builtin_tresume ();
5187
+ p[13] = __builtin_tsuspend ();
5188
+ p[14] = __builtin_tsr (0);
5189
+ p[15] = __builtin_ttest (); /* This expands to a tabortwci. */
5192
+ p[16] = __builtin_get_texasr ();
5193
+ p[17] = __builtin_get_texasru ();
5194
+ p[18] = __builtin_get_tfhar ();
5195
+ p[19] = __builtin_get_tfiar ();
5197
+ __builtin_set_texasr (a[20]);
5198
+ __builtin_set_texasru (a[21]);
5199
+ __builtin_set_tfhar (a[22]);
5200
+ __builtin_set_tfiar (a[23]);
5202
--- a/src/gcc/testsuite/gcc.target/powerpc/bool.c
5203
+++ b/src/gcc/testsuite/gcc.target/powerpc/bool.c
5205
+/* { dg-do compile { target { powerpc*-*-* } } } */
5206
+/* { dg-options "-O2" } */
5207
+/* { dg-final { scan-assembler "eqv" } } */
5208
+/* { dg-final { scan-assembler "nand" } } */
5209
+/* { dg-final { scan-assembler "nor" } } */
5212
+#define TYPE unsigned long
5215
+TYPE op1 (TYPE a, TYPE b) { return ~(a ^ b); } /* eqv */
5216
+TYPE op2 (TYPE a, TYPE b) { return ~(a & b); } /* nand */
5217
+TYPE op3 (TYPE a, TYPE b) { return ~(a | b); } /* nor */
5219
--- a/src/gcc/testsuite/gcc.target/powerpc/bool2-p5.c
5220
+++ b/src/gcc/testsuite/gcc.target/powerpc/bool2-p5.c
5222
+/* { dg-do compile { target { powerpc*-*-* } } } */
5223
+/* { dg-skip-if "" { powerpc*-*-darwin* } { "*" } { "" } } */
5224
+/* { dg-require-effective-target powerpc_altivec_ok } */
5225
+/* { dg-options "-O2 -mcpu=power5 -mabi=altivec -mno-altivec -mno-vsx" } */
5226
+/* { dg-final { scan-assembler "\[ \t\]and " } } */
5227
+/* { dg-final { scan-assembler "\[ \t\]or " } } */
5228
+/* { dg-final { scan-assembler "\[ \t\]xor " } } */
5229
+/* { dg-final { scan-assembler "\[ \t\]nor " } } */
5230
+/* { dg-final { scan-assembler "\[ \t\]andc " } } */
5231
+/* { dg-final { scan-assembler "\[ \t\]eqv " } } */
5232
+/* { dg-final { scan-assembler "\[ \t\]orc " } } */
5233
+/* { dg-final { scan-assembler "\[ \t\]nand " } } */
5234
+/* { dg-final { scan-assembler-not "\[ \t\]vand " } } */
5235
+/* { dg-final { scan-assembler-not "\[ \t\]vandc " } } */
5236
+/* { dg-final { scan-assembler-not "\[ \t\]vor " } } */
5237
+/* { dg-final { scan-assembler-not "\[ \t\]vxor " } } */
5238
+/* { dg-final { scan-assembler-not "\[ \t\]vnor " } } */
5239
+/* { dg-final { scan-assembler-not "\[ \t\]xxland " } } */
5240
+/* { dg-final { scan-assembler-not "\[ \t\]xxlor " } } */
5241
+/* { dg-final { scan-assembler-not "\[ \t\]xxlxor " } } */
5242
+/* { dg-final { scan-assembler-not "\[ \t\]xxlnor " } } */
5243
+/* { dg-final { scan-assembler-not "\[ \t\]xxlandc " } } */
5244
+/* { dg-final { scan-assembler-not "\[ \t\]xxleqv " } } */
5245
+/* { dg-final { scan-assembler-not "\[ \t\]xxlorc " } } */
5246
+/* { dg-final { scan-assembler-not "\[ \t\]xxlnand " } } */
5249
+typedef int v4si __attribute__ ((vector_size (16)));
5254
--- a/src/gcc/testsuite/gcc.target/powerpc/fusion.c
5255
+++ b/src/gcc/testsuite/gcc.target/powerpc/fusion.c
5257
+/* { dg-do compile { target { powerpc*-*-* } } } */
5258
+/* { dg-skip-if "" { powerpc*-*-darwin* } { "*" } { "" } } */
5259
+/* { dg-skip-if "" { powerpc*le-*-* } { "*" } { "" } } */
5260
+/* { dg-require-effective-target powerpc_p8vector_ok } */
5261
+/* { dg-options "-mcpu=power7 -mtune=power8 -O3" } */
5263
+#define LARGE 0x12345
5265
+int fusion_uchar (unsigned char *p){ return p[LARGE]; }
5266
+int fusion_schar (signed char *p){ return p[LARGE]; }
5267
+int fusion_ushort (unsigned short *p){ return p[LARGE]; }
5268
+int fusion_short (short *p){ return p[LARGE]; }
5269
+int fusion_int (int *p){ return p[LARGE]; }
5270
+unsigned fusion_uns (unsigned *p){ return p[LARGE]; }
5272
+vector double fusion_vector (vector double *p) { return p[2]; }
5274
+/* { dg-final { scan-assembler-times "gpr load fusion" 6 } } */
5275
+/* { dg-final { scan-assembler-times "vector load fusion" 1 } } */
5276
+/* { dg-final { scan-assembler-times "lbz" 2 } } */
5277
+/* { dg-final { scan-assembler-times "extsb" 1 } } */
5278
+/* { dg-final { scan-assembler-times "lhz" 2 } } */
5279
+/* { dg-final { scan-assembler-times "extsh" 1 } } */
5280
+/* { dg-final { scan-assembler-times "lwz" 2 } } */
5281
--- a/src/gcc/testsuite/gcc.target/powerpc/ppc64-abi-2.c
5282
+++ b/src/gcc/testsuite/gcc.target/powerpc/ppc64-abi-2.c
5283
@@ -107,8 +107,10 @@
5294
@@ -119,6 +121,12 @@
5298
+#ifdef __LITTLE_ENDIAN__
5299
+#define MAKE_SLOT(x, y) ((long)x | ((long)y << 32))
5301
+#define MAKE_SLOT(x, y) ((long)y | ((long)x << 32))
5304
/* Paramter passing.
5308
sp = __builtin_frame_address(0);
5311
- if (sp->slot[2].l != 0x100000002ULL
5312
- || sp->slot[4].l != 0x500000006ULL)
5313
+ if (sp->slot[2].l != MAKE_SLOT (1, 2)
5314
+ || sp->slot[4].l != MAKE_SLOT (5, 6))
5319
sp = __builtin_frame_address(0);
5322
- if (sp->slot[4].l != 0x100000002ULL
5323
- || sp->slot[6].l != 0x500000006ULL)
5324
+ if (sp->slot[4].l != MAKE_SLOT (1, 2)
5325
+ || sp->slot[6].l != MAKE_SLOT (5, 6))
5330
sp = __builtin_frame_address(0);
5333
- if (sp->slot[4].l != 0x100000002ULL
5334
- || sp->slot[6].l != 0x500000006ULL)
5335
+ if (sp->slot[4].l != MAKE_SLOT (1, 2)
5336
+ || sp->slot[6].l != MAKE_SLOT (5, 6))
5340
--- a/src/gcc/testsuite/gcc.target/powerpc/direct-move-long1.c
5341
+++ b/src/gcc/testsuite/gcc.target/powerpc/direct-move-long1.c
5343
+/* { dg-do compile { target { powerpc*-*-linux* && lp64 } } } */
5344
+/* { dg-skip-if "" { powerpc*-*-darwin* } { "*" } { "" } } */
5345
+/* { dg-skip-if "" { powerpc*-*-*spe* } { "*" } { "" } } */
5346
+/* { dg-require-effective-target powerpc_p8vector_ok } */
5347
+/* { dg-options "-mcpu=power8 -O2" } */
5348
+/* { dg-final { scan-assembler "mtvsrd" } } */
5349
+/* { dg-final { scan-assembler "mfvsrd" } } */
5351
+/* Check code generation for direct move for long types. */
5355
+#define NO_ALTIVEC 1
5356
+#define VSX_REG_ATTR "d"
5358
+#include "direct-move.h"
5359
--- a/src/gcc/testsuite/gcc.target/powerpc/direct-move-double2.c
5360
+++ b/src/gcc/testsuite/gcc.target/powerpc/direct-move-double2.c
5362
+/* { dg-do run { target { powerpc*-*-linux* && lp64 } } } */
5363
+/* { dg-skip-if "" { powerpc*-*-darwin* } { "*" } { "" } } */
5364
+/* { dg-skip-if "" { powerpc*-*-*spe* } { "*" } { "" } } */
5365
+/* { dg-require-effective-target p8vector_hw } */
5366
+/* { dg-options "-mcpu=power8 -O2" } */
5368
+/* Check whether we get the right bits for direct move at runtime. */
5370
+#define TYPE double
5372
+#define NO_ALTIVEC 1
5374
+#define VSX_REG_ATTR "ws"
5376
+#include "direct-move.h"
5377
--- a/src/gcc/testsuite/gcc.target/powerpc/p8vector-builtin-7.c
5378
+++ b/src/gcc/testsuite/gcc.target/powerpc/p8vector-builtin-7.c
5380
+/* { dg-do compile { target { powerpc*-*-* } } } */
5381
+/* { dg-skip-if "" { powerpc*-*-darwin* } { "*" } { "" } } */
5382
+/* { dg-require-effective-target powerpc_p8vector_ok } */
5383
+/* { dg-options "-mcpu=power8 -O2" } */
5385
+#include <altivec.h>
5387
+typedef vector int v_sign;
5388
+typedef vector unsigned int v_uns;
5390
+v_sign even_sign (v_sign a, v_sign b)
5392
+ return vec_vmrgew (a, b);
5395
+v_uns even_uns (v_uns a, v_uns b)
5397
+ return vec_vmrgew (a, b);
5400
+v_sign odd_sign (v_sign a, v_sign b)
5402
+ return vec_vmrgow (a, b);
5405
+v_uns odd_uns (v_uns a, v_uns b)
5407
+ return vec_vmrgow (a, b);
5410
+/* { dg-final { scan-assembler-times "vmrgew" 2 } } */
5411
+/* { dg-final { scan-assembler-times "vmrgow" 2 } } */
5412
--- a/src/gcc/testsuite/gcc.target/powerpc/bool2.h
5413
+++ b/src/gcc/testsuite/gcc.target/powerpc/bool2.h
5415
+/* Test various logical operations. */
5417
+TYPE arg1 (TYPE p, TYPE q) { return p & q; } /* AND */
5418
+TYPE arg2 (TYPE p, TYPE q) { return p | q; } /* OR */
5419
+TYPE arg3 (TYPE p, TYPE q) { return p ^ q; } /* XOR */
5420
+TYPE arg4 (TYPE p) { return ~ p; } /* NOR */
5421
+TYPE arg5 (TYPE p, TYPE q) { return ~(p & q); } /* NAND */
5422
+TYPE arg6 (TYPE p, TYPE q) { return ~(p | q); } /* NOR */
5423
+TYPE arg7 (TYPE p, TYPE q) { return ~(p ^ q); } /* EQV */
5424
+TYPE arg8 (TYPE p, TYPE q) { return (~p) & q; } /* ANDC */
5425
+TYPE arg9 (TYPE p, TYPE q) { return (~p) | q; } /* ORC */
5426
+TYPE arg10(TYPE p, TYPE q) { return (~p) ^ q; } /* EQV */
5427
+TYPE arg11(TYPE p, TYPE q) { return p & (~q); } /* ANDC */
5428
+TYPE arg12(TYPE p, TYPE q) { return p | (~q); } /* ORC */
5429
+TYPE arg13(TYPE p, TYPE q) { return p ^ (~q); } /* EQV */
5431
+void ptr1 (TYPE *p) { p[0] = p[1] & p[2]; } /* AND */
5432
+void ptr2 (TYPE *p) { p[0] = p[1] | p[2]; } /* OR */
5433
+void ptr3 (TYPE *p) { p[0] = p[1] ^ p[2]; } /* XOR */
5434
+void ptr4 (TYPE *p) { p[0] = ~p[1]; } /* NOR */
5435
+void ptr5 (TYPE *p) { p[0] = ~(p[1] & p[2]); } /* NAND */
5436
+void ptr6 (TYPE *p) { p[0] = ~(p[1] | p[2]); } /* NOR */
5437
+void ptr7 (TYPE *p) { p[0] = ~(p[1] ^ p[2]); } /* EQV */
5438
+void ptr8 (TYPE *p) { p[0] = ~(p[1]) & p[2]; } /* ANDC */
5439
+void ptr9 (TYPE *p) { p[0] = (~p[1]) | p[2]; } /* ORC */
5440
+void ptr10(TYPE *p) { p[0] = (~p[1]) ^ p[2]; } /* EQV */
5441
+void ptr11(TYPE *p) { p[0] = p[1] & (~p[2]); } /* ANDC */
5442
+void ptr12(TYPE *p) { p[0] = p[1] | (~p[2]); } /* ORC */
5443
+void ptr13(TYPE *p) { p[0] = p[1] ^ (~p[2]); } /* EQV */
5444
--- a/src/gcc/testsuite/gcc.target/powerpc/pr48258-1.c
5445
+++ b/src/gcc/testsuite/gcc.target/powerpc/pr48258-1.c
5447
/* { dg-do compile } */
5448
/* { dg-skip-if "" { powerpc*-*-darwin* } { "*" } { "" } } */
5449
+/* { dg-skip-if "" { powerpc*le-*-* } { "*" } { "" } } */
5450
/* { dg-require-effective-target powerpc_vsx_ok } */
5451
/* { dg-options "-O3 -mcpu=power7 -mabi=altivec -ffast-math -fno-unroll-loops" } */
5452
/* { dg-final { scan-assembler-times "xvaddsp" 3 } } */
5453
--- a/src/gcc/testsuite/gcc.target/powerpc/ppc64-abi-dfp-1.c
5454
+++ b/src/gcc/testsuite/gcc.target/powerpc/ppc64-abi-dfp-1.c
5458
/* Wrapper to save the GPRs and FPRs and then jump to the real function. */
5460
+#define FUNC_START(NAME) \
5461
+ "\t.globl\t" NAME "\n\t" \
5462
+ ".section \".opd\",\"aw\"\n\t" \
5465
+ ".quad .L." NAME ",.TOC.@tocbase,0\n\t" \
5467
+ ".type " NAME ", @function\n" \
5468
+ ".L." NAME ":\n\t"
5470
+#define FUNC_START(NAME) \
5471
+ "\t.globl\t" NAME "\n\t" \
5474
+ "0:\taddis 2,12,(.TOC.-0b)@ha\n\t" \
5475
+ "addi 2,2,(.TOC.-0b)@l\n\t" \
5476
+ ".localentry " NAME ",.-" NAME "\n\t"
5478
#define WRAPPER(NAME) \
5479
-__asm__ ("\t.globl\t" #NAME "_asm\n\t" \
5480
- ".section \".opd\",\"aw\"\n\t" \
5482
- #NAME "_asm:\n\t" \
5483
- ".quad .L." #NAME "_asm,.TOC.@tocbase,0\n\t" \
5485
- ".type " #NAME "_asm, @function\n" \
5486
- ".L." #NAME "_asm:\n\t" \
5487
+__asm__ (FUNC_START (#NAME "_asm") \
5488
"ld 11,gparms@got(2)\n\t" \
5499
unsigned long slot[100];
5502
--- a/src/gcc/testsuite/gcc.target/powerpc/direct-move-long2.c
5503
+++ b/src/gcc/testsuite/gcc.target/powerpc/direct-move-long2.c
5505
+/* { dg-do run { target { powerpc*-*-linux* && lp64 } } } */
5506
+/* { dg-skip-if "" { powerpc*-*-darwin* } { "*" } { "" } } */
5507
+/* { dg-skip-if "" { powerpc*-*-*spe* } { "*" } { "" } } */
5508
+/* { dg-require-effective-target p8vector_hw } */
5509
+/* { dg-options "-mcpu=power8 -O2" } */
5511
+/* Check whether we get the right bits for direct move at runtime. */
5515
+#define NO_ALTIVEC 1
5517
+#define VSX_REG_ATTR "d"
5519
+#include "direct-move.h"
5520
--- a/src/gcc/testsuite/gcc.target/powerpc/vsx-float0.c
5521
+++ b/src/gcc/testsuite/gcc.target/powerpc/vsx-float0.c
5523
+/* { dg-do compile { target { powerpc*-*-* } } } */
5524
+/* { dg-skip-if "" { powerpc*-*-darwin* } { "*" } { "" } } */
5525
+/* { dg-require-effective-target powerpc_vsx_ok } */
5526
+/* { dg-options "-O2 -mcpu=power7" } */
5527
+/* { dg-final { scan-assembler "xxlxor" } } */
5529
+/* Test that we generate xxlor to clear a SFmode register. */
5531
+float sum (float *p, unsigned long n)
5533
+ float sum = 0.0f; /* generate xxlxor instead of load */
5539
--- a/src/gcc/testsuite/gcc.target/powerpc/ppc-target-1.c
5540
+++ b/src/gcc/testsuite/gcc.target/powerpc/ppc-target-1.c
5542
/* { dg-final { scan-assembler-times "fabs" 3 } } */
5543
/* { dg-final { scan-assembler-times "fnabs" 3 } } */
5544
/* { dg-final { scan-assembler-times "fsel" 3 } } */
5545
-/* { dg-final { scan-assembler-times "fcpsgn" 3 } } */
5546
-/* { dg-final { scan-assembler-times "xscpsgndp" 1 } } */
5547
+/* { dg-final { scan-assembler-times "fcpsgn\|xscpsgndp" 4 } } */
5549
double normal1 (double, double);
5550
double power5 (double, double) __attribute__((__target__("cpu=power5")));
5551
--- a/src/gcc/testsuite/gcc.target/powerpc/bool3.h
5552
+++ b/src/gcc/testsuite/gcc.target/powerpc/bool3.h
5554
+/* Test forcing 128-bit logical types into GPR registers. */
5556
+#if defined(NO_ASM)
5557
+#define FORCE_REG1(X)
5558
+#define FORCE_REG2(X,Y)
5561
+#if defined(USE_ALTIVEC)
5562
+#define REG_CLASS "+v"
5563
+#define PRINT_REG1 "# altivec reg %0"
5564
+#define PRINT_REG2 "# altivec reg %0, %1"
5566
+#elif defined(USE_FPR)
5567
+#define REG_CLASS "+d"
5568
+#define PRINT_REG1 "# fpr reg %0"
5569
+#define PRINT_REG2 "# fpr reg %0, %1"
5571
+#elif defined(USE_VSX)
5572
+#define REG_CLASS "+wa"
5573
+#define PRINT_REG1 "# vsx reg %x0"
5574
+#define PRINT_REG2 "# vsx reg %x0, %x1"
5577
+#define REG_CLASS "+r"
5578
+#define PRINT_REG1 "# gpr reg %0"
5579
+#define PRINT_REG2 "# gpr reg %0, %1"
5582
+#define FORCE_REG1(X) __asm__ (PRINT_REG1 : REG_CLASS (X))
5583
+#define FORCE_REG2(X,Y) __asm__ (PRINT_REG2 : REG_CLASS (X), REG_CLASS (Y))
5586
+void ptr1 (TYPE *p)
5592
+ FORCE_REG2 (a, b);
5593
+ c = a & b; /* AND */
5598
+void ptr2 (TYPE *p)
5604
+ FORCE_REG2 (a, b);
5605
+ c = a | b; /* OR */
5610
+void ptr3 (TYPE *p)
5616
+ FORCE_REG2 (a, b);
5617
+ c = a ^ b; /* XOR */
5622
+void ptr4 (TYPE *p)
5633
+void ptr5 (TYPE *p)
5639
+ FORCE_REG2 (a, b);
5640
+ c = ~(a & b); /* NAND */
5645
+void ptr6 (TYPE *p)
5651
+ FORCE_REG2 (a, b);
5652
+ c = ~(a | b); /* AND */
5657
+void ptr7 (TYPE *p)
5663
+ FORCE_REG2 (a, b);
5664
+ c = ~(a ^ b); /* EQV */
5669
+void ptr8 (TYPE *p)
5675
+ FORCE_REG2 (a, b);
5676
+ c = (~a) & b; /* ANDC */
5681
+void ptr9 (TYPE *p)
5687
+ FORCE_REG2 (a, b);
5688
+ c = (~a) | b; /* ORC */
5693
+void ptr10 (TYPE *p)
5699
+ FORCE_REG2 (a, b);
5700
+ c = (~a) ^ b; /* EQV */
5705
+void ptr11 (TYPE *p)
5711
+ FORCE_REG2 (a, b);
5712
+ c = a & (~b); /* ANDC */
5717
+void ptr12 (TYPE *p)
5723
+ FORCE_REG2 (a, b);
5724
+ c = a | (~b); /* ORC */
5729
+void ptr13 (TYPE *p)
5735
+ FORCE_REG2 (a, b);
5736
+ c = a ^ (~b); /* AND */
5740
--- a/src/gcc/testsuite/gcc.target/powerpc/altivec-perm-1.c
5741
+++ b/src/gcc/testsuite/gcc.target/powerpc/altivec-perm-1.c
5743
return __builtin_shuffle(x, (V){ 4,5,6,7, 4,5,6,7, 4,5,6,7, 4,5,6,7, });
5748
- return __builtin_shuffle(x, y,
5749
- (V){ 1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29, 31 });
5755
- return __builtin_shuffle(x, y,
5756
- (V){ 2, 3, 6, 7, 10, 11, 14, 15, 18, 19, 22, 23, 26, 27, 30, 31 });
5761
return __builtin_shuffle(x, y,
5763
/* { dg-final { scan-assembler "vspltb" } } */
5764
/* { dg-final { scan-assembler "vsplth" } } */
5765
/* { dg-final { scan-assembler "vspltw" } } */
5766
-/* { dg-final { scan-assembler "vpkuhum" } } */
5767
-/* { dg-final { scan-assembler "vpkuwum" } } */
5768
--- a/src/gcc/testsuite/gcc.target/powerpc/bool2-p7.c
5769
+++ b/src/gcc/testsuite/gcc.target/powerpc/bool2-p7.c
5771
+/* { dg-do compile { target { powerpc*-*-* } } } */
5772
+/* { dg-skip-if "" { powerpc*-*-darwin* } { "*" } { "" } } */
5773
+/* { dg-require-effective-target powerpc_vsx_ok } */
5774
+/* { dg-options "-O2 -mcpu=power7" } */
5775
+/* { dg-final { scan-assembler-not "\[ \t\]and " } } */
5776
+/* { dg-final { scan-assembler-not "\[ \t\]or " } } */
5777
+/* { dg-final { scan-assembler-not "\[ \t\]xor " } } */
5778
+/* { dg-final { scan-assembler-not "\[ \t\]nor " } } */
5779
+/* { dg-final { scan-assembler-not "\[ \t\]eqv " } } */
5780
+/* { dg-final { scan-assembler-not "\[ \t\]andc " } } */
5781
+/* { dg-final { scan-assembler-not "\[ \t\]orc " } } */
5782
+/* { dg-final { scan-assembler-not "\[ \t\]nand " } } */
5783
+/* { dg-final { scan-assembler-not "\[ \t\]vand " } } */
5784
+/* { dg-final { scan-assembler-not "\[ \t\]vor " } } */
5785
+/* { dg-final { scan-assembler-not "\[ \t\]vxor " } } */
5786
+/* { dg-final { scan-assembler-not "\[ \t\]vnor " } } */
5787
+/* { dg-final { scan-assembler "\[ \t\]xxland " } } */
5788
+/* { dg-final { scan-assembler "\[ \t\]xxlor " } } */
5789
+/* { dg-final { scan-assembler "\[ \t\]xxlxor " } } */
5790
+/* { dg-final { scan-assembler "\[ \t\]xxlnor " } } */
5791
+/* { dg-final { scan-assembler "\[ \t\]xxlandc " } } */
5792
+/* { dg-final { scan-assembler-not "\[ \t\]xxleqv " } } */
5793
+/* { dg-final { scan-assembler-not "\[ \t\]xxlorc " } } */
5794
+/* { dg-final { scan-assembler-not "\[ \t\]xxlnand " } } */
5797
+typedef int v4si __attribute__ ((vector_size (16)));
5802
--- a/src/gcc/testsuite/ChangeLog.ibm
5803
+++ b/src/gcc/testsuite/ChangeLog.ibm
5805
+2013-12-03 Bill Schmidt <wschmidt@linux.vnet.ibm.com>
5807
+ Backport from mainline r205638
5808
+ 2013-12-03 Bill Schmidt <wschmidt@linux.vnet.ibm.com>
5810
+ * gcc.dg/vect/costmodel/ppc/costmodel-slp-34.c: Skip for little
5813
+2013-11-27 Bill Schmidt <wschmidt@linux.vnet.ibm.com>
5815
+ Backport from mainline r205464
5816
+ 2013-11-27 Bill Schmidt <wschmidt@linux.vnet.ibm.com>
5818
+ * gfortran.dg/nan_7.f90: Disable for little endian PowerPC.
5820
+2013-11-22 Michael Meissner <meissner@linux.vnet.ibm.com>
5822
+ Backport from mainline
5823
+ 2013-11-22 Michael Meissner <meissner@linux.vnet.ibm.com>
5826
+ * gcc.target/powerpc/direct-move.h (VSX_REG_ATTR): Allow test to
5827
+ specify an appropriate register class for VSX operations.
5828
+ (load_vsx): Use it.
5829
+ (load_gpr_to_vsx): Likewise.
5830
+ (load_vsx_to_gpr): Likewise.
5831
+ * gcc.target/powerpc/direct-move-vint1.c: Use an appropriate
5832
+ register class for VSX registers that the type can handle. Remove
5833
+ checks for explicit number of instructions generated, just check
5834
+ if the instruction is generated.
5835
+ * gcc.target/powerpc/direct-move-vint2.c: Likewise.
5836
+ * gcc.target/powerpc/direct-move-float1.c: Likewise.
5837
+ * gcc.target/powerpc/direct-move-float2.c: Likewise.
5838
+ * gcc.target/powerpc/direct-move-double1.c: Likewise.
5839
+ * gcc.target/powerpc/direct-move-double2.c: Likewise.
5840
+ * gcc.target/powerpc/direct-move-long1.c: Likewise.
5841
+ * gcc.target/powerpc/direct-move-long2.c: Likewise.
5843
+ * gcc.target/powerpc/bool3-av.c: Limit to 64-bit mode for now.
5844
+ * gcc.target/powerpc/bool3-p7.c: Likewise.
5845
+ * gcc.target/powerpc/bool3-p8.c: Likewise.
5847
+ * gcc.target/powerpc/p8vector-ldst.c: Just check that the
5848
+ appropriate instructions are generated, don't check the count.
5850
+ 2013-11-12 Michael Meissner <meissner@linux.vnet.ibm.com>
5853
+ * gcc.target/powerpc/pr59054.c: New test.
5855
+2013-11-20 Bill Schmidt <wschmidt@linux.vnet.ibm.com>
5857
+ Backport from mainline r205146
5858
+ 2013-11-20 Bill Schmidt <wschmidt@linux.vnet.ibm.com>
5860
+ * gcc.target/powerpc/pr48258-1.c: Skip for little endian.
5862
+2013-11-20 Ulrich Weigand <Ulrich.Weigand@de.ibm.com>
5864
+ Backport from mainline r205106:
5866
+ 2013-11-20 Ulrich Weigand <Ulrich.Weigand@de.ibm.com>
5868
+ * gcc.target/powerpc/darwin-longlong.c (msw): Make endian-safe.
5870
+2013-11-19 Ulrich Weigand <Ulrich.Weigand@de.ibm.com>
5872
+ Backport from mainline r205046:
5874
+ 2013-11-19 Ulrich Weigand <Ulrich.Weigand@de.ibm.com>
5876
+ * gcc.target/powerpc/ppc64-abi-2.c (MAKE_SLOT): New macro to
5877
+ construct parameter slot value in endian-independent way.
5878
+ (fcevv, fciievv, fcvevv): Use it.
5880
+2013-11-15 Bill Schmidt <wschmidt@linux.vnet.ibm.com>
5882
+ Backport from mainline r204862
5883
+ 2013-11-15 Bill Schmidt <wschmidt@linux.vnet.ibm.com>
5885
+ * gcc.dg/vmx/3b-15.c: Revise for little endian.
5887
+2013-11-15 Ulrich Weigand <Ulrich.Weigand@de.ibm.com>
5889
+ Backport from mainline r204808:
5891
+ 2013-11-14 Ulrich Weigand <Ulrich.Weigand@de.ibm.com>
5893
+ * gcc.target/powerpc/ppc64-abi-1.c (stack_frame_t): Remove
5894
+ compiler and linker field if _CALL_ELF == 2.
5895
+ * gcc.target/powerpc/ppc64-abi-2.c (stack_frame_t): Likewise.
5896
+ * gcc.target/powerpc/ppc64-abi-dfp-1.c (stack_frame_t): Likewise.
5897
+ * gcc.dg/stack-usage-1.c (SIZE): Update value for _CALL_ELF == 2.
5899
+ 2013-11-14 Ulrich Weigand <Ulrich.Weigand@de.ibm.com>
5901
+ * gcc.target/powerpc/ppc64-abi-dfp-1.c (FUNC_START): New macro.
5902
+ (WRAPPER): Use it.
5903
+ * gcc.target/powerpc/no-r11-1.c: Skip on powerpc_elfv2.
5904
+ * gcc.target/powerpc/no-r11-2.c: Skip on powerpc_elfv2.
5905
+ * gcc.target/powerpc/no-r11-3.c: Skip on powerpc_elfv2.
5907
+ 2013-11-14 Ulrich Weigand <Ulrich.Weigand@de.ibm.com>
5909
+ * lib/target-supports.exp (check_effective_target_powerpc_elfv2):
5911
+ * gcc.target/powerpc/pr57949-1.c: Disable for powerpc_elfv2.
5912
+ * gcc.target/powerpc/pr57949-2.c: Likewise.
5914
+2013-11-15 Ulrich Weigand <Ulrich.Weigand@de.ibm.com>
5916
+ Backport from mainline r204799:
5918
+ 2013-11-14 Ulrich Weigand <Ulrich.Weigand@de.ibm.com>
5920
+ * g++.dg/eh/ppc64-sighandle-cr.C: New test.
5922
+2013-11-15 Ulrich Weigand <Ulrich.Weigand@de.ibm.com>
5924
+ Backport from mainline r201750.
5925
+ Note: Default setting of -mcompat-align-parm inverted!
5927
+ 2013-08-14 Bill Schmidt <wschmidt@linux.vnet.ibm.com>
5930
+ * gcc.target/powerpc/pr57949-1.c: New.
5931
+ * gcc.target/powerpc/pr57949-2.c: New.
5933
+2013-11-15 Ulrich Weigand <Ulrich.Weigand@de.ibm.com>
5935
+ Backport from mainline r201040 and r201929:
5937
+ 2013-08-22 Michael Meissner <meissner@linux.vnet.ibm.com>
5939
+ * gcc.target/powerpc/pr57744.c: Declare abort.
5941
+ 2013-07-18 Pat Haugen <pthaugen@us.ibm.com>
5943
+ * gcc.target/powerpc/pr57744.c: Fix typo.
5945
+2013-11-10 Bill Schmidt <wschmidt@linux.vnet.ibm.com>
5947
+ Backport from mainline r204321
5948
+ 2013-11-02 Bill Schmidt <wschmidt@vnet.linux.ibm.com>
5950
+ * gcc.dg/vmx/vec-set.c: New.
5952
+2013-11-10 Bill Schmidt <wschmidt@linux.vnet.ibm.com>
5954
+ Backport from mainline r204138
5955
+ 2013-10-28 Bill Schmidt <wschmidt@linux.vnet.ibm.com>
5957
+ * gcc.dg/vmx/gcc-bug-i.c: Add little endian variant.
5958
+ * gcc.dg/vmx/eg-5.c: Likewise.
5960
+2013-11-08 Bill Schmidt <wschmidt@linux.vnet.ibm.com>
5962
+ Backport from mainline r203930
5963
+ 2013-10-22 Bill Schmidt <wschmidt@vnet.ibm.com>
5965
+ * gcc.target/powerpc/altivec-perm-1.c: Move the two vector pack
5967
+ * gcc.target/powerpc/altivec-perm-3.c: ...this new test, which is
5968
+ restricted to big-endian targets.
5970
+2013-11-08 Bill Schmidt <wschmidt@linux.vnet.ibm.com>
5972
+ Backport from mainline r203246
5973
+ 2013-10-07 Bill Schmidt <wschmidt@linux.vnet.ibm.com>
5975
+ * gcc.target/powerpc/pr43154.c: Skip for ppc64 little endian.
5976
+ * gcc.target/powerpc/fusion.c: Likewise.
5978
+2013-10-21 Bill Schmidt <wschmidt@linux.vnet.ibm.com>
5980
+ Backport from mainline
5981
+ 2013-04-05 Bill Schmidt <wschmidt@linux.vnet.ibm.com>
5984
+ * gcc.target/powerpc/recip-1.c: Modify expected output.
5985
+ * gcc.target/powerpc/recip-3.c: Likewise.
5986
+ * gcc.target/powerpc/recip-4.c: Likewise.
5987
+ * gcc.target/powerpc/recip-5.c: Add expected output for iterations.
5989
+2013-10-17 Michael Meissner <meissner@linux.vnet.ibm.com>
5991
+ Back port from mainline
5992
+ 2013-10-03 Michael Meissner <meissner@linux.vnet.ibm.com>
5994
+ * gcc.target/powerpc/p8vector-fp.c: New test for floating point
5995
+ scalar operations when using -mupper-regs-sf and -mupper-regs-df.
5996
+ * gcc.target/powerpc/ppc-target-1.c: Update tests to allow either
5997
+ VSX scalar operations or the traditional floating point form of
5999
+ * gcc.target/powerpc/ppc-target-2.c: Likewise.
6000
+ * gcc.target/powerpc/recip-3.c: Likewise.
6001
+ * gcc.target/powerpc/recip-5.c: Likewise.
6002
+ * gcc.target/powerpc/pr72747.c: Likewise.
6003
+ * gcc.target/powerpc/vsx-builtin-3.c: Likewise.
6005
+ Back port from mainline
6006
+ 2013-09-27 Michael Meissner <meissner@linux.vnet.ibm.com>
6008
+ * gcc.target/powerpc/p8vector-ldst.c: New test for -mupper-regs-sf
6009
+ and -mupper-regs-df.
6011
+ Back port from mainline
6012
+ 2013-10-17 Michael Meissner <meissner@linux.vnet.ibm.com>
6015
+ * gcc.target/powerpc/pr58673-1.c: New file to test whether
6016
+ -mquad-word + -mno-vsx-timode causes errors.
6017
+ * gcc.target/powerpc/pr58673-2.c: Likewise.
6019
+2013-08-19 Peter Bergner <bergner@vnet.ibm.com>
6021
+ Back port from mainline
6022
+ 2013-08-19 Peter Bergner <bergner@vnet.ibm.com>
6024
+ * gcc.target/powerpc/dfp-dd-2.c: New test.
6025
+ * gcc.target/powerpc/dfp-td-2.c: Likewise.
6026
+ * gcc.target/powerpc/dfp-td-3.c: Likewise.
6028
+2013-08-16 Michael Meissner <meissner@linux.vnet.ibm.com>
6030
+ Backport from trunk.
6031
+ 2013-07-23 Michael Meissner <meissner@linux.vnet.ibm.com>
6033
+ * gcc.target/powerpc/bool2.h: New file, test the code generation
6034
+ of logical operations for power5, altivec, power7, and power8 systems.
6035
+ * gcc.target/powerpc/bool2-p5.c: Likewise.
6036
+ * gcc.target/powerpc/bool2-av.c: Likewise.
6037
+ * gcc.target/powerpc/bool2-p7.c: Likewise.
6038
+ * gcc.target/powerpc/bool2-p8.c: Likewise.
6039
+ * gcc.target/powerpc/bool3.h: Likewise.
6040
+ * gcc.target/powerpc/bool3-av.c: Likewise.
6041
+ * gcc.target/powerpc/bool2-p7.c: Likewise.
6042
+ * gcc.target/powerpc/bool2-p8.c: Likewise.
6044
+2013-08-16 Michael Meissner <meissner@linux.vnet.ibm.com>
6046
+ Backport from trunk.
6047
+ 2013-07-31 Michael Meissner <meissner@linux.vnet.ibm.com>
6049
+ * gcc.target/powerpc/fusion.c: New file, test power8 fusion support.
6051
+2013-08-05 Michael Meissner <meissner@linux.vnet.ibm.com>
6053
+ Back port from mainline:
6054
+ 2013-06-06 Michael Meissner <meissner@linux.vnet.ibm.com>
6055
+ Pat Haugen <pthaugen@us.ibm.com>
6056
+ Peter Bergner <bergner@vnet.ibm.com>
6058
+ * lib/target-supports.exp (check_p8vector_hw_available) Add power8
6060
+ (check_effective_target_powerpc_p8vector_ok): Likewise.
6061
+ (is-effective-target): Likewise.
6062
+ (check_vect_support_and_set_flags): Likewise.
6064
+2013-08-04 Peter Bergner <bergner@vnet.ibm.com>
6066
+ Back port from mainline
6067
+ 2013-08-01 Fabien Chêne <fabien@gcc.gnu.org>
6068
+ Peter Bergner <bergner@vnet.ibm.com>
6071
+ * g++.dg/overload/using3.C: New.
6072
+ * g++.dg/overload/using2.C: Adjust.
6073
+ * g++.dg/lookup/using9.C: Likewise.
6075
+2013-07-31 Michael Meissner <meissner@linux.vnet.ibm.com>
6077
+ Back port from mainline
6078
+ 2013-07-31 Michael Meissner <meissner@linux.vnet.ibm.com>
6080
+ * gcc.target/powerpc/fusion.c: New file, test power8 fusion
6083
+2013-07-15 Peter Bergner <bergner@vnet.ibm.com>
6085
+ Back port from mainline
6086
+ 2013-07-15 Peter Bergner <bergner@vnet.ibm.com>
6088
+ * lib/target-supports.exp (check_effective_target_powerpc_htm_ok): New
6089
+ function to test if HTM is available.
6090
+ * gcc.target/powerpc/htm-xl-intrin-1.c: New test.
6091
+ * gcc.target/powerpc/htm-builtin-1.c: New test.
6093
+2013-06-28 Michael Meissner <meissner@linux.vnet.ibm.com>
6095
+ Back port from the trunk
6096
+ 2013-06-28 Michael Meissner <meissner@linux.vnet.ibm.com>
6099
+ * gcc.target/powerpc/pr57744.c: New test to make sure lqarx and
6100
+ stqcx. get even registers.
6102
+2013-06-12 Michael Meissner <meissner@linux.vnet.ibm.com>
6104
+ Back port from the trunk
6106
+ 2013-06-12 Michael Meissner <meissner@linux.vnet.ibm.com>
6107
+ Pat Haugen <pthaugen@us.ibm.com>
6108
+ Peter Bergner <bergner@vnet.ibm.com>
6110
+ * gcc.target/powerpc/atomic-p7.c: New file, add tests for atomic
6111
+ load/store instructions on power7, power8.
6112
+ * gcc.target/powerpc/atomic-p8.c: Likewise.
6114
+2013-06-11 Michael Meissner <meissner@linux.vnet.ibm.com>
6116
+ Back port from the trunk
6118
+ 2013-06-11 Michael Meissner <meissner@linux.vnet.ibm.com>
6119
+ Pat Haugen <pthaugen@us.ibm.com>
6120
+ Peter Bergner <bergner@vnet.ibm.com>
6122
+ * gcc.target/powerpc/atomic-p7.c: New file, add tests for atomic
6123
+ load/store instructions on power7, power8.
6124
+ * gcc.target/powerpc/atomic-p8.c: Likewise.
6126
+ Back port from the trunk
6128
+ 2013-06-10 Michael Meissner <meissner@linux.vnet.ibm.com>
6129
+ Pat Haugen <pthaugen@us.ibm.com>
6130
+ Peter Bergner <bergner@vnet.ibm.com>
6132
+ * gcc.target/powerpc/direct-move-vint1.c: New tests for power8
6133
+ direct move instructions.
6134
+ * gcc.target/powerpc/direct-move-vint2.c: Likewise.
6135
+ * gcc.target/powerpc/direct-move.h: Likewise.
6136
+ * gcc.target/powerpc/direct-move-float1.c: Likewise.
6137
+ * gcc.target/powerpc/direct-move-float2.c: Likewise.
6138
+ * gcc.target/powerpc/direct-move-double1.c: Likewise.
6139
+ * gcc.target/powerpc/direct-move-double2.c: Likewise.
6140
+ * gcc.target/powerpc/direct-move-long1.c: Likewise.
6141
+ * gcc.target/powerpc/direct-move-long2.c: Likewise.
6143
+2013-06-06 Michael Meissner <meissner@linux.vnet.ibm.com>
6145
+ Backport from the trunk
6147
+ 2013-06-06 Michael Meissner <meissner@linux.vnet.ibm.com>
6148
+ Pat Haugen <pthaugen@us.ibm.com>
6149
+ Peter Bergner <bergner@vnet.ibm.com>
6151
+ * gcc.target/powerpc/p8vector-builtin-1.c: New test to test
6152
+ power8 builtin functions.
6153
+ * gcc/testsuite/gcc.target/powerpc/p8vector-builtin-2.c: Likewise.
6154
+ * gcc/testsuite/gcc.target/powerpc/p8vector-builtin-3.c: Likewise.
6155
+ * gcc/testsuite/gcc.target/powerpc/p8vector-builtin-4.c: Likewise.
6156
+ * gcc/testsuite/gcc.target/powerpc/p8vector-builtin-5.c: Likewise.
6157
+ * gcc/testsuite/gcc.target/powerpc/p8vector-builtin-6.c: Likewise.
6158
+ * gcc/testsuite/gcc.target/powerpc/p8vector-builtin-7.c: Likewise.
6159
+ * gcc/testsuite/gcc.target/powerpc/p8vector-vectorize-1.c: New
6160
+ tests to test power8 auto-vectorization.
6161
+ * gcc/testsuite/gcc.target/powerpc/p8vector-vectorize-2.c: Likewise.
6162
+ * gcc/testsuite/gcc.target/powerpc/p8vector-vectorize-3.c: Likewise.
6163
+ * gcc/testsuite/gcc.target/powerpc/p8vector-vectorize-4.c: Likewise.
6164
+ * gcc/testsuite/gcc.target/powerpc/p8vector-vectorize-5.c: Likewise.
6166
+ * gcc.target/powerpc/crypto-builtin-1.c: Use effective target
6167
+ powerpc_p8vector_ok instead of powerpc_vsx_ok.
6169
+ * gcc.target/powerpc/bool.c: New file, add eqv, nand, nor tests.
6171
+ * lib/target-supports.exp (check_p8vector_hw_available) Add power8
6173
+ (check_effective_target_powerpc_p8vector_ok): Likewise.
6174
+ (is-effective-target): Likewise.
6175
+ (check_vect_support_and_set_flags): Likewise.
6177
+2013-06-06 Peter Bergner <bergner@vnet.ibm.com>
6179
+ Backport from trunk
6181
+ 2013-05-22 Michael Meissner <meissner@linux.vnet.ibm.com>
6182
+ Pat Haugen <pthaugen@us.ibm.com>
6183
+ Peter Bergner <bergner@vnet.ibm.com>
6185
+ * gcc.target/powerpc/crypto-builtin-1.c: New file, test for power8
6188
+2013-05-06 Michael Meissner <meissner@linux.vnet.ibm.com>
6190
+ Backport from trunk
6191
+ 2013-05-03 Michael Meissner <meissner@linux.vnet.ibm.com>
6194
+ * gcc.target/powerpc/pr57150.c: New file.
6196
+2013-03-20 Michael Meissner <meissner@linux.vnet.ibm.com>
6198
+ Backport from mainline
6199
+ 2013-03-20 Michael Meissner <meissner@linux.vnet.ibm.com>
6201
+ * gcc.target/powerpc/mmfpgpr.c: New test.
6202
+ * gcc.target/powerpc/sd-vsx.c: Likewise.
6203
+ * gcc.target/powerpc/sd-pwr6.c: Likewise.
6204
+ * gcc.target/powerpc/vsx-float0.c: Likewise.
6206
+2013-03-20 Michael Meissner <meissner@linux.vnet.ibm.com>
6208
+ Clone branch from gcc-4_8-branch, subversion id 196835.
6209
--- a/src/gcc/testsuite/lib/target-supports.exp
6210
+++ b/src/gcc/testsuite/lib/target-supports.exp
6211
@@ -1311,6 +1311,32 @@
6215
+# Return 1 if the target supports executing power8 vector instructions, 0
6216
+# otherwise. Cache the result.
6218
+proc check_p8vector_hw_available { } {
6219
+ return [check_cached_effective_target p8vector_hw_available {
6220
+ # Some simulators are known to not support VSX/power8 instructions.
6221
+ # For now, disable on Darwin
6222
+ if { [istarget powerpc-*-eabi] || [istarget powerpc*-*-eabispe] || [istarget *-*-darwin*]} {
6225
+ set options "-mpower8-vector"
6226
+ check_runtime_nocache p8vector_hw_available {
6230
+ asm volatile ("xxlorc vs0,vs0,vs0");
6232
+ asm volatile ("xxlorc 0,0,0");
6241
# Return 1 if the target supports executing VSX instructions, 0
6242
# otherwise. Cache the result.
6244
@@ -2672,6 +2698,33 @@
6248
+# Return 1 if this is a PowerPC target supporting -mpower8-vector
6250
+proc check_effective_target_powerpc_p8vector_ok { } {
6251
+ if { ([istarget powerpc*-*-*]
6252
+ && ![istarget powerpc-*-linux*paired*])
6253
+ || [istarget rs6000-*-*] } {
6254
+ # AltiVec is not supported on AIX before 5.3.
6255
+ if { [istarget powerpc*-*-aix4*]
6256
+ || [istarget powerpc*-*-aix5.1*]
6257
+ || [istarget powerpc*-*-aix5.2*] } {
6260
+ return [check_no_compiler_messages powerpc_p8vector_ok object {
6263
+ asm volatile ("xxlorc vs0,vs0,vs0");
6265
+ asm volatile ("xxlorc 0,0,0");
6269
+ } "-mpower8-vector"]
6275
# Return 1 if this is a PowerPC target supporting -mvsx
6277
proc check_effective_target_powerpc_vsx_ok { } {
6278
@@ -2699,6 +2752,27 @@
6282
+# Return 1 if this is a PowerPC target supporting -mhtm
6284
+proc check_effective_target_powerpc_htm_ok { } {
6285
+ if { ([istarget powerpc*-*-*]
6286
+ && ![istarget powerpc-*-linux*paired*])
6287
+ || [istarget rs6000-*-*] } {
6288
+ # HTM is not supported on AIX yet.
6289
+ if { [istarget powerpc*-*-aix*] } {
6292
+ return [check_no_compiler_messages powerpc_htm_ok object {
6294
+ asm volatile ("tbegin. 0");
6303
# Return 1 if this is a PowerPC target supporting -mcpu=cell.
6305
proc check_effective_target_powerpc_ppu_ok { } {
6306
@@ -2794,6 +2868,22 @@
6310
+# Return 1 if this is a PowerPC target using the ELFv2 ABI.
6312
+proc check_effective_target_powerpc_elfv2 { } {
6313
+ if { [istarget powerpc*-*-*] } {
6314
+ return [check_no_compiler_messages powerpc_elfv2 object {
6315
+ #if _CALL_ELF != 2
6316
+ #error not ELF v2 ABI
6326
# Return 1 if this is a SPU target with a toolchain that
6327
# supports automatic overlay generation.
6329
@@ -4499,6 +4589,7 @@
6331
"vmx_hw" { set selected [check_vmx_hw_available] }
6332
"vsx_hw" { set selected [check_vsx_hw_available] }
6333
+ "p8vector_hw" { set selected [check_p8vector_hw_available] }
6334
"ppc_recip_hw" { set selected [check_ppc_recip_hw_available] }
6335
"named_sections" { set selected [check_named_sections_available] }
6336
"gc_sections" { set selected [check_gc_sections_available] }
6337
@@ -4520,6 +4611,7 @@
6339
"vmx_hw" { return 1 }
6340
"vsx_hw" { return 1 }
6341
+ "p8vector_hw" { return 1 }
6342
"ppc_recip_hw" { return 1 }
6343
"named_sections" { return 1 }
6344
"gc_sections" { return 1 }
6345
@@ -5077,7 +5169,9 @@
6348
lappend DEFAULT_VECTCFLAGS "-maltivec"
6349
- if [check_vsx_hw_available] {
6350
+ if [check_p8vector_hw_available] {
6351
+ lappend DEFAULT_VECTCFLAGS "-mpower8-vector" "-mno-allow-movmisalign"
6352
+ } elseif [check_vsx_hw_available] {
6353
lappend DEFAULT_VECTCFLAGS "-mvsx" "-mno-allow-movmisalign"
6356
--- a/src/gcc/testsuite/gfortran.dg/nan_7.f90
6357
+++ b/src/gcc/testsuite/gfortran.dg/nan_7.f90
6359
! { dg-options "-fno-range-check" }
6360
! { dg-require-effective-target fortran_real_16 }
6361
! { dg-require-effective-target fortran_integer_16 }
6362
+! { dg-skip-if "" { "powerpc*le-*-*" } { "*" } { "" } }
6363
! PR47293 NAN not correctly read
6364
character(len=200) :: str
6366
--- a/src/gcc/testsuite/gcc.dg/vmx/3b-15.c
6367
+++ b/src/gcc/testsuite/gcc.dg/vmx/3b-15.c
6369
vector unsigned char
6370
f (vector unsigned char a, vector unsigned char b, vector unsigned char c)
6372
+#ifdef __BIG_ENDIAN__
6373
return vec_perm(a,b,c);
6375
+ return vec_perm(b,a,c);
6381
8,9,10,11,12,13,14,15}),
6382
((vector unsigned char){70,71,72,73,74,75,76,77,
6383
78,79,80,81,82,83,84,85}),
6384
+#ifdef __BIG_ENDIAN__
6385
((vector unsigned char){0x1,0x14,0x18,0x10,0x16,0x15,0x19,0x1a,
6386
0x1c,0x1c,0x1c,0x12,0x8,0x1d,0x1b,0xe})),
6388
+ ((vector unsigned char){0x1e,0xb,0x7,0xf,0x9,0xa,0x6,0x5,
6389
+ 0x3,0x3,0x3,0xd,0x17,0x2,0x4,0x11})),
6391
((vector unsigned char){1,74,78,70,76,75,79,80,82,82,82,72,8,83,81,14})),
6394
--- a/src/gcc/testsuite/gcc.dg/vmx/vec-set.c
6395
+++ b/src/gcc/testsuite/gcc.dg/vmx/vec-set.c
6397
+#include "harness.h"
6402
+ return (vector short){m, 0, 0, 0, 0, 0, 0, 0};
6407
+ check (vec_all_eq (vec_set (7),
6408
+ ((vector short){7, 0, 0, 0, 0, 0, 0, 0})),
6411
--- a/src/gcc/testsuite/gcc.dg/vmx/gcc-bug-i.c
6412
+++ b/src/gcc/testsuite/gcc.dg/vmx/gcc-bug-i.c
6414
#define DO_INLINE __attribute__ ((always_inline))
6415
#define DONT_INLINE __attribute__ ((noinline))
6417
+#ifdef __LITTLE_ENDIAN__
6418
+static inline DO_INLINE int inline_me(vector signed short data)
6420
+ union {vector signed short v; signed short s[8];} u;
6422
+ unsigned char x1, x2;
6426
+ x1 = (x >> 8) & 0xff;
6428
+ return ((x2 << 8) | x1);
6431
static inline DO_INLINE int inline_me(vector signed short data)
6433
union {vector signed short v; signed short s[8];} u;
6439
static DONT_INLINE int foo(vector signed short data)
6441
--- a/src/gcc/testsuite/gcc.dg/vmx/eg-5.c
6442
+++ b/src/gcc/testsuite/gcc.dg/vmx/eg-5.c
6444
/* Set result to a vector of f32 0's */
6445
vector float result = ((vector float){0.,0.,0.,0.});
6447
+#ifdef __LITTLE_ENDIAN__
6448
+ result = vec_madd (c0, vec_splat (v, 3), result);
6449
+ result = vec_madd (c1, vec_splat (v, 2), result);
6450
+ result = vec_madd (c2, vec_splat (v, 1), result);
6451
+ result = vec_madd (c3, vec_splat (v, 0), result);
6453
result = vec_madd (c0, vec_splat (v, 0), result);
6454
result = vec_madd (c1, vec_splat (v, 1), result);
6455
result = vec_madd (c2, vec_splat (v, 2), result);
6456
result = vec_madd (c3, vec_splat (v, 3), result);
6461
--- a/src/gcc/testsuite/gcc.dg/stack-usage-1.c
6462
+++ b/src/gcc/testsuite/gcc.dg/stack-usage-1.c
6465
#elif defined (__powerpc64__) || defined (__ppc64__) || defined (__POWERPC64__) \
6466
|| defined (__PPC64__)
6468
+# if _CALL_ELF == 2
6473
#elif defined (__powerpc__) || defined (__PPC__) || defined (__ppc__) \
6474
|| defined (__POWERPC__) || defined (PPC) || defined (_IBMR2)
6475
# if defined (__ALTIVEC__)
6476
--- a/src/gcc/testsuite/gcc.dg/vect/costmodel/ppc/costmodel-slp-34.c
6477
+++ b/src/gcc/testsuite/gcc.dg/vect/costmodel/ppc/costmodel-slp-34.c
6479
/* { dg-require-effective-target vect_int } */
6480
+/* { dg-skip-if "cost too high" { powerpc*le-*-* } { "*" } { "" } } */
6483
#include "../../tree-vect.h"
6484
--- a/src/gcc/testsuite/g++.dg/lookup/using9.C
6485
+++ b/src/gcc/testsuite/g++.dg/lookup/using9.C
6488
f(1); // { dg-error "ambiguous" }
6489
// { dg-message "candidate" "candidate note" { target *-*-* } 22 }
6490
- void f(int); // { dg-error "previous using declaration" }
6491
+ void f(int); // { dg-error "previous declaration" }
6497
- using B::f; // { dg-error "already declared" }
6498
+ using B::f; // { dg-error "previous declaration" }
6500
--- a/src/gcc/testsuite/g++.dg/eh/ppc64-sighandle-cr.C
6501
+++ b/src/gcc/testsuite/g++.dg/eh/ppc64-sighandle-cr.C
6503
+// { dg-do run { target { powerpc64*-*-linux* } } }
6504
+// { dg-options "-fexceptions -fnon-call-exceptions" }
6506
+#include <signal.h>
6507
+#include <stdlib.h>
6510
+#define SET_CR(R,V) __asm__ __volatile__ ("mtcrf %0,%1" : : "n" (1<<(7-R)), "r" (V<<(4*(7-R))) : "cr" #R)
6511
+#define GET_CR(R) ({ int tmp; __asm__ __volatile__ ("mfcr %0" : "=r" (tmp)); (tmp >> 4*(7-R)) & 15; })
6513
+void sighandler (int signo, siginfo_t * si, void * uc)
6522
+float test (float a, float b) __attribute__ ((__noinline__));
6523
+float test (float a, float b)
6526
+ asm ("mtcrf %1,%2" : "=f" (x) : "n" (1 << (7-3)), "r" (0), "0" (b) : "cr3");
6532
+ struct sigaction sa;
6535
+ sa.sa_sigaction = sighandler;
6536
+ sa.sa_flags = SA_SIGINFO;
6538
+ status = sigaction (SIGFPE, & sa, NULL);
6540
+ feenableexcept (FE_DIVBYZERO);
6550
+ return GET_CR(2) != 6 || GET_CR(3) != 9 || GET_CR(4) != 12;
6557
--- a/src/gcc/testsuite/g++.dg/overload/using3.C
6558
+++ b/src/gcc/testsuite/g++.dg/overload/using3.C
6560
+// { dg-do compile }
6569
+ void f(int); // { dg-message "previous" }
6574
+ using a::f; // { dg-error "conflicts" }
6576
--- a/src/gcc/testsuite/g++.dg/overload/using2.C
6577
+++ b/src/gcc/testsuite/g++.dg/overload/using2.C
6579
extern "C" void exit (int) throw ();
6580
extern "C" void *malloc (__SIZE_TYPE__) throw () __attribute__((malloc));
6582
- void abort (void) throw ();
6583
+ void abort (void) throw (); // { dg-message "previous" }
6584
void _exit (int) throw (); // { dg-error "conflicts" "conflicts" }
6585
// { dg-message "void _exit" "_exit" { target *-*-* } 49 }
6588
// { dg-message "void C1" "C1" { target *-*-* } 53 }
6590
extern "C" void c2 (void) throw ();
6591
- void C2 (void) throw ();
6592
+ void C2 (void) throw (); // { dg-message "previous" }
6594
int C3 (int) throw ();
6597
-using std::abort; // { dg-error "already declared" }
6598
+using std::abort; // { dg-error "conflicts" }
6600
-using std::C2; // { dg-error "already declared" }
6601
+using std::C2; // { dg-error "conflicts" }
6603
using std::c3; using other::c3;
6604
using std::C3; using other::C3;
6605
--- a/src/gcc/cp/ChangeLog.ibm
6606
+++ b/src/gcc/cp/ChangeLog.ibm
6608
+2013-08-04 Peter Bergner <bergner@vnet.ibm.com>
6610
+ Back port from mainline
6611
+ 2013-08-01 Fabien Chêne <fabien@gcc.gnu.org>
6614
+ * cp-tree.h: Check OVL_USED with OVERLOAD_CHECK.
6615
+ * name-lookup.c (do_nonmember_using_decl): Make sure we have an
6616
+ OVERLOAD before calling OVL_USED. Call diagnose_name_conflict
6617
+ instead of issuing an error without mentioning the conflicting
6619
--- a/src/gcc/cp/cp-tree.h
6620
+++ b/src/gcc/cp/cp-tree.h
6622
/* If set, this was imported in a using declaration.
6623
This is not to confuse with being used somewhere, which
6624
is not important for this node. */
6625
-#define OVL_USED(NODE) TREE_USED (NODE)
6626
+#define OVL_USED(NODE) TREE_USED (OVERLOAD_CHECK (NODE))
6627
/* If set, this OVERLOAD was created for argument-dependent lookup
6628
and can be freed afterward. */
6629
#define OVL_ARG_DEPENDENT(NODE) TREE_LANG_FLAG_0 (OVERLOAD_CHECK (NODE))
6630
--- a/src/gcc/cp/name-lookup.c
6631
+++ b/src/gcc/cp/name-lookup.c
6632
@@ -2268,8 +2268,7 @@
6633
&& compparms (TYPE_ARG_TYPES (TREE_TYPE (fn)),
6634
TYPE_ARG_TYPES (TREE_TYPE (decl)))
6635
&& ! decls_match (fn, decl))
6636
- error ("%q#D conflicts with previous using declaration %q#D",
6638
+ diagnose_name_conflict (decl, fn);
6640
dup = duplicate_decls (decl, fn, is_friend);
6641
/* If DECL was a redeclaration of FN -- even an invalid
6642
@@ -2501,7 +2500,7 @@
6643
if (new_fn == old_fn)
6644
/* The function already exists in the current namespace. */
6646
- else if (OVL_USED (tmp1))
6647
+ else if (TREE_CODE (tmp1) == OVERLOAD && OVL_USED (tmp1))
6648
continue; /* this is a using decl */
6649
else if (compparms (TYPE_ARG_TYPES (TREE_TYPE (new_fn)),
6650
TYPE_ARG_TYPES (TREE_TYPE (old_fn))))
6651
@@ -2516,7 +2515,7 @@
6655
- error ("%qD is already declared in this scope", name);
6656
+ diagnose_name_conflict (new_fn, old_fn);
6660
--- a/src/gcc/builtins.def
6661
+++ b/src/gcc/builtins.def
6663
DEF_LIB_BUILTIN (BUILT_IN_FABS, "fabs", BT_FN_DOUBLE_DOUBLE, ATTR_CONST_NOTHROW_LEAF_LIST)
6664
DEF_C99_C90RES_BUILTIN (BUILT_IN_FABSF, "fabsf", BT_FN_FLOAT_FLOAT, ATTR_CONST_NOTHROW_LEAF_LIST)
6665
DEF_C99_C90RES_BUILTIN (BUILT_IN_FABSL, "fabsl", BT_FN_LONGDOUBLE_LONGDOUBLE, ATTR_CONST_NOTHROW_LEAF_LIST)
6666
+DEF_GCC_BUILTIN (BUILT_IN_FABSD32, "fabsd32", BT_FN_DFLOAT32_DFLOAT32, ATTR_CONST_NOTHROW_LEAF_LIST)
6667
+DEF_GCC_BUILTIN (BUILT_IN_FABSD64, "fabsd64", BT_FN_DFLOAT64_DFLOAT64, ATTR_CONST_NOTHROW_LEAF_LIST)
6668
+DEF_GCC_BUILTIN (BUILT_IN_FABSD128, "fabsd128", BT_FN_DFLOAT128_DFLOAT128, ATTR_CONST_NOTHROW_LEAF_LIST)
6669
DEF_C99_BUILTIN (BUILT_IN_FDIM, "fdim", BT_FN_DOUBLE_DOUBLE_DOUBLE, ATTR_MATHFN_FPROUNDING_ERRNO)
6670
DEF_C99_BUILTIN (BUILT_IN_FDIMF, "fdimf", BT_FN_FLOAT_FLOAT_FLOAT, ATTR_MATHFN_FPROUNDING_ERRNO)
6671
DEF_C99_BUILTIN (BUILT_IN_FDIML, "fdiml", BT_FN_LONGDOUBLE_LONGDOUBLE_LONGDOUBLE, ATTR_MATHFN_FPROUNDING_ERRNO)
6672
--- a/src/gcc/expr.h
6673
+++ b/src/gcc/expr.h
6678
-extern void locate_and_pad_parm (enum machine_mode, tree, int, int, tree,
6679
- struct args_size *,
6680
+extern void locate_and_pad_parm (enum machine_mode, tree, int, int, int,
6681
+ tree, struct args_size *,
6682
struct locate_and_pad_arg_data *);
6684
/* Return the CODE_LABEL rtx for a LABEL_DECL, creating it if necessary. */
6685
--- a/src/gcc/function.c
6686
+++ b/src/gcc/function.c
6687
@@ -2507,6 +2507,7 @@
6690
locate_and_pad_parm (data->promoted_mode, data->passed_type, in_regs,
6691
+ all->reg_parm_stack_space,
6692
entry_parm ? data->partial : 0, current_function_decl,
6693
&all->stack_args_size, &data->locate);
6695
@@ -3485,11 +3486,7 @@
6696
/* Adjust function incoming argument size for alignment and
6699
-#ifdef REG_PARM_STACK_SPACE
6700
- crtl->args.size = MAX (crtl->args.size,
6701
- REG_PARM_STACK_SPACE (fndecl));
6704
+ crtl->args.size = MAX (crtl->args.size, all.reg_parm_stack_space);
6705
crtl->args.size = CEIL_ROUND (crtl->args.size,
6706
PARM_BOUNDARY / BITS_PER_UNIT);
6708
@@ -3693,6 +3690,9 @@
6709
IN_REGS is nonzero if the argument will be passed in registers. It will
6710
never be set if REG_PARM_STACK_SPACE is not defined.
6712
+ REG_PARM_STACK_SPACE is the number of bytes of stack space reserved
6713
+ for arguments which are passed in registers.
6715
FNDECL is the function in which the argument was defined.
6717
There are two types of rounding that are done. The first, controlled by
6718
@@ -3713,19 +3713,16 @@
6721
locate_and_pad_parm (enum machine_mode passed_mode, tree type, int in_regs,
6722
- int partial, tree fndecl ATTRIBUTE_UNUSED,
6723
+ int reg_parm_stack_space, int partial,
6724
+ tree fndecl ATTRIBUTE_UNUSED,
6725
struct args_size *initial_offset_ptr,
6726
struct locate_and_pad_arg_data *locate)
6729
enum direction where_pad;
6730
unsigned int boundary, round_boundary;
6731
- int reg_parm_stack_space = 0;
6732
int part_size_in_regs;
6734
-#ifdef REG_PARM_STACK_SPACE
6735
- reg_parm_stack_space = REG_PARM_STACK_SPACE (fndecl);
6737
/* If we have found a stack parm before we reach the end of the
6738
area reserved for registers, skip that area. */
6740
@@ -3743,7 +3740,6 @@
6741
initial_offset_ptr->constant = reg_parm_stack_space;
6744
-#endif /* REG_PARM_STACK_SPACE */
6746
part_size_in_regs = (reg_parm_stack_space == 0 ? partial : 0);
6748
@@ -3806,11 +3802,7 @@
6750
locate->slot_offset.constant += part_size_in_regs;
6753
-#ifdef REG_PARM_STACK_SPACE
6754
- || REG_PARM_STACK_SPACE (fndecl) > 0
6757
+ if (!in_regs || reg_parm_stack_space > 0)
6758
pad_to_arg_alignment (&locate->slot_offset, boundary,
6759
&locate->alignment_pad);
6761
@@ -3830,11 +3822,7 @@
6762
pad_below (&locate->offset, passed_mode, sizetree);
6764
#else /* !ARGS_GROW_DOWNWARD */
6766
-#ifdef REG_PARM_STACK_SPACE
6767
- || REG_PARM_STACK_SPACE (fndecl) > 0
6770
+ if (!in_regs || reg_parm_stack_space > 0)
6771
pad_to_arg_alignment (initial_offset_ptr, boundary,
6772
&locate->alignment_pad);
6773
locate->slot_offset = *initial_offset_ptr;
6774
@@ -5093,6 +5081,7 @@
6775
amount. BLKmode results are handled using the group load/store
6777
if (TYPE_MODE (TREE_TYPE (decl_result)) != BLKmode
6778
+ && REG_P (real_decl_rtl)
6779
&& targetm.calls.return_in_msb (TREE_TYPE (decl_result)))
6781
emit_move_insn (gen_rtx_REG (GET_MODE (decl_rtl),
6782
--- a/src/gcc/ChangeLog.ibm
6783
+++ b/src/gcc/ChangeLog.ibm
6785
+2014-01-13 Peter Bergner <bergner@vnet.ibm.com>
6787
+ Merge up to 206579.
6788
+ * REVISION: Update subversion id.
6790
+2014-01-08 Peter Bergner <bergner@vnet.ibm.com>
6792
+ Merge up to 206404.
6793
+ * REVISION: Update subversion id.
6795
+2013-12-10 Peter Bergner <bergner@vnet.ibm.com>
6797
+ Merge up to 205847.
6798
+ * REVISION: Update subversion id.
6800
+2013-12-03 Peter Bergner <bergner@vnet.ibm.com>
6802
+ Backport from mainline
6803
+ 2013-12-03 Peter Bergner <bergner@vnet.ibm.com>
6805
+ * config/rs6000/htmintrin.h (_TEXASR_INSTRUCTION_FETCH_CONFLICT): Fix
6806
+ typo in macro name.
6807
+ (_TEXASRU_INSTRUCTION_FETCH_CONFLICT): Likewise.
6809
+2013-11-24 Bill Schmidt <wschmidt@linux.vnet.ibm.com>
6811
+ Backport from mainline r205333
6812
+ 2013-11-24 Bill Schmidt <wschmidt@linux.vnet.ibm.com>
6814
+ * config/rs6000/rs6000.c (rs6000_expand_vec_perm_const_1): Correct
6815
+ for little endian.
6817
+2013-11-23 Alan Modra <amodra@gmail.com>
6819
+ Apply mainline r205299.
6820
+ * config/rs6000/vsx.md (fusion peepholes): Disable when !TARGET_VSX.
6822
+2013-11-22 Michael Meissner <meissner@linux.vnet.ibm.com>
6824
+ Backport from mainline
6825
+ 2013-11-12 Michael Meissner <meissner@linux.vnet.ibm.com>
6828
+ * config/rs6000/rs6000.md (movdi_internal32): Eliminate
6829
+ constraints that would allow DImode into the traditional Altivec
6830
+ registers, but cause undesirable code generation when loading 0 as
6832
+ (movdi_internal64): Likewise.
6833
+ (cmp<mode>_fpr): Do not use %x for CR register output.
6834
+ (extendsfdf2_fpr): Fix constraints when -mallow-upper-df and
6835
+ -mallow-upper-sf debug switches are used.
6837
+2013-11-21 Bill Schmidt <wschmidt@linux.vnet.ibm.com>
6839
+ Backport from mainline r205241
6840
+ 2013-11-21 Bill Schmidt <wschmidt@vnet.ibm.com>
6842
+ * config/rs6000/vector.md (vec_pack_trunc_v2df): Revert previous
6843
+ little endian change.
6844
+ (vec_pack_sfix_trunc_v2df): Likewise.
6845
+ (vec_pack_ufix_trunc_v2df): Likewise.
6846
+ * config/rs6000/rs6000.c (rs6000_expand_interleave): Correct
6847
+ double checking of endianness.
6849
+2013-11-21 Peter Bergner <bergner@vnet.ibm.com>
6851
+ Backport from mainline r205233.
6852
+ 2013-11-21 Peter Bergner <bergner@vnet.ibm.com>
6854
+ * doc/extend.texi: Document htm builtins.
6856
+2013-11-20 Bill Schmidt <wschmidt@linux.vnet.ibm.com>
6858
+ Backport from mainline r205146
6859
+ 2013-11-20 Bill Schmidt <wschmidt@linux.vnet.ibm.com>
6861
+ * config/rs6000/vsx.md (vsx_set_<mode>): Adjust for little endian.
6862
+ (vsx_extract_<mode>): Likewise.
6863
+ (*vsx_extract_<mode>_one_le): New LE variant on
6864
+ *vsx_extract_<mode>_zero.
6865
+ (vsx_extract_v4sf): Adjust for little endian.
6867
+2013-11-20 Ulrich Weigand <Ulrich.Weigand@de.ibm.com>
6869
+ Backport from mainline r205123:
6871
+ 2013-11-20 Ulrich Weigand <Ulrich.Weigand@de.ibm.com>
6873
+ * config/rs6000/rs6000.c (rs6000_cannot_change_mode_class): Do not
6874
+ allow subregs of TDmode in FPRs of smaller size in little-endian.
6875
+ (rs6000_split_multireg_move): When splitting an access to TDmode
6876
+ in FPRs, do not use simplify_gen_subreg.
6878
+2013-11-19 Bill Schmidt <wschmidt@linux.vnet.ibm.com>
6880
+ Backport from mainline r205080
6881
+ 2013-11-19 Bill Schmidt <wschmidt@linux.vnet.ibm.com>
6883
+ * config/rs6000/rs6000.c (altivec_expand_vec_perm_const): Adjust
6884
+ V16QI vector splat case for little endian.
6886
+2013-11-20 Alan Modra <amodra@gmail.com>
6888
+ Apply mainline r205060.
6889
+ * config/rs6000/sysv4.h (CC1_ENDIAN_LITTLE_SPEC): Define as empty.
6890
+ * config/rs6000/rs6000.c (rs6000_option_override_internal): Default
6891
+ to strict alignment on older processors when little-endian.
6892
+ * config/rs6000/linux64.h (PROCESSOR_DEFAULT64): Default to power8
6895
+2013-11-19 Ulrich Weigand <Ulrich.Weigand@de.ibm.com>
6897
+ Backport from mainline r205045:
6899
+ 2013-11-19 Ulrich Weigand <Ulrich.Weigand@de.ibm.com>
6901
+ * config/rs6000/vector.md ("mov<mode>"): Do not call
6902
+ rs6000_emit_le_vsx_move to move into or out of GPRs.
6903
+ * config/rs6000/rs6000.c (rs6000_emit_le_vsx_move): Assert
6904
+ source and destination are not GPR hard regs.
6906
+2013-11-18 Peter Bergner <bergner@vnet.ibm.com>
6908
+ Merge up to 204974.
6909
+ * REVISION: Update subversion id.
6911
+2013-11-17 Ulrich Weigand <Ulrich.Weigand@de.ibm.com>
6913
+ Backport from mainline r204927:
6915
+ 2013-11-17 Ulrich Weigand <Ulrich.Weigand@de.ibm.com>
6917
+ * config/rs6000/rs6000.c (rs6000_emit_move): Use low word of
6918
+ sdmode_stack_slot also in little-endian mode.
6920
+2013-11-17 Bill Schmidt <wschmidt@linux.vnet.ibm.com>
6922
+ Backport from mainline r204920
6923
+ 2011-11-17 Bill Schmidt <wschmidt@linux.vnet.ibm.com>
6925
+ * config/rs6000/rs6000.c (rs6000_frame_related): Add split_reg
6926
+ parameter and use it in REG_FRAME_RELATED_EXPR note.
6927
+ (emit_frame_save): Call rs6000_frame_related with extra NULL_RTX
6929
+ (rs6000_emit_prologue): Likewise, but for little endian VSX
6930
+ stores, pass the source register of the store instead.
6932
+2013-11-15 Bill Schmidt <wschmidt@linux.vnet.ibm.com>
6934
+ Backport from mainline r204862
6935
+ 2013-11-15 Bill Schmidt <wschmidt@linux.vnet.ibm.com>
6937
+ * config/rs6000/altivec.md (UNSPEC_VPERM_X, UNSPEC_VPERM_UNS_X):
6939
+ (altivec_vperm_<mode>): Revert earlier little endian change.
6940
+ (*altivec_vperm_<mode>_internal): Remove.
6941
+ (altivec_vperm_<mode>_uns): Revert earlier little endian change.
6942
+ (*altivec_vperm_<mode>_uns_internal): Remove.
6943
+ * config/rs6000/vector.md (vec_realign_load_<mode>): Revise
6946
+2013-11-15 Ulrich Weigand <Ulrich.Weigand@de.ibm.com>
6948
+ Backport from mainline r204842:
6950
+ 2013-11-15 Ulrich Weigand <Ulrich.Weigand@de.ibm.com>
6952
+ * doc/invoke.texi (-mabi=elfv1, -mabi=elfv2): Document.
6954
+2013-11-15 Ulrich Weigand <Ulrich.Weigand@de.ibm.com>
6956
+ Backport from mainline r204809:
6958
+ 2013-11-14 Ulrich Weigand <Ulrich.Weigand@de.ibm.com>
6960
+ * config/rs6000/sysv4le.h (LINUX64_DEFAULT_ABI_ELFv2): Define.
6962
+2013-11-15 Ulrich Weigand <Ulrich.Weigand@de.ibm.com>
6964
+ Backport from mainline r204808:
6966
+ 2013-11-14 Ulrich Weigand <Ulrich.Weigand@de.ibm.com>
6967
+ Alan Modra <amodra@gmail.com>
6969
+ * config/rs6000/rs6000.h (RS6000_SAVE_AREA): Handle ABI_ELFv2.
6970
+ (RS6000_SAVE_TOC): Remove.
6971
+ (RS6000_TOC_SAVE_SLOT): New macro.
6972
+ * config/rs6000/rs6000.c (rs6000_parm_offset): New function.
6973
+ (rs6000_parm_start): Use it.
6974
+ (rs6000_function_arg_advance_1): Likewise.
6975
+ (rs6000_emit_prologue): Use RS6000_TOC_SAVE_SLOT.
6976
+ (rs6000_emit_epilogue): Likewise.
6977
+ (rs6000_call_aix): Likewise.
6978
+ (rs6000_output_function_prologue): Do not save/restore r11
6979
+ around calling _mcount for ABI_ELFv2.
6981
+ 2013-11-14 Ulrich Weigand <Ulrich.Weigand@de.ibm.com>
6982
+ Alan Modra <amodra@gmail.com>
6984
+ * config/rs6000/rs6000-protos.h (rs6000_reg_parm_stack_space):
6986
+ * config/rs6000/rs6000.h (RS6000_REG_SAVE): Remove.
6987
+ (REG_PARM_STACK_SPACE): Call rs6000_reg_parm_stack_space.
6988
+ * config/rs6000/rs6000.c (rs6000_parm_needs_stack): New function.
6989
+ (rs6000_function_parms_need_stack): Likewise.
6990
+ (rs6000_reg_parm_stack_space): Likewise.
6991
+ (rs6000_function_arg): Do not replace BLKmode by Pmode when
6992
+ returning a register argument.
6994
+ 2013-11-14 Ulrich Weigand <Ulrich.Weigand@de.ibm.com>
6995
+ Michael Gschwind <mkg@us.ibm.com>
6997
+ * config/rs6000/rs6000.h (FP_ARG_MAX_RETURN): New macro.
6998
+ (ALTIVEC_ARG_MAX_RETURN): Likewise.
6999
+ (FUNCTION_VALUE_REGNO_P): Use them.
7000
+ * config/rs6000/rs6000.c (TARGET_RETURN_IN_MSB): Define.
7001
+ (rs6000_return_in_msb): New function.
7002
+ (rs6000_return_in_memory): Handle ELFv2 homogeneous aggregates.
7003
+ Handle aggregates of up to 16 bytes for ELFv2.
7004
+ (rs6000_function_value): Handle ELFv2 homogeneous aggregates.
7006
+ 2013-11-14 Ulrich Weigand <Ulrich.Weigand@de.ibm.com>
7007
+ Michael Gschwind <mkg@us.ibm.com>
7009
+ * config/rs6000/rs6000.h (AGGR_ARG_NUM_REG): Define.
7010
+ * config/rs6000/rs6000.c (rs6000_aggregate_candidate): New function.
7011
+ (rs6000_discover_homogeneous_aggregate): Likewise.
7012
+ (rs6000_function_arg_boundary): Handle homogeneous aggregates.
7013
+ (rs6000_function_arg_advance_1): Likewise.
7014
+ (rs6000_function_arg): Likewise.
7015
+ (rs6000_arg_partial_bytes): Likewise.
7016
+ (rs6000_psave_function_arg): Handle BLKmode arguments.
7018
+ 2013-11-14 Ulrich Weigand <Ulrich.Weigand@de.ibm.com>
7019
+ Michael Gschwind <mkg@us.ibm.com>
7021
+ * config/rs6000/rs6000.h (AGGR_ARG_NUM_REG): Define.
7022
+ * config/rs6000/rs6000.c (rs6000_aggregate_candidate): New function.
7023
+ (rs6000_discover_homogeneous_aggregate): Likewise.
7024
+ (rs6000_function_arg_boundary): Handle homogeneous aggregates.
7025
+ (rs6000_function_arg_advance_1): Likewise.
7026
+ (rs6000_function_arg): Likewise.
7027
+ (rs6000_arg_partial_bytes): Likewise.
7028
+ (rs6000_psave_function_arg): Handle BLKmode arguments.
7030
+ 2013-11-14 Ulrich Weigand <Ulrich.Weigand@de.ibm.com>
7032
+ * config/rs6000/rs6000.c (machine_function): New member
7034
+ (rs6000_emit_prologue): Set r2_setup_needed if necessary.
7035
+ (rs6000_output_mi_thunk): Set r2_setup_needed.
7036
+ (rs6000_output_function_prologue): Output global entry point
7037
+ prologue and local entry point marker if needed for ABI_ELFv2.
7038
+ Output -mprofile-kernel code here.
7039
+ (output_function_profiler): Do not output -mprofile-kernel
7040
+ code here; moved to rs6000_output_function_prologue.
7041
+ (rs6000_file_start): Output ".abiversion 2" for ABI_ELFv2.
7043
+ (rs6000_emit_move): Do not handle dot symbols for ABI_ELFv2.
7044
+ (rs6000_output_function_entry): Likewise.
7045
+ (rs6000_assemble_integer): Likewise.
7046
+ (rs6000_elf_encode_section_info): Likewise.
7047
+ (rs6000_elf_declare_function_name): Do not create dot symbols
7048
+ or .opd section for ABI_ELFv2.
7050
+ (rs6000_trampoline_size): Update for ABI_ELFv2 trampolines.
7051
+ (rs6000_trampoline_init): Likewise.
7052
+ (rs6000_elf_file_end): Call file_end_indicate_exec_stack
7055
+ (rs6000_call_aix): Handle ELFv2 indirect calls. Do not check
7056
+ for function descriptors in ABI_ELFv2.
7058
+ * config/rs6000/rs6000.md ("*call_indirect_aix<mode>"): Support
7059
+ on ABI_AIX only, not ABI_ELFv2.
7060
+ ("*call_value_indirect_aix<mode>"): Likewise.
7061
+ ("*call_indirect_elfv2<mode>"): New pattern.
7062
+ ("*call_value_indirect_elfv2<mode>"): Likewise.
7064
+ * config/rs6000/predicates.md ("symbol_ref_operand"): Do not
7065
+ check for function descriptors in ABI_ELFv2.
7066
+ ("current_file_function_operand"): Likewise.
7068
+ * config/rs6000/ppc-asm.h [__powerpc64__ && _CALL_ELF == 2]:
7070
+ (FUNC_NAME): Define ELFv2 variant.
7071
+ (JUMP_TARGET): Likewise.
7072
+ (FUNC_START): Likewise.
7073
+ (HIDDEN_FUNC): Likewise.
7074
+ (FUNC_END): Likeiwse.
7076
+ 2013-11-14 Ulrich Weigand <Ulrich.Weigand@de.ibm.com>
7078
+ * config.gcc [powerpc*-*-* | rs6000-*-*]: Support --with-abi=elfv1
7079
+ and --with-abi=elfv2.
7080
+ * config/rs6000/option-defaults.h (OPTION_DEFAULT_SPECS): Add "abi".
7081
+ * config/rs6000/rs6000.opt (mabi=elfv1): New option.
7082
+ (mabi=elfv2): Likewise.
7083
+ * config/rs6000/rs6000-opts.h (enum rs6000_abi): Add ABI_ELFv2.
7084
+ * config/rs6000/linux64.h (DEFAULT_ABI): Do not hard-code to AIX_ABI
7085
+ if !RS6000_BI_ARCH.
7086
+ (ELFv2_ABI_CHECK): New macro.
7087
+ (SUBSUBTARGET_OVERRIDE_OPTIONS): Use it to decide whether to set
7088
+ rs6000_current_abi to ABI_AIX or ABI_ELFv2.
7089
+ (GLIBC_DYNAMIC_LINKER64): Support ELFv2 ld.so version.
7090
+ * config/rs6000/rs6000-c.c (rs6000_cpu_cpp_builtins): Predefine
7091
+ _CALL_ELF and __STRUCT_PARM_ALIGN__ if appropriate.
7093
+ * config/rs6000/rs6000.c (rs6000_debug_reg_global): Handle ABI_ELFv2.
7094
+ (debug_stack_info): Likewise.
7095
+ (rs6000_file_start): Treat ABI_ELFv2 the same as ABI_AIX.
7096
+ (rs6000_legitimize_tls_address): Likewise.
7097
+ (rs6000_conditional_register_usage): Likewise.
7098
+ (rs6000_emit_move): Likewise.
7099
+ (init_cumulative_args): Likewise.
7100
+ (rs6000_function_arg_advance_1): Likewise.
7101
+ (rs6000_function_arg): Likewise.
7102
+ (rs6000_arg_partial_bytes): Likewise.
7103
+ (rs6000_output_function_entry): Likewise.
7104
+ (rs6000_assemble_integer): Likewise.
7105
+ (rs6000_savres_strategy): Likewise.
7106
+ (rs6000_stack_info): Likewise.
7107
+ (rs6000_function_ok_for_sibcall): Likewise.
7108
+ (rs6000_emit_load_toc_table): Likewise.
7109
+ (rs6000_savres_routine_name): Likewise.
7110
+ (ptr_regno_for_savres): Likewise.
7111
+ (rs6000_emit_prologue): Likewise.
7112
+ (rs6000_emit_epilogue): Likewise.
7113
+ (rs6000_output_function_epilogue): Likewise.
7114
+ (output_profile_hook): Likewise.
7115
+ (output_function_profiler): Likewise.
7116
+ (rs6000_trampoline_size): Likewise.
7117
+ (rs6000_trampoline_init): Likewise.
7118
+ (rs6000_elf_output_toc_section_asm_op): Likewise.
7119
+ (rs6000_elf_encode_section_info): Likewise.
7120
+ (rs6000_elf_reloc_rw_mask): Likewise.
7121
+ (rs6000_elf_declare_function_name): Likewise.
7122
+ (rs6000_function_arg_boundary): Treat ABI_ELFv2 the same as ABI_AIX,
7123
+ except that rs6000_compat_align_parm is always assumed false.
7124
+ (rs6000_gimplify_va_arg): Likewise.
7125
+ (rs6000_call_aix): Update comment.
7126
+ (rs6000_sibcall_aix): Likewise.
7127
+ * config/rs6000/rs6000.md ("tls_gd_aix<TLSmode:tls_abi_suffix>"):
7128
+ Treat ABI_ELFv2 the same as ABI_AIX.
7129
+ ("*tls_gd_call_aix<TLSmode:tls_abi_suffix>"): Likewise.
7130
+ ("tls_ld_aix<TLSmode:tls_abi_suffix>"): Likewise.
7131
+ ("*tls_ld_call_aix<TLSmode:tls_abi_suffix>"): Likewise.
7132
+ ("load_toc_aix_si"): Likewise.
7133
+ ("load_toc_aix_di"): Likewise.
7134
+ ("call"): Likewise.
7135
+ ("call_value"): Likewise.
7136
+ ("*call_local_aix<mode>"): Likewise.
7137
+ ("*call_value_local_aix<mode>"): Likewise.
7138
+ ("*call_nonlocal_aix<mode>"): Likewise.
7139
+ ("*call_value_nonlocal_aix<mode>"): Likewise.
7140
+ ("*call_indirect_aix<mode>"): Likewise.
7141
+ ("*call_value_indirect_aix<mode>"): Likewise.
7142
+ ("sibcall"): Likewise.
7143
+ ("sibcall_value"): Likewise.
7144
+ ("*sibcall_aix<mode>"): Likewise.
7145
+ ("*sibcall_value_aix<mode>"): Likewise.
7146
+ * config/rs6000/predicates.md ("symbol_ref_operand"): Likewise.
7147
+ ("current_file_function_operand"): Likewise.
7149
+2013-11-15 Ulrich Weigand <Ulrich.Weigand@de.ibm.com>
7151
+ Backport from mainline r204807:
7153
+ 2013-11-14 Ulrich Weigand <Ulrich.Weigand@de.ibm.com>
7155
+ * config/rs6000/rs6000.c (rs6000_arg_partial_bytes): Simplify logic
7156
+ by making use of the fact that for vector / floating point arguments
7157
+ passed both in VRs/FPRs and in the fixed parameter area, the partial
7158
+ bytes mechanism is in fact not used.
7160
+2013-11-15 Ulrich Weigand <Ulrich.Weigand@de.ibm.com>
7162
+ Backport from mainline r204806:
7164
+ 2013-11-14 Ulrich Weigand <Ulrich.Weigand@de.ibm.com>
7166
+ * config/rs6000/rs6000.c (rs6000_psave_function_arg): New function.
7167
+ (rs6000_finish_function_arg): Likewise.
7168
+ (rs6000_function_arg): Use rs6000_psave_function_arg and
7169
+ rs6000_finish_function_arg to handle both vector and floating
7170
+ point arguments that are also passed in GPRs / the stack.
7172
+2013-11-15 Ulrich Weigand <Ulrich.Weigand@de.ibm.com>
7174
+ Backport from mainline r204805:
7176
+ 2013-11-14 Ulrich Weigand <Ulrich.Weigand@de.ibm.com>
7178
+ * config/rs6000/rs6000.c (USE_FP_FOR_ARG_P): Remove TYPE argument.
7179
+ (USE_ALTIVEC_FOR_ARG_P): Likewise.
7180
+ (rs6000_darwin64_record_arg_advance_recurse): Update uses.
7181
+ (rs6000_function_arg_advance_1):Likewise.
7182
+ (rs6000_darwin64_record_arg_recurse): Likewise.
7183
+ (rs6000_function_arg): Likewise.
7184
+ (rs6000_arg_partial_bytes): Likewise.
7186
+2013-11-15 Ulrich Weigand <Ulrich.Weigand@de.ibm.com>
7188
+ Backport from mainline r204804:
7190
+ 2013-11-14 Ulrich Weigand <Ulrich.Weigand@de.ibm.com>
7192
+ * config/rs6000/rs6000.c (rs6000_option_override_internal): Replace
7193
+ "DEFAULT_ABI != ABI_AIX" test by testing for ABI_V4 or ABI_DARWIN.
7194
+ (rs6000_savres_strategy): Likewise.
7195
+ (rs6000_return_addr): Likewise.
7196
+ (rs6000_emit_load_toc_table): Replace "DEFAULT_ABI != ABI_AIX" by
7197
+ testing for ABI_V4 (since ABI_DARWIN is impossible here).
7198
+ (rs6000_emit_prologue): Likewise.
7199
+ (legitimate_lo_sum_address_p): Simplify DEFAULT_ABI test.
7200
+ (rs6000_elf_declare_function_name): Remove duplicated test.
7201
+ * config/rs6000/rs6000.md ("load_toc_v4_PIC_1"): Explicitly test
7202
+ for ABI_V4 (instead of "DEFAULT_ABI != ABI_AIX" test).
7203
+ ("load_toc_v4_PIC_1_normal"): Likewise.
7204
+ ("load_toc_v4_PIC_1_476"): Likewise.
7205
+ ("load_toc_v4_PIC_1b"): Likewise.
7206
+ ("load_toc_v4_PIC_1b_normal"): Likewise.
7207
+ ("load_toc_v4_PIC_1b_476"): Likewise.
7208
+ ("load_toc_v4_PIC_2"): Likewise.
7209
+ ("load_toc_v4_PIC_3b"): Likewise.
7210
+ ("load_toc_v4_PIC_3c"): Likewise.
7211
+ * config/rs6000/rs6000.h (RS6000_REG_SAVE): Simplify DEFAULT_ABI test.
7212
+ (RS6000_SAVE_AREA): Likewise.
7213
+ (FP_ARG_MAX_REG): Likewise.
7214
+ (RETURN_ADDRESS_OFFSET): Likewise.
7215
+ * config/rs6000/sysv.h (TARGET_TOC): Test for ABI_V4 instead
7217
+ (SUBTARGET_OVERRIDE_OPTIONS): Likewise.
7218
+ (MINIMAL_TOC_SECTION_ASM_OP): Likewise.
7220
+2013-11-15 Ulrich Weigand <Ulrich.Weigand@de.ibm.com>
7222
+ Backport from mainline r204803:
7224
+ 2013-11-14 Ulrich Weigand <Ulrich.Weigand@de.ibm.com>
7226
+ * config/rs6000/rs6000.c (rs6000_call_indirect_aix): Rename to ...
7227
+ (rs6000_call_aix): ... this. Handle both direct and indirect calls.
7228
+ Create call insn directly instead of via various gen_... routines.
7229
+ Mention special registers used by the call in CALL_INSN_FUNCTION_USAGE.
7230
+ (rs6000_sibcall_aix): New function.
7231
+ * config/rs6000/rs6000.md (TOC_SAVE_OFFSET_32BIT): Remove.
7232
+ (TOC_SAVE_OFFSET_64BIT): Likewise.
7233
+ (AIX_FUNC_DESC_TOC_32BIT): Likewise.
7234
+ (AIX_FUNC_DESC_TOC_64BIT): Likewise.
7235
+ (AIX_FUNC_DESC_SC_32BIT): Likewise.
7236
+ (AIX_FUNC_DESC_SC_64BIT): Likewise.
7237
+ ("call" expander): Call rs6000_call_aix.
7238
+ ("call_value" expander): Likewise.
7239
+ ("call_indirect_aix<ptrsize>"): Replace this pattern ...
7240
+ ("call_indirect_aix<ptrsize>_nor11"): ... and this pattern ...
7241
+ ("*call_indirect_aix<mode>"): ... by this insn pattern.
7242
+ ("call_value_indirect_aix<ptrsize>"): Replace this pattern ...
7243
+ ("call_value_indirect_aix<ptrsize>_nor11"): ... and this pattern ...
7244
+ ("*call_value_indirect_aix<mode>"): ... by this insn pattern.
7245
+ ("*call_nonlocal_aix32", "*call_nonlocal_aix64"): Replace by ...
7246
+ ("*call_nonlocal_aix<mode>"): ... this pattern.
7247
+ ("*call_value_nonlocal_aix32", "*call_value_nonlocal_aix64"): Replace
7248
+ ("*call_value_nonlocal_aix<mode>"): ... by this pattern.
7249
+ ("*call_local_aix<mode>"): New insn pattern.
7250
+ ("*call_value_local_aix<mode>"): Likewise.
7251
+ ("sibcall" expander): Call rs6000_sibcall_aix.
7252
+ ("sibcall_value" expander): Likewise. Move earlier in file.
7253
+ ("*sibcall_nonlocal_aix<mode>"): Replace by ...
7254
+ ("*sibcall_aix<mode>"): ... this pattern.
7255
+ ("*sibcall_value_nonlocal_aix<mode>"): Replace by ...
7256
+ ("*sibcall_value_aix<mode>"): ... this pattern.
7257
+ * config/rs6000/rs6000-protos.h (rs6000_call_indirect_aix): Remove.
7258
+ (rs6000_call_aix): Add prototype.
7259
+ (rs6000_sibcall_aix): Likewise.
7261
+2013-11-15 Ulrich Weigand <Ulrich.Weigand@de.ibm.com>
7263
+ Backport from mainline r204799:
7265
+ 2013-11-14 Ulrich Weigand <Ulrich.Weigand@de.ibm.com>
7267
+ * config/rs6000/rs6000.c (rs6000_emit_prologue): Do not place a
7268
+ RTX_FRAME_RELATED_P marker on the UNSPEC_MOVESI_FROM_CR insn.
7269
+ Instead, add USEs of all modified call-saved CR fields to the
7270
+ insn storing the result to the stack slot, and provide an
7271
+ appropriate REG_FRAME_RELATED_EXPR for that insn.
7272
+ * config/rs6000/rs6000.md ("*crsave"): New insn pattern.
7273
+ * config/rs6000/predicates.md ("crsave_operation"): New predicate.
7275
+2013-11-15 Ulrich Weigand <Ulrich.Weigand@de.ibm.com>
7277
+ Backport from mainline r204798:
7279
+ 2013-11-14 Ulrich Weigand <Ulrich.Weigand@de.ibm.com>
7280
+ Alan Modra <amodra@gmail.com>
7282
+ * function.c (assign_parms): Use all.reg_parm_stack_space instead
7283
+ of re-evaluating REG_PARM_STACK_SPACE target macro.
7284
+ (locate_and_pad_parm): New parameter REG_PARM_STACK_SPACE. Use it
7285
+ instead of evaluating target macro REG_PARM_STACK_SPACE every time.
7286
+ (assign_parm_find_entry_rtl): Update call.
7287
+ * calls.c (initialize_argument_information): Update call.
7288
+ (emit_library_call_value_1): Likewise.
7289
+ * expr.h (locate_and_pad_parm): Update prototype.
7291
+2013-11-15 Ulrich Weigand <Ulrich.Weigand@de.ibm.com>
7293
+ Backport from mainline r204797:
7295
+ 2013-11-14 Ulrich Weigand <Ulrich.Weigand@de.ibm.com>
7297
+ * calls.c (store_unaligned_arguments_into_pseudos): Skip PARALLEL
7300
+2013-11-15 Ulrich Weigand <Ulrich.Weigand@de.ibm.com>
7302
+ Backport from mainline r197003:
7304
+ 2013-03-23 Eric Botcazou <ebotcazou@adacore.com>
7306
+ * calls.c (expand_call): Add missing guard to code handling return
7307
+ of non-BLKmode structures in MSB.
7308
+ * function.c (expand_function_end): Likewise.
7310
+2013-11-15 Ulrich Weigand <Ulrich.Weigand@de.ibm.com>
7312
+ Backport from mainline r201750.
7313
+ Note: Default setting of -mcompat-align-parm inverted!
7315
+ 2013-08-14 Bill Schmidt <wschmidt@linux.vnet.ibm.com>
7318
+ * doc/invoke.texi: Add documentation of mcompat-align-parm
7320
+ * config/rs6000/rs6000.opt: Add mcompat-align-parm option.
7321
+ * config/rs6000/rs6000.c (rs6000_function_arg_boundary): For AIX
7322
+ and Linux, correct BLKmode alignment when 128-bit alignment is
7323
+ required and compatibility flag is not set.
7324
+ (rs6000_gimplify_va_arg): For AIX and Linux, honor specified
7325
+ alignment for zero-size arguments when compatibility flag is not
7328
+2013-11-12 Bill Schmidt <wschmidt@linux.vnet.ibm.com>
7330
+ * configure: Regenerate.
7332
+2013-11-10 Bill Schmidt <wschmidt@linux.vnet.ibm.com>
7334
+ Backport from mainline r204441
7335
+ 2013-11-05 Bill Schmidt <wschmidt@linux.vnet.ibm.com>
7337
+ * config/rs6000/rs6000.c (rs6000_option_override_internal):
7338
+ Remove restriction against use of VSX instructions when generating
7339
+ code for little endian mode.
7341
+2013-11-10 Bill Schmidt <wschmidt@linux.vnet.ibm.com>
7343
+ Backport from mainline r204440
7344
+ 2013-11-05 Bill Schmidt <wschmidt@linux.vnet.ibm.com>
7346
+ * config/rs6000/altivec.md (mulv4si3): Ensure we generate vmulouh
7347
+ for both big and little endian.
7348
+ (mulv8hi3): Swap input operands for merge high and merge low
7349
+ instructions for little endian.
7351
+2013-11-10 Bill Schmidt <wschmidt@linux.vnet.ibm.com>
7353
+ Backport from mainline r204439
7354
+ 2013-11-05 Bill Schmidt <wschmidt@linux.vnet.ibm.com>
7356
+ * config/rs6000/altivec.md (vec_widen_umult_even_v16qi): Change
7357
+ define_insn to define_expand that uses even patterns for big
7358
+ endian and odd patterns for little endian.
7359
+ (vec_widen_smult_even_v16qi): Likewise.
7360
+ (vec_widen_umult_even_v8hi): Likewise.
7361
+ (vec_widen_smult_even_v8hi): Likewise.
7362
+ (vec_widen_umult_odd_v16qi): Likewise.
7363
+ (vec_widen_smult_odd_v16qi): Likewise.
7364
+ (vec_widen_umult_odd_v8hi): Likewise.
7365
+ (vec_widen_smult_odd_v8hi): Likewise.
7366
+ (altivec_vmuleub): New define_insn.
7367
+ (altivec_vmuloub): Likewise.
7368
+ (altivec_vmulesb): Likewise.
7369
+ (altivec_vmulosb): Likewise.
7370
+ (altivec_vmuleuh): Likewise.
7371
+ (altivec_vmulouh): Likewise.
7372
+ (altivec_vmulesh): Likewise.
7373
+ (altivec_vmulosh): Likewise.
7375
+2013-11-10 Bill Schmidt <wschmidt@linux.vnet.ibm.com>
7377
+ Backport from mainline r204395
7378
+ 2013-11-05 Bill Schmidt <wschmidt@linux.vnet.ibm.com>
7380
+ * config/rs6000/vector.md (vec_pack_sfix_trunc_v2df): Adjust for
7382
+ (vec_pack_ufix_trunc_v2df): Likewise.
7384
+2013-11-10 Bill Schmidt <wschmidt@linux.vnet.ibm.com>
7386
+ Backport from mainline r204363
7387
+ 2013-11-04 Bill Schmidt <wschmidt@linux.vnet.ibm.com>
7389
+ * config/rs6000/altivec.md (vec_widen_umult_hi_v16qi): Swap
7390
+ arguments to merge instruction for little endian.
7391
+ (vec_widen_umult_lo_v16qi): Likewise.
7392
+ (vec_widen_smult_hi_v16qi): Likewise.
7393
+ (vec_widen_smult_lo_v16qi): Likewise.
7394
+ (vec_widen_umult_hi_v8hi): Likewise.
7395
+ (vec_widen_umult_lo_v8hi): Likewise.
7396
+ (vec_widen_smult_hi_v8hi): Likewise.
7397
+ (vec_widen_smult_lo_v8hi): Likewise.
7399
+2013-11-10 Bill Schmidt <wschmidt@linux.vnet.ibm.com>
7401
+ Backport from mainline r204350
7402
+ 2013-11-04 Bill Schmidt <wschmidt@linux.vnet.ibm.com>
7404
+ * config/rs6000/vsx.md (*vsx_le_perm_store_<mode> for VSX_D):
7405
+ Replace the define_insn_and_split with a define_insn and two
7406
+ define_splits, with the split after reload re-permuting the source
7407
+ register to its original value.
7408
+ (*vsx_le_perm_store_<mode> for VSX_W): Likewise.
7409
+ (*vsx_le_perm_store_v8hi): Likewise.
7410
+ (*vsx_le_perm_store_v16qi): Likewise.
7412
+2013-11-10 Bill Schmidt <wschmidt@linux.vnet.ibm.com>
7414
+ Backport from mainline r204321
7415
+ 2013-11-04 Bill Schmidt <wschmidt@linux.vnet.ibm.com>
7417
+ * config/rs6000/vector.md (vec_pack_trunc_v2df): Adjust for
7420
+2013-11-10 Bill Schmidt <wschmidt@linux.vnet.ibm.com>
7422
+ Backport from mainline r204321
7423
+ 2013-11-02 Bill Schmidt <wschmidt@vnet.linux.ibm.com>
7425
+ * config/rs6000/rs6000.c (rs6000_expand_vector_set): Adjust for
7428
+2013-11-10 Bill Schmidt <wschmidt@linux.vnet.ibm.com>
7430
+ Backport from mainline r203980
7431
+ 2013-10-23 Bill Schmidt <wschmidt@linux.vnet.ibm.com>
7433
+ * config/rs6000/altivec.md (mulv8hi3): Adjust for little endian.
7435
+2013-11-08 Bill Schmidt <wschmidt@linux.vnet.ibm.com>
7437
+ Backport from mainline r203930
7438
+ 2013-10-22 Bill Schmidt <wschmidt@vnet.ibm.com>
7440
+ * config/rs6000/rs6000.c (altivec_expand_vec_perm_const): Reverse
7441
+ meaning of merge-high and merge-low masks for little endian; avoid
7442
+ use of vector-pack masks for little endian for mismatched modes.
7444
+2013-11-08 Bill Schmidt <wschmidt@linux.vnet.ibm.com>
7446
+ Backport from mainline r203877
7447
+ 2013-10-20 Bill Schmidt <wschmidt@linux.vnet.ibm.com>
7449
+ * config/rs6000/altivec.md (vec_unpacku_hi_v16qi): Adjust for
7451
+ (vec_unpacku_hi_v8hi): Likewise.
7452
+ (vec_unpacku_lo_v16qi): Likewise.
7453
+ (vec_unpacku_lo_v8hi): Likewise.
7455
+2013-11-08 Bill Schmidt <wschmidt@linux.vnet.ibm.com>
7457
+ Backport from mainline r203863
7458
+ 2013-10-19 Bill Schmidt <wschmidt@linux.vnet.ibm.com>
7460
+ * config/rs6000/rs6000.c (vspltis_constant): Make sure we check
7461
+ all elements for both endian flavors.
7463
+2013-11-08 Bill Schmidt <wschmidt@linux.vnet.ibm.com>
7465
+ Backport from mainline r203714
7466
+ 2013-10-16 Bill Schmidt <wschmidt@linux.vnet.ibm.com>
7468
+ * gcc/config/rs6000/vector.md (vec_unpacks_hi_v4sf): Correct for
7470
+ (vec_unpacks_lo_v4sf): Likewise.
7471
+ (vec_unpacks_float_hi_v4si): Likewise.
7472
+ (vec_unpacks_float_lo_v4si): Likewise.
7473
+ (vec_unpacku_float_hi_v4si): Likewise.
7474
+ (vec_unpacku_float_lo_v4si): Likewise.
7476
+2013-11-08 Bill Schmidt <wschmidt@linux.vnet.ibm.com>
7478
+ Backport from mainline r203713
7479
+ 2013-10-16 Bill Schmidt <wschmidt@linux.vnet.ibm.com>
7481
+ * config/rs6000/vsx.md (vsx_concat_<mode>): Adjust output for LE.
7482
+ (vsx_concat_v2sf): Likewise.
7484
+2013-11-08 Bill Schmidt <wschmidt@linux.vnet.ibm.com>
7486
+ Backport from mainline r203458
7487
+ 2013-10-11 Bill Schmidt <wschmidt@linux.vnet.ibm.com>
7489
+ * config/rs6000/vsx.md (*vsx_le_perm_load_v2di): Generalize to
7490
+ handle vector float as well.
7491
+ (*vsx_le_perm_load_v4si): Likewise.
7492
+ (*vsx_le_perm_store_v2di): Likewise.
7493
+ (*vsx_le_perm_store_v4si): Likewise.
7495
+2013-11-08 Bill Schmidt <wschmidt@linux.vnet.ibm.com>
7497
+ Backport from mainline r203457
7498
+ 2013-10-11 Bill Schmidt <wschmidt@linux.vnet.ibm.com>
7500
+ * config/rs6000/vector.md (vec_realign_load<mode>): Generate vperm
7501
+ directly to circumvent subtract from splat{31} workaround.
7502
+ * config/rs6000/rs6000-protos.h (altivec_expand_vec_perm_le): New
7504
+ * config/rs6000/rs6000.c (altivec_expand_vec_perm_le): New.
7505
+ * config/rs6000/altivec.md (define_c_enum "unspec"): Add
7506
+ UNSPEC_VPERM_X and UNSPEC_VPERM_UNS_X.
7507
+ (altivec_vperm_<mode>): Convert to define_insn_and_split to
7508
+ separate big and little endian logic.
7509
+ (*altivec_vperm_<mode>_internal): New define_insn.
7510
+ (altivec_vperm_<mode>_uns): Convert to define_insn_and_split to
7511
+ separate big and little endian logic.
7512
+ (*altivec_vperm_<mode>_uns_internal): New define_insn.
7513
+ (vec_permv16qi): Add little endian logic.
7515
+2013-11-08 Bill Schmidt <wschmidt@linux.vnet.ibm.com>
7517
+ Backport from mainline r203247
7518
+ 2013-10-07 Bill Schmidt <wschmidt@linux.vnet.ibm.com>
7520
+ * config/rs6000/rs6000.c (altivec_expand_vec_perm_const_le): New.
7521
+ (altivec_expand_vec_perm_const): Call it.
7523
+2013-11-08 Bill Schmidt <wschmidt@linux.vnet.ibm.com>
7525
+ Backport from mainline r203246
7526
+ 2013-10-07 Bill Schmidt <wschmidt@linux.vnet.ibm.com>
7528
+ * config/rs6000/vector.md (mov<mode>): Emit permuted move
7529
+ sequences for LE VSX loads and stores at expand time.
7530
+ * config/rs6000/rs6000-protos.h (rs6000_emit_le_vsx_move): New
7532
+ * config/rs6000/rs6000.c (rs6000_const_vec): New.
7533
+ (rs6000_gen_le_vsx_permute): New.
7534
+ (rs6000_gen_le_vsx_load): New.
7535
+ (rs6000_gen_le_vsx_store): New.
7536
+ (rs6000_gen_le_vsx_move): New.
7537
+ * config/rs6000/vsx.md (*vsx_le_perm_load_v2di): New.
7538
+ (*vsx_le_perm_load_v4si): New.
7539
+ (*vsx_le_perm_load_v8hi): New.
7540
+ (*vsx_le_perm_load_v16qi): New.
7541
+ (*vsx_le_perm_store_v2di): New.
7542
+ (*vsx_le_perm_store_v4si): New.
7543
+ (*vsx_le_perm_store_v8hi): New.
7544
+ (*vsx_le_perm_store_v16qi): New.
7545
+ (*vsx_xxpermdi2_le_<mode>): New.
7546
+ (*vsx_xxpermdi4_le_<mode>): New.
7547
+ (*vsx_xxpermdi8_le_V8HI): New.
7548
+ (*vsx_xxpermdi16_le_V16QI): New.
7549
+ (*vsx_lxvd2x2_le_<mode>): New.
7550
+ (*vsx_lxvd2x4_le_<mode>): New.
7551
+ (*vsx_lxvd2x8_le_V8HI): New.
7552
+ (*vsx_lxvd2x16_le_V16QI): New.
7553
+ (*vsx_stxvd2x2_le_<mode>): New.
7554
+ (*vsx_stxvd2x4_le_<mode>): New.
7555
+ (*vsx_stxvd2x8_le_V8HI): New.
7556
+ (*vsx_stxvd2x16_le_V16QI): New.
7558
+2013-11-08 Bill Schmidt <wschmidt@linux.vnet.ibm.com>
7560
+ Backport from mainline r201235
7561
+ 2013-07-24 Bill Schmidt <wschmidt@linux.ibm.com>
7562
+ Anton Blanchard <anton@au1.ibm.com>
7564
+ * config/rs6000/altivec.md (altivec_vpkpx): Handle little endian.
7565
+ (altivec_vpks<VI_char>ss): Likewise.
7566
+ (altivec_vpks<VI_char>us): Likewise.
7567
+ (altivec_vpku<VI_char>us): Likewise.
7568
+ (altivec_vpku<VI_char>um): Likewise.
7570
+2013-11-08 Bill Schmidt <wschmidt@linux.vnet.ibm.com>
7572
+ Backport from mainline r201208
7573
+ 2013-07-24 Bill Schmidt <wschmidt@vnet.linux.ibm.com>
7574
+ Anton Blanchard <anton@au1.ibm.com>
7576
+ * config/rs6000/vector.md (vec_realign_load_<mode>): Reorder input
7577
+ operands to vperm for little endian.
7578
+ * config/rs6000/rs6000.c (rs6000_expand_builtin): Use lvsr instead
7579
+ of lvsl to create the control mask for a vperm for little endian.
7581
+2013-11-08 Bill Schmidt <wschmidt@linux.vnet.ibm.com>
7583
+ Backport from mainline r201195
7584
+ 2013-07-23 Bill Schmidt <wschmidt@linux.vnet.ibm.com>
7585
+ Anton Blanchard <anton@au1.ibm.com>
7587
+ * config/rs6000/rs6000.c (altivec_expand_vec_perm_const): Reverse
7588
+ two operands for little-endian.
7590
+2013-11-08 Bill Schmidt <wschmidt@linux.vnet.ibm.com>
7592
+ Backport from mainline r201193
7593
+ 2013-07-23 Bill Schmidt <wschmidt@linux.vnet.ibm.com>
7594
+ Anton Blanchard <anton@au1.ibm.com>
7596
+ * config/rs6000/rs6000.c (altivec_expand_vec_perm_const): Correct
7597
+ selection of field for vector splat in little endian mode.
7599
+2013-11-08 Bill Schmidt <wschmidt@linux.vnet.ibm.com>
7601
+ Backport from mainline r201149
7602
+ 2013-07-22 Bill Schmidt <wschmidt@vnet.linux.ibm.com>
7603
+ Anton Blanchard <anton@au1.ibm.com>
7605
+ * config/rs6000/rs6000.c (rs6000_expand_vector_init): Fix
7606
+ endianness when selecting field to splat.
7608
+2013-10-21 Bill Schmidt <wschmidt@linux.vnet.ibm.com>
7610
+ Backport from mainline
7611
+ 2013-04-05 Bill Schmidt <wschmidt@linux.vnet.ibm.com>
7614
+ * config/rs6000/rs6000.c (rs6000_emit_swdiv_high_precision): Remove.
7615
+ (rs6000_emit_swdiv_low_precision): Remove.
7616
+ (rs6000_emit_swdiv): Rewrite to handle between one and four
7617
+ iterations of Newton-Raphson generally; modify required number of
7618
+ iterations for some cases.
7619
+ * config/rs6000/rs6000.h (RS6000_RECIP_HIGH_PRECISION_P): Remove.
7621
+2013-10-17 Michael Meissner <meissner@linux.vnet.ibm.com>
7623
+ Backport from mainline
7624
+ 2013-10-17 Michael Meissner <meissner@linux.vnet.ibm.com>
7626
+ * config/rs6000/rs6000.c (enum rs6000_reload_reg_type): Add new
7627
+ fields to the reg_addr array that describes the valid addressing
7628
+ mode for any register, general purpose registers, floating point
7629
+ registers, and Altivec registers.
7630
+ (FIRST_RELOAD_REG_CLASS): Likewise.
7631
+ (LAST_RELOAD_REG_CLASS): Likewise.
7632
+ (struct reload_reg_map_type): Likewise.
7633
+ (reload_reg_map_type): Likewise.
7634
+ (RELOAD_REG_VALID): Likewise.
7635
+ (RELOAD_REG_MULTIPLE): Likewise.
7636
+ (RELOAD_REG_INDEXED): Likewise.
7637
+ (RELOAD_REG_OFFSET): Likewise.
7638
+ (RELOAD_REG_PRE_INCDEC): Likewise.
7639
+ (RELOAD_REG_PRE_MODIFY): Likewise.
7640
+ (reg_addr): Likewise.
7641
+ (mode_supports_pre_incdec_p): New helper functions to say whether
7642
+ a given mode supports PRE_INC, PRE_DEC, and PRE_MODIFY.
7643
+ (mode_supports_pre_modify_p): Likewise.
7644
+ (rs6000_debug_vector_unit): Rearrange the -mdebug=reg output to
7645
+ print the valid address mode bits for each mode.
7646
+ (rs6000_debug_print_mode): Likewise.
7647
+ (rs6000_debug_reg_global): Likewise.
7648
+ (rs6000_setup_reg_addr_masks): New function to set up the address
7649
+ mask bits for each type.
7650
+ (rs6000_init_hard_regno_mode_ok): Use memset to clear arrays.
7651
+ Call rs6000_setup_reg_addr_masks to set up the address mask bits.
7652
+ (rs6000_legitimate_address_p): Use mode_supports_pre_incdec_p and
7653
+ mode_supports_pre_modify_p to determine if PRE_INC, PRE_DEC, and
7654
+ PRE_MODIFY are supported.
7655
+ (rs6000_output_move_128bit): Change to use {src,dest}_vmx_p for altivec
7656
+ registers, instead of {src,dest}_av_p.
7657
+ (rs6000_print_options_internal): Tweak the debug output slightly.
7659
+ Backport from mainline
7660
+ 2013-10-03 Michael Meissner <meissner@linux.vnet.ibm.com>
7662
+ * config/rs6000/rs6000-builtin.def (XSRDPIM): Use floatdf2,
7663
+ ceildf2, btruncdf2, instead of vsx_* name.
7665
+ * config/rs6000/vsx.md (vsx_add<mode>3): Change arithmetic
7666
+ iterators to only do V2DF and V4SF here. Move the DF code to
7667
+ rs6000.md where it is combined with SF mode. Replace <VSv> with
7668
+ just 'v' since only vector operations are handled with these insns
7669
+ after moving the DF support to rs6000.md.
7670
+ (vsx_sub<mode>3): Likewise.
7671
+ (vsx_mul<mode>3): Likewise.
7672
+ (vsx_div<mode>3): Likewise.
7673
+ (vsx_fre<mode>2): Likewise.
7674
+ (vsx_neg<mode>2): Likewise.
7675
+ (vsx_abs<mode>2): Likewise.
7676
+ (vsx_nabs<mode>2): Likewise.
7677
+ (vsx_smax<mode>3): Likewise.
7678
+ (vsx_smin<mode>3): Likewise.
7679
+ (vsx_sqrt<mode>2): Likewise.
7680
+ (vsx_rsqrte<mode>2): Likewise.
7681
+ (vsx_fms<mode>4): Likewise.
7682
+ (vsx_nfma<mode>4): Likewise.
7683
+ (vsx_copysign<mode>3): Likewise.
7684
+ (vsx_btrunc<mode>2): Likewise.
7685
+ (vsx_floor<mode>2): Likewise.
7686
+ (vsx_ceil<mode>2): Likewise.
7687
+ (vsx_smaxsf3): Delete scalar ops that were moved to rs6000.md.
7688
+ (vsx_sminsf3): Likewise.
7689
+ (vsx_fmadf4): Likewise.
7690
+ (vsx_fmsdf4): Likewise.
7691
+ (vsx_nfmadf4): Likewise.
7692
+ (vsx_nfmsdf4): Likewise.
7693
+ (vsx_cmpdf_internal1): Likewise.
7695
+ * config/rs6000/rs6000.h (TARGET_SF_SPE): Define macros to make it
7696
+ simpler to select whether a target has SPE or traditional floating
7697
+ point support in iterators.
7698
+ (TARGET_DF_SPE): Likewise.
7699
+ (TARGET_SF_FPR): Likewise.
7700
+ (TARGET_DF_FPR): Likewise.
7701
+ (TARGET_SF_INSN): Macros to say whether floating point support
7702
+ exists for a given operation for expanders.
7703
+ (TARGET_DF_INSN): Likewise.
7705
+ * config/rs6000/rs6000.c (Ftrad): New mode attributes to allow
7706
+ combining of SF/DF mode operations, using both traditional and VSX
7714
+ (abs<mode>2): Combine SF/DF modes using traditional floating point
7715
+ instructions. Add support for using the upper DF registers with
7716
+ VSX support, and SF registers with power8-vector support. Update
7717
+ expanders for operations supported by both the SPE and traditional
7718
+ floating point units.
7719
+ (abs<mode>2_fpr): Likewise.
7720
+ (nabs<mode>2): Likewise.
7721
+ (nabs<mode>2_fpr): Likewise.
7722
+ (neg<mode>2): Likewise.
7723
+ (neg<mode>2_fpr): Likewise.
7724
+ (add<mode>3): Likewise.
7725
+ (add<mode>3_fpr): Likewise.
7726
+ (sub<mode>3): Likewise.
7727
+ (sub<mode>3_fpr): Likewise.
7728
+ (mul<mode>3): Likewise.
7729
+ (mul<mode>3_fpr): Likewise.
7730
+ (div<mode>3): Likewise.
7731
+ (div<mode>3_fpr): Likewise.
7732
+ (sqrt<mode>3): Likewise.
7733
+ (sqrt<mode>3_fpr): Likewise.
7734
+ (fre<Fs>): Likewise.
7735
+ (rsqrt<mode>2): Likewise.
7736
+ (cmp<mode>_fpr): Likewise.
7737
+ (smax<mode>3): Likewise.
7738
+ (smin<mode>3): Likewise.
7739
+ (smax<mode>3_vsx): Likewise.
7740
+ (smin<mode>3_vsx): Likewise.
7741
+ (negsf2): Delete SF operations that are merged with DF.
7742
+ (abssf2): Likewise.
7743
+ (addsf3): Likewise.
7744
+ (subsf3): Likewise.
7745
+ (mulsf3): Likewise.
7746
+ (divsf3): Likewise.
7748
+ (fmasf4_fpr): Likewise.
7749
+ (fmssf4_fpr): Likewise.
7750
+ (nfmasf4_fpr): Likewise.
7751
+ (nfmssf4_fpr): Likewise.
7752
+ (sqrtsf2): Likewise.
7753
+ (rsqrtsf_internal1): Likewise.
7754
+ (smaxsf3): Likewise.
7755
+ (sminsf3): Likewise.
7756
+ (cmpsf_internal1): Likewise.
7757
+ (copysign<mode>3_fcpsgn): Add VSX/power8-vector support.
7758
+ (negdf2): Delete DF operations that are merged with SF.
7759
+ (absdf2): Likewise.
7760
+ (nabsdf2): Likewise.
7761
+ (adddf3): Likewise.
7762
+ (subdf3): Likewise.
7763
+ (muldf3): Likewise.
7764
+ (divdf3): Likewise.
7766
+ (rsqrtdf_internal1): Likewise.
7767
+ (fmadf4_fpr): Likewise.
7768
+ (fmsdf4_fpr): Likewise.
7769
+ (nfmadf4_fpr): Likewise.
7770
+ (nfmsdf4_fpr): Likewise.
7771
+ (sqrtdf2): Likewise.
7772
+ (smaxdf3): Likewise.
7773
+ (smindf3): Likewise.
7774
+ (cmpdf_internal1): Likewise.
7775
+ (lrint<mode>di2): Use TARGET_<MODE>_FPR macro.
7776
+ (btrunc<mode>2): Delete separate expander, and combine with the
7777
+ insn and add VSX instruction support. Use TARGET_<MODE>_FPR.
7778
+ (btrunc<mode>2_fpr): Likewise.
7779
+ (ceil<mode>2): Likewise.
7780
+ (ceil<mode>2_fpr): Likewise.
7781
+ (floor<mode>2): Likewise.
7782
+ (floor<mode>2_fpr): Likewise.
7783
+ (fma<mode>4_fpr): Combine SF and DF fused multiply/add support.
7784
+ Add support for using the upper registers with VSX and
7785
+ power8-vector. Move insns to be closer to the define_expands. On
7786
+ VSX systems, prefer the traditional form of FMA over the VSX
7787
+ version, since the traditional form allows the target not to
7788
+ overlap with the inputs.
7789
+ (fms<mode>4_fpr): Likewise.
7790
+ (nfma<mode>4_fpr): Likewise.
7791
+ (nfms<mode>4_fpr): Likewise.
7793
+ Backport from mainline
7794
+ 2013-09-27 Michael Meissner <meissner@linux.vnet.ibm.com>
7796
+ * config/rs6000/rs6000.c (rs6000_hard_regno_mode_ok): Allow
7797
+ DFmode, DImode, and SFmode in the upper VSX registers based on the
7798
+ -mupper-regs-{df,sf} flags. Fix wu constraint to be ALTIVEC_REGS
7799
+ if -mpower8-vector. Combine -mvsx-timode handling with the rest
7800
+ of the VSX register handling.
7802
+ * config/rs6000/rs6000.md (f32_lv): Use %x0 for VSX regsters.
7803
+ (f32_sv): Likewise.
7804
+ (zero_extendsidi2_lfiwzx): Add support for loading into the
7805
+ Altivec registers with -mpower8-vector. Use wu/wv constraints to
7806
+ only do VSX memory options on Altivec registers.
7807
+ (extendsidi2_lfiwax): Likewise.
7808
+ (extendsfdf2_fpr): Likewise.
7809
+ (mov<mode>_hardfloat, SF/SD modes): Likewise.
7810
+ (mov<mode>_hardfloat32, DF/DD modes): Likewise.
7811
+ (mov<mode>_hardfloat64, DF/DD modes): Likewise.
7812
+ (movdi_internal64): Likewise.
7814
+ Backport from mainline
7815
+ 2013-09-23 Michael Meissner <meissner@linux.vnet.ibm.com>
7817
+ * config/rs6000/rs6000.c (rs6000_vector_reload): Delete, combine
7818
+ reload helper function arrays into a single array reg_addr.
7819
+ (reload_fpr_gpr): Likewise.
7820
+ (reload_gpr_vsx): Likewise.
7821
+ (reload_vsx_gpr): Likewise.
7822
+ (struct rs6000_reg_addr): Likewise.
7823
+ (reg_addr): Likewise.
7824
+ (rs6000_debug_reg_global): Change rs6000_vector_reload,
7825
+ reload_fpr_gpr, reload_gpr_vsx, reload_vsx_gpr uses to reg_addr.
7826
+ (rs6000_init_hard_regno_mode_ok): Likewise.
7827
+ (rs6000_secondary_reload_direct_move): Likewise.
7828
+ (rs6000_secondary_reload): Likewise.
7830
+ * config/rs6000/rs6000.h (enum r6000_reg_class_enum): Add new
7831
+ constraints: wu, ww, and wy. Repurpose wv constraint added during
7832
+ power8 changes. Put wg constraint in alphabetical order.
7834
+ * config/rs6000/rs6000.opt (-mvsx-scalar-float): New debug switch
7835
+ for future work to add ISA 2.07 VSX single precision support.
7836
+ (-mvsx-scalar-double): Change default from -1 to 1, update
7837
+ documentation comment.
7838
+ (-mvsx-scalar-memory): Rename debug switch to -mupper-regs-df.
7839
+ (-mupper-regs-df): New debug switch to control whether DF values
7840
+ can go in the traditional Altivec registers.
7841
+ (-mupper-regs-sf): New debug switch to control whether SF values
7842
+ can go in the traditional Altivec registers.
7844
+ * config/rs6000/rs6000.c (rs6000_debug_reg_global): Print wu, ww,
7845
+ and wy constraints.
7846
+ (rs6000_init_hard_regno_mode_ok): Use ssize_t instead of int for
7847
+ loop variables. Rename -mvsx-scalar-memory to -mupper-regs-df.
7848
+ Add new constraints, wu/ww/wy. Repurpose wv constraint.
7849
+ (rs6000_debug_legitimate_address_p): Print if we are running
7850
+ before, during, or after reload.
7851
+ (rs6000_secondary_reload): Add a comment.
7852
+ (rs6000_opt_masks): Add -mupper-regs-df, -mupper-regs-sf.
7854
+ * config/rs6000/constraints.md (wa constraint): Sort w<x>
7855
+ constraints. Update documentation string.
7856
+ (wd constraint): Likewise.
7857
+ (wf constraint): Likewise.
7858
+ (wg constraint): Likewise.
7859
+ (wn constraint): Likewise.
7860
+ (ws constraint): Likewise.
7861
+ (wt constraint): Likewise.
7862
+ (wx constraint): Likewise.
7863
+ (wz constraint): Likewise.
7864
+ (wu constraint): New constraint for ISA 2.07 SFmode scalar
7866
+ (ww constraint): Likewise.
7867
+ (wy constraint): Likewise.
7868
+ (wv constraint): Repurpose ISA 2.07 constraint that did not use in
7869
+ the previous submissions.
7870
+ * doc/md.texi (PowerPC and IBM RS6000): Likewise.
7872
+ Backport from mainline
7873
+ 2013-10-17 Michael Meissner <meissner@linux.vnet.ibm.com>
7876
+ * config/rs6000/rs6000.c (rs6000_legitimate_address_p): Only
7877
+ restrict TImode addresses to single indirect registers if both
7878
+ -mquad-memory and -mvsx-timode are used.
7879
+ (rs6000_output_move_128bit): Use quad_load_store_p to determine if
7880
+ we should emit load/store quad. Remove using %y for quad memory
7883
+ * config/rs6000/rs6000.md (mov<mode>_ppc64, TI/PTImode): Add
7884
+ constraints to allow load/store quad on machines where TImode is
7885
+ not allowed in VSX registers. Use 'n' instead of 'F' constraint
7886
+ for TImode to load integer constants.
7888
+2013-10-02 Michael Meissner <meissner@linux.vnet.ibm.com>
7890
+ Backport from mainline
7891
+ 2013-10-02 Michael Meissner <meissner@linux.vnet.ibm.com>
7894
+ * config/rs6000/rs6000-cpus.def (ISA_2_6_MASKS_SERVER): Turn off
7895
+ setting -mvsx-timode by default until the underlying problem is
7897
+ (RS6000_CPU, power7 defaults): Likewise.
7899
+2013-08-19 Peter Bergner <bergner@vnet.ibm.com>
7901
+ Backport from mainline
7902
+ 2013-08-19 Peter Bergner <bergner@vnet.ibm.com>
7903
+ Jakub Jelinek <jakub@redhat.com>
7905
+ * builtins.def (BUILT_IN_FABSD32): New DFP ABS builtin.
7906
+ (BUILT_IN_FABSD64): Likewise.
7907
+ (BUILT_IN_FABSD128): Likewise.
7908
+ * builtins.c (expand_builtin): Add support for
7909
+ new DFP ABS builtins.
7910
+ (fold_builtin_1): Likewise.
7911
+ * config/rs6000/dfp.md
7912
+ (*negtd2_fpr): Handle
7913
+ non-overlapping destination
7914
+ and source operands.
7920
+2013-08-16 Michael Meissner <meissner@linux.vnet.ibm.com>
7922
+ Backport from trunk
7923
+ 2013-08-16 Michael Meissner <meissner@linux.vnet.ibm.com>
7926
+ * config/rs6000/predicates.md (fusion_gpr_mem_load): Allow the
7927
+ memory rtx to contain ZERO_EXTEND and SIGN_EXTEND.
7929
+ * config/rs6000/rs6000-protos.h (fusion_gpr_load_p): Pass operands
7930
+ array instead of each individual operand as a separate argument.
7931
+ (emit_fusion_gpr_load): Likewise.
7932
+ (expand_fusion_gpr_load): Add new function declaration.
7934
+ * config/rs6000/rs6000.c (fusion_gpr_load_p): Change the calling
7935
+ signature to have the operands passed as an array, instead of as
7936
+ separate arguments. Allow ZERO_EXTEND to be in the memory
7937
+ address, and also SIGN_EXTEND if -mpower8-fusion-sign. Do not
7938
+ depend on the register live/dead flags when peepholes are run.
7939
+ (expand_fusion_gpr_load): New function to be called from the
7940
+ peephole2 pass, to change the register that addis sets to be the
7942
+ (emit_fusion_gpr_load): Change the calling signature to have the
7943
+ operands passed as an array, instead of as separate arguments.
7944
+ Allow ZERO_EXTEND to be in the memory address, and also
7945
+ SIGN_EXTEND if -mpower8-fusion-sign.
7947
+ * config/rs6000/rs6000.md (UNSPEC_FUSION_GPR): Delete unused
7948
+ unspec enumeration.
7949
+ (power8 fusion peephole/peephole2): Rework the fusion peepholes to
7950
+ adjust the register addis loads up in the peephole2 pass. Do not
7951
+ depend on the register live/dead state when the peephole pass is
7954
+ Backport from trunk
7955
+ 2013-07-23 Michael Meissner <meissner@linux.vnet.ibm.com>
7957
+ * config/rs6000/vector.md (xor<mode>3): Move 128-bit boolean
7958
+ expanders to rs6000.md.
7959
+ (ior<mode>3): Likewise.
7960
+ (and<mode>3): Likewise.
7961
+ (one_cmpl<mode>2): Likewise.
7962
+ (nor<mode>3): Likewise.
7963
+ (andc<mode>3): Likewise.
7964
+ (eqv<mode>3): Likewise.
7965
+ (nand<mode>3): Likewise.
7966
+ (orc<mode>3): Likewise.
7968
+ * config/rs6000/rs6000-protos.h (rs6000_split_logical): New
7971
+ * config/rs6000/rs6000.c (rs6000_split_logical_inner): Add support
7972
+ to split multi-word logical operations.
7973
+ (rs6000_split_logical_di): Likewise.
7974
+ (rs6000_split_logical): Likewise.
7976
+ * config/rs6000/vsx.md (VSX_L2): Delete, no longer used.
7977
+ (vsx_and<mode>3_32bit): Move 128-bit logical insns to rs6000.md,
7978
+ and allow TImode operations in 32-bit.
7979
+ (vsx_and<mode>3_64bit): Likewise.
7980
+ (vsx_ior<mode>3_32bit): Likewise.
7981
+ (vsx_ior<mode>3_64bit): Likewise.
7982
+ (vsx_xor<mode>3_32bit): Likewise.
7983
+ (vsx_xor<mode>3_64bit): Likewise.
7984
+ (vsx_one_cmpl<mode>2_32bit): Likewise.
7985
+ (vsx_one_cmpl<mode>2_64bit): Likewise.
7986
+ (vsx_nor<mode>3_32bit): Likewise.
7987
+ (vsx_nor<mode>3_64bit): Likewise.
7988
+ (vsx_andc<mode>3_32bit): Likewise.
7989
+ (vsx_andc<mode>3_64bit): Likewise.
7990
+ (vsx_eqv<mode>3_32bit): Likewise.
7991
+ (vsx_eqv<mode>3_64bit): Likewise.
7992
+ (vsx_nand<mode>3_32bit): Likewise.
7993
+ (vsx_nand<mode>3_64bit): Likewise.
7994
+ (vsx_orc<mode>3_32bit): Likewise.
7995
+ (vsx_orc<mode>3_64bit): Likewise.
7997
+ * config/rs6000/rs6000.h (VLOGICAL_REGNO_P): Always allow vector
7998
+ logical types in GPRs.
8000
+ * config/rs6000/altivec.md (altivec_and<mode>3): Move 128-bit
8001
+ logical insns to rs6000.md, and allow TImode operations in
8003
+ (altivec_ior<mode>3): Likewise.
8004
+ (altivec_xor<mode>3): Likewise.
8005
+ (altivec_one_cmpl<mode>2): Likewise.
8006
+ (altivec_nor<mode>3): Likewise.
8007
+ (altivec_andc<mode>3): Likewise.
8009
+ * config/rs6000/rs6000.md (BOOL_128): New mode iterators and mode
8010
+ attributes for moving the 128-bit logical operations into
8012
+ (BOOL_REGS_OUTPUT): Likewise.
8013
+ (BOOL_REGS_OP1): Likewise.
8014
+ (BOOL_REGS_OP2): Likewise.
8015
+ (BOOL_REGS_UNARY): Likewise.
8016
+ (BOOL_REGS_AND_CR0): Likewise.
8017
+ (one_cmpl<mode>2): Add support for DI logical operations on
8018
+ 32-bit, splitting the operations to 32-bit.
8019
+ (anddi3): Likewise.
8020
+ (iordi3): Likewise.
8021
+ (xordi3): Likewise.
8022
+ (and<mode>3, 128-bit types): Rewrite 2013-06-06 logical operator
8023
+ changes to combine the 32/64-bit code, allow logical operations on
8024
+ TI mode in 32-bit, and to use similar match_operator patterns like
8025
+ scalar mode uses. Combine the Altivec and VSX code for logical
8026
+ operations, and move it here.
8027
+ (ior<mode>3, 128-bit types): Likewise.
8028
+ (xor<mode>3, 128-bit types): Likewise.
8029
+ (one_cmpl<mode>3, 128-bit types): Likewise.
8030
+ (nor<mode>3, 128-bit types): Likewise.
8031
+ (andc<mode>3, 128-bit types): Likewise.
8032
+ (eqv<mode>3, 128-bit types): Likewise.
8033
+ (nand<mode>3, 128-bit types): Likewise.
8034
+ (orc<mode>3, 128-bit types): Likewise.
8035
+ (and<mode>3_internal): Likewise.
8036
+ (bool<mode>3_internal): Likewise.
8037
+ (boolc<mode>3_internal1): Likewise.
8038
+ (boolc<mode>3_internal2): Likewise.
8039
+ (boolcc<mode>3_internal1): Likewise.
8040
+ (boolcc<mode>3_internal2): Likewise.
8041
+ (eqv<mode>3_internal1): Likewise.
8042
+ (eqv<mode>3_internal2): Likewise.
8043
+ (one_cmpl1<mode>3_internal): Likewise.
8045
+2013-07-31 Michael Meissner <meissner@linux.vnet.ibm.com>
8047
+ Backport from mainline
8048
+ 2013-07-31 Michael Meissner <meissner@linux.vnet.ibm.com>
8050
+ * config/rs6000/predicates.md (fusion_gpr_addis): New predicates
8051
+ to support power8 load fusion.
8052
+ (fusion_gpr_mem_load): Likewise.
8054
+ * config/rs6000/rs6000-modes.def (PTImode): Update a comment.
8056
+ * config/rs6000/rs6000-protos.h (fusion_gpr_load_p): New
8057
+ declarations for power8 load fusion.
8058
+ (emit_fusion_gpr_load): Likewise.
8060
+ * config/rs6000/rs6000.c (rs6000_option_override_internal): If
8061
+ tuning for power8, turn on fusion mode by default. Turn on sign
8062
+ extending fusion mode if normal fusion mode is on, and we are at
8064
+ (fusion_gpr_load_p): New function, return true if we can fuse an
8065
+ addis instruction with a dependent load to a GPR.
8066
+ (emit_fusion_gpr_load): Emit the instructions for power8 load
8069
+ * config/rs6000/vsx.md (VSX_M2): New iterator for fusion
8071
+ (VSX load fusion peepholes): New peepholes to fuse together an
8072
+ addi instruction with a VSX load instruction.
8074
+ * config/rs6000/rs6000.md (GPR load fusion peepholes): New
8075
+ peepholes to fuse an addis instruction with a load to a GPR base
8076
+ register. If we are supporting sign extending fusions, convert
8077
+ sign extending loads to zero extending loads and add an explicit
8080
+2013-07-19 Pat Haugen <pthaugen@us.ibm.com>
8082
+ Backport from mainline
8083
+ 2013-07-18 Pat Haugen <pthaugen@us.ibm.com>
8085
+ * config/rs6000/rs6000.c (rs6000_option_override_internal): Adjust flag
8086
+ interaction for new Power8 flags and VSX.
8088
+2013-07-17 Peter Bergner <bergner@vnet.ibm.com>
8090
+ Backport from mainline
8091
+ 2013-07-17 Iain Sandoe <iain@codesourcery.com>
8093
+ * config/rs6000/darwin.h (REGISTER_NAMES): Add HTM registers.
8095
+2013-07-16 Peter Bergner <bergner@vnet.ibm.com>
8097
+ Merge up to 200989.
8098
+ * REVISION: Update subversion id.
8100
+2013-07-16 Peter Bergner <bergner@vnet.ibm.com>
8102
+ Backport from mainline
8103
+ 2013-07-16 Peter Bergner <bergner@vnet.ibm.com>
8105
+ * config/rs6000/rs6000.c (rs6000_option_override_internal): Do not
8106
+ enable extra ISA flags with TARGET_HTM.
8108
+ 2013-07-16 Jakub Jelinek <jakub@redhat.com>
8109
+ Peter Bergner <bergner@vnet.ibm.com>
8111
+ * config/rs6000/rs6000.h (FIRST_PSEUDO_REGISTERS): Mention HTM
8112
+ registers in the comment.
8113
+ (DWARF_FRAME_REGISTERS): Subtract also the 3 HTM registers.
8114
+ (DWARF_REG_TO_UNWIND_COLUMN): Use DWARF_FRAME_REGISTERS
8115
+ rather than FIRST_PSEUDO_REGISTERS.
8117
+2013-07-15 Peter Bergner <bergner@vnet.ibm.com>
8119
+ Backport from mainline
8120
+ 2013-07-15 Peter Bergner <bergner@vnet.ibm.com>
8122
+ * config.gcc (powerpc*-*-*): Install htmintrin.h and htmxlintrin.h.
8123
+ * config/rs6000/t-rs6000 (MD_INCLUDES): Add htm.md.
8124
+ * config/rs6000/rs6000.opt: Add -mhtm option.
8125
+ * config/rs6000/rs6000-cpus.def (POWERPC_MASKS): Add OPTION_MASK_HTM.
8126
+ (ISA_2_7_MASKS_SERVER): Add OPTION_MASK_HTM.
8127
+ * config/rs6000/rs6000-c.c (rs6000_target_modify_macros): Define
8128
+ __HTM__ if the HTM instructions are available.
8129
+ * config/rs6000/predicates.md (u3bit_cint_operand, u10bit_cint_operand,
8130
+ htm_spr_reg_operand): New define_predicates.
8131
+ * config/rs6000/rs6000.md (define_attr "type"): Add htm.
8132
+ (TFHAR_REGNO, TFIAR_REGNO, TEXASR_REGNO): New define_constants.
8134
+ * config/rs6000/rs6000-builtin.def (BU_HTM_0, BU_HTM_1, BU_HTM_2,
8135
+ BU_HTM_3, BU_HTM_SPR0, BU_HTM_SPR1): Add support macros for defining
8136
+ HTM builtin functions.
8137
+ * config/rs6000/rs6000.c (RS6000_BUILTIN_H): New macro.
8138
+ (rs6000_reg_names, alt_reg_names): Add HTM SPR register names.
8139
+ (rs6000_init_hard_regno_mode_ok): Add support for HTM instructions.
8140
+ (rs6000_builtin_mask_calculate): Likewise.
8141
+ (rs6000_option_override_internal): Likewise.
8142
+ (bdesc_htm): Add new HTM builtin support.
8143
+ (htm_spr_num): New function.
8144
+ (htm_spr_regno): Likewise.
8145
+ (rs6000_htm_spr_icode): Likewise.
8146
+ (htm_expand_builtin): Likewise.
8147
+ (htm_init_builtins): Likewise.
8148
+ (rs6000_expand_builtin): Add support for HTM builtin functions.
8149
+ (rs6000_init_builtins): Likewise.
8150
+ (rs6000_invalid_builtin, rs6000_opt_mask): Add support for -mhtm option.
8151
+ * config/rs6000/rs6000.h (ASM_CPU_SPEC): Add support for -mhtm.
8152
+ (TARGET_HTM, MASK_HTM): Define macros.
8153
+ (FIRST_PSEUDO_REGISTER): Adjust for new HTM SPR registers.
8154
+ (FIXED_REGISTERS): Likewise.
8155
+ (CALL_USED_REGISTERS): Likewise.
8156
+ (CALL_REALLY_USED_REGISTERS): Likewise.
8157
+ (REG_ALLOC_ORDER): Likewise.
8158
+ (enum reg_class): Likewise.
8159
+ (REG_CLASS_NAMES): Likewise.
8160
+ (REG_CLASS_CONTENTS): Likewise.
8161
+ (REGISTER_NAMES): Likewise.
8162
+ (ADDITIONAL_REGISTER_NAMES): Likewise.
8163
+ (RS6000_BTC_SPR, RS6000_BTC_VOID, RS6000_BTC_32BIT, RS6000_BTC_64BIT,
8164
+ RS6000_BTC_MISC_MASK, RS6000_BTM_HTM): New macros.
8165
+ (RS6000_BTM_COMMON): Add RS6000_BTM_HTM.
8166
+ * config/rs6000/htm.md: New file.
8167
+ * config/rs6000/htmintrin.h: New file.
8168
+ * config/rs6000/htmxlintrin.h: New file.
8170
+2013-06-28 Michael Meissner <meissner@linux.vnet.ibm.com>
8172
+ Back port from the trunk
8173
+ 2013-06-28 Michael Meissner <meissner@linux.vnet.ibm.com>
8176
+ * config/rs6000/rs6000.h (MODES_TIEABLE_P): Do not allow PTImode
8177
+ to tie with any other modes. Eliminate Altivec vector mode tests,
8178
+ since these are a subset of ALTIVEC or VSX vector modes. Simplify
8179
+ code, to return 0 if testing MODE2 for a condition, if we've
8180
+ already tested MODE1 for the same condition.
8182
+2013-06-28 Pat Haugen <pthaugen@us.ibm.com>
8184
+ * config/rs6000/rs6000.md (define_insn ""): Fix insn type.
8186
+2013-06-26 Pat Haugen <pthaugen@us.ibm.com>
8188
+ Back port from the trunk
8189
+ 2013-06-26 Michael Meissner <meissner@linux.vnet.ibm.com>
8190
+ Pat Haugen <pthaugen@us.ibm.com>
8191
+ Peter Bergner <bergner@vnet.ibm.com>
8193
+ * config/rs6000/power8.md: New.
8194
+ * config/rs6000/rs6000-cpus.def (RS6000_CPU table): Adjust processor
8195
+ setting for power8 entry.
8196
+ * config/rs6000/t-rs6000 (MD_INCLUDES): Add power8.md.
8197
+ * config/rs6000/rs6000.c (is_microcoded_insn, is_cracked_insn): Adjust
8198
+ test for Power4/Power5 only.
8199
+ (insn_must_be_first_in_group, insn_must_be_last_in_group): Add Power8
8201
+ (force_new_group): Adjust comment.
8202
+ * config/rs6000/rs6000.md: Include power8.md.
8204
+2013-06-14 Michael Meissner <meissner@linux.vnet.ibm.com>
8206
+ Back port from the trunk
8207
+ 2013-06-14 Michael Meissner <meissner@linux.vnet.ibm.com>
8210
+ * config/rs6000/rs6000.md (mov<mode>_ppc64): Call
8211
+ rs6000_output_move_128bit to handle emitting quad memory
8212
+ operations. Set attribute length to 8 bytes.
8214
+2013-06-13 Michael Meissner <meissner@linux.vnet.ibm.com>
8216
+ Back port from the trunk
8217
+ 2013-06-13 Michael Meissner <meissner@linux.vnet.ibm.com>
8219
+ * config/rs6000/rs6000.c (rs6000_option_override_internal): Move
8220
+ test for clearing quad memory on 32-bit later.
8222
+2013-06-12 Michael Meissner <meissner@linux.vnet.ibm.com>
8224
+ Back port from the trunk
8226
+ Backport from mainline
8227
+ 2013-06-12 Michael Meissner <meissner@linux.vnet.ibm.com>
8228
+ Pat Haugen <pthaugen@us.ibm.com>
8229
+ Peter Bergner <bergner@vnet.ibm.com>
8231
+ * config/rs6000/rs6000.c (emit_load_locked): Add support for
8232
+ power8 byte, half-word, and quad-word atomic instructions.
8233
+ (emit_store_conditional): Likewise.
8234
+ (rs6000_expand_atomic_compare_and_swap): Likewise.
8235
+ (rs6000_expand_atomic_op): Likewise.
8237
+ * config/rs6000/sync.md (larx): Add new modes for power8.
8239
+ (AINT): New mode iterator to include TImode as well as normal
8240
+ integer modes on power8.
8241
+ (fetchop_pred): Use int_reg_operand instead of gpc_reg_operand so
8242
+ that VSX registers are not considered. Use AINT mode iterator
8243
+ instead of INT1 to allow inclusion of quad word atomic operations
8245
+ (load_locked<mode>): Likewise.
8246
+ (store_conditional<mode>): Likewise.
8247
+ (atomic_compare_and_swap<mode>): Likewise.
8248
+ (atomic_exchange<mode>): Likewise.
8249
+ (atomic_nand<mode>): Likewise.
8250
+ (atomic_fetch_<fetchop_name><mode>): Likewise.
8251
+ (atomic_nand_fetch<mode>): Likewise.
8252
+ (mem_thread_fence): Use gen_loadsync_<mode> instead of enumerating
8254
+ (ATOMIC): On power8, add QImode, HImode modes.
8255
+ (load_locked<QHI:mode>_si): Varients of load_locked for QI/HI
8256
+ modes that promote to SImode.
8257
+ (load_lockedti): Convert TImode arguments to PTImode, so that we
8258
+ get a guaranteed even/odd register pair.
8259
+ (load_lockedpti): Likewise.
8260
+ (store_conditionalti): Likewise.
8261
+ (store_conditionalpti): Likewise.
8263
+ * config/rs6000/rs6000.md (QHI): New mode iterator for power8
8264
+ atomic load/store instructions.
8267
+2013-06-11 Michael Meissner <meissner@linux.vnet.ibm.com>
8269
+ Back port from the trunk
8271
+ 2013-06-11 Michael Meissner <meissner@linux.vnet.ibm.com>
8272
+ Pat Haugen <pthaugen@us.ibm.com>
8273
+ Peter Bergner <bergner@vnet.ibm.com>
8275
+ * config/rs6000/rs6000.c (emit_load_locked): Add support for
8276
+ power8 byte, half-word, and quad-word atomic instructions.
8277
+ (emit_store_conditional): Likewise.
8278
+ (rs6000_expand_atomic_compare_and_swap): Likewise.
8279
+ (rs6000_expand_atomic_op): Likewise.
8281
+ * config/rs6000/sync.md (larx): Add new modes for power8.
8283
+ (AINT): New mode iterator to include TImode as well as normal
8284
+ integer modes on power8.
8285
+ (fetchop_pred): Use int_reg_operand instead of gpc_reg_operand so
8286
+ that VSX registers are not considered. Use AINT mode iterator
8287
+ instead of INT1 to allow inclusion of quad word atomic operations
8289
+ (load_locked<mode>): Likewise.
8290
+ (store_conditional<mode>): Likewise.
8291
+ (atomic_compare_and_swap<mode>): Likewise.
8292
+ (atomic_exchange<mode>): Likewise.
8293
+ (atomic_nand<mode>): Likewise.
8294
+ (atomic_fetch_<fetchop_name><mode>): Likewise.
8295
+ (atomic_nand_fetch<mode>): Likewise.
8296
+ (mem_thread_fence): Use gen_loadsync_<mode> instead of enumerating
8298
+ (ATOMIC): On power8, add QImode, HImode modes.
8299
+ (load_locked<QHI:mode>_si): Varients of load_locked for QI/HI
8300
+ modes that promote to SImode.
8301
+ (load_lockedti): Convert TImode arguments to PTImode, so that we
8302
+ get a guaranteed even/odd register pair.
8303
+ (load_lockedpti): Likewise.
8304
+ (store_conditionalti): Likewise.
8305
+ (store_conditionalpti): Likewise.
8307
+ * config/rs6000/rs6000.md (QHI): New mode iterator for power8
8308
+ atomic load/store instructions.
8312
+ * config/rs6000/driver-rs6000.c (elf_platform): Make buffer static
8313
+ to allow returning address to AT_PLATFORM name.
8315
+ Back port from the trunk
8317
+ 2013-06-10 Michael Meissner <meissner@linux.vnet.ibm.com>
8318
+ Pat Haugen <pthaugen@us.ibm.com>
8319
+ Peter Bergner <bergner@vnet.ibm.com>
8321
+ * config/rs6000/vector.md (GPR move splitter): Do not split moves
8322
+ of vectors in GPRS if they are direct moves or quad word load or
8325
+ * config/rs6000/rs6000-protos.h (rs6000_output_move_128bit): Add
8327
+ (direct_move_p): Likewise.
8328
+ (quad_load_store_p): Likewise.
8330
+ * config/rs6000/rs6000.c (enum rs6000_reg_type): Simplify register
8331
+ classes into bins based on the physical register type.
8332
+ (reg_class_to_reg_type): Likewise.
8333
+ (IS_STD_REG_TYPE): Likewise.
8334
+ (IS_FP_VECT_REG_TYPE): Likewise.
8335
+ (reload_fpr_gpr): Arrays to determine what insn to use if we can
8336
+ use direct move instructions.
8337
+ (reload_gpr_vsx): Likewise.
8338
+ (reload_vsx_gpr): Likewise.
8339
+ (rs6000_init_hard_regno_mode_ok): Precalculate the register type
8340
+ information that is a simplification of register classes. Also
8341
+ precalculate direct move reload helpers.
8342
+ (direct_move_p): New function to return true if the operation can
8343
+ be done as a direct move instruciton.
8344
+ (quad_load_store_p): New function to return true if the operation
8345
+ is a quad memory operation.
8346
+ (rs6000_legitimize_address): If quad memory, only allow register
8347
+ indirect for TImode addresses.
8348
+ (rs6000_legitimate_address_p): Likewise.
8349
+ (enum reload_reg_type): Delete, replace with rs6000_reg_type.
8350
+ (rs6000_reload_register_type): Likewise.
8351
+ (register_to_reg_type): Return register type.
8352
+ (rs6000_secondary_reload_simple_move): New helper function for
8353
+ secondary reload and secondary memory needed to identify anything
8354
+ that is a simple move, and does not need reloading.
8355
+ (rs6000_secondary_reload_direct_move): New helper function for
8356
+ secondary reload to identify cases that can be done with several
8357
+ instructions via the direct move instructions.
8358
+ (rs6000_secondary_reload_move): New helper function for secondary
8359
+ reload to identify moves between register types that can be done.
8360
+ (rs6000_secondary_reload): Add support for quad memory operations
8361
+ and for direct move.
8362
+ (rs6000_secondary_memory_needed): Likewise.
8363
+ (rs6000_debug_secondary_memory_needed): Change argument names.
8364
+ (rs6000_output_move_128bit): New function to return the move to
8365
+ use for 128-bit moves, including knowing about the various
8366
+ limitations of quad memory operations.
8368
+ * config/rs6000/vsx.md (vsx_mov<mode>): Add support for quad
8369
+ memory operations. call rs6000_output_move_128bit for the actual
8370
+ instruciton(s) to generate.
8371
+ (vsx_movti_64bit): Likewise.
8373
+ * config/rs6000/rs6000.md (UNSPEC_P8V_FMRGOW): New unspec values.
8374
+ (UNSPEC_P8V_MTVSRWZ): Likewise.
8375
+ (UNSPEC_P8V_RELOAD_FROM_GPR): Likewise.
8376
+ (UNSPEC_P8V_MTVSRD): Likewise.
8377
+ (UNSPEC_P8V_XXPERMDI): Likewise.
8378
+ (UNSPEC_P8V_RELOAD_FROM_VSX): Likewise.
8379
+ (UNSPEC_FUSION_GPR): Likewise.
8380
+ (FMOVE128_GPR): New iterator for direct move.
8381
+ (f32_lv): New mode attribute for load/store of SFmode/SDmode
8383
+ (f32_sv): Likewise.
8384
+ (f32_dm): Likewise.
8385
+ (zero_extend<mode>di2_internal1): Add support for power8 32-bit
8386
+ loads and direct move instructions.
8387
+ (zero_extendsidi2_lfiwzx): Likewise.
8388
+ (extendsidi2_lfiwax): Likewise.
8389
+ (extendsidi2_nocell): Likewise.
8390
+ (floatsi<mode>2_lfiwax): Likewise.
8391
+ (lfiwax): Likewise.
8392
+ (floatunssi<mode>2_lfiwzx): Likewise.
8393
+ (lfiwzx): Likewise.
8394
+ (fix_trunc<mode>_stfiwx): Likewise.
8395
+ (fixuns_trunc<mode>_stfiwx): Likewise.
8396
+ (mov<mode>_hardfloat, 32-bit floating point): Likewise.
8397
+ (mov<move>_hardfloat64, 64-bit floating point): Likewise.
8398
+ (parity<mode>2_cmpb): Set length/type attr.
8399
+ (unnamed shift right patterns, mov<mode>_internal2): Change type attr
8400
+ for 'mr.' to fast_compare.
8401
+ (bpermd_<mode>): Change type attr to popcnt.
8402
+ (p8_fmrgow_<mode>): New insns for power8 direct move support.
8403
+ (p8_mtvsrwz_1): Likewise.
8404
+ (p8_mtvsrwz_2): Likewise.
8405
+ (reload_fpr_from_gpr<mode>): Likewise.
8406
+ (p8_mtvsrd_1): Likewise.
8407
+ (p8_mtvsrd_2): Likewise.
8408
+ (p8_xxpermdi_<mode>): Likewise.
8409
+ (reload_vsx_from_gpr<mode>): Likewise.
8410
+ (reload_vsx_from_gprsf): Likewise.
8411
+ (p8_mfvsrd_3_<mode>): LIkewise.
8412
+ (reload_gpr_from_vsx<mode>): Likewise.
8413
+ (reload_gpr_from_vsxsf): Likewise.
8414
+ (p8_mfvsrd_4_disf): Likewise.
8415
+ (multi-word GPR splits): Do not split direct moves or quad memory
8418
+2013-06-06 Michael Meissner <meissner@linux.vnet.ibm.com>
8420
+ Backport from the trunk
8422
+ 2013-06-06 Michael Meissner <meissner@linux.vnet.ibm.com>
8423
+ Pat Haugen <pthaugen@us.ibm.com>
8424
+ Peter Bergner <bergner@vnet.ibm.com>
8426
+ * doc/extend.texi (PowerPC AltiVec/VSX Built-in Functions):
8427
+ Document new power8 builtins.
8429
+ * config/rs6000/vector.md (and<mode>3): Add a clobber/scratch of a
8430
+ condition code register, to allow 128-bit logical operations to be
8431
+ done in the VSX or GPR registers.
8432
+ (nor<mode>3): Use the canonical form for nor.
8433
+ (eqv<mode>3): Add expanders for power8 xxleqv, xxlnand, xxlorc,
8434
+ vclz*, and vpopcnt* vector instructions.
8435
+ (nand<mode>3): Likewise.
8436
+ (orc<mode>3): Likewise.
8437
+ (clz<mode>2): LIkewise.
8438
+ (popcount<mode>2): Likewise.
8440
+ * config/rs6000/predicates.md (int_reg_operand): Rework tests so
8441
+ that only the GPRs are recognized.
8443
+ * config/rs6000/rs6000-c.c (altivec_overloaded_builtins): Add
8444
+ support for new power8 builtins.
8446
+ * config/rs6000/rs6000-builtin.def (xscvspdpn): Add new power8
8447
+ builtin functions.
8448
+ (xscvdpspn): Likewise.
8450
+ (vclzb): Likewise.
8451
+ (vclzh): Likewise.
8452
+ (vclzw): Likewise.
8453
+ (vclzd): Likewise.
8454
+ (vpopcnt): Likewise.
8455
+ (vpopcntb): Likewise.
8456
+ (vpopcnth): Likewise.
8457
+ (vpopcntw): Likewise.
8458
+ (vpopcntd): Likewise.
8459
+ (vgbbd): Likewise.
8460
+ (vmrgew): Likewise.
8461
+ (vmrgow): Likewise.
8463
+ (eqv_v16qi3): Likewise.
8464
+ (eqv_v8hi3): Likewise.
8465
+ (eqv_v4si3): Likewise.
8466
+ (eqv_v2di3): Likewise.
8467
+ (eqv_v4sf3): Likewise.
8468
+ (eqv_v2df3): Likewise.
8470
+ (nand_v16qi3): Likewise.
8471
+ (nand_v8hi3): Likewise.
8472
+ (nand_v4si3): Likewise.
8473
+ (nand_v2di3): Likewise.
8474
+ (nand_v4sf3): Likewise.
8475
+ (nand_v2df3): Likewise.
8477
+ (orc_v16qi3): Likewise.
8478
+ (orc_v8hi3): Likewise.
8479
+ (orc_v4si3): Likewise.
8480
+ (orc_v2di3): Likewise.
8481
+ (orc_v4sf3): Likewise.
8482
+ (orc_v2df3): Likewise.
8484
+ * config/rs6000/rs6000.c (rs6000_option_override_internal): Only
8485
+ allow power8 quad mode in 64-bit.
8486
+ (rs6000_builtin_vectorized_function): Add support to vectorize
8487
+ ISA 2.07 count leading zeros, population count builtins.
8488
+ (rs6000_expand_vector_init): On ISA 2.07 use xscvdpspn to form
8489
+ V4SF vectors instead of xscvdpsp to avoid IEEE related traps.
8490
+ (builtin_function_type): Add vgbbd builtin function which takes an
8491
+ unsigned argument.
8492
+ (altivec_expand_vec_perm_const): Add support for new power8 merge
8495
+ * config/rs6000/vsx.md (VSX_L2): New iterator for 128-bit types,
8496
+ that does not include TImdoe for use with 32-bit.
8497
+ (UNSPEC_VSX_CVSPDPN): Support for power8 xscvdpspn and xscvspdpn
8499
+ (UNSPEC_VSX_CVDPSPN): Likewise.
8500
+ (vsx_xscvdpspn): Likewise.
8501
+ (vsx_xscvspdpn): Likewise.
8502
+ (vsx_xscvdpspn_scalar): Likewise.
8503
+ (vsx_xscvspdpn_directmove): Likewise.
8504
+ (vsx_and<mode>3): Split logical operations into 32-bit and
8505
+ 64-bit. Add support to do logical operations on TImode as well as
8506
+ VSX vector types. Allow logical operations to be done in either
8507
+ VSX registers or in general purpose registers in 64-bit mode. Add
8508
+ splitters if GPRs were used. For AND, add clobber of CCmode to
8509
+ allow use of ANDI on GPRs. Rewrite nor to use the canonical RTL
8511
+ (vsx_and<mode>3_32bit): Likewise.
8512
+ (vsx_and<mode>3_64bit): Likewise.
8513
+ (vsx_ior<mode>3): Likewise.
8514
+ (vsx_ior<mode>3_32bit): Likewise.
8515
+ (vsx_ior<mode>3_64bit): Likewise.
8516
+ (vsx_xor<mode>3): Likewise.
8517
+ (vsx_xor<mode>3_32bit): Likewise.
8518
+ (vsx_xor<mode>3_64bit): Likewise.
8519
+ (vsx_one_cmpl<mode>2): Likewise.
8520
+ (vsx_one_cmpl<mode>2_32bit): Likewise.
8521
+ (vsx_one_cmpl<mode>2_64bit): Likewise.
8522
+ (vsx_nor<mode>3): Likewise.
8523
+ (vsx_nor<mode>3_32bit): Likewise.
8524
+ (vsx_nor<mode>3_64bit): Likewise.
8525
+ (vsx_andc<mode>3): Likewise.
8526
+ (vsx_andc<mode>3_32bit): Likewise.
8527
+ (vsx_andc<mode>3_64bit): Likewise.
8528
+ (vsx_eqv<mode>3_32bit): Add support for power8 xxleqv, xxlnand,
8529
+ and xxlorc instructions.
8530
+ (vsx_eqv<mode>3_64bit): Likewise.
8531
+ (vsx_nand<mode>3_32bit): Likewise.
8532
+ (vsx_nand<mode>3_64bit): Likewise.
8533
+ (vsx_orc<mode>3_32bit): Likewise.
8534
+ (vsx_orc<mode>3_64bit): Likewise.
8536
+ * config/rs6000/rs6000.h (VLOGICAL_REGNO_P): Update comment.
8538
+ * config/rs6000/altivec.md (UNSPEC_VGBBD): Add power8 vgbbd
8540
+ (p8_vmrgew): Add power8 vmrgew and vmrgow instructions.
8541
+ (p8_vmrgow): Likewise.
8542
+ (altivec_and<mode>3): Add clobber of CCmode to allow AND using
8543
+ GPRs to be split under VSX.
8544
+ (p8v_clz<mode>2): Add power8 count leading zero support.
8545
+ (p8v_popcount<mode>2): Add power8 population count support.
8546
+ (p8v_vgbbd): Add power8 gather bits by bytes by doubleword
8549
+ * config/rs6000/rs6000.md (eqv<mode>3): Add support for powerp eqv
8552
+ * config/rs6000/altivec.h (vec_eqv): Add defines to export power8
8553
+ builtin functions.
8554
+ (vec_nand): Likewise.
8555
+ (vec_vclz): Likewise.
8556
+ (vec_vclzb): Likewise.
8557
+ (vec_vclzd): Likewise.
8558
+ (vec_vclzh): Likewise.
8559
+ (vec_vclzw): Likewise.
8560
+ (vec_vgbbd): Likewise.
8561
+ (vec_vmrgew): Likewise.
8562
+ (vec_vmrgow): Likewise.
8563
+ (vec_vpopcnt): Likewise.
8564
+ (vec_vpopcntb): Likewise.
8565
+ (vec_vpopcntd): Likewise.
8566
+ (vec_vpopcnth): Likewise.
8567
+ (vec_vpopcntw): Likewise.
8569
+2013-06-06 Peter Bergner <bergner@vnet.ibm.com>
8571
+ Merge up to 199753.
8572
+ * REVISION: Update subversion id.
8574
+2013-06-06 Peter Bergner <bergner@vnet.ibm.com>
8576
+ Backport from trunk
8578
+ 2013-05-29 Michael Meissner <meissner@linux.vnet.ibm.com>
8579
+ Pat Haugen <pthaugen@us.ibm.com>
8580
+ Peter Bergner <bergner@vnet.ibm.com>
8582
+ * config/rs6000/vector.md (VEC_I): Add support for new power8 V2DI
8584
+ (VEC_A): Likewise.
8585
+ (VEC_C): Likewise.
8586
+ (vrotl<mode>3): Likewise.
8587
+ (vashl<mode>3): Likewise.
8588
+ (vlshr<mode>3): Likewise.
8589
+ (vashr<mode>3): Likewise.
8591
+ * config/rs6000/rs6000-c.c (altivec_overloaded_builtins): Add
8592
+ support for power8 V2DI builtins.
8594
+ * config/rs6000/rs6000-builtin.def (abs_v2di): Add support for
8595
+ power8 V2DI builtins.
8596
+ (vupkhsw): Likewise.
8597
+ (vupklsw): Likewise.
8598
+ (vaddudm): Likewise.
8599
+ (vminsd): Likewise.
8600
+ (vmaxsd): Likewise.
8601
+ (vminud): Likewise.
8602
+ (vmaxud): Likewise.
8603
+ (vpkudum): Likewise.
8604
+ (vpksdss): Likewise.
8605
+ (vpkudus): Likewise.
8606
+ (vpksdus): Likewise.
8610
+ (vsrad): Likewise.
8611
+ (vsubudm): Likewise.
8612
+ (vcmpequd): Likewise.
8613
+ (vcmpgtsd): Likewise.
8614
+ (vcmpgtud): Likewise.
8615
+ (vcmpequd_p): Likewise.
8616
+ (vcmpgtsd_p): Likewise.
8617
+ (vcmpgtud_p): Likewise.
8618
+ (vupkhsw): Likewise.
8619
+ (vupklsw): Likewise.
8620
+ (vaddudm): Likewise.
8621
+ (vmaxsd): Likewise.
8622
+ (vmaxud): Likewise.
8623
+ (vminsd): Likewise.
8624
+ (vminud): Likewise.
8625
+ (vpksdss): Likewise.
8626
+ (vpksdus): Likewise.
8627
+ (vpkudum): Likewise.
8628
+ (vpkudus): Likewise.
8631
+ (vsrad): Likewise.
8633
+ (vsubudm): Likewise.
8635
+ * config/rs6000/rs6000.c (rs6000_init_hard_regno_mode_ok): Add
8636
+ support for power8 V2DI instructions.
8638
+ * config/rs6000/altivec.md (UNSPEC_VPKUHUM): Add support for
8639
+ power8 V2DI instructions. Combine pack and unpack insns to use an
8640
+ iterator for each mode. Check whether a particular mode supports
8641
+ Altivec instructions instead of just checking TARGET_ALTIVEC.
8642
+ (UNSPEC_VPKUWUM): Likewise.
8643
+ (UNSPEC_VPKSHSS): Likewise.
8644
+ (UNSPEC_VPKSWSS): Likewise.
8645
+ (UNSPEC_VPKUHUS): Likewise.
8646
+ (UNSPEC_VPKSHUS): Likewise.
8647
+ (UNSPEC_VPKUWUS): Likewise.
8648
+ (UNSPEC_VPKSWUS): Likewise.
8649
+ (UNSPEC_VPACK_SIGN_SIGN_SAT): Likewise.
8650
+ (UNSPEC_VPACK_SIGN_UNS_SAT): Likewise.
8651
+ (UNSPEC_VPACK_UNS_UNS_SAT): Likewise.
8652
+ (UNSPEC_VPACK_UNS_UNS_MOD): Likewise.
8653
+ (UNSPEC_VUPKHSB): Likewise.
8654
+ (UNSPEC_VUNPACK_HI_SIGN): Likewise.
8655
+ (UNSPEC_VUNPACK_LO_SIGN): Likewise.
8656
+ (UNSPEC_VUPKHSH): Likewise.
8657
+ (UNSPEC_VUPKLSB): Likewise.
8658
+ (UNSPEC_VUPKLSH): Likewise.
8660
+ (VI_char): Likewise.
8661
+ (VI_scalar): Likewise.
8662
+ (VI_unit): Likewise.
8664
+ (VP_small): Likewise.
8665
+ (VP_small_lc): Likewise.
8666
+ (VU_char): Likewise.
8667
+ (add<mode>3): Likewise.
8668
+ (altivec_vaddcuw): Likewise.
8669
+ (altivec_vaddu<VI_char>s): Likewise.
8670
+ (altivec_vadds<VI_char>s): Likewise.
8671
+ (sub<mode>3): Likewise.
8672
+ (altivec_vsubcuw): Likewise.
8673
+ (altivec_vsubu<VI_char>s): Likewise.
8674
+ (altivec_vsubs<VI_char>s): Likewise.
8675
+ (altivec_vavgs<VI_char>): Likewise.
8676
+ (altivec_vcmpbfp): Likewise.
8677
+ (altivec_eq<mode>): Likewise.
8678
+ (altivec_gt<mode>): Likewise.
8679
+ (altivec_gtu<mode>): Likewise.
8680
+ (umax<mode>3): Likewise.
8681
+ (smax<mode>3): Likewise.
8682
+ (umin<mode>3): Likewise.
8683
+ (smin<mode>3): Likewise.
8684
+ (altivec_vpkuhum): Likewise.
8685
+ (altivec_vpkuwum): Likewise.
8686
+ (altivec_vpkshss): Likewise.
8687
+ (altivec_vpkswss): Likewise.
8688
+ (altivec_vpkuhus): Likewise.
8689
+ (altivec_vpkshus): Likewise.
8690
+ (altivec_vpkuwus): Likewise.
8691
+ (altivec_vpkswus): Likewise.
8692
+ (altivec_vpks<VI_char>ss): Likewise.
8693
+ (altivec_vpks<VI_char>us): Likewise.
8694
+ (altivec_vpku<VI_char>us): Likewise.
8695
+ (altivec_vpku<VI_char>um): Likewise.
8696
+ (altivec_vrl<VI_char>): Likewise.
8697
+ (altivec_vsl<VI_char>): Likewise.
8698
+ (altivec_vsr<VI_char>): Likewise.
8699
+ (altivec_vsra<VI_char>): Likewise.
8700
+ (altivec_vsldoi_<mode>): Likewise.
8701
+ (altivec_vupkhsb): Likewise.
8702
+ (altivec_vupkhs<VU_char>): Likewise.
8703
+ (altivec_vupkls<VU_char>): Likewise.
8704
+ (altivec_vupkhsh): Likewise.
8705
+ (altivec_vupklsb): Likewise.
8706
+ (altivec_vupklsh): Likewise.
8707
+ (altivec_vcmpequ<VI_char>_p): Likewise.
8708
+ (altivec_vcmpgts<VI_char>_p): Likewise.
8709
+ (altivec_vcmpgtu<VI_char>_p): Likewise.
8710
+ (abs<mode>2): Likewise.
8711
+ (vec_unpacks_hi_v16qi): Likewise.
8712
+ (vec_unpacks_hi_v8hi): Likewise.
8713
+ (vec_unpacks_lo_v16qi): Likewise.
8714
+ (vec_unpacks_hi_<VP_small_lc>): Likewise.
8715
+ (vec_unpacks_lo_v8hi): Likewise.
8716
+ (vec_unpacks_lo_<VP_small_lc>): Likewise.
8717
+ (vec_pack_trunc_v8h): Likewise.
8718
+ (vec_pack_trunc_v4si): Likewise.
8719
+ (vec_pack_trunc_<mode>): Likewise.
8721
+ * config/rs6000/altivec.h (vec_vaddudm): Add defines for power8
8723
+ (vec_vmaxsd): Likewise.
8724
+ (vec_vmaxud): Likewise.
8725
+ (vec_vminsd): Likewise.
8726
+ (vec_vminud): Likewise.
8727
+ (vec_vpksdss): Likewise.
8728
+ (vec_vpksdus): Likewise.
8729
+ (vec_vpkudum): Likewise.
8730
+ (vec_vpkudus): Likewise.
8731
+ (vec_vrld): Likewise.
8732
+ (vec_vsld): Likewise.
8733
+ (vec_vsrad): Likewise.
8734
+ (vec_vsrd): Likewise.
8735
+ (vec_vsubudm): Likewise.
8736
+ (vec_vupkhsw): Likewise.
8737
+ (vec_vupklsw): Likewise.
8739
+ 2013-05-22 Michael Meissner <meissner@linux.vnet.ibm.com>
8740
+ Pat Haugen <pthaugen@us.ibm.com>
8741
+ Peter Bergner <bergner@vnet.ibm.com>
8743
+ * doc/extend.texi (PowerPC AltiVec/VSX Built-in Functions): Add
8744
+ documentation for the power8 crypto builtins.
8746
+ * config/rs6000/t-rs6000 (MD_INCLUDES): Add crypto.md.
8748
+ * config/rs6000/rs6000-builtin.def (BU_P8V_AV_1): Add support
8749
+ macros for defining power8 builtin functions.
8750
+ (BU_P8V_AV_2): Likewise.
8751
+ (BU_P8V_AV_P): Likewise.
8752
+ (BU_P8V_VSX_1): Likewise.
8753
+ (BU_P8V_OVERLOAD_1): Likewise.
8754
+ (BU_P8V_OVERLOAD_2): Likewise.
8755
+ (BU_CRYPTO_1): Likewise.
8756
+ (BU_CRYPTO_2): Likewise.
8757
+ (BU_CRYPTO_3): Likewise.
8758
+ (BU_CRYPTO_OVERLOAD_1): Likewise.
8759
+ (BU_CRYPTO_OVERLOAD_2): Likewise.
8760
+ (XSCVSPDP): Fix typo, point to the correct instruction.
8761
+ (VCIPHER): Add power8 crypto builtins.
8762
+ (VCIPHERLAST): Likewise.
8763
+ (VNCIPHER): Likewise.
8764
+ (VNCIPHERLAST): Likewise.
8765
+ (VPMSUMB): Likewise.
8766
+ (VPMSUMH): Likewise.
8767
+ (VPMSUMW): Likewise.
8768
+ (VPERMXOR_V2DI): Likewise.
8769
+ (VPERMXOR_V4SI: Likewise.
8770
+ (VPERMXOR_V8HI: Likewise.
8771
+ (VPERMXOR_V16QI: Likewise.
8772
+ (VSHASIGMAW): Likewise.
8773
+ (VSHASIGMAD): Likewise.
8774
+ (VPMSUM): Likewise.
8775
+ (VPERMXOR): Likewise.
8776
+ (VSHASIGMA): Likewise.
8778
+ * config/rs6000/rs6000-c.c (rs6000_target_modify_macros): Define
8779
+ __CRYPTO__ if the crypto instructions are available.
8780
+ (altivec_overloaded_builtins): Add support for overloaded power8
8783
+ * config/rs6000/rs6000.c (rs6000_expand_ternop_builtin): Add
8784
+ support for power8 crypto builtins.
8785
+ (builtin_function_type): Likewise.
8786
+ (altivec_init_builtins): Add support for builtins that take vector
8787
+ long long (V2DI) arguments.
8789
+ * config/rs6000/crypto.md: New file, define power8 crypto
8792
+ 2013-05-22 Michael Meissner <meissner@linux.vnet.ibm.com>
8793
+ Pat Haugen <pthaugen@us.ibm.com>
8794
+ Peter Bergner <bergner@vnet.ibm.com>
8796
+ * doc/invoke.texi (Option Summary): Add power8 options.
8797
+ (RS/6000 and PowerPC Options): Likewise.
8799
+ * doc/md.texi (PowerPC and IBM RS6000 constraints): Update to use
8800
+ constraints.md instead of rs6000.h. Reorder w* constraints. Add
8801
+ wm, wn, wr documentation.
8803
+ * gcc/config/rs6000/constraints.md (wm): New constraint for VSX
8804
+ registers if direct move instructions are enabled.
8805
+ (wn): New constraint for no registers.
8806
+ (wq): New constraint for quad word even GPR registers.
8807
+ (wr): New constraint if 64-bit instructions are enabled.
8808
+ (wv): New constraint if power8 vector instructions are enabled.
8809
+ (wQ): New constraint for quad word memory locations.
8811
+ * gcc/config/rs6000/predicates.md (const_0_to_15_operand): New
8812
+ constraint for 0..15 for crypto instructions.
8813
+ (gpc_reg_operand): If VSX allow registers in VSX registers as well
8814
+ as GPR and floating point registers.
8815
+ (int_reg_operand): New predicate to match only GPR registers.
8816
+ (base_reg_operand): New predicate to match base registers.
8817
+ (quad_int_reg_operand): New predicate to match even GPR registers
8818
+ for quad memory operations.
8819
+ (vsx_reg_or_cint_operand): New predicate to allow vector logical
8820
+ operations in both GPR and VSX registers.
8821
+ (quad_memory_operand): New predicate for quad memory operations.
8822
+ (reg_or_indexed_operand): New predicate for direct move support.
8824
+ * gcc/config/rs6000/rs6000-cpus.def (ISA_2_5_MASKS_EMBEDDED):
8825
+ Inherit from ISA_2_4_MASKS, not ISA_2_2_MASKS.
8826
+ (ISA_2_7_MASKS_SERVER): New mask for ISA 2.07 (i.e. power8).
8827
+ (POWERPC_MASKS): Add power8 options.
8828
+ (power8 cpu): Use ISA_2_7_MASKS_SERVER instead of specifying the
8831
+ * gcc/config/rs6000/rs6000-c.c (rs6000_target_modify_macros):
8832
+ Define _ARCH_PWR8 and __POWER8_VECTOR__ for power8.
8834
+ * gcc/config/rs6000/rs6000.opt (-mvsx-timode): Add documentation.
8835
+ (-mpower8-fusion): New power8 options.
8836
+ (-mpower8-fusion-sign): Likewise.
8837
+ (-mpower8-vector): Likewise.
8838
+ (-mcrypto): Likewise.
8839
+ (-mdirect-move): Likewise.
8840
+ (-mquad-memory): Likewise.
8842
+ * gcc/config/rs6000/rs6000.c (power8_cost): Initial definition for
8844
+ (rs6000_hard_regno_mode_ok): Make PTImode only match even GPR
8846
+ (rs6000_debug_reg_print): Print the base register class if
8848
+ (rs6000_debug_vector_unit): Add p8_vector.
8849
+ (rs6000_debug_reg_global): If -mdebug=reg, print power8 constraint
8850
+ definitions. Also print fusion state.
8851
+ (rs6000_init_hard_regno_mode_ok): Set up power8 constraints.
8852
+ (rs6000_builtin_mask_calculate): Add power8 builtin support.
8853
+ (rs6000_option_override_internal): Add support for power8.
8854
+ (rs6000_common_init_builtins): Add debugging for skipped builtins
8855
+ if -mdebug=builtin.
8856
+ (rs6000_adjust_cost): Add power8 support.
8857
+ (rs6000_issue_rate): Likewise.
8858
+ (insn_must_be_first_in_group): Likewise.
8859
+ (insn_must_be_last_in_group): Likewise.
8860
+ (force_new_group): Likewise.
8861
+ (rs6000_register_move_cost): Likewise.
8862
+ (rs6000_opt_masks): Likewise.
8864
+ * config/rs6000/rs6000.h (ASM_CPU_POWER8_SPEC): If we don't have a
8865
+ power8 capable assembler, default to power7 options.
8866
+ (TARGET_DIRECT_MOVE): Likewise.
8867
+ (TARGET_CRYPTO): Likewise.
8868
+ (TARGET_P8_VECTOR): Likewise.
8869
+ (VECTOR_UNIT_P8_VECTOR_P): Define power8 vector support.
8870
+ (VECTOR_UNIT_VSX_OR_P8_VECTOR_P): Likewise.
8871
+ (VECTOR_MEM_P8_VECTOR_P): Likewise.
8872
+ (VECTOR_MEM_VSX_OR_P8_VECTOR_P): Likewise.
8873
+ (VECTOR_MEM_ALTIVEC_OR_VSX_P): Likewise.
8874
+ (TARGET_XSCVDPSPN): Likewise.
8875
+ (TARGET_XSCVSPDPN): Likewsie.
8876
+ (TARGET_SYNC_HI_QI): Likewise.
8877
+ (TARGET_SYNC_TI): Likewise.
8878
+ (MASK_CRYPTO): Likewise.
8879
+ (MASK_DIRECT_MOVE): Likewise.
8880
+ (MASK_P8_FUSION): Likewise.
8881
+ (MASK_P8_VECTOR): Likewise.
8882
+ (REG_ALLOC_ORDER): Move fr13 to be lower in priority so that the
8883
+ TFmode temporary used by some of the direct move instructions to
8884
+ get two FP temporary registers does not force creation of a stack
8886
+ (VLOGICAL_REGNO_P): Allow vector logical operations in GPRs.
8887
+ (MODES_TIEABLE_P): Move the VSX tests above the Altivec tests so
8888
+ that any VSX registers are tieable, even if they are also an
8889
+ Altivec vector mode.
8890
+ (r6000_reg_class_enum): Add wm, wr, wv constraints.
8891
+ (RS6000_BTM_P8_VECTOR): Power8 builtin support.
8892
+ (RS6000_BTM_CRYPTO): Likewise.
8893
+ (RS6000_BTM_COMMON): Likewise.
8895
+ * config/rs6000/rs6000.md (cpu attribute): Add power8.
8896
+ * config/rs6000/rs6000-opts.h (PROCESSOR_POWER8): Likewise.
8897
+ (enum rs6000_vector): Add power8 vector support.
8899
+2013-05-06 Michael Meissner <meissner@linux.vnet.ibm.com>
8901
+ Merge up to 198656.
8902
+ * REVISION: Update subversion id.
8904
+ Backport from trunk
8905
+ 2013-05-03 Michael Meissner <meissner@linux.vnet.ibm.com>
8908
+ * config/rs6000/rs6000.h (HARD_REGNO_CALLER_SAVE_MODE): Use DFmode
8909
+ to save TFmode registers and DImode to save TImode registers for
8910
+ caller save operations.
8911
+ (HARD_REGNO_CALL_PART_CLOBBERED): TFmode and TDmode do not need to
8912
+ mark being partially clobbered since they only use the first
8915
+ * config/rs6000/rs6000.c (rs6000_init_hard_regno_mode_ok): TFmode
8916
+ and TDmode only use the upper 64-bits of each VSX register.
8918
+2013-04-09 Michael Meissner <meissner@linux.vnet.ibm.com>
8920
+ Merge up to 197642.
8921
+ * REVISION: Update subversion id.
8923
+2013-03-20 Michael Meissner <meissner@linux.vnet.ibm.com>
8925
+ Backport from mainline
8926
+ 2013-03-20 Pat Haugen <pthaugen@us.ibm.com>
8928
+ * config/rs6000/predicates.md (indexed_address, update_address_mem
8929
+ update_indexed_address_mem): New predicates.
8930
+ * config/rs6000/vsx.md (vsx_extract_<mode>_zero): Set correct "type"
8931
+ attribute for load/store instructions.
8932
+ * config/rs6000/dfp.md (movsd_store): Likewise.
8933
+ (movsd_load): Likewise.
8934
+ * config/rs6000/rs6000.md (zero_extend<mode>di2_internal1): Likewise.
8935
+ (unnamed HI->DI extend define_insn): Likewise.
8936
+ (unnamed SI->DI extend define_insn): Likewise.
8937
+ (unnamed QI->SI extend define_insn): Likewise.
8938
+ (unnamed QI->HI extend define_insn): Likewise.
8939
+ (unnamed HI->SI extend define_insn): Likewise.
8940
+ (unnamed HI->SI extend define_insn): Likewise.
8941
+ (extendsfdf2_fpr): Likewise.
8942
+ (movsi_internal1): Likewise.
8943
+ (movsi_internal1_single): Likewise.
8944
+ (movhi_internal): Likewise.
8945
+ (movqi_internal): Likewise.
8946
+ (movcc_internal1): Correct mnemonic for stw insn. Set correct "type"
8947
+ attribute for load/store instructions.
8948
+ (mov<mode>_hardfloat): Set correct "type" attribute for load/store
8950
+ (mov<mode>_softfloat): Likewise.
8951
+ (mov<mode>_hardfloat32): Likewise.
8952
+ (mov<mode>_hardfloat64): Likewise.
8953
+ (mov<mode>_softfloat64): Likewise.
8954
+ (movdi_internal32): Likewise.
8955
+ (movdi_internal64): Likewise.
8956
+ (probe_stack_<mode>): Likewise.
8958
+ Backport from mainline
8959
+ 2013-03-20 Michael Meissner <meissner@linux.vnet.ibm.com>
8961
+ * config/rs6000/vector.md (VEC_R): Add 32-bit integer, binary
8962
+ floating point, and decimal floating point to reload iterator.
8964
+ * config/rs6000/constraints.md (wl constraint): New constraints to
8965
+ return FLOAT_REGS if certain options are used to reduce the number
8966
+ of separate patterns that exist in the file.
8967
+ (wx constraint): Likewise.
8968
+ (wz constraint): Likewise.
8970
+ * config/rs6000/rs6000.c (rs6000_debug_reg_global): If
8971
+ -mdebug=reg, print wg, wl, wx, and wz constraints.
8972
+ (rs6000_init_hard_regno_mode_ok): Initialize new constraints.
8973
+ Initialize the reload functions for 64-bit binary/decimal floating
8975
+ (reg_offset_addressing_ok_p): If we are on a power7 or later, use
8976
+ LFIWZX and STFIWX to load/store 32-bit decimal types, and don't
8977
+ create the buffer on the stack to overcome not having a 32-bit
8979
+ (rs6000_emit_move): Likewise.
8980
+ (rs6000_secondary_memory_needed_rtx): Likewise.
8981
+ (rs6000_alloc_sdmode_stack_slot): Likewise.
8982
+ (rs6000_preferred_reload_class): On VSX, we can create SFmode 0.0f
8983
+ via xxlxor, just like DFmode 0.0.
8985
+ * config/rs6000/rs6000.h (TARGET_NO_SDMODE_STACK): New macro,
8986
+ define as 1 if we are running on a power7 or newer.
8987
+ (enum r6000_reg_class_enum): Add new constraints.
8989
+ * config/rs6000/dfp.md (movsd): Delete, combine with binary
8990
+ floating point moves in rs6000.md. Combine power6x (mfpgpr) moves
8991
+ with other moves by using conditional constraits (wg). Use LFIWZX
8992
+ and STFIWX for loading SDmode on power7. Use xxlxor to create
8994
+ (movsd splitter): Likewise.
8995
+ (movsd_hardfloat): Likewise.
8996
+ (movsd_softfloat): Likewise.
8998
+ * config/rs6000/rs6000.md (FMOVE32): New iterators to combine
8999
+ binary and decimal floating point moves.
9000
+ (fmove_ok): New attributes to combine binary and decimal floating
9001
+ point moves, and to combine power6x (mfpgpr) moves along normal
9003
+ (real_value_to_target): Likewise.
9004
+ (f32_lr): Likewise.
9005
+ (f32_lm): Likewise.
9006
+ (f32_li): Likewise.
9007
+ (f32_sr): Likewise.
9008
+ (f32_sm): Likewise.
9009
+ (f32_si): Likewise.
9010
+ (movsf): Combine binary and decimal floating point moves. Combine
9011
+ power6x (mfpgpr) moves with other moves by using conditional
9012
+ constraits (wg). Use LFIWZX and STFIWX for loading SDmode on
9014
+ (mov<mode> for SFmode/SDmode); Likewise.
9015
+ (SFmode/SDmode splitters): Likewise.
9016
+ (movsf_hardfloat): Likewise.
9017
+ (mov<mode>_hardfloat for SFmode/SDmode): Likewise.
9018
+ (movsf_softfloat): Likewise.
9019
+ (mov<mode>_softfloat for SFmode/SDmode): Likewise.
9021
+ * doc/md.texi (PowerPC and IBM RS6000 constraints): Document wl,
9022
+ wx and wz constraints.
9024
+ * config/rs6000/constraints.md (wg constraint): New constraint to
9025
+ return FLOAT_REGS if -mmfpgpr (power6x) was used.
9027
+ * config/rs6000/rs6000.h (enum r6000_reg_class_enum): Add wg
9030
+ * config/rs6000/rs6000.c (rs6000_debug_reg_global): If
9031
+ -mdebug=reg, print wg, wl, wx, and wz constraints.
9032
+ (rs6000_init_hard_regno_mode_ok): Initialize new constraints.
9033
+ Initialize the reload functions for 64-bit binary/decimal floating
9035
+ (reg_offset_addressing_ok_p): If we are on a power7 or later, use
9036
+ LFIWZX and STFIWX to load/store 32-bit decimal types, and don't
9037
+ create the buffer on the stack to overcome not having a 32-bit
9039
+ (rs6000_emit_move): Likewise.
9040
+ (rs6000_secondary_memory_needed_rtx): Likewise.
9041
+ (rs6000_alloc_sdmode_stack_slot): Likewise.
9042
+ (rs6000_preferred_reload_class): On VSX, we can create SFmode 0.0f
9043
+ via xxlxor, just like DFmode 0.0.
9046
+ * config/rs6000/dfp.md (movdd): Delete, combine with binary
9047
+ floating point moves in rs6000.md. Combine power6x (mfpgpr) moves
9048
+ with other moves by using conditional constraits (wg). Use LFIWZX
9049
+ and STFIWX for loading SDmode on power7.
9050
+ (movdd splitters): Likewise.
9051
+ (movdd_hardfloat32): Likewise.
9052
+ (movdd_softfloat32): Likewise.
9053
+ (movdd_hardfloat64_mfpgpr): Likewise.
9054
+ (movdd_hardfloat64): Likewise.
9055
+ (movdd_softfloat64): Likewise.
9057
+ * config/rs6000/rs6000.md (FMOVE64): New iterators to combine
9058
+ 64-bit binary and decimal floating point moves.
9059
+ (FMOVE64X): Likewise.
9060
+ (movdf): Combine 64-bit binary and decimal floating point moves.
9061
+ Combine power6x (mfpgpr) moves with other moves by using
9062
+ conditional constraits (wg).
9063
+ (mov<mode> for DFmode/DDmode): Likewise.
9064
+ (DFmode/DDmode splitters): Likewise.
9065
+ (movdf_hardfloat32): Likewise.
9066
+ (mov<mode>_hardfloat32 for DFmode/DDmode): Likewise.
9067
+ (movdf_softfloat32): Likewise.
9068
+ (movdf_hardfloat64_mfpgpr): Likewise.
9069
+ (movdf_hardfloat64): Likewise.
9070
+ (mov<mode>_hardfloat64 for DFmode/DDmode): Likewise.
9071
+ (movdf_softfloat64): Likewise.
9072
+ (mov<mode>_softfloat64 for DFmode/DDmode): Likewise.
9073
+ (reload_<mode>_load): Move to later in the file so they aren't in
9074
+ the middle of the floating point move insns.
9075
+ (reload_<mode>_store): Likewise.
9077
+ * doc/md.texi (PowerPC and IBM RS6000 constraints): Document wg
9080
+ * config/rs6000/rs6000.c (rs6000_debug_reg_global): Print out wg
9081
+ constraint if -mdebug=reg.
9082
+ (rs6000_initi_hard_regno_mode_ok): Enable wg constraint if
9083
+ -mfpgpr. Enable using dd reload support if needed.
9085
+ * config/rs6000/dfp.md (movtd): Delete, combine with 128-bit
9086
+ binary and decimal floating point moves in rs6000.md.
9087
+ (movtd_internal): Likewise.
9089
+ * config/rs6000/rs6000.md (FMOVE128): Combine 128-bit binary and
9090
+ decimal floating point moves.
9091
+ (movtf): Likewise.
9092
+ (movtf_internal): Likewise.
9093
+ (mov<mode>_internal, TDmode/TFmode): Likewise.
9094
+ (movtf_softfloat): Likewise.
9095
+ (mov<mode>_softfloat, TDmode/TFmode): Likewise.
9097
+ * config/rs6000/rs6000.md (movdi_mfpgpr): Delete, combine with
9098
+ movdi_internal64, using wg constraint for move direct operations.
9099
+ (movdi_internal64): Likewise.
9101
+ * config/rs6000/rs6000.c (rs6000_debug_reg_global): Print
9102
+ MODES_TIEABLE_P for selected modes. Print the numerical value of
9103
+ the various virtual registers. Use GPR/FPR first/last values,
9104
+ instead of hard coding the register numbers. Print which modes
9105
+ have reload functions registered.
9106
+ (rs6000_option_override_internal): If -mdebug=reg, trace the
9107
+ options settings before/after setting cpu, target and subtarget
9109
+ (rs6000_secondary_reload_trace): Improve the RTL dump for
9110
+ -mdebug=addr and for secondary reload failures in
9111
+ rs6000_secondary_reload_inner.
9112
+ (rs6000_secondary_reload_fail): Likewise.
9113
+ (rs6000_secondary_reload_inner): Likewise.
9115
+ * config/rs6000/rs6000.md (FIRST_GPR_REGNO): Add convenience
9116
+ macros for first/last GPR and FPR registers.
9117
+ (LAST_GPR_REGNO): Likewise.
9118
+ (FIRST_FPR_REGNO): Likewise.
9119
+ (LAST_FPR_REGNO): Likewise.
9121
+ * config/rs6000/vector.md (mul<mode>3): Use the combined macro
9122
+ VECTOR_UNIT_ALTIVEC_OR_VSX_P instead of separate calls to
9123
+ VECTOR_UNIT_ALTIVEC_P and VECTOR_UNIT_VSX_P.
9124
+ (vcond<mode><mode>): Likewise.
9125
+ (vcondu<mode><mode>): Likewise.
9126
+ (vector_gtu<mode>): Likewise.
9127
+ (vector_gte<mode>): Likewise.
9128
+ (xor<mode>3): Don't allow logical operations on TImode in 32-bit
9129
+ to prevent the compiler from converting DImode operations to
9131
+ (ior<mode>3): Likewise.
9132
+ (and<mode>3): Likewise.
9133
+ (one_cmpl<mode>2): Likewise.
9134
+ (nor<mode>3): Likewise.
9135
+ (andc<mode>3): Likewise.
9137
+ * config/rs6000/constraints.md (wt constraint): New constraint
9138
+ that returns VSX_REGS if TImode is allowed in VSX registers.
9140
+ * config/rs6000/predicates.md (easy_fp_constant): 0.0f is an easy
9141
+ constant under VSX.
9143
+ * config/rs6000/rs6000-modes.def (PTImode): Define, PTImode is
9144
+ similar to TImode, but it is restricted to being in the GPRs.
9146
+ * config/rs6000/rs6000.opt (-mvsx-timode): New switch to allow
9147
+ TImode to occupy a single VSX register.
9149
+ * config/rs6000/rs6000-cpus.def (ISA_2_6_MASKS_SERVER): Default to
9150
+ -mvsx-timode for power7/power8.
9151
+ (power7 cpu): Likewise.
9152
+ (power8 cpu): Likewise.
9154
+ * config/rs6000/rs6000.c (rs6000_hard_regno_nregs_internal): Make
9155
+ sure that TFmode/TDmode take up two registers if they are ever
9156
+ allowed in the upper VSX registers.
9157
+ (rs6000_hard_regno_mode_ok): If -mvsx-timode, allow TImode in VSX
9159
+ (rs6000_init_hard_regno_mode_ok): Likewise.
9160
+ (rs6000_debug_reg_global): Add debugging for PTImode and wt
9161
+ constraint. Print if LRA is turned on.
9162
+ (rs6000_option_override_internal): Give an error if -mvsx-timode
9163
+ and VSX is not enabled.
9164
+ (invalid_e500_subreg): Handle PTImode, restricting it to GPRs. If
9165
+ -mvsx-timode, restrict TImode to reg+reg addressing, and PTImode
9166
+ to reg+offset addressing. Use PTImode when checking offset
9167
+ addresses for validity.
9168
+ (reg_offset_addressing_ok_p): Likewise.
9169
+ (rs6000_legitimate_offset_address_p): Likewise.
9170
+ (rs6000_legitimize_address): Likewise.
9171
+ (rs6000_legitimize_reload_address): Likewise.
9172
+ (rs6000_legitimate_address_p): Likewise.
9173
+ (rs6000_eliminate_indexed_memrefs): Likewise.
9174
+ (rs6000_emit_move): Likewise.
9175
+ (rs6000_secondary_reload): Likewise.
9176
+ (rs6000_secondary_reload_inner): Handle PTImode. Allow 64-bit
9177
+ reloads to fpr registers to continue to use reg+offset addressing,
9178
+ but 64-bit reloads to altivec registers need reg+reg addressing.
9179
+ Drop test for PRE_MODIFY, since VSX loads/stores no longer support
9180
+ it. Treat LO_SUM like a PLUS operation.
9181
+ (rs6000_secondary_reload_class): If type is 64-bit, prefer to use
9182
+ FLOAT_REGS instead of VSX_RGS to allow use of reg+offset
9184
+ (rs6000_cannot_change_mode_class): Do not allow TImode in VSX
9185
+ registers to share a register with a smaller sized type, since VSX
9186
+ puts scalars in the upper 64-bits.
9187
+ (print_operand): Add support for PTImode.
9188
+ (rs6000_register_move_cost): Use VECTOR_MEM_VSX_P instead of
9189
+ VECTOR_UNIT_VSX_P to catch types that can be loaded in VSX
9190
+ registers, but don't have arithmetic support.
9191
+ (rs6000_memory_move_cost): Add test for VSX.
9192
+ (rs6000_opt_masks): Add -mvsx-timode.
9194
+ * config/rs6000/vsx.md (VSm): Change to use 64-bit aligned moves
9197
+ (VSr): Use wt constraint for TImode.
9198
+ (VSv): Drop TImode support.
9199
+ (vsx_movti): Delete, replace with versions for 32-bit and 64-bit.
9200
+ (vsx_movti_64bit): Likewise.
9201
+ (vsx_movti_32bit): Likewise.
9202
+ (vec_store_<mode>): Use VSX iterator instead of vector iterator.
9203
+ (vsx_and<mode>3): Delete use of '?' constraint on inputs, just put
9204
+ one '?' on the appropriate output constraint. Do not allow TImode
9205
+ logical operations on 32-bit systems.
9206
+ (vsx_ior<mode>3): Likewise.
9207
+ (vsx_xor<mode>3): Likewise.
9208
+ (vsx_one_cmpl<mode>2): Likewise.
9209
+ (vsx_nor<mode>3): Likewise.
9210
+ (vsx_andc<mode>3): Likewise.
9211
+ (vsx_concat_<mode>): Likewise.
9212
+ (vsx_xxpermdi_<mode>): Fix thinko for non V2DF/V2DI modes.
9214
+ * config/rs6000/rs6000.h (MASK_VSX_TIMODE): Map from
9215
+ OPTION_MASK_VSX_TIMODE.
9216
+ (enum rs6000_reg_class_enum): Add RS6000_CONSTRAINT_wt.
9217
+ (STACK_SAVEAREA_MODE): Use PTImode instead of TImode.
9219
+ * config/rs6000/rs6000.md (INT mode attribute): Add PTImode.
9220
+ (TI2 iterator): New iterator for TImode, PTImode.
9221
+ (wd mode attribute): Add values for vector types.
9222
+ (movti_string): Replace TI move operations with operations for
9223
+ TImode and PTImode. Add support for TImode being allowed in VSX
9225
+ (mov<mode>_string, TImode/PTImode): Likewise.
9226
+ (movti_ppc64): Likewise.
9227
+ (mov<mode>_ppc64, TImode/PTImode): Likewise.
9228
+ (TI mode splitters): Likewise.
9230
+ * doc/md.texi (PowerPC and IBM RS6000 constraints): Document wt
9233
+2013-03-20 Michael Meissner <meissner@linux.vnet.ibm.com>
9235
+ Clone branch from gcc-4_8-branch, subversion id 196835.
9236
+ * REVISION: New file, track subversion id.
9238
--- a/src/gcc/calls.c
9239
+++ b/src/gcc/calls.c
9242
for (i = 0; i < num_actuals; i++)
9243
if (args[i].reg != 0 && ! args[i].pass_on_stack
9244
+ && GET_CODE (args[i].reg) != PARALLEL
9245
&& args[i].mode == BLKmode
9246
&& MEM_P (args[i].value)
9247
&& (MEM_ALIGN (args[i].value)
9248
@@ -1327,6 +1328,7 @@
9252
+ reg_parm_stack_space,
9253
args[i].pass_on_stack ? 0 : args[i].partial,
9254
fndecl, args_size, &args[i].locate);
9255
#ifdef BLOCK_REG_PADDING
9256
@@ -3171,7 +3173,9 @@
9257
group load/store machinery below. */
9258
if (!structure_value_addr
9259
&& !pcc_struct_value
9260
+ && TYPE_MODE (rettype) != VOIDmode
9261
&& TYPE_MODE (rettype) != BLKmode
9263
&& targetm.calls.return_in_msb (rettype))
9265
if (shift_return_value (TYPE_MODE (rettype), false, valreg))
9266
@@ -3734,7 +3738,8 @@
9268
argvec[count].reg != 0,
9270
- 0, NULL_TREE, &args_size, &argvec[count].locate);
9271
+ reg_parm_stack_space, 0,
9272
+ NULL_TREE, &args_size, &argvec[count].locate);
9274
if (argvec[count].reg == 0 || argvec[count].partial != 0
9275
|| reg_parm_stack_space > 0)
9276
@@ -3821,7 +3826,7 @@
9278
argvec[count].reg != 0,
9280
- argvec[count].partial,
9281
+ reg_parm_stack_space, argvec[count].partial,
9282
NULL_TREE, &args_size, &argvec[count].locate);
9283
args_size.constant += argvec[count].locate.size.constant;
9284
gcc_assert (!argvec[count].locate.size.var);
9285
--- a/src/gcc/config.gcc
9286
+++ b/src/gcc/config.gcc
9291
- extra_headers="ppc-asm.h altivec.h spe.h ppu_intrinsics.h paired.h spu2vmx.h vec_types.h si2vmx.h"
9292
+ 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"
9293
need_64bit_hwint=yes
9295
xpowerpc64|xdefault64|x6[23]0|x970|xG5|xpower[345678]|xpower6x|xrs64a|xcell|xa2|xe500mc64|xe5500|Xe6500)
9296
@@ -3509,7 +3509,7 @@
9299
powerpc*-*-* | rs6000-*-*)
9300
- supported_defaults="cpu cpu_32 cpu_64 float tune tune_32 tune_64"
9301
+ supported_defaults="abi cpu cpu_32 cpu_64 float tune tune_32 tune_64"
9303
for which in cpu cpu_32 cpu_64 tune tune_32 tune_64; do
9304
eval "val=\$with_$which"
9305
@@ -3546,6 +3546,16 @@
9310
+ case "$with_abi" in
9311
+ "" | elfv1 | elfv2 )
9315
+ echo "Unknown ABI used in --with-abi=$with_abi"
9322
--- a/src/gcc/config/rs6000/power8.md
9323
+++ b/src/gcc/config/rs6000/power8.md
9325
+;; Scheduling description for IBM POWER8 processor.
9326
+;; Copyright (C) 2013 Free Software Foundation, Inc.
9328
+;; Contributed by Pat Haugen (pthaugen@us.ibm.com).
9330
+;; This file is part of GCC.
9332
+;; GCC is free software; you can redistribute it and/or modify it
9333
+;; under the terms of the GNU General Public License as published
9334
+;; by the Free Software Foundation; either version 3, or (at your
9335
+;; option) any later version.
9337
+;; GCC is distributed in the hope that it will be useful, but WITHOUT
9338
+;; ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
9339
+;; or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
9340
+;; License for more details.
9342
+;; You should have received a copy of the GNU General Public License
9343
+;; along with GCC; see the file COPYING3. If not see
9344
+;; <http://www.gnu.org/licenses/>.
9346
+(define_automaton "power8fxu,power8lsu,power8vsu,power8misc")
9348
+(define_cpu_unit "fxu0_power8,fxu1_power8" "power8fxu")
9349
+(define_cpu_unit "lu0_power8,lu1_power8" "power8lsu")
9350
+(define_cpu_unit "lsu0_power8,lsu1_power8" "power8lsu")
9351
+(define_cpu_unit "vsu0_power8,vsu1_power8" "power8vsu")
9352
+(define_cpu_unit "bpu_power8,cru_power8" "power8misc")
9353
+(define_cpu_unit "du0_power8,du1_power8,du2_power8,du3_power8,du4_power8,\
9354
+ du5_power8,du6_power8" "power8misc")
9357
+; Dispatch group reservations
9358
+(define_reservation "DU_any_power8"
9359
+ "du0_power8|du1_power8|du2_power8|du3_power8|du4_power8|\
9362
+; 2-way Cracked instructions go in slots 0-1
9363
+; (can also have a second in slots 3-4 if insns are adjacent)
9364
+(define_reservation "DU_cracked_power8"
9365
+ "du0_power8+du1_power8")
9367
+; Insns that are first in group
9368
+(define_reservation "DU_first_power8"
9371
+; Insns that are first and last in group
9372
+(define_reservation "DU_both_power8"
9373
+ "du0_power8+du1_power8+du2_power8+du3_power8+du4_power8+\
9374
+ du5_power8+du6_power8")
9376
+; Dispatch slots are allocated in order conforming to program order.
9377
+(absence_set "du0_power8" "du1_power8,du2_power8,du3_power8,du4_power8,\
9378
+ du5_power8,du6_power8")
9379
+(absence_set "du1_power8" "du2_power8,du3_power8,du4_power8,du5_power8,\
9381
+(absence_set "du2_power8" "du3_power8,du4_power8,du5_power8,du6_power8")
9382
+(absence_set "du3_power8" "du4_power8,du5_power8,du6_power8")
9383
+(absence_set "du4_power8" "du5_power8,du6_power8")
9384
+(absence_set "du5_power8" "du6_power8")
9387
+; Execution unit reservations
9388
+(define_reservation "FXU_power8"
9389
+ "fxu0_power8|fxu1_power8")
9391
+(define_reservation "LU_power8"
9392
+ "lu0_power8|lu1_power8")
9394
+(define_reservation "LSU_power8"
9395
+ "lsu0_power8|lsu1_power8")
9397
+(define_reservation "LU_or_LSU_power8"
9398
+ "lu0_power8|lu1_power8|lsu0_power8|lsu1_power8")
9400
+(define_reservation "VSU_power8"
9401
+ "vsu0_power8|vsu1_power8")
9405
+(define_insn_reservation "power8-load" 3
9406
+ (and (eq_attr "type" "load")
9407
+ (eq_attr "cpu" "power8"))
9408
+ "DU_any_power8,LU_or_LSU_power8")
9410
+(define_insn_reservation "power8-load-update" 3
9411
+ (and (eq_attr "type" "load_u,load_ux")
9412
+ (eq_attr "cpu" "power8"))
9413
+ "DU_cracked_power8,LU_or_LSU_power8+FXU_power8")
9415
+(define_insn_reservation "power8-load-ext" 3
9416
+ (and (eq_attr "type" "load_ext")
9417
+ (eq_attr "cpu" "power8"))
9418
+ "DU_cracked_power8,LU_or_LSU_power8,FXU_power8")
9420
+(define_insn_reservation "power8-load-ext-update" 3
9421
+ (and (eq_attr "type" "load_ext_u,load_ext_ux")
9422
+ (eq_attr "cpu" "power8"))
9423
+ "DU_both_power8,LU_or_LSU_power8+FXU_power8,FXU_power8")
9425
+(define_insn_reservation "power8-fpload" 5
9426
+ (and (eq_attr "type" "fpload,vecload")
9427
+ (eq_attr "cpu" "power8"))
9428
+ "DU_any_power8,LU_power8")
9430
+(define_insn_reservation "power8-fpload-update" 5
9431
+ (and (eq_attr "type" "fpload_u,fpload_ux")
9432
+ (eq_attr "cpu" "power8"))
9433
+ "DU_cracked_power8,LU_power8+FXU_power8")
9435
+(define_insn_reservation "power8-store" 5 ; store-forwarding latency
9436
+ (and (eq_attr "type" "store,store_u")
9437
+ (eq_attr "cpu" "power8"))
9438
+ "DU_any_power8,LSU_power8+LU_power8")
9440
+(define_insn_reservation "power8-store-update-indexed" 5
9441
+ (and (eq_attr "type" "store_ux")
9442
+ (eq_attr "cpu" "power8"))
9443
+ "DU_cracked_power8,LSU_power8+LU_power8")
9445
+(define_insn_reservation "power8-fpstore" 5
9446
+ (and (eq_attr "type" "fpstore")
9447
+ (eq_attr "cpu" "power8"))
9448
+ "DU_any_power8,LSU_power8+VSU_power8")
9450
+(define_insn_reservation "power8-fpstore-update" 5
9451
+ (and (eq_attr "type" "fpstore_u,fpstore_ux")
9452
+ (eq_attr "cpu" "power8"))
9453
+ "DU_any_power8,LSU_power8+VSU_power8")
9455
+(define_insn_reservation "power8-vecstore" 5
9456
+ (and (eq_attr "type" "vecstore")
9457
+ (eq_attr "cpu" "power8"))
9458
+ "DU_cracked_power8,LSU_power8+VSU_power8")
9460
+(define_insn_reservation "power8-larx" 3
9461
+ (and (eq_attr "type" "load_l")
9462
+ (eq_attr "cpu" "power8"))
9463
+ "DU_both_power8,LU_or_LSU_power8")
9465
+(define_insn_reservation "power8-stcx" 10
9466
+ (and (eq_attr "type" "store_c")
9467
+ (eq_attr "cpu" "power8"))
9468
+ "DU_both_power8,LSU_power8+LU_power8")
9470
+(define_insn_reservation "power8-sync" 1
9471
+ (and (eq_attr "type" "sync,isync")
9472
+ (eq_attr "cpu" "power8"))
9473
+ "DU_both_power8,LSU_power8")
9477
+(define_insn_reservation "power8-1cyc" 1
9478
+ (and (eq_attr "type" "integer,insert_word,insert_dword,shift,trap,\
9479
+ var_shift_rotate,exts,isel")
9480
+ (eq_attr "cpu" "power8"))
9481
+ "DU_any_power8,FXU_power8")
9483
+; Extra cycle to LU/LSU
9484
+(define_bypass 2 "power8-1cyc"
9485
+ "power8-load*,power8-fpload*,power8-store*,power8-fpstore*,\
9486
+ power8-vecstore,power8-larx,power8-stcx")
9487
+; "power8-load,power8-load-update,power8-load-ext,\
9488
+; power8-load-ext-update,power8-fpload,power8-fpload-update,\
9489
+; power8-store,power8-store-update,power8-store-update-indexed,\
9490
+; power8-fpstore,power8-fpstore-update,power8-vecstore,\
9491
+; power8-larx,power8-stcx")
9493
+(define_insn_reservation "power8-2cyc" 2
9494
+ (and (eq_attr "type" "cntlz,popcnt")
9495
+ (eq_attr "cpu" "power8"))
9496
+ "DU_any_power8,FXU_power8")
9498
+(define_insn_reservation "power8-two" 2
9499
+ (and (eq_attr "type" "two")
9500
+ (eq_attr "cpu" "power8"))
9501
+ "DU_any_power8+DU_any_power8,FXU_power8,FXU_power8")
9503
+(define_insn_reservation "power8-three" 3
9504
+ (and (eq_attr "type" "three")
9505
+ (eq_attr "cpu" "power8"))
9506
+ "DU_any_power8+DU_any_power8+DU_any_power8,FXU_power8,FXU_power8,FXU_power8")
9508
+; cmp - Normal compare insns
9509
+(define_insn_reservation "power8-cmp" 2
9510
+ (and (eq_attr "type" "cmp")
9511
+ (eq_attr "cpu" "power8"))
9512
+ "DU_any_power8,FXU_power8")
9514
+; fast_compare : add./and./nor./etc
9515
+(define_insn_reservation "power8-fast-compare" 2
9516
+ (and (eq_attr "type" "fast_compare")
9517
+ (eq_attr "cpu" "power8"))
9518
+ "DU_any_power8,FXU_power8")
9520
+; compare : rldicl./exts./etc
9521
+; delayed_compare : rlwinm./slwi./etc
9522
+; var_delayed_compare : rlwnm./slw./etc
9523
+(define_insn_reservation "power8-compare" 2
9524
+ (and (eq_attr "type" "compare,delayed_compare,var_delayed_compare")
9525
+ (eq_attr "cpu" "power8"))
9526
+ "DU_cracked_power8,FXU_power8,FXU_power8")
9528
+; Extra cycle to LU/LSU
9529
+(define_bypass 3 "power8-fast-compare,power8-compare"
9530
+ "power8-load*,power8-fpload*,power8-store*,power8-fpstore*,\
9531
+ power8-vecstore,power8-larx,power8-stcx")
9533
+; 5 cycle CR latency
9534
+(define_bypass 5 "power8-fast-compare,power8-compare"
9535
+ "power8-crlogical,power8-mfcr,power8-mfcrf,power8-branch")
9537
+(define_insn_reservation "power8-mul" 4
9538
+ (and (eq_attr "type" "imul,imul2,imul3,lmul")
9539
+ (eq_attr "cpu" "power8"))
9540
+ "DU_any_power8,FXU_power8")
9542
+(define_insn_reservation "power8-mul-compare" 4
9543
+ (and (eq_attr "type" "imul_compare,lmul_compare")
9544
+ (eq_attr "cpu" "power8"))
9545
+ "DU_cracked_power8,FXU_power8")
9547
+; Extra cycle to LU/LSU
9548
+(define_bypass 5 "power8-mul,power8-mul-compare"
9549
+ "power8-load*,power8-fpload*,power8-store*,power8-fpstore*,\
9550
+ power8-vecstore,power8-larx,power8-stcx")
9552
+; 7 cycle CR latency
9553
+(define_bypass 7 "power8-mul,power8-mul-compare"
9554
+ "power8-crlogical,power8-mfcr,power8-mfcrf,power8-branch")
9556
+; FXU divides are not pipelined
9557
+(define_insn_reservation "power8-idiv" 37
9558
+ (and (eq_attr "type" "idiv")
9559
+ (eq_attr "cpu" "power8"))
9560
+ "DU_any_power8,fxu0_power8*37|fxu1_power8*37")
9562
+(define_insn_reservation "power8-ldiv" 68
9563
+ (and (eq_attr "type" "ldiv")
9564
+ (eq_attr "cpu" "power8"))
9565
+ "DU_any_power8,fxu0_power8*68|fxu1_power8*68")
9567
+(define_insn_reservation "power8-mtjmpr" 5
9568
+ (and (eq_attr "type" "mtjmpr")
9569
+ (eq_attr "cpu" "power8"))
9570
+ "DU_first_power8,FXU_power8")
9572
+; Should differentiate between 1 cr field and > 1 since mtocrf is not microcode
9573
+(define_insn_reservation "power8-mtcr" 3
9574
+ (and (eq_attr "type" "mtcr")
9575
+ (eq_attr "cpu" "power8"))
9576
+ "DU_both_power8,FXU_power8")
9580
+(define_insn_reservation "power8-mfjmpr" 5
9581
+ (and (eq_attr "type" "mfjmpr")
9582
+ (eq_attr "cpu" "power8"))
9583
+ "DU_first_power8,cru_power8+FXU_power8")
9585
+(define_insn_reservation "power8-crlogical" 3
9586
+ (and (eq_attr "type" "cr_logical,delayed_cr")
9587
+ (eq_attr "cpu" "power8"))
9588
+ "DU_first_power8,cru_power8")
9590
+(define_insn_reservation "power8-mfcr" 5
9591
+ (and (eq_attr "type" "mfcr")
9592
+ (eq_attr "cpu" "power8"))
9593
+ "DU_both_power8,cru_power8")
9595
+(define_insn_reservation "power8-mfcrf" 3
9596
+ (and (eq_attr "type" "mfcrf")
9597
+ (eq_attr "cpu" "power8"))
9598
+ "DU_first_power8,cru_power8")
9602
+; Branches take dispatch slot 7, but reserve any remaining prior slots to
9603
+; prevent other insns from grabbing them once this is assigned.
9604
+(define_insn_reservation "power8-branch" 3
9605
+ (and (eq_attr "type" "jmpreg,branch")
9606
+ (eq_attr "cpu" "power8"))
9608
+ |du5_power8+du6_power8\
9609
+ |du4_power8+du5_power8+du6_power8\
9610
+ |du3_power8+du4_power8+du5_power8+du6_power8\
9611
+ |du2_power8+du3_power8+du4_power8+du5_power8+du6_power8\
9612
+ |du1_power8+du2_power8+du3_power8+du4_power8+du5_power8+du6_power8\
9613
+ |du0_power8+du1_power8+du2_power8+du3_power8+du4_power8+du5_power8+\
9614
+ du6_power8),bpu_power8")
9616
+; Branch updating LR/CTR feeding mf[lr|ctr]
9617
+(define_bypass 4 "power8-branch" "power8-mfjmpr")
9620
+; VS Unit (includes FP/VSX/VMX/DFP/Crypto)
9621
+(define_insn_reservation "power8-fp" 6
9622
+ (and (eq_attr "type" "fp,dmul")
9623
+ (eq_attr "cpu" "power8"))
9624
+ "DU_any_power8,VSU_power8")
9626
+; Additional 3 cycles for any CR result
9627
+(define_bypass 9 "power8-fp" "power8-crlogical,power8-mfcr*,power8-branch")
9629
+(define_insn_reservation "power8-fpcompare" 8
9630
+ (and (eq_attr "type" "fpcompare")
9631
+ (eq_attr "cpu" "power8"))
9632
+ "DU_any_power8,VSU_power8")
9634
+(define_insn_reservation "power8-sdiv" 27
9635
+ (and (eq_attr "type" "sdiv")
9636
+ (eq_attr "cpu" "power8"))
9637
+ "DU_any_power8,VSU_power8")
9639
+(define_insn_reservation "power8-ddiv" 33
9640
+ (and (eq_attr "type" "ddiv")
9641
+ (eq_attr "cpu" "power8"))
9642
+ "DU_any_power8,VSU_power8")
9644
+(define_insn_reservation "power8-sqrt" 32
9645
+ (and (eq_attr "type" "ssqrt")
9646
+ (eq_attr "cpu" "power8"))
9647
+ "DU_any_power8,VSU_power8")
9649
+(define_insn_reservation "power8-dsqrt" 44
9650
+ (and (eq_attr "type" "dsqrt")
9651
+ (eq_attr "cpu" "power8"))
9652
+ "DU_any_power8,VSU_power8")
9654
+(define_insn_reservation "power8-vecsimple" 2
9655
+ (and (eq_attr "type" "vecperm,vecsimple,veccmp")
9656
+ (eq_attr "cpu" "power8"))
9657
+ "DU_any_power8,VSU_power8")
9659
+(define_insn_reservation "power8-vecnormal" 6
9660
+ (and (eq_attr "type" "vecfloat,vecdouble")
9661
+ (eq_attr "cpu" "power8"))
9662
+ "DU_any_power8,VSU_power8")
9664
+(define_bypass 7 "power8-vecnormal"
9665
+ "power8-vecsimple,power8-veccomplex,power8-fpstore*,\
9668
+(define_insn_reservation "power8-veccomplex" 7
9669
+ (and (eq_attr "type" "veccomplex")
9670
+ (eq_attr "cpu" "power8"))
9671
+ "DU_any_power8,VSU_power8")
9673
+(define_insn_reservation "power8-vecfdiv" 25
9674
+ (and (eq_attr "type" "vecfdiv")
9675
+ (eq_attr "cpu" "power8"))
9676
+ "DU_any_power8,VSU_power8")
9678
+(define_insn_reservation "power8-vecdiv" 31
9679
+ (and (eq_attr "type" "vecdiv")
9680
+ (eq_attr "cpu" "power8"))
9681
+ "DU_any_power8,VSU_power8")
9683
+(define_insn_reservation "power8-mffgpr" 5
9684
+ (and (eq_attr "type" "mffgpr")
9685
+ (eq_attr "cpu" "power8"))
9686
+ "DU_any_power8,VSU_power8")
9688
+(define_insn_reservation "power8-mftgpr" 6
9689
+ (and (eq_attr "type" "mftgpr")
9690
+ (eq_attr "cpu" "power8"))
9691
+ "DU_any_power8,VSU_power8")
9693
+(define_insn_reservation "power8-crypto" 7
9694
+ (and (eq_attr "type" "crypto")
9695
+ (eq_attr "cpu" "power8"))
9696
+ "DU_any_power8,VSU_power8")
9698
--- a/src/gcc/config/rs6000/vector.md
9699
+++ b/src/gcc/config/rs6000/vector.md
9704
-(define_mode_iterator VEC_I [V16QI V8HI V4SI])
9705
+(define_mode_iterator VEC_I [V16QI V8HI V4SI V2DI])
9707
;; Vector float modes
9708
(define_mode_iterator VEC_F [V4SF V2DF])
9710
;; Vector arithmetic modes
9711
-(define_mode_iterator VEC_A [V16QI V8HI V4SI V4SF V2DF])
9712
+(define_mode_iterator VEC_A [V16QI V8HI V4SI V2DI V4SF V2DF])
9714
;; Vector modes that need alginment via permutes
9715
(define_mode_iterator VEC_K [V16QI V8HI V4SI V4SF])
9717
(define_mode_iterator VEC_N [V4SI V4SF V2DI V2DF])
9719
;; Vector comparison modes
9720
-(define_mode_iterator VEC_C [V16QI V8HI V4SI V4SF V2DF])
9721
+(define_mode_iterator VEC_C [V16QI V8HI V4SI V2DI V4SF V2DF])
9723
;; Vector init/extract modes
9724
(define_mode_iterator VEC_E [V16QI V8HI V4SI V2DI V4SF V2DF])
9726
(define_mode_iterator VEC_64 [V2DI V2DF])
9728
;; Vector reload iterator
9729
-(define_mode_iterator VEC_R [V16QI V8HI V4SI V2DI V4SF V2DF DF TI])
9730
+(define_mode_iterator VEC_R [V16QI V8HI V4SI V2DI V4SF V2DF SF SD SI DF DD DI TI])
9732
;; Base type from vector mode
9733
(define_mode_attr VEC_base [(V16QI "QI")
9738
-;; Vector move instructions.
9739
+;; Vector move instructions. Little-endian VSX loads and stores require
9740
+;; special handling to circumvent "element endianness."
9741
(define_expand "mov<mode>"
9742
[(set (match_operand:VEC_M 0 "nonimmediate_operand" "")
9743
(match_operand:VEC_M 1 "any_operand" ""))]
9744
@@ -104,6 +105,16 @@
9745
&& !vlogical_operand (operands[1], <MODE>mode))
9746
operands[1] = force_reg (<MODE>mode, operands[1]);
9748
+ if (!BYTES_BIG_ENDIAN
9749
+ && VECTOR_MEM_VSX_P (<MODE>mode)
9750
+ && <MODE>mode != TImode
9751
+ && !gpr_or_gpr_p (operands[0], operands[1])
9752
+ && (memory_operand (operands[0], <MODE>mode)
9753
+ ^ memory_operand (operands[1], <MODE>mode)))
9755
+ rs6000_emit_le_vsx_move (operands[0], operands[1], <MODE>mode);
9760
;; Generic vector floating point load/store instructions. These will match
9762
(match_operand:VEC_L 1 "input_operand" ""))]
9763
"VECTOR_MEM_ALTIVEC_OR_VSX_P (<MODE>mode)
9765
- && gpr_or_gpr_p (operands[0], operands[1])"
9766
+ && gpr_or_gpr_p (operands[0], operands[1])
9767
+ && !direct_move_p (operands[0], operands[1])
9768
+ && !quad_load_store_p (operands[0], operands[1])"
9771
rs6000_split_multireg_move (operands[0], operands[1]);
9773
[(set (match_operand:VEC_F 0 "vfloat_operand" "")
9774
(mult:VEC_F (match_operand:VEC_F 1 "vfloat_operand" "")
9775
(match_operand:VEC_F 2 "vfloat_operand" "")))]
9776
- "VECTOR_UNIT_VSX_P (<MODE>mode) || VECTOR_UNIT_ALTIVEC_P (<MODE>mode)"
9777
+ "VECTOR_UNIT_ALTIVEC_OR_VSX_P (<MODE>mode)"
9779
if (<MODE>mode == V4SFmode && VECTOR_UNIT_ALTIVEC_P (<MODE>mode))
9782
(match_operand:VEC_I 5 "vint_operand" "")])
9783
(match_operand:VEC_I 1 "vint_operand" "")
9784
(match_operand:VEC_I 2 "vint_operand" "")))]
9785
- "VECTOR_UNIT_ALTIVEC_P (<MODE>mode)"
9786
+ "VECTOR_UNIT_ALTIVEC_OR_VSX_P (<MODE>mode)"
9789
if (rs6000_emit_vector_cond_expr (operands[0], operands[1], operands[2],
9791
(match_operand:VEC_I 5 "vint_operand" "")])
9792
(match_operand:VEC_I 1 "vint_operand" "")
9793
(match_operand:VEC_I 2 "vint_operand" "")))]
9794
- "VECTOR_UNIT_ALTIVEC_P (<MODE>mode)"
9795
+ "VECTOR_UNIT_ALTIVEC_OR_VSX_P (<MODE>mode)"
9798
if (rs6000_emit_vector_cond_expr (operands[0], operands[1], operands[2],
9799
@@ -505,14 +518,14 @@
9800
[(set (match_operand:VEC_I 0 "vint_operand" "")
9801
(gtu:VEC_I (match_operand:VEC_I 1 "vint_operand" "")
9802
(match_operand:VEC_I 2 "vint_operand" "")))]
9803
- "VECTOR_UNIT_ALTIVEC_P (<MODE>mode)"
9804
+ "VECTOR_UNIT_ALTIVEC_OR_VSX_P (<MODE>mode)"
9807
(define_expand "vector_geu<mode>"
9808
[(set (match_operand:VEC_I 0 "vint_operand" "")
9809
(geu:VEC_I (match_operand:VEC_I 1 "vint_operand" "")
9810
(match_operand:VEC_I 2 "vint_operand" "")))]
9811
- "VECTOR_UNIT_ALTIVEC_P (<MODE>mode)"
9812
+ "VECTOR_UNIT_ALTIVEC_OR_VSX_P (<MODE>mode)"
9815
(define_insn_and_split "*vector_uneq<mode>"
9816
@@ -708,48 +721,19 @@
9820
-;; Vector logical instructions
9821
-(define_expand "xor<mode>3"
9822
- [(set (match_operand:VEC_L 0 "vlogical_operand" "")
9823
- (xor:VEC_L (match_operand:VEC_L 1 "vlogical_operand" "")
9824
- (match_operand:VEC_L 2 "vlogical_operand" "")))]
9825
- "VECTOR_MEM_ALTIVEC_OR_VSX_P (<MODE>mode)"
9827
+;; Vector count leading zeros
9828
+(define_expand "clz<mode>2"
9829
+ [(set (match_operand:VEC_I 0 "register_operand" "")
9830
+ (clz:VEC_I (match_operand:VEC_I 1 "register_operand" "")))]
9831
+ "TARGET_P8_VECTOR")
9833
-(define_expand "ior<mode>3"
9834
- [(set (match_operand:VEC_L 0 "vlogical_operand" "")
9835
- (ior:VEC_L (match_operand:VEC_L 1 "vlogical_operand" "")
9836
- (match_operand:VEC_L 2 "vlogical_operand" "")))]
9837
- "VECTOR_MEM_ALTIVEC_OR_VSX_P (<MODE>mode)"
9839
+;; Vector population count
9840
+(define_expand "popcount<mode>2"
9841
+ [(set (match_operand:VEC_I 0 "register_operand" "")
9842
+ (popcount:VEC_I (match_operand:VEC_I 1 "register_operand" "")))]
9843
+ "TARGET_P8_VECTOR")
9845
-(define_expand "and<mode>3"
9846
- [(set (match_operand:VEC_L 0 "vlogical_operand" "")
9847
- (and:VEC_L (match_operand:VEC_L 1 "vlogical_operand" "")
9848
- (match_operand:VEC_L 2 "vlogical_operand" "")))]
9849
- "VECTOR_MEM_ALTIVEC_OR_VSX_P (<MODE>mode)"
9852
-(define_expand "one_cmpl<mode>2"
9853
- [(set (match_operand:VEC_L 0 "vlogical_operand" "")
9854
- (not:VEC_L (match_operand:VEC_L 1 "vlogical_operand" "")))]
9855
- "VECTOR_MEM_ALTIVEC_OR_VSX_P (<MODE>mode)"
9858
-(define_expand "nor<mode>3"
9859
- [(set (match_operand:VEC_L 0 "vlogical_operand" "")
9860
- (not:VEC_L (ior:VEC_L (match_operand:VEC_L 1 "vlogical_operand" "")
9861
- (match_operand:VEC_L 2 "vlogical_operand" ""))))]
9862
- "VECTOR_MEM_ALTIVEC_OR_VSX_P (<MODE>mode)"
9865
-(define_expand "andc<mode>3"
9866
- [(set (match_operand:VEC_L 0 "vlogical_operand" "")
9867
- (and:VEC_L (not:VEC_L (match_operand:VEC_L 2 "vlogical_operand" ""))
9868
- (match_operand:VEC_L 1 "vlogical_operand" "")))]
9869
- "VECTOR_MEM_ALTIVEC_OR_VSX_P (<MODE>mode)"
9873
;; Same size conversions
9874
(define_expand "float<VEC_int><mode>2"
9875
[(set (match_operand:VEC_F 0 "vfloat_operand" "")
9878
rtx reg = gen_reg_rtx (V4SFmode);
9880
- rs6000_expand_interleave (reg, operands[1], operands[1], true);
9881
+ rs6000_expand_interleave (reg, operands[1], operands[1], BYTES_BIG_ENDIAN);
9882
emit_insn (gen_vsx_xvcvspdp (operands[0], reg));
9887
rtx reg = gen_reg_rtx (V4SFmode);
9889
- rs6000_expand_interleave (reg, operands[1], operands[1], false);
9890
+ rs6000_expand_interleave (reg, operands[1], operands[1], !BYTES_BIG_ENDIAN);
9891
emit_insn (gen_vsx_xvcvspdp (operands[0], reg));
9896
rtx reg = gen_reg_rtx (V4SImode);
9898
- rs6000_expand_interleave (reg, operands[1], operands[1], true);
9899
+ rs6000_expand_interleave (reg, operands[1], operands[1], BYTES_BIG_ENDIAN);
9900
emit_insn (gen_vsx_xvcvsxwdp (operands[0], reg));
9905
rtx reg = gen_reg_rtx (V4SImode);
9907
- rs6000_expand_interleave (reg, operands[1], operands[1], false);
9908
+ rs6000_expand_interleave (reg, operands[1], operands[1], !BYTES_BIG_ENDIAN);
9909
emit_insn (gen_vsx_xvcvsxwdp (operands[0], reg));
9914
rtx reg = gen_reg_rtx (V4SImode);
9916
- rs6000_expand_interleave (reg, operands[1], operands[1], true);
9917
+ rs6000_expand_interleave (reg, operands[1], operands[1], BYTES_BIG_ENDIAN);
9918
emit_insn (gen_vsx_xvcvuxwdp (operands[0], reg));
9923
rtx reg = gen_reg_rtx (V4SImode);
9925
- rs6000_expand_interleave (reg, operands[1], operands[1], false);
9926
+ rs6000_expand_interleave (reg, operands[1], operands[1], !BYTES_BIG_ENDIAN);
9927
emit_insn (gen_vsx_xvcvuxwdp (operands[0], reg));
9930
@@ -963,8 +947,19 @@
9931
(match_operand:V16QI 3 "vlogical_operand" "")]
9932
"VECTOR_MEM_ALTIVEC_OR_VSX_P (<MODE>mode)"
9934
- emit_insn (gen_altivec_vperm_<mode> (operands[0], operands[1], operands[2],
9936
+ if (BYTES_BIG_ENDIAN)
9937
+ emit_insn (gen_altivec_vperm_<mode> (operands[0], operands[1],
9938
+ operands[2], operands[3]));
9941
+ /* We have changed lvsr to lvsl, so to complete the transformation
9942
+ of vperm for LE, we must swap the inputs. */
9943
+ rtx unspec = gen_rtx_UNSPEC (<MODE>mode,
9944
+ gen_rtvec (3, operands[2],
9945
+ operands[1], operands[3]),
9947
+ emit_move_insn (operands[0], unspec);
9952
@@ -1064,7 +1059,7 @@
9953
[(set (match_operand:VEC_I 0 "vint_operand" "")
9954
(rotate:VEC_I (match_operand:VEC_I 1 "vint_operand" "")
9955
(match_operand:VEC_I 2 "vint_operand" "")))]
9957
+ "VECTOR_UNIT_ALTIVEC_OR_VSX_P (<MODE>mode)"
9960
;; Expanders for arithmetic shift left on each vector element
9961
@@ -1072,7 +1067,7 @@
9962
[(set (match_operand:VEC_I 0 "vint_operand" "")
9963
(ashift:VEC_I (match_operand:VEC_I 1 "vint_operand" "")
9964
(match_operand:VEC_I 2 "vint_operand" "")))]
9966
+ "VECTOR_UNIT_ALTIVEC_OR_VSX_P (<MODE>mode)"
9969
;; Expanders for logical shift right on each vector element
9970
@@ -1080,7 +1075,7 @@
9971
[(set (match_operand:VEC_I 0 "vint_operand" "")
9972
(lshiftrt:VEC_I (match_operand:VEC_I 1 "vint_operand" "")
9973
(match_operand:VEC_I 2 "vint_operand" "")))]
9975
+ "VECTOR_UNIT_ALTIVEC_OR_VSX_P (<MODE>mode)"
9978
;; Expanders for arithmetic shift right on each vector element
9979
@@ -1088,7 +1083,7 @@
9980
[(set (match_operand:VEC_I 0 "vint_operand" "")
9981
(ashiftrt:VEC_I (match_operand:VEC_I 1 "vint_operand" "")
9982
(match_operand:VEC_I 2 "vint_operand" "")))]
9984
+ "VECTOR_UNIT_ALTIVEC_OR_VSX_P (<MODE>mode)"
9987
;; Vector reduction expanders for VSX
9988
--- a/src/gcc/config/rs6000/constraints.md
9989
+++ b/src/gcc/config/rs6000/constraints.md
9993
;; Use w as a prefix to add VSX modes
9994
-;; vector double (V2DF)
9995
+;; any VSX register
9996
+(define_register_constraint "wa" "rs6000_constraints[RS6000_CONSTRAINT_wa]"
9997
+ "Any VSX register if the -mvsx option was used or NO_REGS.")
9999
(define_register_constraint "wd" "rs6000_constraints[RS6000_CONSTRAINT_wd]"
10001
+ "VSX vector register to hold vector double data or NO_REGS.")
10003
-;; vector float (V4SF)
10004
(define_register_constraint "wf" "rs6000_constraints[RS6000_CONSTRAINT_wf]"
10006
+ "VSX vector register to hold vector float data or NO_REGS.")
10008
-;; scalar double (DF)
10009
+(define_register_constraint "wg" "rs6000_constraints[RS6000_CONSTRAINT_wg]"
10010
+ "If -mmfpgpr was used, a floating point register or NO_REGS.")
10012
+(define_register_constraint "wl" "rs6000_constraints[RS6000_CONSTRAINT_wl]"
10013
+ "Floating point register if the LFIWAX instruction is enabled or NO_REGS.")
10015
+(define_register_constraint "wm" "rs6000_constraints[RS6000_CONSTRAINT_wm]"
10016
+ "VSX register if direct move instructions are enabled, or NO_REGS.")
10018
+;; NO_REGs register constraint, used to merge mov{sd,sf}, since movsd can use
10019
+;; direct move directly, and movsf can't to move between the register sets.
10020
+;; There is a mode_attr that resolves to wm for SDmode and wn for SFmode
10021
+(define_register_constraint "wn" "NO_REGS" "No register (NO_REGS).")
10023
+(define_register_constraint "wr" "rs6000_constraints[RS6000_CONSTRAINT_wr]"
10024
+ "General purpose register if 64-bit instructions are enabled or NO_REGS.")
10026
(define_register_constraint "ws" "rs6000_constraints[RS6000_CONSTRAINT_ws]"
10028
+ "VSX vector register to hold scalar double values or NO_REGS.")
10030
-;; any VSX register
10031
-(define_register_constraint "wa" "rs6000_constraints[RS6000_CONSTRAINT_wa]"
10033
+(define_register_constraint "wt" "rs6000_constraints[RS6000_CONSTRAINT_wt]"
10034
+ "VSX vector register to hold 128 bit integer or NO_REGS.")
10036
+(define_register_constraint "wu" "rs6000_constraints[RS6000_CONSTRAINT_wu]"
10037
+ "Altivec register to use for float/32-bit int loads/stores or NO_REGS.")
10039
+(define_register_constraint "wv" "rs6000_constraints[RS6000_CONSTRAINT_wv]"
10040
+ "Altivec register to use for double loads/stores or NO_REGS.")
10042
+(define_register_constraint "ww" "rs6000_constraints[RS6000_CONSTRAINT_ww]"
10043
+ "FP or VSX register to perform float operations under -mvsx or NO_REGS.")
10045
+(define_register_constraint "wx" "rs6000_constraints[RS6000_CONSTRAINT_wx]"
10046
+ "Floating point register if the STFIWX instruction is enabled or NO_REGS.")
10048
+(define_register_constraint "wy" "rs6000_constraints[RS6000_CONSTRAINT_wy]"
10049
+ "VSX vector register to hold scalar float values or NO_REGS.")
10051
+(define_register_constraint "wz" "rs6000_constraints[RS6000_CONSTRAINT_wz]"
10052
+ "Floating point register if the LFIWZX instruction is enabled or NO_REGS.")
10054
+;; Lq/stq validates the address for load/store quad
10055
+(define_memory_constraint "wQ"
10056
+ "Memory operand suitable for the load/store quad instructions"
10057
+ (match_operand 0 "quad_memory_operand"))
10059
;; Altivec style load/store that ignores the bottom bits of the address
10060
(define_memory_constraint "wZ"
10061
"Indexed or indirect memory operand, ignoring the bottom 4 bits"
10062
--- a/src/gcc/config/rs6000/predicates.md
10063
+++ b/src/gcc/config/rs6000/predicates.md
10064
@@ -124,6 +124,11 @@
10065
(and (match_code "const_int")
10066
(match_test "INTVAL (op) >= -16 && INTVAL (op) <= 15")))
10068
+;; Return 1 if op is a unsigned 3-bit constant integer.
10069
+(define_predicate "u3bit_cint_operand"
10070
+ (and (match_code "const_int")
10071
+ (match_test "INTVAL (op) >= 0 && INTVAL (op) <= 7")))
10073
;; Return 1 if op is a unsigned 5-bit constant integer.
10074
(define_predicate "u5bit_cint_operand"
10075
(and (match_code "const_int")
10076
@@ -135,6 +140,11 @@
10077
(and (match_code "const_int")
10078
(match_test "INTVAL (op) >= -128 && INTVAL (op) <= 127")))
10080
+;; Return 1 if op is a unsigned 10-bit constant integer.
10081
+(define_predicate "u10bit_cint_operand"
10082
+ (and (match_code "const_int")
10083
+ (match_test "INTVAL (op) >= 0 && INTVAL (op) <= 1023")))
10085
;; Return 1 if op is a constant integer that can fit in a D field.
10086
(define_predicate "short_cint_operand"
10087
(and (match_code "const_int")
10088
@@ -166,6 +176,11 @@
10089
(and (match_code "const_int")
10090
(match_test "IN_RANGE (INTVAL (op), 2, 3)")))
10092
+;; Match op = 0..15
10093
+(define_predicate "const_0_to_15_operand"
10094
+ (and (match_code "const_int")
10095
+ (match_test "IN_RANGE (INTVAL (op), 0, 15)")))
10097
;; Return 1 if op is a register that is not special.
10098
(define_predicate "gpc_reg_operand"
10099
(match_operand 0 "register_operand")
10100
@@ -182,9 +197,95 @@
10101
if (REGNO (op) >= ARG_POINTER_REGNUM && !CA_REGNO_P (REGNO (op)))
10104
+ if (TARGET_VSX && VSX_REGNO_P (REGNO (op)))
10107
return INT_REGNO_P (REGNO (op)) || FP_REGNO_P (REGNO (op));
10110
+;; Return 1 if op is a general purpose register. Unlike gpc_reg_operand, don't
10111
+;; allow floating point or vector registers.
10112
+(define_predicate "int_reg_operand"
10113
+ (match_operand 0 "register_operand")
10115
+ if ((TARGET_E500_DOUBLE || TARGET_SPE) && invalid_e500_subreg (op, mode))
10118
+ if (GET_CODE (op) == SUBREG)
10119
+ op = SUBREG_REG (op);
10124
+ if (REGNO (op) >= FIRST_PSEUDO_REGISTER)
10127
+ return INT_REGNO_P (REGNO (op));
10130
+;; Like int_reg_operand, but only return true for base registers
10131
+(define_predicate "base_reg_operand"
10132
+ (match_operand 0 "int_reg_operand")
10134
+ if (GET_CODE (op) == SUBREG)
10135
+ op = SUBREG_REG (op);
10140
+ return (REGNO (op) != FIRST_GPR_REGNO);
10143
+;; Return 1 if op is a HTM specific SPR register.
10144
+(define_predicate "htm_spr_reg_operand"
10145
+ (match_operand 0 "register_operand")
10150
+ if (GET_CODE (op) == SUBREG)
10151
+ op = SUBREG_REG (op);
10156
+ switch (REGNO (op))
10158
+ case TFHAR_REGNO:
10159
+ case TFIAR_REGNO:
10160
+ case TEXASR_REGNO:
10166
+ /* Unknown SPR. */
10170
+;; Return 1 if op is a general purpose register that is an even register
10171
+;; which suitable for a load/store quad operation
10172
+(define_predicate "quad_int_reg_operand"
10173
+ (match_operand 0 "register_operand")
10177
+ if (!TARGET_QUAD_MEMORY)
10180
+ if (GET_CODE (op) == SUBREG)
10181
+ op = SUBREG_REG (op);
10187
+ if (r >= FIRST_PSEUDO_REGISTER)
10190
+ return (INT_REGNO_P (r) && ((r & 1) == 0));
10193
;; Return 1 if op is a register that is a condition register field.
10194
(define_predicate "cc_reg_operand"
10195
(match_operand 0 "register_operand")
10196
@@ -315,6 +416,11 @@
10197
&& CONST_DOUBLE_HIGH (op) == 0")
10198
(match_operand 0 "gpc_reg_operand"))))
10200
+;; Like reg_or_logical_cint_operand, but allow vsx registers
10201
+(define_predicate "vsx_reg_or_cint_operand"
10202
+ (ior (match_operand 0 "vsx_register_operand")
10203
+ (match_operand 0 "reg_or_logical_cint_operand")))
10205
;; Return 1 if operand is a CONST_DOUBLE that can be set in a register
10206
;; with no more than one instruction per word.
10207
(define_predicate "easy_fp_constant"
10208
@@ -333,6 +439,11 @@
10212
+ /* The constant 0.0 is easy under VSX. */
10213
+ if ((mode == SFmode || mode == DFmode || mode == SDmode || mode == DDmode)
10214
+ && VECTOR_UNIT_VSX_P (DFmode) && op == CONST0_RTX (mode))
10217
if (DECIMAL_FLOAT_MODE_P (mode))
10220
@@ -521,6 +632,54 @@
10221
(and (match_operand 0 "memory_operand")
10222
(match_test "offsettable_nonstrict_memref_p (op)")))
10224
+;; Return 1 if the operand is suitable for load/store quad memory.
10225
+(define_predicate "quad_memory_operand"
10226
+ (match_code "mem")
10228
+ rtx addr, op0, op1;
10231
+ if (!TARGET_QUAD_MEMORY)
10234
+ else if (!memory_operand (op, mode))
10237
+ else if (GET_MODE_SIZE (GET_MODE (op)) != 16)
10240
+ else if (MEM_ALIGN (op) < 128)
10245
+ addr = XEXP (op, 0);
10246
+ if (int_reg_operand (addr, Pmode))
10249
+ else if (GET_CODE (addr) != PLUS)
10254
+ op0 = XEXP (addr, 0);
10255
+ op1 = XEXP (addr, 1);
10256
+ ret = (int_reg_operand (op0, Pmode)
10257
+ && GET_CODE (op1) == CONST_INT
10258
+ && IN_RANGE (INTVAL (op1), -32768, 32767)
10259
+ && (INTVAL (op1) & 15) == 0);
10263
+ if (TARGET_DEBUG_ADDR)
10265
+ fprintf (stderr, "\nquad_memory_operand, ret = %s\n", ret ? "true" : "false");
10272
;; Return 1 if the operand is an indexed or indirect memory operand.
10273
(define_predicate "indexed_or_indirect_operand"
10275
@@ -535,6 +694,19 @@
10276
return indexed_or_indirect_address (op, mode);
10279
+;; Like indexed_or_indirect_operand, but also allow a GPR register if direct
10280
+;; moves are supported.
10281
+(define_predicate "reg_or_indexed_operand"
10282
+ (match_code "mem,reg")
10285
+ return indexed_or_indirect_operand (op, mode);
10286
+ else if (TARGET_DIRECT_MOVE)
10287
+ return register_operand (op, mode);
10292
;; Return 1 if the operand is an indexed or indirect memory operand with an
10293
;; AND -16 in it, used to recognize when we need to switch to Altivec loads
10294
;; to realign loops instead of VSX (altivec silently ignores the bottom bits,
10295
@@ -560,6 +732,28 @@
10296
&& REG_P (XEXP (op, 1)))")
10297
(match_operand 0 "address_operand")))
10299
+;; Return 1 if the operand is an index-form address.
10300
+(define_special_predicate "indexed_address"
10301
+ (match_test "(GET_CODE (op) == PLUS
10302
+ && REG_P (XEXP (op, 0))
10303
+ && REG_P (XEXP (op, 1)))"))
10305
+;; Return 1 if the operand is a MEM with an update-form address. This may
10306
+;; also include update-indexed form.
10307
+(define_special_predicate "update_address_mem"
10308
+ (match_test "(MEM_P (op)
10309
+ && (GET_CODE (XEXP (op, 0)) == PRE_INC
10310
+ || GET_CODE (XEXP (op, 0)) == PRE_DEC
10311
+ || GET_CODE (XEXP (op, 0)) == PRE_MODIFY))"))
10313
+;; Return 1 if the operand is a MEM with an update-indexed-form address. Note
10314
+;; that PRE_INC/PRE_DEC will always be non-indexed (i.e. non X-form) since the
10315
+;; increment is based on the mode size and will therefor always be a const.
10316
+(define_special_predicate "update_indexed_address_mem"
10317
+ (match_test "(MEM_P (op)
10318
+ && GET_CODE (XEXP (op, 0)) == PRE_MODIFY
10319
+ && indexed_address (XEXP (XEXP (op, 0), 1), mode))"))
10321
;; Used for the destination of the fix_truncdfsi2 expander.
10322
;; If stfiwx will be used, the result goes to memory; otherwise,
10323
;; we're going to emit a store and a load of a subreg, so the dest is a
10324
@@ -883,7 +1077,8 @@
10325
(and (match_code "symbol_ref")
10326
(match_test "(DEFAULT_ABI != ABI_AIX || SYMBOL_REF_FUNCTION_P (op))
10327
&& ((SYMBOL_REF_LOCAL_P (op)
10328
- && (DEFAULT_ABI != ABI_AIX
10329
+ && ((DEFAULT_ABI != ABI_AIX
10330
+ && DEFAULT_ABI != ABI_ELFv2)
10331
|| !SYMBOL_REF_EXTERNAL_P (op)))
10332
|| (op == XEXP (DECL_RTL (current_function_decl),
10334
@@ -1364,6 +1559,26 @@
10338
+;; Return 1 if OP is valid for crsave insn, known to be a PARALLEL.
10339
+(define_predicate "crsave_operation"
10340
+ (match_code "parallel")
10342
+ int count = XVECLEN (op, 0);
10345
+ for (i = 1; i < count; i++)
10347
+ rtx exp = XVECEXP (op, 0, i);
10349
+ if (GET_CODE (exp) != USE
10350
+ || GET_CODE (XEXP (exp, 0)) != REG
10351
+ || GET_MODE (XEXP (exp, 0)) != CCmode
10352
+ || ! CR_REGNO_P (REGNO (XEXP (exp, 0))))
10358
;; Return 1 if OP is valid for lmw insn, known to be a PARALLEL.
10359
(define_predicate "lmw_operation"
10360
(match_code "parallel")
10361
@@ -1534,3 +1749,99 @@
10363
return GET_CODE (op) == UNSPEC && XINT (op, 1) == UNSPEC_TOCREL;
10366
+;; Match the first insn (addis) in fusing the combination of addis and loads to
10367
+;; GPR registers on power8.
10368
+(define_predicate "fusion_gpr_addis"
10369
+ (match_code "const_int,high,plus")
10371
+ HOST_WIDE_INT value;
10374
+ if (GET_CODE (op) == HIGH)
10377
+ if (CONST_INT_P (op))
10380
+ else if (GET_CODE (op) == PLUS
10381
+ && base_reg_operand (XEXP (op, 0), Pmode)
10382
+ && CONST_INT_P (XEXP (op, 1)))
10383
+ int_const = XEXP (op, 1);
10388
+ /* Power8 currently will only do the fusion if the top 11 bits of the addis
10389
+ value are all 1's or 0's. */
10390
+ value = INTVAL (int_const);
10391
+ if ((value & (HOST_WIDE_INT)0xffff) != 0)
10394
+ if ((value & (HOST_WIDE_INT)0xffff0000) == 0)
10397
+ return (IN_RANGE (value >> 16, -32, 31));
10400
+;; Match the second insn (lbz, lhz, lwz, ld) in fusing the combination of addis
10401
+;; and loads to GPR registers on power8.
10402
+(define_predicate "fusion_gpr_mem_load"
10403
+ (match_code "mem,sign_extend,zero_extend")
10407
+ /* Handle sign/zero extend. */
10408
+ if (GET_CODE (op) == ZERO_EXTEND
10409
+ || (TARGET_P8_FUSION_SIGN && GET_CODE (op) == SIGN_EXTEND))
10411
+ op = XEXP (op, 0);
10412
+ mode = GET_MODE (op);
10426
+ if (!TARGET_POWERPC64)
10434
+ addr = XEXP (op, 0);
10435
+ if (GET_CODE (addr) == PLUS)
10437
+ rtx base = XEXP (addr, 0);
10438
+ rtx offset = XEXP (addr, 1);
10440
+ return (base_reg_operand (base, GET_MODE (base))
10441
+ && satisfies_constraint_I (offset));
10444
+ else if (GET_CODE (addr) == LO_SUM)
10446
+ rtx base = XEXP (addr, 0);
10447
+ rtx offset = XEXP (addr, 1);
10449
+ if (!base_reg_operand (base, GET_MODE (base)))
10452
+ else if (TARGET_XCOFF || (TARGET_ELF && TARGET_POWERPC64))
10453
+ return small_toc_ref (offset, GET_MODE (offset));
10455
+ else if (TARGET_ELF && !TARGET_POWERPC64)
10456
+ return CONSTANT_P (offset);
10461
--- a/src/gcc/config/rs6000/ppc-asm.h
10462
+++ b/src/gcc/config/rs6000/ppc-asm.h
10463
@@ -256,7 +256,30 @@
10464
* the real function with one or two leading periods respectively.
10467
-#if defined (__powerpc64__)
10468
+#if defined(__powerpc64__) && _CALL_ELF == 2
10470
+/* Defining "toc" above breaks @toc in assembler code. */
10473
+#define FUNC_NAME(name) GLUE(__USER_LABEL_PREFIX__,name)
10474
+#define JUMP_TARGET(name) FUNC_NAME(name)
10475
+#define FUNC_START(name) \
10476
+ .type FUNC_NAME(name),@function; \
10477
+ .globl FUNC_NAME(name); \
10478
+FUNC_NAME(name): \
10479
+0: addis 2,12,(.TOC.-0b)@ha; \
10480
+ addi 2,2,(.TOC.-0b)@l; \
10481
+ .localentry FUNC_NAME(name),.-FUNC_NAME(name)
10483
+#define HIDDEN_FUNC(name) \
10484
+ FUNC_START(name) \
10485
+ .hidden FUNC_NAME(name);
10487
+#define FUNC_END(name) \
10488
+ .size FUNC_NAME(name),.-FUNC_NAME(name)
10490
+#elif defined (__powerpc64__)
10492
#define FUNC_NAME(name) GLUE(.,name)
10493
#define JUMP_TARGET(name) FUNC_NAME(name)
10494
#define FUNC_START(name) \
10495
--- a/src/gcc/config/rs6000/htm.md
10496
+++ b/src/gcc/config/rs6000/htm.md
10498
+;; Hardware Transactional Memory (HTM) patterns.
10499
+;; Copyright (C) 2013 Free Software Foundation, Inc.
10500
+;; Contributed by Peter Bergner <bergner@vnet.ibm.com>.
10502
+;; This file is part of GCC.
10504
+;; GCC is free software; you can redistribute it and/or modify it
10505
+;; under the terms of the GNU General Public License as published
10506
+;; by the Free Software Foundation; either version 3, or (at your
10507
+;; option) any later version.
10509
+;; GCC is distributed in the hope that it will be useful, but WITHOUT
10510
+;; ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
10511
+;; or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
10512
+;; License for more details.
10514
+;; You should have received a copy of the GNU General Public License
10515
+;; along with GCC; see the file COPYING3. If not see
10516
+;; <http://www.gnu.org/licenses/>.
10522
+ (TEXASRU_SPR 131)
10523
+ (MAX_HTM_OPERANDS 4)
10527
+;; UNSPEC_VOLATILE usage
10530
+(define_c_enum "unspecv"
10531
+ [UNSPECV_HTM_TABORT
10532
+ UNSPECV_HTM_TABORTDC
10533
+ UNSPECV_HTM_TABORTDCI
10534
+ UNSPECV_HTM_TABORTWC
10535
+ UNSPECV_HTM_TABORTWCI
10536
+ UNSPECV_HTM_TBEGIN
10537
+ UNSPECV_HTM_TCHECK
10539
+ UNSPECV_HTM_TRECHKPT
10540
+ UNSPECV_HTM_TRECLAIM
10542
+ UNSPECV_HTM_MFSPR
10543
+ UNSPECV_HTM_MTSPR
10547
+(define_expand "tabort"
10548
+ [(set (match_dup 2)
10549
+ (unspec_volatile:CC [(match_operand:SI 1 "int_reg_operand" "")]
10550
+ UNSPECV_HTM_TABORT))
10551
+ (set (match_dup 3)
10552
+ (eq:SI (match_dup 2)
10554
+ (set (match_operand:SI 0 "int_reg_operand" "")
10555
+ (minus:SI (const_int 1) (match_dup 3)))]
10558
+ operands[2] = gen_rtx_REG (CCmode, CR0_REGNO);
10559
+ operands[3] = gen_reg_rtx (SImode);
10562
+(define_insn "*tabort_internal"
10563
+ [(set (match_operand:CC 1 "cc_reg_operand" "=x")
10564
+ (unspec_volatile:CC [(match_operand:SI 0 "int_reg_operand" "r")]
10565
+ UNSPECV_HTM_TABORT))]
10568
+ [(set_attr "type" "htm")
10569
+ (set_attr "length" "4")])
10571
+(define_expand "tabortdc"
10572
+ [(set (match_dup 4)
10573
+ (unspec_volatile:CC [(match_operand 1 "u5bit_cint_operand" "n")
10574
+ (match_operand:SI 2 "gpc_reg_operand" "r")
10575
+ (match_operand:SI 3 "gpc_reg_operand" "r")]
10576
+ UNSPECV_HTM_TABORTDC))
10577
+ (set (match_dup 5)
10578
+ (eq:SI (match_dup 4)
10580
+ (set (match_operand:SI 0 "int_reg_operand" "")
10581
+ (minus:SI (const_int 1) (match_dup 5)))]
10584
+ operands[4] = gen_rtx_REG (CCmode, CR0_REGNO);
10585
+ operands[5] = gen_reg_rtx (SImode);
10588
+(define_insn "*tabortdc_internal"
10589
+ [(set (match_operand:CC 3 "cc_reg_operand" "=x")
10590
+ (unspec_volatile:CC [(match_operand 0 "u5bit_cint_operand" "n")
10591
+ (match_operand:SI 1 "gpc_reg_operand" "r")
10592
+ (match_operand:SI 2 "gpc_reg_operand" "r")]
10593
+ UNSPECV_HTM_TABORTDC))]
10595
+ "tabortdc. %0,%1,%2"
10596
+ [(set_attr "type" "htm")
10597
+ (set_attr "length" "4")])
10599
+(define_expand "tabortdci"
10600
+ [(set (match_dup 4)
10601
+ (unspec_volatile:CC [(match_operand 1 "u5bit_cint_operand" "n")
10602
+ (match_operand:SI 2 "gpc_reg_operand" "r")
10603
+ (match_operand 3 "s5bit_cint_operand" "n")]
10604
+ UNSPECV_HTM_TABORTDCI))
10605
+ (set (match_dup 5)
10606
+ (eq:SI (match_dup 4)
10608
+ (set (match_operand:SI 0 "int_reg_operand" "")
10609
+ (minus:SI (const_int 1) (match_dup 5)))]
10612
+ operands[4] = gen_rtx_REG (CCmode, CR0_REGNO);
10613
+ operands[5] = gen_reg_rtx (SImode);
10616
+(define_insn "*tabortdci_internal"
10617
+ [(set (match_operand:CC 3 "cc_reg_operand" "=x")
10618
+ (unspec_volatile:CC [(match_operand 0 "u5bit_cint_operand" "n")
10619
+ (match_operand:SI 1 "gpc_reg_operand" "r")
10620
+ (match_operand 2 "s5bit_cint_operand" "n")]
10621
+ UNSPECV_HTM_TABORTDCI))]
10623
+ "tabortdci. %0,%1,%2"
10624
+ [(set_attr "type" "htm")
10625
+ (set_attr "length" "4")])
10627
+(define_expand "tabortwc"
10628
+ [(set (match_dup 4)
10629
+ (unspec_volatile:CC [(match_operand 1 "u5bit_cint_operand" "n")
10630
+ (match_operand:SI 2 "gpc_reg_operand" "r")
10631
+ (match_operand:SI 3 "gpc_reg_operand" "r")]
10632
+ UNSPECV_HTM_TABORTWC))
10633
+ (set (match_dup 5)
10634
+ (eq:SI (match_dup 4)
10636
+ (set (match_operand:SI 0 "int_reg_operand" "")
10637
+ (minus:SI (const_int 1) (match_dup 5)))]
10640
+ operands[4] = gen_rtx_REG (CCmode, CR0_REGNO);
10641
+ operands[5] = gen_reg_rtx (SImode);
10644
+(define_insn "*tabortwc_internal"
10645
+ [(set (match_operand:CC 3 "cc_reg_operand" "=x")
10646
+ (unspec_volatile:CC [(match_operand 0 "u5bit_cint_operand" "n")
10647
+ (match_operand:SI 1 "gpc_reg_operand" "r")
10648
+ (match_operand:SI 2 "gpc_reg_operand" "r")]
10649
+ UNSPECV_HTM_TABORTWC))]
10651
+ "tabortwc. %0,%1,%2"
10652
+ [(set_attr "type" "htm")
10653
+ (set_attr "length" "4")])
10655
+(define_expand "tabortwci"
10656
+ [(set (match_dup 4)
10657
+ (unspec_volatile:CC [(match_operand 1 "u5bit_cint_operand" "n")
10658
+ (match_operand:SI 2 "gpc_reg_operand" "r")
10659
+ (match_operand 3 "s5bit_cint_operand" "n")]
10660
+ UNSPECV_HTM_TABORTWCI))
10661
+ (set (match_dup 5)
10662
+ (eq:SI (match_dup 4)
10664
+ (set (match_operand:SI 0 "int_reg_operand" "")
10665
+ (minus:SI (const_int 1) (match_dup 5)))]
10668
+ operands[4] = gen_rtx_REG (CCmode, CR0_REGNO);
10669
+ operands[5] = gen_reg_rtx (SImode);
10672
+(define_expand "ttest"
10673
+ [(set (match_dup 1)
10674
+ (unspec_volatile:CC [(const_int 0)
10677
+ UNSPECV_HTM_TABORTWCI))
10678
+ (set (subreg:CC (match_dup 2) 0) (match_dup 1))
10679
+ (set (match_dup 3) (lshiftrt:SI (match_dup 2) (const_int 24)))
10680
+ (parallel [(set (match_operand:SI 0 "int_reg_operand" "")
10681
+ (and:SI (match_dup 3) (const_int 15)))
10682
+ (clobber (scratch:CC))])]
10685
+ operands[1] = gen_rtx_REG (CCmode, CR0_REGNO);
10686
+ operands[2] = gen_reg_rtx (SImode);
10687
+ operands[3] = gen_reg_rtx (SImode);
10690
+(define_insn "*tabortwci_internal"
10691
+ [(set (match_operand:CC 3 "cc_reg_operand" "=x")
10692
+ (unspec_volatile:CC [(match_operand 0 "u5bit_cint_operand" "n")
10693
+ (match_operand:SI 1 "gpc_reg_operand" "r")
10694
+ (match_operand 2 "s5bit_cint_operand" "n")]
10695
+ UNSPECV_HTM_TABORTWCI))]
10697
+ "tabortwci. %0,%1,%2"
10698
+ [(set_attr "type" "htm")
10699
+ (set_attr "length" "4")])
10701
+(define_expand "tbegin"
10702
+ [(set (match_dup 2)
10703
+ (unspec_volatile:CC [(match_operand 1 "const_0_to_1_operand" "n")]
10704
+ UNSPECV_HTM_TBEGIN))
10705
+ (set (match_dup 3)
10706
+ (eq:SI (match_dup 2)
10708
+ (set (match_operand:SI 0 "int_reg_operand" "")
10709
+ (minus:SI (const_int 1) (match_dup 3)))]
10712
+ operands[2] = gen_rtx_REG (CCmode, CR0_REGNO);
10713
+ operands[3] = gen_reg_rtx (SImode);
10716
+(define_insn "*tbegin_internal"
10717
+ [(set (match_operand:CC 1 "cc_reg_operand" "=x")
10718
+ (unspec_volatile:CC [(match_operand 0 "const_0_to_1_operand" "n")]
10719
+ UNSPECV_HTM_TBEGIN))]
10722
+ [(set_attr "type" "htm")
10723
+ (set_attr "length" "4")])
10725
+(define_expand "tcheck"
10726
+ [(set (match_dup 2)
10727
+ (unspec_volatile:CC [(match_operand 1 "u3bit_cint_operand" "n")]
10728
+ UNSPECV_HTM_TCHECK))
10729
+ (set (match_dup 3)
10730
+ (eq:SI (match_dup 2)
10732
+ (set (match_operand:SI 0 "int_reg_operand" "")
10733
+ (minus:SI (const_int 1) (match_dup 3)))]
10736
+ operands[2] = gen_rtx_REG (CCmode, CR0_REGNO);
10737
+ operands[3] = gen_reg_rtx (SImode);
10740
+(define_insn "*tcheck_internal"
10741
+ [(set (match_operand:CC 1 "cc_reg_operand" "=x")
10742
+ (unspec_volatile:CC [(match_operand 0 "u3bit_cint_operand" "n")]
10743
+ UNSPECV_HTM_TCHECK))]
10746
+ [(set_attr "type" "htm")
10747
+ (set_attr "length" "4")])
10749
+(define_expand "tend"
10750
+ [(set (match_dup 2)
10751
+ (unspec_volatile:CC [(match_operand 1 "const_0_to_1_operand" "n")]
10752
+ UNSPECV_HTM_TEND))
10753
+ (set (match_dup 3)
10754
+ (eq:SI (match_dup 2)
10756
+ (set (match_operand:SI 0 "int_reg_operand" "")
10757
+ (minus:SI (const_int 1) (match_dup 3)))]
10760
+ operands[2] = gen_rtx_REG (CCmode, CR0_REGNO);
10761
+ operands[3] = gen_reg_rtx (SImode);
10764
+(define_insn "*tend_internal"
10765
+ [(set (match_operand:CC 1 "cc_reg_operand" "=x")
10766
+ (unspec_volatile:CC [(match_operand 0 "const_0_to_1_operand" "n")]
10767
+ UNSPECV_HTM_TEND))]
10770
+ [(set_attr "type" "htm")
10771
+ (set_attr "length" "4")])
10773
+(define_expand "trechkpt"
10774
+ [(set (match_dup 1)
10775
+ (unspec_volatile:CC [(const_int 0)]
10776
+ UNSPECV_HTM_TRECHKPT))
10777
+ (set (match_dup 2)
10778
+ (eq:SI (match_dup 1)
10780
+ (set (match_operand:SI 0 "int_reg_operand" "")
10781
+ (minus:SI (const_int 1) (match_dup 2)))]
10784
+ operands[1] = gen_rtx_REG (CCmode, CR0_REGNO);
10785
+ operands[2] = gen_reg_rtx (SImode);
10788
+(define_insn "*trechkpt_internal"
10789
+ [(set (match_operand:CC 0 "cc_reg_operand" "=x")
10790
+ (unspec_volatile:CC [(const_int 0)]
10791
+ UNSPECV_HTM_TRECHKPT))]
10794
+ [(set_attr "type" "htm")
10795
+ (set_attr "length" "4")])
10797
+(define_expand "treclaim"
10798
+ [(set (match_dup 2)
10799
+ (unspec_volatile:CC [(match_operand:SI 1 "gpc_reg_operand" "r")]
10800
+ UNSPECV_HTM_TRECLAIM))
10801
+ (set (match_dup 3)
10802
+ (eq:SI (match_dup 2)
10804
+ (set (match_operand:SI 0 "int_reg_operand" "")
10805
+ (minus:SI (const_int 1) (match_dup 3)))]
10808
+ operands[2] = gen_rtx_REG (CCmode, CR0_REGNO);
10809
+ operands[3] = gen_reg_rtx (SImode);
10812
+(define_insn "*treclaim_internal"
10813
+ [(set (match_operand:CC 1 "cc_reg_operand" "=x")
10814
+ (unspec_volatile:CC [(match_operand:SI 0 "gpc_reg_operand" "r")]
10815
+ UNSPECV_HTM_TRECLAIM))]
10818
+ [(set_attr "type" "htm")
10819
+ (set_attr "length" "4")])
10821
+(define_expand "tsr"
10822
+ [(set (match_dup 2)
10823
+ (unspec_volatile:CC [(match_operand 1 "const_0_to_1_operand" "n")]
10824
+ UNSPECV_HTM_TSR))
10825
+ (set (match_dup 3)
10826
+ (eq:SI (match_dup 2)
10828
+ (set (match_operand:SI 0 "int_reg_operand" "")
10829
+ (minus:SI (const_int 1) (match_dup 3)))]
10832
+ operands[2] = gen_rtx_REG (CCmode, CR0_REGNO);
10833
+ operands[3] = gen_reg_rtx (SImode);
10836
+(define_insn "*tsr_internal"
10837
+ [(set (match_operand:CC 1 "cc_reg_operand" "=x")
10838
+ (unspec_volatile:CC [(match_operand 0 "const_0_to_1_operand" "n")]
10839
+ UNSPECV_HTM_TSR))]
10842
+ [(set_attr "type" "htm")
10843
+ (set_attr "length" "4")])
10845
+(define_insn "htm_mfspr_<mode>"
10846
+ [(set (match_operand:P 0 "gpc_reg_operand" "=r")
10847
+ (unspec_volatile:P [(match_operand 1 "u10bit_cint_operand" "n")
10848
+ (match_operand:P 2 "htm_spr_reg_operand" "")]
10849
+ UNSPECV_HTM_MFSPR))]
10852
+ [(set_attr "type" "htm")
10853
+ (set_attr "length" "4")])
10855
+(define_insn "htm_mtspr_<mode>"
10856
+ [(set (match_operand:P 2 "htm_spr_reg_operand" "")
10857
+ (unspec_volatile:P [(match_operand:P 0 "gpc_reg_operand" "r")
10858
+ (match_operand 1 "u10bit_cint_operand" "n")]
10859
+ UNSPECV_HTM_MTSPR))]
10862
+ [(set_attr "type" "htm")
10863
+ (set_attr "length" "4")])
10864
--- a/src/gcc/config/rs6000/rs6000-modes.def
10865
+++ b/src/gcc/config/rs6000/rs6000-modes.def
10867
VECTOR_MODES (FLOAT, 8); /* V4HF V2SF */
10868
VECTOR_MODES (FLOAT, 16); /* V8HF V4SF V2DF */
10869
VECTOR_MODES (FLOAT, 32); /* V16HF V8SF V4DF */
10871
+/* Replacement for TImode that only is allowed in GPRs. We also use PTImode
10872
+ for quad memory atomic operations to force getting an even/odd register
10874
+PARTIAL_INT_MODE (TI);
10875
--- a/src/gcc/config/rs6000/rs6000-cpus.def
10876
+++ b/src/gcc/config/rs6000/rs6000-cpus.def
10878
ALTIVEC, since in general it isn't a win on power6. In ISA 2.04, fsel,
10879
fre, fsqrt, etc. were no longer documented as optional. Group masks by
10880
server and embedded. */
10881
-#define ISA_2_5_MASKS_EMBEDDED (ISA_2_2_MASKS \
10882
+#define ISA_2_5_MASKS_EMBEDDED (ISA_2_4_MASKS \
10883
| OPTION_MASK_CMPB \
10884
| OPTION_MASK_RECIP_PRECISION \
10885
| OPTION_MASK_PPC_GFXOPT \
10886
@@ -38,12 +38,23 @@
10888
/* For ISA 2.06, don't add ISEL, since in general it isn't a win, but
10889
altivec is a win so enable it. */
10890
+ /* OPTION_MASK_VSX_TIMODE should be set, but disable it for now until
10891
+ PR 58587 is fixed. */
10892
#define ISA_2_6_MASKS_EMBEDDED (ISA_2_5_MASKS_EMBEDDED | OPTION_MASK_POPCNTD)
10893
#define ISA_2_6_MASKS_SERVER (ISA_2_5_MASKS_SERVER \
10894
| OPTION_MASK_POPCNTD \
10895
| OPTION_MASK_ALTIVEC \
10898
+/* For now, don't provide an embedded version of ISA 2.07. */
10899
+#define ISA_2_7_MASKS_SERVER (ISA_2_6_MASKS_SERVER \
10900
+ | OPTION_MASK_P8_FUSION \
10901
+ | OPTION_MASK_P8_VECTOR \
10902
+ | OPTION_MASK_CRYPTO \
10903
+ | OPTION_MASK_DIRECT_MOVE \
10904
+ | OPTION_MASK_HTM \
10905
+ | OPTION_MASK_QUAD_MEMORY)
10907
#define POWERPC_7400_MASK (OPTION_MASK_PPC_GFXOPT | OPTION_MASK_ALTIVEC)
10909
/* Deal with ports that do not have -mstrict-align. */
10910
@@ -60,23 +71,30 @@
10911
/* Mask of all options to set the default isa flags based on -mcpu=<xxx>. */
10912
#define POWERPC_MASKS (OPTION_MASK_ALTIVEC \
10913
| OPTION_MASK_CMPB \
10914
+ | OPTION_MASK_CRYPTO \
10915
| OPTION_MASK_DFP \
10916
+ | OPTION_MASK_DIRECT_MOVE \
10917
| OPTION_MASK_DLMZB \
10918
| OPTION_MASK_FPRND \
10919
+ | OPTION_MASK_HTM \
10920
| OPTION_MASK_ISEL \
10921
| OPTION_MASK_MFCRF \
10922
| OPTION_MASK_MFPGPR \
10923
| OPTION_MASK_MULHW \
10924
| OPTION_MASK_NO_UPDATE \
10925
+ | OPTION_MASK_P8_FUSION \
10926
+ | OPTION_MASK_P8_VECTOR \
10927
| OPTION_MASK_POPCNTB \
10928
| OPTION_MASK_POPCNTD \
10929
| OPTION_MASK_POWERPC64 \
10930
| OPTION_MASK_PPC_GFXOPT \
10931
| OPTION_MASK_PPC_GPOPT \
10932
+ | OPTION_MASK_QUAD_MEMORY \
10933
| OPTION_MASK_RECIP_PRECISION \
10934
| OPTION_MASK_SOFT_FLOAT \
10935
| OPTION_MASK_STRICT_ALIGN_OPTIONAL \
10936
- | OPTION_MASK_VSX)
10937
+ | OPTION_MASK_VSX \
10938
+ | OPTION_MASK_VSX_TIMODE)
10942
@@ -166,10 +184,7 @@
10943
POWERPC_7400_MASK | MASK_POWERPC64 | MASK_PPC_GPOPT | MASK_MFCRF
10944
| MASK_POPCNTB | MASK_FPRND | MASK_CMPB | MASK_DFP | MASK_POPCNTD
10945
| MASK_VSX | MASK_RECIP_PRECISION)
10946
-RS6000_CPU ("power8", PROCESSOR_POWER7, /* Don't add MASK_ISEL by default */
10947
- POWERPC_7400_MASK | MASK_POWERPC64 | MASK_PPC_GPOPT | MASK_MFCRF
10948
- | MASK_POPCNTB | MASK_FPRND | MASK_CMPB | MASK_DFP | MASK_POPCNTD
10949
- | MASK_VSX | MASK_RECIP_PRECISION)
10950
+RS6000_CPU ("power8", PROCESSOR_POWER8, MASK_POWERPC64 | ISA_2_7_MASKS_SERVER)
10951
RS6000_CPU ("powerpc", PROCESSOR_POWERPC, 0)
10952
RS6000_CPU ("powerpc64", PROCESSOR_POWERPC64, MASK_PPC_GFXOPT | MASK_POWERPC64)
10953
RS6000_CPU ("rs64", PROCESSOR_RS64A, MASK_PPC_GFXOPT | MASK_POWERPC64)
10954
--- a/src/gcc/config/rs6000/htmintrin.h
10955
+++ b/src/gcc/config/rs6000/htmintrin.h
10957
+/* Hardware Transactional Memory (HTM) intrinsics.
10958
+ Copyright (C) 2013 Free Software Foundation, Inc.
10959
+ Contributed by Peter Bergner <bergner@vnet.ibm.com>.
10961
+ This file is free software; you can redistribute it and/or modify it under
10962
+ the terms of the GNU General Public License as published by the Free
10963
+ Software Foundation; either version 3 of the License, or (at your option)
10964
+ any later version.
10966
+ This file is distributed in the hope that it will be useful, but WITHOUT
10967
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
10968
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
10969
+ for more details.
10971
+ Under Section 7 of GPL version 3, you are granted additional
10972
+ permissions described in the GCC Runtime Library Exception, version
10973
+ 3.1, as published by the Free Software Foundation.
10975
+ You should have received a copy of the GNU General Public License and
10976
+ a copy of the GCC Runtime Library Exception along with this program;
10977
+ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
10978
+ <http://www.gnu.org/licenses/>. */
10981
+# error "HTM instruction set not enabled"
10982
+#endif /* __HTM__ */
10984
+#ifndef _HTMINTRIN_H
10985
+#define _HTMINTRIN_H
10987
+#include <stdint.h>
10989
+typedef uint64_t texasr_t;
10990
+typedef uint32_t texasru_t;
10991
+typedef uint32_t texasrl_t;
10992
+typedef uintptr_t tfiar_t;
10993
+typedef uintptr_t tfhar_t;
10995
+#define _HTM_STATE(CR0) ((CR0 >> 1) & 0x3)
10996
+#define _HTM_NONTRANSACTIONAL 0x0
10997
+#define _HTM_SUSPENDED 0x1
10998
+#define _HTM_TRANSACTIONAL 0x2
11000
+/* The following macros use the IBM bit numbering for BITNUM
11001
+ as used in the ISA documentation. */
11003
+#define _TEXASR_EXTRACT_BITS(TEXASR,BITNUM,SIZE) \
11004
+ (((TEXASR) >> (63-(BITNUM))) & ((1<<(SIZE))-1))
11005
+#define _TEXASRU_EXTRACT_BITS(TEXASR,BITNUM,SIZE) \
11006
+ (((TEXASR) >> (31-(BITNUM))) & ((1<<(SIZE))-1))
11008
+#define _TEXASR_FAILURE_CODE(TEXASR) \
11009
+ _TEXASR_EXTRACT_BITS(TEXASR, 7, 8)
11010
+#define _TEXASRU_FAILURE_CODE(TEXASRU) \
11011
+ _TEXASRU_EXTRACT_BITS(TEXASRU, 7, 8)
11013
+#define _TEXASR_FAILURE_PERSISTENT(TEXASR) \
11014
+ _TEXASR_EXTRACT_BITS(TEXASR, 7, 1)
11015
+#define _TEXASRU_FAILURE_PERSISTENT(TEXASRU) \
11016
+ _TEXASRU_EXTRACT_BITS(TEXASRU, 7, 1)
11018
+#define _TEXASR_DISALLOWED(TEXASR) \
11019
+ _TEXASR_EXTRACT_BITS(TEXASR, 8, 1)
11020
+#define _TEXASRU_DISALLOWED(TEXASRU) \
11021
+ _TEXASRU_EXTRACT_BITS(TEXASRU, 8, 1)
11023
+#define _TEXASR_NESTING_OVERFLOW(TEXASR) \
11024
+ _TEXASR_EXTRACT_BITS(TEXASR, 9, 1)
11025
+#define _TEXASRU_NESTING_OVERFLOW(TEXASRU) \
11026
+ _TEXASRU_EXTRACT_BITS(TEXASRU, 9, 1)
11028
+#define _TEXASR_FOOTPRINT_OVERFLOW(TEXASR) \
11029
+ _TEXASR_EXTRACT_BITS(TEXASR, 10, 1)
11030
+#define _TEXASRU_FOOTPRINT_OVERFLOW(TEXASRU) \
11031
+ _TEXASRU_EXTRACT_BITS(TEXASRU, 10, 1)
11033
+#define _TEXASR_SELF_INDUCED_CONFLICT(TEXASR) \
11034
+ _TEXASR_EXTRACT_BITS(TEXASR, 11, 1)
11035
+#define _TEXASRU_SELF_INDUCED_CONFLICT(TEXASRU) \
11036
+ _TEXASRU_EXTRACT_BITS(TEXASRU, 11, 1)
11038
+#define _TEXASR_NON_TRANSACTIONAL_CONFLICT(TEXASR) \
11039
+ _TEXASR_EXTRACT_BITS(TEXASR, 12, 1)
11040
+#define _TEXASRU_NON_TRANSACTIONAL_CONFLICT(TEXASRU) \
11041
+ _TEXASRU_EXTRACT_BITS(TEXASRU, 12, 1)
11043
+#define _TEXASR_TRANSACTION_CONFLICT(TEXASR) \
11044
+ _TEXASR_EXTRACT_BITS(TEXASR, 13, 1)
11045
+#define _TEXASRU_TRANSACTION_CONFLICT(TEXASRU) \
11046
+ _TEXASRU_EXTRACT_BITS(TEXASRU, 13, 1)
11048
+#define _TEXASR_TRANSLATION_INVALIDATION_CONFLICT(TEXASR) \
11049
+ _TEXASR_EXTRACT_BITS(TEXASR, 14, 1)
11050
+#define _TEXASRU_TRANSLATION_INVALIDATION_CONFLICT(TEXASRU) \
11051
+ _TEXASRU_EXTRACT_BITS(TEXASRU, 14, 1)
11053
+#define _TEXASR_IMPLEMENTAION_SPECIFIC(TEXASR) \
11054
+ _TEXASR_EXTRACT_BITS(TEXASR, 15, 1)
11055
+#define _TEXASRU_IMPLEMENTAION_SPECIFIC(TEXASRU) \
11056
+ _TEXASRU_EXTRACT_BITS(TEXASRU, 15, 1)
11058
+#define _TEXASR_INSTRUCTION_FETCH_CONFLICT(TEXASR) \
11059
+ _TEXASR_EXTRACT_BITS(TEXASR, 16, 1)
11060
+#define _TEXASRU_INSTRUCTION_FETCH_CONFLICT(TEXASRU) \
11061
+ _TEXASRU_EXTRACT_BITS(TEXASRU, 16, 1)
11063
+#define _TEXASR_ABORT(TEXASR) \
11064
+ _TEXASR_EXTRACT_BITS(TEXASR, 31, 1)
11065
+#define _TEXASRU_ABORT(TEXASRU) \
11066
+ _TEXASRU_EXTRACT_BITS(TEXASRU, 31, 1)
11069
+#define _TEXASR_SUSPENDED(TEXASR) \
11070
+ _TEXASR_EXTRACT_BITS(TEXASR, 32, 1)
11072
+#define _TEXASR_PRIVILEGE(TEXASR) \
11073
+ _TEXASR_EXTRACT_BITS(TEXASR, 35, 2)
11075
+#define _TEXASR_FAILURE_SUMMARY(TEXASR) \
11076
+ _TEXASR_EXTRACT_BITS(TEXASR, 36, 1)
11078
+#define _TEXASR_TFIAR_EXACT(TEXASR) \
11079
+ _TEXASR_EXTRACT_BITS(TEXASR, 37, 1)
11081
+#define _TEXASR_ROT(TEXASR) \
11082
+ _TEXASR_EXTRACT_BITS(TEXASR, 38, 1)
11084
+#define _TEXASR_TRANSACTION_LEVEL(TEXASR) \
11085
+ _TEXASR_EXTRACT_BITS(TEXASR, 63, 12)
11087
+#endif /* _HTMINTRIN_H */
11088
--- a/src/gcc/config/rs6000/rs6000-protos.h
11089
+++ b/src/gcc/config/rs6000/rs6000-protos.h
11090
@@ -50,11 +50,13 @@
11091
extern rtx find_addr_reg (rtx);
11092
extern rtx gen_easy_altivec_constant (rtx);
11093
extern const char *output_vec_const_move (rtx *);
11094
+extern const char *rs6000_output_move_128bit (rtx *);
11095
extern void rs6000_expand_vector_init (rtx, rtx);
11096
extern void paired_expand_vector_init (rtx, rtx);
11097
extern void rs6000_expand_vector_set (rtx, rtx, int);
11098
extern void rs6000_expand_vector_extract (rtx, rtx, int);
11099
extern bool altivec_expand_vec_perm_const (rtx op[4]);
11100
+extern void altivec_expand_vec_perm_le (rtx op[4]);
11101
extern bool rs6000_expand_vec_perm_const (rtx op[4]);
11102
extern void rs6000_expand_extract_even (rtx, rtx, rtx);
11103
extern void rs6000_expand_interleave (rtx, rtx, rtx, bool);
11105
extern int registers_ok_for_quad_peep (rtx, rtx);
11106
extern int mems_ok_for_quad_peep (rtx, rtx);
11107
extern bool gpr_or_gpr_p (rtx, rtx);
11108
+extern bool direct_move_p (rtx, rtx);
11109
+extern bool quad_load_store_p (rtx, rtx);
11110
+extern bool fusion_gpr_load_p (rtx *, bool);
11111
+extern void expand_fusion_gpr_load (rtx *);
11112
+extern const char *emit_fusion_gpr_load (rtx *);
11113
extern enum reg_class (*rs6000_preferred_reload_class_ptr) (rtx,
11115
extern enum reg_class (*rs6000_secondary_reload_class_ptr) (enum reg_class,
11116
@@ -116,6 +123,7 @@
11117
extern void rs6000_fatal_bad_address (rtx);
11118
extern rtx create_TOC_reference (rtx, rtx);
11119
extern void rs6000_split_multireg_move (rtx, rtx);
11120
+extern void rs6000_emit_le_vsx_move (rtx, rtx, enum machine_mode);
11121
extern void rs6000_emit_move (rtx, rtx, enum machine_mode);
11122
extern rtx rs6000_secondary_memory_needed_rtx (enum machine_mode);
11123
extern rtx (*rs6000_legitimize_reload_address_ptr) (rtx, enum machine_mode,
11124
@@ -135,6 +143,7 @@
11125
extern rtx rs6000_address_for_altivec (rtx);
11126
extern rtx rs6000_allocate_stack_temp (enum machine_mode, bool, bool);
11127
extern int rs6000_loop_align (rtx);
11128
+extern void rs6000_split_logical (rtx [], enum rtx_code, bool, bool, bool, rtx);
11129
#endif /* RTX_CODE */
11132
@@ -146,6 +155,7 @@
11133
extern rtx rs6000_libcall_value (enum machine_mode);
11134
extern rtx rs6000_va_arg (tree, tree);
11135
extern int function_ok_for_sibcall (tree);
11136
+extern int rs6000_reg_parm_stack_space (tree);
11137
extern void rs6000_elf_declare_function_name (FILE *, const char *, tree);
11138
extern bool rs6000_elf_in_small_data_p (const_tree);
11139
#ifdef ARGS_SIZE_RTX
11140
@@ -170,7 +180,8 @@
11141
extern void rs6000_emit_epilogue (int);
11142
extern void rs6000_emit_eh_reg_restore (rtx, rtx);
11143
extern const char * output_isel (rtx *);
11144
-extern void rs6000_call_indirect_aix (rtx, rtx, rtx);
11145
+extern void rs6000_call_aix (rtx, rtx, rtx, rtx);
11146
+extern void rs6000_sibcall_aix (rtx, rtx, rtx, rtx);
11147
extern void rs6000_aix_asm_output_dwarf_table_ref (char *);
11148
extern void get_ppc476_thunk_name (char name[32]);
11149
extern bool rs6000_overloaded_builtin_p (enum rs6000_builtins);
11150
--- a/src/gcc/config/rs6000/t-rs6000
11151
+++ b/src/gcc/config/rs6000/t-rs6000
11153
$(srcdir)/config/rs6000/power5.md \
11154
$(srcdir)/config/rs6000/power6.md \
11155
$(srcdir)/config/rs6000/power7.md \
11156
+ $(srcdir)/config/rs6000/power8.md \
11157
$(srcdir)/config/rs6000/cell.md \
11158
$(srcdir)/config/rs6000/xfpu.md \
11159
$(srcdir)/config/rs6000/a2.md \
11161
$(srcdir)/config/rs6000/vector.md \
11162
$(srcdir)/config/rs6000/vsx.md \
11163
$(srcdir)/config/rs6000/altivec.md \
11164
+ $(srcdir)/config/rs6000/crypto.md \
11165
+ $(srcdir)/config/rs6000/htm.md \
11166
$(srcdir)/config/rs6000/spe.md \
11167
$(srcdir)/config/rs6000/dfp.md \
11168
$(srcdir)/config/rs6000/paired.md
11169
--- a/src/gcc/config/rs6000/htmxlintrin.h
11170
+++ b/src/gcc/config/rs6000/htmxlintrin.h
11172
+/* XL compiler Hardware Transactional Memory (HTM) execution intrinsics.
11173
+ Copyright (C) 2013 Free Software Foundation, Inc.
11174
+ Contributed by Peter Bergner <bergner@vnet.ibm.com>.
11176
+ This file is free software; you can redistribute it and/or modify it under
11177
+ the terms of the GNU General Public License as published by the Free
11178
+ Software Foundation; either version 3 of the License, or (at your option)
11179
+ any later version.
11181
+ This file is distributed in the hope that it will be useful, but WITHOUT
11182
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11183
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
11184
+ for more details.
11186
+ Under Section 7 of GPL version 3, you are granted additional
11187
+ permissions described in the GCC Runtime Library Exception, version
11188
+ 3.1, as published by the Free Software Foundation.
11190
+ You should have received a copy of the GNU General Public License and
11191
+ a copy of the GCC Runtime Library Exception along with this program;
11192
+ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
11193
+ <http://www.gnu.org/licenses/>. */
11196
+# error "HTM instruction set not enabled"
11197
+#endif /* __HTM__ */
11199
+#ifndef _HTMXLINTRIN_H
11200
+#define _HTMXLINTRIN_H
11202
+#include <stdint.h>
11203
+#include <htmintrin.h>
11205
+#ifdef __cplusplus
11209
+#define _TEXASR_PTR(TM_BUF) \
11210
+ ((texasr_t *)((TM_BUF)+0))
11211
+#define _TEXASRU_PTR(TM_BUF) \
11212
+ ((texasru_t *)((TM_BUF)+0))
11213
+#define _TEXASRL_PTR(TM_BUF) \
11214
+ ((texasrl_t *)((TM_BUF)+4))
11215
+#define _TFIAR_PTR(TM_BUF) \
11216
+ ((tfiar_t *)((TM_BUF)+8))
11218
+typedef char TM_buff_type[16];
11220
+extern __inline long
11221
+__attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
11222
+__TM_simple_begin (void)
11224
+ if (__builtin_expect (__builtin_tbegin (0), 1))
11229
+extern __inline long
11230
+__attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
11231
+__TM_begin (void* const TM_buff)
11233
+ *_TEXASRL_PTR (TM_buff) = 0;
11234
+ if (__builtin_expect (__builtin_tbegin (0), 1))
11236
+#ifdef __powerpc64__
11237
+ *_TEXASR_PTR (TM_buff) = __builtin_get_texasr ();
11239
+ *_TEXASRU_PTR (TM_buff) = __builtin_get_texasru ();
11240
+ *_TEXASRL_PTR (TM_buff) = __builtin_get_texasr ();
11242
+ *_TFIAR_PTR (TM_buff) = __builtin_get_tfiar ();
11246
+extern __inline long
11247
+__attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
11250
+ if (__builtin_expect (__builtin_tend (0), 1))
11255
+extern __inline void
11256
+__attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
11259
+ __builtin_tabort (0);
11262
+extern __inline void
11263
+__attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
11264
+__TM_named_abort (unsigned char const code)
11266
+ __builtin_tabort (code);
11269
+extern __inline void
11270
+__attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
11271
+__TM_resume (void)
11273
+ __builtin_tresume ();
11276
+extern __inline void
11277
+__attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
11278
+__TM_suspend (void)
11280
+ __builtin_tsuspend ();
11283
+extern __inline long
11284
+__attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
11285
+__TM_is_user_abort (void* const TM_buff)
11287
+ texasru_t texasru = *_TEXASRU_PTR (TM_buff);
11288
+ return _TEXASRU_ABORT (texasru);
11291
+extern __inline long
11292
+__attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
11293
+__TM_is_named_user_abort (void* const TM_buff, unsigned char *code)
11295
+ texasru_t texasru = *_TEXASRU_PTR (TM_buff);
11297
+ *code = _TEXASRU_FAILURE_CODE (texasru);
11298
+ return _TEXASRU_ABORT (texasru);
11301
+extern __inline long
11302
+__attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
11303
+__TM_is_illegal (void* const TM_buff)
11305
+ texasru_t texasru = *_TEXASRU_PTR (TM_buff);
11306
+ return _TEXASRU_DISALLOWED (texasru);
11309
+extern __inline long
11310
+__attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
11311
+__TM_is_footprint_exceeded (void* const TM_buff)
11313
+ texasru_t texasru = *_TEXASRU_PTR (TM_buff);
11314
+ return _TEXASRU_FOOTPRINT_OVERFLOW (texasru);
11317
+extern __inline long
11318
+__attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
11319
+__TM_nesting_depth (void* const TM_buff)
11321
+ texasrl_t texasrl;
11323
+ if (_HTM_STATE (__builtin_ttest ()) == _HTM_NONTRANSACTIONAL)
11325
+ texasrl = *_TEXASRL_PTR (TM_buff);
11326
+ if (!_TEXASR_FAILURE_SUMMARY (texasrl))
11330
+ texasrl = (texasrl_t) __builtin_get_texasr ();
11332
+ return _TEXASR_TRANSACTION_LEVEL (texasrl);
11335
+extern __inline long
11336
+__attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
11337
+__TM_is_nested_too_deep(void* const TM_buff)
11339
+ texasru_t texasru = *_TEXASRU_PTR (TM_buff);
11340
+ return _TEXASRU_NESTING_OVERFLOW (texasru);
11343
+extern __inline long
11344
+__attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
11345
+__TM_is_conflict(void* const TM_buff)
11347
+ texasru_t texasru = *_TEXASRU_PTR (TM_buff);
11348
+ /* Return TEXASR bits 11 (Self-Induced Conflict) through
11349
+ 14 (Translation Invalidation Conflict). */
11350
+ return (_TEXASRU_EXTRACT_BITS (texasru, 14, 4)) ? 1 : 0;
11353
+extern __inline long
11354
+__attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
11355
+__TM_is_failure_persistent(void* const TM_buff)
11357
+ texasru_t texasru = *_TEXASRU_PTR (TM_buff);
11358
+ return _TEXASRU_FAILURE_PERSISTENT (texasru);
11361
+extern __inline long
11362
+__attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
11363
+__TM_failure_address(void* const TM_buff)
11365
+ return *_TFIAR_PTR (TM_buff);
11368
+extern __inline long long
11369
+__attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
11370
+__TM_failure_code(void* const TM_buff)
11372
+ return *_TEXASR_PTR (TM_buff);
11375
+#ifdef __cplusplus
11379
+#endif /* _HTMXLINTRIN_H */
11380
--- a/src/gcc/config/rs6000/rs6000-builtin.def
11381
+++ b/src/gcc/config/rs6000/rs6000-builtin.def
11383
RS6000_BUILTIN_A -- ABS builtins
11384
RS6000_BUILTIN_D -- DST builtins
11385
RS6000_BUILTIN_E -- SPE EVSEL builtins.
11386
- RS6000_BUILTIN_P -- Altivec and VSX predicate builtins
11387
+ RS6000_BUILTIN_H -- HTM builtins
11388
+ RS6000_BUILTIN_P -- Altivec, VSX, ISA 2.07 vector predicate builtins
11389
RS6000_BUILTIN_Q -- Paired floating point VSX predicate builtins
11390
RS6000_BUILTIN_S -- SPE predicate builtins
11391
RS6000_BUILTIN_X -- special builtins
11393
#error "RS6000_BUILTIN_E is not defined."
11396
+#ifndef RS6000_BUILTIN_H
11397
+ #error "RS6000_BUILTIN_H is not defined."
11400
#ifndef RS6000_BUILTIN_P
11401
#error "RS6000_BUILTIN_P is not defined."
11403
@@ -301,6 +306,158 @@
11404
| RS6000_BTC_SPECIAL), \
11405
CODE_FOR_nothing) /* ICODE */
11407
+/* ISA 2.07 (power8) vector convenience macros. */
11408
+/* For the instructions that are encoded as altivec instructions use
11409
+ __builtin_altivec_ as the builtin name. */
11410
+#define BU_P8V_AV_1(ENUM, NAME, ATTR, ICODE) \
11411
+ RS6000_BUILTIN_1 (P8V_BUILTIN_ ## ENUM, /* ENUM */ \
11412
+ "__builtin_altivec_" NAME, /* NAME */ \
11413
+ RS6000_BTM_P8_VECTOR, /* MASK */ \
11414
+ (RS6000_BTC_ ## ATTR /* ATTR */ \
11415
+ | RS6000_BTC_UNARY), \
11416
+ CODE_FOR_ ## ICODE) /* ICODE */
11418
+#define BU_P8V_AV_2(ENUM, NAME, ATTR, ICODE) \
11419
+ RS6000_BUILTIN_2 (P8V_BUILTIN_ ## ENUM, /* ENUM */ \
11420
+ "__builtin_altivec_" NAME, /* NAME */ \
11421
+ RS6000_BTM_P8_VECTOR, /* MASK */ \
11422
+ (RS6000_BTC_ ## ATTR /* ATTR */ \
11423
+ | RS6000_BTC_BINARY), \
11424
+ CODE_FOR_ ## ICODE) /* ICODE */
11426
+#define BU_P8V_AV_P(ENUM, NAME, ATTR, ICODE) \
11427
+ RS6000_BUILTIN_P (P8V_BUILTIN_ ## ENUM, /* ENUM */ \
11428
+ "__builtin_altivec_" NAME, /* NAME */ \
11429
+ RS6000_BTM_P8_VECTOR, /* MASK */ \
11430
+ (RS6000_BTC_ ## ATTR /* ATTR */ \
11431
+ | RS6000_BTC_PREDICATE), \
11432
+ CODE_FOR_ ## ICODE) /* ICODE */
11434
+/* For the instructions encoded as VSX instructions use __builtin_vsx as the
11436
+#define BU_P8V_VSX_1(ENUM, NAME, ATTR, ICODE) \
11437
+ RS6000_BUILTIN_1 (P8V_BUILTIN_ ## ENUM, /* ENUM */ \
11438
+ "__builtin_vsx_" NAME, /* NAME */ \
11439
+ RS6000_BTM_P8_VECTOR, /* MASK */ \
11440
+ (RS6000_BTC_ ## ATTR /* ATTR */ \
11441
+ | RS6000_BTC_UNARY), \
11442
+ CODE_FOR_ ## ICODE) /* ICODE */
11444
+#define BU_P8V_OVERLOAD_1(ENUM, NAME) \
11445
+ RS6000_BUILTIN_1 (P8V_BUILTIN_VEC_ ## ENUM, /* ENUM */ \
11446
+ "__builtin_vec_" NAME, /* NAME */ \
11447
+ RS6000_BTM_P8_VECTOR, /* MASK */ \
11448
+ (RS6000_BTC_OVERLOADED /* ATTR */ \
11449
+ | RS6000_BTC_UNARY), \
11450
+ CODE_FOR_nothing) /* ICODE */
11452
+#define BU_P8V_OVERLOAD_2(ENUM, NAME) \
11453
+ RS6000_BUILTIN_2 (P8V_BUILTIN_VEC_ ## ENUM, /* ENUM */ \
11454
+ "__builtin_vec_" NAME, /* NAME */ \
11455
+ RS6000_BTM_P8_VECTOR, /* MASK */ \
11456
+ (RS6000_BTC_OVERLOADED /* ATTR */ \
11457
+ | RS6000_BTC_BINARY), \
11458
+ CODE_FOR_nothing) /* ICODE */
11460
+/* Crypto convenience macros. */
11461
+#define BU_CRYPTO_1(ENUM, NAME, ATTR, ICODE) \
11462
+ RS6000_BUILTIN_1 (CRYPTO_BUILTIN_ ## ENUM, /* ENUM */ \
11463
+ "__builtin_crypto_" NAME, /* NAME */ \
11464
+ RS6000_BTM_CRYPTO, /* MASK */ \
11465
+ (RS6000_BTC_ ## ATTR /* ATTR */ \
11466
+ | RS6000_BTC_UNARY), \
11467
+ CODE_FOR_ ## ICODE) /* ICODE */
11469
+#define BU_CRYPTO_2(ENUM, NAME, ATTR, ICODE) \
11470
+ RS6000_BUILTIN_2 (CRYPTO_BUILTIN_ ## ENUM, /* ENUM */ \
11471
+ "__builtin_crypto_" NAME, /* NAME */ \
11472
+ RS6000_BTM_CRYPTO, /* MASK */ \
11473
+ (RS6000_BTC_ ## ATTR /* ATTR */ \
11474
+ | RS6000_BTC_BINARY), \
11475
+ CODE_FOR_ ## ICODE) /* ICODE */
11477
+#define BU_CRYPTO_3(ENUM, NAME, ATTR, ICODE) \
11478
+ RS6000_BUILTIN_3 (CRYPTO_BUILTIN_ ## ENUM, /* ENUM */ \
11479
+ "__builtin_crypto_" NAME, /* NAME */ \
11480
+ RS6000_BTM_CRYPTO, /* MASK */ \
11481
+ (RS6000_BTC_ ## ATTR /* ATTR */ \
11482
+ | RS6000_BTC_TERNARY), \
11483
+ CODE_FOR_ ## ICODE) /* ICODE */
11485
+#define BU_CRYPTO_OVERLOAD_1(ENUM, NAME) \
11486
+ RS6000_BUILTIN_1 (CRYPTO_BUILTIN_ ## ENUM, /* ENUM */ \
11487
+ "__builtin_crypto_" NAME, /* NAME */ \
11488
+ RS6000_BTM_CRYPTO, /* MASK */ \
11489
+ (RS6000_BTC_OVERLOADED /* ATTR */ \
11490
+ | RS6000_BTC_UNARY), \
11491
+ CODE_FOR_nothing) /* ICODE */
11493
+#define BU_CRYPTO_OVERLOAD_2(ENUM, NAME) \
11494
+ RS6000_BUILTIN_2 (CRYPTO_BUILTIN_ ## ENUM, /* ENUM */ \
11495
+ "__builtin_crypto_" NAME, /* NAME */ \
11496
+ RS6000_BTM_CRYPTO, /* MASK */ \
11497
+ (RS6000_BTC_OVERLOADED /* ATTR */ \
11498
+ | RS6000_BTC_BINARY), \
11499
+ CODE_FOR_nothing) /* ICODE */
11501
+#define BU_CRYPTO_OVERLOAD_3(ENUM, NAME) \
11502
+ RS6000_BUILTIN_3 (CRYPTO_BUILTIN_ ## ENUM, /* ENUM */ \
11503
+ "__builtin_crypto_" NAME, /* NAME */ \
11504
+ RS6000_BTM_CRYPTO, /* MASK */ \
11505
+ (RS6000_BTC_OVERLOADED /* ATTR */ \
11506
+ | RS6000_BTC_TERNARY), \
11507
+ CODE_FOR_nothing) /* ICODE */
11509
+/* HTM convenience macros. */
11510
+#define BU_HTM_0(ENUM, NAME, ATTR, ICODE) \
11511
+ RS6000_BUILTIN_H (HTM_BUILTIN_ ## ENUM, /* ENUM */ \
11512
+ "__builtin_" NAME, /* NAME */ \
11513
+ RS6000_BTM_HTM, /* MASK */ \
11514
+ RS6000_BTC_ ## ATTR, /* ATTR */ \
11515
+ CODE_FOR_ ## ICODE) /* ICODE */
11517
+#define BU_HTM_1(ENUM, NAME, ATTR, ICODE) \
11518
+ RS6000_BUILTIN_H (HTM_BUILTIN_ ## ENUM, /* ENUM */ \
11519
+ "__builtin_" NAME, /* NAME */ \
11520
+ RS6000_BTM_HTM, /* MASK */ \
11521
+ (RS6000_BTC_ ## ATTR /* ATTR */ \
11522
+ | RS6000_BTC_UNARY), \
11523
+ CODE_FOR_ ## ICODE) /* ICODE */
11525
+#define BU_HTM_2(ENUM, NAME, ATTR, ICODE) \
11526
+ RS6000_BUILTIN_H (HTM_BUILTIN_ ## ENUM, /* ENUM */ \
11527
+ "__builtin_" NAME, /* NAME */ \
11528
+ RS6000_BTM_HTM, /* MASK */ \
11529
+ (RS6000_BTC_ ## ATTR /* ATTR */ \
11530
+ | RS6000_BTC_BINARY), \
11531
+ CODE_FOR_ ## ICODE) /* ICODE */
11533
+#define BU_HTM_3(ENUM, NAME, ATTR, ICODE) \
11534
+ RS6000_BUILTIN_H (HTM_BUILTIN_ ## ENUM, /* ENUM */ \
11535
+ "__builtin_" NAME, /* NAME */ \
11536
+ RS6000_BTM_HTM, /* MASK */ \
11537
+ (RS6000_BTC_ ## ATTR /* ATTR */ \
11538
+ | RS6000_BTC_TERNARY), \
11539
+ CODE_FOR_ ## ICODE) /* ICODE */
11541
+#define BU_HTM_SPR0(ENUM, NAME, ATTR, ICODE) \
11542
+ RS6000_BUILTIN_H (HTM_BUILTIN_ ## ENUM, /* ENUM */ \
11543
+ "__builtin_" NAME, /* NAME */ \
11544
+ RS6000_BTM_HTM, /* MASK */ \
11545
+ (RS6000_BTC_ ## ATTR /* ATTR */ \
11546
+ | RS6000_BTC_SPR), \
11547
+ CODE_FOR_ ## ICODE) /* ICODE */
11549
+#define BU_HTM_SPR1(ENUM, NAME, ATTR, ICODE) \
11550
+ RS6000_BUILTIN_H (HTM_BUILTIN_ ## ENUM, /* ENUM */ \
11551
+ "__builtin_" NAME, /* NAME */ \
11552
+ RS6000_BTM_HTM, /* MASK */ \
11553
+ (RS6000_BTC_ ## ATTR /* ATTR */ \
11554
+ | RS6000_BTC_UNARY \
11555
+ | RS6000_BTC_SPR \
11556
+ | RS6000_BTC_VOID), \
11557
+ CODE_FOR_ ## ICODE) /* ICODE */
11559
/* SPE convenience macros. */
11560
#define BU_SPE_1(ENUM, NAME, ATTR, ICODE) \
11561
RS6000_BUILTIN_1 (SPE_BUILTIN_ ## ENUM, /* ENUM */ \
11562
@@ -1012,7 +1169,7 @@
11563
BU_VSX_1 (XVRESP, "xvresp", CONST, vsx_frev4sf2)
11565
BU_VSX_1 (XSCVDPSP, "xscvdpsp", CONST, vsx_xscvdpsp)
11566
-BU_VSX_1 (XSCVSPDP, "xscvspdp", CONST, vsx_xscvdpsp)
11567
+BU_VSX_1 (XSCVSPDP, "xscvspdp", CONST, vsx_xscvspdp)
11568
BU_VSX_1 (XVCVDPSP, "xvcvdpsp", CONST, vsx_xvcvdpsp)
11569
BU_VSX_1 (XVCVSPDP, "xvcvspdp", CONST, vsx_xvcvspdp)
11570
BU_VSX_1 (XSTSQRTDP_FE, "xstsqrtdp_fe", CONST, vsx_tsqrtdf2_fe)
11571
@@ -1052,9 +1209,9 @@
11573
BU_VSX_1 (XSRDPI, "xsrdpi", CONST, vsx_xsrdpi)
11574
BU_VSX_1 (XSRDPIC, "xsrdpic", CONST, vsx_xsrdpic)
11575
-BU_VSX_1 (XSRDPIM, "xsrdpim", CONST, vsx_floordf2)
11576
-BU_VSX_1 (XSRDPIP, "xsrdpip", CONST, vsx_ceildf2)
11577
-BU_VSX_1 (XSRDPIZ, "xsrdpiz", CONST, vsx_btruncdf2)
11578
+BU_VSX_1 (XSRDPIM, "xsrdpim", CONST, floordf2)
11579
+BU_VSX_1 (XSRDPIP, "xsrdpip", CONST, ceildf2)
11580
+BU_VSX_1 (XSRDPIZ, "xsrdpiz", CONST, btruncdf2)
11582
/* VSX predicate functions. */
11583
BU_VSX_P (XVCMPEQSP_P, "xvcmpeqsp_p", CONST, vector_eq_v4sf_p)
11584
@@ -1132,6 +1289,166 @@
11585
BU_VSX_OVERLOAD_X (LD, "ld")
11586
BU_VSX_OVERLOAD_X (ST, "st")
11588
+/* 1 argument VSX instructions added in ISA 2.07. */
11589
+BU_P8V_VSX_1 (XSCVSPDPN, "xscvspdpn", CONST, vsx_xscvspdpn)
11590
+BU_P8V_VSX_1 (XSCVDPSPN, "xscvdpspn", CONST, vsx_xscvdpspn)
11592
+/* 1 argument altivec instructions added in ISA 2.07. */
11593
+BU_P8V_AV_1 (ABS_V2DI, "abs_v2di", CONST, absv2di2)
11594
+BU_P8V_AV_1 (VUPKHSW, "vupkhsw", CONST, altivec_vupkhsw)
11595
+BU_P8V_AV_1 (VUPKLSW, "vupklsw", CONST, altivec_vupklsw)
11596
+BU_P8V_AV_1 (VCLZB, "vclzb", CONST, clzv16qi2)
11597
+BU_P8V_AV_1 (VCLZH, "vclzh", CONST, clzv8hi2)
11598
+BU_P8V_AV_1 (VCLZW, "vclzw", CONST, clzv4si2)
11599
+BU_P8V_AV_1 (VCLZD, "vclzd", CONST, clzv2di2)
11600
+BU_P8V_AV_1 (VPOPCNTB, "vpopcntb", CONST, popcountv16qi2)
11601
+BU_P8V_AV_1 (VPOPCNTH, "vpopcnth", CONST, popcountv8hi2)
11602
+BU_P8V_AV_1 (VPOPCNTW, "vpopcntw", CONST, popcountv4si2)
11603
+BU_P8V_AV_1 (VPOPCNTD, "vpopcntd", CONST, popcountv2di2)
11604
+BU_P8V_AV_1 (VGBBD, "vgbbd", CONST, p8v_vgbbd)
11606
+/* 2 argument altivec instructions added in ISA 2.07. */
11607
+BU_P8V_AV_2 (VADDUDM, "vaddudm", CONST, addv2di3)
11608
+BU_P8V_AV_2 (VMINSD, "vminsd", CONST, sminv2di3)
11609
+BU_P8V_AV_2 (VMAXSD, "vmaxsd", CONST, smaxv2di3)
11610
+BU_P8V_AV_2 (VMINUD, "vminud", CONST, uminv2di3)
11611
+BU_P8V_AV_2 (VMAXUD, "vmaxud", CONST, umaxv2di3)
11612
+BU_P8V_AV_2 (VMRGEW, "vmrgew", CONST, p8_vmrgew)
11613
+BU_P8V_AV_2 (VMRGOW, "vmrgow", CONST, p8_vmrgow)
11614
+BU_P8V_AV_2 (VPKUDUM, "vpkudum", CONST, altivec_vpkudum)
11615
+BU_P8V_AV_2 (VPKSDSS, "vpksdss", CONST, altivec_vpksdss)
11616
+BU_P8V_AV_2 (VPKUDUS, "vpkudus", CONST, altivec_vpkudus)
11617
+BU_P8V_AV_2 (VPKSDUS, "vpksdus", CONST, altivec_vpkswus)
11618
+BU_P8V_AV_2 (VRLD, "vrld", CONST, vrotlv2di3)
11619
+BU_P8V_AV_2 (VSLD, "vsld", CONST, vashlv2di3)
11620
+BU_P8V_AV_2 (VSRD, "vsrd", CONST, vlshrv2di3)
11621
+BU_P8V_AV_2 (VSRAD, "vsrad", CONST, vashrv2di3)
11622
+BU_P8V_AV_2 (VSUBUDM, "vsubudm", CONST, subv2di3)
11624
+BU_P8V_AV_2 (EQV_V16QI, "eqv_v16qi", CONST, eqvv16qi3)
11625
+BU_P8V_AV_2 (EQV_V8HI, "eqv_v8hi", CONST, eqvv8hi3)
11626
+BU_P8V_AV_2 (EQV_V4SI, "eqv_v4si", CONST, eqvv4si3)
11627
+BU_P8V_AV_2 (EQV_V2DI, "eqv_v2di", CONST, eqvv2di3)
11628
+BU_P8V_AV_2 (EQV_V4SF, "eqv_v4sf", CONST, eqvv4sf3)
11629
+BU_P8V_AV_2 (EQV_V2DF, "eqv_v2df", CONST, eqvv2df3)
11631
+BU_P8V_AV_2 (NAND_V16QI, "nand_v16qi", CONST, nandv16qi3)
11632
+BU_P8V_AV_2 (NAND_V8HI, "nand_v8hi", CONST, nandv8hi3)
11633
+BU_P8V_AV_2 (NAND_V4SI, "nand_v4si", CONST, nandv4si3)
11634
+BU_P8V_AV_2 (NAND_V2DI, "nand_v2di", CONST, nandv2di3)
11635
+BU_P8V_AV_2 (NAND_V4SF, "nand_v4sf", CONST, nandv4sf3)
11636
+BU_P8V_AV_2 (NAND_V2DF, "nand_v2df", CONST, nandv2df3)
11638
+BU_P8V_AV_2 (ORC_V16QI, "orc_v16qi", CONST, orcv16qi3)
11639
+BU_P8V_AV_2 (ORC_V8HI, "orc_v8hi", CONST, orcv8hi3)
11640
+BU_P8V_AV_2 (ORC_V4SI, "orc_v4si", CONST, orcv4si3)
11641
+BU_P8V_AV_2 (ORC_V2DI, "orc_v2di", CONST, orcv2di3)
11642
+BU_P8V_AV_2 (ORC_V4SF, "orc_v4sf", CONST, orcv4sf3)
11643
+BU_P8V_AV_2 (ORC_V2DF, "orc_v2df", CONST, orcv2df3)
11645
+/* Vector comparison instructions added in ISA 2.07. */
11646
+BU_P8V_AV_2 (VCMPEQUD, "vcmpequd", CONST, vector_eqv2di)
11647
+BU_P8V_AV_2 (VCMPGTSD, "vcmpgtsd", CONST, vector_gtv2di)
11648
+BU_P8V_AV_2 (VCMPGTUD, "vcmpgtud", CONST, vector_gtuv2di)
11650
+/* Vector comparison predicate instructions added in ISA 2.07. */
11651
+BU_P8V_AV_P (VCMPEQUD_P, "vcmpequd_p", CONST, vector_eq_v2di_p)
11652
+BU_P8V_AV_P (VCMPGTSD_P, "vcmpgtsd_p", CONST, vector_gt_v2di_p)
11653
+BU_P8V_AV_P (VCMPGTUD_P, "vcmpgtud_p", CONST, vector_gtu_v2di_p)
11655
+/* ISA 2.07 vector overloaded 1 argument functions. */
11656
+BU_P8V_OVERLOAD_1 (VUPKHSW, "vupkhsw")
11657
+BU_P8V_OVERLOAD_1 (VUPKLSW, "vupklsw")
11658
+BU_P8V_OVERLOAD_1 (VCLZ, "vclz")
11659
+BU_P8V_OVERLOAD_1 (VCLZB, "vclzb")
11660
+BU_P8V_OVERLOAD_1 (VCLZH, "vclzh")
11661
+BU_P8V_OVERLOAD_1 (VCLZW, "vclzw")
11662
+BU_P8V_OVERLOAD_1 (VCLZD, "vclzd")
11663
+BU_P8V_OVERLOAD_1 (VPOPCNT, "vpopcnt")
11664
+BU_P8V_OVERLOAD_1 (VPOPCNTB, "vpopcntb")
11665
+BU_P8V_OVERLOAD_1 (VPOPCNTH, "vpopcnth")
11666
+BU_P8V_OVERLOAD_1 (VPOPCNTW, "vpopcntw")
11667
+BU_P8V_OVERLOAD_1 (VPOPCNTD, "vpopcntd")
11668
+BU_P8V_OVERLOAD_1 (VGBBD, "vgbbd")
11670
+/* ISA 2.07 vector overloaded 2 argument functions. */
11671
+BU_P8V_OVERLOAD_2 (EQV, "eqv")
11672
+BU_P8V_OVERLOAD_2 (NAND, "nand")
11673
+BU_P8V_OVERLOAD_2 (ORC, "orc")
11674
+BU_P8V_OVERLOAD_2 (VADDUDM, "vaddudm")
11675
+BU_P8V_OVERLOAD_2 (VMAXSD, "vmaxsd")
11676
+BU_P8V_OVERLOAD_2 (VMAXUD, "vmaxud")
11677
+BU_P8V_OVERLOAD_2 (VMINSD, "vminsd")
11678
+BU_P8V_OVERLOAD_2 (VMINUD, "vminud")
11679
+BU_P8V_OVERLOAD_2 (VMRGEW, "vmrgew")
11680
+BU_P8V_OVERLOAD_2 (VMRGOW, "vmrgow")
11681
+BU_P8V_OVERLOAD_2 (VPKSDSS, "vpksdss")
11682
+BU_P8V_OVERLOAD_2 (VPKSDUS, "vpksdus")
11683
+BU_P8V_OVERLOAD_2 (VPKUDUM, "vpkudum")
11684
+BU_P8V_OVERLOAD_2 (VPKUDUS, "vpkudus")
11685
+BU_P8V_OVERLOAD_2 (VRLD, "vrld")
11686
+BU_P8V_OVERLOAD_2 (VSLD, "vsld")
11687
+BU_P8V_OVERLOAD_2 (VSRAD, "vsrad")
11688
+BU_P8V_OVERLOAD_2 (VSRD, "vsrd")
11689
+BU_P8V_OVERLOAD_2 (VSUBUDM, "vsubudm")
11692
+/* 1 argument crypto functions. */
11693
+BU_CRYPTO_1 (VSBOX, "vsbox", CONST, crypto_vsbox)
11695
+/* 2 argument crypto functions. */
11696
+BU_CRYPTO_2 (VCIPHER, "vcipher", CONST, crypto_vcipher)
11697
+BU_CRYPTO_2 (VCIPHERLAST, "vcipherlast", CONST, crypto_vcipherlast)
11698
+BU_CRYPTO_2 (VNCIPHER, "vncipher", CONST, crypto_vncipher)
11699
+BU_CRYPTO_2 (VNCIPHERLAST, "vncipherlast", CONST, crypto_vncipherlast)
11700
+BU_CRYPTO_2 (VPMSUMB, "vpmsumb", CONST, crypto_vpmsumb)
11701
+BU_CRYPTO_2 (VPMSUMH, "vpmsumh", CONST, crypto_vpmsumh)
11702
+BU_CRYPTO_2 (VPMSUMW, "vpmsumw", CONST, crypto_vpmsumw)
11703
+BU_CRYPTO_2 (VPMSUMD, "vpmsumd", CONST, crypto_vpmsumd)
11705
+/* 3 argument crypto functions. */
11706
+BU_CRYPTO_3 (VPERMXOR_V2DI, "vpermxor_v2di", CONST, crypto_vpermxor_v2di)
11707
+BU_CRYPTO_3 (VPERMXOR_V4SI, "vpermxor_v4si", CONST, crypto_vpermxor_v4si)
11708
+BU_CRYPTO_3 (VPERMXOR_V8HI, "vpermxor_v8hi", CONST, crypto_vpermxor_v8hi)
11709
+BU_CRYPTO_3 (VPERMXOR_V16QI, "vpermxor_v16qi", CONST, crypto_vpermxor_v16qi)
11710
+BU_CRYPTO_3 (VSHASIGMAW, "vshasigmaw", CONST, crypto_vshasigmaw)
11711
+BU_CRYPTO_3 (VSHASIGMAD, "vshasigmad", CONST, crypto_vshasigmad)
11713
+/* 2 argument crypto overloaded functions. */
11714
+BU_CRYPTO_OVERLOAD_2 (VPMSUM, "vpmsum")
11716
+/* 3 argument crypto overloaded functions. */
11717
+BU_CRYPTO_OVERLOAD_3 (VPERMXOR, "vpermxor")
11718
+BU_CRYPTO_OVERLOAD_3 (VSHASIGMA, "vshasigma")
11721
+/* HTM functions. */
11722
+BU_HTM_1 (TABORT, "tabort", MISC, tabort)
11723
+BU_HTM_3 (TABORTDC, "tabortdc", MISC, tabortdc)
11724
+BU_HTM_3 (TABORTDCI, "tabortdci", MISC, tabortdci)
11725
+BU_HTM_3 (TABORTWC, "tabortwc", MISC, tabortwc)
11726
+BU_HTM_3 (TABORTWCI, "tabortwci", MISC, tabortwci)
11727
+BU_HTM_1 (TBEGIN, "tbegin", MISC, tbegin)
11728
+BU_HTM_1 (TCHECK, "tcheck", MISC, tcheck)
11729
+BU_HTM_1 (TEND, "tend", MISC, tend)
11730
+BU_HTM_0 (TENDALL, "tendall", MISC, tend)
11731
+BU_HTM_0 (TRECHKPT, "trechkpt", MISC, trechkpt)
11732
+BU_HTM_1 (TRECLAIM, "treclaim", MISC, treclaim)
11733
+BU_HTM_0 (TRESUME, "tresume", MISC, tsr)
11734
+BU_HTM_0 (TSUSPEND, "tsuspend", MISC, tsr)
11735
+BU_HTM_1 (TSR, "tsr", MISC, tsr)
11736
+BU_HTM_0 (TTEST, "ttest", MISC, ttest)
11738
+BU_HTM_SPR0 (GET_TFHAR, "get_tfhar", MISC, nothing)
11739
+BU_HTM_SPR1 (SET_TFHAR, "set_tfhar", MISC, nothing)
11740
+BU_HTM_SPR0 (GET_TFIAR, "get_tfiar", MISC, nothing)
11741
+BU_HTM_SPR1 (SET_TFIAR, "set_tfiar", MISC, nothing)
11742
+BU_HTM_SPR0 (GET_TEXASR, "get_texasr", MISC, nothing)
11743
+BU_HTM_SPR1 (SET_TEXASR, "set_texasr", MISC, nothing)
11744
+BU_HTM_SPR0 (GET_TEXASRU, "get_texasru", MISC, nothing)
11745
+BU_HTM_SPR1 (SET_TEXASRU, "set_texasru", MISC, nothing)
11748
/* 3 argument paired floating point builtins. */
11749
BU_PAIRED_3 (MSUB, "msub", FP, fmsv2sf4)
11750
BU_PAIRED_3 (MADD, "madd", FP, fmav2sf4)
11751
@@ -1430,10 +1747,10 @@
11754
BU_SPECIAL_X (RS6000_BUILTIN_GET_TB, "__builtin_ppc_get_timebase",
11755
- RS6000_BTM_ALWAYS, RS6000_BTC_MISC)
11756
+ RS6000_BTM_ALWAYS, RS6000_BTC_MISC)
11758
BU_SPECIAL_X (RS6000_BUILTIN_MFTB, "__builtin_ppc_mftb",
11759
- RS6000_BTM_ALWAYS, RS6000_BTC_MISC)
11760
+ RS6000_BTM_ALWAYS, RS6000_BTC_MISC)
11762
/* Darwin CfString builtin. */
11763
BU_SPECIAL_X (RS6000_BUILTIN_CFSTRING, "__builtin_cfstring", RS6000_BTM_ALWAYS,
11764
--- a/src/gcc/config/rs6000/rs6000-c.c
11765
+++ b/src/gcc/config/rs6000/rs6000-c.c
11766
@@ -315,6 +315,8 @@
11767
rs6000_define_or_undefine_macro (define_p, "_ARCH_PWR6X");
11768
if ((flags & OPTION_MASK_POPCNTD) != 0)
11769
rs6000_define_or_undefine_macro (define_p, "_ARCH_PWR7");
11770
+ if ((flags & OPTION_MASK_DIRECT_MOVE) != 0)
11771
+ rs6000_define_or_undefine_macro (define_p, "_ARCH_PWR8");
11772
if ((flags & OPTION_MASK_SOFT_FLOAT) != 0)
11773
rs6000_define_or_undefine_macro (define_p, "_SOFT_FLOAT");
11774
if ((flags & OPTION_MASK_RECIP_PRECISION) != 0)
11775
@@ -331,6 +333,12 @@
11777
if ((flags & OPTION_MASK_VSX) != 0)
11778
rs6000_define_or_undefine_macro (define_p, "__VSX__");
11779
+ if ((flags & OPTION_MASK_HTM) != 0)
11780
+ rs6000_define_or_undefine_macro (define_p, "__HTM__");
11781
+ if ((flags & OPTION_MASK_P8_VECTOR) != 0)
11782
+ rs6000_define_or_undefine_macro (define_p, "__POWER8_VECTOR__");
11783
+ if ((flags & OPTION_MASK_CRYPTO) != 0)
11784
+ rs6000_define_or_undefine_macro (define_p, "__CRYPTO__");
11786
/* options from the builtin masks. */
11787
if ((bu_mask & RS6000_BTM_SPE) != 0)
11788
@@ -453,7 +461,11 @@
11790
builtin_define ("_CALL_AIXDESC");
11791
builtin_define ("_CALL_AIX");
11792
+ builtin_define ("_CALL_ELF=1");
11795
+ builtin_define ("_CALL_ELF=2");
11798
builtin_define ("_CALL_DARWIN");
11800
@@ -465,6 +477,13 @@
11801
if (TARGET_SOFT_FLOAT || !TARGET_FPRS)
11802
builtin_define ("__NO_FPRS__");
11804
+ /* Whether aggregates passed by value are aligned to a 16 byte boundary
11805
+ if their alignment is 16 bytes or larger. */
11806
+ if ((TARGET_MACHO && rs6000_darwin64_abi)
11807
+ || DEFAULT_ABI == ABI_ELFv2
11808
+ || (DEFAULT_ABI == ABI_AIX && !rs6000_compat_align_parm))
11809
+ builtin_define ("__STRUCT_PARM_ALIGN__=16");
11811
/* Generate defines for Xilinx FPU. */
11812
if (rs6000_xilinx_fpu)
11814
@@ -505,6 +524,8 @@
11815
RS6000_BTI_V8HI, RS6000_BTI_V8HI, 0, 0 },
11816
{ ALTIVEC_BUILTIN_VEC_ABS, ALTIVEC_BUILTIN_ABS_V4SI,
11817
RS6000_BTI_V4SI, RS6000_BTI_V4SI, 0, 0 },
11818
+ { ALTIVEC_BUILTIN_VEC_ABS, P8V_BUILTIN_ABS_V2DI,
11819
+ RS6000_BTI_V2DI, RS6000_BTI_V2DI, 0, 0 },
11820
{ ALTIVEC_BUILTIN_VEC_ABS, ALTIVEC_BUILTIN_ABS_V4SF,
11821
RS6000_BTI_V4SF, RS6000_BTI_V4SF, 0, 0 },
11822
{ ALTIVEC_BUILTIN_VEC_ABS, VSX_BUILTIN_XVABSDP,
11823
@@ -577,12 +598,24 @@
11824
RS6000_BTI_V4SI, RS6000_BTI_V8HI, 0, 0 },
11825
{ ALTIVEC_BUILTIN_VEC_UNPACKH, ALTIVEC_BUILTIN_VUPKHSH,
11826
RS6000_BTI_bool_V4SI, RS6000_BTI_bool_V8HI, 0, 0 },
11827
+ { ALTIVEC_BUILTIN_VEC_UNPACKH, P8V_BUILTIN_VUPKHSW,
11828
+ RS6000_BTI_V2DI, RS6000_BTI_V4SI, 0, 0 },
11829
+ { ALTIVEC_BUILTIN_VEC_UNPACKH, P8V_BUILTIN_VUPKHSW,
11830
+ RS6000_BTI_bool_V2DI, RS6000_BTI_bool_V4SI, 0, 0 },
11831
{ ALTIVEC_BUILTIN_VEC_UNPACKH, ALTIVEC_BUILTIN_VUPKHPX,
11832
RS6000_BTI_unsigned_V4SI, RS6000_BTI_pixel_V8HI, 0, 0 },
11833
{ ALTIVEC_BUILTIN_VEC_VUPKHSH, ALTIVEC_BUILTIN_VUPKHSH,
11834
RS6000_BTI_V4SI, RS6000_BTI_V8HI, 0, 0 },
11835
{ ALTIVEC_BUILTIN_VEC_VUPKHSH, ALTIVEC_BUILTIN_VUPKHSH,
11836
RS6000_BTI_bool_V4SI, RS6000_BTI_bool_V8HI, 0, 0 },
11837
+ { ALTIVEC_BUILTIN_VEC_UNPACKH, P8V_BUILTIN_VUPKHSW,
11838
+ RS6000_BTI_V2DI, RS6000_BTI_V4SI, 0, 0 },
11839
+ { ALTIVEC_BUILTIN_VEC_UNPACKH, P8V_BUILTIN_VUPKHSW,
11840
+ RS6000_BTI_bool_V2DI, RS6000_BTI_bool_V4SI, 0, 0 },
11841
+ { ALTIVEC_BUILTIN_VEC_VUPKHSH, P8V_BUILTIN_VUPKHSW,
11842
+ RS6000_BTI_V2DI, RS6000_BTI_V4SI, 0, 0 },
11843
+ { ALTIVEC_BUILTIN_VEC_VUPKHSH, P8V_BUILTIN_VUPKHSW,
11844
+ RS6000_BTI_bool_V2DI, RS6000_BTI_bool_V4SI, 0, 0 },
11845
{ ALTIVEC_BUILTIN_VEC_VUPKHPX, ALTIVEC_BUILTIN_VUPKHPX,
11846
RS6000_BTI_unsigned_V4SI, RS6000_BTI_unsigned_V8HI, 0, 0 },
11847
{ ALTIVEC_BUILTIN_VEC_VUPKHPX, ALTIVEC_BUILTIN_VUPKHPX,
11848
@@ -601,6 +634,10 @@
11849
RS6000_BTI_V4SI, RS6000_BTI_V8HI, 0, 0 },
11850
{ ALTIVEC_BUILTIN_VEC_UNPACKL, ALTIVEC_BUILTIN_VUPKLSH,
11851
RS6000_BTI_bool_V4SI, RS6000_BTI_bool_V8HI, 0, 0 },
11852
+ { ALTIVEC_BUILTIN_VEC_UNPACKL, P8V_BUILTIN_VUPKLSW,
11853
+ RS6000_BTI_V2DI, RS6000_BTI_V4SI, 0, 0 },
11854
+ { ALTIVEC_BUILTIN_VEC_UNPACKL, P8V_BUILTIN_VUPKLSW,
11855
+ RS6000_BTI_bool_V2DI, RS6000_BTI_bool_V4SI, 0, 0 },
11856
{ ALTIVEC_BUILTIN_VEC_VUPKLPX, ALTIVEC_BUILTIN_VUPKLPX,
11857
RS6000_BTI_unsigned_V4SI, RS6000_BTI_unsigned_V8HI, 0, 0 },
11858
{ ALTIVEC_BUILTIN_VEC_VUPKLPX, ALTIVEC_BUILTIN_VUPKLPX,
11859
@@ -651,6 +688,18 @@
11860
RS6000_BTI_unsigned_V4SI, RS6000_BTI_unsigned_V4SI, RS6000_BTI_bool_V4SI, 0 },
11861
{ ALTIVEC_BUILTIN_VEC_ADD, ALTIVEC_BUILTIN_VADDUWM,
11862
RS6000_BTI_unsigned_V4SI, RS6000_BTI_unsigned_V4SI, RS6000_BTI_unsigned_V4SI, 0 },
11863
+ { ALTIVEC_BUILTIN_VEC_ADD, P8V_BUILTIN_VADDUDM,
11864
+ RS6000_BTI_V2DI, RS6000_BTI_bool_V2DI, RS6000_BTI_V2DI, 0 },
11865
+ { ALTIVEC_BUILTIN_VEC_ADD, P8V_BUILTIN_VADDUDM,
11866
+ RS6000_BTI_V2DI, RS6000_BTI_V2DI, RS6000_BTI_bool_V2DI, 0 },
11867
+ { ALTIVEC_BUILTIN_VEC_ADD, P8V_BUILTIN_VADDUDM,
11868
+ RS6000_BTI_V2DI, RS6000_BTI_V2DI, RS6000_BTI_V2DI, 0 },
11869
+ { ALTIVEC_BUILTIN_VEC_ADD, P8V_BUILTIN_VADDUDM,
11870
+ RS6000_BTI_unsigned_V2DI, RS6000_BTI_bool_V2DI, RS6000_BTI_unsigned_V2DI, 0 },
11871
+ { ALTIVEC_BUILTIN_VEC_ADD, P8V_BUILTIN_VADDUDM,
11872
+ RS6000_BTI_unsigned_V2DI, RS6000_BTI_unsigned_V2DI, RS6000_BTI_bool_V2DI, 0 },
11873
+ { ALTIVEC_BUILTIN_VEC_ADD, P8V_BUILTIN_VADDUDM,
11874
+ RS6000_BTI_unsigned_V2DI, RS6000_BTI_unsigned_V2DI, RS6000_BTI_unsigned_V2DI, 0 },
11875
{ ALTIVEC_BUILTIN_VEC_ADD, ALTIVEC_BUILTIN_VADDFP,
11876
RS6000_BTI_V4SF, RS6000_BTI_V4SF, RS6000_BTI_V4SF, 0 },
11877
{ ALTIVEC_BUILTIN_VEC_ADD, VSX_BUILTIN_XVADDDP,
11878
@@ -937,6 +986,10 @@
11879
RS6000_BTI_bool_V4SI, RS6000_BTI_V4SI, RS6000_BTI_V4SI, 0 },
11880
{ ALTIVEC_BUILTIN_VEC_CMPEQ, ALTIVEC_BUILTIN_VCMPEQUW,
11881
RS6000_BTI_bool_V4SI, RS6000_BTI_unsigned_V4SI, RS6000_BTI_unsigned_V4SI, 0 },
11882
+ { ALTIVEC_BUILTIN_VEC_CMPEQ, P8V_BUILTIN_VCMPEQUD,
11883
+ RS6000_BTI_bool_V2DI, RS6000_BTI_V2DI, RS6000_BTI_V2DI, 0 },
11884
+ { ALTIVEC_BUILTIN_VEC_CMPEQ, P8V_BUILTIN_VCMPEQUD,
11885
+ RS6000_BTI_bool_V2DI, RS6000_BTI_unsigned_V2DI, RS6000_BTI_unsigned_V2DI, 0 },
11886
{ ALTIVEC_BUILTIN_VEC_CMPEQ, ALTIVEC_BUILTIN_VCMPEQFP,
11887
RS6000_BTI_bool_V4SI, RS6000_BTI_V4SF, RS6000_BTI_V4SF, 0 },
11888
{ ALTIVEC_BUILTIN_VEC_CMPEQ, VSX_BUILTIN_XVCMPEQDP,
11889
@@ -975,6 +1028,10 @@
11890
RS6000_BTI_bool_V4SI, RS6000_BTI_unsigned_V4SI, RS6000_BTI_unsigned_V4SI, 0 },
11891
{ ALTIVEC_BUILTIN_VEC_CMPGT, ALTIVEC_BUILTIN_VCMPGTSW,
11892
RS6000_BTI_bool_V4SI, RS6000_BTI_V4SI, RS6000_BTI_V4SI, 0 },
11893
+ { ALTIVEC_BUILTIN_VEC_CMPGT, P8V_BUILTIN_VCMPGTUD,
11894
+ RS6000_BTI_bool_V2DI, RS6000_BTI_unsigned_V2DI, RS6000_BTI_unsigned_V2DI, 0 },
11895
+ { ALTIVEC_BUILTIN_VEC_CMPGT, P8V_BUILTIN_VCMPGTSD,
11896
+ RS6000_BTI_bool_V2DI, RS6000_BTI_V2DI, RS6000_BTI_V2DI, 0 },
11897
{ ALTIVEC_BUILTIN_VEC_CMPGT, ALTIVEC_BUILTIN_VCMPGTFP,
11898
RS6000_BTI_bool_V4SI, RS6000_BTI_V4SF, RS6000_BTI_V4SF, 0 },
11899
{ ALTIVEC_BUILTIN_VEC_CMPGT, VSX_BUILTIN_XVCMPGTDP,
11900
@@ -1021,6 +1078,10 @@
11901
RS6000_BTI_bool_V4SI, RS6000_BTI_unsigned_V4SI, RS6000_BTI_unsigned_V4SI, 0 },
11902
{ ALTIVEC_BUILTIN_VEC_CMPLT, ALTIVEC_BUILTIN_VCMPGTSW,
11903
RS6000_BTI_bool_V4SI, RS6000_BTI_V4SI, RS6000_BTI_V4SI, 0 },
11904
+ { ALTIVEC_BUILTIN_VEC_CMPLT, P8V_BUILTIN_VCMPGTUD,
11905
+ RS6000_BTI_bool_V2DI, RS6000_BTI_unsigned_V2DI, RS6000_BTI_unsigned_V2DI, 0 },
11906
+ { ALTIVEC_BUILTIN_VEC_CMPLT, P8V_BUILTIN_VCMPGTSD,
11907
+ RS6000_BTI_bool_V2DI, RS6000_BTI_V2DI, RS6000_BTI_V2DI, 0 },
11908
{ ALTIVEC_BUILTIN_VEC_CMPLT, ALTIVEC_BUILTIN_VCMPGTFP,
11909
RS6000_BTI_bool_V4SI, RS6000_BTI_V4SF, RS6000_BTI_V4SF, 0 },
11910
{ ALTIVEC_BUILTIN_VEC_CMPLT, VSX_BUILTIN_XVCMPGTDP,
11911
@@ -1418,6 +1479,18 @@
11912
RS6000_BTI_V4SI, RS6000_BTI_V4SI, RS6000_BTI_bool_V4SI, 0 },
11913
{ ALTIVEC_BUILTIN_VEC_MAX, ALTIVEC_BUILTIN_VMAXSW,
11914
RS6000_BTI_V4SI, RS6000_BTI_V4SI, RS6000_BTI_V4SI, 0 },
11915
+ { ALTIVEC_BUILTIN_VEC_MAX, P8V_BUILTIN_VMAXUD,
11916
+ RS6000_BTI_unsigned_V2DI, RS6000_BTI_bool_V2DI, RS6000_BTI_unsigned_V2DI, 0 },
11917
+ { ALTIVEC_BUILTIN_VEC_MAX, P8V_BUILTIN_VMAXUD,
11918
+ RS6000_BTI_unsigned_V2DI, RS6000_BTI_unsigned_V2DI, RS6000_BTI_bool_V2DI, 0 },
11919
+ { ALTIVEC_BUILTIN_VEC_MAX, P8V_BUILTIN_VMAXUD,
11920
+ RS6000_BTI_unsigned_V2DI, RS6000_BTI_unsigned_V2DI, RS6000_BTI_unsigned_V2DI, 0 },
11921
+ { ALTIVEC_BUILTIN_VEC_MAX, P8V_BUILTIN_VMAXSD,
11922
+ RS6000_BTI_V2DI, RS6000_BTI_bool_V2DI, RS6000_BTI_V2DI, 0 },
11923
+ { ALTIVEC_BUILTIN_VEC_MAX, P8V_BUILTIN_VMAXSD,
11924
+ RS6000_BTI_V2DI, RS6000_BTI_V2DI, RS6000_BTI_bool_V2DI, 0 },
11925
+ { ALTIVEC_BUILTIN_VEC_MAX, P8V_BUILTIN_VMAXSD,
11926
+ RS6000_BTI_V2DI, RS6000_BTI_V2DI, RS6000_BTI_V2DI, 0 },
11927
{ ALTIVEC_BUILTIN_VEC_MAX, ALTIVEC_BUILTIN_VMAXFP,
11928
RS6000_BTI_V4SF, RS6000_BTI_V4SF, RS6000_BTI_V4SF, 0 },
11929
{ ALTIVEC_BUILTIN_VEC_MAX, VSX_BUILTIN_XVMAXDP,
11930
@@ -1604,6 +1677,18 @@
11931
RS6000_BTI_V4SI, RS6000_BTI_V4SI, RS6000_BTI_bool_V4SI, 0 },
11932
{ ALTIVEC_BUILTIN_VEC_MIN, ALTIVEC_BUILTIN_VMINSW,
11933
RS6000_BTI_V4SI, RS6000_BTI_V4SI, RS6000_BTI_V4SI, 0 },
11934
+ { ALTIVEC_BUILTIN_VEC_MIN, P8V_BUILTIN_VMINUD,
11935
+ RS6000_BTI_unsigned_V2DI, RS6000_BTI_bool_V2DI, RS6000_BTI_unsigned_V2DI, 0 },
11936
+ { ALTIVEC_BUILTIN_VEC_MIN, P8V_BUILTIN_VMINUD,
11937
+ RS6000_BTI_unsigned_V2DI, RS6000_BTI_unsigned_V2DI, RS6000_BTI_bool_V2DI, 0 },
11938
+ { ALTIVEC_BUILTIN_VEC_MIN, P8V_BUILTIN_VMINUD,
11939
+ RS6000_BTI_unsigned_V2DI, RS6000_BTI_unsigned_V2DI, RS6000_BTI_unsigned_V2DI, 0 },
11940
+ { ALTIVEC_BUILTIN_VEC_MIN, P8V_BUILTIN_VMINSD,
11941
+ RS6000_BTI_V2DI, RS6000_BTI_bool_V2DI, RS6000_BTI_V2DI, 0 },
11942
+ { ALTIVEC_BUILTIN_VEC_MIN, P8V_BUILTIN_VMINSD,
11943
+ RS6000_BTI_V2DI, RS6000_BTI_V2DI, RS6000_BTI_bool_V2DI, 0 },
11944
+ { ALTIVEC_BUILTIN_VEC_MIN, P8V_BUILTIN_VMINSD,
11945
+ RS6000_BTI_V2DI, RS6000_BTI_V2DI, RS6000_BTI_V2DI, 0 },
11946
{ ALTIVEC_BUILTIN_VEC_MIN, ALTIVEC_BUILTIN_VMINFP,
11947
RS6000_BTI_V4SF, RS6000_BTI_V4SF, RS6000_BTI_V4SF, 0 },
11948
{ ALTIVEC_BUILTIN_VEC_MIN, VSX_BUILTIN_XVMINDP,
11949
@@ -1786,6 +1871,12 @@
11950
RS6000_BTI_unsigned_V8HI, RS6000_BTI_unsigned_V4SI, RS6000_BTI_unsigned_V4SI, 0 },
11951
{ ALTIVEC_BUILTIN_VEC_PACK, ALTIVEC_BUILTIN_VPKUWUM,
11952
RS6000_BTI_bool_V8HI, RS6000_BTI_bool_V4SI, RS6000_BTI_bool_V4SI, 0 },
11953
+ { ALTIVEC_BUILTIN_VEC_PACK, P8V_BUILTIN_VPKUDUM,
11954
+ RS6000_BTI_V4SI, RS6000_BTI_V2DI, RS6000_BTI_V2DI, 0 },
11955
+ { ALTIVEC_BUILTIN_VEC_PACK, P8V_BUILTIN_VPKUDUM,
11956
+ RS6000_BTI_unsigned_V4SI, RS6000_BTI_unsigned_V2DI, RS6000_BTI_unsigned_V2DI, 0 },
11957
+ { ALTIVEC_BUILTIN_VEC_PACK, P8V_BUILTIN_VPKUDUM,
11958
+ RS6000_BTI_bool_V4SI, RS6000_BTI_bool_V2DI, RS6000_BTI_bool_V2DI, 0 },
11959
{ ALTIVEC_BUILTIN_VEC_VPKUWUM, ALTIVEC_BUILTIN_VPKUWUM,
11960
RS6000_BTI_V8HI, RS6000_BTI_V4SI, RS6000_BTI_V4SI, 0 },
11961
{ ALTIVEC_BUILTIN_VEC_VPKUWUM, ALTIVEC_BUILTIN_VPKUWUM,
11962
@@ -1812,6 +1903,10 @@
11963
RS6000_BTI_V8HI, RS6000_BTI_V4SI, RS6000_BTI_V4SI, 0 },
11964
{ ALTIVEC_BUILTIN_VEC_VPKUWUS, ALTIVEC_BUILTIN_VPKUWUS,
11965
RS6000_BTI_unsigned_V8HI, RS6000_BTI_unsigned_V4SI, RS6000_BTI_unsigned_V4SI, 0 },
11966
+ { ALTIVEC_BUILTIN_VEC_PACKS, P8V_BUILTIN_VPKUDUS,
11967
+ RS6000_BTI_unsigned_V4SI, RS6000_BTI_unsigned_V2DI, RS6000_BTI_unsigned_V2DI, 0 },
11968
+ { ALTIVEC_BUILTIN_VEC_PACKS, P8V_BUILTIN_VPKSDSS,
11969
+ RS6000_BTI_V4SI, RS6000_BTI_V2DI, RS6000_BTI_V2DI, 0 },
11970
{ ALTIVEC_BUILTIN_VEC_VPKSHSS, ALTIVEC_BUILTIN_VPKSHSS,
11971
RS6000_BTI_V16QI, RS6000_BTI_V8HI, RS6000_BTI_V8HI, 0 },
11972
{ ALTIVEC_BUILTIN_VEC_VPKUHUS, ALTIVEC_BUILTIN_VPKUHUS,
11973
@@ -1824,6 +1919,8 @@
11974
RS6000_BTI_unsigned_V8HI, RS6000_BTI_unsigned_V4SI, RS6000_BTI_unsigned_V4SI, 0 },
11975
{ ALTIVEC_BUILTIN_VEC_PACKSU, ALTIVEC_BUILTIN_VPKSWUS,
11976
RS6000_BTI_unsigned_V8HI, RS6000_BTI_V4SI, RS6000_BTI_V4SI, 0 },
11977
+ { ALTIVEC_BUILTIN_VEC_PACKSU, P8V_BUILTIN_VPKSDUS,
11978
+ RS6000_BTI_unsigned_V4SI, RS6000_BTI_V2DI, RS6000_BTI_V2DI, 0 },
11979
{ ALTIVEC_BUILTIN_VEC_VPKSWUS, ALTIVEC_BUILTIN_VPKSWUS,
11980
RS6000_BTI_unsigned_V8HI, RS6000_BTI_V4SI, RS6000_BTI_V4SI, 0 },
11981
{ ALTIVEC_BUILTIN_VEC_VPKSHUS, ALTIVEC_BUILTIN_VPKSHUS,
11982
@@ -1844,6 +1941,10 @@
11983
RS6000_BTI_V4SI, RS6000_BTI_V4SI, RS6000_BTI_unsigned_V4SI, 0 },
11984
{ ALTIVEC_BUILTIN_VEC_RL, ALTIVEC_BUILTIN_VRLW,
11985
RS6000_BTI_unsigned_V4SI, RS6000_BTI_unsigned_V4SI, RS6000_BTI_unsigned_V4SI, 0 },
11986
+ { ALTIVEC_BUILTIN_VEC_RL, P8V_BUILTIN_VRLD,
11987
+ RS6000_BTI_V2DI, RS6000_BTI_V2DI, RS6000_BTI_unsigned_V2DI, 0 },
11988
+ { ALTIVEC_BUILTIN_VEC_RL, P8V_BUILTIN_VRLD,
11989
+ RS6000_BTI_unsigned_V2DI, RS6000_BTI_unsigned_V2DI, RS6000_BTI_unsigned_V2DI, 0 },
11990
{ ALTIVEC_BUILTIN_VEC_VRLW, ALTIVEC_BUILTIN_VRLW,
11991
RS6000_BTI_V4SI, RS6000_BTI_V4SI, RS6000_BTI_unsigned_V4SI, 0 },
11992
{ ALTIVEC_BUILTIN_VEC_VRLW, ALTIVEC_BUILTIN_VRLW,
11993
@@ -1868,6 +1969,10 @@
11994
RS6000_BTI_V4SI, RS6000_BTI_V4SI, RS6000_BTI_unsigned_V4SI, 0 },
11995
{ ALTIVEC_BUILTIN_VEC_SL, ALTIVEC_BUILTIN_VSLW,
11996
RS6000_BTI_unsigned_V4SI, RS6000_BTI_unsigned_V4SI, RS6000_BTI_unsigned_V4SI, 0 },
11997
+ { ALTIVEC_BUILTIN_VEC_SL, P8V_BUILTIN_VSLD,
11998
+ RS6000_BTI_V2DI, RS6000_BTI_V2DI, RS6000_BTI_unsigned_V2DI, 0 },
11999
+ { ALTIVEC_BUILTIN_VEC_SL, P8V_BUILTIN_VSLD,
12000
+ RS6000_BTI_unsigned_V2DI, RS6000_BTI_unsigned_V2DI, RS6000_BTI_unsigned_V2DI, 0 },
12001
{ ALTIVEC_BUILTIN_VEC_SQRT, VSX_BUILTIN_XVSQRTDP,
12002
RS6000_BTI_V2DF, RS6000_BTI_V2DF, 0, 0 },
12003
{ ALTIVEC_BUILTIN_VEC_SQRT, VSX_BUILTIN_XVSQRTSP,
12004
@@ -2032,6 +2137,10 @@
12005
RS6000_BTI_V4SI, RS6000_BTI_V4SI, RS6000_BTI_unsigned_V4SI, 0 },
12006
{ ALTIVEC_BUILTIN_VEC_SR, ALTIVEC_BUILTIN_VSRW,
12007
RS6000_BTI_unsigned_V4SI, RS6000_BTI_unsigned_V4SI, RS6000_BTI_unsigned_V4SI, 0 },
12008
+ { ALTIVEC_BUILTIN_VEC_SR, P8V_BUILTIN_VSRD,
12009
+ RS6000_BTI_V2DI, RS6000_BTI_V2DI, RS6000_BTI_unsigned_V2DI, 0 },
12010
+ { ALTIVEC_BUILTIN_VEC_SR, P8V_BUILTIN_VSRD,
12011
+ RS6000_BTI_unsigned_V2DI, RS6000_BTI_unsigned_V2DI, RS6000_BTI_unsigned_V2DI, 0 },
12012
{ ALTIVEC_BUILTIN_VEC_VSRW, ALTIVEC_BUILTIN_VSRW,
12013
RS6000_BTI_V4SI, RS6000_BTI_V4SI, RS6000_BTI_unsigned_V4SI, 0 },
12014
{ ALTIVEC_BUILTIN_VEC_VSRW, ALTIVEC_BUILTIN_VSRW,
12015
@@ -2056,6 +2165,10 @@
12016
RS6000_BTI_V4SI, RS6000_BTI_V4SI, RS6000_BTI_unsigned_V4SI, 0 },
12017
{ ALTIVEC_BUILTIN_VEC_SRA, ALTIVEC_BUILTIN_VSRAW,
12018
RS6000_BTI_unsigned_V4SI, RS6000_BTI_unsigned_V4SI, RS6000_BTI_unsigned_V4SI, 0 },
12019
+ { ALTIVEC_BUILTIN_VEC_SRA, P8V_BUILTIN_VSRAD,
12020
+ RS6000_BTI_V2DI, RS6000_BTI_V2DI, RS6000_BTI_unsigned_V2DI, 0 },
12021
+ { ALTIVEC_BUILTIN_VEC_SRA, P8V_BUILTIN_VSRD,
12022
+ RS6000_BTI_unsigned_V2DI, RS6000_BTI_unsigned_V2DI, RS6000_BTI_unsigned_V2DI, 0 },
12023
{ ALTIVEC_BUILTIN_VEC_VSRAW, ALTIVEC_BUILTIN_VSRAW,
12024
RS6000_BTI_V4SI, RS6000_BTI_V4SI, RS6000_BTI_unsigned_V4SI, 0 },
12025
{ ALTIVEC_BUILTIN_VEC_VSRAW, ALTIVEC_BUILTIN_VSRAW,
12026
@@ -2196,6 +2309,18 @@
12027
RS6000_BTI_unsigned_V4SI, RS6000_BTI_unsigned_V4SI, RS6000_BTI_bool_V4SI, 0 },
12028
{ ALTIVEC_BUILTIN_VEC_SUB, ALTIVEC_BUILTIN_VSUBUWM,
12029
RS6000_BTI_unsigned_V4SI, RS6000_BTI_unsigned_V4SI, RS6000_BTI_unsigned_V4SI, 0 },
12030
+ { ALTIVEC_BUILTIN_VEC_SUB, P8V_BUILTIN_VSUBUDM,
12031
+ RS6000_BTI_V2DI, RS6000_BTI_bool_V2DI, RS6000_BTI_V2DI, 0 },
12032
+ { ALTIVEC_BUILTIN_VEC_SUB, P8V_BUILTIN_VSUBUDM,
12033
+ RS6000_BTI_V2DI, RS6000_BTI_V2DI, RS6000_BTI_bool_V2DI, 0 },
12034
+ { ALTIVEC_BUILTIN_VEC_SUB, P8V_BUILTIN_VSUBUDM,
12035
+ RS6000_BTI_V2DI, RS6000_BTI_V2DI, RS6000_BTI_V2DI, 0 },
12036
+ { ALTIVEC_BUILTIN_VEC_SUB, P8V_BUILTIN_VSUBUDM,
12037
+ RS6000_BTI_unsigned_V2DI, RS6000_BTI_bool_V2DI, RS6000_BTI_unsigned_V2DI, 0 },
12038
+ { ALTIVEC_BUILTIN_VEC_SUB, P8V_BUILTIN_VSUBUDM,
12039
+ RS6000_BTI_unsigned_V2DI, RS6000_BTI_unsigned_V2DI, RS6000_BTI_bool_V2DI, 0 },
12040
+ { ALTIVEC_BUILTIN_VEC_SUB, P8V_BUILTIN_VSUBUDM,
12041
+ RS6000_BTI_unsigned_V2DI, RS6000_BTI_unsigned_V2DI, RS6000_BTI_unsigned_V2DI, 0 },
12042
{ ALTIVEC_BUILTIN_VEC_SUB, ALTIVEC_BUILTIN_VSUBFP,
12043
RS6000_BTI_V4SF, RS6000_BTI_V4SF, RS6000_BTI_V4SF, 0 },
12044
{ ALTIVEC_BUILTIN_VEC_SUB, VSX_BUILTIN_XVSUBDP,
12045
@@ -3327,6 +3452,20 @@
12046
RS6000_BTI_INTSI, RS6000_BTI_INTSI, RS6000_BTI_V4SI, RS6000_BTI_V4SI },
12047
{ ALTIVEC_BUILTIN_VEC_VCMPEQ_P, ALTIVEC_BUILTIN_VCMPEQUW_P,
12048
RS6000_BTI_INTSI, RS6000_BTI_INTSI, RS6000_BTI_bool_V4SI, RS6000_BTI_bool_V4SI },
12049
+ { ALTIVEC_BUILTIN_VEC_VCMPEQ_P, P8V_BUILTIN_VCMPEQUD_P,
12050
+ RS6000_BTI_INTSI, RS6000_BTI_INTSI, RS6000_BTI_bool_V2DI, RS6000_BTI_unsigned_V2DI },
12051
+ { ALTIVEC_BUILTIN_VEC_VCMPEQ_P, P8V_BUILTIN_VCMPEQUD_P,
12052
+ RS6000_BTI_INTSI, RS6000_BTI_INTSI, RS6000_BTI_unsigned_V2DI, RS6000_BTI_bool_V2DI },
12053
+ { ALTIVEC_BUILTIN_VEC_VCMPEQ_P, P8V_BUILTIN_VCMPEQUD_P,
12054
+ RS6000_BTI_INTSI, RS6000_BTI_INTSI, RS6000_BTI_unsigned_V2DI, RS6000_BTI_unsigned_V2DI },
12055
+ { ALTIVEC_BUILTIN_VEC_VCMPEQ_P, P8V_BUILTIN_VCMPEQUD_P,
12056
+ RS6000_BTI_INTSI, RS6000_BTI_INTSI, RS6000_BTI_bool_V2DI, RS6000_BTI_V2DI },
12057
+ { ALTIVEC_BUILTIN_VEC_VCMPEQ_P, P8V_BUILTIN_VCMPEQUD_P,
12058
+ RS6000_BTI_INTSI, RS6000_BTI_INTSI, RS6000_BTI_V2DI, RS6000_BTI_bool_V2DI },
12059
+ { ALTIVEC_BUILTIN_VEC_VCMPEQ_P, P8V_BUILTIN_VCMPEQUD_P,
12060
+ RS6000_BTI_INTSI, RS6000_BTI_INTSI, RS6000_BTI_V2DI, RS6000_BTI_V2DI },
12061
+ { ALTIVEC_BUILTIN_VEC_VCMPEQ_P, P8V_BUILTIN_VCMPEQUD_P,
12062
+ RS6000_BTI_INTSI, RS6000_BTI_INTSI, RS6000_BTI_bool_V2DI, RS6000_BTI_bool_V2DI },
12063
{ ALTIVEC_BUILTIN_VEC_VCMPEQ_P, ALTIVEC_BUILTIN_VCMPEQFP_P,
12064
RS6000_BTI_INTSI, RS6000_BTI_INTSI, RS6000_BTI_V4SF, RS6000_BTI_V4SF },
12065
{ ALTIVEC_BUILTIN_VEC_VCMPEQ_P, VSX_BUILTIN_XVCMPEQDP_P,
12066
@@ -3372,11 +3511,455 @@
12067
RS6000_BTI_INTSI, RS6000_BTI_INTSI, RS6000_BTI_V4SI, RS6000_BTI_bool_V4SI },
12068
{ ALTIVEC_BUILTIN_VEC_VCMPGE_P, ALTIVEC_BUILTIN_VCMPGTSW_P,
12069
RS6000_BTI_INTSI, RS6000_BTI_INTSI, RS6000_BTI_V4SI, RS6000_BTI_V4SI },
12070
+ { ALTIVEC_BUILTIN_VEC_VCMPGE_P, P8V_BUILTIN_VCMPGTUD_P,
12071
+ RS6000_BTI_INTSI, RS6000_BTI_INTSI, RS6000_BTI_bool_V2DI, RS6000_BTI_unsigned_V2DI },
12072
+ { ALTIVEC_BUILTIN_VEC_VCMPGE_P, P8V_BUILTIN_VCMPGTUD_P,
12073
+ RS6000_BTI_INTSI, RS6000_BTI_INTSI, RS6000_BTI_unsigned_V2DI, RS6000_BTI_bool_V2DI },
12074
+ { ALTIVEC_BUILTIN_VEC_VCMPGE_P, P8V_BUILTIN_VCMPGTUD_P,
12075
+ RS6000_BTI_INTSI, RS6000_BTI_INTSI, RS6000_BTI_unsigned_V2DI, RS6000_BTI_unsigned_V2DI },
12076
+ { ALTIVEC_BUILTIN_VEC_VCMPGE_P, P8V_BUILTIN_VCMPGTSD_P,
12077
+ RS6000_BTI_INTSI, RS6000_BTI_INTSI, RS6000_BTI_bool_V2DI, RS6000_BTI_V2DI },
12078
+ { ALTIVEC_BUILTIN_VEC_VCMPGE_P, P8V_BUILTIN_VCMPGTSD_P,
12079
+ RS6000_BTI_INTSI, RS6000_BTI_INTSI, RS6000_BTI_V2DI, RS6000_BTI_bool_V2DI },
12080
+ { ALTIVEC_BUILTIN_VEC_VCMPGE_P, P8V_BUILTIN_VCMPGTSD_P,
12081
+ RS6000_BTI_INTSI, RS6000_BTI_INTSI, RS6000_BTI_V2DI, RS6000_BTI_V2DI },
12082
{ ALTIVEC_BUILTIN_VEC_VCMPGE_P, ALTIVEC_BUILTIN_VCMPGEFP_P,
12083
RS6000_BTI_INTSI, RS6000_BTI_INTSI, RS6000_BTI_V4SF, RS6000_BTI_V4SF },
12084
{ ALTIVEC_BUILTIN_VEC_VCMPGE_P, VSX_BUILTIN_XVCMPGEDP_P,
12085
RS6000_BTI_INTSI, RS6000_BTI_INTSI, RS6000_BTI_V2DF, RS6000_BTI_V2DF },
12087
+ /* Power8 vector overloaded functions. */
12088
+ { P8V_BUILTIN_VEC_EQV, P8V_BUILTIN_EQV_V16QI,
12089
+ RS6000_BTI_V16QI, RS6000_BTI_bool_V16QI, RS6000_BTI_V16QI, 0 },
12090
+ { P8V_BUILTIN_VEC_EQV, P8V_BUILTIN_EQV_V16QI,
12091
+ RS6000_BTI_V16QI, RS6000_BTI_V16QI, RS6000_BTI_bool_V16QI, 0 },
12092
+ { P8V_BUILTIN_VEC_EQV, P8V_BUILTIN_EQV_V16QI,
12093
+ RS6000_BTI_V16QI, RS6000_BTI_V16QI, RS6000_BTI_V16QI, 0 },
12094
+ { P8V_BUILTIN_VEC_EQV, P8V_BUILTIN_EQV_V16QI,
12095
+ RS6000_BTI_unsigned_V16QI, RS6000_BTI_bool_V16QI,
12096
+ RS6000_BTI_unsigned_V16QI, 0 },
12097
+ { P8V_BUILTIN_VEC_EQV, P8V_BUILTIN_EQV_V16QI,
12098
+ RS6000_BTI_unsigned_V16QI, RS6000_BTI_unsigned_V16QI,
12099
+ RS6000_BTI_bool_V16QI, 0 },
12100
+ { P8V_BUILTIN_VEC_EQV, P8V_BUILTIN_EQV_V16QI,
12101
+ RS6000_BTI_unsigned_V16QI, RS6000_BTI_unsigned_V16QI,
12102
+ RS6000_BTI_unsigned_V16QI, 0 },
12103
+ { P8V_BUILTIN_VEC_EQV, P8V_BUILTIN_EQV_V8HI,
12104
+ RS6000_BTI_V8HI, RS6000_BTI_bool_V8HI, RS6000_BTI_V8HI, 0 },
12105
+ { P8V_BUILTIN_VEC_EQV, P8V_BUILTIN_EQV_V8HI,
12106
+ RS6000_BTI_V8HI, RS6000_BTI_V8HI, RS6000_BTI_bool_V8HI, 0 },
12107
+ { P8V_BUILTIN_VEC_EQV, P8V_BUILTIN_EQV_V8HI,
12108
+ RS6000_BTI_V8HI, RS6000_BTI_V8HI, RS6000_BTI_V8HI, 0 },
12109
+ { P8V_BUILTIN_VEC_EQV, P8V_BUILTIN_EQV_V8HI,
12110
+ RS6000_BTI_unsigned_V8HI, RS6000_BTI_bool_V8HI,
12111
+ RS6000_BTI_unsigned_V8HI, 0 },
12112
+ { P8V_BUILTIN_VEC_EQV, P8V_BUILTIN_EQV_V8HI,
12113
+ RS6000_BTI_unsigned_V8HI, RS6000_BTI_unsigned_V8HI,
12114
+ RS6000_BTI_bool_V8HI, 0 },
12115
+ { P8V_BUILTIN_VEC_EQV, P8V_BUILTIN_EQV_V8HI,
12116
+ RS6000_BTI_unsigned_V8HI, RS6000_BTI_unsigned_V8HI,
12117
+ RS6000_BTI_unsigned_V8HI, 0 },
12118
+ { P8V_BUILTIN_VEC_EQV, P8V_BUILTIN_EQV_V4SI,
12119
+ RS6000_BTI_V4SI, RS6000_BTI_bool_V4SI, RS6000_BTI_V4SI, 0 },
12120
+ { P8V_BUILTIN_VEC_EQV, P8V_BUILTIN_EQV_V4SI,
12121
+ RS6000_BTI_V4SI, RS6000_BTI_V4SI, RS6000_BTI_bool_V4SI, 0 },
12122
+ { P8V_BUILTIN_VEC_EQV, P8V_BUILTIN_EQV_V4SI,
12123
+ RS6000_BTI_V4SI, RS6000_BTI_V4SI, RS6000_BTI_V4SI, 0 },
12124
+ { P8V_BUILTIN_VEC_EQV, P8V_BUILTIN_EQV_V4SI,
12125
+ RS6000_BTI_unsigned_V4SI, RS6000_BTI_bool_V4SI,
12126
+ RS6000_BTI_unsigned_V4SI, 0 },
12127
+ { P8V_BUILTIN_VEC_EQV, P8V_BUILTIN_EQV_V4SI,
12128
+ RS6000_BTI_unsigned_V4SI, RS6000_BTI_unsigned_V4SI,
12129
+ RS6000_BTI_bool_V4SI, 0 },
12130
+ { P8V_BUILTIN_VEC_EQV, P8V_BUILTIN_EQV_V4SI,
12131
+ RS6000_BTI_unsigned_V4SI, RS6000_BTI_unsigned_V4SI,
12132
+ RS6000_BTI_unsigned_V4SI, 0 },
12133
+ { P8V_BUILTIN_VEC_EQV, P8V_BUILTIN_EQV_V2DI,
12134
+ RS6000_BTI_V2DI, RS6000_BTI_bool_V2DI, RS6000_BTI_V2DI, 0 },
12135
+ { P8V_BUILTIN_VEC_EQV, P8V_BUILTIN_EQV_V2DI,
12136
+ RS6000_BTI_V2DI, RS6000_BTI_V2DI, RS6000_BTI_bool_V2DI, 0 },
12137
+ { P8V_BUILTIN_VEC_EQV, P8V_BUILTIN_EQV_V2DI,
12138
+ RS6000_BTI_V2DI, RS6000_BTI_V2DI, RS6000_BTI_V2DI, 0 },
12139
+ { P8V_BUILTIN_VEC_EQV, P8V_BUILTIN_EQV_V2DI,
12140
+ RS6000_BTI_unsigned_V2DI, RS6000_BTI_bool_V2DI,
12141
+ RS6000_BTI_unsigned_V2DI, 0 },
12142
+ { P8V_BUILTIN_VEC_EQV, P8V_BUILTIN_EQV_V2DI,
12143
+ RS6000_BTI_unsigned_V2DI, RS6000_BTI_unsigned_V2DI,
12144
+ RS6000_BTI_bool_V2DI, 0 },
12145
+ { P8V_BUILTIN_VEC_EQV, P8V_BUILTIN_EQV_V2DI,
12146
+ RS6000_BTI_unsigned_V2DI, RS6000_BTI_unsigned_V2DI,
12147
+ RS6000_BTI_unsigned_V2DI, 0 },
12148
+ { P8V_BUILTIN_VEC_EQV, P8V_BUILTIN_EQV_V4SF,
12149
+ RS6000_BTI_V4SF, RS6000_BTI_V4SF, RS6000_BTI_V4SF, 0 },
12150
+ { P8V_BUILTIN_VEC_EQV, P8V_BUILTIN_EQV_V2DF,
12151
+ RS6000_BTI_V2DF, RS6000_BTI_V2DF, RS6000_BTI_V2DF, 0 },
12153
+ { P8V_BUILTIN_VEC_NAND, P8V_BUILTIN_NAND_V16QI,
12154
+ RS6000_BTI_V16QI, RS6000_BTI_bool_V16QI, RS6000_BTI_V16QI, 0 },
12155
+ { P8V_BUILTIN_VEC_NAND, P8V_BUILTIN_NAND_V16QI,
12156
+ RS6000_BTI_V16QI, RS6000_BTI_V16QI, RS6000_BTI_bool_V16QI, 0 },
12157
+ { P8V_BUILTIN_VEC_NAND, P8V_BUILTIN_NAND_V16QI,
12158
+ RS6000_BTI_V16QI, RS6000_BTI_V16QI, RS6000_BTI_V16QI, 0 },
12159
+ { P8V_BUILTIN_VEC_NAND, P8V_BUILTIN_NAND_V16QI,
12160
+ RS6000_BTI_unsigned_V16QI, RS6000_BTI_bool_V16QI,
12161
+ RS6000_BTI_unsigned_V16QI, 0 },
12162
+ { P8V_BUILTIN_VEC_NAND, P8V_BUILTIN_NAND_V16QI,
12163
+ RS6000_BTI_unsigned_V16QI, RS6000_BTI_unsigned_V16QI,
12164
+ RS6000_BTI_bool_V16QI, 0 },
12165
+ { P8V_BUILTIN_VEC_NAND, P8V_BUILTIN_NAND_V16QI,
12166
+ RS6000_BTI_unsigned_V16QI, RS6000_BTI_unsigned_V16QI,
12167
+ RS6000_BTI_unsigned_V16QI, 0 },
12168
+ { P8V_BUILTIN_VEC_NAND, P8V_BUILTIN_NAND_V8HI,
12169
+ RS6000_BTI_V8HI, RS6000_BTI_bool_V8HI, RS6000_BTI_V8HI, 0 },
12170
+ { P8V_BUILTIN_VEC_NAND, P8V_BUILTIN_NAND_V8HI,
12171
+ RS6000_BTI_V8HI, RS6000_BTI_V8HI, RS6000_BTI_bool_V8HI, 0 },
12172
+ { P8V_BUILTIN_VEC_NAND, P8V_BUILTIN_NAND_V8HI,
12173
+ RS6000_BTI_V8HI, RS6000_BTI_V8HI, RS6000_BTI_V8HI, 0 },
12174
+ { P8V_BUILTIN_VEC_NAND, P8V_BUILTIN_NAND_V8HI,
12175
+ RS6000_BTI_unsigned_V8HI, RS6000_BTI_bool_V8HI,
12176
+ RS6000_BTI_unsigned_V8HI, 0 },
12177
+ { P8V_BUILTIN_VEC_NAND, P8V_BUILTIN_NAND_V8HI,
12178
+ RS6000_BTI_unsigned_V8HI, RS6000_BTI_unsigned_V8HI,
12179
+ RS6000_BTI_bool_V8HI, 0 },
12180
+ { P8V_BUILTIN_VEC_NAND, P8V_BUILTIN_NAND_V8HI,
12181
+ RS6000_BTI_unsigned_V8HI, RS6000_BTI_unsigned_V8HI,
12182
+ RS6000_BTI_unsigned_V8HI, 0 },
12183
+ { P8V_BUILTIN_VEC_NAND, P8V_BUILTIN_NAND_V4SI,
12184
+ RS6000_BTI_V4SI, RS6000_BTI_bool_V4SI, RS6000_BTI_V4SI, 0 },
12185
+ { P8V_BUILTIN_VEC_NAND, P8V_BUILTIN_NAND_V4SI,
12186
+ RS6000_BTI_V4SI, RS6000_BTI_V4SI, RS6000_BTI_bool_V4SI, 0 },
12187
+ { P8V_BUILTIN_VEC_NAND, P8V_BUILTIN_NAND_V4SI,
12188
+ RS6000_BTI_V4SI, RS6000_BTI_V4SI, RS6000_BTI_V4SI, 0 },
12189
+ { P8V_BUILTIN_VEC_NAND, P8V_BUILTIN_NAND_V4SI,
12190
+ RS6000_BTI_unsigned_V4SI, RS6000_BTI_bool_V4SI,
12191
+ RS6000_BTI_unsigned_V4SI, 0 },
12192
+ { P8V_BUILTIN_VEC_NAND, P8V_BUILTIN_NAND_V4SI,
12193
+ RS6000_BTI_unsigned_V4SI, RS6000_BTI_unsigned_V4SI,
12194
+ RS6000_BTI_bool_V4SI, 0 },
12195
+ { P8V_BUILTIN_VEC_NAND, P8V_BUILTIN_NAND_V4SI,
12196
+ RS6000_BTI_unsigned_V4SI, RS6000_BTI_unsigned_V4SI,
12197
+ RS6000_BTI_unsigned_V4SI, 0 },
12198
+ { P8V_BUILTIN_VEC_NAND, P8V_BUILTIN_NAND_V2DI,
12199
+ RS6000_BTI_V2DI, RS6000_BTI_bool_V2DI, RS6000_BTI_V2DI, 0 },
12200
+ { P8V_BUILTIN_VEC_NAND, P8V_BUILTIN_NAND_V2DI,
12201
+ RS6000_BTI_V2DI, RS6000_BTI_V2DI, RS6000_BTI_bool_V2DI, 0 },
12202
+ { P8V_BUILTIN_VEC_NAND, P8V_BUILTIN_NAND_V2DI,
12203
+ RS6000_BTI_V2DI, RS6000_BTI_V2DI, RS6000_BTI_V2DI, 0 },
12204
+ { P8V_BUILTIN_VEC_NAND, P8V_BUILTIN_NAND_V2DI,
12205
+ RS6000_BTI_unsigned_V2DI, RS6000_BTI_bool_V2DI,
12206
+ RS6000_BTI_unsigned_V2DI, 0 },
12207
+ { P8V_BUILTIN_VEC_NAND, P8V_BUILTIN_NAND_V2DI,
12208
+ RS6000_BTI_unsigned_V2DI, RS6000_BTI_unsigned_V2DI,
12209
+ RS6000_BTI_bool_V2DI, 0 },
12210
+ { P8V_BUILTIN_VEC_NAND, P8V_BUILTIN_NAND_V2DI,
12211
+ RS6000_BTI_unsigned_V2DI, RS6000_BTI_unsigned_V2DI,
12212
+ RS6000_BTI_unsigned_V2DI, 0 },
12213
+ { P8V_BUILTIN_VEC_NAND, P8V_BUILTIN_NAND_V4SF,
12214
+ RS6000_BTI_V4SF, RS6000_BTI_V4SF, RS6000_BTI_V4SF, 0 },
12215
+ { P8V_BUILTIN_VEC_NAND, P8V_BUILTIN_NAND_V2DF,
12216
+ RS6000_BTI_V2DF, RS6000_BTI_V2DF, RS6000_BTI_V2DF, 0 },
12218
+ { P8V_BUILTIN_VEC_ORC, P8V_BUILTIN_ORC_V16QI,
12219
+ RS6000_BTI_V16QI, RS6000_BTI_bool_V16QI, RS6000_BTI_V16QI, 0 },
12220
+ { P8V_BUILTIN_VEC_ORC, P8V_BUILTIN_ORC_V16QI,
12221
+ RS6000_BTI_V16QI, RS6000_BTI_V16QI, RS6000_BTI_bool_V16QI, 0 },
12222
+ { P8V_BUILTIN_VEC_ORC, P8V_BUILTIN_ORC_V16QI,
12223
+ RS6000_BTI_V16QI, RS6000_BTI_V16QI, RS6000_BTI_V16QI, 0 },
12224
+ { P8V_BUILTIN_VEC_ORC, P8V_BUILTIN_ORC_V16QI,
12225
+ RS6000_BTI_unsigned_V16QI, RS6000_BTI_bool_V16QI,
12226
+ RS6000_BTI_unsigned_V16QI, 0 },
12227
+ { P8V_BUILTIN_VEC_ORC, P8V_BUILTIN_ORC_V16QI,
12228
+ RS6000_BTI_unsigned_V16QI, RS6000_BTI_unsigned_V16QI,
12229
+ RS6000_BTI_bool_V16QI, 0 },
12230
+ { P8V_BUILTIN_VEC_ORC, P8V_BUILTIN_ORC_V16QI,
12231
+ RS6000_BTI_unsigned_V16QI, RS6000_BTI_unsigned_V16QI,
12232
+ RS6000_BTI_unsigned_V16QI, 0 },
12233
+ { P8V_BUILTIN_VEC_ORC, P8V_BUILTIN_ORC_V8HI,
12234
+ RS6000_BTI_V8HI, RS6000_BTI_bool_V8HI, RS6000_BTI_V8HI, 0 },
12235
+ { P8V_BUILTIN_VEC_ORC, P8V_BUILTIN_ORC_V8HI,
12236
+ RS6000_BTI_V8HI, RS6000_BTI_V8HI, RS6000_BTI_bool_V8HI, 0 },
12237
+ { P8V_BUILTIN_VEC_ORC, P8V_BUILTIN_ORC_V8HI,
12238
+ RS6000_BTI_V8HI, RS6000_BTI_V8HI, RS6000_BTI_V8HI, 0 },
12239
+ { P8V_BUILTIN_VEC_ORC, P8V_BUILTIN_ORC_V8HI,
12240
+ RS6000_BTI_unsigned_V8HI, RS6000_BTI_bool_V8HI,
12241
+ RS6000_BTI_unsigned_V8HI, 0 },
12242
+ { P8V_BUILTIN_VEC_ORC, P8V_BUILTIN_ORC_V8HI,
12243
+ RS6000_BTI_unsigned_V8HI, RS6000_BTI_unsigned_V8HI,
12244
+ RS6000_BTI_bool_V8HI, 0 },
12245
+ { P8V_BUILTIN_VEC_ORC, P8V_BUILTIN_ORC_V8HI,
12246
+ RS6000_BTI_unsigned_V8HI, RS6000_BTI_unsigned_V8HI,
12247
+ RS6000_BTI_unsigned_V8HI, 0 },
12248
+ { P8V_BUILTIN_VEC_ORC, P8V_BUILTIN_ORC_V4SI,
12249
+ RS6000_BTI_V4SI, RS6000_BTI_bool_V4SI, RS6000_BTI_V4SI, 0 },
12250
+ { P8V_BUILTIN_VEC_ORC, P8V_BUILTIN_ORC_V4SI,
12251
+ RS6000_BTI_V4SI, RS6000_BTI_V4SI, RS6000_BTI_bool_V4SI, 0 },
12252
+ { P8V_BUILTIN_VEC_ORC, P8V_BUILTIN_ORC_V4SI,
12253
+ RS6000_BTI_V4SI, RS6000_BTI_V4SI, RS6000_BTI_V4SI, 0 },
12254
+ { P8V_BUILTIN_VEC_ORC, P8V_BUILTIN_ORC_V4SI,
12255
+ RS6000_BTI_unsigned_V4SI, RS6000_BTI_bool_V4SI,
12256
+ RS6000_BTI_unsigned_V4SI, 0 },
12257
+ { P8V_BUILTIN_VEC_ORC, P8V_BUILTIN_ORC_V4SI,
12258
+ RS6000_BTI_unsigned_V4SI, RS6000_BTI_unsigned_V4SI,
12259
+ RS6000_BTI_bool_V4SI, 0 },
12260
+ { P8V_BUILTIN_VEC_ORC, P8V_BUILTIN_ORC_V4SI,
12261
+ RS6000_BTI_unsigned_V4SI, RS6000_BTI_unsigned_V4SI,
12262
+ RS6000_BTI_unsigned_V4SI, 0 },
12263
+ { P8V_BUILTIN_VEC_ORC, P8V_BUILTIN_ORC_V2DI,
12264
+ RS6000_BTI_V2DI, RS6000_BTI_bool_V2DI, RS6000_BTI_V2DI, 0 },
12265
+ { P8V_BUILTIN_VEC_ORC, P8V_BUILTIN_ORC_V2DI,
12266
+ RS6000_BTI_V2DI, RS6000_BTI_V2DI, RS6000_BTI_bool_V2DI, 0 },
12267
+ { P8V_BUILTIN_VEC_ORC, P8V_BUILTIN_ORC_V2DI,
12268
+ RS6000_BTI_V2DI, RS6000_BTI_V2DI, RS6000_BTI_V2DI, 0 },
12269
+ { P8V_BUILTIN_VEC_ORC, P8V_BUILTIN_ORC_V2DI,
12270
+ RS6000_BTI_unsigned_V2DI, RS6000_BTI_bool_V2DI,
12271
+ RS6000_BTI_unsigned_V2DI, 0 },
12272
+ { P8V_BUILTIN_VEC_ORC, P8V_BUILTIN_ORC_V2DI,
12273
+ RS6000_BTI_unsigned_V2DI, RS6000_BTI_unsigned_V2DI,
12274
+ RS6000_BTI_bool_V2DI, 0 },
12275
+ { P8V_BUILTIN_VEC_ORC, P8V_BUILTIN_ORC_V2DI,
12276
+ RS6000_BTI_unsigned_V2DI, RS6000_BTI_unsigned_V2DI,
12277
+ RS6000_BTI_unsigned_V2DI, 0 },
12278
+ { P8V_BUILTIN_VEC_ORC, P8V_BUILTIN_ORC_V4SF,
12279
+ RS6000_BTI_V4SF, RS6000_BTI_V4SF, RS6000_BTI_V4SF, 0 },
12280
+ { P8V_BUILTIN_VEC_ORC, P8V_BUILTIN_ORC_V2DF,
12281
+ RS6000_BTI_V2DF, RS6000_BTI_V2DF, RS6000_BTI_V2DF, 0 },
12283
+ { P8V_BUILTIN_VEC_VADDUDM, P8V_BUILTIN_VADDUDM,
12284
+ RS6000_BTI_V2DI, RS6000_BTI_bool_V2DI, RS6000_BTI_V2DI, 0 },
12285
+ { P8V_BUILTIN_VEC_VADDUDM, P8V_BUILTIN_VADDUDM,
12286
+ RS6000_BTI_V2DI, RS6000_BTI_V2DI, RS6000_BTI_bool_V2DI, 0 },
12287
+ { P8V_BUILTIN_VEC_VADDUDM, P8V_BUILTIN_VADDUDM,
12288
+ RS6000_BTI_V2DI, RS6000_BTI_V2DI, RS6000_BTI_V2DI, 0 },
12289
+ { P8V_BUILTIN_VEC_VADDUDM, P8V_BUILTIN_VADDUDM,
12290
+ RS6000_BTI_unsigned_V2DI, RS6000_BTI_bool_V2DI, RS6000_BTI_unsigned_V2DI, 0 },
12291
+ { P8V_BUILTIN_VEC_VADDUDM, P8V_BUILTIN_VADDUDM,
12292
+ RS6000_BTI_unsigned_V2DI, RS6000_BTI_unsigned_V2DI, RS6000_BTI_bool_V2DI, 0 },
12293
+ { P8V_BUILTIN_VEC_VADDUDM, P8V_BUILTIN_VADDUDM,
12294
+ RS6000_BTI_unsigned_V2DI, RS6000_BTI_unsigned_V2DI, RS6000_BTI_unsigned_V2DI, 0 },
12296
+ { P8V_BUILTIN_VEC_VCLZ, P8V_BUILTIN_VCLZB,
12297
+ RS6000_BTI_V16QI, RS6000_BTI_V16QI, 0, 0 },
12298
+ { P8V_BUILTIN_VEC_VCLZ, P8V_BUILTIN_VCLZB,
12299
+ RS6000_BTI_unsigned_V16QI, RS6000_BTI_unsigned_V16QI, 0, 0 },
12300
+ { P8V_BUILTIN_VEC_VCLZ, P8V_BUILTIN_VCLZH,
12301
+ RS6000_BTI_V8HI, RS6000_BTI_V8HI, 0, 0 },
12302
+ { P8V_BUILTIN_VEC_VCLZ, P8V_BUILTIN_VCLZH,
12303
+ RS6000_BTI_unsigned_V8HI, RS6000_BTI_unsigned_V8HI, 0, 0 },
12304
+ { P8V_BUILTIN_VEC_VCLZ, P8V_BUILTIN_VCLZW,
12305
+ RS6000_BTI_V4SI, RS6000_BTI_V4SI, 0, 0 },
12306
+ { P8V_BUILTIN_VEC_VCLZ, P8V_BUILTIN_VCLZW,
12307
+ RS6000_BTI_unsigned_V4SI, RS6000_BTI_unsigned_V4SI, 0, 0 },
12308
+ { P8V_BUILTIN_VEC_VCLZ, P8V_BUILTIN_VCLZD,
12309
+ RS6000_BTI_V2DI, RS6000_BTI_V2DI, 0, 0 },
12310
+ { P8V_BUILTIN_VEC_VCLZ, P8V_BUILTIN_VCLZD,
12311
+ RS6000_BTI_unsigned_V2DI, RS6000_BTI_unsigned_V2DI, 0, 0 },
12313
+ { P8V_BUILTIN_VEC_VCLZB, P8V_BUILTIN_VCLZB,
12314
+ RS6000_BTI_V16QI, RS6000_BTI_V16QI, 0, 0 },
12315
+ { P8V_BUILTIN_VEC_VCLZB, P8V_BUILTIN_VCLZB,
12316
+ RS6000_BTI_unsigned_V16QI, RS6000_BTI_unsigned_V16QI, 0, 0 },
12318
+ { P8V_BUILTIN_VEC_VCLZH, P8V_BUILTIN_VCLZH,
12319
+ RS6000_BTI_V8HI, RS6000_BTI_V8HI, 0, 0 },
12320
+ { P8V_BUILTIN_VEC_VCLZH, P8V_BUILTIN_VCLZH,
12321
+ RS6000_BTI_unsigned_V8HI, RS6000_BTI_unsigned_V8HI, 0, 0 },
12323
+ { P8V_BUILTIN_VEC_VCLZW, P8V_BUILTIN_VCLZW,
12324
+ RS6000_BTI_V4SI, RS6000_BTI_V4SI, 0, 0 },
12325
+ { P8V_BUILTIN_VEC_VCLZW, P8V_BUILTIN_VCLZW,
12326
+ RS6000_BTI_unsigned_V4SI, RS6000_BTI_unsigned_V4SI, 0, 0 },
12328
+ { P8V_BUILTIN_VEC_VCLZD, P8V_BUILTIN_VCLZD,
12329
+ RS6000_BTI_V2DI, RS6000_BTI_V2DI, 0, 0 },
12330
+ { P8V_BUILTIN_VEC_VCLZD, P8V_BUILTIN_VCLZD,
12331
+ RS6000_BTI_unsigned_V2DI, RS6000_BTI_unsigned_V2DI, 0, 0 },
12333
+ { P8V_BUILTIN_VEC_VGBBD, P8V_BUILTIN_VGBBD,
12334
+ RS6000_BTI_V16QI, RS6000_BTI_V16QI, 0, 0 },
12335
+ { P8V_BUILTIN_VEC_VGBBD, P8V_BUILTIN_VGBBD,
12336
+ RS6000_BTI_unsigned_V16QI, RS6000_BTI_unsigned_V16QI, 0, 0 },
12338
+ { P8V_BUILTIN_VEC_VMINSD, P8V_BUILTIN_VMINSD,
12339
+ RS6000_BTI_V2DI, RS6000_BTI_bool_V2DI, RS6000_BTI_V2DI, 0 },
12340
+ { P8V_BUILTIN_VEC_VMINSD, P8V_BUILTIN_VMINSD,
12341
+ RS6000_BTI_V2DI, RS6000_BTI_V2DI, RS6000_BTI_bool_V2DI, 0 },
12342
+ { P8V_BUILTIN_VEC_VMINSD, P8V_BUILTIN_VMINSD,
12343
+ RS6000_BTI_V2DI, RS6000_BTI_V2DI, RS6000_BTI_V2DI, 0 },
12345
+ { P8V_BUILTIN_VEC_VMAXSD, P8V_BUILTIN_VMAXSD,
12346
+ RS6000_BTI_V2DI, RS6000_BTI_bool_V2DI, RS6000_BTI_V2DI, 0 },
12347
+ { P8V_BUILTIN_VEC_VMAXSD, P8V_BUILTIN_VMAXSD,
12348
+ RS6000_BTI_V2DI, RS6000_BTI_V2DI, RS6000_BTI_bool_V2DI, 0 },
12349
+ { P8V_BUILTIN_VEC_VMAXSD, P8V_BUILTIN_VMAXSD,
12350
+ RS6000_BTI_V2DI, RS6000_BTI_V2DI, RS6000_BTI_V2DI, 0 },
12352
+ { P8V_BUILTIN_VEC_VMINUD, P8V_BUILTIN_VMINUD,
12353
+ RS6000_BTI_unsigned_V2DI, RS6000_BTI_bool_V2DI,
12354
+ RS6000_BTI_unsigned_V2DI, 0 },
12355
+ { P8V_BUILTIN_VEC_VMINUD, P8V_BUILTIN_VMINUD,
12356
+ RS6000_BTI_unsigned_V2DI, RS6000_BTI_unsigned_V2DI,
12357
+ RS6000_BTI_bool_V2DI, 0 },
12358
+ { P8V_BUILTIN_VEC_VMINUD, P8V_BUILTIN_VMINUD,
12359
+ RS6000_BTI_unsigned_V2DI, RS6000_BTI_unsigned_V2DI,
12360
+ RS6000_BTI_unsigned_V2DI, 0 },
12362
+ { P8V_BUILTIN_VEC_VMAXUD, P8V_BUILTIN_VMAXUD,
12363
+ RS6000_BTI_unsigned_V2DI, RS6000_BTI_bool_V2DI,
12364
+ RS6000_BTI_unsigned_V2DI, 0 },
12365
+ { P8V_BUILTIN_VEC_VMAXUD, P8V_BUILTIN_VMAXUD,
12366
+ RS6000_BTI_unsigned_V2DI, RS6000_BTI_unsigned_V2DI,
12367
+ RS6000_BTI_bool_V2DI, 0 },
12368
+ { P8V_BUILTIN_VEC_VMAXUD, P8V_BUILTIN_VMAXUD,
12369
+ RS6000_BTI_unsigned_V2DI, RS6000_BTI_unsigned_V2DI,
12370
+ RS6000_BTI_unsigned_V2DI, 0 },
12372
+ { P8V_BUILTIN_VEC_VMRGEW, P8V_BUILTIN_VMRGEW,
12373
+ RS6000_BTI_V4SI, RS6000_BTI_V4SI, RS6000_BTI_V4SI, 0 },
12374
+ { P8V_BUILTIN_VEC_VMRGEW, P8V_BUILTIN_VMRGEW,
12375
+ RS6000_BTI_unsigned_V4SI, RS6000_BTI_unsigned_V4SI,
12376
+ RS6000_BTI_unsigned_V4SI, 0 },
12378
+ { P8V_BUILTIN_VEC_VMRGOW, P8V_BUILTIN_VMRGOW,
12379
+ RS6000_BTI_V4SI, RS6000_BTI_V4SI, RS6000_BTI_V4SI, 0 },
12380
+ { P8V_BUILTIN_VEC_VMRGOW, P8V_BUILTIN_VMRGOW,
12381
+ RS6000_BTI_unsigned_V4SI, RS6000_BTI_unsigned_V4SI,
12382
+ RS6000_BTI_unsigned_V4SI, 0 },
12384
+ { P8V_BUILTIN_VEC_VPOPCNT, P8V_BUILTIN_VPOPCNTB,
12385
+ RS6000_BTI_V16QI, RS6000_BTI_V16QI, 0, 0 },
12386
+ { P8V_BUILTIN_VEC_VPOPCNT, P8V_BUILTIN_VPOPCNTB,
12387
+ RS6000_BTI_unsigned_V16QI, RS6000_BTI_unsigned_V16QI, 0, 0 },
12388
+ { P8V_BUILTIN_VEC_VPOPCNT, P8V_BUILTIN_VPOPCNTH,
12389
+ RS6000_BTI_V8HI, RS6000_BTI_V8HI, 0, 0 },
12390
+ { P8V_BUILTIN_VEC_VPOPCNT, P8V_BUILTIN_VPOPCNTH,
12391
+ RS6000_BTI_unsigned_V8HI, RS6000_BTI_unsigned_V8HI, 0, 0 },
12392
+ { P8V_BUILTIN_VEC_VPOPCNT, P8V_BUILTIN_VPOPCNTW,
12393
+ RS6000_BTI_V4SI, RS6000_BTI_V4SI, 0, 0 },
12394
+ { P8V_BUILTIN_VEC_VPOPCNT, P8V_BUILTIN_VPOPCNTW,
12395
+ RS6000_BTI_unsigned_V4SI, RS6000_BTI_unsigned_V4SI, 0, 0 },
12396
+ { P8V_BUILTIN_VEC_VPOPCNT, P8V_BUILTIN_VPOPCNTD,
12397
+ RS6000_BTI_V2DI, RS6000_BTI_V2DI, 0, 0 },
12398
+ { P8V_BUILTIN_VEC_VPOPCNT, P8V_BUILTIN_VPOPCNTD,
12399
+ RS6000_BTI_unsigned_V2DI, RS6000_BTI_unsigned_V2DI, 0, 0 },
12401
+ { P8V_BUILTIN_VEC_VPOPCNTB, P8V_BUILTIN_VPOPCNTB,
12402
+ RS6000_BTI_V16QI, RS6000_BTI_V16QI, 0, 0 },
12403
+ { P8V_BUILTIN_VEC_VPOPCNTB, P8V_BUILTIN_VPOPCNTB,
12404
+ RS6000_BTI_unsigned_V16QI, RS6000_BTI_unsigned_V16QI, 0, 0 },
12406
+ { P8V_BUILTIN_VEC_VPOPCNTH, P8V_BUILTIN_VPOPCNTH,
12407
+ RS6000_BTI_V8HI, RS6000_BTI_V8HI, 0, 0 },
12408
+ { P8V_BUILTIN_VEC_VPOPCNTH, P8V_BUILTIN_VPOPCNTH,
12409
+ RS6000_BTI_unsigned_V8HI, RS6000_BTI_unsigned_V8HI, 0, 0 },
12411
+ { P8V_BUILTIN_VEC_VPOPCNTW, P8V_BUILTIN_VPOPCNTW,
12412
+ RS6000_BTI_V4SI, RS6000_BTI_V4SI, 0, 0 },
12413
+ { P8V_BUILTIN_VEC_VPOPCNTW, P8V_BUILTIN_VPOPCNTW,
12414
+ RS6000_BTI_unsigned_V4SI, RS6000_BTI_unsigned_V4SI, 0, 0 },
12416
+ { P8V_BUILTIN_VEC_VPOPCNTD, P8V_BUILTIN_VPOPCNTD,
12417
+ RS6000_BTI_V2DI, RS6000_BTI_V2DI, 0, 0 },
12418
+ { P8V_BUILTIN_VEC_VPOPCNTD, P8V_BUILTIN_VPOPCNTD,
12419
+ RS6000_BTI_unsigned_V2DI, RS6000_BTI_unsigned_V2DI, 0, 0 },
12421
+ { P8V_BUILTIN_VEC_VPKUDUM, P8V_BUILTIN_VPKUDUM,
12422
+ RS6000_BTI_V4SI, RS6000_BTI_V2DI, RS6000_BTI_V2DI, 0 },
12423
+ { P8V_BUILTIN_VEC_VPKUDUM, P8V_BUILTIN_VPKUDUM,
12424
+ RS6000_BTI_unsigned_V4SI, RS6000_BTI_unsigned_V2DI, RS6000_BTI_unsigned_V2DI, 0 },
12425
+ { P8V_BUILTIN_VEC_VPKUDUM, P8V_BUILTIN_VPKUDUM,
12426
+ RS6000_BTI_bool_V4SI, RS6000_BTI_bool_V2DI, RS6000_BTI_bool_V2DI, 0 },
12428
+ { P8V_BUILTIN_VEC_VPKSDSS, P8V_BUILTIN_VPKSDSS,
12429
+ RS6000_BTI_V4SI, RS6000_BTI_V2DI, RS6000_BTI_V2DI, 0 },
12431
+ { P8V_BUILTIN_VEC_VPKUDUS, P8V_BUILTIN_VPKUDUS,
12432
+ RS6000_BTI_unsigned_V4SI, RS6000_BTI_unsigned_V2DI, RS6000_BTI_unsigned_V2DI, 0 },
12434
+ { P8V_BUILTIN_VEC_VPKSDUS, P8V_BUILTIN_VPKSDUS,
12435
+ RS6000_BTI_unsigned_V4SI, RS6000_BTI_V2DI, RS6000_BTI_V2DI, 0 },
12437
+ { P8V_BUILTIN_VEC_VRLD, P8V_BUILTIN_VRLD,
12438
+ RS6000_BTI_V2DI, RS6000_BTI_V2DI, RS6000_BTI_unsigned_V2DI, 0 },
12439
+ { P8V_BUILTIN_VEC_VRLD, P8V_BUILTIN_VRLD,
12440
+ RS6000_BTI_unsigned_V2DI, RS6000_BTI_unsigned_V2DI, RS6000_BTI_unsigned_V2DI, 0 },
12442
+ { P8V_BUILTIN_VEC_VSLD, P8V_BUILTIN_VSLD,
12443
+ RS6000_BTI_V2DI, RS6000_BTI_V2DI, RS6000_BTI_unsigned_V2DI, 0 },
12444
+ { P8V_BUILTIN_VEC_VSLD, P8V_BUILTIN_VSLD,
12445
+ RS6000_BTI_unsigned_V2DI, RS6000_BTI_unsigned_V2DI, RS6000_BTI_unsigned_V2DI, 0 },
12447
+ { P8V_BUILTIN_VEC_VSRD, P8V_BUILTIN_VSRD,
12448
+ RS6000_BTI_V2DI, RS6000_BTI_V2DI, RS6000_BTI_unsigned_V2DI, 0 },
12449
+ { P8V_BUILTIN_VEC_VSRD, P8V_BUILTIN_VSRD,
12450
+ RS6000_BTI_unsigned_V2DI, RS6000_BTI_unsigned_V2DI, RS6000_BTI_unsigned_V2DI, 0 },
12452
+ { P8V_BUILTIN_VEC_VSRAD, P8V_BUILTIN_VSRAD,
12453
+ RS6000_BTI_V2DI, RS6000_BTI_V2DI, RS6000_BTI_unsigned_V2DI, 0 },
12454
+ { P8V_BUILTIN_VEC_VSRAD, P8V_BUILTIN_VSRD,
12455
+ RS6000_BTI_unsigned_V2DI, RS6000_BTI_unsigned_V2DI, RS6000_BTI_unsigned_V2DI, 0 },
12457
+ { P8V_BUILTIN_VEC_VSUBUDM, P8V_BUILTIN_VSUBUDM,
12458
+ RS6000_BTI_V2DI, RS6000_BTI_bool_V2DI, RS6000_BTI_V2DI, 0 },
12459
+ { P8V_BUILTIN_VEC_VSUBUDM, P8V_BUILTIN_VSUBUDM,
12460
+ RS6000_BTI_V2DI, RS6000_BTI_V2DI, RS6000_BTI_bool_V2DI, 0 },
12461
+ { P8V_BUILTIN_VEC_VSUBUDM, P8V_BUILTIN_VSUBUDM,
12462
+ RS6000_BTI_V2DI, RS6000_BTI_V2DI, RS6000_BTI_V2DI, 0 },
12463
+ { P8V_BUILTIN_VEC_VSUBUDM, P8V_BUILTIN_VSUBUDM,
12464
+ RS6000_BTI_unsigned_V2DI, RS6000_BTI_bool_V2DI, RS6000_BTI_unsigned_V2DI, 0 },
12465
+ { P8V_BUILTIN_VEC_VSUBUDM, P8V_BUILTIN_VSUBUDM,
12466
+ RS6000_BTI_unsigned_V2DI, RS6000_BTI_unsigned_V2DI, RS6000_BTI_bool_V2DI, 0 },
12467
+ { P8V_BUILTIN_VEC_VSUBUDM, P8V_BUILTIN_VSUBUDM,
12468
+ RS6000_BTI_unsigned_V2DI, RS6000_BTI_unsigned_V2DI, RS6000_BTI_unsigned_V2DI, 0 },
12470
+ { P8V_BUILTIN_VEC_VUPKHSW, P8V_BUILTIN_VUPKHSW,
12471
+ RS6000_BTI_V2DI, RS6000_BTI_V4SI, 0, 0 },
12472
+ { P8V_BUILTIN_VEC_VUPKHSW, P8V_BUILTIN_VUPKHSW,
12473
+ RS6000_BTI_bool_V2DI, RS6000_BTI_bool_V4SI, 0, 0 },
12475
+ { P8V_BUILTIN_VEC_VUPKLSW, P8V_BUILTIN_VUPKLSW,
12476
+ RS6000_BTI_V2DI, RS6000_BTI_V4SI, 0, 0 },
12477
+ { P8V_BUILTIN_VEC_VUPKLSW, P8V_BUILTIN_VUPKLSW,
12478
+ RS6000_BTI_bool_V2DI, RS6000_BTI_bool_V4SI, 0, 0 },
12480
+ { P8V_BUILTIN_VEC_VGBBD, P8V_BUILTIN_VGBBD,
12481
+ RS6000_BTI_V16QI, 0, 0, 0 },
12482
+ { P8V_BUILTIN_VEC_VGBBD, P8V_BUILTIN_VGBBD,
12483
+ RS6000_BTI_unsigned_V16QI, 0, 0, 0 },
12485
+ /* Crypto builtins. */
12486
+ { CRYPTO_BUILTIN_VPERMXOR, CRYPTO_BUILTIN_VPERMXOR_V16QI,
12487
+ RS6000_BTI_unsigned_V16QI, RS6000_BTI_unsigned_V16QI,
12488
+ RS6000_BTI_unsigned_V16QI, RS6000_BTI_unsigned_V16QI },
12489
+ { CRYPTO_BUILTIN_VPERMXOR, CRYPTO_BUILTIN_VPERMXOR_V8HI,
12490
+ RS6000_BTI_unsigned_V8HI, RS6000_BTI_unsigned_V8HI,
12491
+ RS6000_BTI_unsigned_V8HI, RS6000_BTI_unsigned_V8HI },
12492
+ { CRYPTO_BUILTIN_VPERMXOR, CRYPTO_BUILTIN_VPERMXOR_V4SI,
12493
+ RS6000_BTI_unsigned_V4SI, RS6000_BTI_unsigned_V4SI,
12494
+ RS6000_BTI_unsigned_V4SI, RS6000_BTI_unsigned_V4SI },
12495
+ { CRYPTO_BUILTIN_VPERMXOR, CRYPTO_BUILTIN_VPERMXOR_V2DI,
12496
+ RS6000_BTI_unsigned_V2DI, RS6000_BTI_unsigned_V2DI,
12497
+ RS6000_BTI_unsigned_V2DI, RS6000_BTI_unsigned_V2DI },
12499
+ { CRYPTO_BUILTIN_VPMSUM, CRYPTO_BUILTIN_VPMSUMB,
12500
+ RS6000_BTI_unsigned_V16QI, RS6000_BTI_unsigned_V16QI,
12501
+ RS6000_BTI_unsigned_V16QI, 0 },
12502
+ { CRYPTO_BUILTIN_VPMSUM, CRYPTO_BUILTIN_VPMSUMH,
12503
+ RS6000_BTI_unsigned_V8HI, RS6000_BTI_unsigned_V8HI,
12504
+ RS6000_BTI_unsigned_V8HI, 0 },
12505
+ { CRYPTO_BUILTIN_VPMSUM, CRYPTO_BUILTIN_VPMSUMW,
12506
+ RS6000_BTI_unsigned_V4SI, RS6000_BTI_unsigned_V4SI,
12507
+ RS6000_BTI_unsigned_V4SI, 0 },
12508
+ { CRYPTO_BUILTIN_VPMSUM, CRYPTO_BUILTIN_VPMSUMD,
12509
+ RS6000_BTI_unsigned_V2DI, RS6000_BTI_unsigned_V2DI,
12510
+ RS6000_BTI_unsigned_V2DI, 0 },
12512
+ { CRYPTO_BUILTIN_VSHASIGMA, CRYPTO_BUILTIN_VSHASIGMAW,
12513
+ RS6000_BTI_unsigned_V4SI, RS6000_BTI_unsigned_V4SI,
12514
+ RS6000_BTI_INTSI, RS6000_BTI_INTSI },
12515
+ { CRYPTO_BUILTIN_VSHASIGMA, CRYPTO_BUILTIN_VSHASIGMAD,
12516
+ RS6000_BTI_unsigned_V2DI, RS6000_BTI_unsigned_V2DI,
12517
+ RS6000_BTI_INTSI, RS6000_BTI_INTSI },
12519
{ (enum rs6000_builtins) 0, (enum rs6000_builtins) 0, 0, 0, 0, 0 }
12522
@@ -3824,7 +4407,8 @@
12523
&& (desc->op2 == RS6000_BTI_NOT_OPAQUE
12524
|| rs6000_builtin_type_compatible (types[1], desc->op2))
12525
&& (desc->op3 == RS6000_BTI_NOT_OPAQUE
12526
- || rs6000_builtin_type_compatible (types[2], desc->op3)))
12527
+ || rs6000_builtin_type_compatible (types[2], desc->op3))
12528
+ && rs6000_builtin_decls[desc->overloaded_code] != NULL_TREE)
12529
return altivec_build_resolved_builtin (args, n, desc);
12532
--- a/src/gcc/config/rs6000/rs6000.opt
12533
+++ b/src/gcc/config/rs6000/rs6000.opt
12534
@@ -181,13 +181,16 @@
12535
Target Report Mask(VSX) Var(rs6000_isa_flags)
12536
Use vector/scalar (VSX) instructions
12539
+Target Undocumented Report Var(TARGET_VSX_SCALAR_FLOAT) Init(1)
12540
+; If -mpower8-vector, use VSX arithmetic instructions for SFmode (on by default)
12543
-Target Undocumented Report Var(TARGET_VSX_SCALAR_DOUBLE) Init(-1)
12544
-; If -mvsx, use VSX arithmetic instructions for scalar double (on by default)
12545
+Target Undocumented Report Var(TARGET_VSX_SCALAR_DOUBLE) Init(1)
12546
+; If -mvsx, use VSX arithmetic instructions for DFmode (on by default)
12549
-Target Undocumented Report Var(TARGET_VSX_SCALAR_MEMORY)
12550
-; If -mvsx, use VSX scalar memory reference instructions for scalar double (off by default)
12551
+Target Undocumented Report Alias(mupper-regs-df)
12554
Target Undocumented Report Var(TARGET_VSX_ALIGN_128)
12555
@@ -363,6 +366,14 @@
12556
Target RejectNegative Var(rs6000_spe_abi, 0)
12557
Do not use the SPE ABI extensions
12560
+Target RejectNegative Var(rs6000_elf_abi, 1) Save
12564
+Target RejectNegative Var(rs6000_elf_abi, 2)
12567
; These are here for testing during development only, do not document
12568
; in the manual please.
12570
@@ -514,3 +525,47 @@
12572
Target Report Var(TARGET_SAVE_TOC_INDIRECT) Save
12573
Control whether we save the TOC in the prologue for indirect calls or generate the save inline
12576
+Target Undocumented Mask(VSX_TIMODE) Var(rs6000_isa_flags)
12577
+Allow 128-bit integers in VSX registers
12580
+Target Report Mask(P8_FUSION) Var(rs6000_isa_flags)
12581
+Fuse certain integer operations together for better performance on power8
12583
+mpower8-fusion-sign
12584
+Target Undocumented Mask(P8_FUSION_SIGN) Var(rs6000_isa_flags)
12585
+Allow sign extension in fusion operations
12588
+Target Report Mask(P8_VECTOR) Var(rs6000_isa_flags)
12589
+Use/do not use vector and scalar instructions added in ISA 2.07.
12592
+Target Report Mask(CRYPTO) Var(rs6000_isa_flags)
12593
+Use ISA 2.07 crypto instructions
12596
+Target Report Mask(DIRECT_MOVE) Var(rs6000_isa_flags)
12597
+Use ISA 2.07 direct move between GPR & VSX register instructions
12600
+Target Report Mask(HTM) Var(rs6000_isa_flags)
12601
+Use ISA 2.07 transactional memory (HTM) instructions
12604
+Target Report Mask(QUAD_MEMORY) Var(rs6000_isa_flags)
12605
+Generate the quad word memory instructions (lq/stq/lqarx/stqcx).
12607
+mcompat-align-parm
12608
+Target Report Var(rs6000_compat_align_parm) Init(1) Save
12609
+Generate aggregate parameter passing code with at most 64-bit alignment.
12612
+Target Undocumented Mask(UPPER_REGS_DF) Var(rs6000_isa_flags)
12613
+Allow double variables in upper registers with -mcpu=power7 or -mvsx
12616
+Target Undocumented Mask(UPPER_REGS_SF) Var(rs6000_isa_flags)
12617
+Allow float variables in upper registers with -mcpu=power8 or -mp8-vector
12618
--- a/src/gcc/config/rs6000/linux64.h
12619
+++ b/src/gcc/config/rs6000/linux64.h
12622
#ifndef RS6000_BI_ARCH
12624
-#undef DEFAULT_ABI
12625
-#define DEFAULT_ABI ABI_AIX
12627
#undef TARGET_64BIT
12628
#define TARGET_64BIT 1
12631
#undef PROCESSOR_DEFAULT
12632
#define PROCESSOR_DEFAULT PROCESSOR_POWER7
12633
#undef PROCESSOR_DEFAULT64
12634
+#ifdef LINUX64_DEFAULT_ABI_ELFv2
12635
+#define PROCESSOR_DEFAULT64 PROCESSOR_POWER8
12637
#define PROCESSOR_DEFAULT64 PROCESSOR_POWER7
12640
/* We don't need to generate entries in .fixup, except when
12641
-mrelocatable or -mrelocatable-lib is given. */
12643
#define INVALID_64BIT "-m%s not supported in this configuration"
12644
#define INVALID_32BIT INVALID_64BIT
12646
+#ifdef LINUX64_DEFAULT_ABI_ELFv2
12647
+#define ELFv2_ABI_CHECK (rs6000_elf_abi != 1)
12649
+#define ELFv2_ABI_CHECK (rs6000_elf_abi == 2)
12652
#undef SUBSUBTARGET_OVERRIDE_OPTIONS
12653
#define SUBSUBTARGET_OVERRIDE_OPTIONS \
12655
@@ -102,6 +109,12 @@
12656
error (INVALID_64BIT, "call"); \
12658
dot_symbols = !strcmp (rs6000_abi_name, "aixdesc"); \
12659
+ if (ELFv2_ABI_CHECK) \
12661
+ rs6000_current_abi = ABI_ELFv2; \
12662
+ if (dot_symbols) \
12663
+ error ("-mcall-aixdesc incompatible with -mabi=elfv2"); \
12665
if (rs6000_isa_flags & OPTION_MASK_RELOCATABLE) \
12667
rs6000_isa_flags &= ~OPTION_MASK_RELOCATABLE; \
12668
@@ -351,7 +364,11 @@
12669
#define LINK_OS_DEFAULT_SPEC "%(link_os_linux)"
12671
#define GLIBC_DYNAMIC_LINKER32 "/lib/ld.so.1"
12672
-#define GLIBC_DYNAMIC_LINKER64 "/lib64/ld64.so.1"
12673
+#ifdef LINUX64_DEFAULT_ABI_ELFv2
12674
+#define GLIBC_DYNAMIC_LINKER64 "%{mabi=elfv1:/lib64/ld64.so.1;:/lib64/ld64.so.2}"
12676
+#define GLIBC_DYNAMIC_LINKER64 "%{mabi=elfv2:/lib64/ld64.so.2;:/lib64/ld64.so.1}"
12678
#define UCLIBC_DYNAMIC_LINKER32 "/lib/ld-uClibc.so.0"
12679
#define UCLIBC_DYNAMIC_LINKER64 "/lib/ld64-uClibc.so.0"
12680
#if DEFAULT_LIBC == LIBC_UCLIBC
12681
--- a/src/gcc/config/rs6000/darwin.h
12682
+++ b/src/gcc/config/rs6000/darwin.h
12683
@@ -205,7 +205,8 @@
12684
"v24", "v25", "v26", "v27", "v28", "v29", "v30", "v31", \
12685
"vrsave", "vscr", \
12686
"spe_acc", "spefscr", \
12689
+ "tfhar", "tfiar", "texasr" \
12692
/* This outputs NAME to FILE. */
12693
--- a/src/gcc/config/rs6000/rs6000.c
12694
+++ b/src/gcc/config/rs6000/rs6000.c
12696
int spe_gp_save_offset; /* offset to save spe 64-bit gprs */
12697
int varargs_save_offset; /* offset to save the varargs registers */
12698
int ehrd_offset; /* offset to EH return data */
12699
+ int ehcr_offset; /* offset to EH CR field data */
12700
int reg_size; /* register size (4 or 8) */
12701
HOST_WIDE_INT vars_size; /* variable save area size */
12702
int parm_size; /* outgoing parameter size */
12703
@@ -139,6 +140,8 @@
12704
64-bits wide and is allocated early enough so that the offset
12705
does not overflow the 16-bit load/store offset field. */
12706
rtx sdmode_stack_slot;
12707
+ /* Flag if r2 setup is needed with ELFv2 ABI. */
12708
+ bool r2_setup_needed;
12709
} machine_function;
12711
/* Support targetm.vectorize.builtin_mask_for_load. */
12712
@@ -189,9 +192,6 @@
12713
/* Map register number to register class. */
12714
enum reg_class rs6000_regno_regclass[FIRST_PSEUDO_REGISTER];
12716
-/* Reload functions based on the type and the vector unit. */
12717
-static enum insn_code rs6000_vector_reload[NUM_MACHINE_MODES][2];
12719
static int dbg_cost_ctrl;
12721
/* Built in types. */
12722
@@ -289,6 +289,105 @@
12723
don't link in rs6000-c.c, so we can't call it directly. */
12724
void (*rs6000_target_modify_macros_ptr) (bool, HOST_WIDE_INT, HOST_WIDE_INT);
12726
+/* Simplfy register classes into simpler classifications. We assume
12727
+ GPR_REG_TYPE - FPR_REG_TYPE are ordered so that we can use a simple range
12728
+ check for standard register classes (gpr/floating/altivec/vsx) and
12729
+ floating/vector classes (float/altivec/vsx). */
12731
+enum rs6000_reg_type {
12736
+ ALTIVEC_REG_TYPE,
12744
+/* Map register class to register type. */
12745
+static enum rs6000_reg_type reg_class_to_reg_type[N_REG_CLASSES];
12747
+/* First/last register type for the 'normal' register types (i.e. general
12748
+ purpose, floating point, altivec, and VSX registers). */
12749
+#define IS_STD_REG_TYPE(RTYPE) IN_RANGE(RTYPE, GPR_REG_TYPE, FPR_REG_TYPE)
12751
+#define IS_FP_VECT_REG_TYPE(RTYPE) IN_RANGE(RTYPE, VSX_REG_TYPE, FPR_REG_TYPE)
12754
+/* Register classes we care about in secondary reload or go if legitimate
12755
+ address. We only need to worry about GPR, FPR, and Altivec registers here,
12756
+ along an ANY field that is the OR of the 3 register classes. */
12758
+enum rs6000_reload_reg_type {
12759
+ RELOAD_REG_GPR, /* General purpose registers. */
12760
+ RELOAD_REG_FPR, /* Traditional floating point regs. */
12761
+ RELOAD_REG_VMX, /* Altivec (VMX) registers. */
12762
+ RELOAD_REG_ANY, /* OR of GPR, FPR, Altivec masks. */
12766
+/* For setting up register classes, loop through the 3 register classes mapping
12767
+ into real registers, and skip the ANY class, which is just an OR of the
12769
+#define FIRST_RELOAD_REG_CLASS RELOAD_REG_GPR
12770
+#define LAST_RELOAD_REG_CLASS RELOAD_REG_VMX
12772
+/* Map reload register type to a register in the register class. */
12773
+struct reload_reg_map_type {
12774
+ const char *name; /* Register class name. */
12775
+ int reg; /* Register in the register class. */
12778
+static const struct reload_reg_map_type reload_reg_map[N_RELOAD_REG] = {
12779
+ { "Gpr", FIRST_GPR_REGNO }, /* RELOAD_REG_GPR. */
12780
+ { "Fpr", FIRST_FPR_REGNO }, /* RELOAD_REG_FPR. */
12781
+ { "VMX", FIRST_ALTIVEC_REGNO }, /* RELOAD_REG_VMX. */
12782
+ { "Any", -1 }, /* RELOAD_REG_ANY. */
12785
+/* Mask bits for each register class, indexed per mode. Historically the
12786
+ compiler has been more restrictive which types can do PRE_MODIFY instead of
12787
+ PRE_INC and PRE_DEC, so keep track of sepaate bits for these two. */
12788
+typedef unsigned char addr_mask_type;
12790
+#define RELOAD_REG_VALID 0x01 /* Mode valid in register.. */
12791
+#define RELOAD_REG_MULTIPLE 0x02 /* Mode takes multiple registers. */
12792
+#define RELOAD_REG_INDEXED 0x04 /* Reg+reg addressing. */
12793
+#define RELOAD_REG_OFFSET 0x08 /* Reg+offset addressing. */
12794
+#define RELOAD_REG_PRE_INCDEC 0x10 /* PRE_INC/PRE_DEC valid. */
12795
+#define RELOAD_REG_PRE_MODIFY 0x20 /* PRE_MODIFY valid. */
12797
+/* Register type masks based on the type, of valid addressing modes. */
12798
+struct rs6000_reg_addr {
12799
+ enum insn_code reload_load; /* INSN to reload for loading. */
12800
+ enum insn_code reload_store; /* INSN to reload for storing. */
12801
+ enum insn_code reload_fpr_gpr; /* INSN to move from FPR to GPR. */
12802
+ enum insn_code reload_gpr_vsx; /* INSN to move from GPR to VSX. */
12803
+ enum insn_code reload_vsx_gpr; /* INSN to move from VSX to GPR. */
12804
+ addr_mask_type addr_mask[(int)N_RELOAD_REG]; /* Valid address masks. */
12807
+static struct rs6000_reg_addr reg_addr[NUM_MACHINE_MODES];
12809
+/* Helper function to say whether a mode supports PRE_INC or PRE_DEC. */
12810
+static inline bool
12811
+mode_supports_pre_incdec_p (enum machine_mode mode)
12813
+ return ((reg_addr[mode].addr_mask[RELOAD_REG_ANY] & RELOAD_REG_PRE_INCDEC)
12817
+/* Helper function to say whether a mode supports PRE_MODIFY. */
12818
+static inline bool
12819
+mode_supports_pre_modify_p (enum machine_mode mode)
12821
+ return ((reg_addr[mode].addr_mask[RELOAD_REG_ANY] & RELOAD_REG_PRE_MODIFY)
12826
/* Target cpu costs. */
12828
@@ -828,6 +927,25 @@
12829
12, /* prefetch streams */
12832
+/* Instruction costs on POWER8 processors. */
12834
+struct processor_costs power8_cost = {
12835
+ COSTS_N_INSNS (3), /* mulsi */
12836
+ COSTS_N_INSNS (3), /* mulsi_const */
12837
+ COSTS_N_INSNS (3), /* mulsi_const9 */
12838
+ COSTS_N_INSNS (3), /* muldi */
12839
+ COSTS_N_INSNS (19), /* divsi */
12840
+ COSTS_N_INSNS (35), /* divdi */
12841
+ COSTS_N_INSNS (3), /* fp */
12842
+ COSTS_N_INSNS (3), /* dmul */
12843
+ COSTS_N_INSNS (14), /* sdiv */
12844
+ COSTS_N_INSNS (17), /* ddiv */
12845
+ 128, /* cache line size */
12846
+ 32, /* l1 cache */
12847
+ 256, /* l2 cache */
12848
+ 12, /* prefetch streams */
12851
/* Instruction costs on POWER A2 processors. */
12853
struct processor_costs ppca2_cost = {
12854
@@ -855,6 +973,7 @@
12855
#undef RS6000_BUILTIN_A
12856
#undef RS6000_BUILTIN_D
12857
#undef RS6000_BUILTIN_E
12858
+#undef RS6000_BUILTIN_H
12859
#undef RS6000_BUILTIN_P
12860
#undef RS6000_BUILTIN_Q
12861
#undef RS6000_BUILTIN_S
12862
@@ -878,6 +997,9 @@
12863
#define RS6000_BUILTIN_E(ENUM, NAME, MASK, ATTR, ICODE) \
12864
{ NAME, ICODE, MASK, ATTR },
12866
+#define RS6000_BUILTIN_H(ENUM, NAME, MASK, ATTR, ICODE) \
12867
+ { NAME, ICODE, MASK, ATTR },
12869
#define RS6000_BUILTIN_P(ENUM, NAME, MASK, ATTR, ICODE) \
12870
{ NAME, ICODE, MASK, ATTR },
12872
@@ -908,6 +1030,7 @@
12873
#undef RS6000_BUILTIN_A
12874
#undef RS6000_BUILTIN_D
12875
#undef RS6000_BUILTIN_E
12876
+#undef RS6000_BUILTIN_H
12877
#undef RS6000_BUILTIN_P
12878
#undef RS6000_BUILTIN_Q
12879
#undef RS6000_BUILTIN_S
12880
@@ -948,6 +1071,7 @@
12881
static void paired_init_builtins (void);
12882
static rtx paired_expand_predicate_builtin (enum insn_code, tree, rtx);
12883
static void spe_init_builtins (void);
12884
+static void htm_init_builtins (void);
12885
static rtx spe_expand_predicate_builtin (enum insn_code, tree, rtx);
12886
static rtx spe_expand_evsel_builtin (enum insn_code, tree, rtx);
12887
static int rs6000_emit_int_cmove (rtx, rtx, rtx, rtx);
12888
@@ -1020,6 +1144,13 @@
12889
static void rs6000_print_builtin_options (FILE *, int, const char *,
12892
+static enum rs6000_reg_type register_to_reg_type (rtx, bool *);
12893
+static bool rs6000_secondary_reload_move (enum rs6000_reg_type,
12894
+ enum rs6000_reg_type,
12895
+ enum machine_mode,
12896
+ secondary_reload_info *,
12899
/* Hash table stuff for keeping track of TOC entries. */
12901
struct GTY(()) toc_hash_struct
12902
@@ -1068,7 +1199,9 @@
12903
/* SPE registers. */
12904
"spe_acc", "spefscr",
12905
/* Soft frame pointer. */
12908
+ /* HTM SPR registers. */
12909
+ "tfhar", "tfiar", "texasr"
12912
#ifdef TARGET_REGNAMES
12913
@@ -1094,7 +1227,9 @@
12914
/* SPE registers. */
12915
"spe_acc", "spefscr",
12916
/* Soft frame pointer. */
12919
+ /* HTM SPR registers. */
12920
+ "tfhar", "tfiar", "texasr"
12924
@@ -1316,6 +1451,9 @@
12925
#undef TARGET_RETURN_IN_MEMORY
12926
#define TARGET_RETURN_IN_MEMORY rs6000_return_in_memory
12928
+#undef TARGET_RETURN_IN_MSB
12929
+#define TARGET_RETURN_IN_MSB rs6000_return_in_msb
12931
#undef TARGET_SETUP_INCOMING_VARARGS
12932
#define TARGET_SETUP_INCOMING_VARARGS setup_incoming_varargs
12934
@@ -1513,8 +1651,9 @@
12936
unsigned HOST_WIDE_INT reg_size;
12938
+ /* TF/TD modes are special in that they always take 2 registers. */
12939
if (FP_REGNO_P (regno))
12940
- reg_size = (VECTOR_MEM_VSX_P (mode)
12941
+ reg_size = ((VECTOR_MEM_VSX_P (mode) && mode != TDmode && mode != TFmode)
12942
? UNITS_PER_VSX_WORD
12943
: UNITS_PER_FP_WORD);
12945
@@ -1546,16 +1685,38 @@
12947
int last_regno = regno + rs6000_hard_regno_nregs[mode][regno] - 1;
12949
+ /* PTImode can only go in GPRs. Quad word memory operations require even/odd
12950
+ register combinations, and use PTImode where we need to deal with quad
12951
+ word memory operations. Don't allow quad words in the argument or frame
12952
+ pointer registers, just registers 0..31. */
12953
+ if (mode == PTImode)
12954
+ return (IN_RANGE (regno, FIRST_GPR_REGNO, LAST_GPR_REGNO)
12955
+ && IN_RANGE (last_regno, FIRST_GPR_REGNO, LAST_GPR_REGNO)
12956
+ && ((regno & 1) == 0));
12958
/* VSX registers that overlap the FPR registers are larger than for non-VSX
12959
implementations. Don't allow an item to be split between a FP register
12960
- and an Altivec register. */
12961
- if (VECTOR_MEM_VSX_P (mode))
12962
+ and an Altivec register. Allow TImode in all VSX registers if the user
12964
+ if (TARGET_VSX && VSX_REGNO_P (regno)
12965
+ && (VECTOR_MEM_VSX_P (mode)
12966
+ || (TARGET_VSX_SCALAR_FLOAT && mode == SFmode)
12967
+ || (TARGET_VSX_SCALAR_DOUBLE && (mode == DFmode || mode == DImode))
12968
+ || (TARGET_VSX_TIMODE && mode == TImode)))
12970
if (FP_REGNO_P (regno))
12971
return FP_REGNO_P (last_regno);
12973
if (ALTIVEC_REGNO_P (regno))
12974
- return ALTIVEC_REGNO_P (last_regno);
12976
+ if (mode == SFmode && !TARGET_UPPER_REGS_SF)
12979
+ if ((mode == DFmode || mode == DImode) && !TARGET_UPPER_REGS_DF)
12982
+ return ALTIVEC_REGNO_P (last_regno);
12986
/* The GPRs can hold any mode, but values bigger than one register
12987
@@ -1564,8 +1725,7 @@
12988
return INT_REGNO_P (last_regno);
12990
/* The float registers (except for VSX vector modes) can only hold floating
12991
- modes and DImode. This excludes the 32-bit decimal float mode for
12993
+ modes and DImode. */
12994
if (FP_REGNO_P (regno))
12996
if (SCALAR_FLOAT_MODE_P (mode)
12997
@@ -1599,9 +1759,8 @@
12998
if (SPE_SIMD_REGNO_P (regno) && TARGET_SPE && SPE_VECTOR_MODE (mode))
13001
- /* We cannot put TImode anywhere except general register and it must be able
13002
- to fit within the register set. In the future, allow TImode in the
13003
- Altivec or VSX registers. */
13004
+ /* We cannot put non-VSX TImode or PTImode anywhere except general register
13005
+ and it must be able to fit within the register set. */
13007
return GET_MODE_SIZE (mode) <= UNITS_PER_WORD;
13009
@@ -1674,10 +1833,77 @@
13013
+ len += fprintf (stderr, "%sreg-class = %s", comma,
13014
+ reg_class_names[(int)rs6000_regno_regclass[r]]);
13019
+ fprintf (stderr, ",\n\t");
13023
fprintf (stderr, "%sregno = %d\n", comma, r);
13027
+static const char *
13028
+rs6000_debug_vector_unit (enum rs6000_vector v)
13034
+ case VECTOR_NONE: ret = "none"; break;
13035
+ case VECTOR_ALTIVEC: ret = "altivec"; break;
13036
+ case VECTOR_VSX: ret = "vsx"; break;
13037
+ case VECTOR_P8_VECTOR: ret = "p8_vector"; break;
13038
+ case VECTOR_PAIRED: ret = "paired"; break;
13039
+ case VECTOR_SPE: ret = "spe"; break;
13040
+ case VECTOR_OTHER: ret = "other"; break;
13041
+ default: ret = "unknown"; break;
13047
+/* Print the address masks in a human readble fashion. */
13048
+DEBUG_FUNCTION void
13049
+rs6000_debug_print_mode (ssize_t m)
13053
+ fprintf (stderr, "Mode: %-5s", GET_MODE_NAME (m));
13054
+ for (rc = 0; rc < N_RELOAD_REG; rc++)
13056
+ addr_mask_type mask = reg_addr[m].addr_mask[rc];
13058
+ " %s: %c%c%c%c%c%c",
13059
+ reload_reg_map[rc].name,
13060
+ (mask & RELOAD_REG_VALID) != 0 ? 'v' : ' ',
13061
+ (mask & RELOAD_REG_MULTIPLE) != 0 ? 'm' : ' ',
13062
+ (mask & RELOAD_REG_INDEXED) != 0 ? 'i' : ' ',
13063
+ (mask & RELOAD_REG_OFFSET) != 0 ? 'o' : ' ',
13064
+ (mask & RELOAD_REG_PRE_INCDEC) != 0 ? '+' : ' ',
13065
+ (mask & RELOAD_REG_PRE_MODIFY) != 0 ? '+' : ' ');
13068
+ if (rs6000_vector_unit[m] != VECTOR_NONE
13069
+ || rs6000_vector_mem[m] != VECTOR_NONE
13070
+ || (reg_addr[m].reload_store != CODE_FOR_nothing)
13071
+ || (reg_addr[m].reload_load != CODE_FOR_nothing))
13074
+ " Vector-arith=%-10s Vector-mem=%-10s Reload=%c%c",
13075
+ rs6000_debug_vector_unit (rs6000_vector_unit[m]),
13076
+ rs6000_debug_vector_unit (rs6000_vector_mem[m]),
13077
+ (reg_addr[m].reload_store != CODE_FOR_nothing) ? 's' : '*',
13078
+ (reg_addr[m].reload_load != CODE_FOR_nothing) ? 'l' : '*');
13081
+ fputs ("\n", stderr);
13084
#define DEBUG_FMT_ID "%-32s= "
13085
#define DEBUG_FMT_D DEBUG_FMT_ID "%d\n"
13086
#define DEBUG_FMT_WX DEBUG_FMT_ID "%#.12" HOST_WIDE_INT_PRINT "x: "
13087
@@ -1690,6 +1916,7 @@
13088
static const char *const tf[2] = { "false", "true" };
13089
const char *nl = (const char *)0;
13091
+ size_t m1, m2, v;
13092
char costly_num[20];
13094
char flags_buffer[40];
13095
@@ -1700,20 +1927,67 @@
13096
const char *cmodel_str;
13097
struct cl_target_option cl_opts;
13099
- /* Map enum rs6000_vector to string. */
13100
- static const char *rs6000_debug_vector_unit[] = {
13107
+ /* Modes we want tieable information on. */
13108
+ static const enum machine_mode print_tieable_modes[] = {
13142
- fprintf (stderr, "Register information: (last virtual reg = %d)\n",
13143
- LAST_VIRTUAL_REGISTER);
13144
- rs6000_debug_reg_print (0, 31, "gr");
13145
- rs6000_debug_reg_print (32, 63, "fp");
13146
+ /* Virtual regs we are interested in. */
13147
+ const static struct {
13148
+ int regno; /* register number. */
13149
+ const char *name; /* register name. */
13150
+ } virtual_regs[] = {
13151
+ { STACK_POINTER_REGNUM, "stack pointer:" },
13152
+ { TOC_REGNUM, "toc: " },
13153
+ { STATIC_CHAIN_REGNUM, "static chain: " },
13154
+ { RS6000_PIC_OFFSET_TABLE_REGNUM, "pic offset: " },
13155
+ { HARD_FRAME_POINTER_REGNUM, "hard frame: " },
13156
+ { ARG_POINTER_REGNUM, "arg pointer: " },
13157
+ { FRAME_POINTER_REGNUM, "frame pointer:" },
13158
+ { FIRST_PSEUDO_REGISTER, "first pseudo: " },
13159
+ { FIRST_VIRTUAL_REGISTER, "first virtual:" },
13160
+ { VIRTUAL_INCOMING_ARGS_REGNUM, "incoming_args:" },
13161
+ { VIRTUAL_STACK_VARS_REGNUM, "stack_vars: " },
13162
+ { VIRTUAL_STACK_DYNAMIC_REGNUM, "stack_dynamic:" },
13163
+ { VIRTUAL_OUTGOING_ARGS_REGNUM, "outgoing_args:" },
13164
+ { VIRTUAL_CFA_REGNUM, "cfa (frame): " },
13165
+ { VIRTUAL_PREFERRED_STACK_BOUNDARY_REGNUM, "stack boundry:" },
13166
+ { LAST_VIRTUAL_REGISTER, "last virtual: " },
13169
+ fputs ("\nHard register information:\n", stderr);
13170
+ rs6000_debug_reg_print (FIRST_GPR_REGNO, LAST_GPR_REGNO, "gr");
13171
+ rs6000_debug_reg_print (FIRST_FPR_REGNO, LAST_FPR_REGNO, "fp");
13172
rs6000_debug_reg_print (FIRST_ALTIVEC_REGNO,
13173
LAST_ALTIVEC_REGNO,
13175
@@ -1726,6 +2000,10 @@
13176
rs6000_debug_reg_print (SPE_ACC_REGNO, SPE_ACC_REGNO, "spe_a");
13177
rs6000_debug_reg_print (SPEFSCR_REGNO, SPEFSCR_REGNO, "spe_f");
13179
+ fputs ("\nVirtual/stack/frame registers:\n", stderr);
13180
+ for (v = 0; v < ARRAY_SIZE (virtual_regs); v++)
13181
+ fprintf (stderr, "%s regno = %3d\n", virtual_regs[v].name, virtual_regs[v].regno);
13185
"d reg_class = %s\n"
13186
@@ -1734,25 +2012,70 @@
13187
"wa reg_class = %s\n"
13188
"wd reg_class = %s\n"
13189
"wf reg_class = %s\n"
13190
- "ws reg_class = %s\n\n",
13191
+ "wg reg_class = %s\n"
13192
+ "wl reg_class = %s\n"
13193
+ "wm reg_class = %s\n"
13194
+ "wr reg_class = %s\n"
13195
+ "ws reg_class = %s\n"
13196
+ "wt reg_class = %s\n"
13197
+ "wu reg_class = %s\n"
13198
+ "wv reg_class = %s\n"
13199
+ "ww reg_class = %s\n"
13200
+ "wx reg_class = %s\n"
13201
+ "wy reg_class = %s\n"
13202
+ "wz reg_class = %s\n"
13204
reg_class_names[rs6000_constraints[RS6000_CONSTRAINT_d]],
13205
reg_class_names[rs6000_constraints[RS6000_CONSTRAINT_f]],
13206
reg_class_names[rs6000_constraints[RS6000_CONSTRAINT_v]],
13207
reg_class_names[rs6000_constraints[RS6000_CONSTRAINT_wa]],
13208
reg_class_names[rs6000_constraints[RS6000_CONSTRAINT_wd]],
13209
reg_class_names[rs6000_constraints[RS6000_CONSTRAINT_wf]],
13210
- reg_class_names[rs6000_constraints[RS6000_CONSTRAINT_ws]]);
13211
+ reg_class_names[rs6000_constraints[RS6000_CONSTRAINT_wg]],
13212
+ reg_class_names[rs6000_constraints[RS6000_CONSTRAINT_wl]],
13213
+ reg_class_names[rs6000_constraints[RS6000_CONSTRAINT_wm]],
13214
+ reg_class_names[rs6000_constraints[RS6000_CONSTRAINT_wr]],
13215
+ reg_class_names[rs6000_constraints[RS6000_CONSTRAINT_ws]],
13216
+ reg_class_names[rs6000_constraints[RS6000_CONSTRAINT_wt]],
13217
+ reg_class_names[rs6000_constraints[RS6000_CONSTRAINT_wu]],
13218
+ reg_class_names[rs6000_constraints[RS6000_CONSTRAINT_wv]],
13219
+ reg_class_names[rs6000_constraints[RS6000_CONSTRAINT_ww]],
13220
+ reg_class_names[rs6000_constraints[RS6000_CONSTRAINT_wx]],
13221
+ reg_class_names[rs6000_constraints[RS6000_CONSTRAINT_wy]],
13222
+ reg_class_names[rs6000_constraints[RS6000_CONSTRAINT_wz]]);
13225
for (m = 0; m < NUM_MACHINE_MODES; ++m)
13226
- if (rs6000_vector_unit[m] || rs6000_vector_mem[m])
13229
- fprintf (stderr, "Vector mode: %-5s arithmetic: %-8s move: %-8s\n",
13230
- GET_MODE_NAME (m),
13231
- rs6000_debug_vector_unit[ rs6000_vector_unit[m] ],
13232
- rs6000_debug_vector_unit[ rs6000_vector_mem[m] ]);
13234
+ rs6000_debug_print_mode (m);
13236
+ fputs ("\n", stderr);
13238
+ for (m1 = 0; m1 < ARRAY_SIZE (print_tieable_modes); m1++)
13240
+ enum machine_mode mode1 = print_tieable_modes[m1];
13241
+ bool first_time = true;
13243
+ nl = (const char *)0;
13244
+ for (m2 = 0; m2 < ARRAY_SIZE (print_tieable_modes); m2++)
13246
+ enum machine_mode mode2 = print_tieable_modes[m2];
13247
+ if (mode1 != mode2 && MODES_TIEABLE_P (mode1, mode2))
13251
+ fprintf (stderr, "Tieable modes %s:", GET_MODE_NAME (mode1));
13253
+ first_time = false;
13256
+ fprintf (stderr, " %s", GET_MODE_NAME (mode2));
13261
+ fputs ("\n", stderr);
13265
fputs (nl, stderr);
13267
@@ -1913,6 +2236,7 @@
13269
case ABI_NONE: abi_str = "none"; break;
13270
case ABI_AIX: abi_str = "aix"; break;
13271
+ case ABI_ELFv2: abi_str = "ELFv2"; break;
13272
case ABI_V4: abi_str = "V4"; break;
13273
case ABI_DARWIN: abi_str = "darwin"; break;
13274
default: abi_str = "unknown"; break;
13275
@@ -1935,6 +2259,13 @@
13276
if (TARGET_LINK_STACK)
13277
fprintf (stderr, DEBUG_FMT_S, "link_stack", "true");
13279
+ if (targetm.lra_p ())
13280
+ fprintf (stderr, DEBUG_FMT_S, "lra", "true");
13282
+ if (TARGET_P8_FUSION)
13283
+ fprintf (stderr, DEBUG_FMT_S, "p8 fusion",
13284
+ (TARGET_P8_FUSION_SIGN) ? "zero+sign" : "zero");
13286
fprintf (stderr, DEBUG_FMT_S, "plt-format",
13287
TARGET_SECURE_PLT ? "secure" : "bss");
13288
fprintf (stderr, DEBUG_FMT_S, "struct-return",
13289
@@ -1954,11 +2285,106 @@
13290
(int)RS6000_BUILTIN_COUNT);
13294
+/* Update the addr mask bits in reg_addr to help secondary reload and go if
13295
+ legitimate address support to figure out the appropriate addressing to
13299
+rs6000_setup_reg_addr_masks (void)
13301
+ ssize_t rc, reg, m, nregs;
13302
+ addr_mask_type any_addr_mask, addr_mask;
13304
+ for (m = 0; m < NUM_MACHINE_MODES; ++m)
13306
+ /* SDmode is special in that we want to access it only via REG+REG
13307
+ addressing on power7 and above, since we want to use the LFIWZX and
13308
+ STFIWZX instructions to load it. */
13309
+ bool indexed_only_p = (m == SDmode && TARGET_NO_SDMODE_STACK);
13311
+ any_addr_mask = 0;
13312
+ for (rc = FIRST_RELOAD_REG_CLASS; rc <= LAST_RELOAD_REG_CLASS; rc++)
13315
+ reg = reload_reg_map[rc].reg;
13317
+ /* Can mode values go in the GPR/FPR/Altivec registers? */
13318
+ if (reg >= 0 && rs6000_hard_regno_mode_ok_p[m][reg])
13320
+ nregs = rs6000_hard_regno_nregs[m][reg];
13321
+ addr_mask |= RELOAD_REG_VALID;
13323
+ /* Indicate if the mode takes more than 1 physical register. If
13324
+ it takes a single register, indicate it can do REG+REG
13326
+ if (nregs > 1 || m == BLKmode)
13327
+ addr_mask |= RELOAD_REG_MULTIPLE;
13329
+ addr_mask |= RELOAD_REG_INDEXED;
13331
+ /* Figure out if we can do PRE_INC, PRE_DEC, or PRE_MODIFY
13332
+ addressing. Restrict addressing on SPE for 64-bit types
13333
+ because of the SUBREG hackery used to address 64-bit floats in
13334
+ '32-bit' GPRs. To simplify secondary reload, don't allow
13335
+ update forms on scalar floating point types that can go in the
13336
+ upper registers. */
13338
+ if (TARGET_UPDATE
13339
+ && (rc == RELOAD_REG_GPR || rc == RELOAD_REG_FPR)
13340
+ && GET_MODE_SIZE (m) <= 8
13341
+ && !VECTOR_MODE_P (m)
13342
+ && !COMPLEX_MODE_P (m)
13343
+ && !indexed_only_p
13344
+ && !(TARGET_E500_DOUBLE && GET_MODE_SIZE (m) == 8)
13345
+ && !(m == DFmode && TARGET_UPPER_REGS_DF)
13346
+ && !(m == SFmode && TARGET_UPPER_REGS_SF))
13348
+ addr_mask |= RELOAD_REG_PRE_INCDEC;
13350
+ /* PRE_MODIFY is more restricted than PRE_INC/PRE_DEC in that
13351
+ we don't allow PRE_MODIFY for some multi-register
13356
+ addr_mask |= RELOAD_REG_PRE_MODIFY;
13360
+ if (TARGET_POWERPC64)
13361
+ addr_mask |= RELOAD_REG_PRE_MODIFY;
13366
+ if (TARGET_DF_INSN)
13367
+ addr_mask |= RELOAD_REG_PRE_MODIFY;
13373
+ /* GPR and FPR registers can do REG+OFFSET addressing, except
13374
+ possibly for SDmode. */
13375
+ if ((addr_mask != 0) && !indexed_only_p
13376
+ && (rc == RELOAD_REG_GPR || rc == RELOAD_REG_FPR))
13377
+ addr_mask |= RELOAD_REG_OFFSET;
13379
+ reg_addr[m].addr_mask[rc] = addr_mask;
13380
+ any_addr_mask |= addr_mask;
13383
+ reg_addr[m].addr_mask[RELOAD_REG_ANY] = any_addr_mask;
13388
/* Initialize the various global tables that are based on register size. */
13390
rs6000_init_hard_regno_mode_ok (bool global_init_p)
13397
@@ -1987,21 +2413,55 @@
13398
rs6000_regno_regclass[VSCR_REGNO] = VRSAVE_REGS;
13399
rs6000_regno_regclass[SPE_ACC_REGNO] = SPE_ACC_REGS;
13400
rs6000_regno_regclass[SPEFSCR_REGNO] = SPEFSCR_REGS;
13401
+ rs6000_regno_regclass[TFHAR_REGNO] = SPR_REGS;
13402
+ rs6000_regno_regclass[TFIAR_REGNO] = SPR_REGS;
13403
+ rs6000_regno_regclass[TEXASR_REGNO] = SPR_REGS;
13404
rs6000_regno_regclass[ARG_POINTER_REGNUM] = BASE_REGS;
13405
rs6000_regno_regclass[FRAME_POINTER_REGNUM] = BASE_REGS;
13407
- /* Precalculate vector information, this must be set up before the
13408
- rs6000_hard_regno_nregs_internal below. */
13409
- for (m = 0; m < NUM_MACHINE_MODES; ++m)
13410
+ /* Precalculate register class to simpler reload register class. We don't
13411
+ need all of the register classes that are combinations of different
13412
+ classes, just the simple ones that have constraint letters. */
13413
+ for (c = 0; c < N_REG_CLASSES; c++)
13414
+ reg_class_to_reg_type[c] = NO_REG_TYPE;
13416
+ reg_class_to_reg_type[(int)GENERAL_REGS] = GPR_REG_TYPE;
13417
+ reg_class_to_reg_type[(int)BASE_REGS] = GPR_REG_TYPE;
13418
+ reg_class_to_reg_type[(int)VSX_REGS] = VSX_REG_TYPE;
13419
+ reg_class_to_reg_type[(int)VRSAVE_REGS] = SPR_REG_TYPE;
13420
+ reg_class_to_reg_type[(int)VSCR_REGS] = SPR_REG_TYPE;
13421
+ reg_class_to_reg_type[(int)LINK_REGS] = SPR_REG_TYPE;
13422
+ reg_class_to_reg_type[(int)CTR_REGS] = SPR_REG_TYPE;
13423
+ reg_class_to_reg_type[(int)LINK_OR_CTR_REGS] = SPR_REG_TYPE;
13424
+ reg_class_to_reg_type[(int)CR_REGS] = CR_REG_TYPE;
13425
+ reg_class_to_reg_type[(int)CR0_REGS] = CR_REG_TYPE;
13426
+ reg_class_to_reg_type[(int)SPE_ACC_REGS] = SPE_ACC_TYPE;
13427
+ reg_class_to_reg_type[(int)SPEFSCR_REGS] = SPEFSCR_REG_TYPE;
13431
- rs6000_vector_unit[m] = rs6000_vector_mem[m] = VECTOR_NONE;
13432
- rs6000_vector_reload[m][0] = CODE_FOR_nothing;
13433
- rs6000_vector_reload[m][1] = CODE_FOR_nothing;
13434
+ reg_class_to_reg_type[(int)FLOAT_REGS] = VSX_REG_TYPE;
13435
+ reg_class_to_reg_type[(int)ALTIVEC_REGS] = VSX_REG_TYPE;
13439
+ reg_class_to_reg_type[(int)FLOAT_REGS] = FPR_REG_TYPE;
13440
+ reg_class_to_reg_type[(int)ALTIVEC_REGS] = ALTIVEC_REG_TYPE;
13443
- for (c = 0; c < (int)(int)RS6000_CONSTRAINT_MAX; c++)
13444
- rs6000_constraints[c] = NO_REGS;
13445
+ /* Precalculate the valid memory formats as well as the vector information,
13446
+ this must be set up before the rs6000_hard_regno_nregs_internal calls
13448
+ gcc_assert ((int)VECTOR_NONE == 0);
13449
+ memset ((void *) &rs6000_vector_unit[0], '\0', sizeof (rs6000_vector_unit));
13450
+ memset ((void *) &rs6000_vector_mem[0], '\0', sizeof (rs6000_vector_unit));
13452
+ gcc_assert ((int)CODE_FOR_nothing == 0);
13453
+ memset ((void *) ®_addr[0], '\0', sizeof (reg_addr));
13455
+ gcc_assert ((int)NO_REGS == 0);
13456
+ memset ((void *) &rs6000_constraints[0], '\0', sizeof (rs6000_constraints));
13458
/* The VSX hardware allows native alignment for vectors, but control whether the compiler
13459
believes it can use native alignment or still uses 128-bit alignment. */
13460
if (TARGET_VSX && !TARGET_VSX_ALIGN_128)
13461
@@ -2062,12 +2522,13 @@
13465
- /* V2DImode, only allow under VSX, which can do V2DI insert/splat/extract.
13466
- Altivec doesn't have 64-bit support. */
13467
+ /* V2DImode, full mode depends on ISA 2.07 vector mode. Allow under VSX to
13468
+ do insert/splat/extract. Altivec doesn't have 64-bit integer support. */
13471
rs6000_vector_mem[V2DImode] = VECTOR_VSX;
13472
- rs6000_vector_unit[V2DImode] = VECTOR_NONE;
13473
+ rs6000_vector_unit[V2DImode]
13474
+ = (TARGET_P8_VECTOR) ? VECTOR_P8_VECTOR : VECTOR_NONE;
13475
rs6000_vector_align[V2DImode] = align64;
13478
@@ -2076,14 +2537,48 @@
13480
rs6000_vector_unit[DFmode] = VECTOR_VSX;
13481
rs6000_vector_mem[DFmode]
13482
- = (TARGET_VSX_SCALAR_MEMORY ? VECTOR_VSX : VECTOR_NONE);
13483
+ = (TARGET_UPPER_REGS_DF ? VECTOR_VSX : VECTOR_NONE);
13484
rs6000_vector_align[DFmode] = align64;
13487
+ /* Allow TImode in VSX register and set the VSX memory macros. */
13488
+ if (TARGET_VSX && TARGET_VSX_TIMODE)
13490
+ rs6000_vector_mem[TImode] = VECTOR_VSX;
13491
+ rs6000_vector_align[TImode] = align64;
13494
/* TODO add SPE and paired floating point vector support. */
13496
/* Register class constraints for the constraints that depend on compile
13498
+ switches. When the VSX code was added, different constraints were added
13499
+ based on the type (DFmode, V2DFmode, V4SFmode). For the vector types, all
13500
+ of the VSX registers are used. The register classes for scalar floating
13501
+ point types is set, based on whether we allow that type into the upper
13502
+ (Altivec) registers. GCC has register classes to target the Altivec
13503
+ registers for load/store operations, to select using a VSX memory
13504
+ operation instead of the traditional floating point operation. The
13507
+ d - Register class to use with traditional DFmode instructions.
13508
+ f - Register class to use with traditional SFmode instructions.
13509
+ v - Altivec register.
13510
+ wa - Any VSX register.
13511
+ wd - Preferred register class for V2DFmode.
13512
+ wf - Preferred register class for V4SFmode.
13513
+ wg - Float register for power6x move insns.
13514
+ wl - Float register if we can do 32-bit signed int loads.
13515
+ wm - VSX register for ISA 2.07 direct move operations.
13516
+ wr - GPR if 64-bit mode is permitted.
13517
+ ws - Register class to do ISA 2.06 DF operations.
13518
+ wu - Altivec register for ISA 2.07 VSX SF/SI load/stores.
13519
+ wv - Altivec register for ISA 2.06 VSX DF/DI load/stores.
13520
+ wt - VSX register for TImode in VSX registers.
13521
+ ww - Register class to do SF conversions in with VSX operations.
13522
+ wx - Float register if we can do 32-bit int stores.
13523
+ wy - Register class to do ISA 2.07 SF operations.
13524
+ wz - Float register if we can do 32-bit unsigned int loads. */
13526
if (TARGET_HARD_FLOAT && TARGET_FPRS)
13527
rs6000_constraints[RS6000_CONSTRAINT_f] = FLOAT_REGS;
13529
@@ -2092,64 +2587,158 @@
13533
- /* At present, we just use VSX_REGS, but we have different constraints
13534
- based on the use, in case we want to fine tune the default register
13535
- class used. wa = any VSX register, wf = register class to use for
13536
- V4SF, wd = register class to use for V2DF, and ws = register classs to
13537
- use for DF scalars. */
13538
rs6000_constraints[RS6000_CONSTRAINT_wa] = VSX_REGS;
13539
+ rs6000_constraints[RS6000_CONSTRAINT_wd] = VSX_REGS;
13540
rs6000_constraints[RS6000_CONSTRAINT_wf] = VSX_REGS;
13541
- rs6000_constraints[RS6000_CONSTRAINT_wd] = VSX_REGS;
13542
- rs6000_constraints[RS6000_CONSTRAINT_ws] = (TARGET_VSX_SCALAR_MEMORY
13546
+ if (TARGET_VSX_TIMODE)
13547
+ rs6000_constraints[RS6000_CONSTRAINT_wt] = VSX_REGS;
13549
+ if (TARGET_UPPER_REGS_DF)
13551
+ rs6000_constraints[RS6000_CONSTRAINT_ws] = VSX_REGS;
13552
+ rs6000_constraints[RS6000_CONSTRAINT_wv] = ALTIVEC_REGS;
13555
+ rs6000_constraints[RS6000_CONSTRAINT_ws] = FLOAT_REGS;
13558
+ /* Add conditional constraints based on various options, to allow us to
13559
+ collapse multiple insn patterns. */
13560
if (TARGET_ALTIVEC)
13561
rs6000_constraints[RS6000_CONSTRAINT_v] = ALTIVEC_REGS;
13563
- /* Set up the reload helper functions. */
13564
+ if (TARGET_MFPGPR)
13565
+ rs6000_constraints[RS6000_CONSTRAINT_wg] = FLOAT_REGS;
13567
+ if (TARGET_LFIWAX)
13568
+ rs6000_constraints[RS6000_CONSTRAINT_wl] = FLOAT_REGS;
13570
+ if (TARGET_DIRECT_MOVE)
13571
+ rs6000_constraints[RS6000_CONSTRAINT_wm] = VSX_REGS;
13573
+ if (TARGET_POWERPC64)
13574
+ rs6000_constraints[RS6000_CONSTRAINT_wr] = GENERAL_REGS;
13576
+ if (TARGET_P8_VECTOR && TARGET_UPPER_REGS_SF)
13578
+ rs6000_constraints[RS6000_CONSTRAINT_wu] = ALTIVEC_REGS;
13579
+ rs6000_constraints[RS6000_CONSTRAINT_wy] = VSX_REGS;
13580
+ rs6000_constraints[RS6000_CONSTRAINT_ww] = VSX_REGS;
13582
+ else if (TARGET_P8_VECTOR)
13584
+ rs6000_constraints[RS6000_CONSTRAINT_wy] = FLOAT_REGS;
13585
+ rs6000_constraints[RS6000_CONSTRAINT_ww] = FLOAT_REGS;
13587
+ else if (TARGET_VSX)
13588
+ rs6000_constraints[RS6000_CONSTRAINT_ww] = FLOAT_REGS;
13590
+ if (TARGET_STFIWX)
13591
+ rs6000_constraints[RS6000_CONSTRAINT_wx] = FLOAT_REGS;
13593
+ if (TARGET_LFIWZX)
13594
+ rs6000_constraints[RS6000_CONSTRAINT_wz] = FLOAT_REGS;
13596
+ /* Set up the reload helper and direct move functions. */
13597
if (TARGET_VSX || TARGET_ALTIVEC)
13601
- rs6000_vector_reload[V16QImode][0] = CODE_FOR_reload_v16qi_di_store;
13602
- rs6000_vector_reload[V16QImode][1] = CODE_FOR_reload_v16qi_di_load;
13603
- rs6000_vector_reload[V8HImode][0] = CODE_FOR_reload_v8hi_di_store;
13604
- rs6000_vector_reload[V8HImode][1] = CODE_FOR_reload_v8hi_di_load;
13605
- rs6000_vector_reload[V4SImode][0] = CODE_FOR_reload_v4si_di_store;
13606
- rs6000_vector_reload[V4SImode][1] = CODE_FOR_reload_v4si_di_load;
13607
- rs6000_vector_reload[V2DImode][0] = CODE_FOR_reload_v2di_di_store;
13608
- rs6000_vector_reload[V2DImode][1] = CODE_FOR_reload_v2di_di_load;
13609
- rs6000_vector_reload[V4SFmode][0] = CODE_FOR_reload_v4sf_di_store;
13610
- rs6000_vector_reload[V4SFmode][1] = CODE_FOR_reload_v4sf_di_load;
13611
- rs6000_vector_reload[V2DFmode][0] = CODE_FOR_reload_v2df_di_store;
13612
- rs6000_vector_reload[V2DFmode][1] = CODE_FOR_reload_v2df_di_load;
13613
- if (TARGET_VSX && TARGET_VSX_SCALAR_MEMORY)
13614
+ reg_addr[V16QImode].reload_store = CODE_FOR_reload_v16qi_di_store;
13615
+ reg_addr[V16QImode].reload_load = CODE_FOR_reload_v16qi_di_load;
13616
+ reg_addr[V8HImode].reload_store = CODE_FOR_reload_v8hi_di_store;
13617
+ reg_addr[V8HImode].reload_load = CODE_FOR_reload_v8hi_di_load;
13618
+ reg_addr[V4SImode].reload_store = CODE_FOR_reload_v4si_di_store;
13619
+ reg_addr[V4SImode].reload_load = CODE_FOR_reload_v4si_di_load;
13620
+ reg_addr[V2DImode].reload_store = CODE_FOR_reload_v2di_di_store;
13621
+ reg_addr[V2DImode].reload_load = CODE_FOR_reload_v2di_di_load;
13622
+ reg_addr[V4SFmode].reload_store = CODE_FOR_reload_v4sf_di_store;
13623
+ reg_addr[V4SFmode].reload_load = CODE_FOR_reload_v4sf_di_load;
13624
+ reg_addr[V2DFmode].reload_store = CODE_FOR_reload_v2df_di_store;
13625
+ reg_addr[V2DFmode].reload_load = CODE_FOR_reload_v2df_di_load;
13626
+ if (TARGET_VSX && TARGET_UPPER_REGS_DF)
13628
- rs6000_vector_reload[DFmode][0] = CODE_FOR_reload_df_di_store;
13629
- rs6000_vector_reload[DFmode][1] = CODE_FOR_reload_df_di_load;
13630
+ reg_addr[DFmode].reload_store = CODE_FOR_reload_df_di_store;
13631
+ reg_addr[DFmode].reload_load = CODE_FOR_reload_df_di_load;
13632
+ reg_addr[DDmode].reload_store = CODE_FOR_reload_dd_di_store;
13633
+ reg_addr[DDmode].reload_load = CODE_FOR_reload_dd_di_load;
13635
+ if (TARGET_P8_VECTOR)
13637
+ reg_addr[SFmode].reload_store = CODE_FOR_reload_sf_di_store;
13638
+ reg_addr[SFmode].reload_load = CODE_FOR_reload_sf_di_load;
13639
+ reg_addr[SDmode].reload_store = CODE_FOR_reload_sd_di_store;
13640
+ reg_addr[SDmode].reload_load = CODE_FOR_reload_sd_di_load;
13642
+ if (TARGET_VSX_TIMODE)
13644
+ reg_addr[TImode].reload_store = CODE_FOR_reload_ti_di_store;
13645
+ reg_addr[TImode].reload_load = CODE_FOR_reload_ti_di_load;
13647
+ if (TARGET_DIRECT_MOVE)
13649
+ if (TARGET_POWERPC64)
13651
+ reg_addr[TImode].reload_gpr_vsx = CODE_FOR_reload_gpr_from_vsxti;
13652
+ reg_addr[V2DFmode].reload_gpr_vsx = CODE_FOR_reload_gpr_from_vsxv2df;
13653
+ reg_addr[V2DImode].reload_gpr_vsx = CODE_FOR_reload_gpr_from_vsxv2di;
13654
+ reg_addr[V4SFmode].reload_gpr_vsx = CODE_FOR_reload_gpr_from_vsxv4sf;
13655
+ reg_addr[V4SImode].reload_gpr_vsx = CODE_FOR_reload_gpr_from_vsxv4si;
13656
+ reg_addr[V8HImode].reload_gpr_vsx = CODE_FOR_reload_gpr_from_vsxv8hi;
13657
+ reg_addr[V16QImode].reload_gpr_vsx = CODE_FOR_reload_gpr_from_vsxv16qi;
13658
+ reg_addr[SFmode].reload_gpr_vsx = CODE_FOR_reload_gpr_from_vsxsf;
13660
+ reg_addr[TImode].reload_vsx_gpr = CODE_FOR_reload_vsx_from_gprti;
13661
+ reg_addr[V2DFmode].reload_vsx_gpr = CODE_FOR_reload_vsx_from_gprv2df;
13662
+ reg_addr[V2DImode].reload_vsx_gpr = CODE_FOR_reload_vsx_from_gprv2di;
13663
+ reg_addr[V4SFmode].reload_vsx_gpr = CODE_FOR_reload_vsx_from_gprv4sf;
13664
+ reg_addr[V4SImode].reload_vsx_gpr = CODE_FOR_reload_vsx_from_gprv4si;
13665
+ reg_addr[V8HImode].reload_vsx_gpr = CODE_FOR_reload_vsx_from_gprv8hi;
13666
+ reg_addr[V16QImode].reload_vsx_gpr = CODE_FOR_reload_vsx_from_gprv16qi;
13667
+ reg_addr[SFmode].reload_vsx_gpr = CODE_FOR_reload_vsx_from_gprsf;
13671
+ reg_addr[DImode].reload_fpr_gpr = CODE_FOR_reload_fpr_from_gprdi;
13672
+ reg_addr[DDmode].reload_fpr_gpr = CODE_FOR_reload_fpr_from_gprdd;
13673
+ reg_addr[DFmode].reload_fpr_gpr = CODE_FOR_reload_fpr_from_gprdf;
13679
- rs6000_vector_reload[V16QImode][0] = CODE_FOR_reload_v16qi_si_store;
13680
- rs6000_vector_reload[V16QImode][1] = CODE_FOR_reload_v16qi_si_load;
13681
- rs6000_vector_reload[V8HImode][0] = CODE_FOR_reload_v8hi_si_store;
13682
- rs6000_vector_reload[V8HImode][1] = CODE_FOR_reload_v8hi_si_load;
13683
- rs6000_vector_reload[V4SImode][0] = CODE_FOR_reload_v4si_si_store;
13684
- rs6000_vector_reload[V4SImode][1] = CODE_FOR_reload_v4si_si_load;
13685
- rs6000_vector_reload[V2DImode][0] = CODE_FOR_reload_v2di_si_store;
13686
- rs6000_vector_reload[V2DImode][1] = CODE_FOR_reload_v2di_si_load;
13687
- rs6000_vector_reload[V4SFmode][0] = CODE_FOR_reload_v4sf_si_store;
13688
- rs6000_vector_reload[V4SFmode][1] = CODE_FOR_reload_v4sf_si_load;
13689
- rs6000_vector_reload[V2DFmode][0] = CODE_FOR_reload_v2df_si_store;
13690
- rs6000_vector_reload[V2DFmode][1] = CODE_FOR_reload_v2df_si_load;
13691
- if (TARGET_VSX && TARGET_VSX_SCALAR_MEMORY)
13692
+ reg_addr[V16QImode].reload_store = CODE_FOR_reload_v16qi_si_store;
13693
+ reg_addr[V16QImode].reload_load = CODE_FOR_reload_v16qi_si_load;
13694
+ reg_addr[V8HImode].reload_store = CODE_FOR_reload_v8hi_si_store;
13695
+ reg_addr[V8HImode].reload_load = CODE_FOR_reload_v8hi_si_load;
13696
+ reg_addr[V4SImode].reload_store = CODE_FOR_reload_v4si_si_store;
13697
+ reg_addr[V4SImode].reload_load = CODE_FOR_reload_v4si_si_load;
13698
+ reg_addr[V2DImode].reload_store = CODE_FOR_reload_v2di_si_store;
13699
+ reg_addr[V2DImode].reload_load = CODE_FOR_reload_v2di_si_load;
13700
+ reg_addr[V4SFmode].reload_store = CODE_FOR_reload_v4sf_si_store;
13701
+ reg_addr[V4SFmode].reload_load = CODE_FOR_reload_v4sf_si_load;
13702
+ reg_addr[V2DFmode].reload_store = CODE_FOR_reload_v2df_si_store;
13703
+ reg_addr[V2DFmode].reload_load = CODE_FOR_reload_v2df_si_load;
13704
+ if (TARGET_VSX && TARGET_UPPER_REGS_DF)
13706
- rs6000_vector_reload[DFmode][0] = CODE_FOR_reload_df_si_store;
13707
- rs6000_vector_reload[DFmode][1] = CODE_FOR_reload_df_si_load;
13708
+ reg_addr[DFmode].reload_store = CODE_FOR_reload_df_si_store;
13709
+ reg_addr[DFmode].reload_load = CODE_FOR_reload_df_si_load;
13710
+ reg_addr[DDmode].reload_store = CODE_FOR_reload_dd_si_store;
13711
+ reg_addr[DDmode].reload_load = CODE_FOR_reload_dd_si_load;
13713
+ if (TARGET_P8_VECTOR)
13715
+ reg_addr[SFmode].reload_store = CODE_FOR_reload_sf_si_store;
13716
+ reg_addr[SFmode].reload_load = CODE_FOR_reload_sf_si_load;
13717
+ reg_addr[SDmode].reload_store = CODE_FOR_reload_sd_si_store;
13718
+ reg_addr[SDmode].reload_load = CODE_FOR_reload_sd_si_load;
13720
+ if (TARGET_VSX_TIMODE)
13722
+ reg_addr[TImode].reload_store = CODE_FOR_reload_ti_si_store;
13723
+ reg_addr[TImode].reload_load = CODE_FOR_reload_ti_si_load;
13728
@@ -2267,6 +2856,11 @@
13732
+ /* Update the addr mask bits in reg_addr to help secondary reload and go if
13733
+ legitimate address support to figure out the appropriate addressing to
13735
+ rs6000_setup_reg_addr_masks ();
13737
if (global_init_p || TARGET_DEBUG_TARGET)
13739
if (TARGET_DEBUG_REG)
13740
@@ -2369,16 +2963,19 @@
13742
rs6000_builtin_mask_calculate (void)
13744
- return (((TARGET_ALTIVEC) ? RS6000_BTM_ALTIVEC : 0)
13745
- | ((TARGET_VSX) ? RS6000_BTM_VSX : 0)
13746
- | ((TARGET_SPE) ? RS6000_BTM_SPE : 0)
13747
- | ((TARGET_PAIRED_FLOAT) ? RS6000_BTM_PAIRED : 0)
13748
- | ((TARGET_FRE) ? RS6000_BTM_FRE : 0)
13749
- | ((TARGET_FRES) ? RS6000_BTM_FRES : 0)
13750
- | ((TARGET_FRSQRTE) ? RS6000_BTM_FRSQRTE : 0)
13751
- | ((TARGET_FRSQRTES) ? RS6000_BTM_FRSQRTES : 0)
13752
- | ((TARGET_POPCNTD) ? RS6000_BTM_POPCNTD : 0)
13753
- | ((rs6000_cpu == PROCESSOR_CELL) ? RS6000_BTM_CELL : 0));
13754
+ return (((TARGET_ALTIVEC) ? RS6000_BTM_ALTIVEC : 0)
13755
+ | ((TARGET_VSX) ? RS6000_BTM_VSX : 0)
13756
+ | ((TARGET_SPE) ? RS6000_BTM_SPE : 0)
13757
+ | ((TARGET_PAIRED_FLOAT) ? RS6000_BTM_PAIRED : 0)
13758
+ | ((TARGET_FRE) ? RS6000_BTM_FRE : 0)
13759
+ | ((TARGET_FRES) ? RS6000_BTM_FRES : 0)
13760
+ | ((TARGET_FRSQRTE) ? RS6000_BTM_FRSQRTE : 0)
13761
+ | ((TARGET_FRSQRTES) ? RS6000_BTM_FRSQRTES : 0)
13762
+ | ((TARGET_POPCNTD) ? RS6000_BTM_POPCNTD : 0)
13763
+ | ((rs6000_cpu == PROCESSOR_CELL) ? RS6000_BTM_CELL : 0)
13764
+ | ((TARGET_P8_VECTOR) ? RS6000_BTM_P8_VECTOR : 0)
13765
+ | ((TARGET_CRYPTO) ? RS6000_BTM_CRYPTO : 0)
13766
+ | ((TARGET_HTM) ? RS6000_BTM_HTM : 0));
13769
/* Override command line options. Mostly we process the processor type and
13770
@@ -2609,6 +3206,12 @@
13774
+ /* If little-endian, default to -mstrict-align on older processors.
13775
+ Testing for htm matches power8 and later. */
13776
+ if (!BYTES_BIG_ENDIAN
13777
+ && !(processor_target_table[tune_index].target_enable & OPTION_MASK_HTM))
13778
+ rs6000_isa_flags |= ~rs6000_isa_flags_explicit & OPTION_MASK_STRICT_ALIGN;
13780
/* Add some warnings for VSX. */
13783
@@ -2619,15 +3222,13 @@
13784
if (rs6000_isa_flags_explicit & OPTION_MASK_VSX)
13785
msg = N_("-mvsx requires hardware floating point");
13787
- rs6000_isa_flags &= ~ OPTION_MASK_VSX;
13789
+ rs6000_isa_flags &= ~ OPTION_MASK_VSX;
13790
+ rs6000_isa_flags_explicit |= OPTION_MASK_VSX;
13793
else if (TARGET_PAIRED_FLOAT)
13794
msg = N_("-mvsx and -mpaired are incompatible");
13795
- /* The hardware will allow VSX and little endian, but until we make sure
13796
- things like vector select, etc. work don't allow VSX on little endian
13797
- systems at this point. */
13798
- else if (!BYTES_BIG_ENDIAN)
13799
- msg = N_("-mvsx used with little endian code");
13800
else if (TARGET_AVOID_XFORM > 0)
13801
msg = N_("-mvsx needs indexed addressing");
13802
else if (!TARGET_ALTIVEC && (rs6000_isa_flags_explicit
13803
@@ -2647,9 +3248,24 @@
13807
+ /* If hard-float/altivec/vsx were explicitly turned off then don't allow
13808
+ the -mcpu setting to enable options that conflict. */
13809
+ if ((!TARGET_HARD_FLOAT || !TARGET_ALTIVEC || !TARGET_VSX)
13810
+ && (rs6000_isa_flags_explicit & (OPTION_MASK_SOFT_FLOAT
13811
+ | OPTION_MASK_ALTIVEC
13812
+ | OPTION_MASK_VSX)) != 0)
13813
+ rs6000_isa_flags &= ~((OPTION_MASK_P8_VECTOR | OPTION_MASK_CRYPTO
13814
+ | OPTION_MASK_DIRECT_MOVE)
13815
+ & ~rs6000_isa_flags_explicit);
13817
+ if (TARGET_DEBUG_REG || TARGET_DEBUG_TARGET)
13818
+ rs6000_print_isa_options (stderr, 0, "before defaults", rs6000_isa_flags);
13820
/* For the newer switches (vsx, dfp, etc.) set some of the older options,
13821
unless the user explicitly used the -mno-<option> to disable the code. */
13823
+ if (TARGET_P8_VECTOR || TARGET_DIRECT_MOVE || TARGET_CRYPTO)
13824
+ rs6000_isa_flags |= (ISA_2_7_MASKS_SERVER & ~rs6000_isa_flags_explicit);
13825
+ else if (TARGET_VSX)
13826
rs6000_isa_flags |= (ISA_2_6_MASKS_SERVER & ~rs6000_isa_flags_explicit);
13827
else if (TARGET_POPCNTD)
13828
rs6000_isa_flags |= (ISA_2_6_MASKS_EMBEDDED & ~rs6000_isa_flags_explicit);
13829
@@ -2664,6 +3280,69 @@
13830
else if (TARGET_ALTIVEC)
13831
rs6000_isa_flags |= (OPTION_MASK_PPC_GFXOPT & ~rs6000_isa_flags_explicit);
13833
+ if (TARGET_CRYPTO && !TARGET_ALTIVEC)
13835
+ if (rs6000_isa_flags_explicit & OPTION_MASK_CRYPTO)
13836
+ error ("-mcrypto requires -maltivec");
13837
+ rs6000_isa_flags &= ~OPTION_MASK_CRYPTO;
13840
+ if (TARGET_DIRECT_MOVE && !TARGET_VSX)
13842
+ if (rs6000_isa_flags_explicit & OPTION_MASK_DIRECT_MOVE)
13843
+ error ("-mdirect-move requires -mvsx");
13844
+ rs6000_isa_flags &= ~OPTION_MASK_DIRECT_MOVE;
13847
+ if (TARGET_P8_VECTOR && !TARGET_ALTIVEC)
13849
+ if (rs6000_isa_flags_explicit & OPTION_MASK_P8_VECTOR)
13850
+ error ("-mpower8-vector requires -maltivec");
13851
+ rs6000_isa_flags &= ~OPTION_MASK_P8_VECTOR;
13854
+ if (TARGET_P8_VECTOR && !TARGET_VSX)
13856
+ if (rs6000_isa_flags_explicit & OPTION_MASK_P8_VECTOR)
13857
+ error ("-mpower8-vector requires -mvsx");
13858
+ rs6000_isa_flags &= ~OPTION_MASK_P8_VECTOR;
13861
+ if (TARGET_VSX_TIMODE && !TARGET_VSX)
13863
+ if (rs6000_isa_flags_explicit & OPTION_MASK_VSX_TIMODE)
13864
+ error ("-mvsx-timode requires -mvsx");
13865
+ rs6000_isa_flags &= ~OPTION_MASK_VSX_TIMODE;
13868
+ /* The quad memory instructions only works in 64-bit mode. In 32-bit mode,
13869
+ silently turn off quad memory mode. */
13870
+ if (TARGET_QUAD_MEMORY && !TARGET_POWERPC64)
13872
+ if ((rs6000_isa_flags_explicit & OPTION_MASK_QUAD_MEMORY) != 0)
13873
+ warning (0, N_("-mquad-memory requires 64-bit mode"));
13875
+ rs6000_isa_flags &= ~OPTION_MASK_QUAD_MEMORY;
13878
+ /* Enable power8 fusion if we are tuning for power8, even if we aren't
13879
+ generating power8 instructions. */
13880
+ if (!(rs6000_isa_flags_explicit & OPTION_MASK_P8_FUSION))
13881
+ rs6000_isa_flags |= (processor_target_table[tune_index].target_enable
13882
+ & OPTION_MASK_P8_FUSION);
13884
+ /* Power8 does not fuse sign extended loads with the addis. If we are
13885
+ optimizing at high levels for speed, convert a sign extended load into a
13886
+ zero extending load, and an explicit sign extension. */
13887
+ if (TARGET_P8_FUSION
13888
+ && !(rs6000_isa_flags_explicit & OPTION_MASK_P8_FUSION_SIGN)
13889
+ && optimize_function_for_speed_p (cfun)
13890
+ && optimize >= 3)
13891
+ rs6000_isa_flags |= OPTION_MASK_P8_FUSION_SIGN;
13893
+ if (TARGET_DEBUG_REG || TARGET_DEBUG_TARGET)
13894
+ rs6000_print_isa_options (stderr, 0, "after defaults", rs6000_isa_flags);
13896
/* E500mc does "better" if we inline more aggressively. Respect the
13897
user's opinion, though. */
13898
if (rs6000_block_move_inline_limit == 0
13899
@@ -2790,6 +3469,9 @@
13900
if (flag_section_anchors)
13901
TARGET_NO_FP_IN_TOC = 1;
13903
+ if (TARGET_DEBUG_REG || TARGET_DEBUG_TARGET)
13904
+ rs6000_print_isa_options (stderr, 0, "before subtarget", rs6000_isa_flags);
13906
#ifdef SUBTARGET_OVERRIDE_OPTIONS
13907
SUBTARGET_OVERRIDE_OPTIONS;
13909
@@ -2800,6 +3482,9 @@
13910
SUB3TARGET_OVERRIDE_OPTIONS;
13913
+ if (TARGET_DEBUG_REG || TARGET_DEBUG_TARGET)
13914
+ rs6000_print_isa_options (stderr, 0, "after subtarget", rs6000_isa_flags);
13916
/* For the E500 family of cores, reset the single/double FP flags to let us
13917
check that they remain constant across attributes or pragmas. Also,
13918
clear a possible request for string instructions, not supported and which
13919
@@ -2849,16 +3534,19 @@
13920
&& rs6000_cpu != PROCESSOR_POWER5
13921
&& rs6000_cpu != PROCESSOR_POWER6
13922
&& rs6000_cpu != PROCESSOR_POWER7
13923
+ && rs6000_cpu != PROCESSOR_POWER8
13924
&& rs6000_cpu != PROCESSOR_PPCA2
13925
&& rs6000_cpu != PROCESSOR_CELL
13926
&& rs6000_cpu != PROCESSOR_PPC476);
13927
rs6000_sched_groups = (rs6000_cpu == PROCESSOR_POWER4
13928
|| rs6000_cpu == PROCESSOR_POWER5
13929
- || rs6000_cpu == PROCESSOR_POWER7);
13930
+ || rs6000_cpu == PROCESSOR_POWER7
13931
+ || rs6000_cpu == PROCESSOR_POWER8);
13932
rs6000_align_branch_targets = (rs6000_cpu == PROCESSOR_POWER4
13933
|| rs6000_cpu == PROCESSOR_POWER5
13934
|| rs6000_cpu == PROCESSOR_POWER6
13935
|| rs6000_cpu == PROCESSOR_POWER7
13936
+ || rs6000_cpu == PROCESSOR_POWER8
13937
|| rs6000_cpu == PROCESSOR_PPCE500MC
13938
|| rs6000_cpu == PROCESSOR_PPCE500MC64
13939
|| rs6000_cpu == PROCESSOR_PPCE5500
13940
@@ -2988,7 +3676,7 @@
13942
/* We should always be splitting complex arguments, but we can't break
13943
Linux and Darwin ABIs at the moment. For now, only AIX is fixed. */
13944
- if (DEFAULT_ABI != ABI_AIX)
13945
+ if (DEFAULT_ABI == ABI_V4 || DEFAULT_ABI == ABI_DARWIN)
13946
targetm.calls.split_complex_arg = NULL;
13949
@@ -3102,6 +3790,10 @@
13950
rs6000_cost = &power7_cost;
13953
+ case PROCESSOR_POWER8:
13954
+ rs6000_cost = &power8_cost;
13957
case PROCESSOR_PPCA2:
13958
rs6000_cost = &ppca2_cost;
13960
@@ -3274,7 +3966,8 @@
13961
&& (rs6000_cpu == PROCESSOR_POWER4
13962
|| rs6000_cpu == PROCESSOR_POWER5
13963
|| rs6000_cpu == PROCESSOR_POWER6
13964
- || rs6000_cpu == PROCESSOR_POWER7))
13965
+ || rs6000_cpu == PROCESSOR_POWER7
13966
+ || rs6000_cpu == PROCESSOR_POWER8))
13969
return align_loops_log;
13970
@@ -3813,6 +4506,22 @@
13971
enum built_in_function fn = DECL_FUNCTION_CODE (fndecl);
13974
+ case BUILT_IN_CLZIMAX:
13975
+ case BUILT_IN_CLZLL:
13976
+ case BUILT_IN_CLZL:
13977
+ case BUILT_IN_CLZ:
13978
+ if (TARGET_P8_VECTOR && in_mode == out_mode && out_n == in_n)
13980
+ if (out_mode == QImode && out_n == 16)
13981
+ return rs6000_builtin_decls[P8V_BUILTIN_VCLZB];
13982
+ else if (out_mode == HImode && out_n == 8)
13983
+ return rs6000_builtin_decls[P8V_BUILTIN_VCLZH];
13984
+ else if (out_mode == SImode && out_n == 4)
13985
+ return rs6000_builtin_decls[P8V_BUILTIN_VCLZW];
13986
+ else if (out_mode == DImode && out_n == 2)
13987
+ return rs6000_builtin_decls[P8V_BUILTIN_VCLZD];
13990
case BUILT_IN_COPYSIGN:
13991
if (VECTOR_UNIT_VSX_P (V2DFmode)
13992
&& out_mode == DFmode && out_n == 2
13993
@@ -3828,6 +4537,22 @@
13994
if (VECTOR_UNIT_ALTIVEC_P (V4SFmode))
13995
return rs6000_builtin_decls[ALTIVEC_BUILTIN_COPYSIGN_V4SF];
13997
+ case BUILT_IN_POPCOUNTIMAX:
13998
+ case BUILT_IN_POPCOUNTLL:
13999
+ case BUILT_IN_POPCOUNTL:
14000
+ case BUILT_IN_POPCOUNT:
14001
+ if (TARGET_P8_VECTOR && in_mode == out_mode && out_n == in_n)
14003
+ if (out_mode == QImode && out_n == 16)
14004
+ return rs6000_builtin_decls[P8V_BUILTIN_VPOPCNTB];
14005
+ else if (out_mode == HImode && out_n == 8)
14006
+ return rs6000_builtin_decls[P8V_BUILTIN_VPOPCNTH];
14007
+ else if (out_mode == SImode && out_n == 4)
14008
+ return rs6000_builtin_decls[P8V_BUILTIN_VPOPCNTW];
14009
+ else if (out_mode == DImode && out_n == 2)
14010
+ return rs6000_builtin_decls[P8V_BUILTIN_VPOPCNTD];
14013
case BUILT_IN_SQRT:
14014
if (VECTOR_UNIT_VSX_P (V2DFmode)
14015
&& out_mode == DFmode && out_n == 2
14016
@@ -4043,7 +4768,11 @@
14020
- if (DEFAULT_ABI == ABI_AIX || (TARGET_ELF && flag_pic == 2))
14021
+ if (DEFAULT_ABI == ABI_ELFv2)
14022
+ fprintf (file, "\t.abiversion 2\n");
14024
+ if (DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_ELFv2
14025
+ || (TARGET_ELF && flag_pic == 2))
14027
switch_to_section (toc_section);
14028
switch_to_section (text_section);
14029
@@ -4274,15 +5003,16 @@
14031
/* Check if VAL is present in every STEP-th element, and the
14032
other elements are filled with its most significant bit. */
14033
- for (i = 0; i < nunits - 1; ++i)
14034
+ for (i = 1; i < nunits; ++i)
14036
HOST_WIDE_INT desired_val;
14037
- if (((BYTES_BIG_ENDIAN ? i + 1 : i) & (step - 1)) == 0)
14038
+ unsigned elt = BYTES_BIG_ENDIAN ? nunits - 1 - i : i;
14039
+ if ((i & (step - 1)) == 0)
14042
desired_val = msb_val;
14044
- if (desired_val != const_vector_elt_as_int (op, i))
14045
+ if (desired_val != const_vector_elt_as_int (op, elt))
14049
@@ -4698,8 +5428,11 @@
14051
rtx freg = gen_reg_rtx (V4SFmode);
14052
rtx sreg = force_reg (SFmode, XVECEXP (vals, 0, 0));
14053
+ rtx cvt = ((TARGET_XSCVDPSPN)
14054
+ ? gen_vsx_xscvdpspn_scalar (freg, sreg)
14055
+ : gen_vsx_xscvdpsp_scalar (freg, sreg));
14057
- emit_insn (gen_vsx_xscvdpsp_scalar (freg, sreg));
14059
emit_insn (gen_vsx_xxspltw_v4sf (target, freg, const0_rtx));
14062
@@ -4726,6 +5459,7 @@
14063
of 64-bit items is not supported on Altivec. */
14064
if (all_same && GET_MODE_SIZE (inner_mode) <= 4)
14067
mem = assign_stack_temp (mode, GET_MODE_SIZE (inner_mode));
14068
emit_move_insn (adjust_address_nv (mem, inner_mode, 0),
14069
XVECEXP (vals, 0, 0));
14070
@@ -4736,9 +5470,11 @@
14071
gen_rtx_SET (VOIDmode,
14074
+ field = (BYTES_BIG_ENDIAN ? const0_rtx
14075
+ : GEN_INT (GET_MODE_NUNITS (mode) - 1));
14076
x = gen_rtx_VEC_SELECT (inner_mode, target,
14077
gen_rtx_PARALLEL (VOIDmode,
14078
- gen_rtvec (1, const0_rtx)));
14079
+ gen_rtvec (1, field)));
14080
emit_insn (gen_rtx_SET (VOIDmode, target,
14081
gen_rtx_VEC_DUPLICATE (mode, x)));
14083
@@ -4811,10 +5547,27 @@
14084
XVECEXP (mask, 0, elt*width + i)
14085
= GEN_INT (i + 0x10);
14086
x = gen_rtx_CONST_VECTOR (V16QImode, XVEC (mask, 0));
14087
- x = gen_rtx_UNSPEC (mode,
14088
- gen_rtvec (3, target, reg,
14089
- force_reg (V16QImode, x)),
14092
+ if (BYTES_BIG_ENDIAN)
14093
+ x = gen_rtx_UNSPEC (mode,
14094
+ gen_rtvec (3, target, reg,
14095
+ force_reg (V16QImode, x)),
14099
+ /* Invert selector. */
14100
+ rtx splat = gen_rtx_VEC_DUPLICATE (V16QImode,
14101
+ gen_rtx_CONST_INT (QImode, -1));
14102
+ rtx tmp = gen_reg_rtx (V16QImode);
14103
+ emit_move_insn (tmp, splat);
14104
+ x = gen_rtx_MINUS (V16QImode, tmp, force_reg (V16QImode, x));
14105
+ emit_move_insn (tmp, x);
14107
+ /* Permute with operands reversed and adjusted selector. */
14108
+ x = gen_rtx_UNSPEC (mode, gen_rtvec (3, reg, target, tmp),
14112
emit_insn (gen_rtx_SET (VOIDmode, target, x));
14115
@@ -4938,7 +5691,7 @@
14117
if (GET_CODE (op) == SUBREG
14118
&& (mode == SImode || mode == DImode || mode == TImode
14119
- || mode == DDmode || mode == TDmode)
14120
+ || mode == DDmode || mode == TDmode || mode == PTImode)
14121
&& REG_P (SUBREG_REG (op))
14122
&& (GET_MODE (SUBREG_REG (op)) == DFmode
14123
|| GET_MODE (SUBREG_REG (op)) == TFmode))
14124
@@ -4951,6 +5704,7 @@
14125
&& REG_P (SUBREG_REG (op))
14126
&& (GET_MODE (SUBREG_REG (op)) == DImode
14127
|| GET_MODE (SUBREG_REG (op)) == TImode
14128
+ || GET_MODE (SUBREG_REG (op)) == PTImode
14129
|| GET_MODE (SUBREG_REG (op)) == DDmode
14130
|| GET_MODE (SUBREG_REG (op)) == TDmode))
14132
@@ -5087,6 +5841,72 @@
14133
|| (REG_P (op1) && INT_REGNO_P (REGNO (op1))));
14136
+/* Return true if this is a move direct operation between GPR registers and
14137
+ floating point/VSX registers. */
14140
+direct_move_p (rtx op0, rtx op1)
14142
+ int regno0, regno1;
14144
+ if (!REG_P (op0) || !REG_P (op1))
14147
+ if (!TARGET_DIRECT_MOVE && !TARGET_MFPGPR)
14150
+ regno0 = REGNO (op0);
14151
+ regno1 = REGNO (op1);
14152
+ if (regno0 >= FIRST_PSEUDO_REGISTER || regno1 >= FIRST_PSEUDO_REGISTER)
14155
+ if (INT_REGNO_P (regno0))
14156
+ return (TARGET_DIRECT_MOVE) ? VSX_REGNO_P (regno1) : FP_REGNO_P (regno1);
14158
+ else if (INT_REGNO_P (regno1))
14160
+ if (TARGET_MFPGPR && FP_REGNO_P (regno0))
14163
+ else if (TARGET_DIRECT_MOVE && VSX_REGNO_P (regno0))
14170
+/* Return true if this is a load or store quad operation. */
14173
+quad_load_store_p (rtx op0, rtx op1)
14177
+ if (!TARGET_QUAD_MEMORY)
14180
+ else if (REG_P (op0) && MEM_P (op1))
14181
+ ret = (quad_int_reg_operand (op0, GET_MODE (op0))
14182
+ && quad_memory_operand (op1, GET_MODE (op1))
14183
+ && !reg_overlap_mentioned_p (op0, op1));
14185
+ else if (MEM_P (op0) && REG_P (op1))
14186
+ ret = (quad_memory_operand (op0, GET_MODE (op0))
14187
+ && quad_int_reg_operand (op1, GET_MODE (op1)));
14192
+ if (TARGET_DEBUG_ADDR)
14194
+ fprintf (stderr, "\n========== quad_load_store, return %s\n",
14195
+ ret ? "true" : "false");
14196
+ debug_rtx (gen_rtx_SET (VOIDmode, op0, op1));
14202
/* Given an address, return a constant offset term if one exists. */
14205
@@ -5170,7 +5990,11 @@
14209
- /* AltiVec/VSX vector modes. Only reg+reg addressing is valid. */
14211
+ /* AltiVec/VSX vector modes. Only reg+reg addressing is valid. While
14212
+ TImode is not a vector mode, if we want to use the VSX registers to
14213
+ move it around, we need to restrict ourselves to reg+reg
14215
if (VECTOR_MEM_ALTIVEC_OR_VSX_P (mode))
14218
@@ -5184,6 +6008,13 @@
14223
+ /* If we can do direct load/stores of SDmode, restrict it to reg+reg
14224
+ addressing for the LFIWZX and STFIWX instructions. */
14225
+ if (TARGET_NO_SDMODE_STACK)
14232
@@ -5416,7 +6247,7 @@
14234
/* If we are using VSX scalar loads, restrict ourselves to reg+reg
14236
- if (mode == DFmode && VECTOR_MEM_VSX_P (DFmode))
14237
+ if (VECTOR_MEM_VSX_P (mode))
14241
@@ -5428,6 +6259,7 @@
14246
if (TARGET_E500_DOUBLE)
14247
return (SPE_CONST_OFFSET_OK (offset)
14248
&& SPE_CONST_OFFSET_OK (offset + 8));
14249
@@ -5527,7 +6359,7 @@
14251
if (TARGET_ELF || TARGET_MACHO)
14253
- if (DEFAULT_ABI != ABI_AIX && DEFAULT_ABI != ABI_DARWIN && flag_pic)
14254
+ if (DEFAULT_ABI == ABI_V4 && flag_pic)
14258
@@ -5583,8 +6415,11 @@
14259
if (GET_CODE (x) == PLUS && XEXP (x, 1) == const0_rtx)
14260
return force_reg (Pmode, XEXP (x, 0));
14262
+ /* For TImode with load/store quad, restrict addresses to just a single
14263
+ pointer, so it works with both GPRs and VSX registers. */
14264
/* Make sure both operands are registers. */
14265
- else if (GET_CODE (x) == PLUS)
14266
+ else if (GET_CODE (x) == PLUS
14267
+ && (mode != TImode || !TARGET_QUAD_MEMORY))
14268
return gen_rtx_PLUS (Pmode,
14269
force_reg (Pmode, XEXP (x, 0)),
14270
force_reg (Pmode, XEXP (x, 1)));
14271
@@ -5604,11 +6439,12 @@
14276
/* As in legitimate_offset_address_p we do not assume
14277
worst-case. The mode here is just a hint as to the registers
14278
used. A TImode is usually in gprs, but may actually be in
14279
fprs. Leave worst-case scenario for reload to handle via
14280
- insn constraints. */
14281
+ insn constraints. PTImode is only GPRs. */
14285
@@ -6100,10 +6936,13 @@
14286
1, const0_rtx, Pmode);
14288
r3 = gen_rtx_REG (Pmode, 3);
14289
- if (DEFAULT_ABI == ABI_AIX && TARGET_64BIT)
14290
- insn = gen_tls_gd_aix64 (r3, got, addr, tga, const0_rtx);
14291
- else if (DEFAULT_ABI == ABI_AIX && !TARGET_64BIT)
14292
- insn = gen_tls_gd_aix32 (r3, got, addr, tga, const0_rtx);
14293
+ if (DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_ELFv2)
14295
+ if (TARGET_64BIT)
14296
+ insn = gen_tls_gd_aix64 (r3, got, addr, tga, const0_rtx);
14298
+ insn = gen_tls_gd_aix32 (r3, got, addr, tga, const0_rtx);
14300
else if (DEFAULT_ABI == ABI_V4)
14301
insn = gen_tls_gd_sysvsi (r3, got, addr, tga, const0_rtx);
14303
@@ -6122,10 +6961,13 @@
14304
1, const0_rtx, Pmode);
14306
r3 = gen_rtx_REG (Pmode, 3);
14307
- if (DEFAULT_ABI == ABI_AIX && TARGET_64BIT)
14308
- insn = gen_tls_ld_aix64 (r3, got, tga, const0_rtx);
14309
- else if (DEFAULT_ABI == ABI_AIX && !TARGET_64BIT)
14310
- insn = gen_tls_ld_aix32 (r3, got, tga, const0_rtx);
14311
+ if (DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_ELFv2)
14313
+ if (TARGET_64BIT)
14314
+ insn = gen_tls_ld_aix64 (r3, got, tga, const0_rtx);
14316
+ insn = gen_tls_ld_aix32 (r3, got, tga, const0_rtx);
14318
else if (DEFAULT_ABI == ABI_V4)
14319
insn = gen_tls_ld_sysvsi (r3, got, tga, const0_rtx);
14321
@@ -6339,7 +7181,7 @@
14322
&& !(TARGET_E500_DOUBLE && (mode == DFmode || mode == TFmode
14323
|| mode == DDmode || mode == TDmode
14324
|| mode == DImode))
14325
- && VECTOR_MEM_NONE_P (mode))
14326
+ && (!VECTOR_MODE_P (mode) || VECTOR_MEM_NONE_P (mode)))
14328
HOST_WIDE_INT val = INTVAL (XEXP (x, 1));
14329
HOST_WIDE_INT low = ((val & 0xffff) ^ 0x8000) - 0x8000;
14330
@@ -6370,7 +7212,7 @@
14332
if (GET_CODE (x) == SYMBOL_REF
14334
- && VECTOR_MEM_NONE_P (mode)
14335
+ && (!VECTOR_MODE_P (mode) || VECTOR_MEM_NONE_P (mode))
14336
&& !SPE_VECTOR_MODE (mode)
14338
&& DEFAULT_ABI == ABI_DARWIN
14339
@@ -6396,6 +7238,8 @@
14340
mem is sufficiently aligned. */
14343
+ && (mode != TImode || !TARGET_VSX_TIMODE)
14344
+ && mode != PTImode
14345
&& (mode != DImode || TARGET_POWERPC64)
14346
&& ((mode != DFmode && mode != DDmode) || TARGET_POWERPC64
14347
|| (TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT)))
14348
@@ -6516,15 +7360,9 @@
14350
if (legitimate_indirect_address_p (x, reg_ok_strict))
14352
- if ((GET_CODE (x) == PRE_INC || GET_CODE (x) == PRE_DEC)
14353
- && !VECTOR_MEM_ALTIVEC_OR_VSX_P (mode)
14354
- && !SPE_VECTOR_MODE (mode)
14355
- && mode != TFmode
14356
- && mode != TDmode
14357
- /* Restrict addressing for DI because of our SUBREG hackery. */
14358
- && !(TARGET_E500_DOUBLE
14359
- && (mode == DFmode || mode == DDmode || mode == DImode))
14361
+ if (TARGET_UPDATE
14362
+ && (GET_CODE (x) == PRE_INC || GET_CODE (x) == PRE_DEC)
14363
+ && mode_supports_pre_incdec_p (mode)
14364
&& legitimate_indirect_address_p (XEXP (x, 0), reg_ok_strict))
14366
if (virtual_stack_registers_memory_p (x))
14367
@@ -6534,6 +7372,13 @@
14369
&& legitimate_constant_pool_address_p (x, mode, reg_ok_strict))
14371
+ /* For TImode, if we have load/store quad and TImode in VSX registers, only
14372
+ allow register indirect addresses. This will allow the values to go in
14373
+ either GPRs or VSX registers without reloading. The vector types would
14374
+ tend to go into VSX registers, so we allow REG+REG, while TImode seems
14375
+ somewhat split, in that some uses are GPR based, and some VSX based. */
14376
+ if (mode == TImode && TARGET_QUAD_MEMORY && TARGET_VSX_TIMODE)
14378
/* If not REG_OK_STRICT (before reload) let pass any stack offset. */
14379
if (! reg_ok_strict
14381
@@ -6545,31 +7390,20 @@
14383
if (rs6000_legitimate_offset_address_p (mode, x, reg_ok_strict, false))
14385
- if (mode != TImode
14386
- && mode != TFmode
14387
+ if (mode != TFmode
14389
&& ((TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT)
14390
|| TARGET_POWERPC64
14391
|| (mode != DFmode && mode != DDmode)
14392
|| (TARGET_E500_DOUBLE && mode != DDmode))
14393
&& (TARGET_POWERPC64 || mode != DImode)
14394
+ && (mode != TImode || VECTOR_MEM_VSX_P (TImode))
14395
+ && mode != PTImode
14396
&& !avoiding_indexed_address_p (mode)
14397
&& legitimate_indexed_address_p (x, reg_ok_strict))
14399
- if (GET_CODE (x) == PRE_MODIFY
14400
- && mode != TImode
14401
- && mode != TFmode
14402
- && mode != TDmode
14403
- && ((TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT)
14404
- || TARGET_POWERPC64
14405
- || ((mode != DFmode && mode != DDmode) || TARGET_E500_DOUBLE))
14406
- && (TARGET_POWERPC64 || mode != DImode)
14407
- && !VECTOR_MEM_ALTIVEC_OR_VSX_P (mode)
14408
- && !SPE_VECTOR_MODE (mode)
14409
- /* Restrict addressing for DI because of our SUBREG hackery. */
14410
- && !(TARGET_E500_DOUBLE
14411
- && (mode == DFmode || mode == DDmode || mode == DImode))
14413
+ if (TARGET_UPDATE && GET_CODE (x) == PRE_MODIFY
14414
+ && mode_supports_pre_modify_p (mode)
14415
&& legitimate_indirect_address_p (XEXP (x, 0), reg_ok_strict)
14416
&& (rs6000_legitimate_offset_address_p (mode, XEXP (x, 1),
14417
reg_ok_strict, false)
14418
@@ -6590,10 +7424,13 @@
14419
bool ret = rs6000_legitimate_address_p (mode, x, reg_ok_strict);
14421
"\nrs6000_legitimate_address_p: return = %s, mode = %s, "
14422
- "strict = %d, code = %s\n",
14423
+ "strict = %d, reload = %s, code = %s\n",
14424
ret ? "true" : "false",
14425
GET_MODE_NAME (mode),
14427
+ (reload_completed
14429
+ : (reload_in_progress ? "progress" : "before")),
14430
GET_RTX_NAME (GET_CODE (x)));
14433
@@ -6759,7 +7596,7 @@
14435
/* The TOC register is not killed across calls in a way that is
14436
visible to the compiler. */
14437
- if (DEFAULT_ABI == ABI_AIX)
14438
+ if (DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_ELFv2)
14439
call_really_used_regs[2] = 0;
14441
if (DEFAULT_ABI == ABI_V4
14442
@@ -7007,7 +7844,7 @@
14445
/* Helper for the following. Get rid of [r+r] memory refs
14446
- in cases where it won't work (TImode, TFmode, TDmode). */
14447
+ in cases where it won't work (TImode, TFmode, TDmode, PTImode). */
14450
rs6000_eliminate_indexed_memrefs (rtx operands[2])
14451
@@ -7032,6 +7869,107 @@
14452
copy_addr_to_reg (XEXP (operands[1], 0)));
14455
+/* Generate a vector of constants to permute MODE for a little-endian
14456
+ storage operation by swapping the two halves of a vector. */
14458
+rs6000_const_vec (enum machine_mode mode)
14480
+ gcc_unreachable();
14483
+ v = rtvec_alloc (subparts);
14485
+ for (i = 0; i < subparts / 2; ++i)
14486
+ RTVEC_ELT (v, i) = gen_rtx_CONST_INT (DImode, i + subparts / 2);
14487
+ for (i = subparts / 2; i < subparts; ++i)
14488
+ RTVEC_ELT (v, i) = gen_rtx_CONST_INT (DImode, i - subparts / 2);
14493
+/* Generate a permute rtx that represents an lxvd2x, stxvd2x, or xxpermdi
14494
+ for a VSX load or store operation. */
14496
+rs6000_gen_le_vsx_permute (rtx source, enum machine_mode mode)
14498
+ rtx par = gen_rtx_PARALLEL (VOIDmode, rs6000_const_vec (mode));
14499
+ return gen_rtx_VEC_SELECT (mode, source, par);
14502
+/* Emit a little-endian load from vector memory location SOURCE to VSX
14503
+ register DEST in mode MODE. The load is done with two permuting
14504
+ insn's that represent an lxvd2x and xxpermdi. */
14506
+rs6000_emit_le_vsx_load (rtx dest, rtx source, enum machine_mode mode)
14508
+ rtx tmp = can_create_pseudo_p () ? gen_reg_rtx_and_attrs (dest) : dest;
14509
+ rtx permute_mem = rs6000_gen_le_vsx_permute (source, mode);
14510
+ rtx permute_reg = rs6000_gen_le_vsx_permute (tmp, mode);
14511
+ emit_insn (gen_rtx_SET (VOIDmode, tmp, permute_mem));
14512
+ emit_insn (gen_rtx_SET (VOIDmode, dest, permute_reg));
14515
+/* Emit a little-endian store to vector memory location DEST from VSX
14516
+ register SOURCE in mode MODE. The store is done with two permuting
14517
+ insn's that represent an xxpermdi and an stxvd2x. */
14519
+rs6000_emit_le_vsx_store (rtx dest, rtx source, enum machine_mode mode)
14521
+ rtx tmp = can_create_pseudo_p () ? gen_reg_rtx_and_attrs (source) : source;
14522
+ rtx permute_src = rs6000_gen_le_vsx_permute (source, mode);
14523
+ rtx permute_tmp = rs6000_gen_le_vsx_permute (tmp, mode);
14524
+ emit_insn (gen_rtx_SET (VOIDmode, tmp, permute_src));
14525
+ emit_insn (gen_rtx_SET (VOIDmode, dest, permute_tmp));
14528
+/* Emit a sequence representing a little-endian VSX load or store,
14529
+ moving data from SOURCE to DEST in mode MODE. This is done
14530
+ separately from rs6000_emit_move to ensure it is called only
14531
+ during expand. LE VSX loads and stores introduced later are
14532
+ handled with a split. The expand-time RTL generation allows
14533
+ us to optimize away redundant pairs of register-permutes. */
14535
+rs6000_emit_le_vsx_move (rtx dest, rtx source, enum machine_mode mode)
14537
+ gcc_assert (!BYTES_BIG_ENDIAN
14538
+ && VECTOR_MEM_VSX_P (mode)
14539
+ && mode != TImode
14540
+ && !gpr_or_gpr_p (dest, source)
14541
+ && (MEM_P (source) ^ MEM_P (dest)));
14543
+ if (MEM_P (source))
14545
+ gcc_assert (REG_P (dest));
14546
+ rs6000_emit_le_vsx_load (dest, source, mode);
14550
+ if (!REG_P (source))
14551
+ source = force_reg (mode, source);
14552
+ rs6000_emit_le_vsx_store (dest, source, mode);
14556
/* Emit a move from SOURCE to DEST in mode MODE. */
14558
rs6000_emit_move (rtx dest, rtx source, enum machine_mode mode)
14559
@@ -7152,6 +8090,7 @@
14561
if (reload_in_progress
14563
+ && cfun->machine->sdmode_stack_slot != NULL_RTX
14564
&& MEM_P (operands[0])
14565
&& rtx_equal_p (operands[0], cfun->machine->sdmode_stack_slot)
14566
&& REG_P (operands[1]))
14567
@@ -7164,7 +8103,9 @@
14569
else if (INT_REGNO_P (REGNO (operands[1])))
14571
- rtx mem = adjust_address_nv (operands[0], mode, 4);
14572
+ rtx mem = operands[0];
14573
+ if (BYTES_BIG_ENDIAN)
14574
+ mem = adjust_address_nv (mem, mode, 4);
14575
mem = eliminate_regs (mem, VOIDmode, NULL_RTX);
14576
emit_insn (gen_movsd_hardfloat (mem, operands[1]));
14578
@@ -7176,6 +8117,7 @@
14580
&& REG_P (operands[0])
14581
&& MEM_P (operands[1])
14582
+ && cfun->machine->sdmode_stack_slot != NULL_RTX
14583
&& rtx_equal_p (operands[1], cfun->machine->sdmode_stack_slot))
14585
if (FP_REGNO_P (REGNO (operands[0])))
14586
@@ -7186,7 +8128,9 @@
14588
else if (INT_REGNO_P (REGNO (operands[0])))
14590
- rtx mem = adjust_address_nv (operands[1], mode, 4);
14591
+ rtx mem = operands[1];
14592
+ if (BYTES_BIG_ENDIAN)
14593
+ mem = adjust_address_nv (mem, mode, 4);
14594
mem = eliminate_regs (mem, VOIDmode, NULL_RTX);
14595
emit_insn (gen_movsd_hardfloat (operands[0], mem));
14597
@@ -7389,6 +8333,11 @@
14601
+ if (!VECTOR_MEM_VSX_P (TImode))
14602
+ rs6000_eliminate_indexed_memrefs (operands);
14606
rs6000_eliminate_indexed_memrefs (operands);
14609
@@ -7427,18 +8376,231 @@
14612
/* Nonzero if we can use a floating-point register to pass this arg. */
14613
-#define USE_FP_FOR_ARG_P(CUM,MODE,TYPE) \
14614
+#define USE_FP_FOR_ARG_P(CUM,MODE) \
14615
(SCALAR_FLOAT_MODE_P (MODE) \
14616
&& (CUM)->fregno <= FP_ARG_MAX_REG \
14617
&& TARGET_HARD_FLOAT && TARGET_FPRS)
14619
/* Nonzero if we can use an AltiVec register to pass this arg. */
14620
-#define USE_ALTIVEC_FOR_ARG_P(CUM,MODE,TYPE,NAMED) \
14621
+#define USE_ALTIVEC_FOR_ARG_P(CUM,MODE,NAMED) \
14622
(ALTIVEC_OR_VSX_VECTOR_MODE (MODE) \
14623
&& (CUM)->vregno <= ALTIVEC_ARG_MAX_REG \
14624
&& TARGET_ALTIVEC_ABI \
14627
+/* Walk down the type tree of TYPE counting consecutive base elements.
14628
+ If *MODEP is VOIDmode, then set it to the first valid floating point
14629
+ or vector type. If a non-floating point or vector type is found, or
14630
+ if a floating point or vector type that doesn't match a non-VOIDmode
14631
+ *MODEP is found, then return -1, otherwise return the count in the
14635
+rs6000_aggregate_candidate (const_tree type, enum machine_mode *modep)
14637
+ enum machine_mode mode;
14638
+ HOST_WIDE_INT size;
14640
+ switch (TREE_CODE (type))
14643
+ mode = TYPE_MODE (type);
14644
+ if (!SCALAR_FLOAT_MODE_P (mode))
14647
+ if (*modep == VOIDmode)
14650
+ if (*modep == mode)
14655
+ case COMPLEX_TYPE:
14656
+ mode = TYPE_MODE (TREE_TYPE (type));
14657
+ if (!SCALAR_FLOAT_MODE_P (mode))
14660
+ if (*modep == VOIDmode)
14663
+ if (*modep == mode)
14668
+ case VECTOR_TYPE:
14669
+ if (!TARGET_ALTIVEC_ABI || !TARGET_ALTIVEC)
14672
+ /* Use V4SImode as representative of all 128-bit vector types. */
14673
+ size = int_size_in_bytes (type);
14683
+ if (*modep == VOIDmode)
14686
+ /* Vector modes are considered to be opaque: two vectors are
14687
+ equivalent for the purposes of being homogeneous aggregates
14688
+ if they are the same size. */
14689
+ if (*modep == mode)
14697
+ tree index = TYPE_DOMAIN (type);
14699
+ /* Can't handle incomplete types. */
14700
+ if (!COMPLETE_TYPE_P (type))
14703
+ count = rs6000_aggregate_candidate (TREE_TYPE (type), modep);
14706
+ || !TYPE_MAX_VALUE (index)
14707
+ || !host_integerp (TYPE_MAX_VALUE (index), 1)
14708
+ || !TYPE_MIN_VALUE (index)
14709
+ || !host_integerp (TYPE_MIN_VALUE (index), 1)
14713
+ count *= (1 + tree_low_cst (TYPE_MAX_VALUE (index), 1)
14714
+ - tree_low_cst (TYPE_MIN_VALUE (index), 1));
14716
+ /* There must be no padding. */
14717
+ if (!host_integerp (TYPE_SIZE (type), 1)
14718
+ || (tree_low_cst (TYPE_SIZE (type), 1)
14719
+ != count * GET_MODE_BITSIZE (*modep)))
14725
+ case RECORD_TYPE:
14731
+ /* Can't handle incomplete types. */
14732
+ if (!COMPLETE_TYPE_P (type))
14735
+ for (field = TYPE_FIELDS (type); field; field = TREE_CHAIN (field))
14737
+ if (TREE_CODE (field) != FIELD_DECL)
14740
+ sub_count = rs6000_aggregate_candidate (TREE_TYPE (field), modep);
14741
+ if (sub_count < 0)
14743
+ count += sub_count;
14746
+ /* There must be no padding. */
14747
+ if (!host_integerp (TYPE_SIZE (type), 1)
14748
+ || (tree_low_cst (TYPE_SIZE (type), 1)
14749
+ != count * GET_MODE_BITSIZE (*modep)))
14756
+ case QUAL_UNION_TYPE:
14758
+ /* These aren't very interesting except in a degenerate case. */
14763
+ /* Can't handle incomplete types. */
14764
+ if (!COMPLETE_TYPE_P (type))
14767
+ for (field = TYPE_FIELDS (type); field; field = TREE_CHAIN (field))
14769
+ if (TREE_CODE (field) != FIELD_DECL)
14772
+ sub_count = rs6000_aggregate_candidate (TREE_TYPE (field), modep);
14773
+ if (sub_count < 0)
14775
+ count = count > sub_count ? count : sub_count;
14778
+ /* There must be no padding. */
14779
+ if (!host_integerp (TYPE_SIZE (type), 1)
14780
+ || (tree_low_cst (TYPE_SIZE (type), 1)
14781
+ != count * GET_MODE_BITSIZE (*modep)))
14794
+/* If an argument, whose type is described by TYPE and MODE, is a homogeneous
14795
+ float or vector aggregate that shall be passed in FP/vector registers
14796
+ according to the ELFv2 ABI, return the homogeneous element mode in
14797
+ *ELT_MODE and the number of elements in *N_ELTS, and return TRUE.
14799
+ Otherwise, set *ELT_MODE to MODE and *N_ELTS to 1, and return FALSE. */
14802
+rs6000_discover_homogeneous_aggregate (enum machine_mode mode, const_tree type,
14803
+ enum machine_mode *elt_mode,
14806
+ /* Note that we do not accept complex types at the top level as
14807
+ homogeneous aggregates; these types are handled via the
14808
+ targetm.calls.split_complex_arg mechanism. Complex types
14809
+ can be elements of homogeneous aggregates, however. */
14810
+ if (DEFAULT_ABI == ABI_ELFv2 && type && AGGREGATE_TYPE_P (type))
14812
+ enum machine_mode field_mode = VOIDmode;
14813
+ int field_count = rs6000_aggregate_candidate (type, &field_mode);
14815
+ if (field_count > 0)
14817
+ int n_regs = (SCALAR_FLOAT_MODE_P (field_mode)?
14818
+ (GET_MODE_SIZE (field_mode) + 7) >> 3 : 1);
14820
+ /* The ELFv2 ABI allows homogeneous aggregates to occupy
14821
+ up to AGGR_ARG_NUM_REG registers. */
14822
+ if (field_count * n_regs <= AGGR_ARG_NUM_REG)
14825
+ *elt_mode = field_mode;
14827
+ *n_elts = field_count;
14834
+ *elt_mode = mode;
14840
/* Return a nonzero value to say to return the function value in
14841
memory, just as large structures are always returned. TYPE will be
14842
the data type of the value, and FNTYPE will be the type of the
14843
@@ -7491,6 +8653,16 @@
14844
/* Otherwise fall through to more conventional ABI rules. */
14847
+ /* The ELFv2 ABI returns homogeneous VFP aggregates in registers */
14848
+ if (rs6000_discover_homogeneous_aggregate (TYPE_MODE (type), type,
14852
+ /* The ELFv2 ABI returns aggregates up to 16B in registers */
14853
+ if (DEFAULT_ABI == ABI_ELFv2 && AGGREGATE_TYPE_P (type)
14854
+ && (unsigned HOST_WIDE_INT) int_size_in_bytes (type) <= 16)
14857
if (AGGREGATE_TYPE_P (type)
14858
&& (aix_struct_return
14859
|| (unsigned HOST_WIDE_INT) int_size_in_bytes (type) > 8))
14860
@@ -7522,6 +8694,19 @@
14864
+/* Specify whether values returned in registers should be at the most
14865
+ significant end of a register. We want aggregates returned by
14866
+ value to match the way aggregates are passed to functions. */
14869
+rs6000_return_in_msb (const_tree valtype)
14871
+ return (DEFAULT_ABI == ABI_ELFv2
14872
+ && BYTES_BIG_ENDIAN
14873
+ && AGGREGATE_TYPE_P (valtype)
14874
+ && FUNCTION_ARG_PADDING (TYPE_MODE (valtype), valtype) == upward);
14877
#ifdef HAVE_AS_GNU_ATTRIBUTE
14878
/* Return TRUE if a call to function FNDECL may be one that
14879
potentially affects the function calling ABI of the object file. */
14880
@@ -7658,7 +8843,7 @@
14882
rs6000_must_pass_in_stack (enum machine_mode mode, const_tree type)
14884
- if (DEFAULT_ABI == ABI_AIX || TARGET_64BIT)
14885
+ if (DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_ELFv2 || TARGET_64BIT)
14886
return must_pass_in_stack_var_size (mode, type);
14888
return must_pass_in_stack_var_size_or_pad (mode, type);
14889
@@ -7739,6 +8924,11 @@
14890
static unsigned int
14891
rs6000_function_arg_boundary (enum machine_mode mode, const_tree type)
14893
+ enum machine_mode elt_mode;
14896
+ rs6000_discover_homogeneous_aggregate (mode, type, &elt_mode, &n_elts);
14898
if (DEFAULT_ABI == ABI_V4
14899
&& (GET_MODE_SIZE (mode) == 8
14900
|| (TARGET_HARD_FLOAT
14901
@@ -7750,12 +8940,13 @@
14902
&& int_size_in_bytes (type) >= 8
14903
&& int_size_in_bytes (type) < 16))
14905
- else if (ALTIVEC_OR_VSX_VECTOR_MODE (mode)
14906
+ else if (ALTIVEC_OR_VSX_VECTOR_MODE (elt_mode)
14907
|| (type && TREE_CODE (type) == VECTOR_TYPE
14908
&& int_size_in_bytes (type) >= 16))
14910
- else if (TARGET_MACHO
14911
- && rs6000_darwin64_abi
14912
+ else if (((TARGET_MACHO && rs6000_darwin64_abi)
14913
+ || DEFAULT_ABI == ABI_ELFv2
14914
+ || (DEFAULT_ABI == ABI_AIX && !rs6000_compat_align_parm))
14916
&& type && TYPE_ALIGN (type) > 64)
14918
@@ -7763,6 +8954,16 @@
14919
return PARM_BOUNDARY;
14922
+/* The offset in words to the start of the parameter save area. */
14924
+static unsigned int
14925
+rs6000_parm_offset (void)
14927
+ return (DEFAULT_ABI == ABI_V4 ? 2
14928
+ : DEFAULT_ABI == ABI_ELFv2 ? 4
14932
/* For a function parm of MODE and TYPE, return the starting word in
14933
the parameter area. NWORDS of the parameter area are already used. */
14935
@@ -7771,11 +8972,9 @@
14936
unsigned int nwords)
14938
unsigned int align;
14939
- unsigned int parm_offset;
14941
align = rs6000_function_arg_boundary (mode, type) / PARM_BOUNDARY - 1;
14942
- parm_offset = DEFAULT_ABI == ABI_V4 ? 2 : 6;
14943
- return nwords + (-(parm_offset + nwords) & align);
14944
+ return nwords + (-(rs6000_parm_offset () + nwords) & align);
14947
/* Compute the size (in words) of a function argument. */
14948
@@ -7882,7 +9081,7 @@
14950
if (TREE_CODE (ftype) == RECORD_TYPE)
14951
rs6000_darwin64_record_arg_advance_recurse (cum, ftype, bitpos);
14952
- else if (USE_FP_FOR_ARG_P (cum, mode, ftype))
14953
+ else if (USE_FP_FOR_ARG_P (cum, mode))
14955
unsigned n_fpregs = (GET_MODE_SIZE (mode) + 7) >> 3;
14956
rs6000_darwin64_record_arg_advance_flush (cum, bitpos, 0);
14957
@@ -7923,7 +9122,7 @@
14959
cum->words += n_fpregs;
14961
- else if (USE_ALTIVEC_FOR_ARG_P (cum, mode, type, 1))
14962
+ else if (USE_ALTIVEC_FOR_ARG_P (cum, mode, 1))
14964
rs6000_darwin64_record_arg_advance_flush (cum, bitpos, 0);
14966
@@ -7960,6 +9159,11 @@
14967
rs6000_function_arg_advance_1 (CUMULATIVE_ARGS *cum, enum machine_mode mode,
14968
const_tree type, bool named, int depth)
14970
+ enum machine_mode elt_mode;
14973
+ rs6000_discover_homogeneous_aggregate (mode, type, &elt_mode, &n_elts);
14975
/* Only tick off an argument if we're not recursing. */
14977
cum->nargs_prototype--;
14978
@@ -7980,15 +9184,16 @@
14981
if (TARGET_ALTIVEC_ABI
14982
- && (ALTIVEC_OR_VSX_VECTOR_MODE (mode)
14983
+ && (ALTIVEC_OR_VSX_VECTOR_MODE (elt_mode)
14984
|| (type && TREE_CODE (type) == VECTOR_TYPE
14985
&& int_size_in_bytes (type) == 16)))
14987
bool stack = false;
14989
- if (USE_ALTIVEC_FOR_ARG_P (cum, mode, type, named))
14990
+ if (USE_ALTIVEC_FOR_ARG_P (cum, elt_mode, named))
14993
+ cum->vregno += n_elts;
14995
if (!TARGET_ALTIVEC)
14996
error ("cannot pass argument in vector register because"
14997
" altivec instructions are disabled, use -maltivec"
14998
@@ -7997,7 +9202,8 @@
14999
/* PowerPC64 Linux and AIX allocate GPRs for a vector argument
15000
even if it is going to be passed in a vector register.
15001
Darwin does the same for variable-argument functions. */
15002
- if ((DEFAULT_ABI == ABI_AIX && TARGET_64BIT)
15003
+ if (((DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_ELFv2)
15005
|| (cum->stdarg && DEFAULT_ABI != ABI_V4))
15008
@@ -8008,15 +9214,13 @@
15012
- /* Vector parameters must be 16-byte aligned. This places
15013
- them at 2 mod 4 in terms of words in 32-bit mode, since
15014
- the parameter save area starts at offset 24 from the
15015
- stack. In 64-bit mode, they just have to start on an
15016
- even word, since the parameter save area is 16-byte
15017
- aligned. Space for GPRs is reserved even if the argument
15018
- will be passed in memory. */
15019
+ /* Vector parameters must be 16-byte aligned. In 32-bit
15020
+ mode this means we need to take into account the offset
15021
+ to the parameter save area. In 64-bit mode, they just
15022
+ have to start on an even word, since the parameter save
15023
+ area is 16-byte aligned. */
15025
- align = (2 - cum->words) & 3;
15026
+ align = -(rs6000_parm_offset () + cum->words) & 3;
15028
align = cum->words & 1;
15029
cum->words += align + rs6000_arg_size (mode, type);
15030
@@ -8141,15 +9345,15 @@
15032
cum->words = align_words + n_words;
15034
- if (SCALAR_FLOAT_MODE_P (mode)
15035
+ if (SCALAR_FLOAT_MODE_P (elt_mode)
15036
&& TARGET_HARD_FLOAT && TARGET_FPRS)
15038
/* _Decimal128 must be passed in an even/odd float register pair.
15039
This assumes that the register number is odd when fregno is
15041
- if (mode == TDmode && (cum->fregno % 2) == 1)
15042
+ if (elt_mode == TDmode && (cum->fregno % 2) == 1)
15044
- cum->fregno += (GET_MODE_SIZE (mode) + 7) >> 3;
15045
+ cum->fregno += n_elts * ((GET_MODE_SIZE (elt_mode) + 7) >> 3);
15048
if (TARGET_DEBUG_ARG)
15049
@@ -8359,7 +9563,7 @@
15051
if (TREE_CODE (ftype) == RECORD_TYPE)
15052
rs6000_darwin64_record_arg_recurse (cum, ftype, bitpos, rvec, k);
15053
- else if (cum->named && USE_FP_FOR_ARG_P (cum, mode, ftype))
15054
+ else if (cum->named && USE_FP_FOR_ARG_P (cum, mode))
15056
unsigned n_fpreg = (GET_MODE_SIZE (mode) + 7) >> 3;
15058
@@ -8387,7 +9591,7 @@
15059
if (mode == TFmode || mode == TDmode)
15062
- else if (cum->named && USE_ALTIVEC_FOR_ARG_P (cum, mode, ftype, 1))
15063
+ else if (cum->named && USE_ALTIVEC_FOR_ARG_P (cum, mode, 1))
15065
rs6000_darwin64_record_arg_flush (cum, bitpos, rvec, k);
15067
@@ -8504,6 +9708,84 @@
15068
return gen_rtx_PARALLEL (mode, gen_rtvec_v (k, rvec));
15071
+/* We have an argument of MODE and TYPE that goes into FPRs or VRs,
15072
+ but must also be copied into the parameter save area starting at
15073
+ offset ALIGN_WORDS. Fill in RVEC with the elements corresponding
15074
+ to the GPRs and/or memory. Return the number of elements used. */
15077
+rs6000_psave_function_arg (enum machine_mode mode, const_tree type,
15078
+ int align_words, rtx *rvec)
15082
+ if (align_words < GP_ARG_NUM_REG)
15084
+ int n_words = rs6000_arg_size (mode, type);
15086
+ if (align_words + n_words > GP_ARG_NUM_REG
15087
+ || mode == BLKmode
15088
+ || (TARGET_32BIT && TARGET_POWERPC64))
15090
+ /* If this is partially on the stack, then we only
15091
+ include the portion actually in registers here. */
15092
+ enum machine_mode rmode = TARGET_32BIT ? SImode : DImode;
15095
+ if (align_words + n_words > GP_ARG_NUM_REG)
15097
+ /* Not all of the arg fits in gprs. Say that it goes in memory
15098
+ too, using a magic NULL_RTX component. Also see comment in
15099
+ rs6000_mixed_function_arg for why the normal
15100
+ function_arg_partial_nregs scheme doesn't work in this case. */
15101
+ rvec[k++] = gen_rtx_EXPR_LIST (VOIDmode, NULL_RTX, const0_rtx);
15106
+ rtx r = gen_rtx_REG (rmode, GP_ARG_MIN_REG + align_words);
15107
+ rtx off = GEN_INT (i++ * GET_MODE_SIZE (rmode));
15108
+ rvec[k++] = gen_rtx_EXPR_LIST (VOIDmode, r, off);
15110
+ while (++align_words < GP_ARG_NUM_REG && --n_words != 0);
15114
+ /* The whole arg fits in gprs. */
15115
+ rtx r = gen_rtx_REG (mode, GP_ARG_MIN_REG + align_words);
15116
+ rvec[k++] = gen_rtx_EXPR_LIST (VOIDmode, r, const0_rtx);
15121
+ /* It's entirely in memory. */
15122
+ rvec[k++] = gen_rtx_EXPR_LIST (VOIDmode, NULL_RTX, const0_rtx);
15128
+/* RVEC is a vector of K components of an argument of mode MODE.
15129
+ Construct the final function_arg return value from it. */
15132
+rs6000_finish_function_arg (enum machine_mode mode, rtx *rvec, int k)
15134
+ gcc_assert (k >= 1);
15136
+ /* Avoid returning a PARALLEL in the trivial cases. */
15139
+ if (XEXP (rvec[0], 0) == NULL_RTX)
15142
+ if (GET_MODE (XEXP (rvec[0], 0)) == mode)
15143
+ return XEXP (rvec[0], 0);
15146
+ return gen_rtx_PARALLEL (mode, gen_rtvec_v (k, rvec));
15149
/* Determine where to put an argument to a function.
15150
Value is zero to push the argument on the stack,
15151
or a hard register in which to store the argument.
15152
@@ -8538,6 +9820,8 @@
15154
CUMULATIVE_ARGS *cum = get_cumulative_args (cum_v);
15155
enum rs6000_abi abi = DEFAULT_ABI;
15156
+ enum machine_mode elt_mode;
15159
/* Return a marker to indicate whether CR1 needs to set or clear the
15160
bit that V.4 uses to say fp args were passed in registers.
15161
@@ -8564,6 +9848,8 @@
15162
return GEN_INT (cum->call_cookie & ~CALL_LIBCALL);
15165
+ rs6000_discover_homogeneous_aggregate (mode, type, &elt_mode, &n_elts);
15167
if (TARGET_MACHO && rs6000_darwin64_struct_check_p (mode, type))
15169
rtx rslt = rs6000_darwin64_record_arg (cum, type, named, /*retval= */false);
15170
@@ -8572,33 +9858,30 @@
15171
/* Else fall through to usual handling. */
15174
- if (USE_ALTIVEC_FOR_ARG_P (cum, mode, type, named))
15175
- if (TARGET_64BIT && ! cum->prototype)
15177
- /* Vector parameters get passed in vector register
15178
- and also in GPRs or memory, in absence of prototype. */
15181
- align_words = (cum->words + 1) & ~1;
15182
+ if (USE_ALTIVEC_FOR_ARG_P (cum, elt_mode, named))
15184
+ rtx rvec[GP_ARG_NUM_REG + AGGR_ARG_NUM_REG + 1];
15188
- if (align_words >= GP_ARG_NUM_REG)
15194
- slot = gen_rtx_REG (mode, GP_ARG_MIN_REG + align_words);
15196
- return gen_rtx_PARALLEL (mode,
15198
- gen_rtx_EXPR_LIST (VOIDmode,
15199
- slot, const0_rtx),
15200
- gen_rtx_EXPR_LIST (VOIDmode,
15201
- gen_rtx_REG (mode, cum->vregno),
15205
- return gen_rtx_REG (mode, cum->vregno);
15206
+ /* Do we also need to pass this argument in the parameter
15208
+ if (TARGET_64BIT && ! cum->prototype)
15210
+ int align_words = (cum->words + 1) & ~1;
15211
+ k = rs6000_psave_function_arg (mode, type, align_words, rvec);
15214
+ /* Describe where this argument goes in the vector registers. */
15215
+ for (i = 0; i < n_elts && cum->vregno + i <= ALTIVEC_ARG_MAX_REG; i++)
15217
+ r = gen_rtx_REG (elt_mode, cum->vregno + i);
15218
+ off = GEN_INT (i * GET_MODE_SIZE (elt_mode));
15219
+ rvec[k++] = gen_rtx_EXPR_LIST (VOIDmode, r, off);
15222
+ return rs6000_finish_function_arg (mode, rvec, k);
15224
else if (TARGET_ALTIVEC_ABI
15225
&& (ALTIVEC_OR_VSX_VECTOR_MODE (mode)
15226
|| (type && TREE_CODE (type) == VECTOR_TYPE
15227
@@ -8613,13 +9896,13 @@
15228
int align, align_words, n_words;
15229
enum machine_mode part_mode;
15231
- /* Vector parameters must be 16-byte aligned. This places them at
15232
- 2 mod 4 in terms of words in 32-bit mode, since the parameter
15233
- save area starts at offset 24 from the stack. In 64-bit mode,
15234
- they just have to start on an even word, since the parameter
15235
- save area is 16-byte aligned. */
15236
+ /* Vector parameters must be 16-byte aligned. In 32-bit
15237
+ mode this means we need to take into account the offset
15238
+ to the parameter save area. In 64-bit mode, they just
15239
+ have to start on an even word, since the parameter save
15240
+ area is 16-byte aligned. */
15242
- align = (2 - cum->words) & 3;
15243
+ align = -(rs6000_parm_offset () + cum->words) & 3;
15245
align = cum->words & 1;
15246
align_words = cum->words + align;
15247
@@ -8697,101 +9980,50 @@
15249
/* _Decimal128 must be passed in an even/odd float register pair.
15250
This assumes that the register number is odd when fregno is odd. */
15251
- if (mode == TDmode && (cum->fregno % 2) == 1)
15252
+ if (elt_mode == TDmode && (cum->fregno % 2) == 1)
15255
- if (USE_FP_FOR_ARG_P (cum, mode, type))
15256
+ if (USE_FP_FOR_ARG_P (cum, elt_mode))
15258
- rtx rvec[GP_ARG_NUM_REG + 1];
15261
- bool needs_psave;
15262
- enum machine_mode fmode = mode;
15263
- unsigned long n_fpreg = (GET_MODE_SIZE (mode) + 7) >> 3;
15264
+ rtx rvec[GP_ARG_NUM_REG + AGGR_ARG_NUM_REG + 1];
15267
+ unsigned long n_fpreg = (GET_MODE_SIZE (elt_mode) + 7) >> 3;
15269
- if (cum->fregno + n_fpreg > FP_ARG_MAX_REG + 1)
15271
- /* Currently, we only ever need one reg here because complex
15272
- doubles are split. */
15273
- gcc_assert (cum->fregno == FP_ARG_MAX_REG
15274
- && (fmode == TFmode || fmode == TDmode));
15275
+ /* Do we also need to pass this argument in the parameter
15277
+ if (type && (cum->nargs_prototype <= 0
15278
+ || ((DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_ELFv2)
15279
+ && TARGET_XL_COMPAT
15280
+ && align_words >= GP_ARG_NUM_REG)))
15281
+ k = rs6000_psave_function_arg (mode, type, align_words, rvec);
15283
- /* Long double or _Decimal128 split over regs and memory. */
15284
- fmode = DECIMAL_FLOAT_MODE_P (fmode) ? DDmode : DFmode;
15287
- /* Do we also need to pass this arg in the parameter save
15289
- needs_psave = (type
15290
- && (cum->nargs_prototype <= 0
15291
- || (DEFAULT_ABI == ABI_AIX
15292
- && TARGET_XL_COMPAT
15293
- && align_words >= GP_ARG_NUM_REG)));
15295
- if (!needs_psave && mode == fmode)
15296
- return gen_rtx_REG (fmode, cum->fregno);
15300
+ /* Describe where this argument goes in the fprs. */
15301
+ for (i = 0; i < n_elts
15302
+ && cum->fregno + i * n_fpreg <= FP_ARG_MAX_REG; i++)
15304
- /* Describe the part that goes in gprs or the stack.
15305
- This piece must come first, before the fprs. */
15306
- if (align_words < GP_ARG_NUM_REG)
15307
+ /* Check if the argument is split over registers and memory.
15308
+ This can only ever happen for long double or _Decimal128;
15309
+ complex types are handled via split_complex_arg. */
15310
+ enum machine_mode fmode = elt_mode;
15311
+ if (cum->fregno + (i + 1) * n_fpreg > FP_ARG_MAX_REG + 1)
15313
- unsigned long n_words = rs6000_arg_size (mode, type);
15314
+ gcc_assert (fmode == TFmode || fmode == TDmode);
15315
+ fmode = DECIMAL_FLOAT_MODE_P (fmode) ? DDmode : DFmode;
15318
- if (align_words + n_words > GP_ARG_NUM_REG
15319
- || (TARGET_32BIT && TARGET_POWERPC64))
15321
- /* If this is partially on the stack, then we only
15322
- include the portion actually in registers here. */
15323
- enum machine_mode rmode = TARGET_32BIT ? SImode : DImode;
15326
- if (align_words + n_words > GP_ARG_NUM_REG)
15327
- /* Not all of the arg fits in gprs. Say that it
15328
- goes in memory too, using a magic NULL_RTX
15329
- component. Also see comment in
15330
- rs6000_mixed_function_arg for why the normal
15331
- function_arg_partial_nregs scheme doesn't work
15333
- rvec[k++] = gen_rtx_EXPR_LIST (VOIDmode, NULL_RTX,
15337
- r = gen_rtx_REG (rmode,
15338
- GP_ARG_MIN_REG + align_words);
15339
- off = GEN_INT (i++ * GET_MODE_SIZE (rmode));
15340
- rvec[k++] = gen_rtx_EXPR_LIST (VOIDmode, r, off);
15342
- while (++align_words < GP_ARG_NUM_REG && --n_words != 0);
15346
- /* The whole arg fits in gprs. */
15347
- r = gen_rtx_REG (mode, GP_ARG_MIN_REG + align_words);
15348
- rvec[k++] = gen_rtx_EXPR_LIST (VOIDmode, r, const0_rtx);
15352
- /* It's entirely in memory. */
15353
- rvec[k++] = gen_rtx_EXPR_LIST (VOIDmode, NULL_RTX, const0_rtx);
15354
+ r = gen_rtx_REG (fmode, cum->fregno + i * n_fpreg);
15355
+ off = GEN_INT (i * GET_MODE_SIZE (elt_mode));
15356
+ rvec[k++] = gen_rtx_EXPR_LIST (VOIDmode, r, off);
15359
- /* Describe where this piece goes in the fprs. */
15360
- r = gen_rtx_REG (fmode, cum->fregno);
15361
- rvec[k++] = gen_rtx_EXPR_LIST (VOIDmode, r, const0_rtx);
15363
- return gen_rtx_PARALLEL (mode, gen_rtvec_v (k, rvec));
15364
+ return rs6000_finish_function_arg (mode, rvec, k);
15366
else if (align_words < GP_ARG_NUM_REG)
15368
if (TARGET_32BIT && TARGET_POWERPC64)
15369
return rs6000_mixed_function_arg (mode, type, align_words);
15371
- if (mode == BLKmode)
15374
return gen_rtx_REG (mode, GP_ARG_MIN_REG + align_words);
15377
@@ -8810,42 +10042,62 @@
15378
tree type, bool named)
15380
CUMULATIVE_ARGS *cum = get_cumulative_args (cum_v);
15381
+ bool passed_in_gprs = true;
15384
+ enum machine_mode elt_mode;
15387
+ rs6000_discover_homogeneous_aggregate (mode, type, &elt_mode, &n_elts);
15389
if (DEFAULT_ABI == ABI_V4)
15392
- if (USE_ALTIVEC_FOR_ARG_P (cum, mode, type, named)
15393
- && cum->nargs_prototype >= 0)
15395
+ if (USE_ALTIVEC_FOR_ARG_P (cum, elt_mode, named))
15397
+ /* If we are passing this arg in the fixed parameter save area
15398
+ (gprs or memory) as well as VRs, we do not use the partial
15399
+ bytes mechanism; instead, rs6000_function_arg will return a
15400
+ PARALLEL including a memory element as necessary. */
15401
+ if (TARGET_64BIT && ! cum->prototype)
15404
+ /* Otherwise, we pass in VRs only. Check for partial copies. */
15405
+ passed_in_gprs = false;
15406
+ if (cum->vregno + n_elts > ALTIVEC_ARG_MAX_REG + 1)
15407
+ ret = (ALTIVEC_ARG_MAX_REG + 1 - cum->vregno) * 16;
15410
/* In this complicated case we just disable the partial_nregs code. */
15411
if (TARGET_MACHO && rs6000_darwin64_struct_check_p (mode, type))
15414
align_words = rs6000_parm_start (mode, type, cum->words);
15416
- if (USE_FP_FOR_ARG_P (cum, mode, type))
15417
+ if (USE_FP_FOR_ARG_P (cum, elt_mode))
15419
+ unsigned long n_fpreg = (GET_MODE_SIZE (elt_mode) + 7) >> 3;
15421
/* If we are passing this arg in the fixed parameter save area
15422
- (gprs or memory) as well as fprs, then this function should
15423
- return the number of partial bytes passed in the parameter
15424
- save area rather than partial bytes passed in fprs. */
15425
+ (gprs or memory) as well as FPRs, we do not use the partial
15426
+ bytes mechanism; instead, rs6000_function_arg will return a
15427
+ PARALLEL including a memory element as necessary. */
15429
&& (cum->nargs_prototype <= 0
15430
- || (DEFAULT_ABI == ABI_AIX
15431
+ || ((DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_ELFv2)
15432
&& TARGET_XL_COMPAT
15433
&& align_words >= GP_ARG_NUM_REG)))
15435
- else if (cum->fregno + ((GET_MODE_SIZE (mode) + 7) >> 3)
15436
- > FP_ARG_MAX_REG + 1)
15437
- ret = (FP_ARG_MAX_REG + 1 - cum->fregno) * 8;
15438
- else if (cum->nargs_prototype >= 0)
15441
+ /* Otherwise, we pass in FPRs only. Check for partial copies. */
15442
+ passed_in_gprs = false;
15443
+ if (cum->fregno + n_elts * n_fpreg > FP_ARG_MAX_REG + 1)
15444
+ ret = ((FP_ARG_MAX_REG + 1 - cum->fregno)
15445
+ * MIN (8, GET_MODE_SIZE (elt_mode)));
15448
- if (align_words < GP_ARG_NUM_REG
15449
+ if (passed_in_gprs
15450
+ && align_words < GP_ARG_NUM_REG
15451
&& GP_ARG_NUM_REG < align_words + rs6000_arg_size (mode, type))
15452
ret = (GP_ARG_NUM_REG - align_words) * (TARGET_32BIT ? 4 : 8);
15454
@@ -8926,6 +10178,139 @@
15458
+/* Process parameter of type TYPE after ARGS_SO_FAR parameters were
15459
+ already processes. Return true if the parameter must be passed
15460
+ (fully or partially) on the stack. */
15463
+rs6000_parm_needs_stack (cumulative_args_t args_so_far, tree type)
15465
+ enum machine_mode mode;
15469
+ /* Catch errors. */
15470
+ if (type == NULL || type == error_mark_node)
15473
+ /* Handle types with no storage requirement. */
15474
+ if (TYPE_MODE (type) == VOIDmode)
15477
+ /* Handle complex types. */
15478
+ if (TREE_CODE (type) == COMPLEX_TYPE)
15479
+ return (rs6000_parm_needs_stack (args_so_far, TREE_TYPE (type))
15480
+ || rs6000_parm_needs_stack (args_so_far, TREE_TYPE (type)));
15482
+ /* Handle transparent aggregates. */
15483
+ if ((TREE_CODE (type) == UNION_TYPE || TREE_CODE (type) == RECORD_TYPE)
15484
+ && TYPE_TRANSPARENT_AGGR (type))
15485
+ type = TREE_TYPE (first_field (type));
15487
+ /* See if this arg was passed by invisible reference. */
15488
+ if (pass_by_reference (get_cumulative_args (args_so_far),
15489
+ TYPE_MODE (type), type, true))
15490
+ type = build_pointer_type (type);
15492
+ /* Find mode as it is passed by the ABI. */
15493
+ unsignedp = TYPE_UNSIGNED (type);
15494
+ mode = promote_mode (type, TYPE_MODE (type), &unsignedp);
15496
+ /* If we must pass in stack, we need a stack. */
15497
+ if (rs6000_must_pass_in_stack (mode, type))
15500
+ /* If there is no incoming register, we need a stack. */
15501
+ entry_parm = rs6000_function_arg (args_so_far, mode, type, true);
15502
+ if (entry_parm == NULL)
15505
+ /* Likewise if we need to pass both in registers and on the stack. */
15506
+ if (GET_CODE (entry_parm) == PARALLEL
15507
+ && XEXP (XVECEXP (entry_parm, 0, 0), 0) == NULL_RTX)
15510
+ /* Also true if we're partially in registers and partially not. */
15511
+ if (rs6000_arg_partial_bytes (args_so_far, mode, type, true) != 0)
15514
+ /* Update info on where next arg arrives in registers. */
15515
+ rs6000_function_arg_advance (args_so_far, mode, type, true);
15519
+/* Return true if FUN has no prototype, has a variable argument
15520
+ list, or passes any parameter in memory. */
15523
+rs6000_function_parms_need_stack (tree fun)
15525
+ function_args_iterator args_iter;
15527
+ CUMULATIVE_ARGS args_so_far_v;
15528
+ cumulative_args_t args_so_far;
15531
+ /* Must be a libcall, all of which only use reg parms. */
15533
+ if (!TYPE_P (fun))
15534
+ fun = TREE_TYPE (fun);
15536
+ /* Varargs functions need the parameter save area. */
15537
+ if (!prototype_p (fun) || stdarg_p (fun))
15540
+ INIT_CUMULATIVE_INCOMING_ARGS (args_so_far_v, fun, NULL_RTX);
15541
+ args_so_far = pack_cumulative_args (&args_so_far_v);
15543
+ if (aggregate_value_p (TREE_TYPE (fun), fun))
15545
+ tree type = build_pointer_type (TREE_TYPE (fun));
15546
+ rs6000_parm_needs_stack (args_so_far, type);
15549
+ FOREACH_FUNCTION_ARGS (fun, arg_type, args_iter)
15550
+ if (rs6000_parm_needs_stack (args_so_far, arg_type))
15556
+/* Return the size of the REG_PARM_STACK_SPACE are for FUN. This is
15557
+ usually a constant depending on the ABI. However, in the ELFv2 ABI
15558
+ the register parameter area is optional when calling a function that
15559
+ has a prototype is scope, has no variable argument list, and passes
15560
+ all parameters in registers. */
15563
+rs6000_reg_parm_stack_space (tree fun)
15565
+ int reg_parm_stack_space;
15567
+ switch (DEFAULT_ABI)
15570
+ reg_parm_stack_space = 0;
15575
+ reg_parm_stack_space = TARGET_64BIT ? 64 : 32;
15579
+ /* ??? Recomputing this every time is a bit expensive. Is there
15580
+ a place to cache this information? */
15581
+ if (rs6000_function_parms_need_stack (fun))
15582
+ reg_parm_stack_space = TARGET_64BIT ? 64 : 32;
15584
+ reg_parm_stack_space = 0;
15588
+ return reg_parm_stack_space;
15592
rs6000_move_block_from_reg (int regno, rtx x, int nregs)
15594
@@ -9307,8 +10692,10 @@
15595
We don't need to check for pass-by-reference because of the test above.
15596
We can return a simplifed answer, since we know there's no offset to add. */
15599
- && rs6000_darwin64_abi
15600
+ if (((TARGET_MACHO
15601
+ && rs6000_darwin64_abi)
15602
+ || DEFAULT_ABI == ABI_ELFv2
15603
+ || (DEFAULT_ABI == ABI_AIX && !rs6000_compat_align_parm))
15604
&& integer_zerop (TYPE_SIZE (type)))
15606
unsigned HOST_WIDE_INT align, boundary;
15607
@@ -9603,6 +10990,7 @@
15608
#undef RS6000_BUILTIN_A
15609
#undef RS6000_BUILTIN_D
15610
#undef RS6000_BUILTIN_E
15611
+#undef RS6000_BUILTIN_H
15612
#undef RS6000_BUILTIN_P
15613
#undef RS6000_BUILTIN_Q
15614
#undef RS6000_BUILTIN_S
15615
@@ -9616,6 +11004,7 @@
15616
#define RS6000_BUILTIN_A(ENUM, NAME, MASK, ATTR, ICODE)
15617
#define RS6000_BUILTIN_D(ENUM, NAME, MASK, ATTR, ICODE)
15618
#define RS6000_BUILTIN_E(ENUM, NAME, MASK, ATTR, ICODE)
15619
+#define RS6000_BUILTIN_H(ENUM, NAME, MASK, ATTR, ICODE)
15620
#define RS6000_BUILTIN_P(ENUM, NAME, MASK, ATTR, ICODE)
15621
#define RS6000_BUILTIN_Q(ENUM, NAME, MASK, ATTR, ICODE)
15622
#define RS6000_BUILTIN_S(ENUM, NAME, MASK, ATTR, ICODE)
15623
@@ -9634,6 +11023,7 @@
15624
#undef RS6000_BUILTIN_A
15625
#undef RS6000_BUILTIN_D
15626
#undef RS6000_BUILTIN_E
15627
+#undef RS6000_BUILTIN_H
15628
#undef RS6000_BUILTIN_P
15629
#undef RS6000_BUILTIN_Q
15630
#undef RS6000_BUILTIN_S
15631
@@ -9647,6 +11037,7 @@
15632
{ MASK, ICODE, NAME, ENUM },
15634
#define RS6000_BUILTIN_E(ENUM, NAME, MASK, ATTR, ICODE)
15635
+#define RS6000_BUILTIN_H(ENUM, NAME, MASK, ATTR, ICODE)
15636
#define RS6000_BUILTIN_P(ENUM, NAME, MASK, ATTR, ICODE)
15637
#define RS6000_BUILTIN_Q(ENUM, NAME, MASK, ATTR, ICODE)
15638
#define RS6000_BUILTIN_S(ENUM, NAME, MASK, ATTR, ICODE)
15639
@@ -9665,6 +11056,7 @@
15640
#undef RS6000_BUILTIN_A
15641
#undef RS6000_BUILTIN_D
15642
#undef RS6000_BUILTIN_E
15643
+#undef RS6000_BUILTIN_H
15644
#undef RS6000_BUILTIN_P
15645
#undef RS6000_BUILTIN_Q
15646
#undef RS6000_BUILTIN_S
15647
@@ -9678,6 +11070,7 @@
15648
#define RS6000_BUILTIN_A(ENUM, NAME, MASK, ATTR, ICODE)
15649
#define RS6000_BUILTIN_D(ENUM, NAME, MASK, ATTR, ICODE)
15650
#define RS6000_BUILTIN_E(ENUM, NAME, MASK, ATTR, ICODE)
15651
+#define RS6000_BUILTIN_H(ENUM, NAME, MASK, ATTR, ICODE)
15652
#define RS6000_BUILTIN_P(ENUM, NAME, MASK, ATTR, ICODE)
15653
#define RS6000_BUILTIN_Q(ENUM, NAME, MASK, ATTR, ICODE)
15654
#define RS6000_BUILTIN_S(ENUM, NAME, MASK, ATTR, ICODE)
15655
@@ -9694,6 +11087,7 @@
15656
#undef RS6000_BUILTIN_A
15657
#undef RS6000_BUILTIN_D
15658
#undef RS6000_BUILTIN_E
15659
+#undef RS6000_BUILTIN_H
15660
#undef RS6000_BUILTIN_P
15661
#undef RS6000_BUILTIN_Q
15662
#undef RS6000_BUILTIN_S
15663
@@ -9705,6 +11099,7 @@
15664
#define RS6000_BUILTIN_A(ENUM, NAME, MASK, ATTR, ICODE)
15665
#define RS6000_BUILTIN_D(ENUM, NAME, MASK, ATTR, ICODE)
15666
#define RS6000_BUILTIN_E(ENUM, NAME, MASK, ATTR, ICODE)
15667
+#define RS6000_BUILTIN_H(ENUM, NAME, MASK, ATTR, ICODE)
15668
#define RS6000_BUILTIN_P(ENUM, NAME, MASK, ATTR, ICODE) \
15669
{ MASK, ICODE, NAME, ENUM },
15671
@@ -9726,6 +11121,7 @@
15672
#undef RS6000_BUILTIN_A
15673
#undef RS6000_BUILTIN_D
15674
#undef RS6000_BUILTIN_E
15675
+#undef RS6000_BUILTIN_H
15676
#undef RS6000_BUILTIN_P
15677
#undef RS6000_BUILTIN_Q
15678
#undef RS6000_BUILTIN_S
15679
@@ -9737,6 +11133,7 @@
15680
#define RS6000_BUILTIN_A(ENUM, NAME, MASK, ATTR, ICODE)
15681
#define RS6000_BUILTIN_D(ENUM, NAME, MASK, ATTR, ICODE)
15682
#define RS6000_BUILTIN_E(ENUM, NAME, MASK, ATTR, ICODE)
15683
+#define RS6000_BUILTIN_H(ENUM, NAME, MASK, ATTR, ICODE)
15684
#define RS6000_BUILTIN_P(ENUM, NAME, MASK, ATTR, ICODE)
15685
#define RS6000_BUILTIN_Q(ENUM, NAME, MASK, ATTR, ICODE)
15686
#define RS6000_BUILTIN_S(ENUM, NAME, MASK, ATTR, ICODE) \
15687
@@ -9756,6 +11153,7 @@
15688
#undef RS6000_BUILTIN_A
15689
#undef RS6000_BUILTIN_D
15690
#undef RS6000_BUILTIN_E
15691
+#undef RS6000_BUILTIN_H
15692
#undef RS6000_BUILTIN_P
15693
#undef RS6000_BUILTIN_Q
15694
#undef RS6000_BUILTIN_S
15695
@@ -9769,6 +11167,7 @@
15696
#define RS6000_BUILTIN_E(ENUM, NAME, MASK, ATTR, ICODE) \
15697
{ MASK, ICODE, NAME, ENUM },
15699
+#define RS6000_BUILTIN_H(ENUM, NAME, MASK, ATTR, ICODE)
15700
#define RS6000_BUILTIN_P(ENUM, NAME, MASK, ATTR, ICODE)
15701
#define RS6000_BUILTIN_Q(ENUM, NAME, MASK, ATTR, ICODE)
15702
#define RS6000_BUILTIN_S(ENUM, NAME, MASK, ATTR, ICODE)
15703
@@ -9786,6 +11185,7 @@
15704
#undef RS6000_BUILTIN_A
15705
#undef RS6000_BUILTIN_D
15706
#undef RS6000_BUILTIN_E
15707
+#undef RS6000_BUILTIN_H
15708
#undef RS6000_BUILTIN_P
15709
#undef RS6000_BUILTIN_Q
15710
#undef RS6000_BUILTIN_S
15711
@@ -9797,6 +11197,7 @@
15712
#define RS6000_BUILTIN_A(ENUM, NAME, MASK, ATTR, ICODE)
15713
#define RS6000_BUILTIN_D(ENUM, NAME, MASK, ATTR, ICODE)
15714
#define RS6000_BUILTIN_E(ENUM, NAME, MASK, ATTR, ICODE)
15715
+#define RS6000_BUILTIN_H(ENUM, NAME, MASK, ATTR, ICODE)
15716
#define RS6000_BUILTIN_P(ENUM, NAME, MASK, ATTR, ICODE)
15717
#define RS6000_BUILTIN_Q(ENUM, NAME, MASK, ATTR, ICODE) \
15718
{ MASK, ICODE, NAME, ENUM },
15719
@@ -9817,6 +11218,7 @@
15720
#undef RS6000_BUILTIN_A
15721
#undef RS6000_BUILTIN_D
15722
#undef RS6000_BUILTIN_E
15723
+#undef RS6000_BUILTIN_H
15724
#undef RS6000_BUILTIN_P
15725
#undef RS6000_BUILTIN_Q
15726
#undef RS6000_BUILTIN_S
15727
@@ -9830,6 +11232,7 @@
15729
#define RS6000_BUILTIN_D(ENUM, NAME, MASK, ATTR, ICODE)
15730
#define RS6000_BUILTIN_E(ENUM, NAME, MASK, ATTR, ICODE)
15731
+#define RS6000_BUILTIN_H(ENUM, NAME, MASK, ATTR, ICODE)
15732
#define RS6000_BUILTIN_P(ENUM, NAME, MASK, ATTR, ICODE)
15733
#define RS6000_BUILTIN_Q(ENUM, NAME, MASK, ATTR, ICODE)
15734
#define RS6000_BUILTIN_S(ENUM, NAME, MASK, ATTR, ICODE)
15735
@@ -9847,8 +11250,9 @@
15736
#undef RS6000_BUILTIN_2
15737
#undef RS6000_BUILTIN_3
15738
#undef RS6000_BUILTIN_A
15739
+#undef RS6000_BUILTIN_D
15740
#undef RS6000_BUILTIN_E
15741
-#undef RS6000_BUILTIN_D
15742
+#undef RS6000_BUILTIN_H
15743
#undef RS6000_BUILTIN_P
15744
#undef RS6000_BUILTIN_Q
15745
#undef RS6000_BUILTIN_S
15746
@@ -9862,6 +11266,7 @@
15747
#define RS6000_BUILTIN_A(ENUM, NAME, MASK, ATTR, ICODE)
15748
#define RS6000_BUILTIN_D(ENUM, NAME, MASK, ATTR, ICODE)
15749
#define RS6000_BUILTIN_E(ENUM, NAME, MASK, ATTR, ICODE)
15750
+#define RS6000_BUILTIN_H(ENUM, NAME, MASK, ATTR, ICODE)
15751
#define RS6000_BUILTIN_P(ENUM, NAME, MASK, ATTR, ICODE)
15752
#define RS6000_BUILTIN_Q(ENUM, NAME, MASK, ATTR, ICODE)
15753
#define RS6000_BUILTIN_S(ENUM, NAME, MASK, ATTR, ICODE)
15754
@@ -9872,17 +11277,49 @@
15755
#include "rs6000-builtin.def"
15758
+/* HTM builtins. */
15759
#undef RS6000_BUILTIN_1
15760
#undef RS6000_BUILTIN_2
15761
#undef RS6000_BUILTIN_3
15762
#undef RS6000_BUILTIN_A
15763
#undef RS6000_BUILTIN_D
15764
#undef RS6000_BUILTIN_E
15765
+#undef RS6000_BUILTIN_H
15766
#undef RS6000_BUILTIN_P
15767
#undef RS6000_BUILTIN_Q
15768
#undef RS6000_BUILTIN_S
15769
#undef RS6000_BUILTIN_X
15771
+#define RS6000_BUILTIN_1(ENUM, NAME, MASK, ATTR, ICODE)
15772
+#define RS6000_BUILTIN_2(ENUM, NAME, MASK, ATTR, ICODE)
15773
+#define RS6000_BUILTIN_3(ENUM, NAME, MASK, ATTR, ICODE)
15774
+#define RS6000_BUILTIN_A(ENUM, NAME, MASK, ATTR, ICODE)
15775
+#define RS6000_BUILTIN_D(ENUM, NAME, MASK, ATTR, ICODE)
15776
+#define RS6000_BUILTIN_E(ENUM, NAME, MASK, ATTR, ICODE)
15777
+#define RS6000_BUILTIN_H(ENUM, NAME, MASK, ATTR, ICODE) \
15778
+ { MASK, ICODE, NAME, ENUM },
15780
+#define RS6000_BUILTIN_P(ENUM, NAME, MASK, ATTR, ICODE)
15781
+#define RS6000_BUILTIN_Q(ENUM, NAME, MASK, ATTR, ICODE)
15782
+#define RS6000_BUILTIN_S(ENUM, NAME, MASK, ATTR, ICODE)
15783
+#define RS6000_BUILTIN_X(ENUM, NAME, MASK, ATTR, ICODE)
15785
+static const struct builtin_description bdesc_htm[] =
15787
+#include "rs6000-builtin.def"
15790
+#undef RS6000_BUILTIN_1
15791
+#undef RS6000_BUILTIN_2
15792
+#undef RS6000_BUILTIN_3
15793
+#undef RS6000_BUILTIN_A
15794
+#undef RS6000_BUILTIN_D
15795
+#undef RS6000_BUILTIN_E
15796
+#undef RS6000_BUILTIN_H
15797
+#undef RS6000_BUILTIN_P
15798
+#undef RS6000_BUILTIN_Q
15799
+#undef RS6000_BUILTIN_S
15801
/* Return true if a builtin function is overloaded. */
15803
rs6000_overloaded_builtin_p (enum rs6000_builtins fncode)
15804
@@ -10352,7 +11789,198 @@
15808
+/* Return the appropriate SPR number associated with the given builtin. */
15809
+static inline HOST_WIDE_INT
15810
+htm_spr_num (enum rs6000_builtins code)
15812
+ if (code == HTM_BUILTIN_GET_TFHAR
15813
+ || code == HTM_BUILTIN_SET_TFHAR)
15814
+ return TFHAR_SPR;
15815
+ else if (code == HTM_BUILTIN_GET_TFIAR
15816
+ || code == HTM_BUILTIN_SET_TFIAR)
15817
+ return TFIAR_SPR;
15818
+ else if (code == HTM_BUILTIN_GET_TEXASR
15819
+ || code == HTM_BUILTIN_SET_TEXASR)
15820
+ return TEXASR_SPR;
15821
+ gcc_assert (code == HTM_BUILTIN_GET_TEXASRU
15822
+ || code == HTM_BUILTIN_SET_TEXASRU);
15823
+ return TEXASRU_SPR;
15826
+/* Return the appropriate SPR regno associated with the given builtin. */
15827
+static inline HOST_WIDE_INT
15828
+htm_spr_regno (enum rs6000_builtins code)
15830
+ if (code == HTM_BUILTIN_GET_TFHAR
15831
+ || code == HTM_BUILTIN_SET_TFHAR)
15832
+ return TFHAR_REGNO;
15833
+ else if (code == HTM_BUILTIN_GET_TFIAR
15834
+ || code == HTM_BUILTIN_SET_TFIAR)
15835
+ return TFIAR_REGNO;
15836
+ gcc_assert (code == HTM_BUILTIN_GET_TEXASR
15837
+ || code == HTM_BUILTIN_SET_TEXASR
15838
+ || code == HTM_BUILTIN_GET_TEXASRU
15839
+ || code == HTM_BUILTIN_SET_TEXASRU);
15840
+ return TEXASR_REGNO;
15843
+/* Return the correct ICODE value depending on whether we are
15844
+ setting or reading the HTM SPRs. */
15845
+static inline enum insn_code
15846
+rs6000_htm_spr_icode (bool nonvoid)
15849
+ return (TARGET_64BIT) ? CODE_FOR_htm_mfspr_di : CODE_FOR_htm_mfspr_si;
15851
+ return (TARGET_64BIT) ? CODE_FOR_htm_mtspr_di : CODE_FOR_htm_mtspr_si;
15854
+/* Expand the HTM builtin in EXP and store the result in TARGET.
15855
+ Store true in *EXPANDEDP if we found a builtin to expand. */
15857
+htm_expand_builtin (tree exp, rtx target, bool * expandedp)
15859
+ tree fndecl = TREE_OPERAND (CALL_EXPR_FN (exp), 0);
15860
+ bool nonvoid = TREE_TYPE (TREE_TYPE (fndecl)) != void_type_node;
15861
+ enum rs6000_builtins fcode = (enum rs6000_builtins) DECL_FUNCTION_CODE (fndecl);
15862
+ const struct builtin_description *d;
15865
+ *expandedp = false;
15867
+ /* Expand the HTM builtins. */
15869
+ for (i = 0; i < ARRAY_SIZE (bdesc_htm); i++, d++)
15870
+ if (d->code == fcode)
15872
+ rtx op[MAX_HTM_OPERANDS], pat;
15875
+ call_expr_arg_iterator iter;
15876
+ unsigned attr = rs6000_builtin_info[fcode].attr;
15877
+ enum insn_code icode = d->icode;
15879
+ if (attr & RS6000_BTC_SPR)
15880
+ icode = rs6000_htm_spr_icode (nonvoid);
15884
+ enum machine_mode tmode = insn_data[icode].operand[0].mode;
15886
+ || GET_MODE (target) != tmode
15887
+ || !(*insn_data[icode].operand[0].predicate) (target, tmode))
15888
+ target = gen_reg_rtx (tmode);
15889
+ op[nopnds++] = target;
15892
+ FOR_EACH_CALL_EXPR_ARG (arg, iter, exp)
15894
+ const struct insn_operand_data *insn_op;
15896
+ if (arg == error_mark_node || nopnds >= MAX_HTM_OPERANDS)
15899
+ insn_op = &insn_data[icode].operand[nopnds];
15901
+ op[nopnds] = expand_normal (arg);
15903
+ if (!(*insn_op->predicate) (op[nopnds], insn_op->mode))
15905
+ if (!strcmp (insn_op->constraint, "n"))
15907
+ int arg_num = (nonvoid) ? nopnds : nopnds + 1;
15908
+ if (!CONST_INT_P (op[nopnds]))
15909
+ error ("argument %d must be an unsigned literal", arg_num);
15911
+ error ("argument %d is an unsigned literal that is "
15912
+ "out of range", arg_num);
15913
+ return const0_rtx;
15915
+ op[nopnds] = copy_to_mode_reg (insn_op->mode, op[nopnds]);
15921
+ /* Handle the builtins for extended mnemonics. These accept
15922
+ no arguments, but map to builtins that take arguments. */
15925
+ case HTM_BUILTIN_TENDALL: /* Alias for: tend. 1 */
15926
+ case HTM_BUILTIN_TRESUME: /* Alias for: tsr. 1 */
15927
+ op[nopnds++] = GEN_INT (1);
15928
+#ifdef ENABLE_CHECKING
15929
+ attr |= RS6000_BTC_UNARY;
15932
+ case HTM_BUILTIN_TSUSPEND: /* Alias for: tsr. 0 */
15933
+ op[nopnds++] = GEN_INT (0);
15934
+#ifdef ENABLE_CHECKING
15935
+ attr |= RS6000_BTC_UNARY;
15942
+ /* If this builtin accesses SPRs, then pass in the appropriate
15943
+ SPR number and SPR regno as the last two operands. */
15944
+ if (attr & RS6000_BTC_SPR)
15946
+ op[nopnds++] = gen_rtx_CONST_INT (Pmode, htm_spr_num (fcode));
15947
+ op[nopnds++] = gen_rtx_REG (Pmode, htm_spr_regno (fcode));
15950
+#ifdef ENABLE_CHECKING
15951
+ int expected_nopnds = 0;
15952
+ if ((attr & RS6000_BTC_TYPE_MASK) == RS6000_BTC_UNARY)
15953
+ expected_nopnds = 1;
15954
+ else if ((attr & RS6000_BTC_TYPE_MASK) == RS6000_BTC_BINARY)
15955
+ expected_nopnds = 2;
15956
+ else if ((attr & RS6000_BTC_TYPE_MASK) == RS6000_BTC_TERNARY)
15957
+ expected_nopnds = 3;
15958
+ if (!(attr & RS6000_BTC_VOID))
15959
+ expected_nopnds += 1;
15960
+ if (attr & RS6000_BTC_SPR)
15961
+ expected_nopnds += 2;
15963
+ gcc_assert (nopnds == expected_nopnds && nopnds <= MAX_HTM_OPERANDS);
15969
+ pat = GEN_FCN (icode) (NULL_RTX);
15972
+ pat = GEN_FCN (icode) (op[0]);
15975
+ pat = GEN_FCN (icode) (op[0], op[1]);
15978
+ pat = GEN_FCN (icode) (op[0], op[1], op[2]);
15981
+ pat = GEN_FCN (icode) (op[0], op[1], op[2], op[3]);
15984
+ gcc_unreachable ();
15990
+ *expandedp = true;
15993
+ return const0_rtx;
16000
rs6000_expand_ternop_builtin (enum insn_code icode, tree exp, rtx target)
16003
@@ -10428,7 +12056,28 @@
16007
+ else if (icode == CODE_FOR_crypto_vshasigmaw
16008
+ || icode == CODE_FOR_crypto_vshasigmad)
16010
+ /* Check whether the 2nd and 3rd arguments are integer constants and in
16011
+ range and prepare arguments. */
16012
+ STRIP_NOPS (arg1);
16013
+ if (TREE_CODE (arg1) != INTEGER_CST
16014
+ || !IN_RANGE (TREE_INT_CST_LOW (arg1), 0, 1))
16016
+ error ("argument 2 must be 0 or 1");
16017
+ return const0_rtx;
16020
+ STRIP_NOPS (arg2);
16021
+ if (TREE_CODE (arg2) != INTEGER_CST
16022
+ || !IN_RANGE (TREE_INT_CST_LOW (arg2), 0, 15))
16024
+ error ("argument 3 must be in the range 0..15");
16025
+ return const0_rtx;
16030
|| GET_MODE (target) != tmode
16031
|| ! (*insn_data[icode].operand[0].predicate) (target, tmode))
16032
@@ -11412,6 +13061,8 @@
16033
error ("Builtin function %s is only valid for the cell processor", name);
16034
else if ((fnmask & RS6000_BTM_VSX) != 0)
16035
error ("Builtin function %s requires the -mvsx option", name);
16036
+ else if ((fnmask & RS6000_BTM_HTM) != 0)
16037
+ error ("Builtin function %s requires the -mhtm option", name);
16038
else if ((fnmask & RS6000_BTM_ALTIVEC) != 0)
16039
error ("Builtin function %s requires the -maltivec option", name);
16040
else if ((fnmask & RS6000_BTM_PAIRED) != 0)
16041
@@ -11516,7 +13167,8 @@
16042
case ALTIVEC_BUILTIN_MASK_FOR_LOAD:
16043
case ALTIVEC_BUILTIN_MASK_FOR_STORE:
16045
- int icode = (int) CODE_FOR_altivec_lvsr;
16046
+ int icode = (BYTES_BIG_ENDIAN ? (int) CODE_FOR_altivec_lvsr
16047
+ : (int) CODE_FOR_altivec_lvsl);
16048
enum machine_mode tmode = insn_data[icode].operand[0].mode;
16049
enum machine_mode mode = insn_data[icode].operand[1].mode;
16051
@@ -11591,7 +13243,14 @@
16057
+ ret = htm_expand_builtin (exp, target, &success);
16063
gcc_assert (TARGET_ALTIVEC || TARGET_VSX || TARGET_SPE || TARGET_PAIRED_FLOAT);
16065
/* Handle simple unary operations. */
16066
@@ -11773,6 +13432,9 @@
16067
spe_init_builtins ();
16068
if (TARGET_EXTRA_BUILTINS)
16069
altivec_init_builtins ();
16071
+ htm_init_builtins ();
16073
if (TARGET_EXTRA_BUILTINS || TARGET_SPE || TARGET_PAIRED_FLOAT)
16074
rs6000_common_init_builtins ();
16076
@@ -12118,6 +13780,10 @@
16077
= build_function_type_list (integer_type_node,
16078
integer_type_node, V4SI_type_node,
16079
V4SI_type_node, NULL_TREE);
16080
+ tree int_ftype_int_v2di_v2di
16081
+ = build_function_type_list (integer_type_node,
16082
+ integer_type_node, V2DI_type_node,
16083
+ V2DI_type_node, NULL_TREE);
16084
tree void_ftype_v4si
16085
= build_function_type_list (void_type_node, V4SI_type_node, NULL_TREE);
16086
tree v8hi_ftype_void
16087
@@ -12200,6 +13866,8 @@
16088
= build_function_type_list (integer_type_node,
16089
integer_type_node, V2DF_type_node,
16090
V2DF_type_node, NULL_TREE);
16091
+ tree v2di_ftype_v2di
16092
+ = build_function_type_list (V2DI_type_node, V2DI_type_node, NULL_TREE);
16093
tree v4si_ftype_v4si
16094
= build_function_type_list (V4SI_type_node, V4SI_type_node, NULL_TREE);
16095
tree v8hi_ftype_v8hi
16096
@@ -12335,6 +14003,9 @@
16098
type = int_ftype_int_opaque_opaque;
16101
+ type = int_ftype_int_v2di_v2di;
16104
type = int_ftype_int_v4si_v4si;
16106
@@ -12368,6 +14039,9 @@
16111
+ type = v2di_ftype_v2di;
16114
type = v4si_ftype_v4si;
16116
@@ -12500,6 +14174,79 @@
16117
def_builtin ("__builtin_vec_ext_v2di", ftype, VSX_BUILTIN_VEC_EXT_V2DI);
16121
+htm_init_builtins (void)
16123
+ HOST_WIDE_INT builtin_mask = rs6000_builtin_mask;
16124
+ const struct builtin_description *d;
16128
+ for (i = 0; i < ARRAY_SIZE (bdesc_htm); i++, d++)
16130
+ tree op[MAX_HTM_OPERANDS], type;
16131
+ HOST_WIDE_INT mask = d->mask;
16132
+ unsigned attr = rs6000_builtin_info[d->code].attr;
16133
+ bool void_func = (attr & RS6000_BTC_VOID);
16134
+ int attr_args = (attr & RS6000_BTC_TYPE_MASK);
16136
+ tree argtype = (attr & RS6000_BTC_SPR) ? long_unsigned_type_node
16137
+ : unsigned_type_node;
16139
+ if ((mask & builtin_mask) != mask)
16141
+ if (TARGET_DEBUG_BUILTIN)
16142
+ fprintf (stderr, "htm_builtin, skip binary %s\n", d->name);
16146
+ if (d->name == 0)
16148
+ if (TARGET_DEBUG_BUILTIN)
16149
+ fprintf (stderr, "htm_builtin, bdesc_htm[%ld] no name\n",
16150
+ (long unsigned) i);
16154
+ op[nopnds++] = (void_func) ? void_type_node : argtype;
16156
+ if (attr_args == RS6000_BTC_UNARY)
16157
+ op[nopnds++] = argtype;
16158
+ else if (attr_args == RS6000_BTC_BINARY)
16160
+ op[nopnds++] = argtype;
16161
+ op[nopnds++] = argtype;
16163
+ else if (attr_args == RS6000_BTC_TERNARY)
16165
+ op[nopnds++] = argtype;
16166
+ op[nopnds++] = argtype;
16167
+ op[nopnds++] = argtype;
16173
+ type = build_function_type_list (op[0], NULL_TREE);
16176
+ type = build_function_type_list (op[0], op[1], NULL_TREE);
16179
+ type = build_function_type_list (op[0], op[1], op[2], NULL_TREE);
16182
+ type = build_function_type_list (op[0], op[1], op[2], op[3],
16186
+ gcc_unreachable ();
16189
+ def_builtin (d->name, type, d->code);
16193
/* Hash function for builtin functions with up to 3 arguments and a return
16196
@@ -12573,11 +14320,27 @@
16197
are type correct. */
16200
+ /* unsigned 1 argument functions. */
16201
+ case CRYPTO_BUILTIN_VSBOX:
16202
+ case P8V_BUILTIN_VGBBD:
16207
/* unsigned 2 argument functions. */
16208
case ALTIVEC_BUILTIN_VMULEUB_UNS:
16209
case ALTIVEC_BUILTIN_VMULEUH_UNS:
16210
case ALTIVEC_BUILTIN_VMULOUB_UNS:
16211
case ALTIVEC_BUILTIN_VMULOUH_UNS:
16212
+ case CRYPTO_BUILTIN_VCIPHER:
16213
+ case CRYPTO_BUILTIN_VCIPHERLAST:
16214
+ case CRYPTO_BUILTIN_VNCIPHER:
16215
+ case CRYPTO_BUILTIN_VNCIPHERLAST:
16216
+ case CRYPTO_BUILTIN_VPMSUMB:
16217
+ case CRYPTO_BUILTIN_VPMSUMH:
16218
+ case CRYPTO_BUILTIN_VPMSUMW:
16219
+ case CRYPTO_BUILTIN_VPMSUMD:
16220
+ case CRYPTO_BUILTIN_VPMSUM:
16224
@@ -12600,6 +14363,14 @@
16225
case VSX_BUILTIN_XXSEL_8HI_UNS:
16226
case VSX_BUILTIN_XXSEL_4SI_UNS:
16227
case VSX_BUILTIN_XXSEL_2DI_UNS:
16228
+ case CRYPTO_BUILTIN_VPERMXOR:
16229
+ case CRYPTO_BUILTIN_VPERMXOR_V2DI:
16230
+ case CRYPTO_BUILTIN_VPERMXOR_V4SI:
16231
+ case CRYPTO_BUILTIN_VPERMXOR_V8HI:
16232
+ case CRYPTO_BUILTIN_VPERMXOR_V16QI:
16233
+ case CRYPTO_BUILTIN_VSHASIGMAW:
16234
+ case CRYPTO_BUILTIN_VSHASIGMAD:
16235
+ case CRYPTO_BUILTIN_VSHASIGMA:
16239
@@ -12741,9 +14512,24 @@
16242
enum insn_code icode = d->icode;
16243
- if (d->name == 0 || icode == CODE_FOR_nothing)
16245
+ if (d->name == 0)
16247
+ if (TARGET_DEBUG_BUILTIN)
16248
+ fprintf (stderr, "rs6000_builtin, bdesc_3arg[%ld] no name\n",
16249
+ (long unsigned)i);
16254
+ if (icode == CODE_FOR_nothing)
16256
+ if (TARGET_DEBUG_BUILTIN)
16257
+ fprintf (stderr, "rs6000_builtin, skip ternary %s (no code)\n",
16263
type = builtin_function_type (insn_data[icode].operand[0].mode,
16264
insn_data[icode].operand[1].mode,
16265
insn_data[icode].operand[2].mode,
16266
@@ -12781,9 +14567,24 @@
16269
enum insn_code icode = d->icode;
16270
- if (d->name == 0 || icode == CODE_FOR_nothing)
16272
+ if (d->name == 0)
16274
+ if (TARGET_DEBUG_BUILTIN)
16275
+ fprintf (stderr, "rs6000_builtin, bdesc_2arg[%ld] no name\n",
16276
+ (long unsigned)i);
16281
+ if (icode == CODE_FOR_nothing)
16283
+ if (TARGET_DEBUG_BUILTIN)
16284
+ fprintf (stderr, "rs6000_builtin, skip binary %s (no code)\n",
16290
mode0 = insn_data[icode].operand[0].mode;
16291
mode1 = insn_data[icode].operand[1].mode;
16292
mode2 = insn_data[icode].operand[2].mode;
16293
@@ -12843,9 +14644,24 @@
16296
enum insn_code icode = d->icode;
16297
- if (d->name == 0 || icode == CODE_FOR_nothing)
16299
+ if (d->name == 0)
16301
+ if (TARGET_DEBUG_BUILTIN)
16302
+ fprintf (stderr, "rs6000_builtin, bdesc_1arg[%ld] no name\n",
16303
+ (long unsigned)i);
16308
+ if (icode == CODE_FOR_nothing)
16310
+ if (TARGET_DEBUG_BUILTIN)
16311
+ fprintf (stderr, "rs6000_builtin, skip unary %s (no code)\n",
16317
mode0 = insn_data[icode].operand[0].mode;
16318
mode1 = insn_data[icode].operand[1].mode;
16320
@@ -13632,7 +15448,7 @@
16321
static bool eliminated = false;
16324
- if (mode != SDmode)
16325
+ if (mode != SDmode || TARGET_NO_SDMODE_STACK)
16326
ret = assign_stack_local (mode, GET_MODE_SIZE (mode), 0);
16329
@@ -13691,31 +15507,228 @@
16333
-enum reload_reg_type {
16334
- GPR_REGISTER_TYPE,
16335
- VECTOR_REGISTER_TYPE,
16336
- OTHER_REGISTER_TYPE
16338
+/* Classify a register type. Because the FMRGOW/FMRGEW instructions only work
16339
+ on traditional floating point registers, and the VMRGOW/VMRGEW instructions
16340
+ only work on the traditional altivec registers, note if an altivec register
16343
-static enum reload_reg_type
16344
-rs6000_reload_register_type (enum reg_class rclass)
16345
+static enum rs6000_reg_type
16346
+register_to_reg_type (rtx reg, bool *is_altivec)
16349
+ HOST_WIDE_INT regno;
16350
+ enum reg_class rclass;
16352
+ if (GET_CODE (reg) == SUBREG)
16353
+ reg = SUBREG_REG (reg);
16355
+ if (!REG_P (reg))
16356
+ return NO_REG_TYPE;
16358
+ regno = REGNO (reg);
16359
+ if (regno >= FIRST_PSEUDO_REGISTER)
16361
- case GENERAL_REGS:
16363
- return GPR_REGISTER_TYPE;
16364
+ if (!lra_in_progress && !reload_in_progress && !reload_completed)
16365
+ return PSEUDO_REG_TYPE;
16368
- case ALTIVEC_REGS:
16370
- return VECTOR_REGISTER_TYPE;
16371
+ regno = true_regnum (reg);
16372
+ if (regno < 0 || regno >= FIRST_PSEUDO_REGISTER)
16373
+ return PSEUDO_REG_TYPE;
16377
- return OTHER_REGISTER_TYPE;
16378
+ gcc_assert (regno >= 0);
16380
+ if (is_altivec && ALTIVEC_REGNO_P (regno))
16381
+ *is_altivec = true;
16383
+ rclass = rs6000_regno_regclass[regno];
16384
+ return reg_class_to_reg_type[(int)rclass];
16387
+/* Helper function for rs6000_secondary_reload to return true if a move to a
16388
+ different register classe is really a simple move. */
16391
+rs6000_secondary_reload_simple_move (enum rs6000_reg_type to_type,
16392
+ enum rs6000_reg_type from_type,
16393
+ enum machine_mode mode)
16397
+ /* Add support for various direct moves available. In this function, we only
16398
+ look at cases where we don't need any extra registers, and one or more
16399
+ simple move insns are issued. At present, 32-bit integers are not allowed
16400
+ in FPR/VSX registers. Single precision binary floating is not a simple
16401
+ move because we need to convert to the single precision memory layout.
16402
+ The 4-byte SDmode can be moved. */
16403
+ size = GET_MODE_SIZE (mode);
16404
+ if (TARGET_DIRECT_MOVE
16405
+ && ((mode == SDmode) || (TARGET_POWERPC64 && size == 8))
16406
+ && ((to_type == GPR_REG_TYPE && from_type == VSX_REG_TYPE)
16407
+ || (to_type == VSX_REG_TYPE && from_type == GPR_REG_TYPE)))
16410
+ else if (TARGET_MFPGPR && TARGET_POWERPC64 && size == 8
16411
+ && ((to_type == GPR_REG_TYPE && from_type == FPR_REG_TYPE)
16412
+ || (to_type == FPR_REG_TYPE && from_type == GPR_REG_TYPE)))
16415
+ else if ((size == 4 || (TARGET_POWERPC64 && size == 8))
16416
+ && ((to_type == GPR_REG_TYPE && from_type == SPR_REG_TYPE)
16417
+ || (to_type == SPR_REG_TYPE && from_type == GPR_REG_TYPE)))
16423
+/* Power8 helper function for rs6000_secondary_reload, handle all of the
16424
+ special direct moves that involve allocating an extra register, return the
16425
+ insn code of the helper function if there is such a function or
16426
+ CODE_FOR_nothing if not. */
16429
+rs6000_secondary_reload_direct_move (enum rs6000_reg_type to_type,
16430
+ enum rs6000_reg_type from_type,
16431
+ enum machine_mode mode,
16432
+ secondary_reload_info *sri,
16435
+ bool ret = false;
16436
+ enum insn_code icode = CODE_FOR_nothing;
16438
+ int size = GET_MODE_SIZE (mode);
16440
+ if (TARGET_POWERPC64)
16444
+ /* Handle moving 128-bit values from GPRs to VSX point registers on
16445
+ power8 when running in 64-bit mode using XXPERMDI to glue the two
16446
+ 64-bit values back together. */
16447
+ if (to_type == VSX_REG_TYPE && from_type == GPR_REG_TYPE)
16449
+ cost = 3; /* 2 mtvsrd's, 1 xxpermdi. */
16450
+ icode = reg_addr[mode].reload_vsx_gpr;
16453
+ /* Handle moving 128-bit values from VSX point registers to GPRs on
16454
+ power8 when running in 64-bit mode using XXPERMDI to get access to the
16455
+ bottom 64-bit value. */
16456
+ else if (to_type == GPR_REG_TYPE && from_type == VSX_REG_TYPE)
16458
+ cost = 3; /* 2 mfvsrd's, 1 xxpermdi. */
16459
+ icode = reg_addr[mode].reload_gpr_vsx;
16463
+ else if (mode == SFmode)
16465
+ if (to_type == GPR_REG_TYPE && from_type == VSX_REG_TYPE)
16467
+ cost = 3; /* xscvdpspn, mfvsrd, and. */
16468
+ icode = reg_addr[mode].reload_gpr_vsx;
16471
+ else if (to_type == VSX_REG_TYPE && from_type == GPR_REG_TYPE)
16473
+ cost = 2; /* mtvsrz, xscvspdpn. */
16474
+ icode = reg_addr[mode].reload_vsx_gpr;
16479
+ if (TARGET_POWERPC64 && size == 16)
16481
+ /* Handle moving 128-bit values from GPRs to VSX point registers on
16482
+ power8 when running in 64-bit mode using XXPERMDI to glue the two
16483
+ 64-bit values back together. */
16484
+ if (to_type == VSX_REG_TYPE && from_type == GPR_REG_TYPE)
16486
+ cost = 3; /* 2 mtvsrd's, 1 xxpermdi. */
16487
+ icode = reg_addr[mode].reload_vsx_gpr;
16490
+ /* Handle moving 128-bit values from VSX point registers to GPRs on
16491
+ power8 when running in 64-bit mode using XXPERMDI to get access to the
16492
+ bottom 64-bit value. */
16493
+ else if (to_type == GPR_REG_TYPE && from_type == VSX_REG_TYPE)
16495
+ cost = 3; /* 2 mfvsrd's, 1 xxpermdi. */
16496
+ icode = reg_addr[mode].reload_gpr_vsx;
16500
+ else if (!TARGET_POWERPC64 && size == 8)
16502
+ /* Handle moving 64-bit values from GPRs to floating point registers on
16503
+ power8 when running in 32-bit mode using FMRGOW to glue the two 32-bit
16504
+ values back together. Altivec register classes must be handled
16505
+ specially since a different instruction is used, and the secondary
16506
+ reload support requires a single instruction class in the scratch
16507
+ register constraint. However, right now TFmode is not allowed in
16508
+ Altivec registers, so the pattern will never match. */
16509
+ if (to_type == VSX_REG_TYPE && from_type == GPR_REG_TYPE && !altivec_p)
16511
+ cost = 3; /* 2 mtvsrwz's, 1 fmrgow. */
16512
+ icode = reg_addr[mode].reload_fpr_gpr;
16516
+ if (icode != CODE_FOR_nothing)
16521
+ sri->icode = icode;
16522
+ sri->extra_cost = cost;
16529
+/* Return whether a move between two register classes can be done either
16530
+ directly (simple move) or via a pattern that uses a single extra temporary
16531
+ (using power8's direct move in this case. */
16534
+rs6000_secondary_reload_move (enum rs6000_reg_type to_type,
16535
+ enum rs6000_reg_type from_type,
16536
+ enum machine_mode mode,
16537
+ secondary_reload_info *sri,
16540
+ /* Fall back to load/store reloads if either type is not a register. */
16541
+ if (to_type == NO_REG_TYPE || from_type == NO_REG_TYPE)
16544
+ /* If we haven't allocated registers yet, assume the move can be done for the
16545
+ standard register types. */
16546
+ if ((to_type == PSEUDO_REG_TYPE && from_type == PSEUDO_REG_TYPE)
16547
+ || (to_type == PSEUDO_REG_TYPE && IS_STD_REG_TYPE (from_type))
16548
+ || (from_type == PSEUDO_REG_TYPE && IS_STD_REG_TYPE (to_type)))
16551
+ /* Moves to the same set of registers is a simple move for non-specialized
16553
+ if (to_type == from_type && IS_STD_REG_TYPE (to_type))
16556
+ /* Check whether a simple move can be done directly. */
16557
+ if (rs6000_secondary_reload_simple_move (to_type, from_type, mode))
16561
+ sri->icode = CODE_FOR_nothing;
16562
+ sri->extra_cost = 0;
16567
+ /* Now check if we can do it in a few steps. */
16568
+ return rs6000_secondary_reload_direct_move (to_type, from_type, mode, sri,
16572
/* Inform reload about cases where moving X with a mode MODE to a register in
16573
RCLASS requires an extra scratch or immediate register. Return the class
16574
needed for the immediate register.
16575
@@ -13739,12 +15752,36 @@
16576
bool default_p = false;
16578
sri->icode = CODE_FOR_nothing;
16580
+ ? reg_addr[mode].reload_load
16581
+ : reg_addr[mode].reload_store);
16583
- /* Convert vector loads and stores into gprs to use an additional base
16585
- icode = rs6000_vector_reload[mode][in_p != false];
16586
- if (icode != CODE_FOR_nothing)
16587
+ if (REG_P (x) || register_operand (x, mode))
16589
+ enum rs6000_reg_type to_type = reg_class_to_reg_type[(int)rclass];
16590
+ bool altivec_p = (rclass == ALTIVEC_REGS);
16591
+ enum rs6000_reg_type from_type = register_to_reg_type (x, &altivec_p);
16595
+ enum rs6000_reg_type exchange = to_type;
16596
+ to_type = from_type;
16597
+ from_type = exchange;
16600
+ /* Can we do a direct move of some sort? */
16601
+ if (rs6000_secondary_reload_move (to_type, from_type, mode, sri,
16604
+ icode = (enum insn_code)sri->icode;
16605
+ default_p = false;
16610
+ /* Handle vector moves with reload helper functions. */
16611
+ if (ret == ALL_REGS && icode != CODE_FOR_nothing)
16614
sri->icode = CODE_FOR_nothing;
16615
sri->extra_cost = 0;
16616
@@ -13755,22 +15792,43 @@
16618
/* Loads to and stores from gprs can do reg+offset, and wouldn't need
16619
an extra register in that case, but it would need an extra
16620
- register if the addressing is reg+reg or (reg+reg)&(-16). */
16621
+ register if the addressing is reg+reg or (reg+reg)&(-16). Special
16622
+ case load/store quad. */
16623
if (rclass == GENERAL_REGS || rclass == BASE_REGS)
16625
- if (!legitimate_indirect_address_p (addr, false)
16626
- && !rs6000_legitimate_offset_address_p (TImode, addr,
16628
+ if (TARGET_POWERPC64 && TARGET_QUAD_MEMORY
16629
+ && GET_MODE_SIZE (mode) == 16
16630
+ && quad_memory_operand (x, mode))
16632
sri->icode = icode;
16633
+ sri->extra_cost = 2;
16636
+ else if (!legitimate_indirect_address_p (addr, false)
16637
+ && !rs6000_legitimate_offset_address_p (PTImode, addr,
16640
+ sri->icode = icode;
16641
/* account for splitting the loads, and converting the
16642
address from reg+reg to reg. */
16643
sri->extra_cost = (((TARGET_64BIT) ? 3 : 5)
16644
+ ((GET_CODE (addr) == AND) ? 1 : 0));
16647
- /* Loads to and stores from vector registers can only do reg+reg
16648
- addressing. Altivec registers can also do (reg+reg)&(-16). */
16649
+ /* Allow scalar loads to/from the traditional floating point
16650
+ registers, even if VSX memory is set. */
16651
+ else if ((rclass == FLOAT_REGS || rclass == NO_REGS)
16652
+ && (GET_MODE_SIZE (mode) == 4 || GET_MODE_SIZE (mode) == 8)
16653
+ && (legitimate_indirect_address_p (addr, false)
16654
+ || legitimate_indirect_address_p (addr, false)
16655
+ || rs6000_legitimate_offset_address_p (mode, addr,
16659
+ /* Loads to and stores from vector registers can only do reg+reg
16660
+ addressing. Altivec registers can also do (reg+reg)&(-16). Allow
16661
+ scalar modes loading up the traditional floating point registers
16662
+ to use offset addresses. */
16663
else if (rclass == VSX_REGS || rclass == ALTIVEC_REGS
16664
|| rclass == FLOAT_REGS || rclass == NO_REGS)
16666
@@ -13814,12 +15872,12 @@
16669
enum reg_class xclass = REGNO_REG_CLASS (regno);
16670
- enum reload_reg_type rtype1 = rs6000_reload_register_type (rclass);
16671
- enum reload_reg_type rtype2 = rs6000_reload_register_type (xclass);
16672
+ enum rs6000_reg_type rtype1 = reg_class_to_reg_type[(int)rclass];
16673
+ enum rs6000_reg_type rtype2 = reg_class_to_reg_type[(int)xclass];
16675
/* If memory is needed, use default_secondary_reload to create the
16677
- if (rtype1 != rtype2 || rtype1 == OTHER_REGISTER_TYPE)
16678
+ if (rtype1 != rtype2 || !IS_STD_REG_TYPE (rtype1))
16682
@@ -13829,7 +15887,7 @@
16685
else if (TARGET_POWERPC64
16686
- && rs6000_reload_register_type (rclass) == GPR_REGISTER_TYPE
16687
+ && reg_class_to_reg_type[(int)rclass] == GPR_REG_TYPE
16689
&& GET_MODE_SIZE (GET_MODE (x)) >= UNITS_PER_WORD)
16691
@@ -13868,7 +15926,7 @@
16694
else if (!TARGET_POWERPC64
16695
- && rs6000_reload_register_type (rclass) == GPR_REGISTER_TYPE
16696
+ && reg_class_to_reg_type[(int)rclass] == GPR_REG_TYPE
16698
&& GET_MODE_SIZE (GET_MODE (x)) > UNITS_PER_WORD)
16700
@@ -13946,6 +16004,36 @@
16704
+/* Better tracing for rs6000_secondary_reload_inner. */
16707
+rs6000_secondary_reload_trace (int line, rtx reg, rtx mem, rtx scratch,
16710
+ rtx set, clobber;
16712
+ gcc_assert (reg != NULL_RTX && mem != NULL_RTX && scratch != NULL_RTX);
16714
+ fprintf (stderr, "rs6000_secondary_reload_inner:%d, type = %s\n", line,
16715
+ store_p ? "store" : "load");
16718
+ set = gen_rtx_SET (VOIDmode, mem, reg);
16720
+ set = gen_rtx_SET (VOIDmode, reg, mem);
16722
+ clobber = gen_rtx_CLOBBER (VOIDmode, scratch);
16723
+ debug_rtx (gen_rtx_PARALLEL (VOIDmode, gen_rtvec (2, set, clobber)));
16727
+rs6000_secondary_reload_fail (int line, rtx reg, rtx mem, rtx scratch,
16730
+ rs6000_secondary_reload_trace (line, reg, mem, scratch, store_p);
16731
+ gcc_unreachable ();
16734
/* Fixup reload addresses for Altivec or VSX loads/stores to change SP+offset
16735
to SP+reg addressing. */
16737
@@ -13964,19 +16052,14 @@
16740
if (TARGET_DEBUG_ADDR)
16742
- fprintf (stderr, "\nrs6000_secondary_reload_inner, type = %s\n",
16743
- store_p ? "store" : "load");
16744
- fprintf (stderr, "reg:\n");
16746
- fprintf (stderr, "mem:\n");
16748
- fprintf (stderr, "scratch:\n");
16749
- debug_rtx (scratch);
16751
+ rs6000_secondary_reload_trace (__LINE__, reg, mem, scratch, store_p);
16753
- gcc_assert (regno >= 0 && regno < FIRST_PSEUDO_REGISTER);
16754
- gcc_assert (GET_CODE (mem) == MEM);
16755
+ if (regno < 0 || regno >= FIRST_PSEUDO_REGISTER)
16756
+ rs6000_secondary_reload_fail (__LINE__, reg, mem, scratch, store_p);
16758
+ if (GET_CODE (mem) != MEM)
16759
+ rs6000_secondary_reload_fail (__LINE__, reg, mem, scratch, store_p);
16761
rclass = REGNO_REG_CLASS (regno);
16762
addr = XEXP (mem, 0);
16764
@@ -13995,19 +16078,24 @@
16765
if (GET_CODE (addr) == PRE_MODIFY)
16767
scratch_or_premodify = XEXP (addr, 0);
16768
- gcc_assert (REG_P (scratch_or_premodify));
16769
- gcc_assert (GET_CODE (XEXP (addr, 1)) == PLUS);
16770
+ if (!REG_P (scratch_or_premodify))
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 (GET_CODE (addr) == PLUS
16780
&& (and_op2 != NULL_RTX
16781
- || !rs6000_legitimate_offset_address_p (TImode, addr,
16782
+ || !rs6000_legitimate_offset_address_p (PTImode, addr,
16785
addr_op1 = XEXP (addr, 0);
16786
addr_op2 = XEXP (addr, 1);
16787
- gcc_assert (legitimate_indirect_address_p (addr_op1, false));
16788
+ if (!legitimate_indirect_address_p (addr_op1, false))
16789
+ rs6000_secondary_reload_fail (__LINE__, reg, mem, scratch, store_p);
16791
if (!REG_P (addr_op2)
16792
&& (GET_CODE (addr_op2) != CONST_INT
16793
@@ -14035,7 +16123,7 @@
16794
scratch_or_premodify = scratch;
16796
else if (!legitimate_indirect_address_p (addr, false)
16797
- && !rs6000_legitimate_offset_address_p (TImode, addr,
16798
+ && !rs6000_legitimate_offset_address_p (PTImode, addr,
16801
if (TARGET_DEBUG_ADDR)
16802
@@ -14051,9 +16139,21 @@
16806
- /* Float/Altivec registers can only handle reg+reg addressing. Move
16807
- other addresses into a scratch register. */
16808
+ /* Float registers can do offset+reg addressing for scalar types. */
16810
+ if (legitimate_indirect_address_p (addr, false) /* reg */
16811
+ || legitimate_indexed_address_p (addr, false) /* reg+reg */
16812
+ || ((GET_MODE_SIZE (mode) == 4 || GET_MODE_SIZE (mode) == 8)
16813
+ && and_op2 == NULL_RTX
16814
+ && scratch_or_premodify == scratch
16815
+ && rs6000_legitimate_offset_address_p (mode, addr, false, false)))
16818
+ /* If this isn't a legacy floating point load/store, fall through to the
16821
+ /* VSX/Altivec registers can only handle reg+reg addressing. Move other
16822
+ addresses into a scratch register. */
16826
@@ -14073,36 +16173,38 @@
16827
/* If we aren't using a VSX load, save the PRE_MODIFY register and use it
16828
as the address later. */
16829
if (GET_CODE (addr) == PRE_MODIFY
16830
- && (!VECTOR_MEM_VSX_P (mode)
16831
+ && ((ALTIVEC_OR_VSX_VECTOR_MODE (mode)
16832
+ && (rclass != FLOAT_REGS
16833
+ || (GET_MODE_SIZE (mode) != 4 && GET_MODE_SIZE (mode) != 8)))
16834
|| and_op2 != NULL_RTX
16835
|| !legitimate_indexed_address_p (XEXP (addr, 1), false)))
16837
scratch_or_premodify = XEXP (addr, 0);
16838
- gcc_assert (legitimate_indirect_address_p (scratch_or_premodify,
16840
- gcc_assert (GET_CODE (XEXP (addr, 1)) == PLUS);
16841
+ if (!legitimate_indirect_address_p (scratch_or_premodify, false))
16842
+ rs6000_secondary_reload_fail (__LINE__, reg, mem, scratch, store_p);
16844
+ if (GET_CODE (XEXP (addr, 1)) != PLUS)
16845
+ rs6000_secondary_reload_fail (__LINE__, reg, mem, scratch, store_p);
16847
addr = XEXP (addr, 1);
16850
if (legitimate_indirect_address_p (addr, false) /* reg */
16851
|| legitimate_indexed_address_p (addr, false) /* reg+reg */
16852
- || GET_CODE (addr) == PRE_MODIFY /* VSX pre-modify */
16853
|| (GET_CODE (addr) == AND /* Altivec memory */
16854
+ && rclass == ALTIVEC_REGS
16855
&& GET_CODE (XEXP (addr, 1)) == CONST_INT
16856
&& INTVAL (XEXP (addr, 1)) == -16
16857
- && VECTOR_MEM_ALTIVEC_P (mode))
16858
- || (rclass == FLOAT_REGS /* legacy float mem */
16859
- && GET_MODE_SIZE (mode) == 8
16860
- && and_op2 == NULL_RTX
16861
- && scratch_or_premodify == scratch
16862
- && rs6000_legitimate_offset_address_p (mode, addr, false, false)))
16863
+ && (legitimate_indirect_address_p (XEXP (addr, 0), false)
16864
+ || legitimate_indexed_address_p (XEXP (addr, 0), false))))
16867
else if (GET_CODE (addr) == PLUS)
16869
addr_op1 = XEXP (addr, 0);
16870
addr_op2 = XEXP (addr, 1);
16871
- gcc_assert (REG_P (addr_op1));
16872
+ if (!REG_P (addr_op1))
16873
+ rs6000_secondary_reload_fail (__LINE__, reg, mem, scratch, store_p);
16875
if (TARGET_DEBUG_ADDR)
16877
@@ -14121,7 +16223,8 @@
16880
else if (GET_CODE (addr) == SYMBOL_REF || GET_CODE (addr) == CONST
16881
- || GET_CODE (addr) == CONST_INT || REG_P (addr))
16882
+ || GET_CODE (addr) == CONST_INT || GET_CODE (addr) == LO_SUM
16885
if (TARGET_DEBUG_ADDR)
16887
@@ -14137,12 +16240,12 @@
16891
- gcc_unreachable ();
16892
+ rs6000_secondary_reload_fail (__LINE__, reg, mem, scratch, store_p);
16897
- gcc_unreachable ();
16898
+ rs6000_secondary_reload_fail (__LINE__, reg, mem, scratch, store_p);
16901
/* If the original address involved a pre-modify that we couldn't use the VSX
16902
@@ -14189,7 +16292,7 @@
16903
/* Adjust the address if it changed. */
16904
if (addr != XEXP (mem, 0))
16906
- mem = change_address (mem, mode, addr);
16907
+ mem = replace_equiv_address_nv (mem, addr);
16908
if (TARGET_DEBUG_ADDR)
16909
fprintf (stderr, "\nrs6000_secondary_reload_inner, mem adjusted.\n");
16911
@@ -14254,8 +16357,10 @@
16915
-/* Allocate a 64-bit stack slot to be used for copying SDmode
16916
- values through if this function has any SDmode references. */
16917
+/* Allocate a 64-bit stack slot to be used for copying SDmode values through if
16918
+ this function has any SDmode references. If we are on a power7 or later, we
16919
+ don't need the 64-bit stack slot since the LFIWZX and STIFWX instructions
16920
+ can load/store the value. */
16923
rs6000_alloc_sdmode_stack_slot (void)
16924
@@ -14266,6 +16371,9 @@
16926
gcc_assert (cfun->machine->sdmode_stack_slot == NULL_RTX);
16928
+ if (TARGET_NO_SDMODE_STACK)
16932
for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi); gsi_next (&gsi))
16934
@@ -14326,8 +16434,7 @@
16936
enum machine_mode mode = GET_MODE (x);
16938
- if (VECTOR_UNIT_VSX_P (mode)
16939
- && x == CONST0_RTX (mode) && VSX_REG_CLASS_P (rclass))
16940
+ if (TARGET_VSX && x == CONST0_RTX (mode) && VSX_REG_CLASS_P (rclass))
16943
if (VECTOR_UNIT_ALTIVEC_OR_VSX_P (mode)
16944
@@ -14382,60 +16489,45 @@
16945
set and vice versa. */
16948
-rs6000_secondary_memory_needed (enum reg_class class1,
16949
- enum reg_class class2,
16950
+rs6000_secondary_memory_needed (enum reg_class from_class,
16951
+ enum reg_class to_class,
16952
enum machine_mode mode)
16954
- if (class1 == class2)
16956
+ enum rs6000_reg_type from_type, to_type;
16957
+ bool altivec_p = ((from_class == ALTIVEC_REGS)
16958
+ || (to_class == ALTIVEC_REGS));
16960
- /* Under VSX, there are 3 register classes that values could be in (VSX_REGS,
16961
- ALTIVEC_REGS, and FLOAT_REGS). We don't need to use memory to copy
16962
- between these classes. But we need memory for other things that can go in
16963
- FLOAT_REGS like SFmode. */
16965
- && (VECTOR_MEM_VSX_P (mode) || VECTOR_UNIT_VSX_P (mode))
16966
- && (class1 == VSX_REGS || class1 == ALTIVEC_REGS
16967
- || class1 == FLOAT_REGS))
16968
- return (class2 != VSX_REGS && class2 != ALTIVEC_REGS
16969
- && class2 != FLOAT_REGS);
16970
+ /* If a simple/direct move is available, we don't need secondary memory */
16971
+ from_type = reg_class_to_reg_type[(int)from_class];
16972
+ to_type = reg_class_to_reg_type[(int)to_class];
16974
- if (class1 == VSX_REGS || class2 == VSX_REGS)
16976
+ if (rs6000_secondary_reload_move (to_type, from_type, mode,
16977
+ (secondary_reload_info *)0, altivec_p))
16980
- if (class1 == FLOAT_REGS
16981
- && (!TARGET_MFPGPR || !TARGET_POWERPC64
16982
- || ((mode != DFmode)
16983
- && (mode != DDmode)
16984
- && (mode != DImode))))
16985
+ /* If we have a floating point or vector register class, we need to use
16986
+ memory to transfer the data. */
16987
+ if (IS_FP_VECT_REG_TYPE (from_type) || IS_FP_VECT_REG_TYPE (to_type))
16990
- if (class2 == FLOAT_REGS
16991
- && (!TARGET_MFPGPR || !TARGET_POWERPC64
16992
- || ((mode != DFmode)
16993
- && (mode != DDmode)
16994
- && (mode != DImode))))
16997
- if (class1 == ALTIVEC_REGS || class2 == ALTIVEC_REGS)
17003
/* Debug version of rs6000_secondary_memory_needed. */
17005
-rs6000_debug_secondary_memory_needed (enum reg_class class1,
17006
- enum reg_class class2,
17007
+rs6000_debug_secondary_memory_needed (enum reg_class from_class,
17008
+ enum reg_class to_class,
17009
enum machine_mode mode)
17011
- bool ret = rs6000_secondary_memory_needed (class1, class2, mode);
17012
+ bool ret = rs6000_secondary_memory_needed (from_class, to_class, mode);
17015
- "rs6000_secondary_memory_needed, return: %s, class1 = %s, "
17016
- "class2 = %s, mode = %s\n",
17017
- ret ? "true" : "false", reg_class_names[class1],
17018
- reg_class_names[class2], GET_MODE_NAME (mode));
17019
+ "rs6000_secondary_memory_needed, return: %s, from_class = %s, "
17020
+ "to_class = %s, mode = %s\n",
17021
+ ret ? "true" : "false",
17022
+ reg_class_names[from_class],
17023
+ reg_class_names[to_class],
17024
+ GET_MODE_NAME (mode));
17028
@@ -14502,12 +16594,18 @@
17029
return (mode != SDmode) ? NO_REGS : GENERAL_REGS;
17031
/* Memory, and FP/altivec registers can go into fp/altivec registers under
17033
+ VSX. However, for scalar variables, use the traditional floating point
17034
+ registers so that we can use offset+register addressing. */
17036
&& (regno == -1 || VSX_REGNO_P (regno))
17037
&& VSX_REG_CLASS_P (rclass))
17040
+ if (GET_MODE_SIZE (mode) < 16)
17041
+ return FLOAT_REGS;
17046
/* Memory, and AltiVec registers can go into AltiVec registers. */
17047
if ((regno == -1 || ALTIVEC_REGNO_P (regno))
17048
&& rclass == ALTIVEC_REGS)
17049
@@ -14551,8 +16649,42 @@
17050
if (from_size != to_size)
17052
enum reg_class xclass = (TARGET_VSX) ? VSX_REGS : FLOAT_REGS;
17053
- return ((from_size < 8 || to_size < 8 || TARGET_IEEEQUAD)
17054
- && reg_classes_intersect_p (xclass, rclass));
17056
+ if (reg_classes_intersect_p (xclass, rclass))
17058
+ unsigned to_nregs = hard_regno_nregs[FIRST_FPR_REGNO][to];
17059
+ unsigned from_nregs = hard_regno_nregs[FIRST_FPR_REGNO][from];
17061
+ /* Don't allow 64-bit types to overlap with 128-bit types that take a
17062
+ single register under VSX because the scalar part of the register
17063
+ is in the upper 64-bits, and not the lower 64-bits. Types like
17064
+ TFmode/TDmode that take 2 scalar register can overlap. 128-bit
17065
+ IEEE floating point can't overlap, and neither can small
17068
+ if (TARGET_IEEEQUAD && (to == TFmode || from == TFmode))
17071
+ /* TDmode in floating-mode registers must always go into a register
17072
+ pair with the most significant word in the even-numbered register
17073
+ to match ISA requirements. In little-endian mode, this does not
17074
+ match subreg numbering, so we cannot allow subregs. */
17075
+ if (!BYTES_BIG_ENDIAN && (to == TDmode || from == TDmode))
17078
+ if (from_size < 8 || to_size < 8)
17081
+ if (from_size == 8 && (8 * to_nregs) != to_size)
17084
+ if (to_size == 8 && (8 * from_nregs) != from_size)
17093
if (TARGET_E500_DOUBLE
17094
@@ -14566,10 +16698,19 @@
17095
/* Since the VSX register set includes traditional floating point registers
17096
and altivec registers, just check for the size being different instead of
17097
trying to check whether the modes are vector modes. Otherwise it won't
17098
- allow say DF and DI to change classes. */
17099
+ allow say DF and DI to change classes. For types like TFmode and TDmode
17100
+ that take 2 64-bit registers, rather than a single 128-bit register, don't
17101
+ allow subregs of those types to other 128 bit types. */
17102
if (TARGET_VSX && VSX_REG_CLASS_P (rclass))
17103
- return (from_size != 8 && from_size != 16);
17105
+ unsigned num_regs = (from_size + 15) / 16;
17106
+ if (hard_regno_nregs[FIRST_FPR_REGNO][to] > num_regs
17107
+ || hard_regno_nregs[FIRST_FPR_REGNO][from] > num_regs)
17110
+ return (from_size != 8 && from_size != 16);
17113
if (TARGET_ALTIVEC && rclass == ALTIVEC_REGS
17114
&& (ALTIVEC_VECTOR_MODE (from) + ALTIVEC_VECTOR_MODE (to)) == 1)
17116
@@ -14599,6 +16740,161 @@
17120
+/* Return a string to do a move operation of 128 bits of data. */
17123
+rs6000_output_move_128bit (rtx operands[])
17125
+ rtx dest = operands[0];
17126
+ rtx src = operands[1];
17127
+ enum machine_mode mode = GET_MODE (dest);
17130
+ bool dest_gpr_p, dest_fp_p, dest_vmx_p, dest_vsx_p;
17131
+ bool src_gpr_p, src_fp_p, src_vmx_p, src_vsx_p;
17133
+ if (REG_P (dest))
17135
+ dest_regno = REGNO (dest);
17136
+ dest_gpr_p = INT_REGNO_P (dest_regno);
17137
+ dest_fp_p = FP_REGNO_P (dest_regno);
17138
+ dest_vmx_p = ALTIVEC_REGNO_P (dest_regno);
17139
+ dest_vsx_p = dest_fp_p | dest_vmx_p;
17144
+ dest_gpr_p = dest_fp_p = dest_vmx_p = dest_vsx_p = false;
17149
+ src_regno = REGNO (src);
17150
+ src_gpr_p = INT_REGNO_P (src_regno);
17151
+ src_fp_p = FP_REGNO_P (src_regno);
17152
+ src_vmx_p = ALTIVEC_REGNO_P (src_regno);
17153
+ src_vsx_p = src_fp_p | src_vmx_p;
17158
+ src_gpr_p = src_fp_p = src_vmx_p = src_vsx_p = false;
17161
+ /* Register moves. */
17162
+ if (dest_regno >= 0 && src_regno >= 0)
17169
+ else if (TARGET_VSX && TARGET_DIRECT_MOVE && src_vsx_p)
17173
+ else if (TARGET_VSX && dest_vsx_p)
17176
+ return "xxlor %x0,%x1,%x1";
17178
+ else if (TARGET_DIRECT_MOVE && src_gpr_p)
17182
+ else if (TARGET_ALTIVEC && dest_vmx_p && src_vmx_p)
17183
+ return "vor %0,%1,%1";
17185
+ else if (dest_fp_p && src_fp_p)
17190
+ else if (dest_regno >= 0 && MEM_P (src))
17194
+ if (TARGET_QUAD_MEMORY && quad_load_store_p (dest, src))
17195
+ return "lq %0,%1";
17200
+ else if (TARGET_ALTIVEC && dest_vmx_p
17201
+ && altivec_indexed_or_indirect_operand (src, mode))
17202
+ return "lvx %0,%y1";
17204
+ else if (TARGET_VSX && dest_vsx_p)
17206
+ if (mode == V16QImode || mode == V8HImode || mode == V4SImode)
17207
+ return "lxvw4x %x0,%y1";
17209
+ return "lxvd2x %x0,%y1";
17212
+ else if (TARGET_ALTIVEC && dest_vmx_p)
17213
+ return "lvx %0,%y1";
17215
+ else if (dest_fp_p)
17220
+ else if (src_regno >= 0 && MEM_P (dest))
17224
+ if (TARGET_QUAD_MEMORY && quad_load_store_p (dest, src))
17225
+ return "stq %1,%0";
17230
+ else if (TARGET_ALTIVEC && src_vmx_p
17231
+ && altivec_indexed_or_indirect_operand (src, mode))
17232
+ return "stvx %1,%y0";
17234
+ else if (TARGET_VSX && src_vsx_p)
17236
+ if (mode == V16QImode || mode == V8HImode || mode == V4SImode)
17237
+ return "stxvw4x %x1,%y0";
17239
+ return "stxvd2x %x1,%y0";
17242
+ else if (TARGET_ALTIVEC && src_vmx_p)
17243
+ return "stvx %1,%y0";
17245
+ else if (src_fp_p)
17250
+ else if (dest_regno >= 0
17251
+ && (GET_CODE (src) == CONST_INT
17252
+ || GET_CODE (src) == CONST_DOUBLE
17253
+ || GET_CODE (src) == CONST_VECTOR))
17258
+ else if (TARGET_VSX && dest_vsx_p && zero_constant (src, mode))
17259
+ return "xxlxor %x0,%x0,%x0";
17261
+ else if (TARGET_ALTIVEC && dest_vmx_p)
17262
+ return output_vec_const_move (operands);
17265
+ if (TARGET_DEBUG_ADDR)
17267
+ fprintf (stderr, "\n===== Bad 128 bit move:\n");
17268
+ debug_rtx (gen_rtx_SET (VOIDmode, dest, src));
17271
+ gcc_unreachable ();
17275
/* Given a comparison operation, return the bit number in CCR to test. We
17276
know this is a valid comparison.
17278
@@ -14824,6 +17120,7 @@
17279
ASM_OUTPUT_INTERNAL_LABEL_PREFIX (file, "L.");
17286
@@ -15303,7 +17600,7 @@
17290
- /* Like 'L', for third word of TImode */
17291
+ /* Like 'L', for third word of TImode/PTImode */
17293
fputs (reg_names[REGNO (x) + 2], file);
17294
else if (MEM_P (x))
17295
@@ -15353,7 +17650,7 @@
17299
- /* Like 'L', for last word of TImode. */
17300
+ /* Like 'L', for last word of TImode/PTImode. */
17302
fputs (reg_names[REGNO (x) + 3], file);
17303
else if (MEM_P (x))
17304
@@ -15384,7 +17681,8 @@
17305
if ((TARGET_SPE || TARGET_E500_DOUBLE)
17306
&& (GET_MODE_SIZE (GET_MODE (x)) == 8
17307
|| GET_MODE (x) == TFmode
17308
- || GET_MODE (x) == TImode))
17309
+ || GET_MODE (x) == TImode
17310
+ || GET_MODE (x) == PTImode))
17312
/* Handle [reg]. */
17314
@@ -16767,7 +19065,8 @@
17317
/* A subroutine of the atomic operation splitters. Emit a load-locked
17318
- instruction in MODE. */
17319
+ instruction in MODE. For QI/HImode, possibly use a pattern than includes
17320
+ the zero_extend operation. */
17323
emit_load_locked (enum machine_mode mode, rtx reg, rtx mem)
17324
@@ -16776,12 +19075,26 @@
17329
+ fn = gen_load_lockedqi;
17332
+ fn = gen_load_lockedhi;
17335
- fn = gen_load_lockedsi;
17336
+ if (GET_MODE (mem) == QImode)
17337
+ fn = gen_load_lockedqi_si;
17338
+ else if (GET_MODE (mem) == HImode)
17339
+ fn = gen_load_lockedhi_si;
17341
+ fn = gen_load_lockedsi;
17344
fn = gen_load_lockeddi;
17347
+ fn = gen_load_lockedti;
17350
gcc_unreachable ();
17352
@@ -16798,12 +19111,21 @@
17357
+ fn = gen_store_conditionalqi;
17360
+ fn = gen_store_conditionalhi;
17363
fn = gen_store_conditionalsi;
17366
fn = gen_store_conditionaldi;
17369
+ fn = gen_store_conditionalti;
17372
gcc_unreachable ();
17374
@@ -16950,7 +19272,7 @@
17376
rtx boolval, retval, mem, oldval, newval, cond;
17377
rtx label1, label2, x, mask, shift;
17378
- enum machine_mode mode;
17379
+ enum machine_mode mode, orig_mode;
17380
enum memmodel mod_s, mod_f;
17383
@@ -16962,23 +19284,30 @@
17384
is_weak = (INTVAL (operands[5]) != 0);
17385
mod_s = (enum memmodel) INTVAL (operands[6]);
17386
mod_f = (enum memmodel) INTVAL (operands[7]);
17387
- mode = GET_MODE (mem);
17388
+ orig_mode = mode = GET_MODE (mem);
17390
mask = shift = NULL_RTX;
17391
if (mode == QImode || mode == HImode)
17393
- mem = rs6000_adjust_atomic_subword (mem, &shift, &mask);
17395
- /* Shift and mask OLDVAL into position with the word. */
17396
+ /* Before power8, we didn't have access to lbarx/lharx, so generate a
17397
+ lwarx and shift/mask operations. With power8, we need to do the
17398
+ comparison in SImode, but the store is still done in QI/HImode. */
17399
oldval = convert_modes (SImode, mode, oldval, 1);
17400
- oldval = expand_simple_binop (SImode, ASHIFT, oldval, shift,
17401
- NULL_RTX, 1, OPTAB_LIB_WIDEN);
17403
- /* Shift and mask NEWVAL into position within the word. */
17404
- newval = convert_modes (SImode, mode, newval, 1);
17405
- newval = expand_simple_binop (SImode, ASHIFT, newval, shift,
17406
- NULL_RTX, 1, OPTAB_LIB_WIDEN);
17407
+ if (!TARGET_SYNC_HI_QI)
17409
+ mem = rs6000_adjust_atomic_subword (mem, &shift, &mask);
17411
+ /* Shift and mask OLDVAL into position with the word. */
17412
+ oldval = expand_simple_binop (SImode, ASHIFT, oldval, shift,
17413
+ NULL_RTX, 1, OPTAB_LIB_WIDEN);
17415
+ /* Shift and mask NEWVAL into position within the word. */
17416
+ newval = convert_modes (SImode, mode, newval, 1);
17417
+ newval = expand_simple_binop (SImode, ASHIFT, newval, shift,
17418
+ NULL_RTX, 1, OPTAB_LIB_WIDEN);
17421
/* Prepare to adjust the return value. */
17422
retval = gen_reg_rtx (SImode);
17424
@@ -17006,7 +19335,25 @@
17427
cond = gen_reg_rtx (CCmode);
17428
- x = gen_rtx_COMPARE (CCmode, x, oldval);
17429
+ /* If we have TImode, synthesize a comparison. */
17430
+ if (mode != TImode)
17431
+ x = gen_rtx_COMPARE (CCmode, x, oldval);
17434
+ rtx xor1_result = gen_reg_rtx (DImode);
17435
+ rtx xor2_result = gen_reg_rtx (DImode);
17436
+ rtx or_result = gen_reg_rtx (DImode);
17437
+ rtx new_word0 = simplify_gen_subreg (DImode, x, TImode, 0);
17438
+ rtx new_word1 = simplify_gen_subreg (DImode, x, TImode, 8);
17439
+ rtx old_word0 = simplify_gen_subreg (DImode, oldval, TImode, 0);
17440
+ rtx old_word1 = simplify_gen_subreg (DImode, oldval, TImode, 8);
17442
+ emit_insn (gen_xordi3 (xor1_result, new_word0, old_word0));
17443
+ emit_insn (gen_xordi3 (xor2_result, new_word1, old_word1));
17444
+ emit_insn (gen_iordi3 (or_result, xor1_result, xor2_result));
17445
+ x = gen_rtx_COMPARE (CCmode, or_result, const0_rtx);
17448
emit_insn (gen_rtx_SET (VOIDmode, cond, x));
17450
x = gen_rtx_NE (VOIDmode, cond, const0_rtx);
17451
@@ -17016,7 +19363,7 @@
17453
x = rs6000_mask_atomic_subword (retval, newval, mask);
17455
- emit_store_conditional (mode, cond, mem, x);
17456
+ emit_store_conditional (orig_mode, cond, mem, x);
17460
@@ -17034,6 +19381,8 @@
17463
rs6000_finish_atomic_subword (operands[1], retval, shift);
17464
+ else if (mode != GET_MODE (operands[1]))
17465
+ convert_move (operands[1], retval, 1);
17467
/* In all cases, CR0 contains EQ on success, and NE on failure. */
17468
x = gen_rtx_EQ (SImode, cond, const0_rtx);
17469
@@ -17057,7 +19406,7 @@
17470
mode = GET_MODE (mem);
17472
mask = shift = NULL_RTX;
17473
- if (mode == QImode || mode == HImode)
17474
+ if (!TARGET_SYNC_HI_QI && (mode == QImode || mode == HImode))
17476
mem = rs6000_adjust_atomic_subword (mem, &shift, &mask);
17478
@@ -17106,53 +19455,70 @@
17480
enum memmodel model = (enum memmodel) INTVAL (model_rtx);
17481
enum machine_mode mode = GET_MODE (mem);
17482
+ enum machine_mode store_mode = mode;
17483
rtx label, x, cond, mask, shift;
17484
rtx before = orig_before, after = orig_after;
17486
mask = shift = NULL_RTX;
17487
+ /* On power8, we want to use SImode for the operation. On previous systems,
17488
+ use the operation in a subword and shift/mask to get the proper byte or
17490
if (mode == QImode || mode == HImode)
17492
- mem = rs6000_adjust_atomic_subword (mem, &shift, &mask);
17493
+ if (TARGET_SYNC_HI_QI)
17495
+ val = convert_modes (SImode, mode, val, 1);
17497
- /* Shift and mask VAL into position with the word. */
17498
- val = convert_modes (SImode, mode, val, 1);
17499
- val = expand_simple_binop (SImode, ASHIFT, val, shift,
17500
- NULL_RTX, 1, OPTAB_LIB_WIDEN);
17503
+ /* Prepare to adjust the return value. */
17504
+ before = gen_reg_rtx (SImode);
17506
+ after = gen_reg_rtx (SImode);
17513
- /* We've already zero-extended VAL. That is sufficient to
17514
- make certain that it does not affect other bits. */
17517
+ mem = rs6000_adjust_atomic_subword (mem, &shift, &mask);
17520
- /* If we make certain that all of the other bits in VAL are
17521
- set, that will be sufficient to not affect other bits. */
17522
- x = gen_rtx_NOT (SImode, mask);
17523
- x = gen_rtx_IOR (SImode, x, val);
17524
- emit_insn (gen_rtx_SET (VOIDmode, val, x));
17527
+ /* Shift and mask VAL into position with the word. */
17528
+ val = convert_modes (SImode, mode, val, 1);
17529
+ val = expand_simple_binop (SImode, ASHIFT, val, shift,
17530
+ NULL_RTX, 1, OPTAB_LIB_WIDEN);
17535
- /* These will all affect bits outside the field and need
17536
- adjustment via MASK within the loop. */
17542
+ /* We've already zero-extended VAL. That is sufficient to
17543
+ make certain that it does not affect other bits. */
17548
- gcc_unreachable ();
17550
+ /* If we make certain that all of the other bits in VAL are
17551
+ set, that will be sufficient to not affect other bits. */
17552
+ x = gen_rtx_NOT (SImode, mask);
17553
+ x = gen_rtx_IOR (SImode, x, val);
17554
+ emit_insn (gen_rtx_SET (VOIDmode, val, x));
17561
+ /* These will all affect bits outside the field and need
17562
+ adjustment via MASK within the loop. */
17566
+ gcc_unreachable ();
17569
+ /* Prepare to adjust the return value. */
17570
+ before = gen_reg_rtx (SImode);
17572
+ after = gen_reg_rtx (SImode);
17573
+ store_mode = mode = SImode;
17576
- /* Prepare to adjust the return value. */
17577
- before = gen_reg_rtx (SImode);
17579
- after = gen_reg_rtx (SImode);
17583
mem = rs6000_pre_atomic_barrier (mem, model);
17584
@@ -17185,9 +19551,11 @@
17585
NULL_RTX, 1, OPTAB_LIB_WIDEN);
17586
x = rs6000_mask_atomic_subword (before, x, mask);
17588
+ else if (store_mode != mode)
17589
+ x = convert_modes (store_mode, mode, x, 1);
17591
cond = gen_reg_rtx (CCmode);
17592
- emit_store_conditional (mode, cond, mem, x);
17593
+ emit_store_conditional (store_mode, cond, mem, x);
17595
x = gen_rtx_NE (VOIDmode, cond, const0_rtx);
17596
emit_unlikely_jump (x, label);
17597
@@ -17196,11 +19564,22 @@
17601
+ /* QImode/HImode on machines without lbarx/lharx where we do a lwarx and
17602
+ then do the calcuations in a SImode register. */
17604
rs6000_finish_atomic_subword (orig_before, before, shift);
17606
rs6000_finish_atomic_subword (orig_after, after, shift);
17608
+ else if (store_mode != mode)
17610
+ /* QImode/HImode on machines with lbarx/lharx where we do the native
17611
+ operation and then do the calcuations in a SImode register. */
17613
+ convert_move (orig_before, before, 1);
17615
+ convert_move (orig_after, after, 1);
17617
else if (orig_after && after != orig_after)
17618
emit_move_insn (orig_after, after);
17620
@@ -17240,6 +19619,39 @@
17622
gcc_assert (reg_mode_size * nregs == GET_MODE_SIZE (mode));
17624
+ /* TDmode residing in FP registers is special, since the ISA requires that
17625
+ the lower-numbered word of a register pair is always the most significant
17626
+ word, even in little-endian mode. This does not match the usual subreg
17627
+ semantics, so we cannnot use simplify_gen_subreg in those cases. Access
17628
+ the appropriate constituent registers "by hand" in little-endian mode.
17630
+ Note we do not need to check for destructive overlap here since TDmode
17631
+ can only reside in even/odd register pairs. */
17632
+ if (FP_REGNO_P (reg) && DECIMAL_FLOAT_MODE_P (mode) && !BYTES_BIG_ENDIAN)
17634
+ rtx p_src, p_dst;
17637
+ for (i = 0; i < nregs; i++)
17639
+ if (REG_P (src) && FP_REGNO_P (REGNO (src)))
17640
+ p_src = gen_rtx_REG (reg_mode, REGNO (src) + nregs - 1 - i);
17642
+ p_src = simplify_gen_subreg (reg_mode, src, mode,
17643
+ i * reg_mode_size);
17645
+ if (REG_P (dst) && FP_REGNO_P (REGNO (dst)))
17646
+ p_dst = gen_rtx_REG (reg_mode, REGNO (dst) + nregs - 1 - i);
17648
+ p_dst = simplify_gen_subreg (reg_mode, dst, mode,
17649
+ i * reg_mode_size);
17651
+ emit_insn (gen_rtx_SET (VOIDmode, p_dst, p_src));
17657
if (REG_P (src) && REG_P (dst) && (REGNO (src) < REGNO (dst)))
17659
/* Move register range backwards, if we might have destructive
17660
@@ -17694,7 +20106,7 @@
17664
- gcc_checking_assert (DEFAULT_ABI == ABI_AIX);
17665
+ gcc_checking_assert (DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_ELFv2);
17666
if (info->first_fp_reg_save > 61)
17667
strategy |= SAVE_INLINE_FPRS | REST_INLINE_FPRS;
17668
strategy |= SAVE_INLINE_GPRS | REST_INLINE_GPRS;
17669
@@ -17705,7 +20117,8 @@
17670
by the static chain. It would require too much fiddling and the
17671
static chain is rarely used anyway. FPRs are saved w.r.t the stack
17672
pointer on Darwin, and AIX uses r1 or r12. */
17673
- if (using_static_chain_p && DEFAULT_ABI != ABI_AIX)
17674
+ if (using_static_chain_p
17675
+ && (DEFAULT_ABI == ABI_V4 || DEFAULT_ABI == ABI_DARWIN))
17676
strategy |= ((DEFAULT_ABI == ABI_DARWIN ? 0 : SAVE_INLINE_FPRS)
17678
| SAVE_INLINE_VRS | REST_INLINE_VRS);
17679
@@ -17838,7 +20251,35 @@
17680
The required alignment for AIX configurations is two words (i.e., 8
17683
+ The ELFv2 ABI is a variant of the AIX ABI. Stack frames look like:
17685
+ SP----> +---------------------------------------+
17686
+ | Back chain to caller | 0
17687
+ +---------------------------------------+
17688
+ | Save area for CR | 8
17689
+ +---------------------------------------+
17691
+ +---------------------------------------+
17692
+ | Saved TOC pointer | 24
17693
+ +---------------------------------------+
17694
+ | Parameter save area (P) | 32
17695
+ +---------------------------------------+
17696
+ | Alloca space (A) | 32+P
17697
+ +---------------------------------------+
17698
+ | Local variable space (L) | 32+P+A
17699
+ +---------------------------------------+
17700
+ | Save area for AltiVec registers (W) | 32+P+A+L
17701
+ +---------------------------------------+
17702
+ | AltiVec alignment padding (Y) | 32+P+A+L+W
17703
+ +---------------------------------------+
17704
+ | Save area for GP registers (G) | 32+P+A+L+W+Y
17705
+ +---------------------------------------+
17706
+ | Save area for FP registers (F) | 32+P+A+L+W+Y+G
17707
+ +---------------------------------------+
17708
+ old SP->| back chain to caller's caller | 32+P+A+L+W+Y+G+F
17709
+ +---------------------------------------+
17712
V.4 stack frames look like:
17714
SP----> +---------------------------------------+
17715
@@ -17898,6 +20339,7 @@
17716
rs6000_stack_t *info_ptr = &stack_info;
17717
int reg_size = TARGET_32BIT ? 4 : 8;
17722
HOST_WIDE_INT non_fixed_size;
17723
@@ -17991,6 +20433,18 @@
17727
+ /* In the ELFv2 ABI, we also need to allocate space for separate
17728
+ CR field save areas if the function calls __builtin_eh_return. */
17729
+ if (DEFAULT_ABI == ABI_ELFv2 && crtl->calls_eh_return)
17731
+ /* This hard-codes that we have three call-saved CR fields. */
17732
+ ehcr_size = 3 * reg_size;
17733
+ /* We do *not* use the regular CR save mechanism. */
17734
+ info_ptr->cr_save_p = 0;
17739
/* Determine various sizes. */
17740
info_ptr->reg_size = reg_size;
17741
info_ptr->fixed_size = RS6000_SAVE_AREA;
17742
@@ -18030,6 +20484,7 @@
17743
gcc_unreachable ();
17748
info_ptr->fp_save_offset = - info_ptr->fp_size;
17749
info_ptr->gp_save_offset = info_ptr->fp_save_offset - info_ptr->gp_size;
17750
@@ -18059,6 +20514,8 @@
17753
info_ptr->ehrd_offset = info_ptr->gp_save_offset - ehrd_size;
17755
+ info_ptr->ehcr_offset = info_ptr->ehrd_offset - ehcr_size;
17756
info_ptr->cr_save_offset = reg_size; /* first word when 64-bit. */
17757
info_ptr->lr_save_offset = 2*reg_size;
17759
@@ -18121,6 +20578,7 @@
17760
+ info_ptr->spe_gp_size
17761
+ info_ptr->spe_padding_size
17764
+ info_ptr->cr_size
17765
+ info_ptr->vrsave_size,
17767
@@ -18134,7 +20592,7 @@
17769
/* Determine if we need to save the link register. */
17770
if (info_ptr->calls_p
17771
- || (DEFAULT_ABI == ABI_AIX
17772
+ || ((DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_ELFv2)
17774
&& !TARGET_PROFILE_KERNEL)
17775
|| (DEFAULT_ABI == ABI_V4 && cfun->calls_alloca)
17776
@@ -18280,6 +20738,7 @@
17777
default: abi_string = "Unknown"; break;
17778
case ABI_NONE: abi_string = "NONE"; break;
17779
case ABI_AIX: abi_string = "AIX"; break;
17780
+ case ABI_ELFv2: abi_string = "ELFv2"; break;
17781
case ABI_DARWIN: abi_string = "Darwin"; break;
17782
case ABI_V4: abi_string = "V.4"; break;
17784
@@ -18401,7 +20860,8 @@
17785
/* Currently we don't optimize very well between prolog and body
17786
code and for PIC code the code can be actually quite bad, so
17787
don't try to be too clever here. */
17788
- if (count != 0 || (DEFAULT_ABI != ABI_AIX && flag_pic))
17790
+ || ((DEFAULT_ABI == ABI_V4 || DEFAULT_ABI == ABI_DARWIN) && flag_pic))
17792
cfun->machine->ra_needs_full_frame = 1;
17794
@@ -18460,13 +20920,13 @@
17798
- /* Under the AIX ABI we can't allow calls to non-local functions,
17799
- because the callee may have a different TOC pointer to the
17800
- caller and there's no way to ensure we restore the TOC when we
17801
- return. With the secure-plt SYSV ABI we can't make non-local
17802
+ /* Under the AIX or ELFv2 ABIs we can't allow calls to non-local
17803
+ functions, because the callee may have a different TOC pointer to
17804
+ the caller and there's no way to ensure we restore the TOC when
17805
+ we return. With the secure-plt SYSV ABI we can't make non-local
17806
calls when -fpic/PIC because the plt call stubs use r30. */
17807
if (DEFAULT_ABI == ABI_DARWIN
17808
- || (DEFAULT_ABI == ABI_AIX
17809
+ || ((DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_ELFv2)
17811
&& !DECL_EXTERNAL (decl)
17812
&& (*targetm.binds_local_p) (decl))
17813
@@ -18567,7 +21027,7 @@
17815
dest = gen_rtx_REG (Pmode, RS6000_PIC_OFFSET_TABLE_REGNUM);
17817
- if (TARGET_ELF && TARGET_SECURE_PLT && DEFAULT_ABI != ABI_AIX && flag_pic)
17818
+ if (TARGET_ELF && TARGET_SECURE_PLT && DEFAULT_ABI == ABI_V4 && flag_pic)
17821
rtx lab, tmp1, tmp2, got;
17822
@@ -18595,7 +21055,7 @@
17823
emit_insn (gen_load_toc_v4_pic_si ());
17824
emit_move_insn (dest, gen_rtx_REG (Pmode, LR_REGNO));
17826
- else if (TARGET_ELF && DEFAULT_ABI != ABI_AIX && flag_pic == 2)
17827
+ else if (TARGET_ELF && DEFAULT_ABI == ABI_V4 && flag_pic == 2)
17830
rtx temp0 = (fromprolog
17831
@@ -18643,7 +21103,7 @@
17835
- gcc_assert (DEFAULT_ABI == ABI_AIX);
17836
+ gcc_assert (DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_ELFv2);
17839
emit_insn (gen_load_toc_aix_si (dest));
17840
@@ -19048,7 +21508,7 @@
17843
rs6000_frame_related (rtx insn, rtx reg, HOST_WIDE_INT val,
17844
- rtx reg2, rtx rreg)
17845
+ rtx reg2, rtx rreg, rtx split_reg)
17849
@@ -19139,6 +21599,11 @@
17853
+ /* If a store insn has been split into multiple insns, the
17854
+ true source register is given by split_reg. */
17855
+ if (split_reg != NULL_RTX)
17856
+ real = gen_rtx_SET (VOIDmode, SET_DEST (real), split_reg);
17858
RTX_FRAME_RELATED_P (insn) = 1;
17859
add_reg_note (insn, REG_FRAME_RELATED_EXPR, real);
17861
@@ -19246,7 +21711,7 @@
17862
reg = gen_rtx_REG (mode, regno);
17863
insn = emit_insn (gen_frame_store (reg, frame_reg, offset));
17864
return rs6000_frame_related (insn, frame_reg, frame_reg_to_sp,
17865
- NULL_RTX, NULL_RTX);
17866
+ NULL_RTX, NULL_RTX, NULL_RTX);
17869
/* Emit an offset memory reference suitable for a frame store, while
17870
@@ -19362,7 +21827,7 @@
17871
if ((sel & SAVRES_LR))
17874
- else if (DEFAULT_ABI == ABI_AIX)
17875
+ else if (DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_ELFv2)
17877
#if !defined (POWERPC_LINUX) && !defined (POWERPC_FREEBSD)
17878
/* No out-of-line save/restore routines for GPRs on AIX. */
17879
@@ -19503,7 +21968,7 @@
17880
static inline unsigned
17881
ptr_regno_for_savres (int sel)
17883
- if (DEFAULT_ABI == ABI_AIX)
17884
+ if (DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_ELFv2)
17885
return (sel & SAVRES_REG) == SAVRES_FPR || (sel & SAVRES_LR) ? 1 : 12;
17886
return DEFAULT_ABI == ABI_DARWIN && (sel & SAVRES_REG) == SAVRES_FPR ? 1 : 11;
17888
@@ -19588,6 +22053,43 @@
17892
+/* Emit code to store CR fields that need to be saved into REG. */
17895
+rs6000_emit_move_from_cr (rtx reg)
17897
+ /* Only the ELFv2 ABI allows storing only selected fields. */
17898
+ if (DEFAULT_ABI == ABI_ELFv2 && TARGET_MFCRF)
17900
+ int i, cr_reg[8], count = 0;
17902
+ /* Collect CR fields that must be saved. */
17903
+ for (i = 0; i < 8; i++)
17904
+ if (save_reg_p (CR0_REGNO + i))
17905
+ cr_reg[count++] = i;
17907
+ /* If it's just a single one, use mfcrf. */
17910
+ rtvec p = rtvec_alloc (1);
17911
+ rtvec r = rtvec_alloc (2);
17912
+ RTVEC_ELT (r, 0) = gen_rtx_REG (CCmode, CR0_REGNO + cr_reg[0]);
17913
+ RTVEC_ELT (r, 1) = GEN_INT (1 << (7 - cr_reg[0]));
17915
+ = gen_rtx_SET (VOIDmode, reg,
17916
+ gen_rtx_UNSPEC (SImode, r, UNSPEC_MOVESI_FROM_CR));
17918
+ emit_insn (gen_rtx_PARALLEL (VOIDmode, p));
17922
+ /* ??? It might be better to handle count == 2 / 3 cases here
17923
+ as well, using logical operations to combine the values. */
17926
+ emit_insn (gen_movesi_from_cr (reg));
17929
/* Determine whether the gp REG is really used. */
17932
@@ -19653,6 +22155,17 @@
17933
#define NOT_INUSE(R) do {} while (0)
17936
+ if (DEFAULT_ABI == ABI_ELFv2)
17938
+ cfun->machine->r2_setup_needed = df_regs_ever_live_p (TOC_REGNUM);
17940
+ /* With -mminimal-toc we may generate an extra use of r2 below. */
17941
+ if (!TARGET_SINGLE_PIC_BASE
17942
+ && TARGET_TOC && TARGET_MINIMAL_TOC && get_pool_size () != 0)
17943
+ cfun->machine->r2_setup_needed = true;
17947
if (flag_stack_usage_info)
17948
current_function_static_stack_size = info->total_size;
17950
@@ -19767,7 +22280,7 @@
17952
insn = emit_insn (gen_rtx_PARALLEL (VOIDmode, p));
17953
rs6000_frame_related (insn, frame_reg_rtx, sp_off - frame_off,
17954
- treg, GEN_INT (-info->total_size));
17955
+ treg, GEN_INT (-info->total_size), NULL_RTX);
17956
sp_off = frame_off = info->total_size;
17959
@@ -19852,14 +22365,14 @@
17961
insn = emit_move_insn (mem, reg);
17962
rs6000_frame_related (insn, frame_reg_rtx, sp_off - frame_off,
17963
- NULL_RTX, NULL_RTX);
17964
+ NULL_RTX, NULL_RTX, NULL_RTX);
17969
/* If we need to save CR, put it into r12 or r11. Choose r12 except when
17970
r12 will be needed by out-of-line gpr restore. */
17971
- cr_save_regno = (DEFAULT_ABI == ABI_AIX
17972
+ cr_save_regno = ((DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_ELFv2)
17973
&& !(strategy & (SAVE_INLINE_GPRS
17974
| SAVE_NOINLINE_GPRS_SAVES_LR))
17976
@@ -19868,21 +22381,9 @@
17977
&& REGNO (frame_reg_rtx) != cr_save_regno
17978
&& !(using_static_chain_p && cr_save_regno == 11))
17982
cr_save_rtx = gen_rtx_REG (SImode, cr_save_regno);
17983
START_USE (cr_save_regno);
17984
- insn = emit_insn (gen_movesi_from_cr (cr_save_rtx));
17985
- RTX_FRAME_RELATED_P (insn) = 1;
17986
- /* Now, there's no way that dwarf2out_frame_debug_expr is going
17987
- to understand '(unspec:SI [(reg:CC 68) ...] UNSPEC_MOVESI_FROM_CR)'.
17988
- But that's OK. All we have to do is specify that _one_ condition
17989
- code register is saved in this stack slot. The thrower's epilogue
17990
- will then restore all the call-saved registers.
17991
- We use CR2_REGNO (70) to be compatible with gcc-2.95 on Linux. */
17992
- set = gen_rtx_SET (VOIDmode, cr_save_rtx,
17993
- gen_rtx_REG (SImode, CR2_REGNO));
17994
- add_reg_note (insn, REG_FRAME_RELATED_EXPR, set);
17995
+ rs6000_emit_move_from_cr (cr_save_rtx);
17998
/* Do any required saving of fpr's. If only one or two to save, do
17999
@@ -19920,7 +22421,7 @@
18000
info->lr_save_offset,
18002
rs6000_frame_related (insn, ptr_reg, sp_off,
18003
- NULL_RTX, NULL_RTX);
18004
+ NULL_RTX, NULL_RTX, NULL_RTX);
18008
@@ -19999,7 +22500,7 @@
18009
SAVRES_SAVE | SAVRES_GPR);
18011
rs6000_frame_related (insn, spe_save_area_ptr, sp_off - save_off,
18012
- NULL_RTX, NULL_RTX);
18013
+ NULL_RTX, NULL_RTX, NULL_RTX);
18016
/* Move the static chain pointer back. */
18017
@@ -20049,7 +22550,7 @@
18018
info->lr_save_offset + ptr_off,
18020
rs6000_frame_related (insn, ptr_reg, sp_off - ptr_off,
18021
- NULL_RTX, NULL_RTX);
18022
+ NULL_RTX, NULL_RTX, NULL_RTX);
18026
@@ -20065,7 +22566,7 @@
18027
info->gp_save_offset + frame_off + reg_size * i);
18028
insn = emit_insn (gen_rtx_PARALLEL (VOIDmode, p));
18029
rs6000_frame_related (insn, frame_reg_rtx, sp_off - frame_off,
18030
- NULL_RTX, NULL_RTX);
18031
+ NULL_RTX, NULL_RTX, NULL_RTX);
18033
else if (!WORLD_SAVE_P (info))
18035
@@ -20134,7 +22635,8 @@
18036
be updated if we arrived at this function via a plt call or
18037
toc adjusting stub. */
18038
emit_move_insn (tmp_reg_si, gen_rtx_MEM (SImode, tmp_reg));
18039
- toc_restore_insn = TARGET_32BIT ? 0x80410014 : 0xE8410028;
18040
+ toc_restore_insn = ((TARGET_32BIT ? 0x80410000 : 0xE8410000)
18041
+ + RS6000_TOC_SAVE_SLOT);
18042
hi = gen_int_mode (toc_restore_insn & ~0xffff, SImode);
18043
emit_insn (gen_xorsi3 (tmp_reg_si, tmp_reg_si, hi));
18044
compare_result = gen_rtx_REG (CCUNSmode, CR0_REGNO);
18045
@@ -20153,7 +22655,7 @@
18046
LABEL_NUSES (toc_save_done) += 1;
18048
save_insn = emit_frame_save (frame_reg_rtx, reg_mode,
18049
- TOC_REGNUM, frame_off + 5 * reg_size,
18050
+ TOC_REGNUM, frame_off + RS6000_TOC_SAVE_SLOT,
18051
sp_off - frame_off);
18053
emit_label (toc_save_done);
18054
@@ -20193,28 +22695,123 @@
18055
rtx addr = gen_rtx_PLUS (Pmode, frame_reg_rtx,
18056
GEN_INT (info->cr_save_offset + frame_off));
18057
rtx mem = gen_frame_mem (SImode, addr);
18058
- /* See the large comment above about why CR2_REGNO is used. */
18059
- rtx magic_eh_cr_reg = gen_rtx_REG (SImode, CR2_REGNO);
18061
/* If we didn't copy cr before, do so now using r0. */
18062
if (cr_save_rtx == NULL_RTX)
18067
cr_save_rtx = gen_rtx_REG (SImode, 0);
18068
- insn = emit_insn (gen_movesi_from_cr (cr_save_rtx));
18069
- RTX_FRAME_RELATED_P (insn) = 1;
18070
- set = gen_rtx_SET (VOIDmode, cr_save_rtx, magic_eh_cr_reg);
18071
- add_reg_note (insn, REG_FRAME_RELATED_EXPR, set);
18072
+ rs6000_emit_move_from_cr (cr_save_rtx);
18074
- insn = emit_move_insn (mem, cr_save_rtx);
18076
+ /* Saving CR requires a two-instruction sequence: one instruction
18077
+ to move the CR to a general-purpose register, and a second
18078
+ instruction that stores the GPR to memory.
18080
+ We do not emit any DWARF CFI records for the first of these,
18081
+ because we cannot properly represent the fact that CR is saved in
18082
+ a register. One reason is that we cannot express that multiple
18083
+ CR fields are saved; another reason is that on 64-bit, the size
18084
+ of the CR register in DWARF (4 bytes) differs from the size of
18085
+ a general-purpose register.
18087
+ This means if any intervening instruction were to clobber one of
18088
+ the call-saved CR fields, we'd have incorrect CFI. To prevent
18089
+ this from happening, we mark the store to memory as a use of
18090
+ those CR fields, which prevents any such instruction from being
18091
+ scheduled in between the two instructions. */
18093
+ int n_crsave = 0;
18096
+ crsave_v[n_crsave++] = gen_rtx_SET (VOIDmode, mem, cr_save_rtx);
18097
+ for (i = 0; i < 8; i++)
18098
+ if (save_reg_p (CR0_REGNO + i))
18099
+ crsave_v[n_crsave++]
18100
+ = gen_rtx_USE (VOIDmode, gen_rtx_REG (CCmode, CR0_REGNO + i));
18102
+ insn = emit_insn (gen_rtx_PARALLEL (VOIDmode,
18103
+ gen_rtvec_v (n_crsave, crsave_v)));
18104
END_USE (REGNO (cr_save_rtx));
18106
- rs6000_frame_related (insn, frame_reg_rtx, sp_off - frame_off,
18107
- NULL_RTX, NULL_RTX);
18108
+ /* Now, there's no way that dwarf2out_frame_debug_expr is going to
18109
+ understand '(unspec:SI [(reg:CC 68) ...] UNSPEC_MOVESI_FROM_CR)',
18110
+ so we need to construct a frame expression manually. */
18111
+ RTX_FRAME_RELATED_P (insn) = 1;
18113
+ /* Update address to be stack-pointer relative, like
18114
+ rs6000_frame_related would do. */
18115
+ addr = gen_rtx_PLUS (Pmode, gen_rtx_REG (Pmode, STACK_POINTER_REGNUM),
18116
+ GEN_INT (info->cr_save_offset + sp_off));
18117
+ mem = gen_frame_mem (SImode, addr);
18119
+ if (DEFAULT_ABI == ABI_ELFv2)
18121
+ /* In the ELFv2 ABI we generate separate CFI records for each
18122
+ CR field that was actually saved. They all point to the
18123
+ same 32-bit stack slot. */
18125
+ int n_crframe = 0;
18127
+ for (i = 0; i < 8; i++)
18128
+ if (save_reg_p (CR0_REGNO + i))
18130
+ crframe[n_crframe]
18131
+ = gen_rtx_SET (VOIDmode, mem,
18132
+ gen_rtx_REG (SImode, CR0_REGNO + i));
18134
+ RTX_FRAME_RELATED_P (crframe[n_crframe]) = 1;
18138
+ add_reg_note (insn, REG_FRAME_RELATED_EXPR,
18139
+ gen_rtx_PARALLEL (VOIDmode,
18140
+ gen_rtvec_v (n_crframe, crframe)));
18144
+ /* In other ABIs, by convention, we use a single CR regnum to
18145
+ represent the fact that all call-saved CR fields are saved.
18146
+ We use CR2_REGNO to be compatible with gcc-2.95 on Linux. */
18147
+ rtx set = gen_rtx_SET (VOIDmode, mem,
18148
+ gen_rtx_REG (SImode, CR2_REGNO));
18149
+ add_reg_note (insn, REG_FRAME_RELATED_EXPR, set);
18153
+ /* In the ELFv2 ABI we need to save all call-saved CR fields into
18154
+ *separate* slots if the routine calls __builtin_eh_return, so
18155
+ that they can be independently restored by the unwinder. */
18156
+ if (DEFAULT_ABI == ABI_ELFv2 && crtl->calls_eh_return)
18158
+ int i, cr_off = info->ehcr_offset;
18161
+ /* ??? We might get better performance by using multiple mfocrf
18163
+ crsave = gen_rtx_REG (SImode, 0);
18164
+ emit_insn (gen_movesi_from_cr (crsave));
18166
+ for (i = 0; i < 8; i++)
18167
+ if (!call_used_regs[CR0_REGNO + i])
18169
+ rtvec p = rtvec_alloc (2);
18171
+ = gen_frame_store (crsave, frame_reg_rtx, cr_off + frame_off);
18173
+ = gen_rtx_USE (VOIDmode, gen_rtx_REG (CCmode, CR0_REGNO + i));
18175
+ insn = emit_insn (gen_rtx_PARALLEL (VOIDmode, p));
18177
+ RTX_FRAME_RELATED_P (insn) = 1;
18178
+ add_reg_note (insn, REG_FRAME_RELATED_EXPR,
18179
+ gen_frame_store (gen_rtx_REG (SImode, CR0_REGNO + i),
18180
+ sp_reg_rtx, cr_off + sp_off));
18182
+ cr_off += reg_size;
18186
/* Update stack and set back pointer unless this is V.4,
18187
for which it was done previously. */
18188
if (!WORLD_SAVE_P (info) && info->push_p
18189
@@ -20292,7 +22889,7 @@
18190
info->altivec_save_offset + ptr_off,
18191
0, V4SImode, SAVRES_SAVE | SAVRES_VR);
18192
rs6000_frame_related (insn, scratch_reg, sp_off - ptr_off,
18193
- NULL_RTX, NULL_RTX);
18194
+ NULL_RTX, NULL_RTX, NULL_RTX);
18195
if (REGNO (frame_reg_rtx) == REGNO (scratch_reg))
18197
/* The oddity mentioned above clobbered our frame reg. */
18198
@@ -20308,7 +22905,7 @@
18199
for (i = info->first_altivec_reg_save; i <= LAST_ALTIVEC_REGNO; ++i)
18200
if (info->vrsave_mask & ALTIVEC_REG_BIT (i))
18202
- rtx areg, savereg, mem;
18203
+ rtx areg, savereg, mem, split_reg;
18206
offset = (info->altivec_save_offset + frame_off
18207
@@ -20326,8 +22923,18 @@
18209
insn = emit_move_insn (mem, savereg);
18211
+ /* When we split a VSX store into two insns, we need to make
18212
+ sure the DWARF info knows which register we are storing.
18213
+ Pass it in to be used on the appropriate note. */
18214
+ if (!BYTES_BIG_ENDIAN
18215
+ && GET_CODE (PATTERN (insn)) == SET
18216
+ && GET_CODE (SET_SRC (PATTERN (insn))) == VEC_SELECT)
18217
+ split_reg = savereg;
18219
+ split_reg = NULL_RTX;
18221
rs6000_frame_related (insn, frame_reg_rtx, sp_off - frame_off,
18222
- areg, GEN_INT (offset));
18223
+ areg, GEN_INT (offset), split_reg);
18227
@@ -20351,7 +22958,8 @@
18228
be using r12 as frame_reg_rtx and r11 as the static chain
18229
pointer for nested functions. */
18231
- if (DEFAULT_ABI == ABI_AIX && !using_static_chain_p)
18232
+ if ((DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_ELFv2)
18233
+ && !using_static_chain_p)
18235
else if (REGNO (frame_reg_rtx) == 12)
18237
@@ -20390,7 +22998,7 @@
18238
can use register 0. This allows us to use a plain 'blr' to return
18239
from the procedure more often. */
18240
int save_LR_around_toc_setup = (TARGET_ELF
18241
- && DEFAULT_ABI != ABI_AIX
18242
+ && DEFAULT_ABI == ABI_V4
18244
&& ! info->lr_save_p
18245
&& EDGE_COUNT (EXIT_BLOCK_PTR->preds) > 0);
18246
@@ -20452,7 +23060,7 @@
18247
if (rs6000_save_toc_in_prologue_p ())
18249
rtx reg = gen_rtx_REG (reg_mode, TOC_REGNUM);
18250
- emit_insn (gen_frame_store (reg, sp_reg_rtx, 5 * reg_size));
18251
+ emit_insn (gen_frame_store (reg, sp_reg_rtx, RS6000_TOC_SAVE_SLOT));
18255
@@ -20493,6 +23101,49 @@
18259
+ /* ELFv2 ABI r2 setup code and local entry point. This must follow
18260
+ immediately after the global entry point label. */
18261
+ if (DEFAULT_ABI == ABI_ELFv2 && cfun->machine->r2_setup_needed)
18263
+ const char *name = XSTR (XEXP (DECL_RTL (current_function_decl), 0), 0);
18265
+ fprintf (file, "0:\taddis 2,12,.TOC.-0b@ha\n");
18266
+ fprintf (file, "\taddi 2,2,.TOC.-0b@l\n");
18268
+ fputs ("\t.localentry\t", file);
18269
+ assemble_name (file, name);
18270
+ fputs (",.-", file);
18271
+ assemble_name (file, name);
18272
+ fputs ("\n", file);
18275
+ /* Output -mprofile-kernel code. This needs to be done here instead of
18276
+ in output_function_profile since it must go after the ELFv2 ABI
18277
+ local entry point. */
18278
+ if (TARGET_PROFILE_KERNEL)
18280
+ gcc_assert (DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_ELFv2);
18281
+ gcc_assert (!TARGET_32BIT);
18283
+ asm_fprintf (file, "\tmflr %s\n", reg_names[0]);
18284
+ asm_fprintf (file, "\tstd %s,16(%s)\n", reg_names[0], reg_names[1]);
18286
+ /* In the ELFv2 ABI we have no compiler stack word. It must be
18287
+ the resposibility of _mcount to preserve the static chain
18288
+ register if required. */
18289
+ if (DEFAULT_ABI != ABI_ELFv2
18290
+ && cfun->static_chain_decl != NULL)
18292
+ asm_fprintf (file, "\tstd %s,24(%s)\n",
18293
+ reg_names[STATIC_CHAIN_REGNUM], reg_names[1]);
18294
+ fprintf (file, "\tbl %s\n", RS6000_MCOUNT);
18295
+ asm_fprintf (file, "\tld %s,24(%s)\n",
18296
+ reg_names[STATIC_CHAIN_REGNUM], reg_names[1]);
18299
+ fprintf (file, "\tbl %s\n", RS6000_MCOUNT);
18302
rs6000_pic_labelno++;
18305
@@ -20545,6 +23196,7 @@
18307
if (using_mfcr_multiple && count > 1)
18313
@@ -20562,16 +23214,43 @@
18314
gen_rtx_UNSPEC (CCmode, r, UNSPEC_MOVESI_TO_CR));
18317
- emit_insn (gen_rtx_PARALLEL (VOIDmode, p));
18318
+ insn = emit_insn (gen_rtx_PARALLEL (VOIDmode, p));
18319
gcc_assert (ndx == count);
18321
+ /* For the ELFv2 ABI we generate a CFA_RESTORE for each
18322
+ CR field separately. */
18323
+ if (!exit_func && DEFAULT_ABI == ABI_ELFv2 && flag_shrink_wrap)
18325
+ for (i = 0; i < 8; i++)
18326
+ if (save_reg_p (CR0_REGNO + i))
18327
+ add_reg_note (insn, REG_CFA_RESTORE,
18328
+ gen_rtx_REG (SImode, CR0_REGNO + i));
18330
+ RTX_FRAME_RELATED_P (insn) = 1;
18334
for (i = 0; i < 8; i++)
18335
if (save_reg_p (CR0_REGNO + i))
18336
- emit_insn (gen_movsi_to_cr_one (gen_rtx_REG (CCmode, CR0_REGNO + i),
18339
+ rtx insn = emit_insn (gen_movsi_to_cr_one
18340
+ (gen_rtx_REG (CCmode, CR0_REGNO + i), reg));
18342
- if (!exit_func && (DEFAULT_ABI == ABI_V4 || flag_shrink_wrap))
18343
+ /* For the ELFv2 ABI we generate a CFA_RESTORE for each
18344
+ CR field separately, attached to the insn that in fact
18345
+ restores this particular CR field. */
18346
+ if (!exit_func && DEFAULT_ABI == ABI_ELFv2 && flag_shrink_wrap)
18348
+ add_reg_note (insn, REG_CFA_RESTORE,
18349
+ gen_rtx_REG (SImode, CR0_REGNO + i));
18351
+ RTX_FRAME_RELATED_P (insn) = 1;
18355
+ /* For other ABIs, we just generate a single CFA_RESTORE for CR2. */
18356
+ if (!exit_func && DEFAULT_ABI != ABI_ELFv2
18357
+ && (DEFAULT_ABI == ABI_V4 || flag_shrink_wrap))
18359
rtx insn = get_last_insn ();
18360
rtx cr = gen_rtx_REG (SImode, CR2_REGNO);
18361
@@ -20612,10 +23291,22 @@
18363
add_crlr_cfa_restore (const rs6000_stack_t *info, rtx cfa_restores)
18365
- if (info->cr_save_p)
18366
+ if (DEFAULT_ABI == ABI_ELFv2)
18369
+ for (i = 0; i < 8; i++)
18370
+ if (save_reg_p (CR0_REGNO + i))
18372
+ rtx cr = gen_rtx_REG (SImode, CR0_REGNO + i);
18373
+ cfa_restores = alloc_reg_note (REG_CFA_RESTORE, cr,
18377
+ else if (info->cr_save_p)
18378
cfa_restores = alloc_reg_note (REG_CFA_RESTORE,
18379
gen_rtx_REG (SImode, CR2_REGNO),
18382
if (info->lr_save_p)
18383
cfa_restores = alloc_reg_note (REG_CFA_RESTORE,
18384
gen_rtx_REG (Pmode, LR_REGNO),
18385
@@ -21113,6 +23804,35 @@
18386
|| (!restoring_GPRs_inline
18387
&& info->first_fp_reg_save == 64));
18389
+ /* In the ELFv2 ABI we need to restore all call-saved CR fields from
18390
+ *separate* slots if the routine calls __builtin_eh_return, so
18391
+ that they can be independently restored by the unwinder. */
18392
+ if (DEFAULT_ABI == ABI_ELFv2 && crtl->calls_eh_return)
18394
+ int i, cr_off = info->ehcr_offset;
18396
+ for (i = 0; i < 8; i++)
18397
+ if (!call_used_regs[CR0_REGNO + i])
18399
+ rtx reg = gen_rtx_REG (SImode, 0);
18400
+ emit_insn (gen_frame_load (reg, frame_reg_rtx,
18401
+ cr_off + frame_off));
18403
+ insn = emit_insn (gen_movsi_to_cr_one
18404
+ (gen_rtx_REG (CCmode, CR0_REGNO + i), reg));
18406
+ if (!exit_func && flag_shrink_wrap)
18408
+ add_reg_note (insn, REG_CFA_RESTORE,
18409
+ gen_rtx_REG (SImode, CR0_REGNO + i));
18411
+ RTX_FRAME_RELATED_P (insn) = 1;
18414
+ cr_off += reg_size;
18418
/* Get the old lr if we saved it. If we are restoring registers
18419
out-of-line, then the out-of-line routines can do this for us. */
18420
if (restore_lr && restoring_GPRs_inline)
18421
@@ -21156,7 +23876,7 @@
18423
rtx reg = gen_rtx_REG (reg_mode, 2);
18424
emit_insn (gen_frame_load (reg, frame_reg_rtx,
18425
- frame_off + 5 * reg_size));
18426
+ frame_off + RS6000_TOC_SAVE_SLOT));
18430
@@ -21442,6 +24162,7 @@
18431
if (! restoring_FPRs_inline)
18437
if (flag_shrink_wrap)
18438
@@ -21450,10 +24171,9 @@
18439
sym = rs6000_savres_routine_sym (info,
18440
SAVRES_FPR | (lr ? SAVRES_LR : 0));
18441
RTVEC_ELT (p, 2) = gen_rtx_USE (VOIDmode, sym);
18442
- RTVEC_ELT (p, 3) = gen_rtx_USE (VOIDmode,
18443
- gen_rtx_REG (Pmode,
18444
- DEFAULT_ABI == ABI_AIX
18446
+ reg = (DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_ELFv2)? 1 : 11;
18447
+ RTVEC_ELT (p, 3) = gen_rtx_USE (VOIDmode, gen_rtx_REG (Pmode, reg));
18449
for (i = 0; i < 64 - info->first_fp_reg_save; i++)
18451
rtx reg = gen_rtx_REG (DFmode, info->first_fp_reg_save + i);
18452
@@ -21531,7 +24251,8 @@
18454
System V.4 Powerpc's (and the embedded ABI derived from it) use a
18455
different traceback table. */
18456
- if (DEFAULT_ABI == ABI_AIX && ! flag_inhibit_size_directive
18457
+ if ((DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_ELFv2)
18458
+ && ! flag_inhibit_size_directive
18459
&& rs6000_traceback != traceback_none && !cfun->is_thunk)
18461
const char *fname = NULL;
18462
@@ -21859,6 +24580,12 @@
18463
SIBLING_CALL_P (insn) = 1;
18466
+ /* Ensure we have a global entry point for the thunk. ??? We could
18467
+ avoid that if the target routine doesn't need a global entry point,
18468
+ but we do not know whether this is the case at this point. */
18469
+ if (DEFAULT_ABI == ABI_ELFv2)
18470
+ cfun->machine->r2_setup_needed = true;
18472
/* Run just enough of rest_of_compilation to get the insns emitted.
18473
There's not really enough bulk here to make other passes such as
18474
instruction scheduling worth while. Note that use_thunk calls
18475
@@ -22555,7 +25282,7 @@
18476
if (TARGET_PROFILE_KERNEL)
18479
- if (DEFAULT_ABI == ABI_AIX)
18480
+ if (DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_ELFv2)
18482
#ifndef NO_PROFILE_COUNTERS
18483
# define NO_PROFILE_COUNTERS 0
18484
@@ -22699,29 +25426,9 @@
18490
- if (!TARGET_PROFILE_KERNEL)
18492
- /* Don't do anything, done in output_profile_hook (). */
18496
- gcc_assert (!TARGET_32BIT);
18498
- asm_fprintf (file, "\tmflr %s\n", reg_names[0]);
18499
- asm_fprintf (file, "\tstd %s,16(%s)\n", reg_names[0], reg_names[1]);
18501
- if (cfun->static_chain_decl != NULL)
18503
- asm_fprintf (file, "\tstd %s,24(%s)\n",
18504
- reg_names[STATIC_CHAIN_REGNUM], reg_names[1]);
18505
- fprintf (file, "\tbl %s\n", RS6000_MCOUNT);
18506
- asm_fprintf (file, "\tld %s,24(%s)\n",
18507
- reg_names[STATIC_CHAIN_REGNUM], reg_names[1]);
18510
- fprintf (file, "\tbl %s\n", RS6000_MCOUNT);
18512
+ /* Don't do anything, done in output_profile_hook (). */
18516
@@ -22847,6 +25554,7 @@
18517
|| rs6000_cpu_attr == CPU_POWER4
18518
|| rs6000_cpu_attr == CPU_POWER5
18519
|| rs6000_cpu_attr == CPU_POWER7
18520
+ || rs6000_cpu_attr == CPU_POWER8
18521
|| rs6000_cpu_attr == CPU_CELL)
18522
&& recog_memoized (dep_insn)
18523
&& (INSN_CODE (dep_insn) >= 0))
18524
@@ -23129,7 +25837,8 @@
18525
if (rs6000_cpu_attr == CPU_CELL)
18526
return get_attr_cell_micro (insn) == CELL_MICRO_ALWAYS;
18528
- if (rs6000_sched_groups)
18529
+ if (rs6000_sched_groups
18530
+ && (rs6000_cpu == PROCESSOR_POWER4 || rs6000_cpu == PROCESSOR_POWER5))
18532
enum attr_type type = get_attr_type (insn);
18533
if (type == TYPE_LOAD_EXT_U
18534
@@ -23154,7 +25863,8 @@
18535
|| GET_CODE (PATTERN (insn)) == CLOBBER)
18538
- if (rs6000_sched_groups)
18539
+ if (rs6000_sched_groups
18540
+ && (rs6000_cpu == PROCESSOR_POWER4 || rs6000_cpu == PROCESSOR_POWER5))
18542
enum attr_type type = get_attr_type (insn);
18543
if (type == TYPE_LOAD_U || type == TYPE_STORE_U
18544
@@ -23433,6 +26143,8 @@
18553
@@ -24060,6 +26772,39 @@
18557
+ case PROCESSOR_POWER8:
18558
+ type = get_attr_type (insn);
18562
+ case TYPE_CR_LOGICAL:
18563
+ case TYPE_DELAYED_CR:
18567
+ case TYPE_COMPARE:
18568
+ case TYPE_DELAYED_COMPARE:
18569
+ case TYPE_VAR_DELAYED_COMPARE:
18570
+ case TYPE_IMUL_COMPARE:
18571
+ case TYPE_LMUL_COMPARE:
18574
+ case TYPE_LOAD_L:
18575
+ case TYPE_STORE_C:
18576
+ case TYPE_LOAD_U:
18577
+ case TYPE_LOAD_UX:
18578
+ case TYPE_LOAD_EXT:
18579
+ case TYPE_LOAD_EXT_U:
18580
+ case TYPE_LOAD_EXT_UX:
18581
+ case TYPE_STORE_UX:
18582
+ case TYPE_VECSTORE:
18583
+ case TYPE_MFJMPR:
18584
+ case TYPE_MTJMPR:
18593
@@ -24138,6 +26883,25 @@
18597
+ case PROCESSOR_POWER8:
18598
+ type = get_attr_type (insn);
18606
+ case TYPE_LOAD_L:
18607
+ case TYPE_STORE_C:
18608
+ case TYPE_LOAD_EXT_U:
18609
+ case TYPE_LOAD_EXT_UX:
18610
+ case TYPE_STORE_UX:
18619
@@ -24227,8 +26991,9 @@
18620
if (can_issue_more && !is_branch_slot_insn (next_insn))
18623
- /* Power6 and Power7 have special group ending nop. */
18624
- if (rs6000_cpu_attr == CPU_POWER6 || rs6000_cpu_attr == CPU_POWER7)
18625
+ /* Do we have a special group ending nop? */
18626
+ if (rs6000_cpu_attr == CPU_POWER6 || rs6000_cpu_attr == CPU_POWER7
18627
+ || rs6000_cpu_attr == CPU_POWER8)
18629
nop = gen_group_ending_nop ();
18630
emit_insn_before (nop, next_insn);
18631
@@ -24599,6 +27364,11 @@
18632
ret = (TARGET_32BIT) ? 12 : 24;
18636
+ gcc_assert (!TARGET_32BIT);
18642
ret = (TARGET_32BIT) ? 40 : 48;
18643
@@ -24654,6 +27424,7 @@
18646
/* Under V.4/eabi/darwin, __trampoline_setup does the real work. */
18650
emit_library_call (gen_rtx_SYMBOL_REF (Pmode, "__trampoline_setup"),
18651
@@ -24948,7 +27719,7 @@
18653
rs6000_elf_output_toc_section_asm_op (const void *data ATTRIBUTE_UNUSED)
18655
- if (DEFAULT_ABI == ABI_AIX
18656
+ if ((DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_ELFv2)
18657
&& TARGET_MINIMAL_TOC
18658
&& !TARGET_RELOCATABLE)
18660
@@ -24969,7 +27740,8 @@
18662
fprintf (asm_out_file, "%s\n", MINIMAL_TOC_SECTION_ASM_OP);
18664
- else if (DEFAULT_ABI == ABI_AIX && !TARGET_RELOCATABLE)
18665
+ else if ((DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_ELFv2)
18666
+ && !TARGET_RELOCATABLE)
18667
fprintf (asm_out_file, "%s\n", TOC_SECTION_ASM_OP);
18670
@@ -25519,7 +28291,7 @@
18674
- else if (DEFAULT_ABI == ABI_AIX)
18675
+ else if (DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_ELFv2)
18679
@@ -25595,7 +28367,7 @@
18681
rs6000_elf_declare_function_name (FILE *file, const char *name, tree decl)
18683
- if (TARGET_64BIT)
18684
+ if (TARGET_64BIT && DEFAULT_ABI != ABI_ELFv2)
18686
fputs ("\t.section\t\".opd\",\"aw\"\n\t.align 3\n", file);
18687
ASM_OUTPUT_LABEL (file, name);
18688
@@ -25661,8 +28433,7 @@
18689
fprintf (file, "%s:\n", desc_name);
18690
fprintf (file, "\t.long %s\n", orig_name);
18691
fputs ("\t.long _GLOBAL_OFFSET_TABLE_\n", file);
18692
- if (DEFAULT_ABI == ABI_AIX)
18693
- fputs ("\t.long 0\n", file);
18694
+ fputs ("\t.long 0\n", file);
18695
fprintf (file, "\t.previous\n");
18697
ASM_OUTPUT_LABEL (file, name);
18698
@@ -25691,7 +28462,7 @@
18701
#if defined (POWERPC_LINUX) || defined (POWERPC_FREEBSD)
18702
- if (TARGET_32BIT)
18703
+ if (TARGET_32BIT || DEFAULT_ABI == ABI_ELFv2)
18704
file_end_indicate_exec_stack ();
18707
@@ -26431,7 +29202,8 @@
18708
/* For those processors that have slow LR/CTR moves, make them more
18709
expensive than memory in order to bias spills to memory .*/
18710
else if ((rs6000_cpu == PROCESSOR_POWER6
18711
- || rs6000_cpu == PROCESSOR_POWER7)
18712
+ || rs6000_cpu == PROCESSOR_POWER7
18713
+ || rs6000_cpu == PROCESSOR_POWER8)
18714
&& reg_classes_intersect_p (rclass, LINK_OR_CTR_REGS))
18715
ret = 6 * hard_regno_nregs[0][mode];
18717
@@ -26441,7 +29213,7 @@
18720
/* If we have VSX, we can easily move between FPR or Altivec registers. */
18721
- else if (VECTOR_UNIT_VSX_P (mode)
18722
+ else if (VECTOR_MEM_VSX_P (mode)
18723
&& reg_classes_intersect_p (to, VSX_REGS)
18724
&& reg_classes_intersect_p (from, VSX_REGS))
18725
ret = 2 * hard_regno_nregs[32][mode];
18726
@@ -26482,7 +29254,8 @@
18728
if (reg_classes_intersect_p (rclass, GENERAL_REGS))
18729
ret = 4 * hard_regno_nregs[0][mode];
18730
- else if (reg_classes_intersect_p (rclass, FLOAT_REGS))
18731
+ else if ((reg_classes_intersect_p (rclass, FLOAT_REGS)
18732
+ || reg_classes_intersect_p (rclass, VSX_REGS)))
18733
ret = 4 * hard_regno_nregs[32][mode];
18734
else if (reg_classes_intersect_p (rclass, ALTIVEC_REGS))
18735
ret = 4 * hard_regno_nregs[FIRST_ALTIVEC_REGNO][mode];
18736
@@ -26644,54 +29417,26 @@
18737
emit_insn (gen_rtx_SET (VOIDmode, dst, r));
18740
-/* Newton-Raphson approximation of floating point divide with just 2 passes
18741
- (either single precision floating point, or newer machines with higher
18742
- accuracy estimates). Support both scalar and vector divide. Assumes no
18743
- trapping math and finite arguments. */
18744
+/* Newton-Raphson approximation of floating point divide DST = N/D. If NOTE_P,
18745
+ add a reg_note saying that this was a division. Support both scalar and
18746
+ vector divide. Assumes no trapping math and finite arguments. */
18749
-rs6000_emit_swdiv_high_precision (rtx dst, rtx n, rtx d)
18751
+rs6000_emit_swdiv (rtx dst, rtx n, rtx d, bool note_p)
18753
enum machine_mode mode = GET_MODE (dst);
18754
- rtx x0, e0, e1, y1, u0, v0;
18755
- enum insn_code code = optab_handler (smul_optab, mode);
18756
- insn_gen_fn gen_mul = GEN_FCN (code);
18757
- rtx one = rs6000_load_constant_and_splat (mode, dconst1);
18758
+ rtx one, x0, e0, x1, xprev, eprev, xnext, enext, u, v;
18761
- gcc_assert (code != CODE_FOR_nothing);
18762
+ /* Low precision estimates guarantee 5 bits of accuracy. High
18763
+ precision estimates guarantee 14 bits of accuracy. SFmode
18764
+ requires 23 bits of accuracy. DFmode requires 52 bits of
18765
+ accuracy. Each pass at least doubles the accuracy, leading
18766
+ to the following. */
18767
+ int passes = (TARGET_RECIP_PRECISION) ? 1 : 3;
18768
+ if (mode == DFmode || mode == V2DFmode)
18771
- /* x0 = 1./d estimate */
18772
- x0 = gen_reg_rtx (mode);
18773
- emit_insn (gen_rtx_SET (VOIDmode, x0,
18774
- gen_rtx_UNSPEC (mode, gen_rtvec (1, d),
18777
- e0 = gen_reg_rtx (mode);
18778
- rs6000_emit_nmsub (e0, d, x0, one); /* e0 = 1. - (d * x0) */
18780
- e1 = gen_reg_rtx (mode);
18781
- rs6000_emit_madd (e1, e0, e0, e0); /* e1 = (e0 * e0) + e0 */
18783
- y1 = gen_reg_rtx (mode);
18784
- rs6000_emit_madd (y1, e1, x0, x0); /* y1 = (e1 * x0) + x0 */
18786
- u0 = gen_reg_rtx (mode);
18787
- emit_insn (gen_mul (u0, n, y1)); /* u0 = n * y1 */
18789
- v0 = gen_reg_rtx (mode);
18790
- rs6000_emit_nmsub (v0, d, u0, n); /* v0 = n - (d * u0) */
18792
- rs6000_emit_madd (dst, v0, y1, u0); /* dst = (v0 * y1) + u0 */
18795
-/* Newton-Raphson approximation of floating point divide that has a low
18796
- precision estimate. Assumes no trapping math and finite arguments. */
18799
-rs6000_emit_swdiv_low_precision (rtx dst, rtx n, rtx d)
18801
- enum machine_mode mode = GET_MODE (dst);
18802
- rtx x0, e0, e1, e2, y1, y2, y3, u0, v0, one;
18803
enum insn_code code = optab_handler (smul_optab, mode);
18804
insn_gen_fn gen_mul = GEN_FCN (code);
18806
@@ -26705,47 +29450,45 @@
18807
gen_rtx_UNSPEC (mode, gen_rtvec (1, d),
18810
- e0 = gen_reg_rtx (mode);
18811
- rs6000_emit_nmsub (e0, d, x0, one); /* e0 = 1. - d * x0 */
18812
+ /* Each iteration but the last calculates x_(i+1) = x_i * (2 - d * x_i). */
18813
+ if (passes > 1) {
18815
- y1 = gen_reg_rtx (mode);
18816
- rs6000_emit_madd (y1, e0, x0, x0); /* y1 = x0 + e0 * x0 */
18817
+ /* e0 = 1. - d * x0 */
18818
+ e0 = gen_reg_rtx (mode);
18819
+ rs6000_emit_nmsub (e0, d, x0, one);
18821
- e1 = gen_reg_rtx (mode);
18822
- emit_insn (gen_mul (e1, e0, e0)); /* e1 = e0 * e0 */
18823
+ /* x1 = x0 + e0 * x0 */
18824
+ x1 = gen_reg_rtx (mode);
18825
+ rs6000_emit_madd (x1, e0, x0, x0);
18827
- y2 = gen_reg_rtx (mode);
18828
- rs6000_emit_madd (y2, e1, y1, y1); /* y2 = y1 + e1 * y1 */
18829
+ for (i = 0, xprev = x1, eprev = e0; i < passes - 2;
18830
+ ++i, xprev = xnext, eprev = enext) {
18832
+ /* enext = eprev * eprev */
18833
+ enext = gen_reg_rtx (mode);
18834
+ emit_insn (gen_mul (enext, eprev, eprev));
18836
- e2 = gen_reg_rtx (mode);
18837
- emit_insn (gen_mul (e2, e1, e1)); /* e2 = e1 * e1 */
18838
+ /* xnext = xprev + enext * xprev */
18839
+ xnext = gen_reg_rtx (mode);
18840
+ rs6000_emit_madd (xnext, enext, xprev, xprev);
18843
- y3 = gen_reg_rtx (mode);
18844
- rs6000_emit_madd (y3, e2, y2, y2); /* y3 = y2 + e2 * y2 */
18848
- u0 = gen_reg_rtx (mode);
18849
- emit_insn (gen_mul (u0, n, y3)); /* u0 = n * y3 */
18850
+ /* The last iteration calculates x_(i+1) = n * x_i * (2 - d * x_i). */
18852
- v0 = gen_reg_rtx (mode);
18853
- rs6000_emit_nmsub (v0, d, u0, n); /* v0 = n - d * u0 */
18854
+ /* u = n * xprev */
18855
+ u = gen_reg_rtx (mode);
18856
+ emit_insn (gen_mul (u, n, xprev));
18858
- rs6000_emit_madd (dst, v0, y3, u0); /* dst = u0 + v0 * y3 */
18860
+ /* v = n - (d * u) */
18861
+ v = gen_reg_rtx (mode);
18862
+ rs6000_emit_nmsub (v, d, u, n);
18864
-/* Newton-Raphson approximation of floating point divide DST = N/D. If NOTE_P,
18865
- add a reg_note saying that this was a division. Support both scalar and
18866
- vector divide. Assumes no trapping math and finite arguments. */
18867
+ /* dst = (v * xprev) + u */
18868
+ rs6000_emit_madd (dst, v, xprev, u);
18871
-rs6000_emit_swdiv (rtx dst, rtx n, rtx d, bool note_p)
18873
- enum machine_mode mode = GET_MODE (dst);
18875
- if (RS6000_RECIP_HIGH_PRECISION_P (mode))
18876
- rs6000_emit_swdiv_high_precision (dst, n, d);
18878
- rs6000_emit_swdiv_low_precision (dst, n, d);
18881
add_reg_note (get_last_insn (), REG_EQUAL, gen_rtx_DIV (mode, n, d));
18883
@@ -26759,7 +29502,16 @@
18884
enum machine_mode mode = GET_MODE (src);
18885
rtx x0 = gen_reg_rtx (mode);
18886
rtx y = gen_reg_rtx (mode);
18887
- int passes = (TARGET_RECIP_PRECISION) ? 2 : 3;
18889
+ /* Low precision estimates guarantee 5 bits of accuracy. High
18890
+ precision estimates guarantee 14 bits of accuracy. SFmode
18891
+ requires 23 bits of accuracy. DFmode requires 52 bits of
18892
+ accuracy. Each pass at least doubles the accuracy, leading
18893
+ to the following. */
18894
+ int passes = (TARGET_RECIP_PRECISION) ? 1 : 3;
18895
+ if (mode == DFmode || mode == V2DFmode)
18898
REAL_VALUE_TYPE dconst3_2;
18901
@@ -26921,6 +29673,136 @@
18905
+/* Expand an Altivec constant permutation for little endian mode.
18906
+ There are two issues: First, the two input operands must be
18907
+ swapped so that together they form a double-wide array in LE
18908
+ order. Second, the vperm instruction has surprising behavior
18909
+ in LE mode: it interprets the elements of the source vectors
18910
+ in BE mode ("left to right") and interprets the elements of
18911
+ the destination vector in LE mode ("right to left"). To
18912
+ correct for this, we must subtract each element of the permute
18913
+ control vector from 31.
18915
+ For example, suppose we want to concatenate vr10 = {0, 1, 2, 3}
18916
+ with vr11 = {4, 5, 6, 7} and extract {0, 2, 4, 6} using a vperm.
18917
+ We place {0,1,2,3,8,9,10,11,16,17,18,19,24,25,26,27} in vr12 to
18918
+ serve as the permute control vector. Then, in BE mode,
18922
+ places the desired result in vr9. However, in LE mode the
18923
+ vector contents will be
18925
+ vr10 = 00000003 00000002 00000001 00000000
18926
+ vr11 = 00000007 00000006 00000005 00000004
18928
+ The result of the vperm using the same permute control vector is
18930
+ vr9 = 05000000 07000000 01000000 03000000
18932
+ That is, the leftmost 4 bytes of vr10 are interpreted as the
18933
+ source for the rightmost 4 bytes of vr9, and so on.
18935
+ If we change the permute control vector to
18937
+ vr12 = {31,20,29,28,23,22,21,20,15,14,13,12,7,6,5,4}
18943
+ we get the desired
18945
+ vr9 = 00000006 00000004 00000002 00000000. */
18948
+altivec_expand_vec_perm_const_le (rtx operands[4])
18952
+ rtx constv, unspec;
18953
+ rtx target = operands[0];
18954
+ rtx op0 = operands[1];
18955
+ rtx op1 = operands[2];
18956
+ rtx sel = operands[3];
18958
+ /* Unpack and adjust the constant selector. */
18959
+ for (i = 0; i < 16; ++i)
18961
+ rtx e = XVECEXP (sel, 0, i);
18962
+ unsigned int elt = 31 - (INTVAL (e) & 31);
18963
+ perm[i] = GEN_INT (elt);
18966
+ /* Expand to a permute, swapping the inputs and using the
18967
+ adjusted selector. */
18968
+ if (!REG_P (op0))
18969
+ op0 = force_reg (V16QImode, op0);
18970
+ if (!REG_P (op1))
18971
+ op1 = force_reg (V16QImode, op1);
18973
+ constv = gen_rtx_CONST_VECTOR (V16QImode, gen_rtvec_v (16, perm));
18974
+ constv = force_reg (V16QImode, constv);
18975
+ unspec = gen_rtx_UNSPEC (V16QImode, gen_rtvec (3, op1, op0, constv),
18977
+ if (!REG_P (target))
18979
+ rtx tmp = gen_reg_rtx (V16QImode);
18980
+ emit_move_insn (tmp, unspec);
18984
+ emit_move_insn (target, unspec);
18987
+/* Similarly to altivec_expand_vec_perm_const_le, we must adjust the
18988
+ permute control vector. But here it's not a constant, so we must
18989
+ generate a vector splat/subtract to do the adjustment. */
18992
+altivec_expand_vec_perm_le (rtx operands[4])
18994
+ rtx splat, unspec;
18995
+ rtx target = operands[0];
18996
+ rtx op0 = operands[1];
18997
+ rtx op1 = operands[2];
18998
+ rtx sel = operands[3];
18999
+ rtx tmp = target;
19001
+ /* Get everything in regs so the pattern matches. */
19002
+ if (!REG_P (op0))
19003
+ op0 = force_reg (V16QImode, op0);
19004
+ if (!REG_P (op1))
19005
+ op1 = force_reg (V16QImode, op1);
19006
+ if (!REG_P (sel))
19007
+ sel = force_reg (V16QImode, sel);
19008
+ if (!REG_P (target))
19009
+ tmp = gen_reg_rtx (V16QImode);
19011
+ /* SEL = splat(31) - SEL. */
19012
+ /* We want to subtract from 31, but we can't vspltisb 31 since
19013
+ it's out of range. -1 works as well because only the low-order
19014
+ five bits of the permute control vector elements are used. */
19015
+ splat = gen_rtx_VEC_DUPLICATE (V16QImode,
19016
+ gen_rtx_CONST_INT (QImode, -1));
19017
+ emit_move_insn (tmp, splat);
19018
+ sel = gen_rtx_MINUS (V16QImode, tmp, sel);
19019
+ emit_move_insn (tmp, sel);
19021
+ /* Permute with operands reversed and adjusted selector. */
19022
+ unspec = gen_rtx_UNSPEC (V16QImode, gen_rtvec (3, op1, op0, tmp),
19025
+ /* Copy into target, possibly by way of a register. */
19026
+ if (!REG_P (target))
19028
+ emit_move_insn (tmp, unspec);
19032
+ emit_move_insn (target, unspec);
19035
/* Expand an Altivec constant permutation. Return true if we match
19036
an efficient implementation; false to fall back to VPERM. */
19038
@@ -26928,26 +29810,37 @@
19039
altivec_expand_vec_perm_const (rtx operands[4])
19041
struct altivec_perm_insn {
19042
+ HOST_WIDE_INT mask;
19043
enum insn_code impl;
19044
unsigned char perm[16];
19046
static const struct altivec_perm_insn patterns[] = {
19047
- { CODE_FOR_altivec_vpkuhum,
19048
+ { OPTION_MASK_ALTIVEC, CODE_FOR_altivec_vpkuhum,
19049
{ 1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29, 31 } },
19050
- { CODE_FOR_altivec_vpkuwum,
19051
+ { OPTION_MASK_ALTIVEC, CODE_FOR_altivec_vpkuwum,
19052
{ 2, 3, 6, 7, 10, 11, 14, 15, 18, 19, 22, 23, 26, 27, 30, 31 } },
19053
- { CODE_FOR_altivec_vmrghb,
19054
+ { OPTION_MASK_ALTIVEC,
19055
+ BYTES_BIG_ENDIAN ? CODE_FOR_altivec_vmrghb : CODE_FOR_altivec_vmrglb,
19056
{ 0, 16, 1, 17, 2, 18, 3, 19, 4, 20, 5, 21, 6, 22, 7, 23 } },
19057
- { CODE_FOR_altivec_vmrghh,
19058
+ { OPTION_MASK_ALTIVEC,
19059
+ BYTES_BIG_ENDIAN ? CODE_FOR_altivec_vmrghh : CODE_FOR_altivec_vmrglh,
19060
{ 0, 1, 16, 17, 2, 3, 18, 19, 4, 5, 20, 21, 6, 7, 22, 23 } },
19061
- { CODE_FOR_altivec_vmrghw,
19062
+ { OPTION_MASK_ALTIVEC,
19063
+ BYTES_BIG_ENDIAN ? CODE_FOR_altivec_vmrghw : CODE_FOR_altivec_vmrglw,
19064
{ 0, 1, 2, 3, 16, 17, 18, 19, 4, 5, 6, 7, 20, 21, 22, 23 } },
19065
- { CODE_FOR_altivec_vmrglb,
19066
+ { OPTION_MASK_ALTIVEC,
19067
+ BYTES_BIG_ENDIAN ? CODE_FOR_altivec_vmrglb : CODE_FOR_altivec_vmrghb,
19068
{ 8, 24, 9, 25, 10, 26, 11, 27, 12, 28, 13, 29, 14, 30, 15, 31 } },
19069
- { CODE_FOR_altivec_vmrglh,
19070
+ { OPTION_MASK_ALTIVEC,
19071
+ BYTES_BIG_ENDIAN ? CODE_FOR_altivec_vmrglh : CODE_FOR_altivec_vmrghh,
19072
{ 8, 9, 24, 25, 10, 11, 26, 27, 12, 13, 28, 29, 14, 15, 30, 31 } },
19073
- { CODE_FOR_altivec_vmrglw,
19074
- { 8, 9, 10, 11, 24, 25, 26, 27, 12, 13, 14, 15, 28, 29, 30, 31 } }
19075
+ { OPTION_MASK_ALTIVEC,
19076
+ BYTES_BIG_ENDIAN ? CODE_FOR_altivec_vmrglw : CODE_FOR_altivec_vmrghw,
19077
+ { 8, 9, 10, 11, 24, 25, 26, 27, 12, 13, 14, 15, 28, 29, 30, 31 } },
19078
+ { OPTION_MASK_P8_VECTOR, CODE_FOR_p8_vmrgew,
19079
+ { 0, 1, 2, 3, 16, 17, 18, 19, 8, 9, 10, 11, 24, 25, 26, 27 } },
19080
+ { OPTION_MASK_P8_VECTOR, CODE_FOR_p8_vmrgow,
19081
+ { 4, 5, 6, 7, 20, 21, 22, 23, 12, 13, 14, 15, 28, 29, 30, 31 } }
19084
unsigned int i, j, elt, which;
19085
@@ -27004,6 +29897,8 @@
19089
+ if (!BYTES_BIG_ENDIAN)
19091
emit_insn (gen_altivec_vspltb (target, op0, GEN_INT (elt)));
19094
@@ -27015,9 +29910,10 @@
19098
+ int field = BYTES_BIG_ENDIAN ? elt / 2 : 7 - elt / 2;
19099
x = gen_reg_rtx (V8HImode);
19100
emit_insn (gen_altivec_vsplth (x, gen_lowpart (V8HImode, op0),
19101
- GEN_INT (elt / 2)));
19102
+ GEN_INT (field)));
19103
emit_move_insn (target, gen_lowpart (V16QImode, x));
19106
@@ -27033,9 +29929,10 @@
19110
+ int field = BYTES_BIG_ENDIAN ? elt / 4 : 3 - elt / 4;
19111
x = gen_reg_rtx (V4SImode);
19112
emit_insn (gen_altivec_vspltw (x, gen_lowpart (V4SImode, op0),
19113
- GEN_INT (elt / 4)));
19114
+ GEN_INT (field)));
19115
emit_move_insn (target, gen_lowpart (V16QImode, x));
19118
@@ -27047,6 +29944,9 @@
19122
+ if ((patterns[j].mask & rs6000_isa_flags) == 0)
19125
elt = patterns[j].perm[0];
19126
if (perm[0] == elt)
19128
@@ -27070,7 +29970,30 @@
19129
enum machine_mode omode = insn_data[icode].operand[0].mode;
19130
enum machine_mode imode = insn_data[icode].operand[1].mode;
19133
+ /* For little-endian, don't use vpkuwum and vpkuhum if the
19134
+ underlying vector type is not V4SI and V8HI, respectively.
19135
+ For example, using vpkuwum with a V8HI picks up the even
19136
+ halfwords (BE numbering) when the even halfwords (LE
19137
+ numbering) are what we need. */
19138
+ if (!BYTES_BIG_ENDIAN
19139
+ && icode == CODE_FOR_altivec_vpkuwum
19140
+ && ((GET_CODE (op0) == REG
19141
+ && GET_MODE (op0) != V4SImode)
19142
+ || (GET_CODE (op0) == SUBREG
19143
+ && GET_MODE (XEXP (op0, 0)) != V4SImode)))
19145
+ if (!BYTES_BIG_ENDIAN
19146
+ && icode == CODE_FOR_altivec_vpkuhum
19147
+ && ((GET_CODE (op0) == REG
19148
+ && GET_MODE (op0) != V8HImode)
19149
+ || (GET_CODE (op0) == SUBREG
19150
+ && GET_MODE (XEXP (op0, 0)) != V8HImode)))
19153
+ /* For little-endian, the two input operands must be swapped
19154
+ (or swapped back) to ensure proper right-to-left numbering
19155
+ from 0 to 2N-1. */
19156
+ if (swapped ^ !BYTES_BIG_ENDIAN)
19157
x = op0, op0 = op1, op1 = x;
19158
if (imode != V16QImode)
19160
@@ -27088,6 +30011,12 @@
19164
+ if (!BYTES_BIG_ENDIAN)
19166
+ altivec_expand_vec_perm_const_le (operands);
19173
@@ -27137,6 +30066,21 @@
19174
gcc_assert (GET_MODE_NUNITS (vmode) == 2);
19175
dmode = mode_for_vector (GET_MODE_INNER (vmode), 4);
19177
+ /* For little endian, swap operands and invert/swap selectors
19178
+ to get the correct xxpermdi. The operand swap sets up the
19179
+ inputs as a little endian array. The selectors are swapped
19180
+ because they are defined to use big endian ordering. The
19181
+ selectors are inverted to get the correct doublewords for
19182
+ little endian ordering. */
19183
+ if (!BYTES_BIG_ENDIAN)
19186
+ perm0 = 3 - perm0;
19187
+ perm1 = 3 - perm1;
19188
+ n = perm0, perm0 = perm1, perm1 = n;
19189
+ x = op0, op0 = op1, op1 = x;
19192
x = gen_rtx_VEC_CONCAT (dmode, op0, op1);
19193
v = gen_rtvec (2, GEN_INT (perm0), GEN_INT (perm1));
19194
x = gen_rtx_VEC_SELECT (vmode, x, gen_rtx_PARALLEL (VOIDmode, v));
19195
@@ -27232,7 +30176,7 @@
19196
unsigned i, high, nelt = GET_MODE_NUNITS (vmode);
19199
- high = (highp == BYTES_BIG_ENDIAN ? 0 : nelt / 2);
19200
+ high = (highp ? 0 : nelt / 2);
19201
for (i = 0; i < nelt / 2; i++)
19203
perm[i * 2] = GEN_INT (i + high);
19204
@@ -27287,6 +30231,8 @@
19206
enum machine_mode mode;
19207
unsigned int regno;
19208
+ enum machine_mode elt_mode;
19211
/* Special handling for structs in darwin64. */
19213
@@ -27306,6 +30252,36 @@
19214
/* Otherwise fall through to standard ABI rules. */
19217
+ /* The ELFv2 ABI returns homogeneous VFP aggregates in registers. */
19218
+ if (rs6000_discover_homogeneous_aggregate (TYPE_MODE (valtype), valtype,
19219
+ &elt_mode, &n_elts))
19221
+ int first_reg, n_regs, i;
19224
+ if (SCALAR_FLOAT_MODE_P (elt_mode))
19226
+ /* _Decimal128 must use even/odd register pairs. */
19227
+ first_reg = (elt_mode == TDmode) ? FP_ARG_RETURN + 1 : FP_ARG_RETURN;
19228
+ n_regs = (GET_MODE_SIZE (elt_mode) + 7) >> 3;
19232
+ first_reg = ALTIVEC_ARG_RETURN;
19236
+ par = gen_rtx_PARALLEL (TYPE_MODE (valtype), rtvec_alloc (n_elts));
19237
+ for (i = 0; i < n_elts; i++)
19239
+ rtx r = gen_rtx_REG (elt_mode, first_reg + i * n_regs);
19240
+ rtx off = GEN_INT (i * GET_MODE_SIZE (elt_mode));
19241
+ XVECEXP (par, 0, i) = gen_rtx_EXPR_LIST (VOIDmode, r, off);
19247
if (TARGET_32BIT && TARGET_POWERPC64 && TYPE_MODE (valtype) == DImode)
19249
/* Long long return value need be split in -mpowerpc64, 32bit ABI. */
19250
@@ -27680,22 +30656,32 @@
19252
{ "altivec", OPTION_MASK_ALTIVEC, false, true },
19253
{ "cmpb", OPTION_MASK_CMPB, false, true },
19254
+ { "crypto", OPTION_MASK_CRYPTO, false, true },
19255
+ { "direct-move", OPTION_MASK_DIRECT_MOVE, false, true },
19256
{ "dlmzb", OPTION_MASK_DLMZB, false, true },
19257
{ "fprnd", OPTION_MASK_FPRND, false, true },
19258
{ "hard-dfp", OPTION_MASK_DFP, false, true },
19259
+ { "htm", OPTION_MASK_HTM, false, true },
19260
{ "isel", OPTION_MASK_ISEL, false, true },
19261
{ "mfcrf", OPTION_MASK_MFCRF, false, true },
19262
{ "mfpgpr", OPTION_MASK_MFPGPR, false, true },
19263
{ "mulhw", OPTION_MASK_MULHW, false, true },
19264
{ "multiple", OPTION_MASK_MULTIPLE, false, true },
19265
- { "update", OPTION_MASK_NO_UPDATE, true , true },
19266
{ "popcntb", OPTION_MASK_POPCNTB, false, true },
19267
{ "popcntd", OPTION_MASK_POPCNTD, false, true },
19268
+ { "power8-fusion", OPTION_MASK_P8_FUSION, false, true },
19269
+ { "power8-fusion-sign", OPTION_MASK_P8_FUSION_SIGN, false, true },
19270
+ { "power8-vector", OPTION_MASK_P8_VECTOR, false, true },
19271
{ "powerpc-gfxopt", OPTION_MASK_PPC_GFXOPT, false, true },
19272
{ "powerpc-gpopt", OPTION_MASK_PPC_GPOPT, false, true },
19273
+ { "quad-memory", OPTION_MASK_QUAD_MEMORY, false, true },
19274
{ "recip-precision", OPTION_MASK_RECIP_PRECISION, false, true },
19275
{ "string", OPTION_MASK_STRING, false, true },
19276
+ { "update", OPTION_MASK_NO_UPDATE, true , true },
19277
+ { "upper-regs-df", OPTION_MASK_UPPER_REGS_DF, false, false },
19278
+ { "upper-regs-sf", OPTION_MASK_UPPER_REGS_SF, false, false },
19279
{ "vsx", OPTION_MASK_VSX, false, true },
19280
+ { "vsx-timode", OPTION_MASK_VSX_TIMODE, false, true },
19281
#ifdef OPTION_MASK_64BIT
19283
{ "aix64", OPTION_MASK_64BIT, false, false },
19284
@@ -27735,6 +30721,9 @@
19285
{ "frsqrtes", RS6000_BTM_FRSQRTES, false, false },
19286
{ "popcntd", RS6000_BTM_POPCNTD, false, false },
19287
{ "cell", RS6000_BTM_CELL, false, false },
19288
+ { "power8-vector", RS6000_BTM_P8_VECTOR, false, false },
19289
+ { "crypto", RS6000_BTM_CRYPTO, false, false },
19290
+ { "htm", RS6000_BTM_HTM, false, false },
19293
/* Option variables that we want to support inside attribute((target)) and
19294
@@ -28251,7 +31240,6 @@
19296
size_t max_column = 76;
19297
const char *comma = "";
19298
- const char *nl = "\n";
19301
start_column += fprintf (file, "%*s", indent, "");
19302
@@ -28282,7 +31270,6 @@
19303
fprintf (stderr, ", \\\n%*s", (int)start_column, "");
19304
cur_column = start_column + len;
19309
fprintf (file, "%s%s%s%s", comma, prefix, no_str,
19310
@@ -28292,7 +31279,7 @@
19314
- fputs (nl, file);
19315
+ fputs ("\n", file);
19318
/* Helper function to print the current isa options on a line. */
19319
@@ -28468,118 +31455,149 @@
19323
-/* A function pointer under AIX is a pointer to a data area whose first word
19324
- contains the actual address of the function, whose second word contains a
19325
- pointer to its TOC, and whose third word contains a value to place in the
19326
- static chain register (r11). Note that if we load the static chain, our
19327
- "trampoline" need not have any executable code. */
19329
+/* Expand code to perform a call under the AIX or ELFv2 ABI. */
19332
-rs6000_call_indirect_aix (rtx value, rtx func_desc, rtx flag)
19333
+rs6000_call_aix (rtx value, rtx func_desc, rtx flag, rtx cookie)
19335
+ rtx toc_reg = gen_rtx_REG (Pmode, TOC_REGNUM);
19336
+ rtx toc_load = NULL_RTX;
19337
+ rtx toc_restore = NULL_RTX;
19342
- rtx stack_toc_offset;
19343
- rtx stack_toc_mem;
19344
- rtx func_toc_offset;
19345
- rtx func_toc_mem;
19346
- rtx func_sc_offset;
19348
+ rtx abi_reg = NULL_RTX;
19352
- rtx (*call_func) (rtx, rtx, rtx, rtx);
19353
- rtx (*call_value_func) (rtx, rtx, rtx, rtx, rtx);
19355
- stack_ptr = gen_rtx_REG (Pmode, STACK_POINTER_REGNUM);
19356
- toc_reg = gen_rtx_REG (Pmode, TOC_REGNUM);
19357
+ /* Handle longcall attributes. */
19358
+ if (INTVAL (cookie) & CALL_LONG)
19359
+ func_desc = rs6000_longcall_ref (func_desc);
19361
- /* Load up address of the actual function. */
19362
- func_desc = force_reg (Pmode, func_desc);
19363
- func_addr = gen_reg_rtx (Pmode);
19364
- emit_move_insn (func_addr, gen_rtx_MEM (Pmode, func_desc));
19366
- if (TARGET_32BIT)
19367
+ /* Handle indirect calls. */
19368
+ if (GET_CODE (func_desc) != SYMBOL_REF
19369
+ || (DEFAULT_ABI == ABI_AIX && !SYMBOL_REF_FUNCTION_P (func_desc)))
19371
+ /* Save the TOC into its reserved slot before the call,
19372
+ and prepare to restore it after the call. */
19373
+ rtx stack_ptr = gen_rtx_REG (Pmode, STACK_POINTER_REGNUM);
19374
+ rtx stack_toc_offset = GEN_INT (RS6000_TOC_SAVE_SLOT);
19375
+ rtx stack_toc_mem = gen_frame_mem (Pmode,
19376
+ gen_rtx_PLUS (Pmode, stack_ptr,
19377
+ stack_toc_offset));
19378
+ toc_restore = gen_rtx_SET (VOIDmode, toc_reg, stack_toc_mem);
19380
- stack_toc_offset = GEN_INT (TOC_SAVE_OFFSET_32BIT);
19381
- func_toc_offset = GEN_INT (AIX_FUNC_DESC_TOC_32BIT);
19382
- func_sc_offset = GEN_INT (AIX_FUNC_DESC_SC_32BIT);
19383
- if (TARGET_POINTERS_TO_NESTED_FUNCTIONS)
19385
- call_func = gen_call_indirect_aix32bit;
19386
- call_value_func = gen_call_value_indirect_aix32bit;
19388
+ /* Can we optimize saving the TOC in the prologue or
19389
+ do we need to do it at every call? */
19390
+ if (TARGET_SAVE_TOC_INDIRECT && !cfun->calls_alloca)
19391
+ cfun->machine->save_toc_in_prologue = true;
19394
- call_func = gen_call_indirect_aix32bit_nor11;
19395
- call_value_func = gen_call_value_indirect_aix32bit_nor11;
19396
+ MEM_VOLATILE_P (stack_toc_mem) = 1;
19397
+ emit_move_insn (stack_toc_mem, toc_reg);
19402
- stack_toc_offset = GEN_INT (TOC_SAVE_OFFSET_64BIT);
19403
- func_toc_offset = GEN_INT (AIX_FUNC_DESC_TOC_64BIT);
19404
- func_sc_offset = GEN_INT (AIX_FUNC_DESC_SC_64BIT);
19405
- if (TARGET_POINTERS_TO_NESTED_FUNCTIONS)
19407
+ if (DEFAULT_ABI == ABI_ELFv2)
19409
- call_func = gen_call_indirect_aix64bit;
19410
- call_value_func = gen_call_value_indirect_aix64bit;
19411
+ /* A function pointer in the ELFv2 ABI is just a plain address, but
19412
+ the ABI requires it to be loaded into r12 before the call. */
19413
+ func_addr = gen_rtx_REG (Pmode, 12);
19414
+ emit_move_insn (func_addr, func_desc);
19415
+ abi_reg = func_addr;
19419
- call_func = gen_call_indirect_aix64bit_nor11;
19420
- call_value_func = gen_call_value_indirect_aix64bit_nor11;
19423
+ /* A function pointer under AIX is a pointer to a data area whose
19424
+ first word contains the actual address of the function, whose
19425
+ second word contains a pointer to its TOC, and whose third word
19426
+ contains a value to place in the static chain register (r11).
19427
+ Note that if we load the static chain, our "trampoline" need
19428
+ not have any executable code. */
19430
- /* Reserved spot to store the TOC. */
19431
- stack_toc_mem = gen_frame_mem (Pmode,
19432
- gen_rtx_PLUS (Pmode,
19434
- stack_toc_offset));
19435
+ /* Load up address of the actual function. */
19436
+ func_desc = force_reg (Pmode, func_desc);
19437
+ func_addr = gen_reg_rtx (Pmode);
19438
+ emit_move_insn (func_addr, gen_rtx_MEM (Pmode, func_desc));
19440
- gcc_assert (cfun);
19441
- gcc_assert (cfun->machine);
19442
+ /* Prepare to load the TOC of the called function. Note that the
19443
+ TOC load must happen immediately before the actual call so
19444
+ that unwinding the TOC registers works correctly. See the
19445
+ comment in frob_update_context. */
19446
+ rtx func_toc_offset = GEN_INT (GET_MODE_SIZE (Pmode));
19447
+ rtx func_toc_mem = gen_rtx_MEM (Pmode,
19448
+ gen_rtx_PLUS (Pmode, func_desc,
19449
+ func_toc_offset));
19450
+ toc_load = gen_rtx_USE (VOIDmode, func_toc_mem);
19452
- /* Can we optimize saving the TOC in the prologue or do we need to do it at
19454
- if (TARGET_SAVE_TOC_INDIRECT && !cfun->calls_alloca)
19455
- cfun->machine->save_toc_in_prologue = true;
19457
+ /* If we have a static chain, load it up. */
19458
+ if (TARGET_POINTERS_TO_NESTED_FUNCTIONS)
19460
+ rtx sc_reg = gen_rtx_REG (Pmode, STATIC_CHAIN_REGNUM);
19461
+ rtx func_sc_offset = GEN_INT (2 * GET_MODE_SIZE (Pmode));
19462
+ rtx func_sc_mem = gen_rtx_MEM (Pmode,
19463
+ gen_rtx_PLUS (Pmode, func_desc,
19464
+ func_sc_offset));
19465
+ emit_move_insn (sc_reg, func_sc_mem);
19466
+ abi_reg = sc_reg;
19472
- MEM_VOLATILE_P (stack_toc_mem) = 1;
19473
- emit_move_insn (stack_toc_mem, toc_reg);
19474
+ /* Direct calls use the TOC: for local calls, the callee will
19475
+ assume the TOC register is set; for non-local calls, the
19476
+ PLT stub needs the TOC register. */
19477
+ abi_reg = toc_reg;
19478
+ func_addr = func_desc;
19481
- /* Calculate the address to load the TOC of the called function. We don't
19482
- actually load this until the split after reload. */
19483
- func_toc_mem = gen_rtx_MEM (Pmode,
19484
- gen_rtx_PLUS (Pmode,
19486
- func_toc_offset));
19487
+ /* Create the call. */
19488
+ call[0] = gen_rtx_CALL (VOIDmode, gen_rtx_MEM (SImode, func_addr), flag);
19489
+ if (value != NULL_RTX)
19490
+ call[0] = gen_rtx_SET (VOIDmode, value, call[0]);
19493
- /* If we have a static chain, load it up. */
19494
- if (TARGET_POINTERS_TO_NESTED_FUNCTIONS)
19496
- func_sc_mem = gen_rtx_MEM (Pmode,
19497
- gen_rtx_PLUS (Pmode,
19499
- func_sc_offset));
19501
+ call[n_call++] = toc_load;
19503
+ call[n_call++] = toc_restore;
19505
- sc_reg = gen_rtx_REG (Pmode, STATIC_CHAIN_REGNUM);
19506
- emit_move_insn (sc_reg, func_sc_mem);
19508
+ call[n_call++] = gen_rtx_CLOBBER (VOIDmode, gen_rtx_REG (Pmode, LR_REGNO));
19510
+ insn = gen_rtx_PARALLEL (VOIDmode, gen_rtvec_v (n_call, call));
19511
+ insn = emit_call_insn (insn);
19513
+ /* Mention all registers defined by the ABI to hold information
19514
+ as uses in CALL_INSN_FUNCTION_USAGE. */
19516
+ use_reg (&CALL_INSN_FUNCTION_USAGE (insn), abi_reg);
19519
+/* Expand code to perform a sibling call under the AIX or ELFv2 ABI. */
19522
+rs6000_sibcall_aix (rtx value, rtx func_desc, rtx flag, rtx cookie)
19527
+ gcc_assert (INTVAL (cookie) == 0);
19529
/* Create the call. */
19531
- insn = call_value_func (value, func_addr, flag, func_toc_mem,
19534
- insn = call_func (func_addr, flag, func_toc_mem, stack_toc_mem);
19535
+ call[0] = gen_rtx_CALL (VOIDmode, gen_rtx_MEM (SImode, func_desc), flag);
19536
+ if (value != NULL_RTX)
19537
+ call[0] = gen_rtx_SET (VOIDmode, value, call[0]);
19539
- emit_call_insn (insn);
19540
+ call[1] = simple_return_rtx;
19542
+ insn = gen_rtx_PARALLEL (VOIDmode, gen_rtvec_v (2, call));
19543
+ insn = emit_call_insn (insn);
19545
+ /* Note use of the TOC register. */
19546
+ use_reg (&CALL_INSN_FUNCTION_USAGE (insn), gen_rtx_REG (Pmode, TOC_REGNUM));
19547
+ /* We need to also mark a use of the link register since the function we
19548
+ sibling-call to will use it to return to our caller. */
19549
+ use_reg (&CALL_INSN_FUNCTION_USAGE (insn), gen_rtx_REG (Pmode, LR_REGNO));
19552
/* Return whether we need to always update the saved TOC pointer when we update
19553
@@ -28680,6 +31698,656 @@
19554
add_to_hard_reg_set (&set->set, Pmode, RS6000_PIC_OFFSET_TABLE_REGNUM);
19558
+/* Helper function for rs6000_split_logical to emit a logical instruction after
19559
+ spliting the operation to single GPR registers.
19561
+ DEST is the destination register.
19562
+ OP1 and OP2 are the input source registers.
19563
+ CODE is the base operation (AND, IOR, XOR, NOT).
19564
+ MODE is the machine mode.
19565
+ If COMPLEMENT_FINAL_P is true, wrap the whole operation with NOT.
19566
+ If COMPLEMENT_OP1_P is true, wrap operand1 with NOT.
19567
+ If COMPLEMENT_OP2_P is true, wrap operand2 with NOT.
19568
+ CLOBBER_REG is either NULL or a scratch register of type CC to allow
19569
+ formation of the AND instructions. */
19572
+rs6000_split_logical_inner (rtx dest,
19575
+ enum rtx_code code,
19576
+ enum machine_mode mode,
19577
+ bool complement_final_p,
19578
+ bool complement_op1_p,
19579
+ bool complement_op2_p,
19585
+ /* Optimize AND of 0/0xffffffff and IOR/XOR of 0. */
19586
+ if (op2 && GET_CODE (op2) == CONST_INT
19587
+ && (mode == SImode || (mode == DImode && TARGET_POWERPC64))
19588
+ && !complement_final_p && !complement_op1_p && !complement_op2_p)
19590
+ HOST_WIDE_INT mask = GET_MODE_MASK (mode);
19591
+ HOST_WIDE_INT value = INTVAL (op2) & mask;
19593
+ /* Optimize AND of 0 to just set 0. Optimize AND of -1 to be a move. */
19598
+ emit_insn (gen_rtx_SET (VOIDmode, dest, const0_rtx));
19602
+ else if (value == mask)
19604
+ if (!rtx_equal_p (dest, op1))
19605
+ emit_insn (gen_rtx_SET (VOIDmode, dest, op1));
19610
+ /* Optimize IOR/XOR of 0 to be a simple move. Split large operations
19611
+ into separate ORI/ORIS or XORI/XORIS instrucitons. */
19612
+ else if (code == IOR || code == XOR)
19616
+ if (!rtx_equal_p (dest, op1))
19617
+ emit_insn (gen_rtx_SET (VOIDmode, dest, op1));
19623
+ if (complement_op1_p)
19624
+ op1 = gen_rtx_NOT (mode, op1);
19626
+ if (complement_op2_p)
19627
+ op2 = gen_rtx_NOT (mode, op2);
19629
+ bool_rtx = ((code == NOT)
19630
+ ? gen_rtx_NOT (mode, op1)
19631
+ : gen_rtx_fmt_ee (code, mode, op1, op2));
19633
+ if (complement_final_p)
19634
+ bool_rtx = gen_rtx_NOT (mode, bool_rtx);
19636
+ set_rtx = gen_rtx_SET (VOIDmode, dest, bool_rtx);
19638
+ /* Is this AND with an explicit clobber? */
19641
+ rtx clobber = gen_rtx_CLOBBER (VOIDmode, clobber_reg);
19642
+ set_rtx = gen_rtx_PARALLEL (VOIDmode, gen_rtvec (2, set_rtx, clobber));
19645
+ emit_insn (set_rtx);
19649
+/* Split a DImode AND/IOR/XOR with a constant on a 32-bit system. These
19650
+ operations are split immediately during RTL generation to allow for more
19651
+ optimizations of the AND/IOR/XOR.
19653
+ OPERANDS is an array containing the destination and two input operands.
19654
+ CODE is the base operation (AND, IOR, XOR, NOT).
19655
+ MODE is the machine mode.
19656
+ If COMPLEMENT_FINAL_P is true, wrap the whole operation with NOT.
19657
+ If COMPLEMENT_OP1_P is true, wrap operand1 with NOT.
19658
+ If COMPLEMENT_OP2_P is true, wrap operand2 with NOT.
19659
+ CLOBBER_REG is either NULL or a scratch register of type CC to allow
19660
+ formation of the AND instructions. */
19663
+rs6000_split_logical_di (rtx operands[3],
19664
+ enum rtx_code code,
19665
+ bool complement_final_p,
19666
+ bool complement_op1_p,
19667
+ bool complement_op2_p,
19670
+ const HOST_WIDE_INT lower_32bits = HOST_WIDE_INT_C(0xffffffff);
19671
+ const HOST_WIDE_INT upper_32bits = ~ lower_32bits;
19672
+ const HOST_WIDE_INT sign_bit = HOST_WIDE_INT_C(0x80000000);
19673
+ enum hi_lo { hi = 0, lo = 1 };
19674
+ rtx op0_hi_lo[2], op1_hi_lo[2], op2_hi_lo[2];
19677
+ op0_hi_lo[hi] = gen_highpart (SImode, operands[0]);
19678
+ op1_hi_lo[hi] = gen_highpart (SImode, operands[1]);
19679
+ op0_hi_lo[lo] = gen_lowpart (SImode, operands[0]);
19680
+ op1_hi_lo[lo] = gen_lowpart (SImode, operands[1]);
19683
+ op2_hi_lo[hi] = op2_hi_lo[lo] = NULL_RTX;
19686
+ if (GET_CODE (operands[2]) != CONST_INT)
19688
+ op2_hi_lo[hi] = gen_highpart_mode (SImode, DImode, operands[2]);
19689
+ op2_hi_lo[lo] = gen_lowpart (SImode, operands[2]);
19693
+ HOST_WIDE_INT value = INTVAL (operands[2]);
19694
+ HOST_WIDE_INT value_hi_lo[2];
19696
+ gcc_assert (!complement_final_p);
19697
+ gcc_assert (!complement_op1_p);
19698
+ gcc_assert (!complement_op2_p);
19700
+ value_hi_lo[hi] = value >> 32;
19701
+ value_hi_lo[lo] = value & lower_32bits;
19703
+ for (i = 0; i < 2; i++)
19705
+ HOST_WIDE_INT sub_value = value_hi_lo[i];
19707
+ if (sub_value & sign_bit)
19708
+ sub_value |= upper_32bits;
19710
+ op2_hi_lo[i] = GEN_INT (sub_value);
19712
+ /* If this is an AND instruction, check to see if we need to load
19713
+ the value in a register. */
19714
+ if (code == AND && sub_value != -1 && sub_value != 0
19715
+ && !and_operand (op2_hi_lo[i], SImode))
19716
+ op2_hi_lo[i] = force_reg (SImode, op2_hi_lo[i]);
19721
+ for (i = 0; i < 2; i++)
19723
+ /* Split large IOR/XOR operations. */
19724
+ if ((code == IOR || code == XOR)
19725
+ && GET_CODE (op2_hi_lo[i]) == CONST_INT
19726
+ && !complement_final_p
19727
+ && !complement_op1_p
19728
+ && !complement_op2_p
19729
+ && clobber_reg == NULL_RTX
19730
+ && !logical_const_operand (op2_hi_lo[i], SImode))
19732
+ HOST_WIDE_INT value = INTVAL (op2_hi_lo[i]);
19733
+ HOST_WIDE_INT hi_16bits = value & HOST_WIDE_INT_C(0xffff0000);
19734
+ HOST_WIDE_INT lo_16bits = value & HOST_WIDE_INT_C(0x0000ffff);
19735
+ rtx tmp = gen_reg_rtx (SImode);
19737
+ /* Make sure the constant is sign extended. */
19738
+ if ((hi_16bits & sign_bit) != 0)
19739
+ hi_16bits |= upper_32bits;
19741
+ rs6000_split_logical_inner (tmp, op1_hi_lo[i], GEN_INT (hi_16bits),
19742
+ code, SImode, false, false, false,
19745
+ rs6000_split_logical_inner (op0_hi_lo[i], tmp, GEN_INT (lo_16bits),
19746
+ code, SImode, false, false, false,
19750
+ rs6000_split_logical_inner (op0_hi_lo[i], op1_hi_lo[i], op2_hi_lo[i],
19751
+ code, SImode, complement_final_p,
19752
+ complement_op1_p, complement_op2_p,
19759
+/* Split the insns that make up boolean operations operating on multiple GPR
19760
+ registers. The boolean MD patterns ensure that the inputs either are
19761
+ exactly the same as the output registers, or there is no overlap.
19763
+ OPERANDS is an array containing the destination and two input operands.
19764
+ CODE is the base operation (AND, IOR, XOR, NOT).
19765
+ MODE is the machine mode.
19766
+ If COMPLEMENT_FINAL_P is true, wrap the whole operation with NOT.
19767
+ If COMPLEMENT_OP1_P is true, wrap operand1 with NOT.
19768
+ If COMPLEMENT_OP2_P is true, wrap operand2 with NOT.
19769
+ CLOBBER_REG is either NULL or a scratch register of type CC to allow
19770
+ formation of the AND instructions. */
19773
+rs6000_split_logical (rtx operands[3],
19774
+ enum rtx_code code,
19775
+ bool complement_final_p,
19776
+ bool complement_op1_p,
19777
+ bool complement_op2_p,
19780
+ enum machine_mode mode = GET_MODE (operands[0]);
19781
+ enum machine_mode sub_mode;
19782
+ rtx op0, op1, op2;
19783
+ int sub_size, regno0, regno1, nregs, i;
19785
+ /* If this is DImode, use the specialized version that can run before
19786
+ register allocation. */
19787
+ if (mode == DImode && !TARGET_POWERPC64)
19789
+ rs6000_split_logical_di (operands, code, complement_final_p,
19790
+ complement_op1_p, complement_op2_p,
19795
+ op0 = operands[0];
19796
+ op1 = operands[1];
19797
+ op2 = (code == NOT) ? NULL_RTX : operands[2];
19798
+ sub_mode = (TARGET_POWERPC64) ? DImode : SImode;
19799
+ sub_size = GET_MODE_SIZE (sub_mode);
19800
+ regno0 = REGNO (op0);
19801
+ regno1 = REGNO (op1);
19803
+ gcc_assert (reload_completed);
19804
+ gcc_assert (IN_RANGE (regno0, FIRST_GPR_REGNO, LAST_GPR_REGNO));
19805
+ gcc_assert (IN_RANGE (regno1, FIRST_GPR_REGNO, LAST_GPR_REGNO));
19807
+ nregs = rs6000_hard_regno_nregs[(int)mode][regno0];
19808
+ gcc_assert (nregs > 1);
19810
+ if (op2 && REG_P (op2))
19811
+ gcc_assert (IN_RANGE (REGNO (op2), FIRST_GPR_REGNO, LAST_GPR_REGNO));
19813
+ for (i = 0; i < nregs; i++)
19815
+ int offset = i * sub_size;
19816
+ rtx sub_op0 = simplify_subreg (sub_mode, op0, mode, offset);
19817
+ rtx sub_op1 = simplify_subreg (sub_mode, op1, mode, offset);
19818
+ rtx sub_op2 = ((code == NOT)
19820
+ : simplify_subreg (sub_mode, op2, mode, offset));
19822
+ rs6000_split_logical_inner (sub_op0, sub_op1, sub_op2, code, sub_mode,
19823
+ complement_final_p, complement_op1_p,
19824
+ complement_op2_p, clobber_reg);
19831
+/* Return true if the peephole2 can combine a load involving a combination of
19832
+ an addis instruction and a load with an offset that can be fused together on
19835
+ The operands are:
19836
+ operands[0] register set with addis
19837
+ operands[1] value set via addis
19838
+ operands[2] target register being loaded
19839
+ operands[3] D-form memory reference using operands[0].
19841
+ In addition, we are passed a boolean that is true if this is a peephole2,
19842
+ and we can use see if the addis_reg is dead after the insn and can be
19843
+ replaced by the target register. */
19846
+fusion_gpr_load_p (rtx *operands, bool peep2_p)
19848
+ rtx addis_reg = operands[0];
19849
+ rtx addis_value = operands[1];
19850
+ rtx target = operands[2];
19851
+ rtx mem = operands[3];
19855
+ /* Validate arguments. */
19856
+ if (!base_reg_operand (addis_reg, GET_MODE (addis_reg)))
19859
+ if (!base_reg_operand (target, GET_MODE (target)))
19862
+ if (!fusion_gpr_addis (addis_value, GET_MODE (addis_value)))
19865
+ if (!fusion_gpr_mem_load (mem, GET_MODE (mem)))
19868
+ /* Allow sign/zero extension. */
19869
+ if (GET_CODE (mem) == ZERO_EXTEND
19870
+ || (GET_CODE (mem) == SIGN_EXTEND && TARGET_P8_FUSION_SIGN))
19871
+ mem = XEXP (mem, 0);
19873
+ if (!MEM_P (mem))
19876
+ addr = XEXP (mem, 0); /* either PLUS or LO_SUM. */
19877
+ if (GET_CODE (addr) != PLUS && GET_CODE (addr) != LO_SUM)
19880
+ /* Validate that the register used to load the high value is either the
19881
+ register being loaded, or we can safely replace its use in a peephole2.
19883
+ If this is a peephole2, we assume that there are 2 instructions in the
19884
+ peephole (addis and load), so we want to check if the target register was
19885
+ not used in the memory address and the register to hold the addis result
19886
+ is dead after the peephole. */
19887
+ if (REGNO (addis_reg) != REGNO (target))
19892
+ if (reg_mentioned_p (target, mem))
19895
+ if (!peep2_reg_dead_p (2, addis_reg))
19899
+ base_reg = XEXP (addr, 0);
19900
+ return REGNO (addis_reg) == REGNO (base_reg);
19903
+/* During the peephole2 pass, adjust and expand the insns for a load fusion
19904
+ sequence. We adjust the addis register to use the target register. If the
19905
+ load sign extends, we adjust the code to do the zero extending load, and an
19906
+ explicit sign extension later since the fusion only covers zero extending
19909
+ The operands are:
19910
+ operands[0] register set with addis (to be replaced with target)
19911
+ operands[1] value set via addis
19912
+ operands[2] target register being loaded
19913
+ operands[3] D-form memory reference using operands[0]. */
19916
+expand_fusion_gpr_load (rtx *operands)
19918
+ rtx addis_value = operands[1];
19919
+ rtx target = operands[2];
19920
+ rtx orig_mem = operands[3];
19921
+ rtx new_addr, new_mem, orig_addr, offset;
19922
+ enum rtx_code plus_or_lo_sum;
19923
+ enum machine_mode target_mode = GET_MODE (target);
19924
+ enum machine_mode extend_mode = target_mode;
19925
+ enum machine_mode ptr_mode = Pmode;
19926
+ enum rtx_code extend = UNKNOWN;
19927
+ rtx addis_reg = ((ptr_mode == target_mode)
19929
+ : simplify_subreg (ptr_mode, target, target_mode, 0));
19931
+ if (GET_CODE (orig_mem) == ZERO_EXTEND
19932
+ || (TARGET_P8_FUSION_SIGN && GET_CODE (orig_mem) == SIGN_EXTEND))
19934
+ extend = GET_CODE (orig_mem);
19935
+ orig_mem = XEXP (orig_mem, 0);
19936
+ target_mode = GET_MODE (orig_mem);
19939
+ gcc_assert (MEM_P (orig_mem));
19941
+ orig_addr = XEXP (orig_mem, 0);
19942
+ plus_or_lo_sum = GET_CODE (orig_addr);
19943
+ gcc_assert (plus_or_lo_sum == PLUS || plus_or_lo_sum == LO_SUM);
19945
+ offset = XEXP (orig_addr, 1);
19946
+ new_addr = gen_rtx_fmt_ee (plus_or_lo_sum, ptr_mode, addis_reg, offset);
19947
+ new_mem = change_address (orig_mem, target_mode, new_addr);
19949
+ if (extend != UNKNOWN)
19950
+ new_mem = gen_rtx_fmt_e (ZERO_EXTEND, extend_mode, new_mem);
19952
+ emit_insn (gen_rtx_SET (VOIDmode, addis_reg, addis_value));
19953
+ emit_insn (gen_rtx_SET (VOIDmode, target, new_mem));
19955
+ if (extend == SIGN_EXTEND)
19957
+ int sub_off = ((BYTES_BIG_ENDIAN)
19958
+ ? GET_MODE_SIZE (extend_mode) - GET_MODE_SIZE (target_mode)
19961
+ = simplify_subreg (target_mode, target, extend_mode, sub_off);
19963
+ emit_insn (gen_rtx_SET (VOIDmode, target,
19964
+ gen_rtx_SIGN_EXTEND (extend_mode, sign_reg)));
19970
+/* Return a string to fuse an addis instruction with a gpr load to the same
19971
+ register that we loaded up the addis instruction. The code is complicated,
19972
+ so we call output_asm_insn directly, and just return "".
19974
+ The operands are:
19975
+ operands[0] register set with addis (must be same reg as target).
19976
+ operands[1] value set via addis
19977
+ operands[2] target register being loaded
19978
+ operands[3] D-form memory reference using operands[0]. */
19981
+emit_fusion_gpr_load (rtx *operands)
19983
+ rtx addis_reg = operands[0];
19984
+ rtx addis_value = operands[1];
19985
+ rtx target = operands[2];
19986
+ rtx mem = operands[3];
19987
+ rtx fuse_ops[10];
19990
+ const char *addis_str = NULL;
19991
+ const char *load_str = NULL;
19992
+ const char *extend_insn = NULL;
19993
+ const char *mode_name = NULL;
19994
+ char insn_template[80];
19995
+ enum machine_mode mode;
19996
+ const char *comment_str = ASM_COMMENT_START;
19997
+ bool sign_p = false;
19999
+ gcc_assert (REG_P (addis_reg) && REG_P (target));
20000
+ gcc_assert (REGNO (addis_reg) == REGNO (target));
20002
+ if (*comment_str == ' ')
20005
+ /* Allow sign/zero extension. */
20006
+ if (GET_CODE (mem) == ZERO_EXTEND)
20007
+ mem = XEXP (mem, 0);
20009
+ else if (GET_CODE (mem) == SIGN_EXTEND && TARGET_P8_FUSION_SIGN)
20012
+ mem = XEXP (mem, 0);
20015
+ gcc_assert (MEM_P (mem));
20016
+ addr = XEXP (mem, 0);
20017
+ if (GET_CODE (addr) != PLUS && GET_CODE (addr) != LO_SUM)
20018
+ gcc_unreachable ();
20020
+ load_offset = XEXP (addr, 1);
20022
+ /* Now emit the load instruction to the same register. */
20023
+ mode = GET_MODE (mem);
20027
+ mode_name = "char";
20028
+ load_str = "lbz";
20029
+ extend_insn = "extsb %0,%0";
20033
+ mode_name = "short";
20034
+ load_str = "lhz";
20035
+ extend_insn = "extsh %0,%0";
20039
+ mode_name = "int";
20040
+ load_str = "lwz";
20041
+ extend_insn = "extsw %0,%0";
20045
+ if (TARGET_POWERPC64)
20047
+ mode_name = "long";
20051
+ gcc_unreachable ();
20055
+ gcc_unreachable ();
20058
+ /* Emit the addis instruction. */
20059
+ fuse_ops[0] = target;
20060
+ if (satisfies_constraint_L (addis_value))
20062
+ fuse_ops[1] = addis_value;
20063
+ addis_str = "lis %0,%v1";
20066
+ else if (GET_CODE (addis_value) == PLUS)
20068
+ rtx op0 = XEXP (addis_value, 0);
20069
+ rtx op1 = XEXP (addis_value, 1);
20071
+ if (REG_P (op0) && CONST_INT_P (op1)
20072
+ && satisfies_constraint_L (op1))
20074
+ fuse_ops[1] = op0;
20075
+ fuse_ops[2] = op1;
20076
+ addis_str = "addis %0,%1,%v2";
20080
+ else if (GET_CODE (addis_value) == HIGH)
20082
+ rtx value = XEXP (addis_value, 0);
20083
+ if (GET_CODE (value) == UNSPEC && XINT (value, 1) == UNSPEC_TOCREL)
20085
+ fuse_ops[1] = XVECEXP (value, 0, 0); /* symbol ref. */
20086
+ fuse_ops[2] = XVECEXP (value, 0, 1); /* TOC register. */
20088
+ addis_str = "addis %0,%2,%1@toc@ha";
20090
+ else if (TARGET_XCOFF)
20091
+ addis_str = "addis %0,%1@u(%2)";
20094
+ gcc_unreachable ();
20097
+ else if (GET_CODE (value) == PLUS)
20099
+ rtx op0 = XEXP (value, 0);
20100
+ rtx op1 = XEXP (value, 1);
20102
+ if (GET_CODE (op0) == UNSPEC
20103
+ && XINT (op0, 1) == UNSPEC_TOCREL
20104
+ && CONST_INT_P (op1))
20106
+ fuse_ops[1] = XVECEXP (op0, 0, 0); /* symbol ref. */
20107
+ fuse_ops[2] = XVECEXP (op0, 0, 1); /* TOC register. */
20108
+ fuse_ops[3] = op1;
20110
+ addis_str = "addis %0,%2,%1+%3@toc@ha";
20112
+ else if (TARGET_XCOFF)
20113
+ addis_str = "addis %0,%1+%3@u(%2)";
20116
+ gcc_unreachable ();
20120
+ else if (satisfies_constraint_L (value))
20122
+ fuse_ops[1] = value;
20123
+ addis_str = "lis %0,%v1";
20126
+ else if (TARGET_ELF && !TARGET_POWERPC64 && CONSTANT_P (value))
20128
+ fuse_ops[1] = value;
20129
+ addis_str = "lis %0,%1@ha";
20134
+ fatal_insn ("Could not generate addis value for fusion", addis_value);
20136
+ sprintf (insn_template, "%s\t\t%s gpr load fusion, type %s", addis_str,
20137
+ comment_str, mode_name);
20138
+ output_asm_insn (insn_template, fuse_ops);
20140
+ /* Emit the D-form load instruction. */
20141
+ if (CONST_INT_P (load_offset) && satisfies_constraint_I (load_offset))
20143
+ sprintf (insn_template, "%s %%0,%%1(%%0)", load_str);
20144
+ fuse_ops[1] = load_offset;
20145
+ output_asm_insn (insn_template, fuse_ops);
20148
+ else if (GET_CODE (load_offset) == UNSPEC
20149
+ && XINT (load_offset, 1) == UNSPEC_TOCREL)
20152
+ sprintf (insn_template, "%s %%0,%%1@toc@l(%%0)", load_str);
20154
+ else if (TARGET_XCOFF)
20155
+ sprintf (insn_template, "%s %%0,%%1@l(%%0)", load_str);
20158
+ gcc_unreachable ();
20160
+ fuse_ops[1] = XVECEXP (load_offset, 0, 0);
20161
+ output_asm_insn (insn_template, fuse_ops);
20164
+ else if (GET_CODE (load_offset) == PLUS
20165
+ && GET_CODE (XEXP (load_offset, 0)) == UNSPEC
20166
+ && XINT (XEXP (load_offset, 0), 1) == UNSPEC_TOCREL
20167
+ && CONST_INT_P (XEXP (load_offset, 1)))
20169
+ rtx tocrel_unspec = XEXP (load_offset, 0);
20171
+ sprintf (insn_template, "%s %%0,%%1+%%2@toc@l(%%0)", load_str);
20173
+ else if (TARGET_XCOFF)
20174
+ sprintf (insn_template, "%s %%0,%%1+%%2@l(%%0)", load_str);
20177
+ gcc_unreachable ();
20179
+ fuse_ops[1] = XVECEXP (tocrel_unspec, 0, 0);
20180
+ fuse_ops[2] = XEXP (load_offset, 1);
20181
+ output_asm_insn (insn_template, fuse_ops);
20184
+ else if (TARGET_ELF && !TARGET_POWERPC64 && CONSTANT_P (load_offset))
20186
+ sprintf (insn_template, "%s %%0,%%1@l(%%0)", load_str);
20188
+ fuse_ops[1] = load_offset;
20189
+ output_asm_insn (insn_template, fuse_ops);
20193
+ fatal_insn ("Unable to generate load offset for fusion", load_offset);
20195
+ /* Handle sign extension. The peephole2 pass generates this as a separate
20196
+ insn, but we handle it just in case it got reattached. */
20199
+ gcc_assert (extend_insn != NULL);
20200
+ output_asm_insn (extend_insn, fuse_ops);
20207
struct gcc_target targetm = TARGET_INITIALIZER;
20209
#include "gt-rs6000.h"
20210
--- a/src/gcc/config/rs6000/vsx.md
20211
+++ b/src/gcc/config/rs6000/vsx.md
20213
;; it to use gprs as well as vsx registers.
20214
(define_mode_iterator VSX_M [V16QI V8HI V4SI V2DI V4SF V2DF])
20216
+(define_mode_iterator VSX_M2 [V16QI
20222
+ (TI "TARGET_VSX_TIMODE")])
20224
;; Map into the appropriate load/store name based on the type
20225
(define_mode_attr VSm [(V16QI "vw4")
20234
;; Map into the appropriate suffix based on the type
20235
(define_mode_attr VSs [(V16QI "sp")
20243
;; Map the register class used
20244
(define_mode_attr VSr [(V16QI "v")
20252
;; Map the register class used for float<->int conversions
20253
(define_mode_attr VSr2 [(V2DF "wd")
20254
@@ -115,7 +123,6 @@
20261
;; Appropriate type for add ops (and other simple FP ops)
20262
@@ -192,6 +199,8 @@
20263
UNSPEC_VSX_CVDPSXWS
20264
UNSPEC_VSX_CVDPUXWS
20266
+ UNSPEC_VSX_CVSPDPN
20267
+ UNSPEC_VSX_CVDPSPN
20271
@@ -207,77 +216,393 @@
20275
-(define_insn "*vsx_mov<mode>"
20276
- [(set (match_operand:VSX_M 0 "nonimmediate_operand" "=Z,<VSr>,<VSr>,?Z,?wa,?wa,*Y,*r,*r,<VSr>,?wa,*r,v,wZ,v")
20277
- (match_operand:VSX_M 1 "input_operand" "<VSr>,Z,<VSr>,wa,Z,wa,r,Y,r,j,j,j,W,v,wZ"))]
20278
- "VECTOR_MEM_VSX_P (<MODE>mode)
20279
- && (register_operand (operands[0], <MODE>mode)
20280
- || register_operand (operands[1], <MODE>mode))"
20282
+;; The patterns for LE permuted loads and stores come before the general
20283
+;; VSX moves so they match first.
20284
+(define_insn_and_split "*vsx_le_perm_load_<mode>"
20285
+ [(set (match_operand:VSX_D 0 "vsx_register_operand" "=wa")
20286
+ (match_operand:VSX_D 1 "memory_operand" "Z"))]
20287
+ "!BYTES_BIG_ENDIAN && TARGET_VSX"
20289
+ "!BYTES_BIG_ENDIAN && TARGET_VSX"
20290
+ [(set (match_dup 2)
20291
+ (vec_select:<MODE>
20293
+ (parallel [(const_int 1) (const_int 0)])))
20294
+ (set (match_dup 0)
20295
+ (vec_select:<MODE>
20297
+ (parallel [(const_int 1) (const_int 0)])))]
20300
- switch (which_alternative)
20304
- gcc_assert (MEM_P (operands[0])
20305
- && GET_CODE (XEXP (operands[0], 0)) != PRE_INC
20306
- && GET_CODE (XEXP (operands[0], 0)) != PRE_DEC
20307
- && GET_CODE (XEXP (operands[0], 0)) != PRE_MODIFY);
20308
- return "stx<VSm>x %x1,%y0";
20309
+ operands[2] = can_create_pseudo_p () ? gen_reg_rtx_and_attrs (operands[0])
20313
+ [(set_attr "type" "vecload")
20314
+ (set_attr "length" "8")])
20318
- gcc_assert (MEM_P (operands[1])
20319
- && GET_CODE (XEXP (operands[1], 0)) != PRE_INC
20320
- && GET_CODE (XEXP (operands[1], 0)) != PRE_DEC
20321
- && GET_CODE (XEXP (operands[1], 0)) != PRE_MODIFY);
20322
- return "lx<VSm>x %x0,%y1";
20323
+(define_insn_and_split "*vsx_le_perm_load_<mode>"
20324
+ [(set (match_operand:VSX_W 0 "vsx_register_operand" "=wa")
20325
+ (match_operand:VSX_W 1 "memory_operand" "Z"))]
20326
+ "!BYTES_BIG_ENDIAN && TARGET_VSX"
20328
+ "!BYTES_BIG_ENDIAN && TARGET_VSX"
20329
+ [(set (match_dup 2)
20330
+ (vec_select:<MODE>
20332
+ (parallel [(const_int 2) (const_int 3)
20333
+ (const_int 0) (const_int 1)])))
20334
+ (set (match_dup 0)
20335
+ (vec_select:<MODE>
20337
+ (parallel [(const_int 2) (const_int 3)
20338
+ (const_int 0) (const_int 1)])))]
20341
+ operands[2] = can_create_pseudo_p () ? gen_reg_rtx_and_attrs (operands[0])
20345
+ [(set_attr "type" "vecload")
20346
+ (set_attr "length" "8")])
20350
- return "xxlor %x0,%x1,%x1";
20351
+(define_insn_and_split "*vsx_le_perm_load_v8hi"
20352
+ [(set (match_operand:V8HI 0 "vsx_register_operand" "=wa")
20353
+ (match_operand:V8HI 1 "memory_operand" "Z"))]
20354
+ "!BYTES_BIG_ENDIAN && TARGET_VSX"
20356
+ "!BYTES_BIG_ENDIAN && TARGET_VSX"
20357
+ [(set (match_dup 2)
20360
+ (parallel [(const_int 4) (const_int 5)
20361
+ (const_int 6) (const_int 7)
20362
+ (const_int 0) (const_int 1)
20363
+ (const_int 2) (const_int 3)])))
20364
+ (set (match_dup 0)
20367
+ (parallel [(const_int 4) (const_int 5)
20368
+ (const_int 6) (const_int 7)
20369
+ (const_int 0) (const_int 1)
20370
+ (const_int 2) (const_int 3)])))]
20373
+ operands[2] = can_create_pseudo_p () ? gen_reg_rtx_and_attrs (operands[0])
20377
+ [(set_attr "type" "vecload")
20378
+ (set_attr "length" "8")])
20385
+(define_insn_and_split "*vsx_le_perm_load_v16qi"
20386
+ [(set (match_operand:V16QI 0 "vsx_register_operand" "=wa")
20387
+ (match_operand:V16QI 1 "memory_operand" "Z"))]
20388
+ "!BYTES_BIG_ENDIAN && TARGET_VSX"
20390
+ "!BYTES_BIG_ENDIAN && TARGET_VSX"
20391
+ [(set (match_dup 2)
20392
+ (vec_select:V16QI
20394
+ (parallel [(const_int 8) (const_int 9)
20395
+ (const_int 10) (const_int 11)
20396
+ (const_int 12) (const_int 13)
20397
+ (const_int 14) (const_int 15)
20398
+ (const_int 0) (const_int 1)
20399
+ (const_int 2) (const_int 3)
20400
+ (const_int 4) (const_int 5)
20401
+ (const_int 6) (const_int 7)])))
20402
+ (set (match_dup 0)
20403
+ (vec_select:V16QI
20405
+ (parallel [(const_int 8) (const_int 9)
20406
+ (const_int 10) (const_int 11)
20407
+ (const_int 12) (const_int 13)
20408
+ (const_int 14) (const_int 15)
20409
+ (const_int 0) (const_int 1)
20410
+ (const_int 2) (const_int 3)
20411
+ (const_int 4) (const_int 5)
20412
+ (const_int 6) (const_int 7)])))]
20415
+ operands[2] = can_create_pseudo_p () ? gen_reg_rtx_and_attrs (operands[0])
20419
+ [(set_attr "type" "vecload")
20420
+ (set_attr "length" "8")])
20424
- return "xxlxor %x0,%x0,%x0";
20425
+(define_insn "*vsx_le_perm_store_<mode>"
20426
+ [(set (match_operand:VSX_D 0 "memory_operand" "=Z")
20427
+ (match_operand:VSX_D 1 "vsx_register_operand" "+wa"))]
20428
+ "!BYTES_BIG_ENDIAN && TARGET_VSX"
20430
+ [(set_attr "type" "vecstore")
20431
+ (set_attr "length" "12")])
20434
- return output_vec_const_move (operands);
20436
+ [(set (match_operand:VSX_D 0 "memory_operand" "")
20437
+ (match_operand:VSX_D 1 "vsx_register_operand" ""))]
20438
+ "!BYTES_BIG_ENDIAN && TARGET_VSX && !reload_completed"
20439
+ [(set (match_dup 2)
20440
+ (vec_select:<MODE>
20442
+ (parallel [(const_int 1) (const_int 0)])))
20443
+ (set (match_dup 0)
20444
+ (vec_select:<MODE>
20446
+ (parallel [(const_int 1) (const_int 0)])))]
20448
+ operands[2] = can_create_pseudo_p () ? gen_reg_rtx_and_attrs (operands[1])
20453
- gcc_assert (MEM_P (operands[0])
20454
- && GET_CODE (XEXP (operands[0], 0)) != PRE_INC
20455
- && GET_CODE (XEXP (operands[0], 0)) != PRE_DEC
20456
- && GET_CODE (XEXP (operands[0], 0)) != PRE_MODIFY);
20457
- return "stvx %1,%y0";
20458
+;; The post-reload split requires that we re-permute the source
20459
+;; register in case it is still live.
20461
+ [(set (match_operand:VSX_D 0 "memory_operand" "")
20462
+ (match_operand:VSX_D 1 "vsx_register_operand" ""))]
20463
+ "!BYTES_BIG_ENDIAN && TARGET_VSX && reload_completed"
20464
+ [(set (match_dup 1)
20465
+ (vec_select:<MODE>
20467
+ (parallel [(const_int 1) (const_int 0)])))
20468
+ (set (match_dup 0)
20469
+ (vec_select:<MODE>
20471
+ (parallel [(const_int 1) (const_int 0)])))
20472
+ (set (match_dup 1)
20473
+ (vec_select:<MODE>
20475
+ (parallel [(const_int 1) (const_int 0)])))]
20479
- gcc_assert (MEM_P (operands[0])
20480
- && GET_CODE (XEXP (operands[0], 0)) != PRE_INC
20481
- && GET_CODE (XEXP (operands[0], 0)) != PRE_DEC
20482
- && GET_CODE (XEXP (operands[0], 0)) != PRE_MODIFY);
20483
- return "lvx %0,%y1";
20484
+(define_insn "*vsx_le_perm_store_<mode>"
20485
+ [(set (match_operand:VSX_W 0 "memory_operand" "=Z")
20486
+ (match_operand:VSX_W 1 "vsx_register_operand" "+wa"))]
20487
+ "!BYTES_BIG_ENDIAN && TARGET_VSX"
20489
+ [(set_attr "type" "vecstore")
20490
+ (set_attr "length" "12")])
20493
- gcc_unreachable ();
20496
+ [(set (match_operand:VSX_W 0 "memory_operand" "")
20497
+ (match_operand:VSX_W 1 "vsx_register_operand" ""))]
20498
+ "!BYTES_BIG_ENDIAN && TARGET_VSX && !reload_completed"
20499
+ [(set (match_dup 2)
20500
+ (vec_select:<MODE>
20502
+ (parallel [(const_int 2) (const_int 3)
20503
+ (const_int 0) (const_int 1)])))
20504
+ (set (match_dup 0)
20505
+ (vec_select:<MODE>
20507
+ (parallel [(const_int 2) (const_int 3)
20508
+ (const_int 0) (const_int 1)])))]
20510
+ operands[2] = can_create_pseudo_p () ? gen_reg_rtx_and_attrs (operands[1])
20514
+;; The post-reload split requires that we re-permute the source
20515
+;; register in case it is still live.
20517
+ [(set (match_operand:VSX_W 0 "memory_operand" "")
20518
+ (match_operand:VSX_W 1 "vsx_register_operand" ""))]
20519
+ "!BYTES_BIG_ENDIAN && TARGET_VSX && reload_completed"
20520
+ [(set (match_dup 1)
20521
+ (vec_select:<MODE>
20523
+ (parallel [(const_int 2) (const_int 3)
20524
+ (const_int 0) (const_int 1)])))
20525
+ (set (match_dup 0)
20526
+ (vec_select:<MODE>
20528
+ (parallel [(const_int 2) (const_int 3)
20529
+ (const_int 0) (const_int 1)])))
20530
+ (set (match_dup 1)
20531
+ (vec_select:<MODE>
20533
+ (parallel [(const_int 2) (const_int 3)
20534
+ (const_int 0) (const_int 1)])))]
20537
+(define_insn "*vsx_le_perm_store_v8hi"
20538
+ [(set (match_operand:V8HI 0 "memory_operand" "=Z")
20539
+ (match_operand:V8HI 1 "vsx_register_operand" "+wa"))]
20540
+ "!BYTES_BIG_ENDIAN && TARGET_VSX"
20542
+ [(set_attr "type" "vecstore")
20543
+ (set_attr "length" "12")])
20546
+ [(set (match_operand:V8HI 0 "memory_operand" "")
20547
+ (match_operand:V8HI 1 "vsx_register_operand" ""))]
20548
+ "!BYTES_BIG_ENDIAN && TARGET_VSX && !reload_completed"
20549
+ [(set (match_dup 2)
20552
+ (parallel [(const_int 4) (const_int 5)
20553
+ (const_int 6) (const_int 7)
20554
+ (const_int 0) (const_int 1)
20555
+ (const_int 2) (const_int 3)])))
20556
+ (set (match_dup 0)
20559
+ (parallel [(const_int 4) (const_int 5)
20560
+ (const_int 6) (const_int 7)
20561
+ (const_int 0) (const_int 1)
20562
+ (const_int 2) (const_int 3)])))]
20564
+ operands[2] = can_create_pseudo_p () ? gen_reg_rtx_and_attrs (operands[1])
20568
+;; The post-reload split requires that we re-permute the source
20569
+;; register in case it is still live.
20571
+ [(set (match_operand:V8HI 0 "memory_operand" "")
20572
+ (match_operand:V8HI 1 "vsx_register_operand" ""))]
20573
+ "!BYTES_BIG_ENDIAN && TARGET_VSX && reload_completed"
20574
+ [(set (match_dup 1)
20577
+ (parallel [(const_int 4) (const_int 5)
20578
+ (const_int 6) (const_int 7)
20579
+ (const_int 0) (const_int 1)
20580
+ (const_int 2) (const_int 3)])))
20581
+ (set (match_dup 0)
20584
+ (parallel [(const_int 4) (const_int 5)
20585
+ (const_int 6) (const_int 7)
20586
+ (const_int 0) (const_int 1)
20587
+ (const_int 2) (const_int 3)])))
20588
+ (set (match_dup 1)
20591
+ (parallel [(const_int 4) (const_int 5)
20592
+ (const_int 6) (const_int 7)
20593
+ (const_int 0) (const_int 1)
20594
+ (const_int 2) (const_int 3)])))]
20597
+(define_insn "*vsx_le_perm_store_v16qi"
20598
+ [(set (match_operand:V16QI 0 "memory_operand" "=Z")
20599
+ (match_operand:V16QI 1 "vsx_register_operand" "+wa"))]
20600
+ "!BYTES_BIG_ENDIAN && TARGET_VSX"
20602
+ [(set_attr "type" "vecstore")
20603
+ (set_attr "length" "12")])
20606
+ [(set (match_operand:V16QI 0 "memory_operand" "")
20607
+ (match_operand:V16QI 1 "vsx_register_operand" ""))]
20608
+ "!BYTES_BIG_ENDIAN && TARGET_VSX && !reload_completed"
20609
+ [(set (match_dup 2)
20610
+ (vec_select:V16QI
20612
+ (parallel [(const_int 8) (const_int 9)
20613
+ (const_int 10) (const_int 11)
20614
+ (const_int 12) (const_int 13)
20615
+ (const_int 14) (const_int 15)
20616
+ (const_int 0) (const_int 1)
20617
+ (const_int 2) (const_int 3)
20618
+ (const_int 4) (const_int 5)
20619
+ (const_int 6) (const_int 7)])))
20620
+ (set (match_dup 0)
20621
+ (vec_select:V16QI
20623
+ (parallel [(const_int 8) (const_int 9)
20624
+ (const_int 10) (const_int 11)
20625
+ (const_int 12) (const_int 13)
20626
+ (const_int 14) (const_int 15)
20627
+ (const_int 0) (const_int 1)
20628
+ (const_int 2) (const_int 3)
20629
+ (const_int 4) (const_int 5)
20630
+ (const_int 6) (const_int 7)])))]
20632
+ operands[2] = can_create_pseudo_p () ? gen_reg_rtx_and_attrs (operands[1])
20636
+;; The post-reload split requires that we re-permute the source
20637
+;; register in case it is still live.
20639
+ [(set (match_operand:V16QI 0 "memory_operand" "")
20640
+ (match_operand:V16QI 1 "vsx_register_operand" ""))]
20641
+ "!BYTES_BIG_ENDIAN && TARGET_VSX && reload_completed"
20642
+ [(set (match_dup 1)
20643
+ (vec_select:V16QI
20645
+ (parallel [(const_int 8) (const_int 9)
20646
+ (const_int 10) (const_int 11)
20647
+ (const_int 12) (const_int 13)
20648
+ (const_int 14) (const_int 15)
20649
+ (const_int 0) (const_int 1)
20650
+ (const_int 2) (const_int 3)
20651
+ (const_int 4) (const_int 5)
20652
+ (const_int 6) (const_int 7)])))
20653
+ (set (match_dup 0)
20654
+ (vec_select:V16QI
20656
+ (parallel [(const_int 8) (const_int 9)
20657
+ (const_int 10) (const_int 11)
20658
+ (const_int 12) (const_int 13)
20659
+ (const_int 14) (const_int 15)
20660
+ (const_int 0) (const_int 1)
20661
+ (const_int 2) (const_int 3)
20662
+ (const_int 4) (const_int 5)
20663
+ (const_int 6) (const_int 7)])))
20664
+ (set (match_dup 1)
20665
+ (vec_select:V16QI
20667
+ (parallel [(const_int 8) (const_int 9)
20668
+ (const_int 10) (const_int 11)
20669
+ (const_int 12) (const_int 13)
20670
+ (const_int 14) (const_int 15)
20671
+ (const_int 0) (const_int 1)
20672
+ (const_int 2) (const_int 3)
20673
+ (const_int 4) (const_int 5)
20674
+ (const_int 6) (const_int 7)])))]
20678
+(define_insn "*vsx_mov<mode>"
20679
+ [(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")
20680
+ (match_operand:VSX_M 1 "input_operand" "<VSr>,Z,<VSr>,wa,Z,wa,r,wQ,r,Y,r,j,j,j,W,v,wZ"))]
20681
+ "VECTOR_MEM_VSX_P (<MODE>mode)
20682
+ && (register_operand (operands[0], <MODE>mode)
20683
+ || register_operand (operands[1], <MODE>mode))"
20685
+ return rs6000_output_move_128bit (operands);
20687
- [(set_attr "type" "vecstore,vecload,vecsimple,vecstore,vecload,vecsimple,*,*,*,vecsimple,vecsimple,*,*,vecstore,vecload")])
20688
+ [(set_attr "type" "vecstore,vecload,vecsimple,vecstore,vecload,vecsimple,load,store,store,load, *,vecsimple,vecsimple,*, *,vecstore,vecload")
20689
+ (set_attr "length" "4,4,4,4,4,4,12,12,12,12,16,4,4,*,16,4,4")])
20691
-;; Unlike other VSX moves, allow the GPRs, since a normal use of TImode is for
20692
-;; unions. However for plain data movement, slightly favor the vector loads
20693
-(define_insn "*vsx_movti"
20694
- [(set (match_operand:TI 0 "nonimmediate_operand" "=Z,wa,wa,?Y,?r,?r,wa,v,v,wZ")
20695
- (match_operand:TI 1 "input_operand" "wa,Z,wa,r,Y,r,j,W,wZ,v"))]
20696
- "VECTOR_MEM_VSX_P (TImode)
20697
+;; Unlike other VSX moves, allow the GPRs even for reloading, since a normal
20698
+;; use of TImode is for unions. However for plain data movement, slightly
20699
+;; favor the vector loads
20700
+(define_insn "*vsx_movti_64bit"
20701
+ [(set (match_operand:TI 0 "nonimmediate_operand" "=Z,wa,wa,wa,v,v,wZ,wQ,&r,Y,r,r,?r")
20702
+ (match_operand:TI 1 "input_operand" "wa,Z,wa,O,W,wZ,v,r,wQ,r,Y,r,n"))]
20703
+ "TARGET_POWERPC64 && VECTOR_MEM_VSX_P (TImode)
20704
&& (register_operand (operands[0], TImode)
20705
|| register_operand (operands[1], TImode))"
20707
+ return rs6000_output_move_128bit (operands);
20709
+ [(set_attr "type" "vecstore,vecload,vecsimple,vecsimple,vecsimple,vecstore,vecload,store,load,store,load,*,*")
20710
+ (set_attr "length" "4,4,4,4,16,4,4,8,8,8,8,8,8")])
20712
+(define_insn "*vsx_movti_32bit"
20713
+ [(set (match_operand:TI 0 "nonimmediate_operand" "=Z,wa,wa,wa,v, v,wZ,Q,Y,????r,????r,????r,r")
20714
+ (match_operand:TI 1 "input_operand" "wa, Z,wa, O,W,wZ, v,r,r, Q, Y, r,n"))]
20715
+ "! TARGET_POWERPC64 && VECTOR_MEM_VSX_P (TImode)
20716
+ && (register_operand (operands[0], TImode)
20717
+ || register_operand (operands[1], TImode))"
20719
switch (which_alternative)
20722
@@ -290,27 +615,45 @@
20723
return "xxlor %x0,%x1,%x1";
20726
+ return "xxlxor %x0,%x0,%x0";
20729
+ return output_vec_const_move (operands);
20733
+ return "stvx %1,%y0";
20736
- return "xxlxor %x0,%x0,%x0";
20737
+ return "lvx %0,%y1";
20740
- return output_vec_const_move (operands);
20741
+ if (TARGET_STRING)
20742
+ return \"stswi %1,%P0,16\";
20745
- return "stvx %1,%y0";
20749
- return "lvx %0,%y1";
20750
+ /* If the address is not used in the output, we can use lsi. Otherwise,
20751
+ fall through to generating four loads. */
20752
+ if (TARGET_STRING
20753
+ && ! reg_overlap_mentioned_p (operands[0], operands[1]))
20754
+ return \"lswi %0,%P1,16\";
20755
+ /* ... fall through ... */
20762
gcc_unreachable ();
20765
- [(set_attr "type" "vecstore,vecload,vecsimple,*,*,*,vecsimple,*,vecstore,vecload")])
20766
+ [(set_attr "type" "vecstore,vecload,vecsimple,vecsimple,vecsimple,vecstore,vecload,store_ux,store_ux,load_ux,load_ux, *, *")
20767
+ (set_attr "length" " 4, 4, 4, 4, 8, 4, 4, 16, 16, 16, 16,16,16")
20768
+ (set (attr "cell_micro") (if_then_else (match_test "TARGET_STRING")
20769
+ (const_string "always")
20770
+ (const_string "conditional")))])
20772
;; Explicit load/store expanders for the builtin functions
20773
(define_expand "vsx_load_<mode>"
20774
@@ -320,46 +663,48 @@
20777
(define_expand "vsx_store_<mode>"
20778
- [(set (match_operand:VEC_M 0 "memory_operand" "")
20779
- (match_operand:VEC_M 1 "vsx_register_operand" ""))]
20780
+ [(set (match_operand:VSX_M 0 "memory_operand" "")
20781
+ (match_operand:VSX_M 1 "vsx_register_operand" ""))]
20782
"VECTOR_MEM_VSX_P (<MODE>mode)"
20786
-;; VSX scalar and vector floating point arithmetic instructions
20787
+;; VSX vector floating point arithmetic instructions. The VSX scalar
20788
+;; instructions are now combined with the insn for the traditional floating
20790
(define_insn "*vsx_add<mode>3"
20791
- [(set (match_operand:VSX_B 0 "vsx_register_operand" "=<VSr>,?wa")
20792
- (plus:VSX_B (match_operand:VSX_B 1 "vsx_register_operand" "<VSr>,wa")
20793
- (match_operand:VSX_B 2 "vsx_register_operand" "<VSr>,wa")))]
20794
+ [(set (match_operand:VSX_F 0 "vsx_register_operand" "=<VSr>,?wa")
20795
+ (plus:VSX_F (match_operand:VSX_F 1 "vsx_register_operand" "<VSr>,wa")
20796
+ (match_operand:VSX_F 2 "vsx_register_operand" "<VSr>,wa")))]
20797
"VECTOR_UNIT_VSX_P (<MODE>mode)"
20798
- "x<VSv>add<VSs> %x0,%x1,%x2"
20799
+ "xvadd<VSs> %x0,%x1,%x2"
20800
[(set_attr "type" "<VStype_simple>")
20801
(set_attr "fp_type" "<VSfptype_simple>")])
20803
(define_insn "*vsx_sub<mode>3"
20804
- [(set (match_operand:VSX_B 0 "vsx_register_operand" "=<VSr>,?wa")
20805
- (minus:VSX_B (match_operand:VSX_B 1 "vsx_register_operand" "<VSr>,wa")
20806
- (match_operand:VSX_B 2 "vsx_register_operand" "<VSr>,wa")))]
20807
+ [(set (match_operand:VSX_F 0 "vsx_register_operand" "=<VSr>,?wa")
20808
+ (minus:VSX_F (match_operand:VSX_F 1 "vsx_register_operand" "<VSr>,wa")
20809
+ (match_operand:VSX_F 2 "vsx_register_operand" "<VSr>,wa")))]
20810
"VECTOR_UNIT_VSX_P (<MODE>mode)"
20811
- "x<VSv>sub<VSs> %x0,%x1,%x2"
20812
+ "xvsub<VSs> %x0,%x1,%x2"
20813
[(set_attr "type" "<VStype_simple>")
20814
(set_attr "fp_type" "<VSfptype_simple>")])
20816
(define_insn "*vsx_mul<mode>3"
20817
- [(set (match_operand:VSX_B 0 "vsx_register_operand" "=<VSr>,?wa")
20818
- (mult:VSX_B (match_operand:VSX_B 1 "vsx_register_operand" "<VSr>,wa")
20819
- (match_operand:VSX_B 2 "vsx_register_operand" "<VSr>,wa")))]
20820
+ [(set (match_operand:VSX_F 0 "vsx_register_operand" "=<VSr>,?wa")
20821
+ (mult:VSX_F (match_operand:VSX_F 1 "vsx_register_operand" "<VSr>,wa")
20822
+ (match_operand:VSX_F 2 "vsx_register_operand" "<VSr>,wa")))]
20823
"VECTOR_UNIT_VSX_P (<MODE>mode)"
20824
- "x<VSv>mul<VSs> %x0,%x1,%x2"
20825
- [(set_attr "type" "<VStype_mul>")
20826
+ "xvmul<VSs> %x0,%x1,%x2"
20827
+ [(set_attr "type" "<VStype_simple>")
20828
(set_attr "fp_type" "<VSfptype_mul>")])
20830
(define_insn "*vsx_div<mode>3"
20831
- [(set (match_operand:VSX_B 0 "vsx_register_operand" "=<VSr>,?wa")
20832
- (div:VSX_B (match_operand:VSX_B 1 "vsx_register_operand" "<VSr>,wa")
20833
- (match_operand:VSX_B 2 "vsx_register_operand" "<VSr>,wa")))]
20834
+ [(set (match_operand:VSX_F 0 "vsx_register_operand" "=<VSr>,?wa")
20835
+ (div:VSX_F (match_operand:VSX_F 1 "vsx_register_operand" "<VSr>,wa")
20836
+ (match_operand:VSX_F 2 "vsx_register_operand" "<VSr>,wa")))]
20837
"VECTOR_UNIT_VSX_P (<MODE>mode)"
20838
- "x<VSv>div<VSs> %x0,%x1,%x2"
20839
+ "xvdiv<VSs> %x0,%x1,%x2"
20840
[(set_attr "type" "<VStype_div>")
20841
(set_attr "fp_type" "<VSfptype_div>")])
20843
@@ -402,94 +747,72 @@
20844
(set_attr "fp_type" "<VSfptype_simple>")])
20846
(define_insn "vsx_fre<mode>2"
20847
- [(set (match_operand:VSX_B 0 "vsx_register_operand" "=<VSr>,?wa")
20848
- (unspec:VSX_B [(match_operand:VSX_B 1 "vsx_register_operand" "<VSr>,wa")]
20849
+ [(set (match_operand:VSX_F 0 "vsx_register_operand" "=<VSr>,?wa")
20850
+ (unspec:VSX_F [(match_operand:VSX_F 1 "vsx_register_operand" "<VSr>,wa")]
20852
"VECTOR_UNIT_VSX_P (<MODE>mode)"
20853
- "x<VSv>re<VSs> %x0,%x1"
20854
+ "xvre<VSs> %x0,%x1"
20855
[(set_attr "type" "<VStype_simple>")
20856
(set_attr "fp_type" "<VSfptype_simple>")])
20858
(define_insn "*vsx_neg<mode>2"
20859
- [(set (match_operand:VSX_B 0 "vsx_register_operand" "=<VSr>,?wa")
20860
- (neg:VSX_B (match_operand:VSX_B 1 "vsx_register_operand" "<VSr>,wa")))]
20861
+ [(set (match_operand:VSX_F 0 "vsx_register_operand" "=<VSr>,?wa")
20862
+ (neg:VSX_F (match_operand:VSX_F 1 "vsx_register_operand" "<VSr>,wa")))]
20863
"VECTOR_UNIT_VSX_P (<MODE>mode)"
20864
- "x<VSv>neg<VSs> %x0,%x1"
20865
+ "xvneg<VSs> %x0,%x1"
20866
[(set_attr "type" "<VStype_simple>")
20867
(set_attr "fp_type" "<VSfptype_simple>")])
20869
(define_insn "*vsx_abs<mode>2"
20870
- [(set (match_operand:VSX_B 0 "vsx_register_operand" "=<VSr>,?wa")
20871
- (abs:VSX_B (match_operand:VSX_B 1 "vsx_register_operand" "<VSr>,wa")))]
20872
+ [(set (match_operand:VSX_F 0 "vsx_register_operand" "=<VSr>,?wa")
20873
+ (abs:VSX_F (match_operand:VSX_F 1 "vsx_register_operand" "<VSr>,wa")))]
20874
"VECTOR_UNIT_VSX_P (<MODE>mode)"
20875
- "x<VSv>abs<VSs> %x0,%x1"
20876
+ "xvabs<VSs> %x0,%x1"
20877
[(set_attr "type" "<VStype_simple>")
20878
(set_attr "fp_type" "<VSfptype_simple>")])
20880
(define_insn "vsx_nabs<mode>2"
20881
- [(set (match_operand:VSX_B 0 "vsx_register_operand" "=<VSr>,?wa")
20884
- (match_operand:VSX_B 1 "vsx_register_operand" "<VSr>,wa"))))]
20885
+ [(set (match_operand:VSX_F 0 "vsx_register_operand" "=<VSr>,?wa")
20888
+ (match_operand:VSX_F 1 "vsx_register_operand" "<VSr>,wa"))))]
20889
"VECTOR_UNIT_VSX_P (<MODE>mode)"
20890
- "x<VSv>nabs<VSs> %x0,%x1"
20891
+ "xvnabs<VSs> %x0,%x1"
20892
[(set_attr "type" "<VStype_simple>")
20893
(set_attr "fp_type" "<VSfptype_simple>")])
20895
(define_insn "vsx_smax<mode>3"
20896
- [(set (match_operand:VSX_B 0 "vsx_register_operand" "=<VSr>,?wa")
20897
- (smax:VSX_B (match_operand:VSX_B 1 "vsx_register_operand" "<VSr>,wa")
20898
- (match_operand:VSX_B 2 "vsx_register_operand" "<VSr>,wa")))]
20899
+ [(set (match_operand:VSX_F 0 "vsx_register_operand" "=<VSr>,?wa")
20900
+ (smax:VSX_F (match_operand:VSX_F 1 "vsx_register_operand" "<VSr>,wa")
20901
+ (match_operand:VSX_F 2 "vsx_register_operand" "<VSr>,wa")))]
20902
"VECTOR_UNIT_VSX_P (<MODE>mode)"
20903
- "x<VSv>max<VSs> %x0,%x1,%x2"
20904
+ "xvmax<VSs> %x0,%x1,%x2"
20905
[(set_attr "type" "<VStype_simple>")
20906
(set_attr "fp_type" "<VSfptype_simple>")])
20908
(define_insn "*vsx_smin<mode>3"
20909
- [(set (match_operand:VSX_B 0 "vsx_register_operand" "=<VSr>,?wa")
20910
- (smin:VSX_B (match_operand:VSX_B 1 "vsx_register_operand" "<VSr>,wa")
20911
- (match_operand:VSX_B 2 "vsx_register_operand" "<VSr>,wa")))]
20912
+ [(set (match_operand:VSX_F 0 "vsx_register_operand" "=<VSr>,?wa")
20913
+ (smin:VSX_F (match_operand:VSX_F 1 "vsx_register_operand" "<VSr>,wa")
20914
+ (match_operand:VSX_F 2 "vsx_register_operand" "<VSr>,wa")))]
20915
"VECTOR_UNIT_VSX_P (<MODE>mode)"
20916
- "x<VSv>min<VSs> %x0,%x1,%x2"
20917
+ "xvmin<VSs> %x0,%x1,%x2"
20918
[(set_attr "type" "<VStype_simple>")
20919
(set_attr "fp_type" "<VSfptype_simple>")])
20921
-;; Special VSX version of smin/smax for single precision floating point. Since
20922
-;; both numbers are rounded to single precision, we can just use the DP version
20923
-;; of the instruction.
20925
-(define_insn "*vsx_smaxsf3"
20926
- [(set (match_operand:SF 0 "vsx_register_operand" "=f")
20927
- (smax:SF (match_operand:SF 1 "vsx_register_operand" "f")
20928
- (match_operand:SF 2 "vsx_register_operand" "f")))]
20929
- "VECTOR_UNIT_VSX_P (DFmode)"
20930
- "xsmaxdp %x0,%x1,%x2"
20931
- [(set_attr "type" "fp")
20932
- (set_attr "fp_type" "fp_addsub_d")])
20934
-(define_insn "*vsx_sminsf3"
20935
- [(set (match_operand:SF 0 "vsx_register_operand" "=f")
20936
- (smin:SF (match_operand:SF 1 "vsx_register_operand" "f")
20937
- (match_operand:SF 2 "vsx_register_operand" "f")))]
20938
- "VECTOR_UNIT_VSX_P (DFmode)"
20939
- "xsmindp %x0,%x1,%x2"
20940
- [(set_attr "type" "fp")
20941
- (set_attr "fp_type" "fp_addsub_d")])
20943
(define_insn "*vsx_sqrt<mode>2"
20944
- [(set (match_operand:VSX_B 0 "vsx_register_operand" "=<VSr>,?wa")
20945
- (sqrt:VSX_B (match_operand:VSX_B 1 "vsx_register_operand" "<VSr>,wa")))]
20946
+ [(set (match_operand:VSX_F 0 "vsx_register_operand" "=<VSr>,?wa")
20947
+ (sqrt:VSX_F (match_operand:VSX_F 1 "vsx_register_operand" "<VSr>,wa")))]
20948
"VECTOR_UNIT_VSX_P (<MODE>mode)"
20949
- "x<VSv>sqrt<VSs> %x0,%x1"
20950
+ "xvsqrt<VSs> %x0,%x1"
20951
[(set_attr "type" "<VStype_sqrt>")
20952
(set_attr "fp_type" "<VSfptype_sqrt>")])
20954
(define_insn "*vsx_rsqrte<mode>2"
20955
- [(set (match_operand:VSX_B 0 "vsx_register_operand" "=<VSr>,?wa")
20956
- (unspec:VSX_B [(match_operand:VSX_B 1 "vsx_register_operand" "<VSr>,wa")]
20957
+ [(set (match_operand:VSX_F 0 "vsx_register_operand" "=<VSr>,?wa")
20958
+ (unspec:VSX_F [(match_operand:VSX_F 1 "vsx_register_operand" "<VSr>,wa")]
20960
"VECTOR_UNIT_VSX_P (<MODE>mode)"
20961
- "x<VSv>rsqrte<VSs> %x0,%x1"
20962
+ "xvrsqrte<VSs> %x0,%x1"
20963
[(set_attr "type" "<VStype_simple>")
20964
(set_attr "fp_type" "<VSfptype_simple>")])
20966
@@ -528,27 +851,11 @@
20967
[(set_attr "type" "<VStype_simple>")
20968
(set_attr "fp_type" "<VSfptype_simple>")])
20970
-;; Fused vector multiply/add instructions Support the classical DF versions of
20971
-;; fma, which allows the target to be a separate register from the 3 inputs.
20972
-;; Under VSX, the target must be either the addend or the first multiply.
20973
-;; Where we can, also do the same for the Altivec V4SF fmas.
20974
+;; Fused vector multiply/add instructions. Support the classical Altivec
20975
+;; versions of fma, which allows the target to be a separate register from the
20976
+;; 3 inputs. Under VSX, the target must be either the addend or the first
20979
-(define_insn "*vsx_fmadf4"
20980
- [(set (match_operand:DF 0 "vsx_register_operand" "=ws,ws,?wa,?wa,d")
20982
- (match_operand:DF 1 "vsx_register_operand" "%ws,ws,wa,wa,d")
20983
- (match_operand:DF 2 "vsx_register_operand" "ws,0,wa,0,d")
20984
- (match_operand:DF 3 "vsx_register_operand" "0,ws,0,wa,d")))]
20985
- "VECTOR_UNIT_VSX_P (DFmode)"
20987
- xsmaddadp %x0,%x1,%x2
20988
- xsmaddmdp %x0,%x1,%x3
20989
- xsmaddadp %x0,%x1,%x2
20990
- xsmaddmdp %x0,%x1,%x3
20991
- fmadd %0,%1,%2,%3"
20992
- [(set_attr "type" "fp")
20993
- (set_attr "fp_type" "fp_maddsub_d")])
20995
(define_insn "*vsx_fmav4sf4"
20996
[(set (match_operand:V4SF 0 "vsx_register_operand" "=ws,ws,?wa,?wa,v")
20998
@@ -578,23 +885,6 @@
20999
xvmaddmdp %x0,%x1,%x3"
21000
[(set_attr "type" "vecdouble")])
21002
-(define_insn "*vsx_fmsdf4"
21003
- [(set (match_operand:DF 0 "vsx_register_operand" "=ws,ws,?wa,?wa,d")
21005
- (match_operand:DF 1 "vsx_register_operand" "%ws,ws,wa,wa,d")
21006
- (match_operand:DF 2 "vsx_register_operand" "ws,0,wa,0,d")
21008
- (match_operand:DF 3 "vsx_register_operand" "0,ws,0,wa,d"))))]
21009
- "VECTOR_UNIT_VSX_P (DFmode)"
21011
- xsmsubadp %x0,%x1,%x2
21012
- xsmsubmdp %x0,%x1,%x3
21013
- xsmsubadp %x0,%x1,%x2
21014
- xsmsubmdp %x0,%x1,%x3
21015
- fmsub %0,%1,%2,%3"
21016
- [(set_attr "type" "fp")
21017
- (set_attr "fp_type" "fp_maddsub_d")])
21019
(define_insn "*vsx_fms<mode>4"
21020
[(set (match_operand:VSX_F 0 "vsx_register_operand" "=<VSr>,<VSr>,?wa,?wa")
21022
@@ -604,29 +894,12 @@
21023
(match_operand:VSX_F 3 "vsx_register_operand" "0,<VSr>,0,wa"))))]
21024
"VECTOR_UNIT_VSX_P (<MODE>mode)"
21026
- x<VSv>msuba<VSs> %x0,%x1,%x2
21027
- x<VSv>msubm<VSs> %x0,%x1,%x3
21028
- x<VSv>msuba<VSs> %x0,%x1,%x2
21029
- x<VSv>msubm<VSs> %x0,%x1,%x3"
21030
+ xvmsuba<VSs> %x0,%x1,%x2
21031
+ xvmsubm<VSs> %x0,%x1,%x3
21032
+ xvmsuba<VSs> %x0,%x1,%x2
21033
+ xvmsubm<VSs> %x0,%x1,%x3"
21034
[(set_attr "type" "<VStype_mul>")])
21036
-(define_insn "*vsx_nfmadf4"
21037
- [(set (match_operand:DF 0 "vsx_register_operand" "=ws,ws,?wa,?wa,d")
21040
- (match_operand:DF 1 "vsx_register_operand" "ws,ws,wa,wa,d")
21041
- (match_operand:DF 2 "vsx_register_operand" "ws,0,wa,0,d")
21042
- (match_operand:DF 3 "vsx_register_operand" "0,ws,0,wa,d"))))]
21043
- "VECTOR_UNIT_VSX_P (DFmode)"
21045
- xsnmaddadp %x0,%x1,%x2
21046
- xsnmaddmdp %x0,%x1,%x3
21047
- xsnmaddadp %x0,%x1,%x2
21048
- xsnmaddmdp %x0,%x1,%x3
21049
- fnmadd %0,%1,%2,%3"
21050
- [(set_attr "type" "fp")
21051
- (set_attr "fp_type" "fp_maddsub_d")])
21053
(define_insn "*vsx_nfma<mode>4"
21054
[(set (match_operand:VSX_F 0 "vsx_register_operand" "=<VSr>,<VSr>,?wa,?wa")
21056
@@ -636,31 +909,13 @@
21057
(match_operand:VSX_F 3 "vsx_register_operand" "0,<VSr>,0,wa"))))]
21058
"VECTOR_UNIT_VSX_P (<MODE>mode)"
21060
- x<VSv>nmadda<VSs> %x0,%x1,%x2
21061
- x<VSv>nmaddm<VSs> %x0,%x1,%x3
21062
- x<VSv>nmadda<VSs> %x0,%x1,%x2
21063
- x<VSv>nmaddm<VSs> %x0,%x1,%x3"
21064
+ xvnmadda<VSs> %x0,%x1,%x2
21065
+ xvnmaddm<VSs> %x0,%x1,%x3
21066
+ xvnmadda<VSs> %x0,%x1,%x2
21067
+ xvnmaddm<VSs> %x0,%x1,%x3"
21068
[(set_attr "type" "<VStype_mul>")
21069
(set_attr "fp_type" "<VSfptype_mul>")])
21071
-(define_insn "*vsx_nfmsdf4"
21072
- [(set (match_operand:DF 0 "vsx_register_operand" "=ws,ws,?wa,?wa,d")
21075
- (match_operand:DF 1 "vsx_register_operand" "%ws,ws,wa,wa,d")
21076
- (match_operand:DF 2 "vsx_register_operand" "ws,0,wa,0,d")
21078
- (match_operand:DF 3 "vsx_register_operand" "0,ws,0,wa,d")))))]
21079
- "VECTOR_UNIT_VSX_P (DFmode)"
21081
- xsnmsubadp %x0,%x1,%x2
21082
- xsnmsubmdp %x0,%x1,%x3
21083
- xsnmsubadp %x0,%x1,%x2
21084
- xsnmsubmdp %x0,%x1,%x3
21085
- fnmsub %0,%1,%2,%3"
21086
- [(set_attr "type" "fp")
21087
- (set_attr "fp_type" "fp_maddsub_d")])
21089
(define_insn "*vsx_nfmsv4sf4"
21090
[(set (match_operand:V4SF 0 "vsx_register_operand" "=wf,wf,?wa,?wa,v")
21092
@@ -722,16 +977,6 @@
21093
[(set_attr "type" "<VStype_simple>")
21094
(set_attr "fp_type" "<VSfptype_simple>")])
21096
-;; Floating point scalar compare
21097
-(define_insn "*vsx_cmpdf_internal1"
21098
- [(set (match_operand:CCFP 0 "cc_reg_operand" "=y,?y")
21099
- (compare:CCFP (match_operand:DF 1 "gpc_reg_operand" "ws,wa")
21100
- (match_operand:DF 2 "gpc_reg_operand" "ws,wa")))]
21101
- "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
21102
- && VECTOR_UNIT_VSX_P (DFmode)"
21103
- "xscmpudp %0,%x1,%x2"
21104
- [(set_attr "type" "fpcompare")])
21106
;; Compare vectors producing a vector result and a predicate, setting CR6 to
21107
;; indicate a combined status
21108
(define_insn "*vsx_eq_<mode>_p"
21109
@@ -798,13 +1043,13 @@
21112
(define_insn "vsx_copysign<mode>3"
21113
- [(set (match_operand:VSX_B 0 "vsx_register_operand" "=<VSr>,?wa")
21115
- [(match_operand:VSX_B 1 "vsx_register_operand" "<VSr>,wa")
21116
- (match_operand:VSX_B 2 "vsx_register_operand" "<VSr>,wa")]
21117
+ [(set (match_operand:VSX_F 0 "vsx_register_operand" "=<VSr>,?wa")
21119
+ [(match_operand:VSX_F 1 "vsx_register_operand" "<VSr>,wa")
21120
+ (match_operand:VSX_F 2 "vsx_register_operand" "<VSr>,wa")]
21122
"VECTOR_UNIT_VSX_P (<MODE>mode)"
21123
- "x<VSv>cpsgn<VSs> %x0,%x2,%x1"
21124
+ "xvcpsgn<VSs> %x0,%x2,%x1"
21125
[(set_attr "type" "<VStype_simple>")
21126
(set_attr "fp_type" "<VSfptype_simple>")])
21128
@@ -865,10 +1110,10 @@
21129
(set_attr "fp_type" "<VSfptype_simple>")])
21131
(define_insn "vsx_btrunc<mode>2"
21132
- [(set (match_operand:VSX_B 0 "vsx_register_operand" "=<VSr>,?wa")
21133
- (fix:VSX_B (match_operand:VSX_B 1 "vsx_register_operand" "<VSr>,wa")))]
21134
+ [(set (match_operand:VSX_F 0 "vsx_register_operand" "=<VSr>,?wa")
21135
+ (fix:VSX_F (match_operand:VSX_F 1 "vsx_register_operand" "<VSr>,wa")))]
21136
"VECTOR_UNIT_VSX_P (<MODE>mode)"
21137
- "x<VSv>r<VSs>iz %x0,%x1"
21138
+ "xvr<VSs>iz %x0,%x1"
21139
[(set_attr "type" "<VStype_simple>")
21140
(set_attr "fp_type" "<VSfptype_simple>")])
21142
@@ -882,20 +1127,20 @@
21143
(set_attr "fp_type" "<VSfptype_simple>")])
21145
(define_insn "vsx_floor<mode>2"
21146
- [(set (match_operand:VSX_B 0 "vsx_register_operand" "=<VSr>,?wa")
21147
- (unspec:VSX_B [(match_operand:VSX_B 1 "vsx_register_operand" "<VSr>,wa")]
21148
+ [(set (match_operand:VSX_F 0 "vsx_register_operand" "=<VSr>,?wa")
21149
+ (unspec:VSX_F [(match_operand:VSX_F 1 "vsx_register_operand" "<VSr>,wa")]
21151
"VECTOR_UNIT_VSX_P (<MODE>mode)"
21152
- "x<VSv>r<VSs>im %x0,%x1"
21153
+ "xvr<VSs>im %x0,%x1"
21154
[(set_attr "type" "<VStype_simple>")
21155
(set_attr "fp_type" "<VSfptype_simple>")])
21157
(define_insn "vsx_ceil<mode>2"
21158
- [(set (match_operand:VSX_B 0 "vsx_register_operand" "=<VSr>,?wa")
21159
- (unspec:VSX_B [(match_operand:VSX_B 1 "vsx_register_operand" "<VSr>,wa")]
21160
+ [(set (match_operand:VSX_F 0 "vsx_register_operand" "=<VSr>,?wa")
21161
+ (unspec:VSX_F [(match_operand:VSX_F 1 "vsx_register_operand" "<VSr>,wa")]
21163
"VECTOR_UNIT_VSX_P (<MODE>mode)"
21164
- "x<VSv>r<VSs>ip %x0,%x1"
21165
+ "xvr<VSs>ip %x0,%x1"
21166
[(set_attr "type" "<VStype_simple>")
21167
(set_attr "fp_type" "<VSfptype_simple>")])
21169
@@ -942,6 +1187,40 @@
21171
[(set_attr "type" "fp")])
21173
+;; ISA 2.07 xscvdpspn/xscvspdpn that does not raise an error on signalling NaNs
21174
+(define_insn "vsx_xscvdpspn"
21175
+ [(set (match_operand:V4SF 0 "vsx_register_operand" "=ws,?wa")
21176
+ (unspec:V4SF [(match_operand:DF 1 "vsx_register_operand" "wd,wa")]
21177
+ UNSPEC_VSX_CVDPSPN))]
21178
+ "TARGET_XSCVDPSPN"
21179
+ "xscvdpspn %x0,%x1"
21180
+ [(set_attr "type" "fp")])
21182
+(define_insn "vsx_xscvspdpn"
21183
+ [(set (match_operand:DF 0 "vsx_register_operand" "=ws,?wa")
21184
+ (unspec:DF [(match_operand:V4SF 1 "vsx_register_operand" "wa,wa")]
21185
+ UNSPEC_VSX_CVSPDPN))]
21186
+ "TARGET_XSCVSPDPN"
21187
+ "xscvspdpn %x0,%x1"
21188
+ [(set_attr "type" "fp")])
21190
+(define_insn "vsx_xscvdpspn_scalar"
21191
+ [(set (match_operand:V4SF 0 "vsx_register_operand" "=wa")
21192
+ (unspec:V4SF [(match_operand:SF 1 "vsx_register_operand" "f")]
21193
+ UNSPEC_VSX_CVDPSPN))]
21194
+ "TARGET_XSCVDPSPN"
21195
+ "xscvdpspn %x0,%x1"
21196
+ [(set_attr "type" "fp")])
21198
+;; Used by direct move to move a SFmode value from GPR to VSX register
21199
+(define_insn "vsx_xscvspdpn_directmove"
21200
+ [(set (match_operand:SF 0 "vsx_register_operand" "=wa")
21201
+ (unspec:SF [(match_operand:SF 1 "vsx_register_operand" "wa")]
21202
+ UNSPEC_VSX_CVSPDPN))]
21203
+ "TARGET_XSCVSPDPN"
21204
+ "xscvspdpn %x0,%x1"
21205
+ [(set_attr "type" "fp")])
21207
;; Convert from 64-bit to 32-bit types
21208
;; Note, favor the Altivec registers since the usual use of these instructions
21209
;; is in vector converts and we need to use the Altivec vperm instruction.
21210
@@ -1027,73 +1306,21 @@
21211
(set_attr "fp_type" "<VSfptype_simple>")])
21214
-;; Logical and permute operations
21215
-(define_insn "*vsx_and<mode>3"
21216
- [(set (match_operand:VSX_L 0 "vsx_register_operand" "=<VSr>,?wa")
21218
- (match_operand:VSX_L 1 "vsx_register_operand" "<VSr>,?wa")
21219
- (match_operand:VSX_L 2 "vsx_register_operand" "<VSr>,?wa")))]
21220
- "VECTOR_MEM_VSX_P (<MODE>mode)"
21221
- "xxland %x0,%x1,%x2"
21222
- [(set_attr "type" "vecsimple")])
21224
-(define_insn "*vsx_ior<mode>3"
21225
- [(set (match_operand:VSX_L 0 "vsx_register_operand" "=<VSr>,?wa")
21226
- (ior:VSX_L (match_operand:VSX_L 1 "vsx_register_operand" "<VSr>,?wa")
21227
- (match_operand:VSX_L 2 "vsx_register_operand" "<VSr>,?wa")))]
21228
- "VECTOR_MEM_VSX_P (<MODE>mode)"
21229
- "xxlor %x0,%x1,%x2"
21230
- [(set_attr "type" "vecsimple")])
21232
-(define_insn "*vsx_xor<mode>3"
21233
- [(set (match_operand:VSX_L 0 "vsx_register_operand" "=<VSr>,?wa")
21235
- (match_operand:VSX_L 1 "vsx_register_operand" "<VSr>,?wa")
21236
- (match_operand:VSX_L 2 "vsx_register_operand" "<VSr>,?wa")))]
21237
- "VECTOR_MEM_VSX_P (<MODE>mode)"
21238
- "xxlxor %x0,%x1,%x2"
21239
- [(set_attr "type" "vecsimple")])
21241
-(define_insn "*vsx_one_cmpl<mode>2"
21242
- [(set (match_operand:VSX_L 0 "vsx_register_operand" "=<VSr>,?wa")
21244
- (match_operand:VSX_L 1 "vsx_register_operand" "<VSr>,?wa")))]
21245
- "VECTOR_MEM_VSX_P (<MODE>mode)"
21246
- "xxlnor %x0,%x1,%x1"
21247
- [(set_attr "type" "vecsimple")])
21249
-(define_insn "*vsx_nor<mode>3"
21250
- [(set (match_operand:VSX_L 0 "vsx_register_operand" "=<VSr>,?wa")
21253
- (match_operand:VSX_L 1 "vsx_register_operand" "<VSr>,?wa")
21254
- (match_operand:VSX_L 2 "vsx_register_operand" "<VSr>,?wa"))))]
21255
- "VECTOR_MEM_VSX_P (<MODE>mode)"
21256
- "xxlnor %x0,%x1,%x2"
21257
- [(set_attr "type" "vecsimple")])
21259
-(define_insn "*vsx_andc<mode>3"
21260
- [(set (match_operand:VSX_L 0 "vsx_register_operand" "=<VSr>,?wa")
21263
- (match_operand:VSX_L 2 "vsx_register_operand" "<VSr>,?wa"))
21264
- (match_operand:VSX_L 1 "vsx_register_operand" "<VSr>,?wa")))]
21265
- "VECTOR_MEM_VSX_P (<MODE>mode)"
21266
- "xxlandc %x0,%x1,%x2"
21267
- [(set_attr "type" "vecsimple")])
21270
;; Permute operations
21272
;; Build a V2DF/V2DI vector from two scalars
21273
(define_insn "vsx_concat_<mode>"
21274
- [(set (match_operand:VSX_D 0 "vsx_register_operand" "=wd,?wa")
21276
- [(match_operand:<VS_scalar> 1 "vsx_register_operand" "ws,wa")
21277
- (match_operand:<VS_scalar> 2 "vsx_register_operand" "ws,wa")]
21278
- UNSPEC_VSX_CONCAT))]
21279
+ [(set (match_operand:VSX_D 0 "vsx_register_operand" "=<VSr>,?wa")
21280
+ (vec_concat:VSX_D
21281
+ (match_operand:<VS_scalar> 1 "vsx_register_operand" "ws,wa")
21282
+ (match_operand:<VS_scalar> 2 "vsx_register_operand" "ws,wa")))]
21283
"VECTOR_MEM_VSX_P (<MODE>mode)"
21284
- "xxpermdi %x0,%x1,%x2,0"
21286
+ if (BYTES_BIG_ENDIAN)
21287
+ return "xxpermdi %x0,%x1,%x2,0";
21289
+ return "xxpermdi %x0,%x2,%x1,0";
21291
[(set_attr "type" "vecperm")])
21293
;; Special purpose concat using xxpermdi to glue two single precision values
21294
@@ -1106,9 +1333,161 @@
21295
(match_operand:SF 2 "vsx_register_operand" "f,f")]
21296
UNSPEC_VSX_CONCAT))]
21297
"VECTOR_MEM_VSX_P (V2DFmode)"
21298
- "xxpermdi %x0,%x1,%x2,0"
21300
+ if (BYTES_BIG_ENDIAN)
21301
+ return "xxpermdi %x0,%x1,%x2,0";
21303
+ return "xxpermdi %x0,%x2,%x1,0";
21305
[(set_attr "type" "vecperm")])
21307
+;; xxpermdi for little endian loads and stores. We need several of
21308
+;; these since the form of the PARALLEL differs by mode.
21309
+(define_insn "*vsx_xxpermdi2_le_<mode>"
21310
+ [(set (match_operand:VSX_D 0 "vsx_register_operand" "=wa")
21311
+ (vec_select:VSX_D
21312
+ (match_operand:VSX_D 1 "vsx_register_operand" "wa")
21313
+ (parallel [(const_int 1) (const_int 0)])))]
21314
+ "!BYTES_BIG_ENDIAN && VECTOR_MEM_VSX_P (<MODE>mode)"
21315
+ "xxpermdi %x0,%x1,%x1,2"
21316
+ [(set_attr "type" "vecperm")])
21318
+(define_insn "*vsx_xxpermdi4_le_<mode>"
21319
+ [(set (match_operand:VSX_W 0 "vsx_register_operand" "=wa")
21320
+ (vec_select:VSX_W
21321
+ (match_operand:VSX_W 1 "vsx_register_operand" "wa")
21322
+ (parallel [(const_int 2) (const_int 3)
21323
+ (const_int 0) (const_int 1)])))]
21324
+ "!BYTES_BIG_ENDIAN && VECTOR_MEM_VSX_P (<MODE>mode)"
21325
+ "xxpermdi %x0,%x1,%x1,2"
21326
+ [(set_attr "type" "vecperm")])
21328
+(define_insn "*vsx_xxpermdi8_le_V8HI"
21329
+ [(set (match_operand:V8HI 0 "vsx_register_operand" "=wa")
21331
+ (match_operand:V8HI 1 "vsx_register_operand" "wa")
21332
+ (parallel [(const_int 4) (const_int 5)
21333
+ (const_int 6) (const_int 7)
21334
+ (const_int 0) (const_int 1)
21335
+ (const_int 2) (const_int 3)])))]
21336
+ "!BYTES_BIG_ENDIAN && VECTOR_MEM_VSX_P (V8HImode)"
21337
+ "xxpermdi %x0,%x1,%x1,2"
21338
+ [(set_attr "type" "vecperm")])
21340
+(define_insn "*vsx_xxpermdi16_le_V16QI"
21341
+ [(set (match_operand:V16QI 0 "vsx_register_operand" "=wa")
21342
+ (vec_select:V16QI
21343
+ (match_operand:V16QI 1 "vsx_register_operand" "wa")
21344
+ (parallel [(const_int 8) (const_int 9)
21345
+ (const_int 10) (const_int 11)
21346
+ (const_int 12) (const_int 13)
21347
+ (const_int 14) (const_int 15)
21348
+ (const_int 0) (const_int 1)
21349
+ (const_int 2) (const_int 3)
21350
+ (const_int 4) (const_int 5)
21351
+ (const_int 6) (const_int 7)])))]
21352
+ "!BYTES_BIG_ENDIAN && VECTOR_MEM_VSX_P (V16QImode)"
21353
+ "xxpermdi %x0,%x1,%x1,2"
21354
+ [(set_attr "type" "vecperm")])
21356
+;; lxvd2x for little endian loads. We need several of
21357
+;; these since the form of the PARALLEL differs by mode.
21358
+(define_insn "*vsx_lxvd2x2_le_<mode>"
21359
+ [(set (match_operand:VSX_D 0 "vsx_register_operand" "=wa")
21360
+ (vec_select:VSX_D
21361
+ (match_operand:VSX_D 1 "memory_operand" "Z")
21362
+ (parallel [(const_int 1) (const_int 0)])))]
21363
+ "!BYTES_BIG_ENDIAN && VECTOR_MEM_VSX_P (<MODE>mode)"
21365
+ [(set_attr "type" "vecload")])
21367
+(define_insn "*vsx_lxvd2x4_le_<mode>"
21368
+ [(set (match_operand:VSX_W 0 "vsx_register_operand" "=wa")
21369
+ (vec_select:VSX_W
21370
+ (match_operand:VSX_W 1 "memory_operand" "Z")
21371
+ (parallel [(const_int 2) (const_int 3)
21372
+ (const_int 0) (const_int 1)])))]
21373
+ "!BYTES_BIG_ENDIAN && VECTOR_MEM_VSX_P (<MODE>mode)"
21375
+ [(set_attr "type" "vecload")])
21377
+(define_insn "*vsx_lxvd2x8_le_V8HI"
21378
+ [(set (match_operand:V8HI 0 "vsx_register_operand" "=wa")
21380
+ (match_operand:V8HI 1 "memory_operand" "Z")
21381
+ (parallel [(const_int 4) (const_int 5)
21382
+ (const_int 6) (const_int 7)
21383
+ (const_int 0) (const_int 1)
21384
+ (const_int 2) (const_int 3)])))]
21385
+ "!BYTES_BIG_ENDIAN && VECTOR_MEM_VSX_P (V8HImode)"
21387
+ [(set_attr "type" "vecload")])
21389
+(define_insn "*vsx_lxvd2x16_le_V16QI"
21390
+ [(set (match_operand:V16QI 0 "vsx_register_operand" "=wa")
21391
+ (vec_select:V16QI
21392
+ (match_operand:V16QI 1 "memory_operand" "Z")
21393
+ (parallel [(const_int 8) (const_int 9)
21394
+ (const_int 10) (const_int 11)
21395
+ (const_int 12) (const_int 13)
21396
+ (const_int 14) (const_int 15)
21397
+ (const_int 0) (const_int 1)
21398
+ (const_int 2) (const_int 3)
21399
+ (const_int 4) (const_int 5)
21400
+ (const_int 6) (const_int 7)])))]
21401
+ "!BYTES_BIG_ENDIAN && VECTOR_MEM_VSX_P (V16QImode)"
21403
+ [(set_attr "type" "vecload")])
21405
+;; stxvd2x for little endian stores. We need several of
21406
+;; these since the form of the PARALLEL differs by mode.
21407
+(define_insn "*vsx_stxvd2x2_le_<mode>"
21408
+ [(set (match_operand:VSX_D 0 "memory_operand" "=Z")
21409
+ (vec_select:VSX_D
21410
+ (match_operand:VSX_D 1 "vsx_register_operand" "wa")
21411
+ (parallel [(const_int 1) (const_int 0)])))]
21412
+ "!BYTES_BIG_ENDIAN && VECTOR_MEM_VSX_P (<MODE>mode)"
21413
+ "stxvd2x %x1,%y0"
21414
+ [(set_attr "type" "vecstore")])
21416
+(define_insn "*vsx_stxvd2x4_le_<mode>"
21417
+ [(set (match_operand:VSX_W 0 "memory_operand" "=Z")
21418
+ (vec_select:VSX_W
21419
+ (match_operand:VSX_W 1 "vsx_register_operand" "wa")
21420
+ (parallel [(const_int 2) (const_int 3)
21421
+ (const_int 0) (const_int 1)])))]
21422
+ "!BYTES_BIG_ENDIAN && VECTOR_MEM_VSX_P (<MODE>mode)"
21423
+ "stxvd2x %x1,%y0"
21424
+ [(set_attr "type" "vecstore")])
21426
+(define_insn "*vsx_stxvd2x8_le_V8HI"
21427
+ [(set (match_operand:V8HI 0 "memory_operand" "=Z")
21429
+ (match_operand:V8HI 1 "vsx_register_operand" "wa")
21430
+ (parallel [(const_int 4) (const_int 5)
21431
+ (const_int 6) (const_int 7)
21432
+ (const_int 0) (const_int 1)
21433
+ (const_int 2) (const_int 3)])))]
21434
+ "!BYTES_BIG_ENDIAN && VECTOR_MEM_VSX_P (V8HImode)"
21435
+ "stxvd2x %x1,%y0"
21436
+ [(set_attr "type" "vecstore")])
21438
+(define_insn "*vsx_stxvd2x16_le_V16QI"
21439
+ [(set (match_operand:V16QI 0 "memory_operand" "=Z")
21440
+ (vec_select:V16QI
21441
+ (match_operand:V16QI 1 "vsx_register_operand" "wa")
21442
+ (parallel [(const_int 8) (const_int 9)
21443
+ (const_int 10) (const_int 11)
21444
+ (const_int 12) (const_int 13)
21445
+ (const_int 14) (const_int 15)
21446
+ (const_int 0) (const_int 1)
21447
+ (const_int 2) (const_int 3)
21448
+ (const_int 4) (const_int 5)
21449
+ (const_int 6) (const_int 7)])))]
21450
+ "!BYTES_BIG_ENDIAN && VECTOR_MEM_VSX_P (V16QImode)"
21451
+ "stxvd2x %x1,%y0"
21452
+ [(set_attr "type" "vecstore")])
21454
;; Set the element of a V2DI/VD2F mode
21455
(define_insn "vsx_set_<mode>"
21456
[(set (match_operand:VSX_D 0 "vsx_register_operand" "=wd,?wa")
21457
@@ -1118,9 +1497,10 @@
21459
"VECTOR_MEM_VSX_P (<MODE>mode)"
21461
- if (INTVAL (operands[3]) == 0)
21462
+ int idx_first = BYTES_BIG_ENDIAN ? 0 : 1;
21463
+ if (INTVAL (operands[3]) == idx_first)
21464
return \"xxpermdi %x0,%x2,%x1,1\";
21465
- else if (INTVAL (operands[3]) == 1)
21466
+ else if (INTVAL (operands[3]) == 1 - idx_first)
21467
return \"xxpermdi %x0,%x1,%x2,0\";
21469
gcc_unreachable ();
21470
@@ -1135,8 +1515,12 @@
21471
[(match_operand:QI 2 "u5bit_cint_operand" "i,i,i")])))]
21472
"VECTOR_MEM_VSX_P (<MODE>mode)"
21475
gcc_assert (UINTVAL (operands[2]) <= 1);
21476
- operands[3] = GEN_INT (INTVAL (operands[2]) << 1);
21477
+ fldDM = INTVAL (operands[2]) << 1;
21478
+ if (!BYTES_BIG_ENDIAN)
21479
+ fldDM = 3 - fldDM;
21480
+ operands[3] = GEN_INT (fldDM);
21481
return \"xxpermdi %x0,%x1,%x1,%3\";
21483
[(set_attr "type" "vecperm")])
21484
@@ -1149,9 +1533,28 @@
21485
(parallel [(const_int 0)])))]
21486
"VECTOR_MEM_VSX_P (<MODE>mode) && WORDS_BIG_ENDIAN"
21488
- [(set_attr "type" "fpload")
21489
+ [(set (attr "type")
21491
+ (match_test "update_indexed_address_mem (operands[1], VOIDmode)")
21492
+ (const_string "fpload_ux")
21493
+ (const_string "fpload")))
21494
(set_attr "length" "4")])
21496
+;; Optimize extracting element 1 from memory for little endian
21497
+(define_insn "*vsx_extract_<mode>_one_le"
21498
+ [(set (match_operand:<VS_scalar> 0 "vsx_register_operand" "=ws,d,?wa")
21499
+ (vec_select:<VS_scalar>
21500
+ (match_operand:VSX_D 1 "indexed_or_indirect_operand" "Z,Z,Z")
21501
+ (parallel [(const_int 1)])))]
21502
+ "VECTOR_MEM_VSX_P (<MODE>mode) && !WORDS_BIG_ENDIAN"
21503
+ "lxsd%U1x %x0,%y1"
21504
+ [(set (attr "type")
21506
+ (match_test "update_indexed_address_mem (operands[1], VOIDmode)")
21507
+ (const_string "fpload_ux")
21508
+ (const_string "fpload")))
21509
+ (set_attr "length" "4")])
21511
;; Extract a SF element from V4SF
21512
(define_insn_and_split "vsx_extract_v4sf"
21513
[(set (match_operand:SF 0 "vsx_register_operand" "=f,f")
21514
@@ -1172,7 +1575,7 @@
21515
rtx op2 = operands[2];
21516
rtx op3 = operands[3];
21518
- HOST_WIDE_INT ele = INTVAL (op2);
21519
+ HOST_WIDE_INT ele = BYTES_BIG_ENDIAN ? INTVAL (op2) : 3 - INTVAL (op2);
21523
@@ -1213,8 +1616,8 @@
21524
if (<MODE>mode != V2DImode)
21526
target = gen_lowpart (V2DImode, target);
21527
- op0 = gen_lowpart (V2DImode, target);
21528
- op1 = gen_lowpart (V2DImode, target);
21529
+ op0 = gen_lowpart (V2DImode, op0);
21530
+ op1 = gen_lowpart (V2DImode, op1);
21533
emit_insn (gen (target, op0, op1, perm0, perm1));
21534
@@ -1483,3 +1886,27 @@
21536
[(set_attr "length" "20")
21537
(set_attr "type" "veccomplex")])
21540
+;; Power8 Vector fusion. The fused ops must be physically adjacent.
21542
+ [(set (match_operand:P 0 "base_reg_operand" "")
21543
+ (match_operand:P 1 "short_cint_operand" ""))
21544
+ (set (match_operand:VSX_M2 2 "vsx_register_operand" "")
21545
+ (mem:VSX_M2 (plus:P (match_dup 0)
21546
+ (match_operand:P 3 "int_reg_operand" ""))))]
21547
+ "TARGET_VSX && TARGET_P8_FUSION"
21548
+ "li %0,%1\t\t\t# vector load fusion\;lx<VSX_M2:VSm>x %x2,%0,%3"
21549
+ [(set_attr "length" "8")
21550
+ (set_attr "type" "vecload")])
21553
+ [(set (match_operand:P 0 "base_reg_operand" "")
21554
+ (match_operand:P 1 "short_cint_operand" ""))
21555
+ (set (match_operand:VSX_M2 2 "vsx_register_operand" "")
21556
+ (mem:VSX_M2 (plus:P (match_operand:P 3 "int_reg_operand" "")
21557
+ (match_dup 0))))]
21558
+ "TARGET_VSX && TARGET_P8_FUSION"
21559
+ "li %0,%1\t\t\t# vector load fusion\;lx<VSX_M2:VSm>x %x2,%0,%3"
21560
+ [(set_attr "length" "8")
21561
+ (set_attr "type" "vecload")])
21562
--- a/src/gcc/config/rs6000/rs6000.h
21563
+++ b/src/gcc/config/rs6000/rs6000.h
21565
#ifdef HAVE_AS_POWER8
21566
#define ASM_CPU_POWER8_SPEC "-mpower8"
21568
-#define ASM_CPU_POWER8_SPEC "-mpower4 -maltivec"
21569
+#define ASM_CPU_POWER8_SPEC ASM_CPU_POWER7_SPEC
21573
@@ -164,6 +164,7 @@
21574
%{mcpu=e6500: -me6500} \
21575
%{maltivec: -maltivec} \
21576
%{mvsx: -mvsx %{!maltivec: -maltivec} %{!mcpu*: %(asm_cpu_power7)}} \
21577
+%{mpower8-vector|mcrypto|mdirect-move|mhtm: %{!mcpu*: %(asm_cpu_power8)}} \
21580
#define CPP_DEFAULT_SPEC ""
21581
@@ -277,6 +278,21 @@
21582
#define TARGET_POPCNTD 0
21585
+/* Define the ISA 2.07 flags as 0 if the target assembler does not support the
21586
+ waitasecond instruction. Allow -mpower8-fusion, since it does not add new
21589
+#ifndef HAVE_AS_POWER8
21590
+#undef TARGET_DIRECT_MOVE
21591
+#undef TARGET_CRYPTO
21593
+#undef TARGET_P8_VECTOR
21594
+#define TARGET_DIRECT_MOVE 0
21595
+#define TARGET_CRYPTO 0
21596
+#define TARGET_HTM 0
21597
+#define TARGET_P8_VECTOR 0
21600
/* Define TARGET_LWSYNC_INSTRUCTION if the assembler knows about lwsync. If
21601
not, generate the lwsync code as an integer constant. */
21602
#ifdef HAVE_AS_LWSYNC
21603
@@ -386,6 +402,7 @@
21604
#define TARGET_DEBUG_TARGET (rs6000_debug & MASK_DEBUG_TARGET)
21605
#define TARGET_DEBUG_BUILTIN (rs6000_debug & MASK_DEBUG_BUILTIN)
21607
+/* Describe the vector unit used for arithmetic operations. */
21608
extern enum rs6000_vector rs6000_vector_unit[];
21610
#define VECTOR_UNIT_NONE_P(MODE) \
21611
@@ -394,12 +411,25 @@
21612
#define VECTOR_UNIT_VSX_P(MODE) \
21613
(rs6000_vector_unit[(MODE)] == VECTOR_VSX)
21615
+#define VECTOR_UNIT_P8_VECTOR_P(MODE) \
21616
+ (rs6000_vector_unit[(MODE)] == VECTOR_P8_VECTOR)
21618
#define VECTOR_UNIT_ALTIVEC_P(MODE) \
21619
(rs6000_vector_unit[(MODE)] == VECTOR_ALTIVEC)
21621
+#define VECTOR_UNIT_VSX_OR_P8_VECTOR_P(MODE) \
21622
+ (IN_RANGE ((int)rs6000_vector_unit[(MODE)], \
21623
+ (int)VECTOR_VSX, \
21624
+ (int)VECTOR_P8_VECTOR))
21626
+/* VECTOR_UNIT_ALTIVEC_OR_VSX_P is used in places where we are using either
21627
+ altivec (VMX) or VSX vector instructions. P8 vector support is upwards
21628
+ compatible, so allow it as well, rather than changing all of the uses of the
21630
#define VECTOR_UNIT_ALTIVEC_OR_VSX_P(MODE) \
21631
- (rs6000_vector_unit[(MODE)] == VECTOR_ALTIVEC \
21632
- || rs6000_vector_unit[(MODE)] == VECTOR_VSX)
21633
+ (IN_RANGE ((int)rs6000_vector_unit[(MODE)], \
21634
+ (int)VECTOR_ALTIVEC, \
21635
+ (int)VECTOR_P8_VECTOR))
21637
/* Describe whether to use VSX loads or Altivec loads. For now, just use the
21638
same unit as the vector unit we are using, but we may want to migrate to
21639
@@ -412,12 +442,21 @@
21640
#define VECTOR_MEM_VSX_P(MODE) \
21641
(rs6000_vector_mem[(MODE)] == VECTOR_VSX)
21643
+#define VECTOR_MEM_P8_VECTOR_P(MODE) \
21644
+ (rs6000_vector_mem[(MODE)] == VECTOR_VSX)
21646
#define VECTOR_MEM_ALTIVEC_P(MODE) \
21647
(rs6000_vector_mem[(MODE)] == VECTOR_ALTIVEC)
21649
+#define VECTOR_MEM_VSX_OR_P8_VECTOR_P(MODE) \
21650
+ (IN_RANGE ((int)rs6000_vector_mem[(MODE)], \
21651
+ (int)VECTOR_VSX, \
21652
+ (int)VECTOR_P8_VECTOR))
21654
#define VECTOR_MEM_ALTIVEC_OR_VSX_P(MODE) \
21655
- (rs6000_vector_mem[(MODE)] == VECTOR_ALTIVEC \
21656
- || rs6000_vector_mem[(MODE)] == VECTOR_VSX)
21657
+ (IN_RANGE ((int)rs6000_vector_mem[(MODE)], \
21658
+ (int)VECTOR_ALTIVEC, \
21659
+ (int)VECTOR_P8_VECTOR))
21661
/* Return the alignment of a given vector type, which is set based on the
21662
vector unit use. VSX for instance can load 32 or 64 bit aligned words
21663
@@ -479,22 +518,41 @@
21664
#define TARGET_FCTIDUZ TARGET_POPCNTD
21665
#define TARGET_FCTIWUZ TARGET_POPCNTD
21667
+#define TARGET_XSCVDPSPN (TARGET_DIRECT_MOVE || TARGET_P8_VECTOR)
21668
+#define TARGET_XSCVSPDPN (TARGET_DIRECT_MOVE || TARGET_P8_VECTOR)
21670
+/* Byte/char syncs were added as phased in for ISA 2.06B, but are not present
21671
+ in power7, so conditionalize them on p8 features. TImode syncs need quad
21672
+ memory support. */
21673
+#define TARGET_SYNC_HI_QI (TARGET_QUAD_MEMORY || TARGET_DIRECT_MOVE)
21674
+#define TARGET_SYNC_TI TARGET_QUAD_MEMORY
21676
+/* Power7 has both 32-bit load and store integer for the FPRs, so we don't need
21677
+ to allocate the SDmode stack slot to get the value into the proper location
21678
+ in the register. */
21679
+#define TARGET_NO_SDMODE_STACK (TARGET_LFIWZX && TARGET_STFIWX && TARGET_DFP)
21681
/* In switching from using target_flags to using rs6000_isa_flags, the options
21682
machinery creates OPTION_MASK_<xxx> instead of MASK_<xxx>. For now map
21683
OPTION_MASK_<xxx> back into MASK_<xxx>. */
21684
#define MASK_ALTIVEC OPTION_MASK_ALTIVEC
21685
#define MASK_CMPB OPTION_MASK_CMPB
21686
+#define MASK_CRYPTO OPTION_MASK_CRYPTO
21687
#define MASK_DFP OPTION_MASK_DFP
21688
+#define MASK_DIRECT_MOVE OPTION_MASK_DIRECT_MOVE
21689
#define MASK_DLMZB OPTION_MASK_DLMZB
21690
#define MASK_EABI OPTION_MASK_EABI
21691
#define MASK_FPRND OPTION_MASK_FPRND
21692
+#define MASK_P8_FUSION OPTION_MASK_P8_FUSION
21693
#define MASK_HARD_FLOAT OPTION_MASK_HARD_FLOAT
21694
+#define MASK_HTM OPTION_MASK_HTM
21695
#define MASK_ISEL OPTION_MASK_ISEL
21696
#define MASK_MFCRF OPTION_MASK_MFCRF
21697
#define MASK_MFPGPR OPTION_MASK_MFPGPR
21698
#define MASK_MULHW OPTION_MASK_MULHW
21699
#define MASK_MULTIPLE OPTION_MASK_MULTIPLE
21700
#define MASK_NO_UPDATE OPTION_MASK_NO_UPDATE
21701
+#define MASK_P8_VECTOR OPTION_MASK_P8_VECTOR
21702
#define MASK_POPCNTB OPTION_MASK_POPCNTB
21703
#define MASK_POPCNTD OPTION_MASK_POPCNTD
21704
#define MASK_PPC_GFXOPT OPTION_MASK_PPC_GFXOPT
21705
@@ -505,6 +563,7 @@
21706
#define MASK_STRING OPTION_MASK_STRING
21707
#define MASK_UPDATE OPTION_MASK_UPDATE
21708
#define MASK_VSX OPTION_MASK_VSX
21709
+#define MASK_VSX_TIMODE OPTION_MASK_VSX_TIMODE
21712
#define MASK_POWERPC64 OPTION_MASK_POWERPC64
21713
@@ -558,6 +617,25 @@
21714
|| rs6000_cpu == PROCESSOR_PPC8548)
21717
+/* Whether SF/DF operations are supported on the E500. */
21718
+#define TARGET_SF_SPE (TARGET_HARD_FLOAT && TARGET_SINGLE_FLOAT \
21721
+#define TARGET_DF_SPE (TARGET_HARD_FLOAT && TARGET_DOUBLE_FLOAT \
21722
+ && !TARGET_FPRS && TARGET_E500_DOUBLE)
21724
+/* Whether SF/DF operations are supported by by the normal floating point unit
21725
+ (or the vector/scalar unit). */
21726
+#define TARGET_SF_FPR (TARGET_HARD_FLOAT && TARGET_FPRS \
21727
+ && TARGET_SINGLE_FLOAT)
21729
+#define TARGET_DF_FPR (TARGET_HARD_FLOAT && TARGET_FPRS \
21730
+ && TARGET_DOUBLE_FLOAT)
21732
+/* Whether SF/DF operations are supported by any hardware. */
21733
+#define TARGET_SF_INSN (TARGET_SF_FPR || TARGET_SF_SPE)
21734
+#define TARGET_DF_INSN (TARGET_DF_FPR || TARGET_DF_SPE)
21736
/* Which machine supports the various reciprocal estimate instructions. */
21737
#define TARGET_FRES (TARGET_HARD_FLOAT && TARGET_PPC_GFXOPT \
21738
&& TARGET_FPRS && TARGET_SINGLE_FLOAT)
21739
@@ -595,9 +673,6 @@
21740
#define RS6000_RECIP_AUTO_RSQRTE_P(MODE) \
21741
(rs6000_recip_bits[(int)(MODE)] & RS6000_RECIP_MASK_AUTO_RSQRTE)
21743
-#define RS6000_RECIP_HIGH_PRECISION_P(MODE) \
21744
- ((MODE) == SFmode || (MODE) == V4SFmode || TARGET_RECIP_PRECISION)
21746
/* The default CPU for TARGET_OPTION_OVERRIDE. */
21747
#define OPTION_TARGET_CPU_DEFAULT TARGET_CPU_DEFAULT
21749
@@ -842,15 +917,17 @@
21750
in inline functions.
21752
Another pseudo (not included in DWARF_FRAME_REGISTERS) is soft frame
21753
- pointer, which is eventually eliminated in favor of SP or FP. */
21754
+ pointer, which is eventually eliminated in favor of SP or FP.
21756
-#define FIRST_PSEUDO_REGISTER 114
21757
+ The 3 HTM registers aren't also included in DWARF_FRAME_REGISTERS. */
21759
+#define FIRST_PSEUDO_REGISTER 117
21761
/* This must be included for pre gcc 3.0 glibc compatibility. */
21762
#define PRE_GCC3_DWARF_FRAME_REGISTERS 77
21764
/* Add 32 dwarf columns for synthetic SPE registers. */
21765
-#define DWARF_FRAME_REGISTERS ((FIRST_PSEUDO_REGISTER - 1) + 32)
21766
+#define DWARF_FRAME_REGISTERS ((FIRST_PSEUDO_REGISTER - 4) + 32)
21768
/* The SPE has an additional 32 synthetic registers, with DWARF debug
21769
info numbering for these registers starting at 1200. While eh_frame
21770
@@ -866,7 +943,7 @@
21771
We must map them here to avoid huge unwinder tables mostly consisting
21772
of unused space. */
21773
#define DWARF_REG_TO_UNWIND_COLUMN(r) \
21774
- ((r) > 1200 ? ((r) - 1200 + FIRST_PSEUDO_REGISTER - 1) : (r))
21775
+ ((r) > 1200 ? ((r) - 1200 + (DWARF_FRAME_REGISTERS - 32)) : (r))
21777
/* Use standard DWARF numbering for DWARF debugging information. */
21778
#define DBX_REGISTER_NUMBER(REGNO) rs6000_dbx_register_number (REGNO)
21779
@@ -906,7 +983,7 @@
21780
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \
21781
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \
21784
+ , 1, 1, 1, 1, 1, 1 \
21787
/* 1 for registers not available across function calls.
21788
@@ -926,7 +1003,7 @@
21789
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \
21790
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \
21793
+ , 1, 1, 1, 1, 1, 1 \
21796
/* Like `CALL_USED_REGISTERS' except this macro doesn't require that
21797
@@ -945,7 +1022,7 @@
21798
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \
21799
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \
21802
+ , 0, 0, 0, 0, 0, 0 \
21805
#define TOTAL_ALTIVEC_REGS (LAST_ALTIVEC_REGNO - FIRST_ALTIVEC_REGNO + 1)
21806
@@ -984,6 +1061,9 @@
21807
vrsave, vscr (fixed)
21808
spe_acc, spefscr (fixed)
21816
@@ -1004,7 +1084,9 @@
21818
#define REG_ALLOC_ORDER \
21820
- 45, 44, 43, 42, 41, 40, 39, 38, 37, 36, 35, 34, \
21821
+ /* move fr13 (ie 45) later, so if we need TFmode, it does */ \
21822
+ /* not use fr14 which is a saved register. */ \
21823
+ 44, 43, 42, 41, 40, 39, 38, 37, 36, 35, 34, 45, \
21825
63, 62, 61, 60, 59, 58, 57, 56, 55, 54, 53, 52, 51, \
21826
50, 49, 48, 47, 46, \
21827
@@ -1023,7 +1105,7 @@
21828
96, 95, 94, 93, 92, 91, \
21829
108, 107, 106, 105, 104, 103, 102, 101, 100, 99, 98, 97, \
21832
+ 111, 112, 113, 114, 115, 116 \
21835
/* True if register is floating-point. */
21836
@@ -1064,8 +1146,11 @@
21837
#define VINT_REGNO_P(N) ALTIVEC_REGNO_P (N)
21839
/* Alternate name for any vector register supporting logical operations, no
21840
- matter which instruction set(s) are available. */
21841
-#define VLOGICAL_REGNO_P(N) VFLOAT_REGNO_P (N)
21842
+ matter which instruction set(s) are available. Allow GPRs as well as the
21843
+ vector registers. */
21844
+#define VLOGICAL_REGNO_P(N) \
21845
+ (INT_REGNO_P (N) || ALTIVEC_REGNO_P (N) \
21846
+ || (TARGET_VSX && FP_REGNO_P (N))) \
21848
/* Return number of consecutive hard regs needed starting at reg REGNO
21849
to hold something of mode MODE. */
21850
@@ -1125,28 +1210,32 @@
21851
/* Value is 1 if it is a good idea to tie two pseudo registers
21852
when one has mode MODE1 and one has mode MODE2.
21853
If HARD_REGNO_MODE_OK could produce different values for MODE1 and MODE2,
21854
- for any hard reg, then this must be 0 for correct output. */
21855
-#define MODES_TIEABLE_P(MODE1, MODE2) \
21856
- (SCALAR_FLOAT_MODE_P (MODE1) \
21857
+ for any hard reg, then this must be 0 for correct output.
21859
+ PTImode cannot tie with other modes because PTImode is restricted to even
21860
+ GPR registers, and TImode can go in any GPR as well as VSX registers (PR
21862
+#define MODES_TIEABLE_P(MODE1, MODE2) \
21863
+ ((MODE1) == PTImode \
21864
+ ? (MODE2) == PTImode \
21865
+ : (MODE2) == PTImode \
21867
+ : SCALAR_FLOAT_MODE_P (MODE1) \
21868
? SCALAR_FLOAT_MODE_P (MODE2) \
21869
: SCALAR_FLOAT_MODE_P (MODE2) \
21870
- ? SCALAR_FLOAT_MODE_P (MODE1) \
21872
: GET_MODE_CLASS (MODE1) == MODE_CC \
21873
? GET_MODE_CLASS (MODE2) == MODE_CC \
21874
: GET_MODE_CLASS (MODE2) == MODE_CC \
21875
- ? GET_MODE_CLASS (MODE1) == MODE_CC \
21877
: SPE_VECTOR_MODE (MODE1) \
21878
? SPE_VECTOR_MODE (MODE2) \
21879
: SPE_VECTOR_MODE (MODE2) \
21880
- ? SPE_VECTOR_MODE (MODE1) \
21881
- : ALTIVEC_VECTOR_MODE (MODE1) \
21882
- ? ALTIVEC_VECTOR_MODE (MODE2) \
21883
- : ALTIVEC_VECTOR_MODE (MODE2) \
21884
- ? ALTIVEC_VECTOR_MODE (MODE1) \
21886
: ALTIVEC_OR_VSX_VECTOR_MODE (MODE1) \
21887
? ALTIVEC_OR_VSX_VECTOR_MODE (MODE2) \
21888
: ALTIVEC_OR_VSX_VECTOR_MODE (MODE2) \
21889
- ? ALTIVEC_OR_VSX_VECTOR_MODE (MODE1) \
21893
/* Post-reload, we can't use any new AltiVec registers, as we already
21894
@@ -1240,6 +1329,7 @@
21902
@@ -1270,6 +1360,7 @@
21907
"NON_SPECIAL_REGS", \
21910
@@ -1299,6 +1390,7 @@
21911
{ 0x00000000, 0x00000000, 0x00000000, 0x00004000 }, /* VSCR_REGS */ \
21912
{ 0x00000000, 0x00000000, 0x00000000, 0x00008000 }, /* SPE_ACC_REGS */ \
21913
{ 0x00000000, 0x00000000, 0x00000000, 0x00010000 }, /* SPEFSCR_REGS */ \
21914
+ { 0x00000000, 0x00000000, 0x00000000, 0x00040000 }, /* SPR_REGS */ \
21915
{ 0xffffffff, 0xffffffff, 0x00000008, 0x00020000 }, /* NON_SPECIAL_REGS */ \
21916
{ 0x00000000, 0x00000000, 0x00000002, 0x00000000 }, /* LINK_REGS */ \
21917
{ 0x00000000, 0x00000000, 0x00000004, 0x00000000 }, /* CTR_REGS */ \
21918
@@ -1309,7 +1401,7 @@
21919
{ 0x00000000, 0x00000000, 0x00000ff0, 0x00000000 }, /* CR_REGS */ \
21920
{ 0xffffffff, 0x00000000, 0x00000ffe, 0x00020000 }, /* NON_FLOAT_REGS */ \
21921
{ 0x00000000, 0x00000000, 0x00001000, 0x00000000 }, /* CA_REGS */ \
21922
- { 0xffffffff, 0xffffffff, 0xfffffffe, 0x0003ffff } /* ALL_REGS */ \
21923
+ { 0xffffffff, 0xffffffff, 0xfffffffe, 0x0007ffff } /* ALL_REGS */ \
21926
/* The same information, inverted:
21927
@@ -1337,7 +1429,18 @@
21928
RS6000_CONSTRAINT_wa, /* Any VSX register */
21929
RS6000_CONSTRAINT_wd, /* VSX register for V2DF */
21930
RS6000_CONSTRAINT_wf, /* VSX register for V4SF */
21931
+ RS6000_CONSTRAINT_wg, /* FPR register for -mmfpgpr */
21932
+ RS6000_CONSTRAINT_wl, /* FPR register for LFIWAX */
21933
+ RS6000_CONSTRAINT_wm, /* VSX register for direct move */
21934
+ RS6000_CONSTRAINT_wr, /* GPR register if 64-bit */
21935
RS6000_CONSTRAINT_ws, /* VSX register for DF */
21936
+ RS6000_CONSTRAINT_wt, /* VSX register for TImode */
21937
+ RS6000_CONSTRAINT_wu, /* Altivec register for float load/stores. */
21938
+ RS6000_CONSTRAINT_wv, /* Altivec register for double load/stores. */
21939
+ RS6000_CONSTRAINT_ww, /* FP or VSX register for vsx float ops. */
21940
+ RS6000_CONSTRAINT_wx, /* FPR register for STFIWX */
21941
+ RS6000_CONSTRAINT_wy, /* VSX register for SF */
21942
+ RS6000_CONSTRAINT_wz, /* FPR register for LFIWZX */
21943
RS6000_CONSTRAINT_MAX
21946
@@ -1425,21 +1528,14 @@
21948
#define FRAME_GROWS_DOWNWARD (flag_stack_protect != 0 || flag_asan != 0)
21950
-/* Size of the outgoing register save area */
21951
-#define RS6000_REG_SAVE ((DEFAULT_ABI == ABI_AIX \
21952
- || DEFAULT_ABI == ABI_DARWIN) \
21953
- ? (TARGET_64BIT ? 64 : 32) \
21956
/* Size of the fixed area on the stack */
21957
#define RS6000_SAVE_AREA \
21958
- (((DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_DARWIN) ? 24 : 8) \
21959
+ ((DEFAULT_ABI == ABI_V4 ? 8 : DEFAULT_ABI == ABI_ELFv2 ? 16 : 24) \
21960
<< (TARGET_64BIT ? 1 : 0))
21962
-/* MEM representing address to save the TOC register */
21963
-#define RS6000_SAVE_TOC gen_rtx_MEM (Pmode, \
21964
- plus_constant (Pmode, stack_pointer_rtx, \
21965
- (TARGET_32BIT ? 20 : 40)))
21966
+/* Stack offset for toc save slot. */
21967
+#define RS6000_TOC_SAVE_SLOT \
21968
+ ((DEFAULT_ABI == ABI_ELFv2 ? 12 : 20) << (TARGET_64BIT ? 1 : 0))
21970
/* Align an address */
21971
#define RS6000_ALIGN(n,a) (((n) + (a) - 1) & ~((a) - 1))
21972
@@ -1489,7 +1585,7 @@
21973
/* Define this if stack space is still allocated for a parameter passed
21974
in a register. The value is the number of bytes allocated to this
21976
-#define REG_PARM_STACK_SPACE(FNDECL) RS6000_REG_SAVE
21977
+#define REG_PARM_STACK_SPACE(FNDECL) rs6000_reg_parm_stack_space((FNDECL))
21979
/* Define this if the above stack space is to be considered part of the
21980
space allocated by the caller. */
21981
@@ -1522,7 +1618,7 @@
21982
NONLOCAL needs twice Pmode to maintain both backchain and SP. */
21983
#define STACK_SAVEAREA_MODE(LEVEL) \
21984
(LEVEL == SAVE_FUNCTION ? VOIDmode \
21985
- : LEVEL == SAVE_NONLOCAL ? (TARGET_32BIT ? DImode : TImode) : Pmode)
21986
+ : LEVEL == SAVE_NONLOCAL ? (TARGET_32BIT ? DImode : PTImode) : Pmode)
21988
/* Minimum and maximum general purpose registers used to hold arguments. */
21989
#define GP_ARG_MIN_REG 3
21990
@@ -1533,9 +1629,8 @@
21991
#define FP_ARG_MIN_REG 33
21992
#define FP_ARG_AIX_MAX_REG 45
21993
#define FP_ARG_V4_MAX_REG 40
21994
-#define FP_ARG_MAX_REG ((DEFAULT_ABI == ABI_AIX \
21995
- || DEFAULT_ABI == ABI_DARWIN) \
21996
- ? FP_ARG_AIX_MAX_REG : FP_ARG_V4_MAX_REG)
21997
+#define FP_ARG_MAX_REG (DEFAULT_ABI == ABI_V4 \
21998
+ ? FP_ARG_V4_MAX_REG : FP_ARG_AIX_MAX_REG)
21999
#define FP_ARG_NUM_REG (FP_ARG_MAX_REG - FP_ARG_MIN_REG + 1)
22001
/* Minimum and maximum AltiVec registers used to hold arguments. */
22002
@@ -1543,10 +1638,17 @@
22003
#define ALTIVEC_ARG_MAX_REG (ALTIVEC_ARG_MIN_REG + 11)
22004
#define ALTIVEC_ARG_NUM_REG (ALTIVEC_ARG_MAX_REG - ALTIVEC_ARG_MIN_REG + 1)
22006
+/* Maximum number of registers per ELFv2 homogeneous aggregate argument. */
22007
+#define AGGR_ARG_NUM_REG 8
22009
/* Return registers */
22010
#define GP_ARG_RETURN GP_ARG_MIN_REG
22011
#define FP_ARG_RETURN FP_ARG_MIN_REG
22012
#define ALTIVEC_ARG_RETURN (FIRST_ALTIVEC_REGNO + 2)
22013
+#define FP_ARG_MAX_RETURN (DEFAULT_ABI != ABI_ELFv2 ? FP_ARG_RETURN \
22014
+ : (FP_ARG_RETURN + AGGR_ARG_NUM_REG - 1))
22015
+#define ALTIVEC_ARG_MAX_RETURN (DEFAULT_ABI != ABI_ELFv2 ? ALTIVEC_ARG_RETURN \
22016
+ : (ALTIVEC_ARG_RETURN + AGGR_ARG_NUM_REG - 1))
22018
/* Flags for the call/call_value rtl operations set up by function_arg */
22019
#define CALL_NORMAL 0x00000000 /* no special processing */
22020
@@ -1566,8 +1668,10 @@
22021
On RS/6000, this is r3, fp1, and v2 (for AltiVec). */
22022
#define FUNCTION_VALUE_REGNO_P(N) \
22023
((N) == GP_ARG_RETURN \
22024
- || ((N) == FP_ARG_RETURN && TARGET_HARD_FLOAT && TARGET_FPRS) \
22025
- || ((N) == ALTIVEC_ARG_RETURN && TARGET_ALTIVEC && TARGET_ALTIVEC_ABI))
22026
+ || ((N) >= FP_ARG_RETURN && (N) <= FP_ARG_MAX_RETURN \
22027
+ && TARGET_HARD_FLOAT && TARGET_FPRS) \
22028
+ || ((N) >= ALTIVEC_ARG_RETURN && (N) <= ALTIVEC_ARG_MAX_RETURN \
22029
+ && TARGET_ALTIVEC && TARGET_ALTIVEC_ABI))
22031
/* 1 if N is a possible register number for function argument passing.
22032
On RS/6000, these are r3-r10 and fp1-fp13.
22033
@@ -1691,11 +1795,8 @@
22034
/* Number of bytes into the frame return addresses can be found. See
22035
rs6000_stack_info in rs6000.c for more information on how the different
22036
abi's store the return address. */
22037
-#define RETURN_ADDRESS_OFFSET \
22038
- ((DEFAULT_ABI == ABI_AIX \
22039
- || DEFAULT_ABI == ABI_DARWIN) ? (TARGET_32BIT ? 8 : 16) : \
22040
- (DEFAULT_ABI == ABI_V4) ? 4 : \
22041
- (internal_error ("RETURN_ADDRESS_OFFSET not supported"), 0))
22042
+#define RETURN_ADDRESS_OFFSET \
22043
+ ((DEFAULT_ABI == ABI_V4 ? 4 : 8) << (TARGET_64BIT ? 1 : 0))
22045
/* The current return address is in link register (65). The return address
22046
of anything farther back is accessed normally at an offset of 8 from the
22047
@@ -2215,6 +2316,9 @@
22048
&rs6000_reg_names[111][0], /* spe_acc */ \
22049
&rs6000_reg_names[112][0], /* spefscr */ \
22050
&rs6000_reg_names[113][0], /* sfp */ \
22051
+ &rs6000_reg_names[114][0], /* tfhar */ \
22052
+ &rs6000_reg_names[115][0], /* tfiar */ \
22053
+ &rs6000_reg_names[116][0], /* texasr */ \
22056
/* Table of additional register names to use in user input. */
22057
@@ -2268,7 +2372,9 @@
22058
{"vs48", 93}, {"vs49", 94}, {"vs50", 95}, {"vs51", 96}, \
22059
{"vs52", 97}, {"vs53", 98}, {"vs54", 99}, {"vs55", 100}, \
22060
{"vs56", 101},{"vs57", 102},{"vs58", 103},{"vs59", 104}, \
22061
- {"vs60", 105},{"vs61", 106},{"vs62", 107},{"vs63", 108} }
22062
+ {"vs60", 105},{"vs61", 106},{"vs62", 107},{"vs63", 108}, \
22063
+ /* Transactional Memory Facility (HTM) Registers. */ \
22064
+ {"tfhar", 114}, {"tfiar", 115}, {"texasr", 116} }
22066
/* This is how to output an element of a case-vector that is relative. */
22068
@@ -2357,7 +2463,12 @@
22069
#define RS6000_BTC_ATTR_MASK 0x00000700 /* Mask of the attributes. */
22071
/* Miscellaneous information. */
22072
-#define RS6000_BTC_OVERLOADED 0x4000000 /* function is overloaded. */
22073
+#define RS6000_BTC_SPR 0x01000000 /* function references SPRs. */
22074
+#define RS6000_BTC_VOID 0x02000000 /* function has no return value. */
22075
+#define RS6000_BTC_OVERLOADED 0x04000000 /* function is overloaded. */
22076
+#define RS6000_BTC_32BIT 0x08000000 /* function references SPRs. */
22077
+#define RS6000_BTC_64BIT 0x10000000 /* function references SPRs. */
22078
+#define RS6000_BTC_MISC_MASK 0x1f000000 /* Mask of the misc info. */
22080
/* Convenience macros to document the instruction type. */
22081
#define RS6000_BTC_MEM RS6000_BTC_MISC /* load/store touches mem. */
22082
@@ -2369,6 +2480,9 @@
22083
#define RS6000_BTM_ALWAYS 0 /* Always enabled. */
22084
#define RS6000_BTM_ALTIVEC MASK_ALTIVEC /* VMX/altivec vectors. */
22085
#define RS6000_BTM_VSX MASK_VSX /* VSX (vector/scalar). */
22086
+#define RS6000_BTM_P8_VECTOR MASK_P8_VECTOR /* ISA 2.07 vector. */
22087
+#define RS6000_BTM_CRYPTO MASK_CRYPTO /* crypto funcs. */
22088
+#define RS6000_BTM_HTM MASK_HTM /* hardware TM funcs. */
22089
#define RS6000_BTM_SPE MASK_STRING /* E500 */
22090
#define RS6000_BTM_PAIRED MASK_MULHW /* 750CL paired insns. */
22091
#define RS6000_BTM_FRE MASK_POPCNTB /* FRE instruction. */
22092
@@ -2380,10 +2494,13 @@
22094
#define RS6000_BTM_COMMON (RS6000_BTM_ALTIVEC \
22096
+ | RS6000_BTM_P8_VECTOR \
22097
+ | RS6000_BTM_CRYPTO \
22099
| RS6000_BTM_FRES \
22100
| RS6000_BTM_FRSQRTE \
22101
| RS6000_BTM_FRSQRTES \
22102
+ | RS6000_BTM_HTM \
22103
| RS6000_BTM_POPCNTD \
22106
@@ -2395,6 +2512,7 @@
22107
#undef RS6000_BUILTIN_A
22108
#undef RS6000_BUILTIN_D
22109
#undef RS6000_BUILTIN_E
22110
+#undef RS6000_BUILTIN_H
22111
#undef RS6000_BUILTIN_P
22112
#undef RS6000_BUILTIN_Q
22113
#undef RS6000_BUILTIN_S
22114
@@ -2406,6 +2524,7 @@
22115
#define RS6000_BUILTIN_A(ENUM, NAME, MASK, ATTR, ICODE) ENUM,
22116
#define RS6000_BUILTIN_D(ENUM, NAME, MASK, ATTR, ICODE) ENUM,
22117
#define RS6000_BUILTIN_E(ENUM, NAME, MASK, ATTR, ICODE) ENUM,
22118
+#define RS6000_BUILTIN_H(ENUM, NAME, MASK, ATTR, ICODE) ENUM,
22119
#define RS6000_BUILTIN_P(ENUM, NAME, MASK, ATTR, ICODE) ENUM,
22120
#define RS6000_BUILTIN_Q(ENUM, NAME, MASK, ATTR, ICODE) ENUM,
22121
#define RS6000_BUILTIN_S(ENUM, NAME, MASK, ATTR, ICODE) ENUM,
22122
@@ -2424,6 +2543,7 @@
22123
#undef RS6000_BUILTIN_A
22124
#undef RS6000_BUILTIN_D
22125
#undef RS6000_BUILTIN_E
22126
+#undef RS6000_BUILTIN_H
22127
#undef RS6000_BUILTIN_P
22128
#undef RS6000_BUILTIN_Q
22129
#undef RS6000_BUILTIN_S
22130
--- a/src/gcc/config/rs6000/altivec.md
22131
+++ b/src/gcc/config/rs6000/altivec.md
22132
@@ -41,15 +41,11 @@
22145
+ UNSPEC_VPACK_SIGN_SIGN_SAT
22146
+ UNSPEC_VPACK_SIGN_UNS_SAT
22147
+ UNSPEC_VPACK_UNS_UNS_SAT
22148
+ UNSPEC_VPACK_UNS_UNS_MOD
22152
@@ -71,12 +67,10 @@
22157
+ UNSPEC_VUNPACK_HI_SIGN
22158
+ UNSPEC_VUNPACK_LO_SIGN
22167
@@ -134,6 +128,7 @@
22174
(define_c_enum "unspecv"
22175
@@ -146,6 +141,8 @@
22178
(define_mode_iterator VI [V4SI V8HI V16QI])
22179
+;; Like VI, but add ISA 2.07 integer vector ops
22180
+(define_mode_iterator VI2 [V4SI V8HI V16QI V2DI])
22181
;; Short vec in modes
22182
(define_mode_iterator VIshort [V8HI V16QI])
22184
@@ -159,9 +156,19 @@
22185
;; Like VM, except don't do TImode
22186
(define_mode_iterator VM2 [V4SI V8HI V16QI V4SF V2DF V2DI])
22188
-(define_mode_attr VI_char [(V4SI "w") (V8HI "h") (V16QI "b")])
22189
-(define_mode_attr VI_scalar [(V4SI "SI") (V8HI "HI") (V16QI "QI")])
22190
+(define_mode_attr VI_char [(V2DI "d") (V4SI "w") (V8HI "h") (V16QI "b")])
22191
+(define_mode_attr VI_scalar [(V2DI "DI") (V4SI "SI") (V8HI "HI") (V16QI "QI")])
22192
+(define_mode_attr VI_unit [(V16QI "VECTOR_UNIT_ALTIVEC_P (V16QImode)")
22193
+ (V8HI "VECTOR_UNIT_ALTIVEC_P (V8HImode)")
22194
+ (V4SI "VECTOR_UNIT_ALTIVEC_P (V4SImode)")
22195
+ (V2DI "VECTOR_UNIT_P8_VECTOR_P (V2DImode)")])
22197
+;; Vector pack/unpack
22198
+(define_mode_iterator VP [V2DI V4SI V8HI])
22199
+(define_mode_attr VP_small [(V2DI "V4SI") (V4SI "V8HI") (V8HI "V16QI")])
22200
+(define_mode_attr VP_small_lc [(V2DI "v4si") (V4SI "v8hi") (V8HI "v16qi")])
22201
+(define_mode_attr VU_char [(V2DI "w") (V4SI "h") (V8HI "b")])
22203
;; Vector move instructions.
22204
(define_insn "*altivec_mov<mode>"
22205
[(set (match_operand:VM2 0 "nonimmediate_operand" "=Z,v,v,*Y,*r,*r,v,v")
22206
@@ -378,10 +385,10 @@
22209
(define_insn "add<mode>3"
22210
- [(set (match_operand:VI 0 "register_operand" "=v")
22211
- (plus:VI (match_operand:VI 1 "register_operand" "v")
22212
- (match_operand:VI 2 "register_operand" "v")))]
22214
+ [(set (match_operand:VI2 0 "register_operand" "=v")
22215
+ (plus:VI2 (match_operand:VI2 1 "register_operand" "v")
22216
+ (match_operand:VI2 2 "register_operand" "v")))]
22218
"vaddu<VI_char>m %0,%1,%2"
22219
[(set_attr "type" "vecsimple")])
22221
@@ -398,17 +405,17 @@
22222
(unspec:V4SI [(match_operand:V4SI 1 "register_operand" "v")
22223
(match_operand:V4SI 2 "register_operand" "v")]
22226
+ "VECTOR_UNIT_ALTIVEC_P (V4SImode)"
22228
[(set_attr "type" "vecsimple")])
22230
(define_insn "altivec_vaddu<VI_char>s"
22231
[(set (match_operand:VI 0 "register_operand" "=v")
22232
(unspec:VI [(match_operand:VI 1 "register_operand" "v")
22233
- (match_operand:VI 2 "register_operand" "v")]
22234
+ (match_operand:VI 2 "register_operand" "v")]
22236
(set (reg:SI 110) (unspec:SI [(const_int 0)] UNSPEC_SET_VSCR))]
22239
"vaddu<VI_char>s %0,%1,%2"
22240
[(set_attr "type" "vecsimple")])
22242
@@ -418,16 +425,16 @@
22243
(match_operand:VI 2 "register_operand" "v")]
22245
(set (reg:SI 110) (unspec:SI [(const_int 0)] UNSPEC_SET_VSCR))]
22247
+ "VECTOR_UNIT_ALTIVEC_P (<MODE>mode)"
22248
"vadds<VI_char>s %0,%1,%2"
22249
[(set_attr "type" "vecsimple")])
22252
(define_insn "sub<mode>3"
22253
- [(set (match_operand:VI 0 "register_operand" "=v")
22254
- (minus:VI (match_operand:VI 1 "register_operand" "v")
22255
- (match_operand:VI 2 "register_operand" "v")))]
22257
+ [(set (match_operand:VI2 0 "register_operand" "=v")
22258
+ (minus:VI2 (match_operand:VI2 1 "register_operand" "v")
22259
+ (match_operand:VI2 2 "register_operand" "v")))]
22261
"vsubu<VI_char>m %0,%1,%2"
22262
[(set_attr "type" "vecsimple")])
22264
@@ -444,7 +451,7 @@
22265
(unspec:V4SI [(match_operand:V4SI 1 "register_operand" "v")
22266
(match_operand:V4SI 2 "register_operand" "v")]
22269
+ "VECTOR_UNIT_ALTIVEC_P (V4SImode)"
22271
[(set_attr "type" "vecsimple")])
22273
@@ -454,7 +461,7 @@
22274
(match_operand:VI 2 "register_operand" "v")]
22276
(set (reg:SI 110) (unspec:SI [(const_int 0)] UNSPEC_SET_VSCR))]
22278
+ "VECTOR_UNIT_ALTIVEC_P (<MODE>mode)"
22279
"vsubu<VI_char>s %0,%1,%2"
22280
[(set_attr "type" "vecsimple")])
22282
@@ -464,7 +471,7 @@
22283
(match_operand:VI 2 "register_operand" "v")]
22285
(set (reg:SI 110) (unspec:SI [(const_int 0)] UNSPEC_SET_VSCR))]
22287
+ "VECTOR_UNIT_ALTIVEC_P (<MODE>mode)"
22288
"vsubs<VI_char>s %0,%1,%2"
22289
[(set_attr "type" "vecsimple")])
22291
@@ -483,7 +490,7 @@
22292
(unspec:VI [(match_operand:VI 1 "register_operand" "v")
22293
(match_operand:VI 2 "register_operand" "v")]
22296
+ "VECTOR_UNIT_ALTIVEC_P (<MODE>mode)"
22297
"vavgs<VI_char> %0,%1,%2"
22298
[(set_attr "type" "vecsimple")])
22300
@@ -492,31 +499,31 @@
22301
(unspec:V4SI [(match_operand:V4SF 1 "register_operand" "v")
22302
(match_operand:V4SF 2 "register_operand" "v")]
22305
+ "VECTOR_UNIT_ALTIVEC_P (V4SImode)"
22307
[(set_attr "type" "veccmp")])
22309
(define_insn "*altivec_eq<mode>"
22310
- [(set (match_operand:VI 0 "altivec_register_operand" "=v")
22311
- (eq:VI (match_operand:VI 1 "altivec_register_operand" "v")
22312
- (match_operand:VI 2 "altivec_register_operand" "v")))]
22314
+ [(set (match_operand:VI2 0 "altivec_register_operand" "=v")
22315
+ (eq:VI2 (match_operand:VI2 1 "altivec_register_operand" "v")
22316
+ (match_operand:VI2 2 "altivec_register_operand" "v")))]
22318
"vcmpequ<VI_char> %0,%1,%2"
22319
[(set_attr "type" "veccmp")])
22321
(define_insn "*altivec_gt<mode>"
22322
- [(set (match_operand:VI 0 "altivec_register_operand" "=v")
22323
- (gt:VI (match_operand:VI 1 "altivec_register_operand" "v")
22324
- (match_operand:VI 2 "altivec_register_operand" "v")))]
22326
+ [(set (match_operand:VI2 0 "altivec_register_operand" "=v")
22327
+ (gt:VI2 (match_operand:VI2 1 "altivec_register_operand" "v")
22328
+ (match_operand:VI2 2 "altivec_register_operand" "v")))]
22330
"vcmpgts<VI_char> %0,%1,%2"
22331
[(set_attr "type" "veccmp")])
22333
(define_insn "*altivec_gtu<mode>"
22334
- [(set (match_operand:VI 0 "altivec_register_operand" "=v")
22335
- (gtu:VI (match_operand:VI 1 "altivec_register_operand" "v")
22336
- (match_operand:VI 2 "altivec_register_operand" "v")))]
22338
+ [(set (match_operand:VI2 0 "altivec_register_operand" "=v")
22339
+ (gtu:VI2 (match_operand:VI2 1 "altivec_register_operand" "v")
22340
+ (match_operand:VI2 2 "altivec_register_operand" "v")))]
22342
"vcmpgtu<VI_char> %0,%1,%2"
22343
[(set_attr "type" "veccmp")])
22345
@@ -642,7 +649,7 @@
22346
convert_move (small_swap, swap, 0);
22348
low_product = gen_reg_rtx (V4SImode);
22349
- emit_insn (gen_vec_widen_umult_odd_v8hi (low_product, one, two));
22350
+ emit_insn (gen_altivec_vmulouh (low_product, one, two));
22352
high_product = gen_reg_rtx (V4SImode);
22353
emit_insn (gen_altivec_vmsumuhm (high_product, one, small_swap, zero));
22354
@@ -669,11 +676,19 @@
22355
emit_insn (gen_vec_widen_smult_even_v8hi (even, operands[1], operands[2]));
22356
emit_insn (gen_vec_widen_smult_odd_v8hi (odd, operands[1], operands[2]));
22358
- emit_insn (gen_altivec_vmrghw (high, even, odd));
22359
- emit_insn (gen_altivec_vmrglw (low, even, odd));
22360
+ if (BYTES_BIG_ENDIAN)
22362
+ emit_insn (gen_altivec_vmrghw (high, even, odd));
22363
+ emit_insn (gen_altivec_vmrglw (low, even, odd));
22364
+ emit_insn (gen_altivec_vpkuwum (operands[0], high, low));
22368
+ emit_insn (gen_altivec_vmrghw (high, odd, even));
22369
+ emit_insn (gen_altivec_vmrglw (low, odd, even));
22370
+ emit_insn (gen_altivec_vpkuwum (operands[0], low, high));
22373
- emit_insn (gen_altivec_vpkuwum (operands[0], high, low));
22378
@@ -744,18 +759,18 @@
22381
(define_insn "umax<mode>3"
22382
- [(set (match_operand:VI 0 "register_operand" "=v")
22383
- (umax:VI (match_operand:VI 1 "register_operand" "v")
22384
- (match_operand:VI 2 "register_operand" "v")))]
22386
+ [(set (match_operand:VI2 0 "register_operand" "=v")
22387
+ (umax:VI2 (match_operand:VI2 1 "register_operand" "v")
22388
+ (match_operand:VI2 2 "register_operand" "v")))]
22390
"vmaxu<VI_char> %0,%1,%2"
22391
[(set_attr "type" "vecsimple")])
22393
(define_insn "smax<mode>3"
22394
- [(set (match_operand:VI 0 "register_operand" "=v")
22395
- (smax:VI (match_operand:VI 1 "register_operand" "v")
22396
- (match_operand:VI 2 "register_operand" "v")))]
22398
+ [(set (match_operand:VI2 0 "register_operand" "=v")
22399
+ (smax:VI2 (match_operand:VI2 1 "register_operand" "v")
22400
+ (match_operand:VI2 2 "register_operand" "v")))]
22402
"vmaxs<VI_char> %0,%1,%2"
22403
[(set_attr "type" "vecsimple")])
22405
@@ -768,18 +783,18 @@
22406
[(set_attr "type" "veccmp")])
22408
(define_insn "umin<mode>3"
22409
- [(set (match_operand:VI 0 "register_operand" "=v")
22410
- (umin:VI (match_operand:VI 1 "register_operand" "v")
22411
- (match_operand:VI 2 "register_operand" "v")))]
22413
+ [(set (match_operand:VI2 0 "register_operand" "=v")
22414
+ (umin:VI2 (match_operand:VI2 1 "register_operand" "v")
22415
+ (match_operand:VI2 2 "register_operand" "v")))]
22417
"vminu<VI_char> %0,%1,%2"
22418
[(set_attr "type" "vecsimple")])
22420
(define_insn "smin<mode>3"
22421
- [(set (match_operand:VI 0 "register_operand" "=v")
22422
- (smin:VI (match_operand:VI 1 "register_operand" "v")
22423
- (match_operand:VI 2 "register_operand" "v")))]
22425
+ [(set (match_operand:VI2 0 "register_operand" "=v")
22426
+ (smin:VI2 (match_operand:VI2 1 "register_operand" "v")
22427
+ (match_operand:VI2 2 "register_operand" "v")))]
22429
"vmins<VI_char> %0,%1,%2"
22430
[(set_attr "type" "vecsimple")])
22432
@@ -935,7 +950,136 @@
22434
[(set_attr "type" "vecperm")])
22436
-(define_insn "vec_widen_umult_even_v16qi"
22437
+;; Power8 vector merge even/odd
22438
+(define_insn "p8_vmrgew"
22439
+ [(set (match_operand:V4SI 0 "register_operand" "=v")
22442
+ (match_operand:V4SI 1 "register_operand" "v")
22443
+ (match_operand:V4SI 2 "register_operand" "v"))
22444
+ (parallel [(const_int 0) (const_int 4)
22445
+ (const_int 2) (const_int 6)])))]
22446
+ "TARGET_P8_VECTOR"
22447
+ "vmrgew %0,%1,%2"
22448
+ [(set_attr "type" "vecperm")])
22450
+(define_insn "p8_vmrgow"
22451
+ [(set (match_operand:V4SI 0 "register_operand" "=v")
22454
+ (match_operand:V4SI 1 "register_operand" "v")
22455
+ (match_operand:V4SI 2 "register_operand" "v"))
22456
+ (parallel [(const_int 1) (const_int 5)
22457
+ (const_int 3) (const_int 7)])))]
22458
+ "TARGET_P8_VECTOR"
22459
+ "vmrgow %0,%1,%2"
22460
+ [(set_attr "type" "vecperm")])
22462
+(define_expand "vec_widen_umult_even_v16qi"
22463
+ [(use (match_operand:V8HI 0 "register_operand" ""))
22464
+ (use (match_operand:V16QI 1 "register_operand" ""))
22465
+ (use (match_operand:V16QI 2 "register_operand" ""))]
22468
+ if (BYTES_BIG_ENDIAN)
22469
+ emit_insn (gen_altivec_vmuleub (operands[0], operands[1], operands[2]));
22471
+ emit_insn (gen_altivec_vmuloub (operands[0], operands[1], operands[2]));
22475
+(define_expand "vec_widen_smult_even_v16qi"
22476
+ [(use (match_operand:V8HI 0 "register_operand" ""))
22477
+ (use (match_operand:V16QI 1 "register_operand" ""))
22478
+ (use (match_operand:V16QI 2 "register_operand" ""))]
22481
+ if (BYTES_BIG_ENDIAN)
22482
+ emit_insn (gen_altivec_vmulesb (operands[0], operands[1], operands[2]));
22484
+ emit_insn (gen_altivec_vmulosb (operands[0], operands[1], operands[2]));
22488
+(define_expand "vec_widen_umult_even_v8hi"
22489
+ [(use (match_operand:V4SI 0 "register_operand" ""))
22490
+ (use (match_operand:V8HI 1 "register_operand" ""))
22491
+ (use (match_operand:V8HI 2 "register_operand" ""))]
22494
+ if (BYTES_BIG_ENDIAN)
22495
+ emit_insn (gen_altivec_vmuleuh (operands[0], operands[1], operands[2]));
22497
+ emit_insn (gen_altivec_vmulouh (operands[0], operands[1], operands[2]));
22501
+(define_expand "vec_widen_smult_even_v8hi"
22502
+ [(use (match_operand:V4SI 0 "register_operand" ""))
22503
+ (use (match_operand:V8HI 1 "register_operand" ""))
22504
+ (use (match_operand:V8HI 2 "register_operand" ""))]
22507
+ if (BYTES_BIG_ENDIAN)
22508
+ emit_insn (gen_altivec_vmulesh (operands[0], operands[1], operands[2]));
22510
+ emit_insn (gen_altivec_vmulosh (operands[0], operands[1], operands[2]));
22514
+(define_expand "vec_widen_umult_odd_v16qi"
22515
+ [(use (match_operand:V8HI 0 "register_operand" ""))
22516
+ (use (match_operand:V16QI 1 "register_operand" ""))
22517
+ (use (match_operand:V16QI 2 "register_operand" ""))]
22520
+ if (BYTES_BIG_ENDIAN)
22521
+ emit_insn (gen_altivec_vmuloub (operands[0], operands[1], operands[2]));
22523
+ emit_insn (gen_altivec_vmuleub (operands[0], operands[1], operands[2]));
22527
+(define_expand "vec_widen_smult_odd_v16qi"
22528
+ [(use (match_operand:V8HI 0 "register_operand" ""))
22529
+ (use (match_operand:V16QI 1 "register_operand" ""))
22530
+ (use (match_operand:V16QI 2 "register_operand" ""))]
22533
+ if (BYTES_BIG_ENDIAN)
22534
+ emit_insn (gen_altivec_vmulosb (operands[0], operands[1], operands[2]));
22536
+ emit_insn (gen_altivec_vmulesb (operands[0], operands[1], operands[2]));
22540
+(define_expand "vec_widen_umult_odd_v8hi"
22541
+ [(use (match_operand:V4SI 0 "register_operand" ""))
22542
+ (use (match_operand:V8HI 1 "register_operand" ""))
22543
+ (use (match_operand:V8HI 2 "register_operand" ""))]
22546
+ if (BYTES_BIG_ENDIAN)
22547
+ emit_insn (gen_altivec_vmulouh (operands[0], operands[1], operands[2]));
22549
+ emit_insn (gen_altivec_vmuleuh (operands[0], operands[1], operands[2]));
22553
+(define_expand "vec_widen_smult_odd_v8hi"
22554
+ [(use (match_operand:V4SI 0 "register_operand" ""))
22555
+ (use (match_operand:V8HI 1 "register_operand" ""))
22556
+ (use (match_operand:V8HI 2 "register_operand" ""))]
22559
+ if (BYTES_BIG_ENDIAN)
22560
+ emit_insn (gen_altivec_vmulosh (operands[0], operands[1], operands[2]));
22562
+ emit_insn (gen_altivec_vmulesh (operands[0], operands[1], operands[2]));
22566
+(define_insn "altivec_vmuleub"
22567
[(set (match_operand:V8HI 0 "register_operand" "=v")
22568
(unspec:V8HI [(match_operand:V16QI 1 "register_operand" "v")
22569
(match_operand:V16QI 2 "register_operand" "v")]
22570
@@ -944,43 +1088,25 @@
22572
[(set_attr "type" "veccomplex")])
22574
-(define_insn "vec_widen_smult_even_v16qi"
22575
+(define_insn "altivec_vmuloub"
22576
[(set (match_operand:V8HI 0 "register_operand" "=v")
22577
(unspec:V8HI [(match_operand:V16QI 1 "register_operand" "v")
22578
(match_operand:V16QI 2 "register_operand" "v")]
22579
- UNSPEC_VMULESB))]
22580
+ UNSPEC_VMULOUB))]
22582
- "vmulesb %0,%1,%2"
22583
+ "vmuloub %0,%1,%2"
22584
[(set_attr "type" "veccomplex")])
22586
-(define_insn "vec_widen_umult_even_v8hi"
22587
- [(set (match_operand:V4SI 0 "register_operand" "=v")
22588
- (unspec:V4SI [(match_operand:V8HI 1 "register_operand" "v")
22589
- (match_operand:V8HI 2 "register_operand" "v")]
22590
- UNSPEC_VMULEUH))]
22592
- "vmuleuh %0,%1,%2"
22593
- [(set_attr "type" "veccomplex")])
22595
-(define_insn "vec_widen_smult_even_v8hi"
22596
- [(set (match_operand:V4SI 0 "register_operand" "=v")
22597
- (unspec:V4SI [(match_operand:V8HI 1 "register_operand" "v")
22598
- (match_operand:V8HI 2 "register_operand" "v")]
22599
- UNSPEC_VMULESH))]
22601
- "vmulesh %0,%1,%2"
22602
- [(set_attr "type" "veccomplex")])
22604
-(define_insn "vec_widen_umult_odd_v16qi"
22605
+(define_insn "altivec_vmulesb"
22606
[(set (match_operand:V8HI 0 "register_operand" "=v")
22607
(unspec:V8HI [(match_operand:V16QI 1 "register_operand" "v")
22608
(match_operand:V16QI 2 "register_operand" "v")]
22609
- UNSPEC_VMULOUB))]
22610
+ UNSPEC_VMULESB))]
22612
- "vmuloub %0,%1,%2"
22613
+ "vmulesb %0,%1,%2"
22614
[(set_attr "type" "veccomplex")])
22616
-(define_insn "vec_widen_smult_odd_v16qi"
22617
+(define_insn "altivec_vmulosb"
22618
[(set (match_operand:V8HI 0 "register_operand" "=v")
22619
(unspec:V8HI [(match_operand:V16QI 1 "register_operand" "v")
22620
(match_operand:V16QI 2 "register_operand" "v")]
22621
@@ -989,167 +1115,124 @@
22623
[(set_attr "type" "veccomplex")])
22625
-(define_insn "vec_widen_umult_odd_v8hi"
22626
+(define_insn "altivec_vmuleuh"
22627
[(set (match_operand:V4SI 0 "register_operand" "=v")
22628
(unspec:V4SI [(match_operand:V8HI 1 "register_operand" "v")
22629
(match_operand:V8HI 2 "register_operand" "v")]
22630
+ UNSPEC_VMULEUH))]
22632
+ "vmuleuh %0,%1,%2"
22633
+ [(set_attr "type" "veccomplex")])
22635
+(define_insn "altivec_vmulouh"
22636
+ [(set (match_operand:V4SI 0 "register_operand" "=v")
22637
+ (unspec:V4SI [(match_operand:V8HI 1 "register_operand" "v")
22638
+ (match_operand:V8HI 2 "register_operand" "v")]
22642
[(set_attr "type" "veccomplex")])
22644
-(define_insn "vec_widen_smult_odd_v8hi"
22645
+(define_insn "altivec_vmulesh"
22646
[(set (match_operand:V4SI 0 "register_operand" "=v")
22647
(unspec:V4SI [(match_operand:V8HI 1 "register_operand" "v")
22648
(match_operand:V8HI 2 "register_operand" "v")]
22649
+ UNSPEC_VMULESH))]
22651
+ "vmulesh %0,%1,%2"
22652
+ [(set_attr "type" "veccomplex")])
22654
+(define_insn "altivec_vmulosh"
22655
+ [(set (match_operand:V4SI 0 "register_operand" "=v")
22656
+ (unspec:V4SI [(match_operand:V8HI 1 "register_operand" "v")
22657
+ (match_operand:V8HI 2 "register_operand" "v")]
22661
[(set_attr "type" "veccomplex")])
22664
-;; logical ops. Have the logical ops follow the memory ops in
22665
-;; terms of whether to prefer VSX or Altivec
22667
-(define_insn "*altivec_and<mode>3"
22668
- [(set (match_operand:VM 0 "register_operand" "=v")
22669
- (and:VM (match_operand:VM 1 "register_operand" "v")
22670
- (match_operand:VM 2 "register_operand" "v")))]
22671
- "VECTOR_MEM_ALTIVEC_P (<MODE>mode)"
22673
- [(set_attr "type" "vecsimple")])
22675
-(define_insn "*altivec_ior<mode>3"
22676
- [(set (match_operand:VM 0 "register_operand" "=v")
22677
- (ior:VM (match_operand:VM 1 "register_operand" "v")
22678
- (match_operand:VM 2 "register_operand" "v")))]
22679
- "VECTOR_MEM_ALTIVEC_P (<MODE>mode)"
22681
- [(set_attr "type" "vecsimple")])
22683
-(define_insn "*altivec_xor<mode>3"
22684
- [(set (match_operand:VM 0 "register_operand" "=v")
22685
- (xor:VM (match_operand:VM 1 "register_operand" "v")
22686
- (match_operand:VM 2 "register_operand" "v")))]
22687
- "VECTOR_MEM_ALTIVEC_P (<MODE>mode)"
22689
- [(set_attr "type" "vecsimple")])
22691
-(define_insn "*altivec_one_cmpl<mode>2"
22692
- [(set (match_operand:VM 0 "register_operand" "=v")
22693
- (not:VM (match_operand:VM 1 "register_operand" "v")))]
22694
- "VECTOR_MEM_ALTIVEC_P (<MODE>mode)"
22696
- [(set_attr "type" "vecsimple")])
22698
-(define_insn "*altivec_nor<mode>3"
22699
- [(set (match_operand:VM 0 "register_operand" "=v")
22700
- (not:VM (ior:VM (match_operand:VM 1 "register_operand" "v")
22701
- (match_operand:VM 2 "register_operand" "v"))))]
22702
- "VECTOR_MEM_ALTIVEC_P (<MODE>mode)"
22704
- [(set_attr "type" "vecsimple")])
22706
-(define_insn "*altivec_andc<mode>3"
22707
- [(set (match_operand:VM 0 "register_operand" "=v")
22708
- (and:VM (not:VM (match_operand:VM 2 "register_operand" "v"))
22709
- (match_operand:VM 1 "register_operand" "v")))]
22710
- "VECTOR_MEM_ALTIVEC_P (<MODE>mode)"
22712
- [(set_attr "type" "vecsimple")])
22714
-(define_insn "altivec_vpkuhum"
22715
- [(set (match_operand:V16QI 0 "register_operand" "=v")
22716
- (unspec:V16QI [(match_operand:V8HI 1 "register_operand" "v")
22717
- (match_operand:V8HI 2 "register_operand" "v")]
22718
- UNSPEC_VPKUHUM))]
22720
- "vpkuhum %0,%1,%2"
22721
- [(set_attr "type" "vecperm")])
22723
-(define_insn "altivec_vpkuwum"
22724
- [(set (match_operand:V8HI 0 "register_operand" "=v")
22725
- (unspec:V8HI [(match_operand:V4SI 1 "register_operand" "v")
22726
- (match_operand:V4SI 2 "register_operand" "v")]
22727
- UNSPEC_VPKUWUM))]
22729
- "vpkuwum %0,%1,%2"
22730
- [(set_attr "type" "vecperm")])
22732
+;; Vector pack/unpack
22733
(define_insn "altivec_vpkpx"
22734
[(set (match_operand:V8HI 0 "register_operand" "=v")
22735
(unspec:V8HI [(match_operand:V4SI 1 "register_operand" "v")
22736
(match_operand:V4SI 2 "register_operand" "v")]
22742
+ if (BYTES_BIG_ENDIAN)
22743
+ return \"vpkpx %0,%1,%2\";
22745
+ return \"vpkpx %0,%2,%1\";
22747
[(set_attr "type" "vecperm")])
22749
-(define_insn "altivec_vpkshss"
22750
- [(set (match_operand:V16QI 0 "register_operand" "=v")
22751
- (unspec:V16QI [(match_operand:V8HI 1 "register_operand" "v")
22752
- (match_operand:V8HI 2 "register_operand" "v")]
22754
- (set (reg:SI 110) (unspec:SI [(const_int 0)] UNSPEC_SET_VSCR))]
22756
- "vpkshss %0,%1,%2"
22757
+(define_insn "altivec_vpks<VI_char>ss"
22758
+ [(set (match_operand:<VP_small> 0 "register_operand" "=v")
22759
+ (unspec:<VP_small> [(match_operand:VP 1 "register_operand" "v")
22760
+ (match_operand:VP 2 "register_operand" "v")]
22761
+ UNSPEC_VPACK_SIGN_SIGN_SAT))]
22765
+ if (BYTES_BIG_ENDIAN)
22766
+ return \"vpks<VI_char>ss %0,%1,%2\";
22768
+ return \"vpks<VI_char>ss %0,%2,%1\";
22770
[(set_attr "type" "vecperm")])
22772
-(define_insn "altivec_vpkswss"
22773
- [(set (match_operand:V8HI 0 "register_operand" "=v")
22774
- (unspec:V8HI [(match_operand:V4SI 1 "register_operand" "v")
22775
- (match_operand:V4SI 2 "register_operand" "v")]
22777
- (set (reg:SI 110) (unspec:SI [(const_int 0)] UNSPEC_SET_VSCR))]
22779
- "vpkswss %0,%1,%2"
22780
+(define_insn "altivec_vpks<VI_char>us"
22781
+ [(set (match_operand:<VP_small> 0 "register_operand" "=v")
22782
+ (unspec:<VP_small> [(match_operand:VP 1 "register_operand" "v")
22783
+ (match_operand:VP 2 "register_operand" "v")]
22784
+ UNSPEC_VPACK_SIGN_UNS_SAT))]
22788
+ if (BYTES_BIG_ENDIAN)
22789
+ return \"vpks<VI_char>us %0,%1,%2\";
22791
+ return \"vpks<VI_char>us %0,%2,%1\";
22793
[(set_attr "type" "vecperm")])
22795
-(define_insn "altivec_vpkuhus"
22796
- [(set (match_operand:V16QI 0 "register_operand" "=v")
22797
- (unspec:V16QI [(match_operand:V8HI 1 "register_operand" "v")
22798
- (match_operand:V8HI 2 "register_operand" "v")]
22800
- (set (reg:SI 110) (unspec:SI [(const_int 0)] UNSPEC_SET_VSCR))]
22802
- "vpkuhus %0,%1,%2"
22803
+(define_insn "altivec_vpku<VI_char>us"
22804
+ [(set (match_operand:<VP_small> 0 "register_operand" "=v")
22805
+ (unspec:<VP_small> [(match_operand:VP 1 "register_operand" "v")
22806
+ (match_operand:VP 2 "register_operand" "v")]
22807
+ UNSPEC_VPACK_UNS_UNS_SAT))]
22811
+ if (BYTES_BIG_ENDIAN)
22812
+ return \"vpku<VI_char>us %0,%1,%2\";
22814
+ return \"vpku<VI_char>us %0,%2,%1\";
22816
[(set_attr "type" "vecperm")])
22818
-(define_insn "altivec_vpkshus"
22819
- [(set (match_operand:V16QI 0 "register_operand" "=v")
22820
- (unspec:V16QI [(match_operand:V8HI 1 "register_operand" "v")
22821
- (match_operand:V8HI 2 "register_operand" "v")]
22823
- (set (reg:SI 110) (unspec:SI [(const_int 0)] UNSPEC_SET_VSCR))]
22825
- "vpkshus %0,%1,%2"
22826
+(define_insn "altivec_vpku<VI_char>um"
22827
+ [(set (match_operand:<VP_small> 0 "register_operand" "=v")
22828
+ (unspec:<VP_small> [(match_operand:VP 1 "register_operand" "v")
22829
+ (match_operand:VP 2 "register_operand" "v")]
22830
+ UNSPEC_VPACK_UNS_UNS_MOD))]
22834
+ if (BYTES_BIG_ENDIAN)
22835
+ return \"vpku<VI_char>um %0,%1,%2\";
22837
+ return \"vpku<VI_char>um %0,%2,%1\";
22839
[(set_attr "type" "vecperm")])
22841
-(define_insn "altivec_vpkuwus"
22842
- [(set (match_operand:V8HI 0 "register_operand" "=v")
22843
- (unspec:V8HI [(match_operand:V4SI 1 "register_operand" "v")
22844
- (match_operand:V4SI 2 "register_operand" "v")]
22846
- (set (reg:SI 110) (unspec:SI [(const_int 0)] UNSPEC_SET_VSCR))]
22848
- "vpkuwus %0,%1,%2"
22849
- [(set_attr "type" "vecperm")])
22851
-(define_insn "altivec_vpkswus"
22852
- [(set (match_operand:V8HI 0 "register_operand" "=v")
22853
- (unspec:V8HI [(match_operand:V4SI 1 "register_operand" "v")
22854
- (match_operand:V4SI 2 "register_operand" "v")]
22856
- (set (reg:SI 110) (unspec:SI [(const_int 0)] UNSPEC_SET_VSCR))]
22858
- "vpkswus %0,%1,%2"
22859
- [(set_attr "type" "vecperm")])
22861
(define_insn "*altivec_vrl<VI_char>"
22862
- [(set (match_operand:VI 0 "register_operand" "=v")
22863
- (rotate:VI (match_operand:VI 1 "register_operand" "v")
22864
- (match_operand:VI 2 "register_operand" "v")))]
22866
+ [(set (match_operand:VI2 0 "register_operand" "=v")
22867
+ (rotate:VI2 (match_operand:VI2 1 "register_operand" "v")
22868
+ (match_operand:VI2 2 "register_operand" "v")))]
22870
"vrl<VI_char> %0,%1,%2"
22871
[(set_attr "type" "vecsimple")])
22873
@@ -1172,26 +1255,26 @@
22874
[(set_attr "type" "vecperm")])
22876
(define_insn "*altivec_vsl<VI_char>"
22877
- [(set (match_operand:VI 0 "register_operand" "=v")
22878
- (ashift:VI (match_operand:VI 1 "register_operand" "v")
22879
- (match_operand:VI 2 "register_operand" "v")))]
22881
+ [(set (match_operand:VI2 0 "register_operand" "=v")
22882
+ (ashift:VI2 (match_operand:VI2 1 "register_operand" "v")
22883
+ (match_operand:VI2 2 "register_operand" "v")))]
22885
"vsl<VI_char> %0,%1,%2"
22886
[(set_attr "type" "vecsimple")])
22888
(define_insn "*altivec_vsr<VI_char>"
22889
- [(set (match_operand:VI 0 "register_operand" "=v")
22890
- (lshiftrt:VI (match_operand:VI 1 "register_operand" "v")
22891
- (match_operand:VI 2 "register_operand" "v")))]
22893
+ [(set (match_operand:VI2 0 "register_operand" "=v")
22894
+ (lshiftrt:VI2 (match_operand:VI2 1 "register_operand" "v")
22895
+ (match_operand:VI2 2 "register_operand" "v")))]
22897
"vsr<VI_char> %0,%1,%2"
22898
[(set_attr "type" "vecsimple")])
22900
(define_insn "*altivec_vsra<VI_char>"
22901
- [(set (match_operand:VI 0 "register_operand" "=v")
22902
- (ashiftrt:VI (match_operand:VI 1 "register_operand" "v")
22903
- (match_operand:VI 2 "register_operand" "v")))]
22905
+ [(set (match_operand:VI2 0 "register_operand" "=v")
22906
+ (ashiftrt:VI2 (match_operand:VI2 1 "register_operand" "v")
22907
+ (match_operand:VI2 2 "register_operand" "v")))]
22909
"vsra<VI_char> %0,%1,%2"
22910
[(set_attr "type" "vecsimple")])
22912
@@ -1335,7 +1418,12 @@
22913
(match_operand:V16QI 3 "register_operand" "")]
22918
+ if (!BYTES_BIG_ENDIAN) {
22919
+ altivec_expand_vec_perm_le (operands);
22924
(define_expand "vec_perm_constv16qi"
22925
[(match_operand:V16QI 0 "register_operand" "")
22926
@@ -1476,14 +1564,22 @@
22927
"vsldoi %0,%1,%2,%3"
22928
[(set_attr "type" "vecperm")])
22930
-(define_insn "altivec_vupkhsb"
22931
- [(set (match_operand:V8HI 0 "register_operand" "=v")
22932
- (unspec:V8HI [(match_operand:V16QI 1 "register_operand" "v")]
22933
- UNSPEC_VUPKHSB))]
22936
+(define_insn "altivec_vupkhs<VU_char>"
22937
+ [(set (match_operand:VP 0 "register_operand" "=v")
22938
+ (unspec:VP [(match_operand:<VP_small> 1 "register_operand" "v")]
22939
+ UNSPEC_VUNPACK_HI_SIGN))]
22941
+ "vupkhs<VU_char> %0,%1"
22942
[(set_attr "type" "vecperm")])
22944
+(define_insn "altivec_vupkls<VU_char>"
22945
+ [(set (match_operand:VP 0 "register_operand" "=v")
22946
+ (unspec:VP [(match_operand:<VP_small> 1 "register_operand" "v")]
22947
+ UNSPEC_VUNPACK_LO_SIGN))]
22949
+ "vupkls<VU_char> %0,%1"
22950
+ [(set_attr "type" "vecperm")])
22952
(define_insn "altivec_vupkhpx"
22953
[(set (match_operand:V4SI 0 "register_operand" "=v")
22954
(unspec:V4SI [(match_operand:V8HI 1 "register_operand" "v")]
22955
@@ -1492,22 +1588,6 @@
22957
[(set_attr "type" "vecperm")])
22959
-(define_insn "altivec_vupkhsh"
22960
- [(set (match_operand:V4SI 0 "register_operand" "=v")
22961
- (unspec:V4SI [(match_operand:V8HI 1 "register_operand" "v")]
22962
- UNSPEC_VUPKHSH))]
22965
- [(set_attr "type" "vecperm")])
22967
-(define_insn "altivec_vupklsb"
22968
- [(set (match_operand:V8HI 0 "register_operand" "=v")
22969
- (unspec:V8HI [(match_operand:V16QI 1 "register_operand" "v")]
22970
- UNSPEC_VUPKLSB))]
22973
- [(set_attr "type" "vecperm")])
22975
(define_insn "altivec_vupklpx"
22976
[(set (match_operand:V4SI 0 "register_operand" "=v")
22977
(unspec:V4SI [(match_operand:V8HI 1 "register_operand" "v")]
22978
@@ -1516,49 +1596,41 @@
22980
[(set_attr "type" "vecperm")])
22982
-(define_insn "altivec_vupklsh"
22983
- [(set (match_operand:V4SI 0 "register_operand" "=v")
22984
- (unspec:V4SI [(match_operand:V8HI 1 "register_operand" "v")]
22985
- UNSPEC_VUPKLSH))]
22988
- [(set_attr "type" "vecperm")])
22990
;; Compare vectors producing a vector result and a predicate, setting CR6 to
22991
;; indicate a combined status
22992
(define_insn "*altivec_vcmpequ<VI_char>_p"
22994
- (unspec:CC [(eq:CC (match_operand:VI 1 "register_operand" "v")
22995
- (match_operand:VI 2 "register_operand" "v"))]
22996
+ (unspec:CC [(eq:CC (match_operand:VI2 1 "register_operand" "v")
22997
+ (match_operand:VI2 2 "register_operand" "v"))]
22999
- (set (match_operand:VI 0 "register_operand" "=v")
23000
- (eq:VI (match_dup 1)
23002
- "VECTOR_UNIT_ALTIVEC_P (<MODE>mode)"
23003
+ (set (match_operand:VI2 0 "register_operand" "=v")
23004
+ (eq:VI2 (match_dup 1)
23007
"vcmpequ<VI_char>. %0,%1,%2"
23008
[(set_attr "type" "veccmp")])
23010
(define_insn "*altivec_vcmpgts<VI_char>_p"
23012
- (unspec:CC [(gt:CC (match_operand:VI 1 "register_operand" "v")
23013
- (match_operand:VI 2 "register_operand" "v"))]
23014
+ (unspec:CC [(gt:CC (match_operand:VI2 1 "register_operand" "v")
23015
+ (match_operand:VI2 2 "register_operand" "v"))]
23017
- (set (match_operand:VI 0 "register_operand" "=v")
23018
- (gt:VI (match_dup 1)
23020
- "VECTOR_UNIT_ALTIVEC_P (<MODE>mode)"
23021
+ (set (match_operand:VI2 0 "register_operand" "=v")
23022
+ (gt:VI2 (match_dup 1)
23025
"vcmpgts<VI_char>. %0,%1,%2"
23026
[(set_attr "type" "veccmp")])
23028
(define_insn "*altivec_vcmpgtu<VI_char>_p"
23030
- (unspec:CC [(gtu:CC (match_operand:VI 1 "register_operand" "v")
23031
- (match_operand:VI 2 "register_operand" "v"))]
23032
+ (unspec:CC [(gtu:CC (match_operand:VI2 1 "register_operand" "v")
23033
+ (match_operand:VI2 2 "register_operand" "v"))]
23035
- (set (match_operand:VI 0 "register_operand" "=v")
23036
- (gtu:VI (match_dup 1)
23038
- "VECTOR_UNIT_ALTIVEC_P (<MODE>mode)"
23039
+ (set (match_operand:VI2 0 "register_operand" "=v")
23040
+ (gtu:VI2 (match_dup 1)
23043
"vcmpgtu<VI_char>. %0,%1,%2"
23044
[(set_attr "type" "veccmp")])
23046
@@ -1779,20 +1851,28 @@
23047
[(set_attr "type" "vecstore")])
23050
-;; vspltis? SCRATCH0,0
23051
+;; xxlxor/vxor SCRATCH0,SCRATCH0,SCRATCH0
23052
;; vsubu?m SCRATCH2,SCRATCH1,%1
23053
;; vmaxs? %0,%1,SCRATCH2"
23054
(define_expand "abs<mode>2"
23055
- [(set (match_dup 2) (vec_duplicate:VI (const_int 0)))
23056
- (set (match_dup 3)
23057
- (minus:VI (match_dup 2)
23058
- (match_operand:VI 1 "register_operand" "v")))
23059
- (set (match_operand:VI 0 "register_operand" "=v")
23060
- (smax:VI (match_dup 1) (match_dup 3)))]
23062
+ [(set (match_dup 2) (match_dup 3))
23063
+ (set (match_dup 4)
23064
+ (minus:VI2 (match_dup 2)
23065
+ (match_operand:VI2 1 "register_operand" "v")))
23066
+ (set (match_operand:VI2 0 "register_operand" "=v")
23067
+ (smax:VI2 (match_dup 1) (match_dup 4)))]
23070
- operands[2] = gen_reg_rtx (GET_MODE (operands[0]));
23071
- operands[3] = gen_reg_rtx (GET_MODE (operands[0]));
23072
+ int i, n_elt = GET_MODE_NUNITS (<MODE>mode);
23073
+ rtvec v = rtvec_alloc (n_elt);
23075
+ /* Create an all 0 constant. */
23076
+ for (i = 0; i < n_elt; ++i)
23077
+ RTVEC_ELT (v, i) = const0_rtx;
23079
+ operands[2] = gen_reg_rtx (<MODE>mode);
23080
+ operands[3] = gen_rtx_CONST_VECTOR (<MODE>mode, v);
23081
+ operands[4] = gen_reg_rtx (<MODE>mode);
23085
@@ -1950,50 +2030,20 @@
23089
-(define_expand "vec_unpacks_hi_v16qi"
23090
- [(set (match_operand:V8HI 0 "register_operand" "=v")
23091
- (unspec:V8HI [(match_operand:V16QI 1 "register_operand" "v")]
23092
- UNSPEC_VUPKHSB))]
23096
- emit_insn (gen_altivec_vupkhsb (operands[0], operands[1]));
23099
+(define_expand "vec_unpacks_hi_<VP_small_lc>"
23100
+ [(set (match_operand:VP 0 "register_operand" "=v")
23101
+ (unspec:VP [(match_operand:<VP_small> 1 "register_operand" "v")]
23102
+ UNSPEC_VUNPACK_HI_SIGN))]
23106
-(define_expand "vec_unpacks_hi_v8hi"
23107
- [(set (match_operand:V4SI 0 "register_operand" "=v")
23108
- (unspec:V4SI [(match_operand:V8HI 1 "register_operand" "v")]
23109
- UNSPEC_VUPKHSH))]
23113
- emit_insn (gen_altivec_vupkhsh (operands[0], operands[1]));
23116
+(define_expand "vec_unpacks_lo_<VP_small_lc>"
23117
+ [(set (match_operand:VP 0 "register_operand" "=v")
23118
+ (unspec:VP [(match_operand:<VP_small> 1 "register_operand" "v")]
23119
+ UNSPEC_VUNPACK_LO_SIGN))]
23123
-(define_expand "vec_unpacks_lo_v16qi"
23124
- [(set (match_operand:V8HI 0 "register_operand" "=v")
23125
- (unspec:V8HI [(match_operand:V16QI 1 "register_operand" "v")]
23126
- UNSPEC_VUPKLSB))]
23130
- emit_insn (gen_altivec_vupklsb (operands[0], operands[1]));
23134
-(define_expand "vec_unpacks_lo_v8hi"
23135
- [(set (match_operand:V4SI 0 "register_operand" "=v")
23136
- (unspec:V4SI [(match_operand:V8HI 1 "register_operand" "v")]
23137
- UNSPEC_VUPKLSH))]
23141
- emit_insn (gen_altivec_vupklsh (operands[0], operands[1]));
23145
(define_insn "vperm_v8hiv4si"
23146
[(set (match_operand:V4SI 0 "register_operand" "=v")
23147
(unspec:V4SI [(match_operand:V8HI 1 "register_operand" "v")
23148
@@ -2025,25 +2075,26 @@
23149
rtx vzero = gen_reg_rtx (V8HImode);
23150
rtx mask = gen_reg_rtx (V16QImode);
23151
rtvec v = rtvec_alloc (16);
23152
+ bool be = BYTES_BIG_ENDIAN;
23154
emit_insn (gen_altivec_vspltish (vzero, const0_rtx));
23156
- RTVEC_ELT (v, 0) = gen_rtx_CONST_INT (QImode, 16);
23157
- RTVEC_ELT (v, 1) = gen_rtx_CONST_INT (QImode, 0);
23158
- RTVEC_ELT (v, 2) = gen_rtx_CONST_INT (QImode, 16);
23159
- RTVEC_ELT (v, 3) = gen_rtx_CONST_INT (QImode, 1);
23160
- RTVEC_ELT (v, 4) = gen_rtx_CONST_INT (QImode, 16);
23161
- RTVEC_ELT (v, 5) = gen_rtx_CONST_INT (QImode, 2);
23162
- RTVEC_ELT (v, 6) = gen_rtx_CONST_INT (QImode, 16);
23163
- RTVEC_ELT (v, 7) = gen_rtx_CONST_INT (QImode, 3);
23164
- RTVEC_ELT (v, 8) = gen_rtx_CONST_INT (QImode, 16);
23165
- RTVEC_ELT (v, 9) = gen_rtx_CONST_INT (QImode, 4);
23166
- RTVEC_ELT (v, 10) = gen_rtx_CONST_INT (QImode, 16);
23167
- RTVEC_ELT (v, 11) = gen_rtx_CONST_INT (QImode, 5);
23168
- RTVEC_ELT (v, 12) = gen_rtx_CONST_INT (QImode, 16);
23169
- RTVEC_ELT (v, 13) = gen_rtx_CONST_INT (QImode, 6);
23170
- RTVEC_ELT (v, 14) = gen_rtx_CONST_INT (QImode, 16);
23171
- RTVEC_ELT (v, 15) = gen_rtx_CONST_INT (QImode, 7);
23172
+ RTVEC_ELT (v, 0) = gen_rtx_CONST_INT (QImode, be ? 16 : 7);
23173
+ RTVEC_ELT (v, 1) = gen_rtx_CONST_INT (QImode, be ? 0 : 16);
23174
+ RTVEC_ELT (v, 2) = gen_rtx_CONST_INT (QImode, be ? 16 : 6);
23175
+ RTVEC_ELT (v, 3) = gen_rtx_CONST_INT (QImode, be ? 1 : 16);
23176
+ RTVEC_ELT (v, 4) = gen_rtx_CONST_INT (QImode, be ? 16 : 5);
23177
+ RTVEC_ELT (v, 5) = gen_rtx_CONST_INT (QImode, be ? 2 : 16);
23178
+ RTVEC_ELT (v, 6) = gen_rtx_CONST_INT (QImode, be ? 16 : 4);
23179
+ RTVEC_ELT (v, 7) = gen_rtx_CONST_INT (QImode, be ? 3 : 16);
23180
+ RTVEC_ELT (v, 8) = gen_rtx_CONST_INT (QImode, be ? 16 : 3);
23181
+ RTVEC_ELT (v, 9) = gen_rtx_CONST_INT (QImode, be ? 4 : 16);
23182
+ RTVEC_ELT (v, 10) = gen_rtx_CONST_INT (QImode, be ? 16 : 2);
23183
+ RTVEC_ELT (v, 11) = gen_rtx_CONST_INT (QImode, be ? 5 : 16);
23184
+ RTVEC_ELT (v, 12) = gen_rtx_CONST_INT (QImode, be ? 16 : 1);
23185
+ RTVEC_ELT (v, 13) = gen_rtx_CONST_INT (QImode, be ? 6 : 16);
23186
+ RTVEC_ELT (v, 14) = gen_rtx_CONST_INT (QImode, be ? 16 : 0);
23187
+ RTVEC_ELT (v, 15) = gen_rtx_CONST_INT (QImode, be ? 7 : 16);
23189
emit_insn (gen_vec_initv16qi (mask, gen_rtx_PARALLEL (V16QImode, v)));
23190
emit_insn (gen_vperm_v16qiv8hi (operands[0], operands[1], vzero, mask));
23191
@@ -2060,25 +2111,26 @@
23192
rtx vzero = gen_reg_rtx (V4SImode);
23193
rtx mask = gen_reg_rtx (V16QImode);
23194
rtvec v = rtvec_alloc (16);
23195
+ bool be = BYTES_BIG_ENDIAN;
23197
emit_insn (gen_altivec_vspltisw (vzero, const0_rtx));
23199
- RTVEC_ELT (v, 0) = gen_rtx_CONST_INT (QImode, 16);
23200
- RTVEC_ELT (v, 1) = gen_rtx_CONST_INT (QImode, 17);
23201
- RTVEC_ELT (v, 2) = gen_rtx_CONST_INT (QImode, 0);
23202
- RTVEC_ELT (v, 3) = gen_rtx_CONST_INT (QImode, 1);
23203
- RTVEC_ELT (v, 4) = gen_rtx_CONST_INT (QImode, 16);
23204
- RTVEC_ELT (v, 5) = gen_rtx_CONST_INT (QImode, 17);
23205
- RTVEC_ELT (v, 6) = gen_rtx_CONST_INT (QImode, 2);
23206
- RTVEC_ELT (v, 7) = gen_rtx_CONST_INT (QImode, 3);
23207
- RTVEC_ELT (v, 8) = gen_rtx_CONST_INT (QImode, 16);
23208
- RTVEC_ELT (v, 9) = gen_rtx_CONST_INT (QImode, 17);
23209
- RTVEC_ELT (v, 10) = gen_rtx_CONST_INT (QImode, 4);
23210
- RTVEC_ELT (v, 11) = gen_rtx_CONST_INT (QImode, 5);
23211
- RTVEC_ELT (v, 12) = gen_rtx_CONST_INT (QImode, 16);
23212
- RTVEC_ELT (v, 13) = gen_rtx_CONST_INT (QImode, 17);
23213
- RTVEC_ELT (v, 14) = gen_rtx_CONST_INT (QImode, 6);
23214
- RTVEC_ELT (v, 15) = gen_rtx_CONST_INT (QImode, 7);
23215
+ RTVEC_ELT (v, 0) = gen_rtx_CONST_INT (QImode, be ? 16 : 7);
23216
+ RTVEC_ELT (v, 1) = gen_rtx_CONST_INT (QImode, be ? 17 : 6);
23217
+ RTVEC_ELT (v, 2) = gen_rtx_CONST_INT (QImode, be ? 0 : 17);
23218
+ RTVEC_ELT (v, 3) = gen_rtx_CONST_INT (QImode, be ? 1 : 16);
23219
+ RTVEC_ELT (v, 4) = gen_rtx_CONST_INT (QImode, be ? 16 : 5);
23220
+ RTVEC_ELT (v, 5) = gen_rtx_CONST_INT (QImode, be ? 17 : 4);
23221
+ RTVEC_ELT (v, 6) = gen_rtx_CONST_INT (QImode, be ? 2 : 17);
23222
+ RTVEC_ELT (v, 7) = gen_rtx_CONST_INT (QImode, be ? 3 : 16);
23223
+ RTVEC_ELT (v, 8) = gen_rtx_CONST_INT (QImode, be ? 16 : 3);
23224
+ RTVEC_ELT (v, 9) = gen_rtx_CONST_INT (QImode, be ? 17 : 2);
23225
+ RTVEC_ELT (v, 10) = gen_rtx_CONST_INT (QImode, be ? 4 : 17);
23226
+ RTVEC_ELT (v, 11) = gen_rtx_CONST_INT (QImode, be ? 5 : 16);
23227
+ RTVEC_ELT (v, 12) = gen_rtx_CONST_INT (QImode, be ? 16 : 1);
23228
+ RTVEC_ELT (v, 13) = gen_rtx_CONST_INT (QImode, be ? 17 : 0);
23229
+ RTVEC_ELT (v, 14) = gen_rtx_CONST_INT (QImode, be ? 6 : 17);
23230
+ RTVEC_ELT (v, 15) = gen_rtx_CONST_INT (QImode, be ? 7 : 16);
23232
emit_insn (gen_vec_initv16qi (mask, gen_rtx_PARALLEL (V16QImode, v)));
23233
emit_insn (gen_vperm_v8hiv4si (operands[0], operands[1], vzero, mask));
23234
@@ -2095,25 +2147,26 @@
23235
rtx vzero = gen_reg_rtx (V8HImode);
23236
rtx mask = gen_reg_rtx (V16QImode);
23237
rtvec v = rtvec_alloc (16);
23238
+ bool be = BYTES_BIG_ENDIAN;
23240
emit_insn (gen_altivec_vspltish (vzero, const0_rtx));
23242
- RTVEC_ELT (v, 0) = gen_rtx_CONST_INT (QImode, 16);
23243
- RTVEC_ELT (v, 1) = gen_rtx_CONST_INT (QImode, 8);
23244
- RTVEC_ELT (v, 2) = gen_rtx_CONST_INT (QImode, 16);
23245
- RTVEC_ELT (v, 3) = gen_rtx_CONST_INT (QImode, 9);
23246
- RTVEC_ELT (v, 4) = gen_rtx_CONST_INT (QImode, 16);
23247
- RTVEC_ELT (v, 5) = gen_rtx_CONST_INT (QImode, 10);
23248
- RTVEC_ELT (v, 6) = gen_rtx_CONST_INT (QImode, 16);
23249
- RTVEC_ELT (v, 7) = gen_rtx_CONST_INT (QImode, 11);
23250
- RTVEC_ELT (v, 8) = gen_rtx_CONST_INT (QImode, 16);
23251
- RTVEC_ELT (v, 9) = gen_rtx_CONST_INT (QImode, 12);
23252
- RTVEC_ELT (v, 10) = gen_rtx_CONST_INT (QImode, 16);
23253
- RTVEC_ELT (v, 11) = gen_rtx_CONST_INT (QImode, 13);
23254
- RTVEC_ELT (v, 12) = gen_rtx_CONST_INT (QImode, 16);
23255
- RTVEC_ELT (v, 13) = gen_rtx_CONST_INT (QImode, 14);
23256
- RTVEC_ELT (v, 14) = gen_rtx_CONST_INT (QImode, 16);
23257
- RTVEC_ELT (v, 15) = gen_rtx_CONST_INT (QImode, 15);
23258
+ RTVEC_ELT (v, 0) = gen_rtx_CONST_INT (QImode, be ? 16 : 15);
23259
+ RTVEC_ELT (v, 1) = gen_rtx_CONST_INT (QImode, be ? 8 : 16);
23260
+ RTVEC_ELT (v, 2) = gen_rtx_CONST_INT (QImode, be ? 16 : 14);
23261
+ RTVEC_ELT (v, 3) = gen_rtx_CONST_INT (QImode, be ? 9 : 16);
23262
+ RTVEC_ELT (v, 4) = gen_rtx_CONST_INT (QImode, be ? 16 : 13);
23263
+ RTVEC_ELT (v, 5) = gen_rtx_CONST_INT (QImode, be ? 10 : 16);
23264
+ RTVEC_ELT (v, 6) = gen_rtx_CONST_INT (QImode, be ? 16 : 12);
23265
+ RTVEC_ELT (v, 7) = gen_rtx_CONST_INT (QImode, be ? 11 : 16);
23266
+ RTVEC_ELT (v, 8) = gen_rtx_CONST_INT (QImode, be ? 16 : 11);
23267
+ RTVEC_ELT (v, 9) = gen_rtx_CONST_INT (QImode, be ? 12 : 16);
23268
+ RTVEC_ELT (v, 10) = gen_rtx_CONST_INT (QImode, be ? 16 : 10);
23269
+ RTVEC_ELT (v, 11) = gen_rtx_CONST_INT (QImode, be ? 13 : 16);
23270
+ RTVEC_ELT (v, 12) = gen_rtx_CONST_INT (QImode, be ? 16 : 9);
23271
+ RTVEC_ELT (v, 13) = gen_rtx_CONST_INT (QImode, be ? 14 : 16);
23272
+ RTVEC_ELT (v, 14) = gen_rtx_CONST_INT (QImode, be ? 16 : 8);
23273
+ RTVEC_ELT (v, 15) = gen_rtx_CONST_INT (QImode, be ? 15 : 16);
23275
emit_insn (gen_vec_initv16qi (mask, gen_rtx_PARALLEL (V16QImode, v)));
23276
emit_insn (gen_vperm_v16qiv8hi (operands[0], operands[1], vzero, mask));
23277
@@ -2130,25 +2183,26 @@
23278
rtx vzero = gen_reg_rtx (V4SImode);
23279
rtx mask = gen_reg_rtx (V16QImode);
23280
rtvec v = rtvec_alloc (16);
23281
+ bool be = BYTES_BIG_ENDIAN;
23283
emit_insn (gen_altivec_vspltisw (vzero, const0_rtx));
23285
- RTVEC_ELT (v, 0) = gen_rtx_CONST_INT (QImode, 16);
23286
- RTVEC_ELT (v, 1) = gen_rtx_CONST_INT (QImode, 17);
23287
- RTVEC_ELT (v, 2) = gen_rtx_CONST_INT (QImode, 8);
23288
- RTVEC_ELT (v, 3) = gen_rtx_CONST_INT (QImode, 9);
23289
- RTVEC_ELT (v, 4) = gen_rtx_CONST_INT (QImode, 16);
23290
- RTVEC_ELT (v, 5) = gen_rtx_CONST_INT (QImode, 17);
23291
- RTVEC_ELT (v, 6) = gen_rtx_CONST_INT (QImode, 10);
23292
- RTVEC_ELT (v, 7) = gen_rtx_CONST_INT (QImode, 11);
23293
- RTVEC_ELT (v, 8) = gen_rtx_CONST_INT (QImode, 16);
23294
- RTVEC_ELT (v, 9) = gen_rtx_CONST_INT (QImode, 17);
23295
- RTVEC_ELT (v, 10) = gen_rtx_CONST_INT (QImode, 12);
23296
- RTVEC_ELT (v, 11) = gen_rtx_CONST_INT (QImode, 13);
23297
- RTVEC_ELT (v, 12) = gen_rtx_CONST_INT (QImode, 16);
23298
- RTVEC_ELT (v, 13) = gen_rtx_CONST_INT (QImode, 17);
23299
- RTVEC_ELT (v, 14) = gen_rtx_CONST_INT (QImode, 14);
23300
- RTVEC_ELT (v, 15) = gen_rtx_CONST_INT (QImode, 15);
23301
+ RTVEC_ELT (v, 0) = gen_rtx_CONST_INT (QImode, be ? 16 : 15);
23302
+ RTVEC_ELT (v, 1) = gen_rtx_CONST_INT (QImode, be ? 17 : 14);
23303
+ RTVEC_ELT (v, 2) = gen_rtx_CONST_INT (QImode, be ? 8 : 17);
23304
+ RTVEC_ELT (v, 3) = gen_rtx_CONST_INT (QImode, be ? 9 : 16);
23305
+ RTVEC_ELT (v, 4) = gen_rtx_CONST_INT (QImode, be ? 16 : 13);
23306
+ RTVEC_ELT (v, 5) = gen_rtx_CONST_INT (QImode, be ? 17 : 12);
23307
+ RTVEC_ELT (v, 6) = gen_rtx_CONST_INT (QImode, be ? 10 : 17);
23308
+ RTVEC_ELT (v, 7) = gen_rtx_CONST_INT (QImode, be ? 11 : 16);
23309
+ RTVEC_ELT (v, 8) = gen_rtx_CONST_INT (QImode, be ? 16 : 11);
23310
+ RTVEC_ELT (v, 9) = gen_rtx_CONST_INT (QImode, be ? 17 : 10);
23311
+ RTVEC_ELT (v, 10) = gen_rtx_CONST_INT (QImode, be ? 12 : 17);
23312
+ RTVEC_ELT (v, 11) = gen_rtx_CONST_INT (QImode, be ? 13 : 16);
23313
+ RTVEC_ELT (v, 12) = gen_rtx_CONST_INT (QImode, be ? 16 : 9);
23314
+ RTVEC_ELT (v, 13) = gen_rtx_CONST_INT (QImode, be ? 17 : 8);
23315
+ RTVEC_ELT (v, 14) = gen_rtx_CONST_INT (QImode, be ? 14 : 17);
23316
+ RTVEC_ELT (v, 15) = gen_rtx_CONST_INT (QImode, be ? 15 : 16);
23318
emit_insn (gen_vec_initv16qi (mask, gen_rtx_PARALLEL (V16QImode, v)));
23319
emit_insn (gen_vperm_v8hiv4si (operands[0], operands[1], vzero, mask));
23320
@@ -2168,7 +2222,10 @@
23322
emit_insn (gen_vec_widen_umult_even_v16qi (ve, operands[1], operands[2]));
23323
emit_insn (gen_vec_widen_umult_odd_v16qi (vo, operands[1], operands[2]));
23324
- emit_insn (gen_altivec_vmrghh (operands[0], ve, vo));
23325
+ if (BYTES_BIG_ENDIAN)
23326
+ emit_insn (gen_altivec_vmrghh (operands[0], ve, vo));
23328
+ emit_insn (gen_altivec_vmrghh (operands[0], vo, ve));
23332
@@ -2185,7 +2242,10 @@
23334
emit_insn (gen_vec_widen_umult_even_v16qi (ve, operands[1], operands[2]));
23335
emit_insn (gen_vec_widen_umult_odd_v16qi (vo, operands[1], operands[2]));
23336
- emit_insn (gen_altivec_vmrglh (operands[0], ve, vo));
23337
+ if (BYTES_BIG_ENDIAN)
23338
+ emit_insn (gen_altivec_vmrglh (operands[0], ve, vo));
23340
+ emit_insn (gen_altivec_vmrglh (operands[0], vo, ve));
23344
@@ -2202,7 +2262,10 @@
23346
emit_insn (gen_vec_widen_smult_even_v16qi (ve, operands[1], operands[2]));
23347
emit_insn (gen_vec_widen_smult_odd_v16qi (vo, operands[1], operands[2]));
23348
- emit_insn (gen_altivec_vmrghh (operands[0], ve, vo));
23349
+ if (BYTES_BIG_ENDIAN)
23350
+ emit_insn (gen_altivec_vmrghh (operands[0], ve, vo));
23352
+ emit_insn (gen_altivec_vmrghh (operands[0], vo, ve));
23356
@@ -2219,7 +2282,10 @@
23358
emit_insn (gen_vec_widen_smult_even_v16qi (ve, operands[1], operands[2]));
23359
emit_insn (gen_vec_widen_smult_odd_v16qi (vo, operands[1], operands[2]));
23360
- emit_insn (gen_altivec_vmrglh (operands[0], ve, vo));
23361
+ if (BYTES_BIG_ENDIAN)
23362
+ emit_insn (gen_altivec_vmrglh (operands[0], ve, vo));
23364
+ emit_insn (gen_altivec_vmrglh (operands[0], vo, ve));
23368
@@ -2236,7 +2302,10 @@
23370
emit_insn (gen_vec_widen_umult_even_v8hi (ve, operands[1], operands[2]));
23371
emit_insn (gen_vec_widen_umult_odd_v8hi (vo, operands[1], operands[2]));
23372
- emit_insn (gen_altivec_vmrghw (operands[0], ve, vo));
23373
+ if (BYTES_BIG_ENDIAN)
23374
+ emit_insn (gen_altivec_vmrghw (operands[0], ve, vo));
23376
+ emit_insn (gen_altivec_vmrghw (operands[0], vo, ve));
23380
@@ -2253,7 +2322,10 @@
23382
emit_insn (gen_vec_widen_umult_even_v8hi (ve, operands[1], operands[2]));
23383
emit_insn (gen_vec_widen_umult_odd_v8hi (vo, operands[1], operands[2]));
23384
- emit_insn (gen_altivec_vmrglw (operands[0], ve, vo));
23385
+ if (BYTES_BIG_ENDIAN)
23386
+ emit_insn (gen_altivec_vmrglw (operands[0], ve, vo));
23388
+ emit_insn (gen_altivec_vmrglw (operands[0], vo, ve));
23392
@@ -2270,7 +2342,10 @@
23394
emit_insn (gen_vec_widen_smult_even_v8hi (ve, operands[1], operands[2]));
23395
emit_insn (gen_vec_widen_smult_odd_v8hi (vo, operands[1], operands[2]));
23396
- emit_insn (gen_altivec_vmrghw (operands[0], ve, vo));
23397
+ if (BYTES_BIG_ENDIAN)
23398
+ emit_insn (gen_altivec_vmrghw (operands[0], ve, vo));
23400
+ emit_insn (gen_altivec_vmrghw (operands[0], vo, ve));
23404
@@ -2287,33 +2362,20 @@
23406
emit_insn (gen_vec_widen_smult_even_v8hi (ve, operands[1], operands[2]));
23407
emit_insn (gen_vec_widen_smult_odd_v8hi (vo, operands[1], operands[2]));
23408
- emit_insn (gen_altivec_vmrglw (operands[0], ve, vo));
23409
+ if (BYTES_BIG_ENDIAN)
23410
+ emit_insn (gen_altivec_vmrglw (operands[0], ve, vo));
23412
+ emit_insn (gen_altivec_vmrglw (operands[0], vo, ve));
23416
-(define_expand "vec_pack_trunc_v8hi"
23417
- [(set (match_operand:V16QI 0 "register_operand" "=v")
23418
- (unspec:V16QI [(match_operand:V8HI 1 "register_operand" "v")
23419
- (match_operand:V8HI 2 "register_operand" "v")]
23420
- UNSPEC_VPKUHUM))]
23424
- emit_insn (gen_altivec_vpkuhum (operands[0], operands[1], operands[2]));
23428
-(define_expand "vec_pack_trunc_v4si"
23429
- [(set (match_operand:V8HI 0 "register_operand" "=v")
23430
- (unspec:V8HI [(match_operand:V4SI 1 "register_operand" "v")
23431
- (match_operand:V4SI 2 "register_operand" "v")]
23432
- UNSPEC_VPKUWUM))]
23436
- emit_insn (gen_altivec_vpkuwum (operands[0], operands[1], operands[2]));
23439
+(define_expand "vec_pack_trunc_<mode>"
23440
+ [(set (match_operand:<VP_small> 0 "register_operand" "=v")
23441
+ (unspec:<VP_small> [(match_operand:VP 1 "register_operand" "v")
23442
+ (match_operand:VP 2 "register_operand" "v")]
23443
+ UNSPEC_VPACK_UNS_UNS_MOD))]
23447
(define_expand "altivec_negv4sf2"
23448
[(use (match_operand:V4SF 0 "register_operand" ""))
23449
@@ -2460,3 +2522,34 @@
23450
emit_insn (gen_altivec_vcfux (operands[0], tmp, const0_rtx));
23455
+;; Power8 vector instructions encoded as Altivec instructions
23457
+;; Vector count leading zeros
23458
+(define_insn "*p8v_clz<mode>2"
23459
+ [(set (match_operand:VI2 0 "register_operand" "=v")
23460
+ (clz:VI2 (match_operand:VI2 1 "register_operand" "v")))]
23461
+ "TARGET_P8_VECTOR"
23463
+ [(set_attr "length" "4")
23464
+ (set_attr "type" "vecsimple")])
23466
+;; Vector population count
23467
+(define_insn "*p8v_popcount<mode>2"
23468
+ [(set (match_operand:VI2 0 "register_operand" "=v")
23469
+ (popcount:VI2 (match_operand:VI2 1 "register_operand" "v")))]
23470
+ "TARGET_P8_VECTOR"
23471
+ "vpopcnt<wd> %0,%1"
23472
+ [(set_attr "length" "4")
23473
+ (set_attr "type" "vecsimple")])
23475
+;; Vector Gather Bits by Bytes by Doubleword
23476
+(define_insn "p8v_vgbbd"
23477
+ [(set (match_operand:V16QI 0 "register_operand" "=v")
23478
+ (unspec:V16QI [(match_operand:V16QI 1 "register_operand" "v")]
23480
+ "TARGET_P8_VECTOR"
23482
+ [(set_attr "length" "4")
23483
+ (set_attr "type" "vecsimple")])
23484
--- a/src/gcc/config/rs6000/sysv4le.h
23485
+++ b/src/gcc/config/rs6000/sysv4le.h
23488
#undef MULTILIB_DEFAULTS
23489
#define MULTILIB_DEFAULTS { "mlittle", "mcall-sysv" }
23491
+/* Little-endian PowerPC64 Linux uses the ELF v2 ABI by default. */
23492
+#define LINUX64_DEFAULT_ABI_ELFv2
23494
--- a/src/gcc/config/rs6000/dfp.md
23495
+++ b/src/gcc/config/rs6000/dfp.md
23500
-(define_expand "movsd"
23501
- [(set (match_operand:SD 0 "nonimmediate_operand" "")
23502
- (match_operand:SD 1 "any_operand" ""))]
23503
- "TARGET_HARD_FLOAT && TARGET_FPRS"
23504
- "{ rs6000_emit_move (operands[0], operands[1], SDmode); DONE; }")
23507
- [(set (match_operand:SD 0 "gpc_reg_operand" "")
23508
- (match_operand:SD 1 "const_double_operand" ""))]
23509
- "reload_completed
23510
- && ((GET_CODE (operands[0]) == REG && REGNO (operands[0]) <= 31)
23511
- || (GET_CODE (operands[0]) == SUBREG
23512
- && GET_CODE (SUBREG_REG (operands[0])) == REG
23513
- && REGNO (SUBREG_REG (operands[0])) <= 31))"
23514
- [(set (match_dup 2) (match_dup 3))]
23518
- REAL_VALUE_TYPE rv;
23520
- REAL_VALUE_FROM_CONST_DOUBLE (rv, operands[1]);
23521
- REAL_VALUE_TO_TARGET_DECIMAL32 (rv, l);
23523
- if (! TARGET_POWERPC64)
23524
- operands[2] = operand_subword (operands[0], 0, 0, SDmode);
23526
- operands[2] = gen_lowpart (SImode, operands[0]);
23528
- operands[3] = gen_int_mode (l, SImode);
23531
-(define_insn "movsd_hardfloat"
23532
- [(set (match_operand:SD 0 "nonimmediate_operand" "=r,r,m,f,*c*l,!r,*h,!r,!r")
23533
- (match_operand:SD 1 "input_operand" "r,m,r,f,r,h,0,G,Fn"))]
23534
- "(gpc_reg_operand (operands[0], SDmode)
23535
- || gpc_reg_operand (operands[1], SDmode))
23536
- && (TARGET_HARD_FLOAT && TARGET_FPRS)"
23547
- [(set_attr "type" "*,load,store,fp,mtjmpr,mfjmpr,*,*,*")
23548
- (set_attr "length" "4,4,4,4,4,4,4,4,8")])
23550
-(define_insn "movsd_softfloat"
23551
- [(set (match_operand:SD 0 "nonimmediate_operand" "=r,cl,r,r,m,r,r,r,r,r,*h")
23552
- (match_operand:SD 1 "input_operand" "r,r,h,m,r,I,L,R,G,Fn,0"))]
23553
- "(gpc_reg_operand (operands[0], SDmode)
23554
- || gpc_reg_operand (operands[1], SDmode))
23555
- && (TARGET_SOFT_FLOAT || !TARGET_FPRS)"
23568
- [(set_attr "type" "*,mtjmpr,mfjmpr,load,store,*,*,*,*,*,*")
23569
- (set_attr "length" "4,4,4,4,4,4,4,4,4,8,4")])
23571
(define_insn "movsd_store"
23572
[(set (match_operand:DD 0 "nonimmediate_operand" "=m")
23573
(unspec:DD [(match_operand:SD 1 "input_operand" "d")]
23574
@@ -108,7 +37,14 @@
23575
|| gpc_reg_operand (operands[1], SDmode))
23576
&& TARGET_HARD_FLOAT && TARGET_FPRS"
23578
- [(set_attr "type" "fpstore")
23579
+ [(set (attr "type")
23581
+ (match_test "update_indexed_address_mem (operands[0], VOIDmode)")
23582
+ (const_string "fpstore_ux")
23584
+ (match_test "update_address_mem (operands[0], VOIDmode)")
23585
+ (const_string "fpstore_u")
23586
+ (const_string "fpstore"))))
23587
(set_attr "length" "4")])
23589
(define_insn "movsd_load"
23590
@@ -119,7 +55,14 @@
23591
|| gpc_reg_operand (operands[1], DDmode))
23592
&& TARGET_HARD_FLOAT && TARGET_FPRS"
23594
- [(set_attr "type" "fpload")
23595
+ [(set (attr "type")
23597
+ (match_test "update_indexed_address_mem (operands[1], VOIDmode)")
23598
+ (const_string "fpload_ux")
23600
+ (match_test "update_address_mem (operands[1], VOIDmode)")
23601
+ (const_string "fpload_u")
23602
+ (const_string "fpload"))))
23603
(set_attr "length" "4")])
23605
;; Hardware support for decimal floating point operations.
23606
@@ -182,211 +125,6 @@
23608
[(set_attr "type" "fp")])
23610
-(define_expand "movdd"
23611
- [(set (match_operand:DD 0 "nonimmediate_operand" "")
23612
- (match_operand:DD 1 "any_operand" ""))]
23614
- "{ rs6000_emit_move (operands[0], operands[1], DDmode); DONE; }")
23617
- [(set (match_operand:DD 0 "gpc_reg_operand" "")
23618
- (match_operand:DD 1 "const_int_operand" ""))]
23619
- "! TARGET_POWERPC64 && reload_completed
23620
- && ((GET_CODE (operands[0]) == REG && REGNO (operands[0]) <= 31)
23621
- || (GET_CODE (operands[0]) == SUBREG
23622
- && GET_CODE (SUBREG_REG (operands[0])) == REG
23623
- && REGNO (SUBREG_REG (operands[0])) <= 31))"
23624
- [(set (match_dup 2) (match_dup 4))
23625
- (set (match_dup 3) (match_dup 1))]
23628
- int endian = (WORDS_BIG_ENDIAN == 0);
23629
- HOST_WIDE_INT value = INTVAL (operands[1]);
23631
- operands[2] = operand_subword (operands[0], endian, 0, DDmode);
23632
- operands[3] = operand_subword (operands[0], 1 - endian, 0, DDmode);
23633
-#if HOST_BITS_PER_WIDE_INT == 32
23634
- operands[4] = (value & 0x80000000) ? constm1_rtx : const0_rtx;
23636
- operands[4] = GEN_INT (value >> 32);
23637
- operands[1] = GEN_INT (((value & 0xffffffff) ^ 0x80000000) - 0x80000000);
23642
- [(set (match_operand:DD 0 "gpc_reg_operand" "")
23643
- (match_operand:DD 1 "const_double_operand" ""))]
23644
- "! TARGET_POWERPC64 && reload_completed
23645
- && ((GET_CODE (operands[0]) == REG && REGNO (operands[0]) <= 31)
23646
- || (GET_CODE (operands[0]) == SUBREG
23647
- && GET_CODE (SUBREG_REG (operands[0])) == REG
23648
- && REGNO (SUBREG_REG (operands[0])) <= 31))"
23649
- [(set (match_dup 2) (match_dup 4))
23650
- (set (match_dup 3) (match_dup 5))]
23653
- int endian = (WORDS_BIG_ENDIAN == 0);
23655
- REAL_VALUE_TYPE rv;
23657
- REAL_VALUE_FROM_CONST_DOUBLE (rv, operands[1]);
23658
- REAL_VALUE_TO_TARGET_DECIMAL64 (rv, l);
23660
- operands[2] = operand_subword (operands[0], endian, 0, DDmode);
23661
- operands[3] = operand_subword (operands[0], 1 - endian, 0, DDmode);
23662
- operands[4] = gen_int_mode (l[endian], SImode);
23663
- operands[5] = gen_int_mode (l[1 - endian], SImode);
23667
- [(set (match_operand:DD 0 "gpc_reg_operand" "")
23668
- (match_operand:DD 1 "const_double_operand" ""))]
23669
- "TARGET_POWERPC64 && reload_completed
23670
- && ((GET_CODE (operands[0]) == REG && REGNO (operands[0]) <= 31)
23671
- || (GET_CODE (operands[0]) == SUBREG
23672
- && GET_CODE (SUBREG_REG (operands[0])) == REG
23673
- && REGNO (SUBREG_REG (operands[0])) <= 31))"
23674
- [(set (match_dup 2) (match_dup 3))]
23677
- int endian = (WORDS_BIG_ENDIAN == 0);
23679
- REAL_VALUE_TYPE rv;
23680
-#if HOST_BITS_PER_WIDE_INT >= 64
23681
- HOST_WIDE_INT val;
23684
- REAL_VALUE_FROM_CONST_DOUBLE (rv, operands[1]);
23685
- REAL_VALUE_TO_TARGET_DECIMAL64 (rv, l);
23687
- operands[2] = gen_lowpart (DImode, operands[0]);
23688
- /* HIGHPART is lower memory address when WORDS_BIG_ENDIAN. */
23689
-#if HOST_BITS_PER_WIDE_INT >= 64
23690
- val = ((HOST_WIDE_INT)(unsigned long)l[endian] << 32
23691
- | ((HOST_WIDE_INT)(unsigned long)l[1 - endian]));
23693
- operands[3] = gen_int_mode (val, DImode);
23695
- operands[3] = immed_double_const (l[1 - endian], l[endian], DImode);
23699
-;; Don't have reload use general registers to load a constant. First,
23700
-;; it might not work if the output operand is the equivalent of
23701
-;; a non-offsettable memref, but also it is less efficient than loading
23702
-;; the constant into an FP register, since it will probably be used there.
23703
-;; The "??" is a kludge until we can figure out a more reasonable way
23704
-;; of handling these non-offsettable values.
23705
-(define_insn "*movdd_hardfloat32"
23706
- [(set (match_operand:DD 0 "nonimmediate_operand" "=!r,??r,m,d,d,m,!r,!r,!r")
23707
- (match_operand:DD 1 "input_operand" "r,m,r,d,m,d,G,H,F"))]
23708
- "! TARGET_POWERPC64 && TARGET_HARD_FLOAT && TARGET_FPRS
23709
- && (gpc_reg_operand (operands[0], DDmode)
23710
- || gpc_reg_operand (operands[1], DDmode))"
23713
- switch (which_alternative)
23716
- gcc_unreachable ();
23722
- return \"fmr %0,%1\";
23724
- return \"lfd%U1%X1 %0,%1\";
23726
- return \"stfd%U0%X0 %1,%0\";
23733
- [(set_attr "type" "two,load,store,fp,fpload,fpstore,*,*,*")
23734
- (set_attr "length" "8,16,16,4,4,4,8,12,16")])
23736
-(define_insn "*movdd_softfloat32"
23737
- [(set (match_operand:DD 0 "nonimmediate_operand" "=r,r,m,r,r,r")
23738
- (match_operand:DD 1 "input_operand" "r,m,r,G,H,F"))]
23739
- "! TARGET_POWERPC64 && (TARGET_SOFT_FLOAT || !TARGET_FPRS)
23740
- && (gpc_reg_operand (operands[0], DDmode)
23741
- || gpc_reg_operand (operands[1], DDmode))"
23743
- [(set_attr "type" "two,load,store,*,*,*")
23744
- (set_attr "length" "8,8,8,8,12,16")])
23746
-; ld/std require word-aligned displacements -> 'Y' constraint.
23747
-; List Y->r and r->Y before r->r for reload.
23748
-(define_insn "*movdd_hardfloat64_mfpgpr"
23749
- [(set (match_operand:DD 0 "nonimmediate_operand" "=Y,r,!r,d,d,m,*c*l,!r,*h,!r,!r,!r,r,d")
23750
- (match_operand:DD 1 "input_operand" "r,Y,r,d,m,d,r,h,0,G,H,F,d,r"))]
23751
- "TARGET_POWERPC64 && TARGET_MFPGPR && TARGET_HARD_FLOAT && TARGET_FPRS
23752
- && (gpc_reg_operand (operands[0], DDmode)
23753
- || gpc_reg_operand (operands[1], DDmode))"
23769
- [(set_attr "type" "store,load,*,fp,fpload,fpstore,mtjmpr,mfjmpr,*,*,*,*,mftgpr,mffgpr")
23770
- (set_attr "length" "4,4,4,4,4,4,4,4,4,8,12,16,4,4")])
23772
-; ld/std require word-aligned displacements -> 'Y' constraint.
23773
-; List Y->r and r->Y before r->r for reload.
23774
-(define_insn "*movdd_hardfloat64"
23775
- [(set (match_operand:DD 0 "nonimmediate_operand" "=Y,r,!r,d,d,m,*c*l,!r,*h,!r,!r,!r")
23776
- (match_operand:DD 1 "input_operand" "r,Y,r,d,m,d,r,h,0,G,H,F"))]
23777
- "TARGET_POWERPC64 && !TARGET_MFPGPR && TARGET_HARD_FLOAT && TARGET_FPRS
23778
- && (gpc_reg_operand (operands[0], DDmode)
23779
- || gpc_reg_operand (operands[1], DDmode))"
23793
- [(set_attr "type" "store,load,*,fp,fpload,fpstore,mtjmpr,mfjmpr,*,*,*,*")
23794
- (set_attr "length" "4,4,4,4,4,4,4,4,4,8,12,16")])
23796
-(define_insn "*movdd_softfloat64"
23797
- [(set (match_operand:DD 0 "nonimmediate_operand" "=r,Y,r,cl,r,r,r,r,*h")
23798
- (match_operand:DD 1 "input_operand" "Y,r,r,r,h,G,H,F,0"))]
23799
- "TARGET_POWERPC64 && (TARGET_SOFT_FLOAT || !TARGET_FPRS)
23800
- && (gpc_reg_operand (operands[0], DDmode)
23801
- || gpc_reg_operand (operands[1], DDmode))"
23812
- [(set_attr "type" "load,store,*,mtjmpr,mfjmpr,*,*,*,*")
23813
- (set_attr "length" "4,4,4,4,4,8,12,16,4")])
23815
(define_expand "negtd2"
23816
[(set (match_operand:TD 0 "gpc_reg_operand" "")
23817
(neg:TD (match_operand:TD 1 "gpc_reg_operand" "")))]
23818
@@ -410,40 +148,25 @@
23821
(define_insn "*abstd2_fpr"
23822
- [(set (match_operand:TD 0 "gpc_reg_operand" "=d")
23823
- (abs:TD (match_operand:TD 1 "gpc_reg_operand" "d")))]
23824
+ [(set (match_operand:TD 0 "gpc_reg_operand" "=d,d")
23825
+ (abs:TD (match_operand:TD 1 "gpc_reg_operand" "0,d")))]
23826
"TARGET_HARD_FLOAT && TARGET_FPRS"
23828
- [(set_attr "type" "fp")])
23831
+ fabs %0,%1\;fmr %L0,%L1"
23832
+ [(set_attr "type" "fp")
23833
+ (set_attr "length" "4,8")])
23835
(define_insn "*nabstd2_fpr"
23836
- [(set (match_operand:TD 0 "gpc_reg_operand" "=d")
23837
- (neg:TD (abs:TD (match_operand:TD 1 "gpc_reg_operand" "d"))))]
23838
+ [(set (match_operand:TD 0 "gpc_reg_operand" "=d,d")
23839
+ (neg:TD (abs:TD (match_operand:TD 1 "gpc_reg_operand" "0,d"))))]
23840
"TARGET_HARD_FLOAT && TARGET_FPRS"
23842
- [(set_attr "type" "fp")])
23845
+ fnabs %0,%1\;fmr %L0,%L1"
23846
+ [(set_attr "type" "fp")
23847
+ (set_attr "length" "4,8")])
23849
-(define_expand "movtd"
23850
- [(set (match_operand:TD 0 "general_operand" "")
23851
- (match_operand:TD 1 "any_operand" ""))]
23852
- "TARGET_HARD_FLOAT && TARGET_FPRS"
23853
- "{ rs6000_emit_move (operands[0], operands[1], TDmode); DONE; }")
23855
-; It's important to list the Y->r and r->Y moves before r->r because
23856
-; otherwise reload, given m->r, will try to pick r->r and reload it,
23857
-; which doesn't make progress.
23858
-(define_insn_and_split "*movtd_internal"
23859
- [(set (match_operand:TD 0 "nonimmediate_operand" "=m,d,d,Y,r,r")
23860
- (match_operand:TD 1 "input_operand" "d,m,d,r,YGHF,r"))]
23861
- "TARGET_HARD_FLOAT && TARGET_FPRS
23862
- && (gpc_reg_operand (operands[0], TDmode)
23863
- || gpc_reg_operand (operands[1], TDmode))"
23865
- "&& reload_completed"
23867
-{ rs6000_split_multireg_move (operands[0], operands[1]); DONE; }
23868
- [(set_attr "length" "8,8,8,20,20,16")])
23870
;; Hardware support for decimal floating point operations.
23872
(define_insn "extendddtd2"
23873
--- a/src/gcc/config/rs6000/sync.md
23874
+++ b/src/gcc/config/rs6000/sync.md
23875
@@ -18,14 +18,23 @@
23876
;; along with GCC; see the file COPYING3. If not see
23877
;; <http://www.gnu.org/licenses/>.
23879
-(define_mode_attr larx [(SI "lwarx") (DI "ldarx")])
23880
-(define_mode_attr stcx [(SI "stwcx.") (DI "stdcx.")])
23881
+(define_mode_attr larx [(QI "lbarx")
23887
+(define_mode_attr stcx [(QI "stbcx.")
23893
(define_code_iterator FETCHOP [plus minus ior xor and])
23894
(define_code_attr fetchop_name
23895
[(plus "add") (minus "sub") (ior "or") (xor "xor") (and "and")])
23896
(define_code_attr fetchop_pred
23897
- [(plus "add_operand") (minus "gpc_reg_operand")
23898
+ [(plus "add_operand") (minus "int_reg_operand")
23899
(ior "logical_operand") (xor "logical_operand") (and "and_operand")])
23901
(define_expand "mem_thread_fence"
23902
@@ -129,16 +138,7 @@
23903
case MEMMODEL_CONSUME:
23904
case MEMMODEL_ACQUIRE:
23905
case MEMMODEL_SEQ_CST:
23906
- if (GET_MODE (operands[0]) == QImode)
23907
- emit_insn (gen_loadsync_qi (operands[0]));
23908
- else if (GET_MODE (operands[0]) == HImode)
23909
- emit_insn (gen_loadsync_hi (operands[0]));
23910
- else if (GET_MODE (operands[0]) == SImode)
23911
- emit_insn (gen_loadsync_si (operands[0]));
23912
- else if (GET_MODE (operands[0]) == DImode)
23913
- emit_insn (gen_loadsync_di (operands[0]));
23915
- gcc_unreachable ();
23916
+ emit_insn (gen_loadsync_<mode> (operands[0]));
23919
gcc_unreachable ();
23920
@@ -170,35 +170,109 @@
23924
-;; ??? Power ISA 2.06B says that there *is* a load-{byte,half}-and-reserve
23925
-;; opcode that is "phased-in". Not implemented as of Power7, so not yet used,
23926
-;; but let's prepare the macros anyway.
23927
+;; Any supported integer mode that has atomic l<x>arx/st<x>cx. instrucitons
23928
+;; other than the quad memory operations, which have special restrictions.
23929
+;; Byte/halfword atomic instructions were added in ISA 2.06B, but were phased
23930
+;; in and did not show up until power8. TImode atomic lqarx/stqcx. require
23931
+;; special handling due to even/odd register requirements.
23932
+(define_mode_iterator ATOMIC [(QI "TARGET_SYNC_HI_QI")
23933
+ (HI "TARGET_SYNC_HI_QI")
23935
+ (DI "TARGET_POWERPC64")])
23937
-(define_mode_iterator ATOMIC [SI (DI "TARGET_POWERPC64")])
23938
+;; Types that we should provide atomic instructions for.
23940
+(define_mode_iterator AINT [QI
23943
+ (DI "TARGET_POWERPC64")
23944
+ (TI "TARGET_SYNC_TI")])
23946
(define_insn "load_locked<mode>"
23947
- [(set (match_operand:ATOMIC 0 "gpc_reg_operand" "=r")
23948
+ [(set (match_operand:ATOMIC 0 "int_reg_operand" "=r")
23949
(unspec_volatile:ATOMIC
23950
[(match_operand:ATOMIC 1 "memory_operand" "Z")] UNSPECV_LL))]
23953
[(set_attr "type" "load_l")])
23955
+(define_insn "load_locked<QHI:mode>_si"
23956
+ [(set (match_operand:SI 0 "int_reg_operand" "=r")
23957
+ (unspec_volatile:SI
23958
+ [(match_operand:QHI 1 "memory_operand" "Z")] UNSPECV_LL))]
23959
+ "TARGET_SYNC_HI_QI"
23960
+ "<QHI:larx> %0,%y1"
23961
+ [(set_attr "type" "load_l")])
23963
+;; Use PTImode to get even/odd register pairs
23964
+(define_expand "load_lockedti"
23965
+ [(use (match_operand:TI 0 "quad_int_reg_operand" ""))
23966
+ (use (match_operand:TI 1 "memory_operand" ""))]
23969
+ /* Use a temporary register to force getting an even register for the
23970
+ lqarx/stqcrx. instructions. Normal optimizations will eliminate this
23972
+ rtx pti = gen_reg_rtx (PTImode);
23973
+ emit_insn (gen_load_lockedpti (pti, operands[1]));
23974
+ emit_move_insn (operands[0], gen_lowpart (TImode, pti));
23978
+(define_insn "load_lockedpti"
23979
+ [(set (match_operand:PTI 0 "quad_int_reg_operand" "=&r")
23980
+ (unspec_volatile:PTI
23981
+ [(match_operand:TI 1 "memory_operand" "Z")] UNSPECV_LL))]
23983
+ && !reg_mentioned_p (operands[0], operands[1])
23984
+ && quad_int_reg_operand (operands[0], PTImode)"
23986
+ [(set_attr "type" "load_l")])
23988
(define_insn "store_conditional<mode>"
23989
[(set (match_operand:CC 0 "cc_reg_operand" "=x")
23990
(unspec_volatile:CC [(const_int 0)] UNSPECV_SC))
23991
(set (match_operand:ATOMIC 1 "memory_operand" "=Z")
23992
- (match_operand:ATOMIC 2 "gpc_reg_operand" "r"))]
23993
+ (match_operand:ATOMIC 2 "int_reg_operand" "r"))]
23996
[(set_attr "type" "store_c")])
23998
+(define_expand "store_conditionalti"
23999
+ [(use (match_operand:CC 0 "cc_reg_operand" ""))
24000
+ (use (match_operand:TI 1 "memory_operand" ""))
24001
+ (use (match_operand:TI 2 "quad_int_reg_operand" ""))]
24004
+ rtx op0 = operands[0];
24005
+ rtx op1 = operands[1];
24006
+ rtx op2 = operands[2];
24007
+ rtx pti_op1 = change_address (op1, PTImode, XEXP (op1, 0));
24008
+ rtx pti_op2 = gen_reg_rtx (PTImode);
24010
+ /* Use a temporary register to force getting an even register for the
24011
+ lqarx/stqcrx. instructions. Normal optimizations will eliminate this
24013
+ emit_move_insn (pti_op2, gen_lowpart (PTImode, op2));
24014
+ emit_insn (gen_store_conditionalpti (op0, pti_op1, pti_op2));
24018
+(define_insn "store_conditionalpti"
24019
+ [(set (match_operand:CC 0 "cc_reg_operand" "=x")
24020
+ (unspec_volatile:CC [(const_int 0)] UNSPECV_SC))
24021
+ (set (match_operand:PTI 1 "memory_operand" "=Z")
24022
+ (match_operand:PTI 2 "quad_int_reg_operand" "r"))]
24023
+ "TARGET_SYNC_TI && quad_int_reg_operand (operands[2], PTImode)"
24025
+ [(set_attr "type" "store_c")])
24027
(define_expand "atomic_compare_and_swap<mode>"
24028
- [(match_operand:SI 0 "gpc_reg_operand" "") ;; bool out
24029
- (match_operand:INT1 1 "gpc_reg_operand" "") ;; val out
24030
- (match_operand:INT1 2 "memory_operand" "") ;; memory
24031
- (match_operand:INT1 3 "reg_or_short_operand" "") ;; expected
24032
- (match_operand:INT1 4 "gpc_reg_operand" "") ;; desired
24033
+ [(match_operand:SI 0 "int_reg_operand" "") ;; bool out
24034
+ (match_operand:AINT 1 "int_reg_operand" "") ;; val out
24035
+ (match_operand:AINT 2 "memory_operand" "") ;; memory
24036
+ (match_operand:AINT 3 "reg_or_short_operand" "") ;; expected
24037
+ (match_operand:AINT 4 "int_reg_operand" "") ;; desired
24038
(match_operand:SI 5 "const_int_operand" "") ;; is_weak
24039
(match_operand:SI 6 "const_int_operand" "") ;; model succ
24040
(match_operand:SI 7 "const_int_operand" "")] ;; model fail
24041
@@ -209,9 +283,9 @@
24044
(define_expand "atomic_exchange<mode>"
24045
- [(match_operand:INT1 0 "gpc_reg_operand" "") ;; output
24046
- (match_operand:INT1 1 "memory_operand" "") ;; memory
24047
- (match_operand:INT1 2 "gpc_reg_operand" "") ;; input
24048
+ [(match_operand:AINT 0 "int_reg_operand" "") ;; output
24049
+ (match_operand:AINT 1 "memory_operand" "") ;; memory
24050
+ (match_operand:AINT 2 "int_reg_operand" "") ;; input
24051
(match_operand:SI 3 "const_int_operand" "")] ;; model
24054
@@ -220,9 +294,9 @@
24057
(define_expand "atomic_<fetchop_name><mode>"
24058
- [(match_operand:INT1 0 "memory_operand" "") ;; memory
24059
- (FETCHOP:INT1 (match_dup 0)
24060
- (match_operand:INT1 1 "<fetchop_pred>" "")) ;; operand
24061
+ [(match_operand:AINT 0 "memory_operand" "") ;; memory
24062
+ (FETCHOP:AINT (match_dup 0)
24063
+ (match_operand:AINT 1 "<fetchop_pred>" "")) ;; operand
24064
(match_operand:SI 2 "const_int_operand" "")] ;; model
24067
@@ -232,8 +306,8 @@
24070
(define_expand "atomic_nand<mode>"
24071
- [(match_operand:INT1 0 "memory_operand" "") ;; memory
24072
- (match_operand:INT1 1 "gpc_reg_operand" "") ;; operand
24073
+ [(match_operand:AINT 0 "memory_operand" "") ;; memory
24074
+ (match_operand:AINT 1 "int_reg_operand" "") ;; operand
24075
(match_operand:SI 2 "const_int_operand" "")] ;; model
24078
@@ -243,10 +317,10 @@
24081
(define_expand "atomic_fetch_<fetchop_name><mode>"
24082
- [(match_operand:INT1 0 "gpc_reg_operand" "") ;; output
24083
- (match_operand:INT1 1 "memory_operand" "") ;; memory
24084
- (FETCHOP:INT1 (match_dup 1)
24085
- (match_operand:INT1 2 "<fetchop_pred>" "")) ;; operand
24086
+ [(match_operand:AINT 0 "int_reg_operand" "") ;; output
24087
+ (match_operand:AINT 1 "memory_operand" "") ;; memory
24088
+ (FETCHOP:AINT (match_dup 1)
24089
+ (match_operand:AINT 2 "<fetchop_pred>" "")) ;; operand
24090
(match_operand:SI 3 "const_int_operand" "")] ;; model
24093
@@ -256,9 +330,9 @@
24096
(define_expand "atomic_fetch_nand<mode>"
24097
- [(match_operand:INT1 0 "gpc_reg_operand" "") ;; output
24098
- (match_operand:INT1 1 "memory_operand" "") ;; memory
24099
- (match_operand:INT1 2 "gpc_reg_operand" "") ;; operand
24100
+ [(match_operand:AINT 0 "int_reg_operand" "") ;; output
24101
+ (match_operand:AINT 1 "memory_operand" "") ;; memory
24102
+ (match_operand:AINT 2 "int_reg_operand" "") ;; operand
24103
(match_operand:SI 3 "const_int_operand" "")] ;; model
24106
@@ -268,10 +342,10 @@
24109
(define_expand "atomic_<fetchop_name>_fetch<mode>"
24110
- [(match_operand:INT1 0 "gpc_reg_operand" "") ;; output
24111
- (match_operand:INT1 1 "memory_operand" "") ;; memory
24112
- (FETCHOP:INT1 (match_dup 1)
24113
- (match_operand:INT1 2 "<fetchop_pred>" "")) ;; operand
24114
+ [(match_operand:AINT 0 "int_reg_operand" "") ;; output
24115
+ (match_operand:AINT 1 "memory_operand" "") ;; memory
24116
+ (FETCHOP:AINT (match_dup 1)
24117
+ (match_operand:AINT 2 "<fetchop_pred>" "")) ;; operand
24118
(match_operand:SI 3 "const_int_operand" "")] ;; model
24121
@@ -281,9 +355,9 @@
24124
(define_expand "atomic_nand_fetch<mode>"
24125
- [(match_operand:INT1 0 "gpc_reg_operand" "") ;; output
24126
- (match_operand:INT1 1 "memory_operand" "") ;; memory
24127
- (match_operand:INT1 2 "gpc_reg_operand" "") ;; operand
24128
+ [(match_operand:AINT 0 "int_reg_operand" "") ;; output
24129
+ (match_operand:AINT 1 "memory_operand" "") ;; memory
24130
+ (match_operand:AINT 2 "int_reg_operand" "") ;; operand
24131
(match_operand:SI 3 "const_int_operand" "")] ;; model
24134
--- a/src/gcc/config/rs6000/crypto.md
24135
+++ b/src/gcc/config/rs6000/crypto.md
24137
+;; Cryptographic instructions added in ISA 2.07
24138
+;; Copyright (C) 2012-2013 Free Software Foundation, Inc.
24139
+;; Contributed by Michael Meissner (meissner@linux.vnet.ibm.com)
24141
+;; This file is part of GCC.
24143
+;; GCC is free software; you can redistribute it and/or modify it
24144
+;; under the terms of the GNU General Public License as published
24145
+;; by the Free Software Foundation; either version 3, or (at your
24146
+;; option) any later version.
24148
+;; GCC is distributed in the hope that it will be useful, but WITHOUT
24149
+;; ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
24150
+;; or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
24151
+;; License for more details.
24153
+;; You should have received a copy of the GNU General Public License
24154
+;; along with GCC; see the file COPYING3. If not see
24155
+;; <http://www.gnu.org/licenses/>.
24157
+(define_c_enum "unspec"
24160
+ UNSPEC_VCIPHERLAST
24161
+ UNSPEC_VNCIPHERLAST
24167
+;; Iterator for VPMSUM/VPERMXOR
24168
+(define_mode_iterator CR_mode [V16QI V8HI V4SI V2DI])
24170
+(define_mode_attr CR_char [(V16QI "b")
24175
+;; Iterator for VSHASIGMAD/VSHASIGMAW
24176
+(define_mode_iterator CR_hash [V4SI V2DI])
24178
+;; Iterator for the other crypto functions
24179
+(define_int_iterator CR_code [UNSPEC_VCIPHER
24181
+ UNSPEC_VCIPHERLAST
24182
+ UNSPEC_VNCIPHERLAST])
24184
+(define_int_attr CR_insn [(UNSPEC_VCIPHER "vcipher")
24185
+ (UNSPEC_VNCIPHER "vncipher")
24186
+ (UNSPEC_VCIPHERLAST "vcipherlast")
24187
+ (UNSPEC_VNCIPHERLAST "vncipherlast")])
24189
+;; 2 operand crypto instructions
24190
+(define_insn "crypto_<CR_insn>"
24191
+ [(set (match_operand:V2DI 0 "register_operand" "=v")
24192
+ (unspec:V2DI [(match_operand:V2DI 1 "register_operand" "v")
24193
+ (match_operand:V2DI 2 "register_operand" "v")]
24196
+ "<CR_insn> %0,%1,%2"
24197
+ [(set_attr "type" "crypto")])
24199
+(define_insn "crypto_vpmsum<CR_char>"
24200
+ [(set (match_operand:CR_mode 0 "register_operand" "=v")
24201
+ (unspec:CR_mode [(match_operand:CR_mode 1 "register_operand" "v")
24202
+ (match_operand:CR_mode 2 "register_operand" "v")]
24205
+ "vpmsum<CR_char> %0,%1,%2"
24206
+ [(set_attr "type" "crypto")])
24208
+;; 3 operand crypto instructions
24209
+(define_insn "crypto_vpermxor_<mode>"
24210
+ [(set (match_operand:CR_mode 0 "register_operand" "=v")
24211
+ (unspec:CR_mode [(match_operand:CR_mode 1 "register_operand" "v")
24212
+ (match_operand:CR_mode 2 "register_operand" "v")
24213
+ (match_operand:CR_mode 3 "register_operand" "v")]
24214
+ UNSPEC_VPERMXOR))]
24216
+ "vpermxor %0,%1,%2,%3"
24217
+ [(set_attr "type" "crypto")])
24219
+;; 1 operand crypto instruction
24220
+(define_insn "crypto_vsbox"
24221
+ [(set (match_operand:V2DI 0 "register_operand" "=v")
24222
+ (unspec:V2DI [(match_operand:V2DI 1 "register_operand" "v")]
24226
+ [(set_attr "type" "crypto")])
24228
+;; Hash crypto instructions
24229
+(define_insn "crypto_vshasigma<CR_char>"
24230
+ [(set (match_operand:CR_hash 0 "register_operand" "=v")
24231
+ (unspec:CR_hash [(match_operand:CR_hash 1 "register_operand" "v")
24232
+ (match_operand:SI 2 "const_0_to_1_operand" "n")
24233
+ (match_operand:SI 3 "const_0_to_15_operand" "n")]
24234
+ UNSPEC_VSHASIGMA))]
24236
+ "vshasigma<CR_char> %0,%1,%2,%3"
24237
+ [(set_attr "type" "crypto")])
24238
--- a/src/gcc/config/rs6000/rs6000.md
24239
+++ b/src/gcc/config/rs6000/rs6000.md
24240
@@ -25,10 +25,14 @@
24244
- [(STACK_POINTER_REGNUM 1)
24245
+ [(FIRST_GPR_REGNO 0)
24246
+ (STACK_POINTER_REGNUM 1)
24248
(STATIC_CHAIN_REGNUM 11)
24249
(HARD_FRAME_POINTER_REGNUM 31)
24250
+ (LAST_GPR_REGNO 31)
24251
+ (FIRST_FPR_REGNO 32)
24252
+ (LAST_FPR_REGNO 63)
24255
(ARG_POINTER_REGNUM 67)
24257
(SPE_ACC_REGNO 111)
24258
(SPEFSCR_REGNO 112)
24259
(FRAME_POINTER_REGNUM 113)
24261
- ; ABI defined stack offsets for storing the TOC pointer with AIX calls.
24262
- (TOC_SAVE_OFFSET_32BIT 20)
24263
- (TOC_SAVE_OFFSET_64BIT 40)
24265
- ; Function TOC offset in the AIX function descriptor.
24266
- (AIX_FUNC_DESC_TOC_32BIT 4)
24267
- (AIX_FUNC_DESC_TOC_64BIT 8)
24269
- ; Static chain offset in the AIX function descriptor.
24270
- (AIX_FUNC_DESC_SC_32BIT 8)
24271
- (AIX_FUNC_DESC_SC_64BIT 16)
24272
+ (TFHAR_REGNO 114)
24273
+ (TFIAR_REGNO 115)
24274
+ (TEXASR_REGNO 116)
24278
@@ -123,6 +118,12 @@
24282
+ UNSPEC_P8V_FMRGOW
24283
+ UNSPEC_P8V_MTVSRWZ
24284
+ UNSPEC_P8V_RELOAD_FROM_GPR
24285
+ UNSPEC_P8V_MTVSRD
24286
+ UNSPEC_P8V_XXPERMDI
24287
+ UNSPEC_P8V_RELOAD_FROM_VSX
24291
@@ -142,7 +143,7 @@
24293
;; Define an insn type attribute. This is used in function unit delay
24295
-(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"
24296
+(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"
24297
(const_string "integer"))
24299
;; Define floating point instruction sub-types for use with Xfpu.md
24300
@@ -164,7 +165,7 @@
24301
;; Processor type -- this attribute must exactly match the processor_type
24302
;; enumeration in rs6000.h.
24304
-(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"
24305
+(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"
24306
(const (symbol_ref "rs6000_cpu_attr")))
24309
@@ -197,6 +198,7 @@
24310
(include "power5.md")
24311
(include "power6.md")
24312
(include "power7.md")
24313
+(include "power8.md")
24314
(include "cell.md")
24315
(include "xfpu.md")
24317
@@ -215,7 +217,7 @@
24318
(define_mode_iterator GPR [SI (DI "TARGET_POWERPC64")])
24320
; Any supported integer mode.
24321
-(define_mode_iterator INT [QI HI SI DI TI])
24322
+(define_mode_iterator INT [QI HI SI DI TI PTI])
24324
; Any supported integer mode that fits in one register.
24325
(define_mode_iterator INT1 [QI HI SI (DI "TARGET_POWERPC64")])
24326
@@ -223,6 +225,12 @@
24327
; extend modes for DImode
24328
(define_mode_iterator QHSI [QI HI SI])
24330
+; QImode or HImode for small atomic ops
24331
+(define_mode_iterator QHI [QI HI])
24333
+; HImode or SImode for sign extended fusion ops
24334
+(define_mode_iterator HSI [HI SI])
24336
; SImode or DImode, even if DImode doesn't fit in GPRs.
24337
(define_mode_iterator SDI [SI DI])
24339
@@ -230,6 +238,10 @@
24340
; (one with a '.') will compare; and the size used for arithmetic carries.
24341
(define_mode_iterator P [(SI "TARGET_32BIT") (DI "TARGET_64BIT")])
24343
+; Iterator to add PTImode along with TImode (TImode can go in VSX registers,
24344
+; PTImode is GPR only)
24345
+(define_mode_iterator TI2 [TI PTI])
24347
; Any hardware-supported floating-point mode
24348
(define_mode_iterator FP [
24349
(SF "TARGET_HARD_FLOAT
24350
@@ -253,6 +265,49 @@
24351
(V2DF "VECTOR_UNIT_ALTIVEC_OR_VSX_P (V2DFmode)")
24354
+; Floating point move iterators to combine binary and decimal moves
24355
+(define_mode_iterator FMOVE32 [SF SD])
24356
+(define_mode_iterator FMOVE64 [DF DD])
24357
+(define_mode_iterator FMOVE64X [DI DF DD])
24358
+(define_mode_iterator FMOVE128 [(TF "!TARGET_IEEEQUAD && TARGET_LONG_DOUBLE_128")
24359
+ (TD "TARGET_HARD_FLOAT && TARGET_FPRS")])
24361
+; Iterators for 128 bit types for direct move
24362
+(define_mode_iterator FMOVE128_GPR [(TI "TARGET_VSX_TIMODE")
24370
+; Whether a floating point move is ok, don't allow SD without hardware FP
24371
+(define_mode_attr fmove_ok [(SF "")
24373
+ (SD "TARGET_HARD_FLOAT && TARGET_FPRS")
24376
+; Convert REAL_VALUE to the appropriate bits
24377
+(define_mode_attr real_value_to_target [(SF "REAL_VALUE_TO_TARGET_SINGLE")
24378
+ (DF "REAL_VALUE_TO_TARGET_DOUBLE")
24379
+ (SD "REAL_VALUE_TO_TARGET_DECIMAL32")
24380
+ (DD "REAL_VALUE_TO_TARGET_DECIMAL64")])
24382
+; Definitions for load to 32-bit fpr register
24383
+(define_mode_attr f32_lr [(SF "f") (SD "wz")])
24384
+(define_mode_attr f32_lm [(SF "m") (SD "Z")])
24385
+(define_mode_attr f32_li [(SF "lfs%U1%X1 %0,%1") (SD "lfiwzx %0,%y1")])
24386
+(define_mode_attr f32_lv [(SF "lxsspx %x0,%y1") (SD "lxsiwzx %x0,%y1")])
24388
+; Definitions for store from 32-bit fpr register
24389
+(define_mode_attr f32_sr [(SF "f") (SD "wx")])
24390
+(define_mode_attr f32_sm [(SF "m") (SD "Z")])
24391
+(define_mode_attr f32_si [(SF "stfs%U0%X0 %1,%0") (SD "stfiwx %1,%y0")])
24392
+(define_mode_attr f32_sv [(SF "stxsspx %x1,%y0") (SD "stxsiwzx %x1,%y0")])
24394
+; Definitions for 32-bit fpr direct move
24395
+(define_mode_attr f32_dm [(SF "wn") (SD "wm")])
24397
; These modes do not fit in integer registers in 32-bit mode.
24398
; but on e500v2, the gpr are 64 bit registers
24399
(define_mode_iterator DIFD [DI (DF "!TARGET_E500_DOUBLE") DD])
24400
@@ -263,6 +318,25 @@
24401
; Iterator for just SF/DF
24402
(define_mode_iterator SFDF [SF DF])
24404
+; SF/DF suffix for traditional floating instructions
24405
+(define_mode_attr Ftrad [(SF "s") (DF "")])
24407
+; SF/DF suffix for VSX instructions
24408
+(define_mode_attr Fvsx [(SF "sp") (DF "dp")])
24410
+; SF/DF constraint for arithmetic on traditional floating point registers
24411
+(define_mode_attr Ff [(SF "f") (DF "d")])
24413
+; SF/DF constraint for arithmetic on VSX registers
24414
+(define_mode_attr Fv [(SF "wy") (DF "ws")])
24416
+; s/d suffix for things like fp_addsub_s/fp_addsub_d
24417
+(define_mode_attr Fs [(SF "s") (DF "d")])
24419
+; FRE/FRES support
24420
+(define_mode_attr Ffre [(SF "fres") (DF "fre")])
24421
+(define_mode_attr FFRE [(SF "FRES") (DF "FRE")])
24423
; Conditional returns.
24424
(define_code_iterator any_return [return simple_return])
24425
(define_code_attr return_pred [(return "direct_return ()")
24426
@@ -271,7 +345,14 @@
24428
; Various instructions that come in SI and DI forms.
24429
; A generic w/d attribute, for things like cmpw/cmpd.
24430
-(define_mode_attr wd [(QI "b") (HI "h") (SI "w") (DI "d")])
24431
+(define_mode_attr wd [(QI "b")
24441
(define_mode_attr dbits [(QI "56") (HI "48") (SI "32")])
24442
@@ -311,6 +392,77 @@
24444
(define_mode_attr TARGET_FLOAT [(SF "TARGET_SINGLE_FLOAT")
24445
(DF "TARGET_DOUBLE_FLOAT")])
24447
+;; Mode iterator for logical operations on 128-bit types
24448
+(define_mode_iterator BOOL_128 [TI
24450
+ (V16QI "TARGET_ALTIVEC")
24451
+ (V8HI "TARGET_ALTIVEC")
24452
+ (V4SI "TARGET_ALTIVEC")
24453
+ (V4SF "TARGET_ALTIVEC")
24454
+ (V2DI "TARGET_ALTIVEC")
24455
+ (V2DF "TARGET_ALTIVEC")])
24457
+;; For the GPRs we use 3 constraints for register outputs, two that are the
24458
+;; same as the output register, and a third where the output register is an
24459
+;; early clobber, so we don't have to deal with register overlaps. For the
24460
+;; vector types, we prefer to use the vector registers. For TI mode, allow
24463
+;; Mode attribute for boolean operation register constraints for output
24464
+(define_mode_attr BOOL_REGS_OUTPUT [(TI "&r,r,r,wa,v")
24466
+ (V16QI "wa,v,&?r,?r,?r")
24467
+ (V8HI "wa,v,&?r,?r,?r")
24468
+ (V4SI "wa,v,&?r,?r,?r")
24469
+ (V4SF "wa,v,&?r,?r,?r")
24470
+ (V2DI "wa,v,&?r,?r,?r")
24471
+ (V2DF "wa,v,&?r,?r,?r")])
24473
+;; Mode attribute for boolean operation register constraints for operand1
24474
+(define_mode_attr BOOL_REGS_OP1 [(TI "r,0,r,wa,v")
24476
+ (V16QI "wa,v,r,0,r")
24477
+ (V8HI "wa,v,r,0,r")
24478
+ (V4SI "wa,v,r,0,r")
24479
+ (V4SF "wa,v,r,0,r")
24480
+ (V2DI "wa,v,r,0,r")
24481
+ (V2DF "wa,v,r,0,r")])
24483
+;; Mode attribute for boolean operation register constraints for operand2
24484
+(define_mode_attr BOOL_REGS_OP2 [(TI "r,r,0,wa,v")
24486
+ (V16QI "wa,v,r,r,0")
24487
+ (V8HI "wa,v,r,r,0")
24488
+ (V4SI "wa,v,r,r,0")
24489
+ (V4SF "wa,v,r,r,0")
24490
+ (V2DI "wa,v,r,r,0")
24491
+ (V2DF "wa,v,r,r,0")])
24493
+;; Mode attribute for boolean operation register constraints for operand1
24494
+;; for one_cmpl. To simplify things, we repeat the constraint where 0
24495
+;; is used for operand1 or operand2
24496
+(define_mode_attr BOOL_REGS_UNARY [(TI "r,0,0,wa,v")
24498
+ (V16QI "wa,v,r,0,0")
24499
+ (V8HI "wa,v,r,0,0")
24500
+ (V4SI "wa,v,r,0,0")
24501
+ (V4SF "wa,v,r,0,0")
24502
+ (V2DI "wa,v,r,0,0")
24503
+ (V2DF "wa,v,r,0,0")])
24505
+;; Mode attribute for the clobber of CC0 for AND expansion.
24506
+;; For the 128-bit types, we never do AND immediate, but we need to
24507
+;; get the correct number of X's for the number of operands.
24508
+(define_mode_attr BOOL_REGS_AND_CR0 [(TI "X,X,X,X,X")
24510
+ (V16QI "X,X,X,X,X")
24511
+ (V8HI "X,X,X,X,X")
24512
+ (V4SI "X,X,X,X,X")
24513
+ (V4SF "X,X,X,X,X")
24514
+ (V2DI "X,X,X,X,X")
24515
+ (V2DF "X,X,X,X,X")])
24518
;; Start with fixed-point load and store insns. Here we put only the more
24519
;; complex forms. Basic data transfer is done later.
24520
@@ -324,11 +476,19 @@
24521
(define_insn "*zero_extend<mode>di2_internal1"
24522
[(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
24523
(zero_extend:DI (match_operand:QHSI 1 "reg_or_mem_operand" "m,r")))]
24524
- "TARGET_POWERPC64"
24525
+ "TARGET_POWERPC64 && (<MODE>mode != SImode || !TARGET_LFIWZX)"
24528
rldicl %0,%1,0,<dbits>"
24529
- [(set_attr "type" "load,*")])
24530
+ [(set_attr_alternative "type"
24532
+ (match_test "update_indexed_address_mem (operands[1], VOIDmode)")
24533
+ (const_string "load_ux")
24535
+ (match_test "update_address_mem (operands[1], VOIDmode)")
24536
+ (const_string "load_u")
24537
+ (const_string "load")))
24538
+ (const_string "*")])])
24540
(define_insn "*zero_extend<mode>di2_internal2"
24541
[(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
24542
@@ -382,6 +542,29 @@
24546
+(define_insn "*zero_extendsidi2_lfiwzx"
24547
+ [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r,??wm,!wz,!wu")
24548
+ (zero_extend:DI (match_operand:SI 1 "reg_or_mem_operand" "m,r,r,Z,Z")))]
24549
+ "TARGET_POWERPC64 && TARGET_LFIWZX"
24552
+ rldicl %0,%1,0,32
24556
+ [(set_attr_alternative "type"
24558
+ (match_test "update_indexed_address_mem (operands[1], VOIDmode)")
24559
+ (const_string "load_ux")
24561
+ (match_test "update_address_mem (operands[1], VOIDmode)")
24562
+ (const_string "load_u")
24563
+ (const_string "load")))
24564
+ (const_string "*")
24565
+ (const_string "mffgpr")
24566
+ (const_string "fpload")
24567
+ (const_string "fpload")])])
24569
(define_insn "extendqidi2"
24570
[(set (match_operand:DI 0 "gpc_reg_operand" "=r")
24571
(sign_extend:DI (match_operand:QI 1 "gpc_reg_operand" "r")))]
24572
@@ -454,7 +637,15 @@
24576
- [(set_attr "type" "load_ext,exts")])
24577
+ [(set_attr_alternative "type"
24579
+ (match_test "update_indexed_address_mem (operands[1], VOIDmode)")
24580
+ (const_string "load_ext_ux")
24582
+ (match_test "update_address_mem (operands[1], VOIDmode)")
24583
+ (const_string "load_ext_u")
24584
+ (const_string "load_ext")))
24585
+ (const_string "exts")])])
24588
[(set (match_operand:DI 0 "gpc_reg_operand" "=r")
24589
@@ -521,16 +712,47 @@
24594
+(define_insn "*extendsidi2_lfiwax"
24595
+ [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r,??wm,!wl,!wu")
24596
+ (sign_extend:DI (match_operand:SI 1 "lwa_operand" "m,r,r,Z,Z")))]
24597
+ "TARGET_POWERPC64 && TARGET_LFIWAX"
24604
+ [(set_attr_alternative "type"
24606
+ (match_test "update_indexed_address_mem (operands[1], VOIDmode)")
24607
+ (const_string "load_ext_ux")
24609
+ (match_test "update_address_mem (operands[1], VOIDmode)")
24610
+ (const_string "load_ext_u")
24611
+ (const_string "load_ext")))
24612
+ (const_string "exts")
24613
+ (const_string "mffgpr")
24614
+ (const_string "fpload")
24615
+ (const_string "fpload")])])
24617
+(define_insn "*extendsidi2_nocell"
24618
[(set (match_operand:DI 0 "gpc_reg_operand" "=r,r")
24619
(sign_extend:DI (match_operand:SI 1 "lwa_operand" "m,r")))]
24620
- "TARGET_POWERPC64 && rs6000_gen_cell_microcode"
24621
+ "TARGET_POWERPC64 && rs6000_gen_cell_microcode && !TARGET_LFIWAX"
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
+(define_insn "*extendsidi2_nocell"
24638
[(set (match_operand:DI 0 "gpc_reg_operand" "=r")
24639
(sign_extend:DI (match_operand:SI 1 "gpc_reg_operand" "r")))]
24640
"TARGET_POWERPC64 && !rs6000_gen_cell_microcode"
24641
@@ -602,7 +824,15 @@
24644
rlwinm %0,%1,0,0xff"
24645
- [(set_attr "type" "load,*")])
24646
+ [(set_attr_alternative "type"
24648
+ (match_test "update_indexed_address_mem (operands[1], VOIDmode)")
24649
+ (const_string "load_ux")
24651
+ (match_test "update_address_mem (operands[1], VOIDmode)")
24652
+ (const_string "load_u")
24653
+ (const_string "load")))
24654
+ (const_string "*")])])
24657
[(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
24658
@@ -722,7 +952,15 @@
24661
rlwinm %0,%1,0,0xff"
24662
- [(set_attr "type" "load,*")])
24663
+ [(set_attr_alternative "type"
24665
+ (match_test "update_indexed_address_mem (operands[1], VOIDmode)")
24666
+ (const_string "load_ux")
24668
+ (match_test "update_address_mem (operands[1], VOIDmode)")
24669
+ (const_string "load_u")
24670
+ (const_string "load")))
24671
+ (const_string "*")])])
24674
[(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
24675
@@ -848,7 +1086,15 @@
24678
rlwinm %0,%1,0,0xffff"
24679
- [(set_attr "type" "load,*")])
24680
+ [(set_attr_alternative "type"
24682
+ (match_test "update_indexed_address_mem (operands[1], VOIDmode)")
24683
+ (const_string "load_ux")
24685
+ (match_test "update_address_mem (operands[1], VOIDmode)")
24686
+ (const_string "load_u")
24687
+ (const_string "load")))
24688
+ (const_string "*")])])
24691
[(set (match_operand:CC 0 "cc_reg_operand" "=x,?y")
24692
@@ -915,7 +1161,15 @@
24696
- [(set_attr "type" "load_ext,exts")])
24697
+ [(set_attr_alternative "type"
24699
+ (match_test "update_indexed_address_mem (operands[1], VOIDmode)")
24700
+ (const_string "load_ext_ux")
24702
+ (match_test "update_address_mem (operands[1], VOIDmode)")
24703
+ (const_string "load_ext_u")
24704
+ (const_string "load_ext")))
24705
+ (const_string "exts")])])
24708
[(set (match_operand:SI 0 "gpc_reg_operand" "=r")
24709
@@ -1658,7 +1912,19 @@
24713
-(define_insn "one_cmpl<mode>2"
24714
+(define_expand "one_cmpl<mode>2"
24715
+ [(set (match_operand:SDI 0 "gpc_reg_operand" "")
24716
+ (not:SDI (match_operand:SDI 1 "gpc_reg_operand" "")))]
24719
+ if (<MODE>mode == DImode && !TARGET_POWERPC64)
24721
+ rs6000_split_logical (operands, NOT, false, false, false, NULL_RTX);
24726
+(define_insn "*one_cmpl<mode>2"
24727
[(set (match_operand:GPR 0 "gpc_reg_operand" "=r")
24728
(not:GPR (match_operand:GPR 1 "gpc_reg_operand" "r")))]
24730
@@ -1935,7 +2201,9 @@
24731
[(set (match_operand:GPR 0 "gpc_reg_operand" "=r")
24732
(unspec:GPR [(match_operand:GPR 1 "gpc_reg_operand" "r")] UNSPEC_PARITY))]
24733
"TARGET_CMPB && TARGET_POPCNTB"
24734
- "prty<wd> %0,%1")
24736
+ [(set_attr "length" "4")
24737
+ (set_attr "type" "popcnt")])
24739
(define_expand "parity<mode>2"
24740
[(set (match_operand:GPR 0 "gpc_reg_operand" "")
24741
@@ -4054,7 +4322,7 @@
24745
- [(set_attr "type" "delayed_compare,var_delayed_compare,delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
24746
+ [(set_attr "type" "fast_compare,var_delayed_compare,delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
24747
(set_attr "length" "4,4,4,8,8,8")])
24750
@@ -4086,7 +4354,7 @@
24754
- [(set_attr "type" "delayed_compare,var_delayed_compare,delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
24755
+ [(set_attr "type" "fast_compare,var_delayed_compare,delayed_compare,delayed_compare,var_delayed_compare,delayed_compare")
24756
(set_attr "length" "4,4,4,8,8,8")])
24759
@@ -4455,224 +4723,226 @@
24763
-;; Floating-point insns, excluding normal data motion.
24765
-;; PowerPC has a full set of single-precision floating point instructions.
24767
-;; For the POWER architecture, we pretend that we have both SFmode and
24768
-;; DFmode insns, while, in fact, all fp insns are actually done in double.
24769
-;; The only conversions we will do will be when storing to memory. In that
24770
-;; case, we will use the "frsp" instruction before storing.
24772
-;; Note that when we store into a single-precision memory location, we need to
24773
-;; use the frsp insn first. If the register being stored isn't dead, we
24774
-;; need a scratch register for the frsp. But this is difficult when the store
24775
-;; is done by reload. It is not incorrect to do the frsp on the register in
24776
-;; this case, we just lose precision that we would have otherwise gotten but
24777
-;; is not guaranteed. Perhaps this should be tightened up at some point.
24779
+;; Floating-point insns, excluding normal data motion. We combine the SF/DF
24780
+;; modes here, and also add in conditional vsx/power8-vector support to access
24781
+;; values in the traditional Altivec registers if the appropriate
24782
+;; -mupper-regs-{df,sf} option is enabled.
24784
-(define_expand "extendsfdf2"
24785
- [(set (match_operand:DF 0 "gpc_reg_operand" "")
24786
- (float_extend:DF (match_operand:SF 1 "reg_or_none500mem_operand" "")))]
24787
- "TARGET_HARD_FLOAT && ((TARGET_FPRS && TARGET_DOUBLE_FLOAT) || TARGET_E500_DOUBLE)"
24788
+(define_expand "abs<mode>2"
24789
+ [(set (match_operand:SFDF 0 "gpc_reg_operand" "")
24790
+ (abs:SFDF (match_operand:SFDF 1 "gpc_reg_operand" "")))]
24791
+ "TARGET_<MODE>_INSN"
24794
-(define_insn_and_split "*extendsfdf2_fpr"
24795
- [(set (match_operand:DF 0 "gpc_reg_operand" "=d,?d,d")
24796
- (float_extend:DF (match_operand:SF 1 "reg_or_mem_operand" "0,f,m")))]
24797
- "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT"
24798
+(define_insn "*abs<mode>2_fpr"
24799
+ [(set (match_operand:SFDF 0 "gpc_reg_operand" "=<Ff>,<Fv>")
24800
+ (abs:SFDF (match_operand:SFDF 1 "gpc_reg_operand" "<Ff>,<Fv>")))]
24801
+ "TARGET_<MODE>_FPR"
24806
- "&& reload_completed && REG_P (operands[1]) && REGNO (operands[0]) == REGNO (operands[1])"
24809
- emit_note (NOTE_INSN_DELETED);
24812
- [(set_attr "type" "fp,fp,fpload")])
24815
+ [(set_attr "type" "fp")
24816
+ (set_attr "fp_type" "fp_addsub_<Fs>")])
24818
-(define_expand "truncdfsf2"
24819
- [(set (match_operand:SF 0 "gpc_reg_operand" "")
24820
- (float_truncate:SF (match_operand:DF 1 "gpc_reg_operand" "")))]
24821
- "TARGET_HARD_FLOAT && ((TARGET_FPRS && TARGET_DOUBLE_FLOAT) || TARGET_E500_DOUBLE)"
24823
+(define_insn "*nabs<mode>2_fpr"
24824
+ [(set (match_operand:SFDF 0 "gpc_reg_operand" "=<Ff>,<Fv>")
24827
+ (match_operand:SFDF 1 "gpc_reg_operand" "<Ff>,<Fv>"))))]
24828
+ "TARGET_<MODE>_FPR"
24831
+ xsnabsdp %x0,%x1"
24832
+ [(set_attr "type" "fp")
24833
+ (set_attr "fp_type" "fp_addsub_<Fs>")])
24835
-(define_insn "*truncdfsf2_fpr"
24836
- [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
24837
- (float_truncate:SF (match_operand:DF 1 "gpc_reg_operand" "d")))]
24838
- "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT"
24840
- [(set_attr "type" "fp")])
24842
-(define_expand "negsf2"
24843
- [(set (match_operand:SF 0 "gpc_reg_operand" "")
24844
- (neg:SF (match_operand:SF 1 "gpc_reg_operand" "")))]
24845
- "TARGET_HARD_FLOAT && TARGET_SINGLE_FLOAT"
24846
+(define_expand "neg<mode>2"
24847
+ [(set (match_operand:SFDF 0 "gpc_reg_operand" "")
24848
+ (neg:SFDF (match_operand:SFDF 1 "gpc_reg_operand" "")))]
24849
+ "TARGET_<MODE>_INSN"
24852
-(define_insn "*negsf2"
24853
- [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
24854
- (neg:SF (match_operand:SF 1 "gpc_reg_operand" "f")))]
24855
- "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT"
24857
- [(set_attr "type" "fp")])
24858
+(define_insn "*neg<mode>2_fpr"
24859
+ [(set (match_operand:SFDF 0 "gpc_reg_operand" "=<Ff>,<Fv>")
24860
+ (neg:SFDF (match_operand:SFDF 1 "gpc_reg_operand" "<Ff>,<Fv>")))]
24861
+ "TARGET_<MODE>_FPR"
24865
+ [(set_attr "type" "fp")
24866
+ (set_attr "fp_type" "fp_addsub_<Fs>")])
24868
-(define_expand "abssf2"
24869
- [(set (match_operand:SF 0 "gpc_reg_operand" "")
24870
- (abs:SF (match_operand:SF 1 "gpc_reg_operand" "")))]
24871
- "TARGET_HARD_FLOAT && TARGET_SINGLE_FLOAT"
24872
+(define_expand "add<mode>3"
24873
+ [(set (match_operand:SFDF 0 "gpc_reg_operand" "")
24874
+ (plus:SFDF (match_operand:SFDF 1 "gpc_reg_operand" "")
24875
+ (match_operand:SFDF 2 "gpc_reg_operand" "")))]
24876
+ "TARGET_<MODE>_INSN"
24879
-(define_insn "*abssf2"
24880
- [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
24881
- (abs:SF (match_operand:SF 1 "gpc_reg_operand" "f")))]
24882
- "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT"
24884
- [(set_attr "type" "fp")])
24885
+(define_insn "*add<mode>3_fpr"
24886
+ [(set (match_operand:SFDF 0 "gpc_reg_operand" "=<Ff>,<Fv>")
24887
+ (plus:SFDF (match_operand:SFDF 1 "gpc_reg_operand" "%<Ff>,<Fv>")
24888
+ (match_operand:SFDF 2 "gpc_reg_operand" "<Ff>,<Fv>")))]
24889
+ "TARGET_<MODE>_FPR"
24891
+ fadd<Ftrad> %0,%1,%2
24892
+ xsadd<Fvsx> %x0,%x1,%x2"
24893
+ [(set_attr "type" "fp")
24894
+ (set_attr "fp_type" "fp_addsub_<Fs>")])
24897
- [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
24898
- (neg:SF (abs:SF (match_operand:SF 1 "gpc_reg_operand" "f"))))]
24899
- "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT"
24901
- [(set_attr "type" "fp")])
24903
-(define_expand "addsf3"
24904
- [(set (match_operand:SF 0 "gpc_reg_operand" "")
24905
- (plus:SF (match_operand:SF 1 "gpc_reg_operand" "")
24906
- (match_operand:SF 2 "gpc_reg_operand" "")))]
24907
- "TARGET_HARD_FLOAT && TARGET_SINGLE_FLOAT"
24908
+(define_expand "sub<mode>3"
24909
+ [(set (match_operand:SFDF 0 "gpc_reg_operand" "")
24910
+ (minus:SFDF (match_operand:SFDF 1 "gpc_reg_operand" "")
24911
+ (match_operand:SFDF 2 "gpc_reg_operand" "")))]
24912
+ "TARGET_<MODE>_INSN"
24916
- [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
24917
- (plus:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
24918
- (match_operand:SF 2 "gpc_reg_operand" "f")))]
24919
- "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT"
24921
+(define_insn "*sub<mode>3_fpr"
24922
+ [(set (match_operand:SFDF 0 "gpc_reg_operand" "=<Ff>,<Fv>")
24923
+ (minus:SFDF (match_operand:SFDF 1 "gpc_reg_operand" "<Ff>,<Fv>")
24924
+ (match_operand:SFDF 2 "gpc_reg_operand" "<Ff>,<Fv>")))]
24925
+ "TARGET_<MODE>_FPR"
24927
+ fsub<Ftrad> %0,%1,%2
24928
+ xssub<Fvsx> %x0,%x1,%x2"
24929
[(set_attr "type" "fp")
24930
- (set_attr "fp_type" "fp_addsub_s")])
24931
+ (set_attr "fp_type" "fp_addsub_<Fs>")])
24933
-(define_expand "subsf3"
24934
- [(set (match_operand:SF 0 "gpc_reg_operand" "")
24935
- (minus:SF (match_operand:SF 1 "gpc_reg_operand" "")
24936
- (match_operand:SF 2 "gpc_reg_operand" "")))]
24937
- "TARGET_HARD_FLOAT && TARGET_SINGLE_FLOAT"
24938
+(define_expand "mul<mode>3"
24939
+ [(set (match_operand:SFDF 0 "gpc_reg_operand" "")
24940
+ (mult:SFDF (match_operand:SFDF 1 "gpc_reg_operand" "")
24941
+ (match_operand:SFDF 2 "gpc_reg_operand" "")))]
24942
+ "TARGET_<MODE>_INSN"
24946
- [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
24947
- (minus:SF (match_operand:SF 1 "gpc_reg_operand" "f")
24948
- (match_operand:SF 2 "gpc_reg_operand" "f")))]
24949
- "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT"
24951
- [(set_attr "type" "fp")
24952
- (set_attr "fp_type" "fp_addsub_s")])
24953
+(define_insn "*mul<mode>3_fpr"
24954
+ [(set (match_operand:SFDF 0 "gpc_reg_operand" "=<Ff>,<Fv>")
24955
+ (mult:SFDF (match_operand:SFDF 1 "gpc_reg_operand" "%<Ff>,<Fv>")
24956
+ (match_operand:SFDF 2 "gpc_reg_operand" "<Ff>,<Fv>")))]
24957
+ "TARGET_<MODE>_FPR"
24959
+ fmul<Ftrad> %0,%1,%2
24960
+ xsmul<Fvsx> %x0,%x1,%x2"
24961
+ [(set_attr "type" "dmul")
24962
+ (set_attr "fp_type" "fp_mul_<Fs>")])
24964
-(define_expand "mulsf3"
24965
- [(set (match_operand:SF 0 "gpc_reg_operand" "")
24966
- (mult:SF (match_operand:SF 1 "gpc_reg_operand" "")
24967
- (match_operand:SF 2 "gpc_reg_operand" "")))]
24968
- "TARGET_HARD_FLOAT && TARGET_SINGLE_FLOAT"
24969
+(define_expand "div<mode>3"
24970
+ [(set (match_operand:SFDF 0 "gpc_reg_operand" "")
24971
+ (div:SFDF (match_operand:SFDF 1 "gpc_reg_operand" "")
24972
+ (match_operand:SFDF 2 "gpc_reg_operand" "")))]
24973
+ "TARGET_<MODE>_INSN && !TARGET_SIMPLE_FPU"
24977
- [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
24978
- (mult:SF (match_operand:SF 1 "gpc_reg_operand" "%f")
24979
- (match_operand:SF 2 "gpc_reg_operand" "f")))]
24980
- "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT"
24982
- [(set_attr "type" "fp")
24983
- (set_attr "fp_type" "fp_mul_s")])
24984
+(define_insn "*div<mode>3_fpr"
24985
+ [(set (match_operand:SFDF 0 "gpc_reg_operand" "=<Ff>,<Fv>")
24986
+ (div:SFDF (match_operand:SFDF 1 "gpc_reg_operand" "<Ff>,<Fv>")
24987
+ (match_operand:SFDF 2 "gpc_reg_operand" "<Ff>,<Fv>")))]
24988
+ "TARGET_<MODE>_FPR && !TARGET_SIMPLE_FPU"
24990
+ fdiv<Ftrad> %0,%1,%2
24991
+ xsdiv<Fvsx> %x0,%x1,%x2"
24992
+ [(set_attr "type" "<Fs>div")
24993
+ (set_attr "fp_type" "fp_div_<Fs>")])
24995
-(define_expand "divsf3"
24996
- [(set (match_operand:SF 0 "gpc_reg_operand" "")
24997
- (div:SF (match_operand:SF 1 "gpc_reg_operand" "")
24998
- (match_operand:SF 2 "gpc_reg_operand" "")))]
24999
- "TARGET_HARD_FLOAT && TARGET_SINGLE_FLOAT && !TARGET_SIMPLE_FPU"
25001
+(define_insn "sqrt<mode>2"
25002
+ [(set (match_operand:SFDF 0 "gpc_reg_operand" "=<Ff>,<Fv>")
25003
+ (sqrt:SFDF (match_operand:SFDF 1 "gpc_reg_operand" "<Ff>,<Fv>")))]
25004
+ "TARGET_<MODE>_FPR && !TARGET_SIMPLE_FPU
25005
+ && (TARGET_PPC_GPOPT || (<MODE>mode == SFmode && TARGET_XILINX_FPU))"
25007
+ fsqrt<Ftrad> %0,%1
25008
+ xssqrt<Fvsx> %x0,%x1"
25009
+ [(set_attr "type" "<Fs>sqrt")
25010
+ (set_attr "fp_type" "fp_sqrt_<Fs>")])
25013
- [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
25014
- (div:SF (match_operand:SF 1 "gpc_reg_operand" "f")
25015
- (match_operand:SF 2 "gpc_reg_operand" "f")))]
25016
- "TARGET_HARD_FLOAT && TARGET_FPRS
25017
- && TARGET_SINGLE_FLOAT && !TARGET_SIMPLE_FPU"
25019
- [(set_attr "type" "sdiv")])
25020
+;; Floating point reciprocal approximation
25021
+(define_insn "fre<Fs>"
25022
+ [(set (match_operand:SFDF 0 "gpc_reg_operand" "=<Ff>,<Fv>")
25023
+ (unspec:SFDF [(match_operand:SFDF 1 "gpc_reg_operand" "<Ff>,<Fv>")]
25028
+ xsre<Fvsx> %x0,%x1"
25029
+ [(set_attr "type" "fp")])
25031
-(define_insn "fres"
25032
- [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
25033
- (unspec:SF [(match_operand:SF 1 "gpc_reg_operand" "f")] UNSPEC_FRES))]
25036
+(define_insn "*rsqrt<mode>2"
25037
+ [(set (match_operand:SFDF 0 "gpc_reg_operand" "=<Ff>,<Fv>")
25038
+ (unspec:SFDF [(match_operand:SFDF 1 "gpc_reg_operand" "<Ff>,<Fv>")]
25040
+ "RS6000_RECIP_HAVE_RSQRTE_P (<MODE>mode)"
25042
+ frsqrte<Ftrad> %0,%1
25043
+ xsrsqrte<Fvsx> %x0,%x1"
25044
[(set_attr "type" "fp")])
25046
-; builtin fmaf support
25047
-(define_insn "*fmasf4_fpr"
25048
- [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
25049
- (fma:SF (match_operand:SF 1 "gpc_reg_operand" "f")
25050
- (match_operand:SF 2 "gpc_reg_operand" "f")
25051
- (match_operand:SF 3 "gpc_reg_operand" "f")))]
25052
- "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT"
25053
- "fmadds %0,%1,%2,%3"
25054
- [(set_attr "type" "fp")
25055
- (set_attr "fp_type" "fp_maddsub_s")])
25056
+;; Floating point comparisons
25057
+(define_insn "*cmp<mode>_fpr"
25058
+ [(set (match_operand:CCFP 0 "cc_reg_operand" "=y,y")
25059
+ (compare:CCFP (match_operand:SFDF 1 "gpc_reg_operand" "<Ff>,<Fv>")
25060
+ (match_operand:SFDF 2 "gpc_reg_operand" "<Ff>,<Fv>")))]
25061
+ "TARGET_<MODE>_FPR"
25064
+ xscmpudp %0,%x1,%x2"
25065
+ [(set_attr "type" "fpcompare")])
25067
-(define_insn "*fmssf4_fpr"
25068
- [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
25069
- (fma:SF (match_operand:SF 1 "gpc_reg_operand" "f")
25070
- (match_operand:SF 2 "gpc_reg_operand" "f")
25071
- (neg:SF (match_operand:SF 3 "gpc_reg_operand" "f"))))]
25072
- "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT"
25073
- "fmsubs %0,%1,%2,%3"
25074
- [(set_attr "type" "fp")
25075
- (set_attr "fp_type" "fp_maddsub_s")])
25076
+;; Floating point conversions
25077
+(define_expand "extendsfdf2"
25078
+ [(set (match_operand:DF 0 "gpc_reg_operand" "")
25079
+ (float_extend:DF (match_operand:SF 1 "reg_or_none500mem_operand" "")))]
25080
+ "TARGET_HARD_FLOAT && ((TARGET_FPRS && TARGET_DOUBLE_FLOAT) || TARGET_E500_DOUBLE)"
25083
-(define_insn "*nfmasf4_fpr"
25084
- [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
25085
- (neg:SF (fma:SF (match_operand:SF 1 "gpc_reg_operand" "f")
25086
- (match_operand:SF 2 "gpc_reg_operand" "f")
25087
- (match_operand:SF 3 "gpc_reg_operand" "f"))))]
25088
- "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT"
25089
- "fnmadds %0,%1,%2,%3"
25090
- [(set_attr "type" "fp")
25091
- (set_attr "fp_type" "fp_maddsub_s")])
25092
+(define_insn_and_split "*extendsfdf2_fpr"
25093
+ [(set (match_operand:DF 0 "gpc_reg_operand" "=d,?d,d,ws,?ws,wv")
25094
+ (float_extend:DF (match_operand:SF 1 "reg_or_mem_operand" "0,f,m,0,wy,Z")))]
25095
+ "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT"
25101
+ xxlor %x0,%x1,%x1
25103
+ "&& reload_completed && REG_P (operands[1]) && REGNO (operands[0]) == REGNO (operands[1])"
25106
+ emit_note (NOTE_INSN_DELETED);
25109
+ [(set_attr_alternative "type"
25110
+ [(const_string "fp")
25111
+ (const_string "fp")
25113
+ (match_test "update_indexed_address_mem (operands[1], VOIDmode)")
25114
+ (const_string "fpload_ux")
25116
+ (match_test "update_address_mem (operands[1], VOIDmode)")
25117
+ (const_string "fpload_u")
25118
+ (const_string "fpload")))
25119
+ (const_string "fp")
25120
+ (const_string "vecsimple")
25122
+ (match_test "update_indexed_address_mem (operands[1], VOIDmode)")
25123
+ (const_string "fpload_ux")
25125
+ (match_test "update_address_mem (operands[1], VOIDmode)")
25126
+ (const_string "fpload_u")
25127
+ (const_string "fpload")))])])
25129
-(define_insn "*nfmssf4_fpr"
25130
- [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
25131
- (neg:SF (fma:SF (match_operand:SF 1 "gpc_reg_operand" "f")
25132
- (match_operand:SF 2 "gpc_reg_operand" "f")
25133
- (neg:SF (match_operand:SF 3 "gpc_reg_operand" "f")))))]
25134
- "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT"
25135
- "fnmsubs %0,%1,%2,%3"
25136
- [(set_attr "type" "fp")
25137
- (set_attr "fp_type" "fp_maddsub_s")])
25139
-(define_expand "sqrtsf2"
25140
+(define_expand "truncdfsf2"
25141
[(set (match_operand:SF 0 "gpc_reg_operand" "")
25142
- (sqrt:SF (match_operand:SF 1 "gpc_reg_operand" "")))]
25143
- "(TARGET_PPC_GPOPT || TARGET_XILINX_FPU)
25144
- && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT
25145
- && !TARGET_SIMPLE_FPU"
25146
+ (float_truncate:SF (match_operand:DF 1 "gpc_reg_operand" "")))]
25147
+ "TARGET_HARD_FLOAT && ((TARGET_FPRS && TARGET_DOUBLE_FLOAT) || TARGET_E500_DOUBLE)"
25151
+(define_insn "*truncdfsf2_fpr"
25152
[(set (match_operand:SF 0 "gpc_reg_operand" "=f")
25153
- (sqrt:SF (match_operand:SF 1 "gpc_reg_operand" "f")))]
25154
- "(TARGET_PPC_GPOPT || TARGET_XILINX_FPU) && TARGET_HARD_FLOAT
25155
- && TARGET_FPRS && TARGET_SINGLE_FLOAT && !TARGET_SIMPLE_FPU"
25157
- [(set_attr "type" "ssqrt")])
25159
-(define_insn "*rsqrtsf_internal1"
25160
- [(set (match_operand:SF 0 "gpc_reg_operand" "=f")
25161
- (unspec:SF [(match_operand:SF 1 "gpc_reg_operand" "f")]
25163
- "TARGET_FRSQRTES"
25165
+ (float_truncate:SF (match_operand:DF 1 "gpc_reg_operand" "d")))]
25166
+ "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT"
25168
[(set_attr "type" "fp")])
25170
;; This expander is here to avoid FLOAT_WORDS_BIGENDIAN tests in
25171
@@ -4742,39 +5012,84 @@
25172
;; Use an unspec rather providing an if-then-else in RTL, to prevent the
25173
;; compiler from optimizing -0.0
25174
(define_insn "copysign<mode>3_fcpsgn"
25175
- [(set (match_operand:SFDF 0 "gpc_reg_operand" "=<rreg2>")
25176
- (unspec:SFDF [(match_operand:SFDF 1 "gpc_reg_operand" "<rreg2>")
25177
- (match_operand:SFDF 2 "gpc_reg_operand" "<rreg2>")]
25178
+ [(set (match_operand:SFDF 0 "gpc_reg_operand" "=<Ff>,<Fv>")
25179
+ (unspec:SFDF [(match_operand:SFDF 1 "gpc_reg_operand" "<Ff>,<Fv>")
25180
+ (match_operand:SFDF 2 "gpc_reg_operand" "<Ff>,<Fv>")]
25182
- "TARGET_CMPB && !VECTOR_UNIT_VSX_P (<MODE>mode)"
25183
- "fcpsgn %0,%2,%1"
25184
+ "TARGET_<MODE>_FPR && TARGET_CMPB"
25187
+ xscpsgn<Fvsx> %x0,%x2,%x1"
25188
[(set_attr "type" "fp")])
25190
;; For MIN, MAX, and conditional move, we use DEFINE_EXPAND's that involve a
25191
;; fsel instruction and some auxiliary computations. Then we just have a
25192
;; single DEFINE_INSN for fsel and the define_splits to make them if made by
25194
-(define_expand "smaxsf3"
25195
- [(set (match_operand:SF 0 "gpc_reg_operand" "")
25196
- (if_then_else:SF (ge (match_operand:SF 1 "gpc_reg_operand" "")
25197
- (match_operand:SF 2 "gpc_reg_operand" ""))
25200
- "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS
25201
- && TARGET_SINGLE_FLOAT && !flag_trapping_math"
25202
- "{ rs6000_emit_minmax (operands[0], SMAX, operands[1], operands[2]); DONE;}")
25203
+;; For MIN, MAX on non-VSX machines, and conditional move all of the time, we
25204
+;; use DEFINE_EXPAND's that involve a fsel instruction and some auxiliary
25205
+;; computations. Then we just have a single DEFINE_INSN for fsel and the
25206
+;; define_splits to make them if made by combine. On VSX machines we have the
25207
+;; min/max instructions.
25209
+;; On VSX, we only check for TARGET_VSX instead of checking for a vsx/p8 vector
25210
+;; to allow either DF/SF to use only traditional registers.
25212
-(define_expand "sminsf3"
25213
- [(set (match_operand:SF 0 "gpc_reg_operand" "")
25214
- (if_then_else:SF (ge (match_operand:SF 1 "gpc_reg_operand" "")
25215
- (match_operand:SF 2 "gpc_reg_operand" ""))
25218
- "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS
25219
- && TARGET_SINGLE_FLOAT && !flag_trapping_math"
25220
- "{ rs6000_emit_minmax (operands[0], SMIN, operands[1], operands[2]); DONE;}")
25221
+(define_expand "smax<mode>3"
25222
+ [(set (match_operand:SFDF 0 "gpc_reg_operand" "")
25223
+ (if_then_else:SFDF (ge (match_operand:SFDF 1 "gpc_reg_operand" "")
25224
+ (match_operand:SFDF 2 "gpc_reg_operand" ""))
25227
+ "TARGET_<MODE>_FPR && TARGET_PPC_GFXOPT && !flag_trapping_math"
25229
+ rs6000_emit_minmax (operands[0], SMAX, operands[1], operands[2]);
25233
+(define_insn "*smax<mode>3_vsx"
25234
+ [(set (match_operand:SFDF 0 "gpc_reg_operand" "=<Ff>,<Fv>")
25235
+ (smax:SFDF (match_operand:SFDF 1 "gpc_reg_operand" "%<Ff>,<Fv>")
25236
+ (match_operand:SFDF 2 "gpc_reg_operand" "<Ff>,<Fv>")))]
25237
+ "TARGET_<MODE>_FPR && TARGET_VSX"
25238
+ "xsmaxdp %x0,%x1,%x2"
25239
+ [(set_attr "type" "fp")])
25241
+(define_expand "smin<mode>3"
25242
+ [(set (match_operand:SFDF 0 "gpc_reg_operand" "")
25243
+ (if_then_else:SFDF (ge (match_operand:SFDF 1 "gpc_reg_operand" "")
25244
+ (match_operand:SFDF 2 "gpc_reg_operand" ""))
25247
+ "TARGET_<MODE>_FPR && TARGET_PPC_GFXOPT && !flag_trapping_math"
25249
+ rs6000_emit_minmax (operands[0], SMIN, operands[1], operands[2]);
25253
+(define_insn "*smin<mode>3_vsx"
25254
+ [(set (match_operand:SFDF 0 "gpc_reg_operand" "=<Ff>,<Fv>")
25255
+ (smin:SFDF (match_operand:SFDF 1 "gpc_reg_operand" "%<Ff>,<Fv>")
25256
+ (match_operand:SFDF 2 "gpc_reg_operand" "<Ff>,<Fv>")))]
25257
+ "TARGET_<MODE>_FPR && TARGET_VSX"
25258
+ "xsmindp %x0,%x1,%x2"
25259
+ [(set_attr "type" "fp")])
25262
+ [(set (match_operand:SFDF 0 "gpc_reg_operand" "")
25263
+ (match_operator:SFDF 3 "min_max_operator"
25264
+ [(match_operand:SFDF 1 "gpc_reg_operand" "")
25265
+ (match_operand:SFDF 2 "gpc_reg_operand" "")]))]
25266
+ "TARGET_<MODE>_FPR && TARGET_PPC_GFXOPT && !flag_trapping_math
25270
+ rs6000_emit_minmax (operands[0], GET_CODE (operands[3]), operands[1],
25276
[(set (match_operand:SF 0 "gpc_reg_operand" "")
25277
(match_operator:SF 3 "min_max_operator"
25278
[(match_operand:SF 1 "gpc_reg_operand" "")
25279
@@ -4904,208 +5219,9 @@
25281
[(set_attr "type" "fp")])
25283
-(define_expand "negdf2"
25284
- [(set (match_operand:DF 0 "gpc_reg_operand" "")
25285
- (neg:DF (match_operand:DF 1 "gpc_reg_operand" "")))]
25286
- "TARGET_HARD_FLOAT && ((TARGET_FPRS && TARGET_DOUBLE_FLOAT) || TARGET_E500_DOUBLE)"
25289
-(define_insn "*negdf2_fpr"
25290
- [(set (match_operand:DF 0 "gpc_reg_operand" "=d")
25291
- (neg:DF (match_operand:DF 1 "gpc_reg_operand" "d")))]
25292
- "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
25293
- && !VECTOR_UNIT_VSX_P (DFmode)"
25295
- [(set_attr "type" "fp")])
25297
-(define_expand "absdf2"
25298
- [(set (match_operand:DF 0 "gpc_reg_operand" "")
25299
- (abs:DF (match_operand:DF 1 "gpc_reg_operand" "")))]
25300
- "TARGET_HARD_FLOAT && ((TARGET_FPRS && TARGET_DOUBLE_FLOAT) || TARGET_E500_DOUBLE)"
25303
-(define_insn "*absdf2_fpr"
25304
- [(set (match_operand:DF 0 "gpc_reg_operand" "=d")
25305
- (abs:DF (match_operand:DF 1 "gpc_reg_operand" "d")))]
25306
- "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
25307
- && !VECTOR_UNIT_VSX_P (DFmode)"
25309
- [(set_attr "type" "fp")])
25311
-(define_insn "*nabsdf2_fpr"
25312
- [(set (match_operand:DF 0 "gpc_reg_operand" "=d")
25313
- (neg:DF (abs:DF (match_operand:DF 1 "gpc_reg_operand" "d"))))]
25314
- "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
25315
- && !VECTOR_UNIT_VSX_P (DFmode)"
25317
- [(set_attr "type" "fp")])
25319
-(define_expand "adddf3"
25320
- [(set (match_operand:DF 0 "gpc_reg_operand" "")
25321
- (plus:DF (match_operand:DF 1 "gpc_reg_operand" "")
25322
- (match_operand:DF 2 "gpc_reg_operand" "")))]
25323
- "TARGET_HARD_FLOAT && ((TARGET_FPRS && TARGET_DOUBLE_FLOAT) || TARGET_E500_DOUBLE)"
25326
-(define_insn "*adddf3_fpr"
25327
- [(set (match_operand:DF 0 "gpc_reg_operand" "=d")
25328
- (plus:DF (match_operand:DF 1 "gpc_reg_operand" "%d")
25329
- (match_operand:DF 2 "gpc_reg_operand" "d")))]
25330
- "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
25331
- && !VECTOR_UNIT_VSX_P (DFmode)"
25333
- [(set_attr "type" "fp")
25334
- (set_attr "fp_type" "fp_addsub_d")])
25336
-(define_expand "subdf3"
25337
- [(set (match_operand:DF 0 "gpc_reg_operand" "")
25338
- (minus:DF (match_operand:DF 1 "gpc_reg_operand" "")
25339
- (match_operand:DF 2 "gpc_reg_operand" "")))]
25340
- "TARGET_HARD_FLOAT && ((TARGET_FPRS && TARGET_DOUBLE_FLOAT) || TARGET_E500_DOUBLE)"
25343
-(define_insn "*subdf3_fpr"
25344
- [(set (match_operand:DF 0 "gpc_reg_operand" "=d")
25345
- (minus:DF (match_operand:DF 1 "gpc_reg_operand" "d")
25346
- (match_operand:DF 2 "gpc_reg_operand" "d")))]
25347
- "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
25348
- && !VECTOR_UNIT_VSX_P (DFmode)"
25350
- [(set_attr "type" "fp")
25351
- (set_attr "fp_type" "fp_addsub_d")])
25353
-(define_expand "muldf3"
25354
- [(set (match_operand:DF 0 "gpc_reg_operand" "")
25355
- (mult:DF (match_operand:DF 1 "gpc_reg_operand" "")
25356
- (match_operand:DF 2 "gpc_reg_operand" "")))]
25357
- "TARGET_HARD_FLOAT && ((TARGET_FPRS && TARGET_DOUBLE_FLOAT) || TARGET_E500_DOUBLE)"
25360
-(define_insn "*muldf3_fpr"
25361
- [(set (match_operand:DF 0 "gpc_reg_operand" "=d")
25362
- (mult:DF (match_operand:DF 1 "gpc_reg_operand" "%d")
25363
- (match_operand:DF 2 "gpc_reg_operand" "d")))]
25364
- "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
25365
- && !VECTOR_UNIT_VSX_P (DFmode)"
25367
- [(set_attr "type" "dmul")
25368
- (set_attr "fp_type" "fp_mul_d")])
25370
-(define_expand "divdf3"
25371
- [(set (match_operand:DF 0 "gpc_reg_operand" "")
25372
- (div:DF (match_operand:DF 1 "gpc_reg_operand" "")
25373
- (match_operand:DF 2 "gpc_reg_operand" "")))]
25374
- "TARGET_HARD_FLOAT
25375
- && ((TARGET_FPRS && TARGET_DOUBLE_FLOAT) || TARGET_E500_DOUBLE)
25376
- && !TARGET_SIMPLE_FPU"
25379
-(define_insn "*divdf3_fpr"
25380
- [(set (match_operand:DF 0 "gpc_reg_operand" "=d")
25381
- (div:DF (match_operand:DF 1 "gpc_reg_operand" "d")
25382
- (match_operand:DF 2 "gpc_reg_operand" "d")))]
25383
- "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT && !TARGET_SIMPLE_FPU
25384
- && !VECTOR_UNIT_VSX_P (DFmode)"
25386
- [(set_attr "type" "ddiv")])
25388
-(define_insn "*fred_fpr"
25389
- [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
25390
- (unspec:DF [(match_operand:DF 1 "gpc_reg_operand" "f")] UNSPEC_FRES))]
25391
- "TARGET_FRE && !VECTOR_UNIT_VSX_P (DFmode)"
25393
- [(set_attr "type" "fp")])
25395
-(define_insn "*rsqrtdf_internal1"
25396
- [(set (match_operand:DF 0 "gpc_reg_operand" "=d")
25397
- (unspec:DF [(match_operand:DF 1 "gpc_reg_operand" "d")]
25399
- "TARGET_FRSQRTE && !VECTOR_UNIT_VSX_P (DFmode)"
25401
- [(set_attr "type" "fp")])
25403
-; builtin fma support
25404
-(define_insn "*fmadf4_fpr"
25405
- [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
25406
- (fma:DF (match_operand:DF 1 "gpc_reg_operand" "f")
25407
- (match_operand:DF 2 "gpc_reg_operand" "f")
25408
- (match_operand:DF 3 "gpc_reg_operand" "f")))]
25409
- "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
25410
- && VECTOR_UNIT_NONE_P (DFmode)"
25411
- "fmadd %0,%1,%2,%3"
25412
- [(set_attr "type" "fp")
25413
- (set_attr "fp_type" "fp_maddsub_d")])
25415
-(define_insn "*fmsdf4_fpr"
25416
- [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
25417
- (fma:DF (match_operand:DF 1 "gpc_reg_operand" "f")
25418
- (match_operand:DF 2 "gpc_reg_operand" "f")
25419
- (neg:DF (match_operand:DF 3 "gpc_reg_operand" "f"))))]
25420
- "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
25421
- && VECTOR_UNIT_NONE_P (DFmode)"
25422
- "fmsub %0,%1,%2,%3"
25423
- [(set_attr "type" "fp")
25424
- (set_attr "fp_type" "fp_maddsub_d")])
25426
-(define_insn "*nfmadf4_fpr"
25427
- [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
25428
- (neg:DF (fma:DF (match_operand:DF 1 "gpc_reg_operand" "f")
25429
- (match_operand:DF 2 "gpc_reg_operand" "f")
25430
- (match_operand:DF 3 "gpc_reg_operand" "f"))))]
25431
- "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
25432
- && VECTOR_UNIT_NONE_P (DFmode)"
25433
- "fnmadd %0,%1,%2,%3"
25434
- [(set_attr "type" "fp")
25435
- (set_attr "fp_type" "fp_maddsub_d")])
25437
-(define_insn "*nfmsdf4_fpr"
25438
- [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
25439
- (neg:DF (fma:DF (match_operand:DF 1 "gpc_reg_operand" "f")
25440
- (match_operand:DF 2 "gpc_reg_operand" "f")
25441
- (neg:DF (match_operand:DF 3 "gpc_reg_operand" "f")))))]
25442
- "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
25443
- && VECTOR_UNIT_NONE_P (DFmode)"
25444
- "fnmsub %0,%1,%2,%3"
25445
- [(set_attr "type" "fp")
25446
- (set_attr "fp_type" "fp_maddsub_d")])
25448
-(define_expand "sqrtdf2"
25449
- [(set (match_operand:DF 0 "gpc_reg_operand" "")
25450
- (sqrt:DF (match_operand:DF 1 "gpc_reg_operand" "")))]
25451
- "TARGET_PPC_GPOPT && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT"
25454
-(define_insn "*sqrtdf2_fpr"
25455
- [(set (match_operand:DF 0 "gpc_reg_operand" "=d")
25456
- (sqrt:DF (match_operand:DF 1 "gpc_reg_operand" "d")))]
25457
- "TARGET_PPC_GPOPT && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
25458
- && !VECTOR_UNIT_VSX_P (DFmode)"
25460
- [(set_attr "type" "dsqrt")])
25462
;; The conditional move instructions allow us to perform max and min
25463
;; operations even when
25465
-(define_expand "smaxdf3"
25466
- [(set (match_operand:DF 0 "gpc_reg_operand" "")
25467
- (if_then_else:DF (ge (match_operand:DF 1 "gpc_reg_operand" "")
25468
- (match_operand:DF 2 "gpc_reg_operand" ""))
25471
- "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
25472
- && !flag_trapping_math"
25473
- "{ rs6000_emit_minmax (operands[0], SMAX, operands[1], operands[2]); DONE;}")
25475
-(define_expand "smindf3"
25476
- [(set (match_operand:DF 0 "gpc_reg_operand" "")
25477
- (if_then_else:DF (ge (match_operand:DF 1 "gpc_reg_operand" "")
25478
- (match_operand:DF 2 "gpc_reg_operand" ""))
25481
- "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
25482
- && !flag_trapping_math"
25483
- "{ rs6000_emit_minmax (operands[0], SMIN, operands[1], operands[2]); DONE;}")
25486
[(set (match_operand:DF 0 "gpc_reg_operand" "")
25487
(match_operator:DF 3 "min_max_operator"
25488
@@ -5159,12 +5275,15 @@
25489
; We don't define lfiwax/lfiwzx with the normal definition, because we
25490
; don't want to support putting SImode in FPR registers.
25491
(define_insn "lfiwax"
25492
- [(set (match_operand:DI 0 "gpc_reg_operand" "=d")
25493
- (unspec:DI [(match_operand:SI 1 "indexed_or_indirect_operand" "Z")]
25494
+ [(set (match_operand:DI 0 "gpc_reg_operand" "=d,wm,!wm")
25495
+ (unspec:DI [(match_operand:SI 1 "reg_or_indexed_operand" "Z,Z,r")]
25497
"TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT && TARGET_LFIWAX"
25499
- [(set_attr "type" "fpload")])
25504
+ [(set_attr "type" "fpload,fpload,mffgpr")])
25506
; This split must be run before register allocation because it allocates the
25507
; memory slot that is needed to move values to/from the FPR. We don't allocate
25508
@@ -5186,7 +5305,8 @@
25509
rtx src = operands[1];
25512
- if (!MEM_P (src) && TARGET_MFPGPR && TARGET_POWERPC64)
25513
+ if (!MEM_P (src) && TARGET_POWERPC64
25514
+ && (TARGET_MFPGPR || TARGET_DIRECT_MOVE))
25515
tmp = convert_to_mode (DImode, src, false);
25518
@@ -5235,12 +5355,15 @@
25519
(set_attr "type" "fpload")])
25521
(define_insn "lfiwzx"
25522
- [(set (match_operand:DI 0 "gpc_reg_operand" "=d")
25523
- (unspec:DI [(match_operand:SI 1 "indexed_or_indirect_operand" "Z")]
25524
+ [(set (match_operand:DI 0 "gpc_reg_operand" "=d,wm,!wm")
25525
+ (unspec:DI [(match_operand:SI 1 "reg_or_indexed_operand" "Z,Z,r")]
25527
"TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT && TARGET_LFIWZX"
25529
- [(set_attr "type" "fpload")])
25534
+ [(set_attr "type" "fpload,fpload,mftgpr")])
25536
(define_insn_and_split "floatunssi<mode>2_lfiwzx"
25537
[(set (match_operand:SFDF 0 "gpc_reg_operand" "=d")
25538
@@ -5257,7 +5380,8 @@
25539
rtx src = operands[1];
25542
- if (!MEM_P (src) && TARGET_MFPGPR && TARGET_POWERPC64)
25543
+ if (!MEM_P (src) && TARGET_POWERPC64
25544
+ && (TARGET_MFPGPR || TARGET_DIRECT_MOVE))
25545
tmp = convert_to_mode (DImode, src, true);
25548
@@ -5548,7 +5672,7 @@
25549
emit_insn (gen_stfiwx (dest, tmp));
25552
- else if (TARGET_MFPGPR && TARGET_POWERPC64)
25553
+ else if (TARGET_POWERPC64 && (TARGET_MFPGPR || TARGET_DIRECT_MOVE))
25555
dest = gen_lowpart (DImode, dest);
25556
emit_move_insn (dest, tmp);
25557
@@ -5642,7 +5766,7 @@
25558
emit_insn (gen_stfiwx (dest, tmp));
25561
- else if (TARGET_MFPGPR && TARGET_POWERPC64)
25562
+ else if (TARGET_POWERPC64 && (TARGET_MFPGPR || TARGET_DIRECT_MOVE))
25564
dest = gen_lowpart (DImode, dest);
25565
emit_move_insn (dest, tmp);
25566
@@ -5781,66 +5905,52 @@
25567
[(set (match_operand:DI 0 "gpc_reg_operand" "=d")
25568
(unspec:DI [(match_operand:SFDF 1 "gpc_reg_operand" "<rreg2>")]
25570
- "TARGET_FPRND && TARGET_HARD_FLOAT && TARGET_FPRS && <TARGET_FLOAT>"
25571
+ "TARGET_<MODE>_FPR && TARGET_FPRND"
25573
[(set_attr "type" "fp")])
25575
-(define_expand "btrunc<mode>2"
25576
- [(set (match_operand:SFDF 0 "gpc_reg_operand" "")
25577
- (unspec:SFDF [(match_operand:SFDF 1 "gpc_reg_operand" "")]
25578
+(define_insn "btrunc<mode>2"
25579
+ [(set (match_operand:SFDF 0 "gpc_reg_operand" "=<Ff>,<Fv>")
25580
+ (unspec:SFDF [(match_operand:SFDF 1 "gpc_reg_operand" "<Ff>,<Fv>")]
25582
- "TARGET_FPRND && TARGET_HARD_FLOAT && TARGET_FPRS && <TARGET_FLOAT>"
25584
+ "TARGET_<MODE>_FPR && TARGET_FPRND"
25588
+ [(set_attr "type" "fp")
25589
+ (set_attr "fp_type" "fp_addsub_<Fs>")])
25591
-(define_insn "*btrunc<mode>2_fpr"
25592
- [(set (match_operand:SFDF 0 "gpc_reg_operand" "=<rreg2>")
25593
- (unspec:SFDF [(match_operand:SFDF 1 "gpc_reg_operand" "<rreg2>")]
25595
- "TARGET_FPRND && TARGET_HARD_FLOAT && TARGET_FPRS && <TARGET_FLOAT>
25596
- && !VECTOR_UNIT_VSX_P (<MODE>mode)"
25598
- [(set_attr "type" "fp")])
25600
-(define_expand "ceil<mode>2"
25601
- [(set (match_operand:SFDF 0 "gpc_reg_operand" "")
25602
- (unspec:SFDF [(match_operand:SFDF 1 "gpc_reg_operand" "")]
25603
+(define_insn "ceil<mode>2"
25604
+ [(set (match_operand:SFDF 0 "gpc_reg_operand" "=<Ff>,<Fv>")
25605
+ (unspec:SFDF [(match_operand:SFDF 1 "gpc_reg_operand" "<Ff>,<Fv>")]
25607
- "TARGET_FPRND && TARGET_HARD_FLOAT && TARGET_FPRS && <TARGET_FLOAT>"
25609
+ "TARGET_<MODE>_FPR && TARGET_FPRND"
25613
+ [(set_attr "type" "fp")
25614
+ (set_attr "fp_type" "fp_addsub_<Fs>")])
25616
-(define_insn "*ceil<mode>2_fpr"
25617
- [(set (match_operand:SFDF 0 "gpc_reg_operand" "=<rreg2>")
25618
- (unspec:SFDF [(match_operand:SFDF 1 "gpc_reg_operand" "<rreg2>")]
25620
- "TARGET_FPRND && TARGET_HARD_FLOAT && TARGET_FPRS && <TARGET_FLOAT>
25621
- && !VECTOR_UNIT_VSX_P (<MODE>mode)"
25623
- [(set_attr "type" "fp")])
25625
-(define_expand "floor<mode>2"
25626
- [(set (match_operand:SFDF 0 "gpc_reg_operand" "")
25627
- (unspec:SFDF [(match_operand:SFDF 1 "gpc_reg_operand" "")]
25628
+(define_insn "floor<mode>2"
25629
+ [(set (match_operand:SFDF 0 "gpc_reg_operand" "=<Ff>,<Fv>")
25630
+ (unspec:SFDF [(match_operand:SFDF 1 "gpc_reg_operand" "<Ff>,<Fv>")]
25632
- "TARGET_FPRND && TARGET_HARD_FLOAT && TARGET_FPRS && <TARGET_FLOAT>"
25634
+ "TARGET_<MODE>_FPR && TARGET_FPRND"
25638
+ [(set_attr "type" "fp")
25639
+ (set_attr "fp_type" "fp_addsub_<Fs>")])
25641
-(define_insn "*floor<mode>2_fpr"
25642
- [(set (match_operand:SFDF 0 "gpc_reg_operand" "=<rreg2>")
25643
- (unspec:SFDF [(match_operand:SFDF 1 "gpc_reg_operand" "<rreg2>")]
25645
- "TARGET_FPRND && TARGET_HARD_FLOAT && TARGET_FPRS && <TARGET_FLOAT>
25646
- && !VECTOR_UNIT_VSX_P (<MODE>mode)"
25648
- [(set_attr "type" "fp")])
25650
;; No VSX equivalent to frin
25651
(define_insn "round<mode>2"
25652
[(set (match_operand:SFDF 0 "gpc_reg_operand" "=<rreg2>")
25653
(unspec:SFDF [(match_operand:SFDF 1 "gpc_reg_operand" "<rreg2>")]
25655
- "TARGET_FPRND && TARGET_HARD_FLOAT && TARGET_FPRS && <TARGET_FLOAT>"
25656
+ "TARGET_<MODE>_FPR && TARGET_FPRND"
25658
- [(set_attr "type" "fp")])
25659
+ [(set_attr "type" "fp")
25660
+ (set_attr "fp_type" "fp_addsub_<Fs>")])
25662
; An UNSPEC is used so we don't have to support SImode in FP registers.
25663
(define_insn "stfiwx"
25664
@@ -7195,10 +7305,19 @@
25666
[(set (match_operand:DI 0 "gpc_reg_operand" "")
25667
(and:DI (match_operand:DI 1 "gpc_reg_operand" "")
25668
- (match_operand:DI 2 "and64_2_operand" "")))
25669
+ (match_operand:DI 2 "reg_or_cint_operand" "")))
25670
(clobber (match_scratch:CC 3 ""))])]
25671
- "TARGET_POWERPC64"
25675
+ if (!TARGET_POWERPC64)
25677
+ rtx cc = gen_rtx_SCRATCH (CCmode);
25678
+ rs6000_split_logical (operands, AND, false, false, false, cc);
25681
+ else if (!and64_2_operand (operands[2], DImode))
25682
+ operands[2] = force_reg (DImode, operands[2]);
25685
(define_insn "anddi3_mc"
25686
[(set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,r,r,r")
25687
@@ -7379,12 +7498,18 @@
25688
(define_expand "iordi3"
25689
[(set (match_operand:DI 0 "gpc_reg_operand" "")
25690
(ior:DI (match_operand:DI 1 "gpc_reg_operand" "")
25691
- (match_operand:DI 2 "reg_or_logical_cint_operand" "")))]
25692
- "TARGET_POWERPC64"
25694
+ (match_operand:DI 2 "reg_or_cint_operand" "")))]
25697
- if (non_logical_cint_operand (operands[2], DImode))
25698
+ if (!TARGET_POWERPC64)
25700
+ rs6000_split_logical (operands, IOR, false, false, false, NULL_RTX);
25703
+ else if (!reg_or_logical_cint_operand (operands[2], DImode))
25704
+ operands[2] = force_reg (DImode, operands[2]);
25705
+ else if (non_logical_cint_operand (operands[2], DImode))
25707
HOST_WIDE_INT value;
25708
rtx tmp = ((!can_create_pseudo_p ()
25709
|| rtx_equal_p (operands[0], operands[1]))
25710
@@ -7408,15 +7533,21 @@
25711
emit_insn (gen_iordi3 (operands[0], tmp, GEN_INT (value & 0xffff)));
25717
(define_expand "xordi3"
25718
[(set (match_operand:DI 0 "gpc_reg_operand" "")
25719
(xor:DI (match_operand:DI 1 "gpc_reg_operand" "")
25720
- (match_operand:DI 2 "reg_or_logical_cint_operand" "")))]
25721
- "TARGET_POWERPC64"
25723
+ (match_operand:DI 2 "reg_or_cint_operand" "")))]
25726
+ if (!TARGET_POWERPC64)
25728
+ rs6000_split_logical (operands, XOR, false, false, false, NULL_RTX);
25731
+ else if (!reg_or_logical_cint_operand (operands[2], DImode))
25732
+ operands[2] = force_reg (DImode, operands[2]);
25733
if (non_logical_cint_operand (operands[2], DImode))
25735
HOST_WIDE_INT value;
25736
@@ -7442,7 +7573,7 @@
25737
emit_insn (gen_xordi3 (operands[0], tmp, GEN_INT (value & 0xffff)));
25743
(define_insn "*booldi3_internal1"
25744
[(set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r")
25745
@@ -7678,7 +7809,385 @@
25746
(compare:CC (match_dup 0)
25751
+(define_insn "*eqv<mode>3"
25752
+ [(set (match_operand:GPR 0 "gpc_reg_operand" "=r")
25754
+ (xor:GPR (match_operand:GPR 1 "gpc_reg_operand" "r")
25755
+ (match_operand:GPR 2 "gpc_reg_operand" "r"))))]
25758
+ [(set_attr "type" "integer")
25759
+ (set_attr "length" "4")])
25762
+;; 128-bit logical operations expanders
25764
+(define_expand "and<mode>3"
25765
+ [(parallel [(set (match_operand:BOOL_128 0 "vlogical_operand" "")
25767
+ (match_operand:BOOL_128 1 "vlogical_operand" "")
25768
+ (match_operand:BOOL_128 2 "vlogical_operand" "")))
25769
+ (clobber (match_scratch:CC 3 ""))])]
25773
+(define_expand "ior<mode>3"
25774
+ [(set (match_operand:BOOL_128 0 "vlogical_operand" "")
25775
+ (ior:BOOL_128 (match_operand:BOOL_128 1 "vlogical_operand" "")
25776
+ (match_operand:BOOL_128 2 "vlogical_operand" "")))]
25780
+(define_expand "xor<mode>3"
25781
+ [(set (match_operand:BOOL_128 0 "vlogical_operand" "")
25782
+ (xor:BOOL_128 (match_operand:BOOL_128 1 "vlogical_operand" "")
25783
+ (match_operand:BOOL_128 2 "vlogical_operand" "")))]
25787
+(define_expand "one_cmpl<mode>2"
25788
+ [(set (match_operand:BOOL_128 0 "vlogical_operand" "")
25789
+ (not:BOOL_128 (match_operand:BOOL_128 1 "vlogical_operand" "")))]
25793
+(define_expand "nor<mode>3"
25794
+ [(set (match_operand:BOOL_128 0 "vlogical_operand" "")
25796
+ (not:BOOL_128 (match_operand:BOOL_128 1 "vlogical_operand" ""))
25797
+ (not:BOOL_128 (match_operand:BOOL_128 2 "vlogical_operand" ""))))]
25801
+(define_expand "andc<mode>3"
25802
+ [(set (match_operand:BOOL_128 0 "vlogical_operand" "")
25804
+ (not:BOOL_128 (match_operand:BOOL_128 2 "vlogical_operand" ""))
25805
+ (match_operand:BOOL_128 1 "vlogical_operand" "")))]
25809
+;; Power8 vector logical instructions.
25810
+(define_expand "eqv<mode>3"
25811
+ [(set (match_operand:BOOL_128 0 "vlogical_operand" "")
25813
+ (xor:BOOL_128 (match_operand:BOOL_128 1 "vlogical_operand" "")
25814
+ (match_operand:BOOL_128 2 "vlogical_operand" ""))))]
25815
+ "<MODE>mode == TImode || <MODE>mode == PTImode || TARGET_P8_VECTOR"
25818
+;; Rewrite nand into canonical form
25819
+(define_expand "nand<mode>3"
25820
+ [(set (match_operand:BOOL_128 0 "vlogical_operand" "")
25822
+ (not:BOOL_128 (match_operand:BOOL_128 1 "vlogical_operand" ""))
25823
+ (not:BOOL_128 (match_operand:BOOL_128 2 "vlogical_operand" ""))))]
25824
+ "<MODE>mode == TImode || <MODE>mode == PTImode || TARGET_P8_VECTOR"
25827
+;; The canonical form is to have the negated element first, so we need to
25828
+;; reverse arguments.
25829
+(define_expand "orc<mode>3"
25830
+ [(set (match_operand:BOOL_128 0 "vlogical_operand" "")
25832
+ (not:BOOL_128 (match_operand:BOOL_128 2 "vlogical_operand" ""))
25833
+ (match_operand:BOOL_128 1 "vlogical_operand" "")))]
25834
+ "<MODE>mode == TImode || <MODE>mode == PTImode || TARGET_P8_VECTOR"
25837
+;; 128-bit logical operations insns and split operations
25838
+(define_insn_and_split "*and<mode>3_internal"
25839
+ [(set (match_operand:BOOL_128 0 "vlogical_operand" "=<BOOL_REGS_OUTPUT>")
25841
+ (match_operand:BOOL_128 1 "vlogical_operand" "%<BOOL_REGS_OP1>")
25842
+ (match_operand:BOOL_128 2 "vlogical_operand" "<BOOL_REGS_OP2>")))
25843
+ (clobber (match_scratch:CC 3 "<BOOL_REGS_AND_CR0>"))]
25846
+ if (TARGET_VSX && vsx_register_operand (operands[0], <MODE>mode))
25847
+ return "xxland %x0,%x1,%x2";
25849
+ if (TARGET_ALTIVEC && altivec_register_operand (operands[0], <MODE>mode))
25850
+ return "vand %0,%1,%2";
25854
+ "reload_completed && int_reg_operand (operands[0], <MODE>mode)"
25857
+ rs6000_split_logical (operands, AND, false, false, false, operands[3]);
25860
+ [(set (attr "type")
25862
+ (match_test "vsx_register_operand (operands[0], <MODE>mode)")
25863
+ (const_string "vecsimple")
25864
+ (const_string "integer")))
25865
+ (set (attr "length")
25867
+ (match_test "vsx_register_operand (operands[0], <MODE>mode)")
25868
+ (const_string "4")
25870
+ (match_test "TARGET_POWERPC64")
25871
+ (const_string "8")
25872
+ (const_string "16"))))])
25874
+;; 128-bit IOR/XOR
25875
+(define_insn_and_split "*bool<mode>3_internal"
25876
+ [(set (match_operand:BOOL_128 0 "vlogical_operand" "=<BOOL_REGS_OUTPUT>")
25877
+ (match_operator:BOOL_128 3 "boolean_or_operator"
25878
+ [(match_operand:BOOL_128 1 "vlogical_operand" "%<BOOL_REGS_OP1>")
25879
+ (match_operand:BOOL_128 2 "vlogical_operand" "<BOOL_REGS_OP2>")]))]
25882
+ if (TARGET_VSX && vsx_register_operand (operands[0], <MODE>mode))
25883
+ return "xxl%q3 %x0,%x1,%x2";
25885
+ if (TARGET_ALTIVEC && altivec_register_operand (operands[0], <MODE>mode))
25886
+ return "v%q3 %0,%1,%2";
25890
+ "reload_completed && int_reg_operand (operands[0], <MODE>mode)"
25893
+ rs6000_split_logical (operands, GET_CODE (operands[3]), false, false, false,
25897
+ [(set (attr "type")
25899
+ (match_test "vsx_register_operand (operands[0], <MODE>mode)")
25900
+ (const_string "vecsimple")
25901
+ (const_string "integer")))
25902
+ (set (attr "length")
25904
+ (match_test "vsx_register_operand (operands[0], <MODE>mode)")
25905
+ (const_string "4")
25907
+ (match_test "TARGET_POWERPC64")
25908
+ (const_string "8")
25909
+ (const_string "16"))))])
25911
+;; 128-bit ANDC/ORC
25912
+(define_insn_and_split "*boolc<mode>3_internal1"
25913
+ [(set (match_operand:BOOL_128 0 "vlogical_operand" "=<BOOL_REGS_OUTPUT>")
25914
+ (match_operator:BOOL_128 3 "boolean_operator"
25916
+ (match_operand:BOOL_128 2 "vlogical_operand" "<BOOL_REGS_OP1>"))
25917
+ (match_operand:BOOL_128 1 "vlogical_operand" "<BOOL_REGS_OP2>")]))]
25918
+ "TARGET_P8_VECTOR || (GET_CODE (operands[3]) == AND)"
25920
+ if (TARGET_VSX && vsx_register_operand (operands[0], <MODE>mode))
25921
+ return "xxl%q3 %x0,%x1,%x2";
25923
+ if (TARGET_ALTIVEC && altivec_register_operand (operands[0], <MODE>mode))
25924
+ return "v%q3 %0,%1,%2";
25928
+ "(TARGET_P8_VECTOR || (GET_CODE (operands[3]) == AND))
25929
+ && reload_completed && int_reg_operand (operands[0], <MODE>mode)"
25932
+ rs6000_split_logical (operands, GET_CODE (operands[3]), false, true, false,
25936
+ [(set (attr "type")
25938
+ (match_test "vsx_register_operand (operands[0], <MODE>mode)")
25939
+ (const_string "vecsimple")
25940
+ (const_string "integer")))
25941
+ (set (attr "length")
25943
+ (match_test "vsx_register_operand (operands[0], <MODE>mode)")
25944
+ (const_string "4")
25946
+ (match_test "TARGET_POWERPC64")
25947
+ (const_string "8")
25948
+ (const_string "16"))))])
25950
+(define_insn_and_split "*boolc<mode>3_internal2"
25951
+ [(set (match_operand:TI2 0 "int_reg_operand" "=&r,r,r")
25952
+ (match_operator:TI2 3 "boolean_operator"
25954
+ (match_operand:TI2 1 "int_reg_operand" "r,0,r"))
25955
+ (match_operand:TI2 2 "int_reg_operand" "r,r,0")]))]
25956
+ "!TARGET_P8_VECTOR && (GET_CODE (operands[3]) != AND)"
25958
+ "reload_completed && !TARGET_P8_VECTOR && (GET_CODE (operands[3]) != AND)"
25961
+ rs6000_split_logical (operands, GET_CODE (operands[3]), false, true, false,
25965
+ [(set_attr "type" "integer")
25966
+ (set (attr "length")
25968
+ (match_test "TARGET_POWERPC64")
25969
+ (const_string "8")
25970
+ (const_string "16")))])
25972
+;; 128-bit NAND/NOR
25973
+(define_insn_and_split "*boolcc<mode>3_internal1"
25974
+ [(set (match_operand:BOOL_128 0 "vlogical_operand" "=<BOOL_REGS_OUTPUT>")
25975
+ (match_operator:BOOL_128 3 "boolean_operator"
25977
+ (match_operand:BOOL_128 1 "vlogical_operand" "<BOOL_REGS_OP1>"))
25979
+ (match_operand:BOOL_128 2 "vlogical_operand" "<BOOL_REGS_OP2>"))]))]
25980
+ "TARGET_P8_VECTOR || (GET_CODE (operands[3]) == AND)"
25982
+ if (TARGET_VSX && vsx_register_operand (operands[0], <MODE>mode))
25983
+ return "xxl%q3 %x0,%x1,%x2";
25985
+ if (TARGET_ALTIVEC && altivec_register_operand (operands[0], <MODE>mode))
25986
+ return "v%q3 %0,%1,%2";
25990
+ "(TARGET_P8_VECTOR || (GET_CODE (operands[3]) == AND))
25991
+ && reload_completed && int_reg_operand (operands[0], <MODE>mode)"
25994
+ rs6000_split_logical (operands, GET_CODE (operands[3]), false, true, true,
25998
+ [(set (attr "type")
26000
+ (match_test "vsx_register_operand (operands[0], <MODE>mode)")
26001
+ (const_string "vecsimple")
26002
+ (const_string "integer")))
26003
+ (set (attr "length")
26005
+ (match_test "vsx_register_operand (operands[0], <MODE>mode)")
26006
+ (const_string "4")
26008
+ (match_test "TARGET_POWERPC64")
26009
+ (const_string "8")
26010
+ (const_string "16"))))])
26012
+(define_insn_and_split "*boolcc<mode>3_internal2"
26013
+ [(set (match_operand:TI2 0 "int_reg_operand" "=&r,r,r")
26014
+ (match_operator:TI2 3 "boolean_operator"
26016
+ (match_operand:TI2 1 "int_reg_operand" "r,0,r"))
26018
+ (match_operand:TI2 2 "int_reg_operand" "r,r,0"))]))]
26019
+ "!TARGET_P8_VECTOR && (GET_CODE (operands[3]) != AND)"
26021
+ "reload_completed && !TARGET_P8_VECTOR && (GET_CODE (operands[3]) != AND)"
26024
+ rs6000_split_logical (operands, GET_CODE (operands[3]), false, true, true,
26028
+ [(set_attr "type" "integer")
26029
+ (set (attr "length")
26031
+ (match_test "TARGET_POWERPC64")
26032
+ (const_string "8")
26033
+ (const_string "16")))])
26037
+(define_insn_and_split "*eqv<mode>3_internal1"
26038
+ [(set (match_operand:BOOL_128 0 "vlogical_operand" "=<BOOL_REGS_OUTPUT>")
26041
+ (match_operand:BOOL_128 1 "vlogical_operand" "<BOOL_REGS_OP1>")
26042
+ (match_operand:BOOL_128 2 "vlogical_operand" "<BOOL_REGS_OP2>"))))]
26043
+ "TARGET_P8_VECTOR"
26045
+ if (vsx_register_operand (operands[0], <MODE>mode))
26046
+ return "xxleqv %x0,%x1,%x2";
26050
+ "TARGET_P8_VECTOR && reload_completed
26051
+ && int_reg_operand (operands[0], <MODE>mode)"
26054
+ rs6000_split_logical (operands, XOR, true, false, false, NULL_RTX);
26057
+ [(set (attr "type")
26059
+ (match_test "vsx_register_operand (operands[0], <MODE>mode)")
26060
+ (const_string "vecsimple")
26061
+ (const_string "integer")))
26062
+ (set (attr "length")
26064
+ (match_test "vsx_register_operand (operands[0], <MODE>mode)")
26065
+ (const_string "4")
26067
+ (match_test "TARGET_POWERPC64")
26068
+ (const_string "8")
26069
+ (const_string "16"))))])
26071
+(define_insn_and_split "*eqv<mode>3_internal2"
26072
+ [(set (match_operand:TI2 0 "int_reg_operand" "=&r,r,r")
26075
+ (match_operand:TI2 1 "int_reg_operand" "r,0,r")
26076
+ (match_operand:TI2 2 "int_reg_operand" "r,r,0"))))]
26077
+ "!TARGET_P8_VECTOR"
26079
+ "reload_completed && !TARGET_P8_VECTOR"
26082
+ rs6000_split_logical (operands, XOR, true, false, false, NULL_RTX);
26085
+ [(set_attr "type" "integer")
26086
+ (set (attr "length")
26088
+ (match_test "TARGET_POWERPC64")
26089
+ (const_string "8")
26090
+ (const_string "16")))])
26092
+;; 128-bit one's complement
26093
+(define_insn_and_split "*one_cmpl<mode>3_internal"
26094
+ [(set (match_operand:BOOL_128 0 "vlogical_operand" "=<BOOL_REGS_OUTPUT>")
26096
+ (match_operand:BOOL_128 1 "vlogical_operand" "<BOOL_REGS_UNARY>")))]
26099
+ if (TARGET_VSX && vsx_register_operand (operands[0], <MODE>mode))
26100
+ return "xxlnor %x0,%x1,%x1";
26102
+ if (TARGET_ALTIVEC && altivec_register_operand (operands[0], <MODE>mode))
26103
+ return "vnor %0,%1,%1";
26107
+ "reload_completed && int_reg_operand (operands[0], <MODE>mode)"
26110
+ rs6000_split_logical (operands, NOT, false, false, false, NULL_RTX);
26113
+ [(set (attr "type")
26115
+ (match_test "vsx_register_operand (operands[0], <MODE>mode)")
26116
+ (const_string "vecsimple")
26117
+ (const_string "integer")))
26118
+ (set (attr "length")
26120
+ (match_test "vsx_register_operand (operands[0], <MODE>mode)")
26121
+ (const_string "4")
26123
+ (match_test "TARGET_POWERPC64")
26124
+ (const_string "8")
26125
+ (const_string "16"))))])
26128
;; Now define ways of moving data around.
26130
;; Set up a register with a value from the GOT table
26131
@@ -7765,7 +8274,31 @@
26135
- [(set_attr "type" "*,*,load,store,*,*,*,mfjmpr,mtjmpr,*,*")
26136
+ [(set_attr_alternative "type"
26137
+ [(const_string "*")
26138
+ (const_string "*")
26140
+ (match_test "update_indexed_address_mem (operands[1], VOIDmode)")
26141
+ (const_string "load_ux")
26143
+ (match_test "update_address_mem (operands[1], VOIDmode)")
26144
+ (const_string "load_u")
26145
+ (const_string "load")))
26147
+ (match_test "update_indexed_address_mem (operands[0], VOIDmode)")
26148
+ (const_string "store_ux")
26150
+ (match_test "update_address_mem (operands[0], VOIDmode)")
26151
+ (const_string "store_u")
26152
+ (const_string "store")))
26153
+ (const_string "*")
26154
+ (const_string "*")
26155
+ (const_string "*")
26156
+ (const_string "mfjmpr")
26157
+ (const_string "mtjmpr")
26158
+ (const_string "*")
26159
+ (const_string "*")])
26161
(set_attr "length" "4,4,4,4,4,4,8,4,4,4,4")])
26163
(define_insn "*movsi_internal1_single"
26164
@@ -7787,7 +8320,44 @@
26168
- [(set_attr "type" "*,*,load,store,*,*,*,mfjmpr,mtjmpr,*,*,*,*")
26169
+ [(set_attr_alternative "type"
26170
+ [(const_string "*")
26171
+ (const_string "*")
26173
+ (match_test "update_indexed_address_mem (operands[1], VOIDmode)")
26174
+ (const_string "load_ux")
26176
+ (match_test "update_address_mem (operands[1], VOIDmode)")
26177
+ (const_string "load_u")
26178
+ (const_string "load")))
26180
+ (match_test "update_indexed_address_mem (operands[0], VOIDmode)")
26181
+ (const_string "store_ux")
26183
+ (match_test "update_address_mem (operands[0], VOIDmode)")
26184
+ (const_string "store_u")
26185
+ (const_string "store")))
26186
+ (const_string "*")
26187
+ (const_string "*")
26188
+ (const_string "*")
26189
+ (const_string "mfjmpr")
26190
+ (const_string "mtjmpr")
26191
+ (const_string "*")
26192
+ (const_string "*")
26194
+ (match_test "update_indexed_address_mem (operands[0], VOIDmode)")
26195
+ (const_string "fpstore_ux")
26197
+ (match_test "update_address_mem (operands[0], VOIDmode)")
26198
+ (const_string "fpstore_u")
26199
+ (const_string "fpstore")))
26201
+ (match_test "update_indexed_address_mem (operands[1], VOIDmode)")
26202
+ (const_string "fpload_ux")
26204
+ (match_test "update_address_mem (operands[1], VOIDmode)")
26205
+ (const_string "fpload_u")
26206
+ (const_string "fpload")))])
26207
(set_attr "length" "4,4,4,4,4,4,8,4,4,4,4,4,4")])
26209
;; Split a load of a large constant into the appropriate two-insn
26210
@@ -7822,7 +8392,7 @@
26214
- [(set_attr "type" "cmp,compare,cmp")
26215
+ [(set_attr "type" "cmp,fast_compare,cmp")
26216
(set_attr "length" "4,4,8")])
26219
@@ -7850,7 +8420,26 @@
26223
- [(set_attr "type" "*,load,store,*,mfjmpr,mtjmpr,*")])
26224
+ [(set_attr_alternative "type"
26225
+ [(const_string "*")
26227
+ (match_test "update_indexed_address_mem (operands[1], VOIDmode)")
26228
+ (const_string "load_ux")
26230
+ (match_test "update_address_mem (operands[1], VOIDmode)")
26231
+ (const_string "load_u")
26232
+ (const_string "load")))
26234
+ (match_test "update_indexed_address_mem (operands[0], VOIDmode)")
26235
+ (const_string "store_ux")
26237
+ (match_test "update_address_mem (operands[0], VOIDmode)")
26238
+ (const_string "store_u")
26239
+ (const_string "store")))
26240
+ (const_string "*")
26241
+ (const_string "mfjmpr")
26242
+ (const_string "mtjmpr")
26243
+ (const_string "*")])])
26245
(define_expand "mov<mode>"
26246
[(set (match_operand:INT 0 "general_operand" "")
26247
@@ -7871,7 +8460,26 @@
26251
- [(set_attr "type" "*,load,store,*,mfjmpr,mtjmpr,*")])
26252
+ [(set_attr_alternative "type"
26253
+ [(const_string "*")
26255
+ (match_test "update_indexed_address_mem (operands[1], VOIDmode)")
26256
+ (const_string "load_ux")
26258
+ (match_test "update_address_mem (operands[1], VOIDmode)")
26259
+ (const_string "load_u")
26260
+ (const_string "load")))
26262
+ (match_test "update_indexed_address_mem (operands[0], VOIDmode)")
26263
+ (const_string "store_ux")
26265
+ (match_test "update_address_mem (operands[0], VOIDmode)")
26266
+ (const_string "store_u")
26267
+ (const_string "store")))
26268
+ (const_string "*")
26269
+ (const_string "mfjmpr")
26270
+ (const_string "mtjmpr")
26271
+ (const_string "*")])])
26273
;; Here is how to move condition codes around. When we store CC data in
26274
;; an integer register or memory, we store just the high-order 4 bits.
26275
@@ -7899,7 +8507,7 @@
26281
[(set (attr "type")
26282
(cond [(eq_attr "alternative" "0,3")
26283
(const_string "cr_logical")
26284
@@ -7912,9 +8520,23 @@
26285
(eq_attr "alternative" "9")
26286
(const_string "mtjmpr")
26287
(eq_attr "alternative" "10")
26288
- (const_string "load")
26290
+ (match_test "update_indexed_address_mem (operands[1],
26292
+ (const_string "load_ux")
26294
+ (match_test "update_address_mem (operands[1], VOIDmode)")
26295
+ (const_string "load_u")
26296
+ (const_string "load")))
26297
(eq_attr "alternative" "11")
26298
- (const_string "store")
26300
+ (match_test "update_indexed_address_mem (operands[0],
26302
+ (const_string "store_ux")
26304
+ (match_test "update_address_mem (operands[0], VOIDmode)")
26305
+ (const_string "store_u")
26306
+ (const_string "store")))
26307
(match_test "TARGET_MFCRF")
26308
(const_string "mfcrf")
26310
@@ -7926,15 +8548,17 @@
26311
;; can produce floating-point values in fixed-point registers. Unless the
26312
;; value is a simple constant or already in memory, we deal with this by
26313
;; allocating memory and copying the value explicitly via that memory location.
26314
-(define_expand "movsf"
26315
- [(set (match_operand:SF 0 "nonimmediate_operand" "")
26316
- (match_operand:SF 1 "any_operand" ""))]
26318
- "{ rs6000_emit_move (operands[0], operands[1], SFmode); DONE; }")
26320
+;; Move 32-bit binary/decimal floating point
26321
+(define_expand "mov<mode>"
26322
+ [(set (match_operand:FMOVE32 0 "nonimmediate_operand" "")
26323
+ (match_operand:FMOVE32 1 "any_operand" ""))]
26325
+ "{ rs6000_emit_move (operands[0], operands[1], <MODE>mode); DONE; }")
26328
- [(set (match_operand:SF 0 "gpc_reg_operand" "")
26329
- (match_operand:SF 1 "const_double_operand" ""))]
26330
+ [(set (match_operand:FMOVE32 0 "gpc_reg_operand" "")
26331
+ (match_operand:FMOVE32 1 "const_double_operand" ""))]
26333
&& ((GET_CODE (operands[0]) == REG && REGNO (operands[0]) <= 31)
26334
|| (GET_CODE (operands[0]) == SUBREG
26335
@@ -7947,42 +8571,89 @@
26336
REAL_VALUE_TYPE rv;
26338
REAL_VALUE_FROM_CONST_DOUBLE (rv, operands[1]);
26339
- REAL_VALUE_TO_TARGET_SINGLE (rv, l);
26340
+ <real_value_to_target> (rv, l);
26342
if (! TARGET_POWERPC64)
26343
- operands[2] = operand_subword (operands[0], 0, 0, SFmode);
26344
+ operands[2] = operand_subword (operands[0], 0, 0, <MODE>mode);
26346
operands[2] = gen_lowpart (SImode, operands[0]);
26348
operands[3] = gen_int_mode (l, SImode);
26351
-(define_insn "*movsf_hardfloat"
26352
- [(set (match_operand:SF 0 "nonimmediate_operand" "=!r,!r,m,f,f,m,*c*l,!r,*h,!r,!r")
26353
- (match_operand:SF 1 "input_operand" "r,m,r,f,m,f,r,h,0,G,Fn"))]
26354
- "(gpc_reg_operand (operands[0], SFmode)
26355
- || gpc_reg_operand (operands[1], SFmode))
26356
+(define_insn "mov<mode>_hardfloat"
26357
+ [(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")
26358
+ (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"))]
26359
+ "(gpc_reg_operand (operands[0], <MODE>mode)
26360
+ || gpc_reg_operand (operands[1], <MODE>mode))
26361
&& (TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT)"
26369
+ xxlor %x0,%x1,%x1
26370
+ xxlxor %x0,%x0,%x0
26382
- [(set_attr "type" "*,load,store,fp,fpload,fpstore,mtjmpr,mfjmpr,*,*,*")
26383
- (set_attr "length" "4,4,4,4,4,4,4,4,4,4,8")])
26384
+ [(set_attr_alternative "type"
26385
+ [(const_string "*")
26387
+ (match_test "update_indexed_address_mem (operands[1], VOIDmode)")
26388
+ (const_string "load_ux")
26390
+ (match_test "update_address_mem (operands[1], VOIDmode)")
26391
+ (const_string "load_u")
26392
+ (const_string "load")))
26394
+ (match_test "update_indexed_address_mem (operands[0], VOIDmode)")
26395
+ (const_string "store_ux")
26397
+ (match_test "update_address_mem (operands[0], VOIDmode)")
26398
+ (const_string "store_u")
26399
+ (const_string "store")))
26400
+ (const_string "fp")
26401
+ (const_string "vecsimple")
26402
+ (const_string "vecsimple")
26404
+ (match_test "update_indexed_address_mem (operands[1], VOIDmode)")
26405
+ (const_string "fpload_ux")
26407
+ (match_test "update_address_mem (operands[1], VOIDmode)")
26408
+ (const_string "fpload_u")
26409
+ (const_string "fpload")))
26411
+ (match_test "update_indexed_address_mem (operands[0], VOIDmode)")
26412
+ (const_string "fpstore_ux")
26414
+ (match_test "update_address_mem (operands[0], VOIDmode)")
26415
+ (const_string "fpstore_u")
26416
+ (const_string "fpstore")))
26417
+ (const_string "fpload")
26418
+ (const_string "fpstore")
26419
+ (const_string "mftgpr")
26420
+ (const_string "mffgpr")
26421
+ (const_string "mtjmpr")
26422
+ (const_string "mfjmpr")
26423
+ (const_string "*")
26424
+ (const_string "*")
26425
+ (const_string "*")])
26426
+ (set_attr "length" "4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,8")])
26428
-(define_insn "*movsf_softfloat"
26429
- [(set (match_operand:SF 0 "nonimmediate_operand" "=r,cl,r,r,m,r,r,r,r,*h")
26430
- (match_operand:SF 1 "input_operand" "r,r,h,m,r,I,L,G,Fn,0"))]
26431
- "(gpc_reg_operand (operands[0], SFmode)
26432
- || gpc_reg_operand (operands[1], SFmode))
26433
+(define_insn "*mov<mode>_softfloat"
26434
+ [(set (match_operand:FMOVE32 0 "nonimmediate_operand" "=r,cl,r,r,m,r,r,r,r,*h")
26435
+ (match_operand:FMOVE32 1 "input_operand" "r,r,h,m,r,I,L,G,Fn,0"))]
26436
+ "(gpc_reg_operand (operands[0], <MODE>mode)
26437
+ || gpc_reg_operand (operands[1], <MODE>mode))
26438
&& (TARGET_SOFT_FLOAT || !TARGET_FPRS)"
26441
@@ -7995,19 +8666,42 @@
26445
- [(set_attr "type" "*,mtjmpr,mfjmpr,load,store,*,*,*,*,*")
26446
+ [(set_attr_alternative "type"
26447
+ [(const_string "*")
26448
+ (const_string "mtjmpr")
26449
+ (const_string "mfjmpr")
26451
+ (match_test "update_indexed_address_mem (operands[1], VOIDmode)")
26452
+ (const_string "load_ux")
26454
+ (match_test "update_address_mem (operands[1], VOIDmode)")
26455
+ (const_string "load_u")
26456
+ (const_string "load")))
26458
+ (match_test "update_indexed_address_mem (operands[0], VOIDmode)")
26459
+ (const_string "store_ux")
26461
+ (match_test "update_address_mem (operands[0], VOIDmode)")
26462
+ (const_string "store_u")
26463
+ (const_string "store")))
26464
+ (const_string "*")
26465
+ (const_string "*")
26466
+ (const_string "*")
26467
+ (const_string "*")
26468
+ (const_string "*")])
26469
(set_attr "length" "4,4,4,4,4,4,4,4,8,4")])
26472
-(define_expand "movdf"
26473
- [(set (match_operand:DF 0 "nonimmediate_operand" "")
26474
- (match_operand:DF 1 "any_operand" ""))]
26475
+;; Move 64-bit binary/decimal floating point
26476
+(define_expand "mov<mode>"
26477
+ [(set (match_operand:FMOVE64 0 "nonimmediate_operand" "")
26478
+ (match_operand:FMOVE64 1 "any_operand" ""))]
26480
- "{ rs6000_emit_move (operands[0], operands[1], DFmode); DONE; }")
26481
+ "{ rs6000_emit_move (operands[0], operands[1], <MODE>mode); DONE; }")
26484
- [(set (match_operand:DF 0 "gpc_reg_operand" "")
26485
- (match_operand:DF 1 "const_int_operand" ""))]
26486
+ [(set (match_operand:FMOVE64 0 "gpc_reg_operand" "")
26487
+ (match_operand:FMOVE64 1 "const_int_operand" ""))]
26488
"! TARGET_POWERPC64 && reload_completed
26489
&& ((GET_CODE (operands[0]) == REG && REGNO (operands[0]) <= 31)
26490
|| (GET_CODE (operands[0]) == SUBREG
26491
@@ -8020,8 +8714,8 @@
26492
int endian = (WORDS_BIG_ENDIAN == 0);
26493
HOST_WIDE_INT value = INTVAL (operands[1]);
26495
- operands[2] = operand_subword (operands[0], endian, 0, DFmode);
26496
- operands[3] = operand_subword (operands[0], 1 - endian, 0, DFmode);
26497
+ operands[2] = operand_subword (operands[0], endian, 0, <MODE>mode);
26498
+ operands[3] = operand_subword (operands[0], 1 - endian, 0, <MODE>mode);
26499
#if HOST_BITS_PER_WIDE_INT == 32
26500
operands[4] = (value & 0x80000000) ? constm1_rtx : const0_rtx;
26502
@@ -8031,8 +8725,8 @@
26506
- [(set (match_operand:DF 0 "gpc_reg_operand" "")
26507
- (match_operand:DF 1 "const_double_operand" ""))]
26508
+ [(set (match_operand:FMOVE64 0 "gpc_reg_operand" "")
26509
+ (match_operand:FMOVE64 1 "const_double_operand" ""))]
26510
"! TARGET_POWERPC64 && reload_completed
26511
&& ((GET_CODE (operands[0]) == REG && REGNO (operands[0]) <= 31)
26512
|| (GET_CODE (operands[0]) == SUBREG
26513
@@ -8047,17 +8741,17 @@
26514
REAL_VALUE_TYPE rv;
26516
REAL_VALUE_FROM_CONST_DOUBLE (rv, operands[1]);
26517
- REAL_VALUE_TO_TARGET_DOUBLE (rv, l);
26518
+ <real_value_to_target> (rv, l);
26520
- operands[2] = operand_subword (operands[0], endian, 0, DFmode);
26521
- operands[3] = operand_subword (operands[0], 1 - endian, 0, DFmode);
26522
+ operands[2] = operand_subword (operands[0], endian, 0, <MODE>mode);
26523
+ operands[3] = operand_subword (operands[0], 1 - endian, 0, <MODE>mode);
26524
operands[4] = gen_int_mode (l[endian], SImode);
26525
operands[5] = gen_int_mode (l[1 - endian], SImode);
26529
- [(set (match_operand:DF 0 "gpc_reg_operand" "")
26530
- (match_operand:DF 1 "const_double_operand" ""))]
26531
+ [(set (match_operand:FMOVE64 0 "gpc_reg_operand" "")
26532
+ (match_operand:FMOVE64 1 "const_double_operand" ""))]
26533
"TARGET_POWERPC64 && reload_completed
26534
&& ((GET_CODE (operands[0]) == REG && REGNO (operands[0]) <= 31)
26535
|| (GET_CODE (operands[0]) == SUBREG
26536
@@ -8074,7 +8768,7 @@
26539
REAL_VALUE_FROM_CONST_DOUBLE (rv, operands[1]);
26540
- REAL_VALUE_TO_TARGET_DOUBLE (rv, l);
26541
+ <real_value_to_target> (rv, l);
26543
operands[2] = gen_lowpart (DImode, operands[0]);
26544
/* HIGHPART is lower memory address when WORDS_BIG_ENDIAN. */
26545
@@ -8099,22 +8793,19 @@
26546
;; since the D-form version of the memory instructions does not need a GPR for
26549
-(define_insn "*movdf_hardfloat32"
26550
- [(set (match_operand:DF 0 "nonimmediate_operand" "=m,d,d,ws,?wa,Z,?Z,ws,?wa,wa,Y,r,!r,!r,!r,!r")
26551
- (match_operand:DF 1 "input_operand" "d,m,d,Z,Z,ws,wa,ws,wa,j,r,Y,r,G,H,F"))]
26552
+(define_insn "*mov<mode>_hardfloat32"
26553
+ [(set (match_operand:FMOVE64 0 "nonimmediate_operand" "=m,d,d,wv,Z,wa,wa,Y,r,!r,!r,!r,!r")
26554
+ (match_operand:FMOVE64 1 "input_operand" "d,m,d,Z,wv,wa,j,r,Y,r,G,H,F"))]
26555
"! TARGET_POWERPC64 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
26556
- && (gpc_reg_operand (operands[0], DFmode)
26557
- || gpc_reg_operand (operands[1], DFmode))"
26558
+ && (gpc_reg_operand (operands[0], <MODE>mode)
26559
+ || gpc_reg_operand (operands[1], <MODE>mode))"
26567
- stxsd%U0x %x1,%y0
26569
- xxlor %x0,%x1,%x1
26573
@@ -8122,115 +8813,140 @@
26577
- [(set_attr "type" "fpstore,fpload,fp,fpload,fpload,fpstore,fpstore,vecsimple,vecsimple,vecsimple,store,load,two,fp,fp,*")
26578
- (set_attr "length" "4,4,4,4,4,4,4,4,4,4,8,8,8,8,12,16")])
26579
+ [(set_attr_alternative "type"
26581
+ (match_test "update_indexed_address_mem (operands[0], VOIDmode)")
26582
+ (const_string "fpstore_ux")
26584
+ (match_test "update_address_mem (operands[0], VOIDmode)")
26585
+ (const_string "fpstore_u")
26586
+ (const_string "fpstore")))
26588
+ (match_test "update_indexed_address_mem (operands[1], VOIDmode)")
26589
+ (const_string "fpload_ux")
26591
+ (match_test "update_address_mem (operands[1], VOIDmode)")
26592
+ (const_string "fpload_u")
26593
+ (const_string "fpload")))
26594
+ (const_string "fp")
26596
+ (match_test "update_indexed_address_mem (operands[1], VOIDmode)")
26597
+ (const_string "fpload_ux")
26598
+ (const_string "fpload"))
26600
+ (match_test "update_indexed_address_mem (operands[0], VOIDmode)")
26601
+ (const_string "fpstore_ux")
26602
+ (const_string "fpstore"))
26603
+ (const_string "vecsimple")
26604
+ (const_string "vecsimple")
26605
+ (const_string "store")
26606
+ (const_string "load")
26607
+ (const_string "two")
26608
+ (const_string "fp")
26609
+ (const_string "fp")
26610
+ (const_string "*")])
26611
+ (set_attr "length" "4,4,4,4,4,4,4,8,8,8,8,12,16")])
26613
-(define_insn "*movdf_softfloat32"
26614
- [(set (match_operand:DF 0 "nonimmediate_operand" "=Y,r,r,r,r,r")
26615
- (match_operand:DF 1 "input_operand" "r,Y,r,G,H,F"))]
26616
+(define_insn "*mov<mode>_softfloat32"
26617
+ [(set (match_operand:FMOVE64 0 "nonimmediate_operand" "=Y,r,r,r,r,r")
26618
+ (match_operand:FMOVE64 1 "input_operand" "r,Y,r,G,H,F"))]
26619
"! TARGET_POWERPC64
26620
&& ((TARGET_FPRS && TARGET_SINGLE_FLOAT)
26621
|| TARGET_SOFT_FLOAT || TARGET_E500_SINGLE)
26622
- && (gpc_reg_operand (operands[0], DFmode)
26623
- || gpc_reg_operand (operands[1], DFmode))"
26624
+ && (gpc_reg_operand (operands[0], <MODE>mode)
26625
+ || gpc_reg_operand (operands[1], <MODE>mode))"
26627
[(set_attr "type" "store,load,two,*,*,*")
26628
(set_attr "length" "8,8,8,8,12,16")])
26630
-;; Reload patterns to support gpr load/store with misaligned mem.
26631
-;; and multiple gpr load/store at offset >= 0xfffc
26632
-(define_expand "reload_<mode>_store"
26633
- [(parallel [(match_operand 0 "memory_operand" "=m")
26634
- (match_operand 1 "gpc_reg_operand" "r")
26635
- (match_operand:GPR 2 "register_operand" "=&b")])]
26638
- rs6000_secondary_reload_gpr (operands[1], operands[0], operands[2], true);
26642
-(define_expand "reload_<mode>_load"
26643
- [(parallel [(match_operand 0 "gpc_reg_operand" "=r")
26644
- (match_operand 1 "memory_operand" "m")
26645
- (match_operand:GPR 2 "register_operand" "=b")])]
26648
- rs6000_secondary_reload_gpr (operands[0], operands[1], operands[2], false);
26652
; ld/std require word-aligned displacements -> 'Y' constraint.
26653
; List Y->r and r->Y before r->r for reload.
26654
-(define_insn "*movdf_hardfloat64_mfpgpr"
26655
- [(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")
26656
- (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"))]
26657
- "TARGET_POWERPC64 && TARGET_MFPGPR && TARGET_HARD_FLOAT && TARGET_FPRS
26658
- && TARGET_DOUBLE_FLOAT
26659
- && (gpc_reg_operand (operands[0], DFmode)
26660
- || gpc_reg_operand (operands[1], DFmode))"
26661
+(define_insn "*mov<mode>_hardfloat64"
26662
+ [(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")
26663
+ (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"))]
26664
+ "TARGET_POWERPC64 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
26665
+ && (gpc_reg_operand (operands[0], <MODE>mode)
26666
+ || gpc_reg_operand (operands[1], <MODE>mode))"
26671
- xxlor %x0,%x1,%x1
26672
- xxlor %x0,%x1,%x1
26675
- stxsd%U0x %x1,%y0
26676
- stxsd%U0x %x1,%y0
26681
+ stxsd%U0x %x1,%y0
26682
+ xxlor %x0,%x1,%x1
26692
- [(set_attr "type" "store,load,*,fp,fp,fpload,fpload,fpstore,fpstore,fpstore,fpload,fp,vecsimple,mtjmpr,mfjmpr,*,*,*,*,mftgpr,mffgpr")
26693
- (set_attr "length" "4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,8,12,16,4,4")])
26695
-; ld/std require word-aligned displacements -> 'Y' constraint.
26696
-; List Y->r and r->Y before r->r for reload.
26697
-(define_insn "*movdf_hardfloat64"
26698
- [(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")
26699
- (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"))]
26700
- "TARGET_POWERPC64 && !TARGET_MFPGPR && TARGET_HARD_FLOAT && TARGET_FPRS
26701
- && TARGET_DOUBLE_FLOAT
26702
- && (gpc_reg_operand (operands[0], DFmode)
26703
- || gpc_reg_operand (operands[1], DFmode))"
26713
- stxsd%U0x %x1,%y0
26714
- stxsd%U0x %x1,%y0
26715
- xxlor %x0,%x1,%x1
26716
- xxlor %x0,%x1,%x1
26717
- xxlxor %x0,%x0,%x0
26724
- [(set_attr "type" "fpstore,fpload,fp,store,load,*,fpload,fpload,fpstore,fpstore,vecsimple,vecsimple,vecsimple,mtjmpr,mfjmpr,*,*,*,*")
26725
- (set_attr "length" "4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,8,12,16")])
26731
+ [(set_attr_alternative "type"
26733
+ (match_test "update_indexed_address_mem (operands[0], VOIDmode)")
26734
+ (const_string "fpstore_ux")
26736
+ (match_test "update_address_mem (operands[0], VOIDmode)")
26737
+ (const_string "fpstore_u")
26738
+ (const_string "fpstore")))
26740
+ (match_test "update_indexed_address_mem (operands[1], VOIDmode)")
26741
+ (const_string "fpload_ux")
26743
+ (match_test "update_address_mem (operands[1], VOIDmode)")
26744
+ (const_string "fpload_u")
26745
+ (const_string "fpload")))
26746
+ (const_string "fp")
26748
+ (match_test "update_indexed_address_mem (operands[1], VOIDmode)")
26749
+ (const_string "fpload_ux")
26750
+ (const_string "fpload"))
26752
+ (match_test "update_indexed_address_mem (operands[0], VOIDmode)")
26753
+ (const_string "fpstore_ux")
26754
+ (const_string "fpstore"))
26755
+ (const_string "vecsimple")
26756
+ (const_string "vecsimple")
26758
+ (match_test "update_indexed_address_mem (operands[0], VOIDmode)")
26759
+ (const_string "store_ux")
26761
+ (match_test "update_address_mem (operands[0], VOIDmode)")
26762
+ (const_string "store_u")
26763
+ (const_string "store")))
26765
+ (match_test "update_indexed_address_mem (operands[1], VOIDmode)")
26766
+ (const_string "load_ux")
26768
+ (match_test "update_address_mem (operands[1], VOIDmode)")
26769
+ (const_string "load_u")
26770
+ (const_string "load")))
26771
+ (const_string "*")
26772
+ (const_string "mtjmpr")
26773
+ (const_string "mfjmpr")
26774
+ (const_string "*")
26775
+ (const_string "*")
26776
+ (const_string "*")
26777
+ (const_string "*")
26778
+ (const_string "mftgpr")
26779
+ (const_string "mffgpr")
26780
+ (const_string "mftgpr")
26781
+ (const_string "mffgpr")])
26782
+ (set_attr "length" "4,4,4,4,4,4,4,4,4,4,4,4,4,8,12,16,4,4,4,4")])
26784
-(define_insn "*movdf_softfloat64"
26785
- [(set (match_operand:DF 0 "nonimmediate_operand" "=Y,r,r,cl,r,r,r,r,*h")
26786
- (match_operand:DF 1 "input_operand" "r,Y,r,r,h,G,H,F,0"))]
26787
+(define_insn "*mov<mode>_softfloat64"
26788
+ [(set (match_operand:FMOVE64 0 "nonimmediate_operand" "=Y,r,r,cl,r,r,r,r,*h")
26789
+ (match_operand:FMOVE64 1 "input_operand" "r,Y,r,r,h,G,H,F,0"))]
26790
"TARGET_POWERPC64 && (TARGET_SOFT_FLOAT || !TARGET_FPRS)
26791
- && (gpc_reg_operand (operands[0], DFmode)
26792
- || gpc_reg_operand (operands[1], DFmode))"
26793
+ && (gpc_reg_operand (operands[0], <MODE>mode)
26794
+ || gpc_reg_operand (operands[1], <MODE>mode))"
26798
@@ -8241,38 +8957,57 @@
26802
- [(set_attr "type" "store,load,*,mtjmpr,mfjmpr,*,*,*,*")
26803
+ [(set_attr_alternative "type"
26805
+ (match_test "update_indexed_address_mem (operands[0], VOIDmode)")
26806
+ (const_string "store_ux")
26808
+ (match_test "update_address_mem (operands[0], VOIDmode)")
26809
+ (const_string "store_u")
26810
+ (const_string "store")))
26812
+ (match_test "update_indexed_address_mem (operands[1], VOIDmode)")
26813
+ (const_string "load_ux")
26815
+ (match_test "update_address_mem (operands[1], VOIDmode)")
26816
+ (const_string "load_u")
26817
+ (const_string "load")))
26818
+ (const_string "*")
26819
+ (const_string "mtjmpr")
26820
+ (const_string "mfjmpr")
26821
+ (const_string "*")
26822
+ (const_string "*")
26823
+ (const_string "*")
26824
+ (const_string "*")])
26825
(set_attr "length" "4,4,4,4,4,8,12,16,4")])
26827
-(define_expand "movtf"
26828
- [(set (match_operand:TF 0 "general_operand" "")
26829
- (match_operand:TF 1 "any_operand" ""))]
26830
- "!TARGET_IEEEQUAD && TARGET_LONG_DOUBLE_128"
26831
- "{ rs6000_emit_move (operands[0], operands[1], TFmode); DONE; }")
26832
+(define_expand "mov<mode>"
26833
+ [(set (match_operand:FMOVE128 0 "general_operand" "")
26834
+ (match_operand:FMOVE128 1 "any_operand" ""))]
26836
+ "{ rs6000_emit_move (operands[0], operands[1], <MODE>mode); DONE; }")
26838
;; It's important to list Y->r and r->Y before r->r because otherwise
26839
;; reload, given m->r, will try to pick r->r and reload it, which
26840
;; doesn't make progress.
26841
-(define_insn_and_split "*movtf_internal"
26842
- [(set (match_operand:TF 0 "nonimmediate_operand" "=m,d,d,Y,r,r")
26843
- (match_operand:TF 1 "input_operand" "d,m,d,r,YGHF,r"))]
26844
- "!TARGET_IEEEQUAD
26845
- && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_LONG_DOUBLE_128
26846
- && (gpc_reg_operand (operands[0], TFmode)
26847
- || gpc_reg_operand (operands[1], TFmode))"
26848
+(define_insn_and_split "*mov<mode>_internal"
26849
+ [(set (match_operand:FMOVE128 0 "nonimmediate_operand" "=m,d,d,Y,r,r")
26850
+ (match_operand:FMOVE128 1 "input_operand" "d,m,d,r,YGHF,r"))]
26851
+ "TARGET_HARD_FLOAT && TARGET_FPRS
26852
+ && (gpc_reg_operand (operands[0], <MODE>mode)
26853
+ || gpc_reg_operand (operands[1], <MODE>mode))"
26855
"&& reload_completed"
26857
{ rs6000_split_multireg_move (operands[0], operands[1]); DONE; }
26858
[(set_attr "length" "8,8,8,20,20,16")])
26860
-(define_insn_and_split "*movtf_softfloat"
26861
- [(set (match_operand:TF 0 "rs6000_nonimmediate_operand" "=Y,r,r")
26862
- (match_operand:TF 1 "input_operand" "r,YGHF,r"))]
26863
- "!TARGET_IEEEQUAD
26864
- && (TARGET_SOFT_FLOAT || !TARGET_FPRS) && TARGET_LONG_DOUBLE_128
26865
- && (gpc_reg_operand (operands[0], TFmode)
26866
- || gpc_reg_operand (operands[1], TFmode))"
26867
+(define_insn_and_split "*mov<mode>_softfloat"
26868
+ [(set (match_operand:FMOVE128 0 "rs6000_nonimmediate_operand" "=Y,r,r")
26869
+ (match_operand:FMOVE128 1 "input_operand" "r,YGHF,r"))]
26870
+ "(TARGET_SOFT_FLOAT || !TARGET_FPRS)
26871
+ && (gpc_reg_operand (operands[0], <MODE>mode)
26872
+ || gpc_reg_operand (operands[1], <MODE>mode))"
26874
"&& reload_completed"
26876
@@ -8557,6 +9292,243 @@
26877
operands[6] = simplify_gen_subreg (DFmode, operands[0], TFmode, lo_word);
26880
+;; Reload helper functions used by rs6000_secondary_reload. The patterns all
26881
+;; must have 3 arguments, and scratch register constraint must be a single
26884
+;; Reload patterns to support gpr load/store with misaligned mem.
26885
+;; and multiple gpr load/store at offset >= 0xfffc
26886
+(define_expand "reload_<mode>_store"
26887
+ [(parallel [(match_operand 0 "memory_operand" "=m")
26888
+ (match_operand 1 "gpc_reg_operand" "r")
26889
+ (match_operand:GPR 2 "register_operand" "=&b")])]
26892
+ rs6000_secondary_reload_gpr (operands[1], operands[0], operands[2], true);
26896
+(define_expand "reload_<mode>_load"
26897
+ [(parallel [(match_operand 0 "gpc_reg_operand" "=r")
26898
+ (match_operand 1 "memory_operand" "m")
26899
+ (match_operand:GPR 2 "register_operand" "=b")])]
26902
+ rs6000_secondary_reload_gpr (operands[0], operands[1], operands[2], false);
26907
+;; Power8 merge instructions to allow direct move to/from floating point
26908
+;; registers in 32-bit mode. We use TF mode to get two registers to move the
26909
+;; individual 32-bit parts across. Subreg doesn't work too well on the TF
26910
+;; value, since it is allocated in reload and not all of the flow information
26911
+;; is setup for it. We have two patterns to do the two moves between gprs and
26912
+;; fprs. There isn't a dependancy between the two, but we could potentially
26913
+;; schedule other instructions between the two instructions. TFmode is
26914
+;; currently limited to traditional FPR registers. If/when this is changed, we
26915
+;; will need to revist %L to make sure it works with VSX registers, or add an
26916
+;; %x version of %L.
26918
+(define_insn "p8_fmrgow_<mode>"
26919
+ [(set (match_operand:FMOVE64X 0 "register_operand" "=d")
26920
+ (unspec:FMOVE64X [(match_operand:TF 1 "register_operand" "d")]
26921
+ UNSPEC_P8V_FMRGOW))]
26922
+ "!TARGET_POWERPC64 && TARGET_DIRECT_MOVE"
26923
+ "fmrgow %0,%1,%L1"
26924
+ [(set_attr "type" "vecperm")])
26926
+(define_insn "p8_mtvsrwz_1"
26927
+ [(set (match_operand:TF 0 "register_operand" "=d")
26928
+ (unspec:TF [(match_operand:SI 1 "register_operand" "r")]
26929
+ UNSPEC_P8V_MTVSRWZ))]
26930
+ "!TARGET_POWERPC64 && TARGET_DIRECT_MOVE"
26932
+ [(set_attr "type" "mftgpr")])
26934
+(define_insn "p8_mtvsrwz_2"
26935
+ [(set (match_operand:TF 0 "register_operand" "+d")
26936
+ (unspec:TF [(match_dup 0)
26937
+ (match_operand:SI 1 "register_operand" "r")]
26938
+ UNSPEC_P8V_MTVSRWZ))]
26939
+ "!TARGET_POWERPC64 && TARGET_DIRECT_MOVE"
26941
+ [(set_attr "type" "mftgpr")])
26943
+(define_insn_and_split "reload_fpr_from_gpr<mode>"
26944
+ [(set (match_operand:FMOVE64X 0 "register_operand" "=ws")
26945
+ (unspec:FMOVE64X [(match_operand:FMOVE64X 1 "register_operand" "r")]
26946
+ UNSPEC_P8V_RELOAD_FROM_GPR))
26947
+ (clobber (match_operand:TF 2 "register_operand" "=d"))]
26948
+ "!TARGET_POWERPC64 && TARGET_DIRECT_MOVE"
26950
+ "&& reload_completed"
26953
+ rtx dest = operands[0];
26954
+ rtx src = operands[1];
26955
+ rtx tmp = operands[2];
26956
+ rtx gpr_hi_reg = gen_highpart (SImode, src);
26957
+ rtx gpr_lo_reg = gen_lowpart (SImode, src);
26959
+ emit_insn (gen_p8_mtvsrwz_1 (tmp, gpr_hi_reg));
26960
+ emit_insn (gen_p8_mtvsrwz_2 (tmp, gpr_lo_reg));
26961
+ emit_insn (gen_p8_fmrgow_<mode> (dest, tmp));
26964
+ [(set_attr "length" "12")
26965
+ (set_attr "type" "three")])
26967
+;; Move 128 bit values from GPRs to VSX registers in 64-bit mode
26968
+(define_insn "p8_mtvsrd_1"
26969
+ [(set (match_operand:TF 0 "register_operand" "=ws")
26970
+ (unspec:TF [(match_operand:DI 1 "register_operand" "r")]
26971
+ UNSPEC_P8V_MTVSRD))]
26972
+ "TARGET_POWERPC64 && TARGET_DIRECT_MOVE"
26974
+ [(set_attr "type" "mftgpr")])
26976
+(define_insn "p8_mtvsrd_2"
26977
+ [(set (match_operand:TF 0 "register_operand" "+ws")
26978
+ (unspec:TF [(match_dup 0)
26979
+ (match_operand:DI 1 "register_operand" "r")]
26980
+ UNSPEC_P8V_MTVSRD))]
26981
+ "TARGET_POWERPC64 && TARGET_DIRECT_MOVE"
26983
+ [(set_attr "type" "mftgpr")])
26985
+(define_insn "p8_xxpermdi_<mode>"
26986
+ [(set (match_operand:FMOVE128_GPR 0 "register_operand" "=wa")
26987
+ (unspec:FMOVE128_GPR [(match_operand:TF 1 "register_operand" "ws")]
26988
+ UNSPEC_P8V_XXPERMDI))]
26989
+ "TARGET_POWERPC64 && TARGET_DIRECT_MOVE"
26990
+ "xxpermdi %x0,%1,%L1,0"
26991
+ [(set_attr "type" "vecperm")])
26993
+(define_insn_and_split "reload_vsx_from_gpr<mode>"
26994
+ [(set (match_operand:FMOVE128_GPR 0 "register_operand" "=wa")
26995
+ (unspec:FMOVE128_GPR
26996
+ [(match_operand:FMOVE128_GPR 1 "register_operand" "r")]
26997
+ UNSPEC_P8V_RELOAD_FROM_GPR))
26998
+ (clobber (match_operand:TF 2 "register_operand" "=ws"))]
26999
+ "TARGET_POWERPC64 && TARGET_DIRECT_MOVE"
27001
+ "&& reload_completed"
27004
+ rtx dest = operands[0];
27005
+ rtx src = operands[1];
27006
+ rtx tmp = operands[2];
27007
+ rtx gpr_hi_reg = gen_highpart (DImode, src);
27008
+ rtx gpr_lo_reg = gen_lowpart (DImode, src);
27010
+ emit_insn (gen_p8_mtvsrd_1 (tmp, gpr_hi_reg));
27011
+ emit_insn (gen_p8_mtvsrd_2 (tmp, gpr_lo_reg));
27012
+ emit_insn (gen_p8_xxpermdi_<mode> (dest, tmp));
27014
+ [(set_attr "length" "12")
27015
+ (set_attr "type" "three")])
27017
+;; Move SFmode to a VSX from a GPR register. Because scalar floating point
27018
+;; type is stored internally as double precision in the VSX registers, we have
27019
+;; to convert it from the vector format.
27021
+(define_insn_and_split "reload_vsx_from_gprsf"
27022
+ [(set (match_operand:SF 0 "register_operand" "=wa")
27023
+ (unspec:SF [(match_operand:SF 1 "register_operand" "r")]
27024
+ UNSPEC_P8V_RELOAD_FROM_GPR))
27025
+ (clobber (match_operand:DI 2 "register_operand" "=r"))]
27026
+ "TARGET_POWERPC64 && TARGET_DIRECT_MOVE && WORDS_BIG_ENDIAN"
27028
+ "&& reload_completed"
27031
+ rtx op0 = operands[0];
27032
+ rtx op1 = operands[1];
27033
+ rtx op2 = operands[2];
27034
+ rtx op0_di = simplify_gen_subreg (DImode, op0, SFmode, 0);
27035
+ rtx op1_di = simplify_gen_subreg (DImode, op1, SFmode, 0);
27037
+ /* Move SF value to upper 32-bits for xscvspdpn. */
27038
+ emit_insn (gen_ashldi3 (op2, op1_di, GEN_INT (32)));
27039
+ emit_move_insn (op0_di, op2);
27040
+ emit_insn (gen_vsx_xscvspdpn_directmove (op0, op0));
27043
+ [(set_attr "length" "8")
27044
+ (set_attr "type" "two")])
27046
+;; Move 128 bit values from VSX registers to GPRs in 64-bit mode by doing a
27047
+;; normal 64-bit move, followed by an xxpermdi to get the bottom 64-bit value,
27048
+;; and then doing a move of that.
27049
+(define_insn "p8_mfvsrd_3_<mode>"
27050
+ [(set (match_operand:DF 0 "register_operand" "=r")
27051
+ (unspec:DF [(match_operand:FMOVE128_GPR 1 "register_operand" "wa")]
27052
+ UNSPEC_P8V_RELOAD_FROM_VSX))]
27053
+ "TARGET_POWERPC64 && TARGET_DIRECT_MOVE && WORDS_BIG_ENDIAN"
27055
+ [(set_attr "type" "mftgpr")])
27057
+(define_insn_and_split "reload_gpr_from_vsx<mode>"
27058
+ [(set (match_operand:FMOVE128_GPR 0 "register_operand" "=r")
27059
+ (unspec:FMOVE128_GPR
27060
+ [(match_operand:FMOVE128_GPR 1 "register_operand" "wa")]
27061
+ UNSPEC_P8V_RELOAD_FROM_VSX))
27062
+ (clobber (match_operand:FMOVE128_GPR 2 "register_operand" "=wa"))]
27063
+ "TARGET_POWERPC64 && TARGET_DIRECT_MOVE && WORDS_BIG_ENDIAN"
27065
+ "&& reload_completed"
27068
+ rtx dest = operands[0];
27069
+ rtx src = operands[1];
27070
+ rtx tmp = operands[2];
27071
+ rtx gpr_hi_reg = gen_highpart (DFmode, dest);
27072
+ rtx gpr_lo_reg = gen_lowpart (DFmode, dest);
27074
+ emit_insn (gen_p8_mfvsrd_3_<mode> (gpr_hi_reg, src));
27075
+ emit_insn (gen_vsx_xxpermdi_<mode> (tmp, src, src, GEN_INT (3)));
27076
+ emit_insn (gen_p8_mfvsrd_3_<mode> (gpr_lo_reg, tmp));
27078
+ [(set_attr "length" "12")
27079
+ (set_attr "type" "three")])
27081
+;; Move SFmode to a GPR from a VSX register. Because scalar floating point
27082
+;; type is stored internally as double precision, we have to convert it to the
27085
+(define_insn_and_split "reload_gpr_from_vsxsf"
27086
+ [(set (match_operand:SF 0 "register_operand" "=r")
27087
+ (unspec:SF [(match_operand:SF 1 "register_operand" "wa")]
27088
+ UNSPEC_P8V_RELOAD_FROM_VSX))
27089
+ (clobber (match_operand:V4SF 2 "register_operand" "=wa"))]
27090
+ "TARGET_POWERPC64 && TARGET_DIRECT_MOVE && WORDS_BIG_ENDIAN"
27092
+ "&& reload_completed"
27095
+ rtx op0 = operands[0];
27096
+ rtx op1 = operands[1];
27097
+ rtx op2 = operands[2];
27098
+ rtx diop0 = simplify_gen_subreg (DImode, op0, SFmode, 0);
27100
+ emit_insn (gen_vsx_xscvdpspn_scalar (op2, op1));
27101
+ emit_insn (gen_p8_mfvsrd_4_disf (diop0, op2));
27102
+ emit_insn (gen_lshrdi3 (diop0, diop0, GEN_INT (32)));
27105
+ [(set_attr "length" "12")
27106
+ (set_attr "type" "three")])
27108
+(define_insn "p8_mfvsrd_4_disf"
27109
+ [(set (match_operand:DI 0 "register_operand" "=r")
27110
+ (unspec:DI [(match_operand:V4SF 1 "register_operand" "wa")]
27111
+ UNSPEC_P8V_RELOAD_FROM_VSX))]
27112
+ "TARGET_POWERPC64 && TARGET_DIRECT_MOVE && WORDS_BIG_ENDIAN"
27114
+ [(set_attr "type" "mftgpr")])
27117
;; Next come the multi-word integer load and store and the load and store
27120
@@ -8565,8 +9537,8 @@
27121
;; Use of fprs is disparaged slightly otherwise reload prefers to reload
27122
;; a gpr into a fpr instead of reloading an invalid 'Y' address
27123
(define_insn "*movdi_internal32"
27124
- [(set (match_operand:DI 0 "rs6000_nonimmediate_operand" "=Y,r,r,?m,?*d,?*d,r,?wa")
27125
- (match_operand:DI 1 "input_operand" "r,Y,r,d,m,d,IJKnGHF,O"))]
27126
+ [(set (match_operand:DI 0 "rs6000_nonimmediate_operand" "=Y,r,r,?m,?*d,?*d,r")
27127
+ (match_operand:DI 1 "input_operand" "r,Y,r,d,m,d,IJKnGHF"))]
27128
"! TARGET_POWERPC64
27129
&& (gpc_reg_operand (operands[0], DImode)
27130
|| gpc_reg_operand (operands[1], DImode))"
27131
@@ -8577,15 +9549,34 @@
27136
- xxlxor %x0,%x0,%x0"
27137
- [(set_attr "type" "store,load,*,fpstore,fpload,fp,*,vecsimple")])
27139
+ [(set_attr_alternative "type"
27140
+ [(const_string "store")
27141
+ (const_string "load")
27142
+ (const_string "*")
27144
+ (match_test "update_indexed_address_mem (operands[0], VOIDmode)")
27145
+ (const_string "fpstore_ux")
27147
+ (match_test "update_address_mem (operands[0], VOIDmode)")
27148
+ (const_string "fpstore_u")
27149
+ (const_string "fpstore")))
27151
+ (match_test "update_indexed_address_mem (operands[1], VOIDmode)")
27152
+ (const_string "fpload_ux")
27154
+ (match_test "update_address_mem (operands[1], VOIDmode)")
27155
+ (const_string "fpload_u")
27156
+ (const_string "fpload")))
27157
+ (const_string "fp")
27158
+ (const_string "*")])])
27161
[(set (match_operand:DI 0 "gpc_reg_operand" "")
27162
(match_operand:DI 1 "const_int_operand" ""))]
27163
"! TARGET_POWERPC64 && reload_completed
27164
- && gpr_or_gpr_p (operands[0], operands[1])"
27165
+ && gpr_or_gpr_p (operands[0], operands[1])
27166
+ && !direct_move_p (operands[0], operands[1])"
27167
[(set (match_dup 2) (match_dup 4))
27168
(set (match_dup 3) (match_dup 1))]
27170
@@ -8607,14 +9598,15 @@
27171
[(set (match_operand:DIFD 0 "rs6000_nonimmediate_operand" "")
27172
(match_operand:DIFD 1 "input_operand" ""))]
27173
"reload_completed && !TARGET_POWERPC64
27174
- && gpr_or_gpr_p (operands[0], operands[1])"
27175
+ && gpr_or_gpr_p (operands[0], operands[1])
27176
+ && !direct_move_p (operands[0], operands[1])"
27178
{ rs6000_split_multireg_move (operands[0], operands[1]); DONE; })
27180
-(define_insn "*movdi_mfpgpr"
27181
- [(set (match_operand:DI 0 "nonimmediate_operand" "=Y,r,r,r,r,r,?m,?*d,?*d,r,*h,*h,r,?*d")
27182
- (match_operand:DI 1 "input_operand" "r,Y,r,I,L,nF,d,m,d,*h,r,0,*d,r"))]
27183
- "TARGET_POWERPC64 && TARGET_MFPGPR && TARGET_HARD_FLOAT && TARGET_FPRS
27184
+(define_insn "*movdi_internal64"
27185
+ [(set (match_operand:DI 0 "nonimmediate_operand" "=Y,r,r,r,r,r,?m,?*d,?*d,r,*h,*h,r,?*wg,r,?*wm")
27186
+ (match_operand:DI 1 "input_operand" "r,Y,r,I,L,nF,d,m,d,*h,r,0,*wg,r,*wm,r"))]
27187
+ "TARGET_POWERPC64
27188
&& (gpc_reg_operand (operands[0], DImode)
27189
|| gpc_reg_operand (operands[1], DImode))"
27191
@@ -8631,33 +9623,52 @@
27196
- [(set_attr "type" "store,load,*,*,*,*,fpstore,fpload,fp,mfjmpr,mtjmpr,*,mftgpr,mffgpr")
27197
- (set_attr "length" "4,4,4,4,4,20,4,4,4,4,4,4,4,4")])
27201
+ [(set_attr_alternative "type"
27203
+ (match_test "update_indexed_address_mem (operands[0], VOIDmode)")
27204
+ (const_string "store_ux")
27206
+ (match_test "update_address_mem (operands[0], VOIDmode)")
27207
+ (const_string "store_u")
27208
+ (const_string "store")))
27210
+ (match_test "update_indexed_address_mem (operands[1], VOIDmode)")
27211
+ (const_string "load_ux")
27213
+ (match_test "update_address_mem (operands[1], VOIDmode)")
27214
+ (const_string "load_u")
27215
+ (const_string "load")))
27216
+ (const_string "*")
27217
+ (const_string "*")
27218
+ (const_string "*")
27219
+ (const_string "*")
27221
+ (match_test "update_indexed_address_mem (operands[0], VOIDmode)")
27222
+ (const_string "fpstore_ux")
27224
+ (match_test "update_address_mem (operands[0], VOIDmode)")
27225
+ (const_string "fpstore_u")
27226
+ (const_string "fpstore")))
27228
+ (match_test "update_indexed_address_mem (operands[1], VOIDmode)")
27229
+ (const_string "fpload_ux")
27231
+ (match_test "update_address_mem (operands[1], VOIDmode)")
27232
+ (const_string "fpload_u")
27233
+ (const_string "fpload")))
27234
+ (const_string "fp")
27235
+ (const_string "mfjmpr")
27236
+ (const_string "mtjmpr")
27237
+ (const_string "*")
27238
+ (const_string "mftgpr")
27239
+ (const_string "mffgpr")
27240
+ (const_string "mftgpr")
27241
+ (const_string "mffgpr")])
27242
+ (set_attr "length" "4,4,4,4,4,20,4,4,4,4,4,4,4,4,4,4")])
27244
-(define_insn "*movdi_internal64"
27245
- [(set (match_operand:DI 0 "nonimmediate_operand" "=Y,r,r,r,r,r,?m,?*d,?*d,r,*h,*h,?wa")
27246
- (match_operand:DI 1 "input_operand" "r,Y,r,I,L,nF,d,m,d,*h,r,0,O"))]
27247
- "TARGET_POWERPC64 && (!TARGET_MFPGPR || !TARGET_HARD_FLOAT || !TARGET_FPRS)
27248
- && (gpc_reg_operand (operands[0], DImode)
27249
- || gpc_reg_operand (operands[1], DImode))"
27263
- xxlxor %x0,%x0,%x0"
27264
- [(set_attr "type" "store,load,*,*,*,*,fpstore,fpload,fp,mfjmpr,mtjmpr,*,vecsimple")
27265
- (set_attr "length" "4,4,4,4,4,20,4,4,4,4,4,4,4")])
27267
;; immediate value valid for a single instruction hiding in a const_double
27269
[(set (match_operand:DI 0 "gpc_reg_operand" "=r")
27270
@@ -8719,14 +9730,16 @@
27274
-;; TImode is similar, except that we usually want to compute the address into
27275
-;; a register and use lsi/stsi (the exception is during reload).
27276
+;; TImode/PTImode is similar, except that we usually want to compute the
27277
+;; address into a register and use lsi/stsi (the exception is during reload).
27279
-(define_insn "*movti_string"
27280
- [(set (match_operand:TI 0 "reg_or_mem_operand" "=Q,Y,????r,????r,????r,r")
27281
- (match_operand:TI 1 "input_operand" "r,r,Q,Y,r,n"))]
27282
+(define_insn "*mov<mode>_string"
27283
+ [(set (match_operand:TI2 0 "reg_or_mem_operand" "=Q,Y,????r,????r,????r,r")
27284
+ (match_operand:TI2 1 "input_operand" "r,r,Q,Y,r,n"))]
27285
"! TARGET_POWERPC64
27286
- && (gpc_reg_operand (operands[0], TImode) || gpc_reg_operand (operands[1], TImode))"
27287
+ && (<MODE>mode != TImode || VECTOR_MEM_NONE_P (TImode))
27288
+ && (gpc_reg_operand (operands[0], <MODE>mode)
27289
+ || gpc_reg_operand (operands[1], <MODE>mode))"
27292
switch (which_alternative)
27293
@@ -8756,27 +9769,32 @@
27294
(const_string "always")
27295
(const_string "conditional")))])
27297
-(define_insn "*movti_ppc64"
27298
- [(set (match_operand:TI 0 "nonimmediate_operand" "=Y,r,r")
27299
- (match_operand:TI 1 "input_operand" "r,Y,r"))]
27300
- "(TARGET_POWERPC64 && (gpc_reg_operand (operands[0], TImode)
27301
- || gpc_reg_operand (operands[1], TImode)))
27302
- && VECTOR_MEM_NONE_P (TImode)"
27304
- [(set_attr "type" "store,load,*")])
27305
+(define_insn "*mov<mode>_ppc64"
27306
+ [(set (match_operand:TI2 0 "nonimmediate_operand" "=wQ,Y,r,r,r,r")
27307
+ (match_operand:TI2 1 "input_operand" "r,r,wQ,Y,r,n"))]
27308
+ "(TARGET_POWERPC64 && VECTOR_MEM_NONE_P (<MODE>mode)
27309
+ && (gpc_reg_operand (operands[0], <MODE>mode)
27310
+ || gpc_reg_operand (operands[1], <MODE>mode)))"
27312
+ return rs6000_output_move_128bit (operands);
27314
+ [(set_attr "type" "store,store,load,load,*,*")
27315
+ (set_attr "length" "8")])
27318
- [(set (match_operand:TI 0 "gpc_reg_operand" "")
27319
- (match_operand:TI 1 "const_double_operand" ""))]
27320
- "TARGET_POWERPC64 && VECTOR_MEM_NONE_P (TImode)"
27321
+ [(set (match_operand:TI2 0 "int_reg_operand" "")
27322
+ (match_operand:TI2 1 "const_double_operand" ""))]
27323
+ "TARGET_POWERPC64
27324
+ && (VECTOR_MEM_NONE_P (<MODE>mode)
27325
+ || (reload_completed && INT_REGNO_P (REGNO (operands[0]))))"
27326
[(set (match_dup 2) (match_dup 4))
27327
(set (match_dup 3) (match_dup 5))]
27330
operands[2] = operand_subword_force (operands[0], WORDS_BIG_ENDIAN == 0,
27333
operands[3] = operand_subword_force (operands[0], WORDS_BIG_ENDIAN != 0,
27336
if (GET_CODE (operands[1]) == CONST_DOUBLE)
27338
operands[4] = GEN_INT (CONST_DOUBLE_HIGH (operands[1]));
27339
@@ -8792,10 +9810,12 @@
27343
- [(set (match_operand:TI 0 "nonimmediate_operand" "")
27344
- (match_operand:TI 1 "input_operand" ""))]
27345
- "reload_completed && VECTOR_MEM_NONE_P (TImode)
27346
- && gpr_or_gpr_p (operands[0], operands[1])"
27347
+ [(set (match_operand:TI2 0 "nonimmediate_operand" "")
27348
+ (match_operand:TI2 1 "input_operand" ""))]
27349
+ "reload_completed
27350
+ && gpr_or_gpr_p (operands[0], operands[1])
27351
+ && !direct_move_p (operands[0], operands[1])
27352
+ && !quad_load_store_p (operands[0], operands[1])"
27354
{ rs6000_split_multireg_move (operands[0], operands[1]); DONE; })
27356
@@ -9651,7 +10671,7 @@
27357
(match_operand:TLSmode 2 "rs6000_tls_symbol_ref" "")]
27359
(clobber (reg:SI LR_REGNO))]
27360
- "HAVE_AS_TLS && DEFAULT_ABI == ABI_AIX"
27361
+ "HAVE_AS_TLS && (DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_ELFv2)"
27363
if (TARGET_CMODEL != CMODEL_SMALL)
27364
return "addis %0,%1,%2@got@tlsgd@ha\;addi %0,%0,%2@got@tlsgd@l\;"
27365
@@ -9759,7 +10779,8 @@
27366
(unspec:TLSmode [(match_operand:TLSmode 3 "rs6000_tls_symbol_ref" "")]
27368
(clobber (reg:SI LR_REGNO))]
27369
- "HAVE_AS_TLS && DEFAULT_ABI == ABI_AIX && TARGET_TLS_MARKERS"
27370
+ "HAVE_AS_TLS && TARGET_TLS_MARKERS
27371
+ && (DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_ELFv2)"
27372
"bl %z1(%3@tlsgd)\;nop"
27373
[(set_attr "type" "branch")
27374
(set_attr "length" "8")])
27375
@@ -9791,7 +10812,7 @@
27376
(unspec:TLSmode [(match_operand:TLSmode 1 "gpc_reg_operand" "b")]
27378
(clobber (reg:SI LR_REGNO))]
27379
- "HAVE_AS_TLS && DEFAULT_ABI == ABI_AIX"
27380
+ "HAVE_AS_TLS && (DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_ELFv2)"
27382
if (TARGET_CMODEL != CMODEL_SMALL)
27383
return "addis %0,%1,%&@got@tlsld@ha\;addi %0,%0,%&@got@tlsld@l\;"
27384
@@ -9892,7 +10913,8 @@
27385
(match_operand 2 "" "g")))
27386
(unspec:TLSmode [(const_int 0)] UNSPEC_TLSLD)
27387
(clobber (reg:SI LR_REGNO))]
27388
- "HAVE_AS_TLS && DEFAULT_ABI == ABI_AIX && TARGET_TLS_MARKERS"
27389
+ "HAVE_AS_TLS && TARGET_TLS_MARKERS
27390
+ && (DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_ELFv2)"
27391
"bl %z1(%&@tlsld)\;nop"
27392
[(set_attr "type" "branch")
27393
(set_attr "length" "8")])
27394
@@ -10261,7 +11283,7 @@
27395
[(parallel [(set (match_operand:SI 0 "gpc_reg_operand" "=r")
27396
(unspec:SI [(const_int 0)] UNSPEC_TOC))
27397
(use (reg:SI 2))])]
27398
- "DEFAULT_ABI == ABI_AIX && TARGET_32BIT"
27399
+ "(DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_ELFv2) && TARGET_32BIT"
27403
@@ -10276,7 +11298,7 @@
27404
[(parallel [(set (match_operand:DI 0 "gpc_reg_operand" "=r")
27405
(unspec:DI [(const_int 0)] UNSPEC_TOC))
27406
(use (reg:DI 2))])]
27407
- "DEFAULT_ABI == ABI_AIX && TARGET_64BIT"
27408
+ "(DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_ELFv2) && TARGET_64BIT"
27412
@@ -10306,7 +11328,7 @@
27413
[(parallel [(set (reg:SI LR_REGNO)
27414
(match_operand:SI 0 "immediate_operand" "s"))
27415
(use (unspec [(match_dup 0)] UNSPEC_TOC))])]
27416
- "TARGET_ELF && DEFAULT_ABI != ABI_AIX
27417
+ "TARGET_ELF && DEFAULT_ABI == ABI_V4
27418
&& (flag_pic == 2 || (flag_pic && TARGET_SECURE_PLT))"
27421
@@ -10314,7 +11336,7 @@
27422
[(set (reg:SI LR_REGNO)
27423
(match_operand:SI 0 "immediate_operand" "s"))
27424
(use (unspec [(match_dup 0)] UNSPEC_TOC))]
27425
- "!TARGET_LINK_STACK && TARGET_ELF && DEFAULT_ABI != ABI_AIX
27426
+ "!TARGET_LINK_STACK && TARGET_ELF && DEFAULT_ABI == ABI_V4
27427
&& (flag_pic == 2 || (flag_pic && TARGET_SECURE_PLT))"
27428
"bcl 20,31,%0\\n%0:"
27429
[(set_attr "type" "branch")
27430
@@ -10324,7 +11346,7 @@
27431
[(set (reg:SI LR_REGNO)
27432
(match_operand:SI 0 "immediate_operand" "s"))
27433
(use (unspec [(match_dup 0)] UNSPEC_TOC))]
27434
- "TARGET_LINK_STACK && TARGET_ELF && DEFAULT_ABI != ABI_AIX
27435
+ "TARGET_LINK_STACK && TARGET_ELF && DEFAULT_ABI == ABI_V4
27436
&& (flag_pic == 2 || (flag_pic && TARGET_SECURE_PLT))"
27439
@@ -10344,7 +11366,7 @@
27440
(label_ref (match_operand 1 "" ""))]
27443
- "TARGET_ELF && DEFAULT_ABI != ABI_AIX && flag_pic == 2"
27444
+ "TARGET_ELF && DEFAULT_ABI == ABI_V4 && flag_pic == 2"
27447
(define_insn "load_toc_v4_PIC_1b_normal"
27448
@@ -10353,7 +11375,7 @@
27449
(label_ref (match_operand 1 "" ""))]
27452
- "!TARGET_LINK_STACK && TARGET_ELF && DEFAULT_ABI != ABI_AIX && flag_pic == 2"
27453
+ "!TARGET_LINK_STACK && TARGET_ELF && DEFAULT_ABI == ABI_V4 && flag_pic == 2"
27454
"bcl 20,31,$+8\;.long %0-$"
27455
[(set_attr "type" "branch")
27456
(set_attr "length" "8")])
27457
@@ -10364,7 +11386,7 @@
27458
(label_ref (match_operand 1 "" ""))]
27461
- "TARGET_LINK_STACK && TARGET_ELF && DEFAULT_ABI != ABI_AIX && flag_pic == 2"
27462
+ "TARGET_LINK_STACK && TARGET_ELF && DEFAULT_ABI == ABI_V4 && flag_pic == 2"
27466
@@ -10382,7 +11404,7 @@
27467
(mem:SI (plus:SI (match_operand:SI 1 "gpc_reg_operand" "b")
27468
(minus:SI (match_operand:SI 2 "immediate_operand" "s")
27469
(match_operand:SI 3 "immediate_operand" "s")))))]
27470
- "TARGET_ELF && DEFAULT_ABI != ABI_AIX && flag_pic == 2"
27471
+ "TARGET_ELF && DEFAULT_ABI == ABI_V4 && flag_pic == 2"
27473
[(set_attr "type" "load")])
27475
@@ -10392,7 +11414,7 @@
27477
(minus:SI (match_operand:SI 2 "symbol_ref_operand" "s")
27478
(match_operand:SI 3 "symbol_ref_operand" "s")))))]
27479
- "TARGET_ELF && TARGET_SECURE_PLT && DEFAULT_ABI != ABI_AIX && flag_pic"
27480
+ "TARGET_ELF && TARGET_SECURE_PLT && DEFAULT_ABI == ABI_V4 && flag_pic"
27481
"addis %0,%1,%2-%3@ha")
27483
(define_insn "load_toc_v4_PIC_3c"
27484
@@ -10400,7 +11422,7 @@
27485
(lo_sum:SI (match_operand:SI 1 "gpc_reg_operand" "b")
27486
(minus:SI (match_operand:SI 2 "symbol_ref_operand" "s")
27487
(match_operand:SI 3 "symbol_ref_operand" "s"))))]
27488
- "TARGET_ELF && TARGET_SECURE_PLT && DEFAULT_ABI != ABI_AIX && flag_pic"
27489
+ "TARGET_ELF && TARGET_SECURE_PLT && DEFAULT_ABI == ABI_V4 && flag_pic"
27490
"addi %0,%1,%2-%3@l")
27492
;; If the TOC is shared over a translation unit, as happens with all
27493
@@ -10542,8 +11564,13 @@
27495
operands[0] = XEXP (operands[0], 0);
27497
+ if (DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_ELFv2)
27499
+ rs6000_call_aix (NULL_RTX, operands[0], operands[1], operands[2]);
27503
if (GET_CODE (operands[0]) != SYMBOL_REF
27504
- || (DEFAULT_ABI == ABI_AIX && !SYMBOL_REF_FUNCTION_P (operands[0]))
27505
|| (DEFAULT_ABI != ABI_DARWIN && (INTVAL (operands[2]) & CALL_LONG) != 0))
27507
if (INTVAL (operands[2]) & CALL_LONG)
27508
@@ -10556,12 +11583,6 @@
27509
operands[0] = force_reg (Pmode, operands[0]);
27513
- /* AIX function pointers are really pointers to a three word
27515
- rs6000_call_indirect_aix (NULL_RTX, operands[0], operands[1]);
27519
gcc_unreachable ();
27521
@@ -10587,8 +11608,13 @@
27523
operands[1] = XEXP (operands[1], 0);
27525
+ if (DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_ELFv2)
27527
+ rs6000_call_aix (operands[0], operands[1], operands[2], operands[3]);
27531
if (GET_CODE (operands[1]) != SYMBOL_REF
27532
- || (DEFAULT_ABI == ABI_AIX && !SYMBOL_REF_FUNCTION_P (operands[1]))
27533
|| (DEFAULT_ABI != ABI_DARWIN && (INTVAL (operands[3]) & CALL_LONG) != 0))
27535
if (INTVAL (operands[3]) & CALL_LONG)
27536
@@ -10601,12 +11627,6 @@
27537
operands[1] = force_reg (Pmode, operands[1]);
27541
- /* AIX function pointers are really pointers to a three word
27543
- rs6000_call_indirect_aix (operands[0], operands[1], operands[2]);
27547
gcc_unreachable ();
27549
@@ -10698,136 +11718,7 @@
27550
[(set_attr "type" "branch")
27551
(set_attr "length" "4,8")])
27553
-;; Call to indirect functions with the AIX abi using a 3 word descriptor.
27554
-;; Operand0 is the addresss of the function to call
27555
-;; Operand1 is the flag for System V.4 for unprototyped or FP registers
27556
-;; Operand2 is the location in the function descriptor to load r2 from
27557
-;; Operand3 is the stack location to hold the current TOC pointer
27559
-(define_insn "call_indirect_aix<ptrsize>"
27560
- [(call (mem:SI (match_operand:P 0 "register_operand" "c,*l"))
27561
- (match_operand 1 "" "g,g"))
27562
- (use (match_operand:P 2 "memory_operand" "<ptrm>,<ptrm>"))
27563
- (set (reg:P TOC_REGNUM) (match_operand:P 3 "memory_operand" "<ptrm>,<ptrm>"))
27564
- (use (reg:P STATIC_CHAIN_REGNUM))
27565
- (clobber (reg:P LR_REGNO))]
27566
- "DEFAULT_ABI == ABI_AIX && TARGET_POINTERS_TO_NESTED_FUNCTIONS"
27567
- "<ptrload> 2,%2\;b%T0l\;<ptrload> 2,%3"
27568
- [(set_attr "type" "jmpreg")
27569
- (set_attr "length" "12")])
27571
-;; Like call_indirect_aix<ptrsize>, but no use of the static chain
27572
-;; Operand0 is the addresss of the function to call
27573
-;; Operand1 is the flag for System V.4 for unprototyped or FP registers
27574
-;; Operand2 is the location in the function descriptor to load r2 from
27575
-;; Operand3 is the stack location to hold the current TOC pointer
27577
-(define_insn "call_indirect_aix<ptrsize>_nor11"
27578
- [(call (mem:SI (match_operand:P 0 "register_operand" "c,*l"))
27579
- (match_operand 1 "" "g,g"))
27580
- (use (match_operand:P 2 "memory_operand" "<ptrm>,<ptrm>"))
27581
- (set (reg:P TOC_REGNUM) (match_operand:P 3 "memory_operand" "<ptrm>,<ptrm>"))
27582
- (clobber (reg:P LR_REGNO))]
27583
- "DEFAULT_ABI == ABI_AIX && !TARGET_POINTERS_TO_NESTED_FUNCTIONS"
27584
- "<ptrload> 2,%2\;b%T0l\;<ptrload> 2,%3"
27585
- [(set_attr "type" "jmpreg")
27586
- (set_attr "length" "12")])
27588
-;; Operand0 is the return result of the function
27589
-;; Operand1 is the addresss of the function to call
27590
-;; Operand2 is the flag for System V.4 for unprototyped or FP registers
27591
-;; Operand3 is the location in the function descriptor to load r2 from
27592
-;; Operand4 is the stack location to hold the current TOC pointer
27594
-(define_insn "call_value_indirect_aix<ptrsize>"
27595
- [(set (match_operand 0 "" "")
27596
- (call (mem:SI (match_operand:P 1 "register_operand" "c,*l"))
27597
- (match_operand 2 "" "g,g")))
27598
- (use (match_operand:P 3 "memory_operand" "<ptrm>,<ptrm>"))
27599
- (set (reg:P TOC_REGNUM) (match_operand:P 4 "memory_operand" "<ptrm>,<ptrm>"))
27600
- (use (reg:P STATIC_CHAIN_REGNUM))
27601
- (clobber (reg:P LR_REGNO))]
27602
- "DEFAULT_ABI == ABI_AIX && TARGET_POINTERS_TO_NESTED_FUNCTIONS"
27603
- "<ptrload> 2,%3\;b%T1l\;<ptrload> 2,%4"
27604
- [(set_attr "type" "jmpreg")
27605
- (set_attr "length" "12")])
27607
-;; Like call_value_indirect_aix<ptrsize>, but no use of the static chain
27608
-;; Operand0 is the return result of the function
27609
-;; Operand1 is the addresss of the function to call
27610
-;; Operand2 is the flag for System V.4 for unprototyped or FP registers
27611
-;; Operand3 is the location in the function descriptor to load r2 from
27612
-;; Operand4 is the stack location to hold the current TOC pointer
27614
-(define_insn "call_value_indirect_aix<ptrsize>_nor11"
27615
- [(set (match_operand 0 "" "")
27616
- (call (mem:SI (match_operand:P 1 "register_operand" "c,*l"))
27617
- (match_operand 2 "" "g,g")))
27618
- (use (match_operand:P 3 "memory_operand" "<ptrm>,<ptrm>"))
27619
- (set (reg:P TOC_REGNUM) (match_operand:P 4 "memory_operand" "<ptrm>,<ptrm>"))
27620
- (clobber (reg:P LR_REGNO))]
27621
- "DEFAULT_ABI == ABI_AIX && !TARGET_POINTERS_TO_NESTED_FUNCTIONS"
27622
- "<ptrload> 2,%3\;b%T1l\;<ptrload> 2,%4"
27623
- [(set_attr "type" "jmpreg")
27624
- (set_attr "length" "12")])
27626
-;; Call to function which may be in another module. Restore the TOC
27627
-;; pointer (r2) after the call unless this is System V.
27628
-;; Operand2 is nonzero if we are using the V.4 calling sequence and
27629
-;; either the function was not prototyped, or it was prototyped as a
27630
-;; variable argument function. It is > 0 if FP registers were passed
27631
-;; and < 0 if they were not.
27633
-(define_insn "*call_nonlocal_aix32"
27634
- [(call (mem:SI (match_operand:SI 0 "symbol_ref_operand" "s"))
27635
- (match_operand 1 "" "g"))
27636
- (use (match_operand:SI 2 "immediate_operand" "O"))
27637
- (clobber (reg:SI LR_REGNO))]
27639
- && DEFAULT_ABI == ABI_AIX
27640
- && (INTVAL (operands[2]) & CALL_LONG) == 0"
27642
- [(set_attr "type" "branch")
27643
- (set_attr "length" "8")])
27645
-(define_insn "*call_nonlocal_aix64"
27646
- [(call (mem:SI (match_operand:DI 0 "symbol_ref_operand" "s"))
27647
- (match_operand 1 "" "g"))
27648
- (use (match_operand:SI 2 "immediate_operand" "O"))
27649
- (clobber (reg:SI LR_REGNO))]
27651
- && DEFAULT_ABI == ABI_AIX
27652
- && (INTVAL (operands[2]) & CALL_LONG) == 0"
27654
- [(set_attr "type" "branch")
27655
- (set_attr "length" "8")])
27657
-(define_insn "*call_value_nonlocal_aix32"
27658
- [(set (match_operand 0 "" "")
27659
- (call (mem:SI (match_operand:SI 1 "symbol_ref_operand" "s"))
27660
- (match_operand 2 "" "g")))
27661
- (use (match_operand:SI 3 "immediate_operand" "O"))
27662
- (clobber (reg:SI LR_REGNO))]
27664
- && DEFAULT_ABI == ABI_AIX
27665
- && (INTVAL (operands[3]) & CALL_LONG) == 0"
27667
- [(set_attr "type" "branch")
27668
- (set_attr "length" "8")])
27670
-(define_insn "*call_value_nonlocal_aix64"
27671
- [(set (match_operand 0 "" "")
27672
- (call (mem:SI (match_operand:DI 1 "symbol_ref_operand" "s"))
27673
- (match_operand 2 "" "g")))
27674
- (use (match_operand:SI 3 "immediate_operand" "O"))
27675
- (clobber (reg:SI LR_REGNO))]
27677
- && DEFAULT_ABI == ABI_AIX
27678
- && (INTVAL (operands[3]) & CALL_LONG) == 0"
27680
- [(set_attr "type" "branch")
27681
- (set_attr "length" "8")])
27683
;; A function pointer under System V is just a normal pointer
27684
;; operands[0] is the function pointer
27685
;; operands[1] is the stack size to clean up
27686
@@ -11009,6 +11900,104 @@
27687
[(set_attr "type" "branch,branch")
27688
(set_attr "length" "4,8")])
27691
+;; Call to AIX abi function in the same module.
27693
+(define_insn "*call_local_aix<mode>"
27694
+ [(call (mem:SI (match_operand:P 0 "current_file_function_operand" "s"))
27695
+ (match_operand 1 "" "g"))
27696
+ (clobber (reg:P LR_REGNO))]
27697
+ "DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_ELFv2"
27699
+ [(set_attr "type" "branch")
27700
+ (set_attr "length" "4")])
27702
+(define_insn "*call_value_local_aix<mode>"
27703
+ [(set (match_operand 0 "" "")
27704
+ (call (mem:SI (match_operand:P 1 "current_file_function_operand" "s"))
27705
+ (match_operand 2 "" "g")))
27706
+ (clobber (reg:P LR_REGNO))]
27707
+ "DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_ELFv2"
27709
+ [(set_attr "type" "branch")
27710
+ (set_attr "length" "4")])
27712
+;; Call to AIX abi function which may be in another module.
27713
+;; Restore the TOC pointer (r2) after the call.
27715
+(define_insn "*call_nonlocal_aix<mode>"
27716
+ [(call (mem:SI (match_operand:P 0 "symbol_ref_operand" "s"))
27717
+ (match_operand 1 "" "g"))
27718
+ (clobber (reg:P LR_REGNO))]
27719
+ "DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_ELFv2"
27721
+ [(set_attr "type" "branch")
27722
+ (set_attr "length" "8")])
27724
+(define_insn "*call_value_nonlocal_aix<mode>"
27725
+ [(set (match_operand 0 "" "")
27726
+ (call (mem:SI (match_operand:P 1 "symbol_ref_operand" "s"))
27727
+ (match_operand 2 "" "g")))
27728
+ (clobber (reg:P LR_REGNO))]
27729
+ "DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_ELFv2"
27731
+ [(set_attr "type" "branch")
27732
+ (set_attr "length" "8")])
27734
+;; Call to indirect functions with the AIX abi using a 3 word descriptor.
27735
+;; Operand0 is the addresss of the function to call
27736
+;; Operand2 is the location in the function descriptor to load r2 from
27737
+;; Operand3 is the stack location to hold the current TOC pointer
27739
+(define_insn "*call_indirect_aix<mode>"
27740
+ [(call (mem:SI (match_operand:P 0 "register_operand" "c,*l"))
27741
+ (match_operand 1 "" "g,g"))
27742
+ (use (match_operand:P 2 "memory_operand" "<ptrm>,<ptrm>"))
27743
+ (set (reg:P TOC_REGNUM) (match_operand:P 3 "memory_operand" "<ptrm>,<ptrm>"))
27744
+ (clobber (reg:P LR_REGNO))]
27745
+ "DEFAULT_ABI == ABI_AIX"
27746
+ "<ptrload> 2,%2\;b%T0l\;<ptrload> 2,%3"
27747
+ [(set_attr "type" "jmpreg")
27748
+ (set_attr "length" "12")])
27750
+(define_insn "*call_value_indirect_aix<mode>"
27751
+ [(set (match_operand 0 "" "")
27752
+ (call (mem:SI (match_operand:P 1 "register_operand" "c,*l"))
27753
+ (match_operand 2 "" "g,g")))
27754
+ (use (match_operand:P 3 "memory_operand" "<ptrm>,<ptrm>"))
27755
+ (set (reg:P TOC_REGNUM) (match_operand:P 4 "memory_operand" "<ptrm>,<ptrm>"))
27756
+ (clobber (reg:P LR_REGNO))]
27757
+ "DEFAULT_ABI == ABI_AIX"
27758
+ "<ptrload> 2,%3\;b%T1l\;<ptrload> 2,%4"
27759
+ [(set_attr "type" "jmpreg")
27760
+ (set_attr "length" "12")])
27762
+;; Call to indirect functions with the ELFv2 ABI.
27763
+;; Operand0 is the addresss of the function to call
27764
+;; Operand2 is the stack location to hold the current TOC pointer
27766
+(define_insn "*call_indirect_elfv2<mode>"
27767
+ [(call (mem:SI (match_operand:P 0 "register_operand" "c,*l"))
27768
+ (match_operand 1 "" "g,g"))
27769
+ (set (reg:P TOC_REGNUM) (match_operand:P 2 "memory_operand" "<ptrm>,<ptrm>"))
27770
+ (clobber (reg:P LR_REGNO))]
27771
+ "DEFAULT_ABI == ABI_ELFv2"
27772
+ "b%T0l\;<ptrload> 2,%2"
27773
+ [(set_attr "type" "jmpreg")
27774
+ (set_attr "length" "8")])
27776
+(define_insn "*call_value_indirect_elfv2<mode>"
27777
+ [(set (match_operand 0 "" "")
27778
+ (call (mem:SI (match_operand:P 1 "register_operand" "c,*l"))
27779
+ (match_operand 2 "" "g,g")))
27780
+ (set (reg:P TOC_REGNUM) (match_operand:P 3 "memory_operand" "<ptrm>,<ptrm>"))
27781
+ (clobber (reg:P LR_REGNO))]
27782
+ "DEFAULT_ABI == ABI_ELFv2"
27783
+ "b%T1l\;<ptrload> 2,%3"
27784
+ [(set_attr "type" "jmpreg")
27785
+ (set_attr "length" "8")])
27788
;; Call subroutine returning any type.
27789
(define_expand "untyped_call"
27790
[(parallel [(call (match_operand 0 "" "")
27791
@@ -11056,8 +12045,41 @@
27792
gcc_assert (GET_CODE (operands[1]) == CONST_INT);
27794
operands[0] = XEXP (operands[0], 0);
27796
+ if (DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_ELFv2)
27798
+ rs6000_sibcall_aix (NULL_RTX, operands[0], operands[1], operands[2]);
27803
+(define_expand "sibcall_value"
27804
+ [(parallel [(set (match_operand 0 "register_operand" "")
27805
+ (call (mem:SI (match_operand 1 "address_operand" ""))
27806
+ (match_operand 2 "" "")))
27807
+ (use (match_operand 3 "" ""))
27808
+ (use (reg:SI LR_REGNO))
27809
+ (simple_return)])]
27814
+ if (MACHOPIC_INDIRECT)
27815
+ operands[1] = machopic_indirect_call_target (operands[1]);
27818
+ gcc_assert (GET_CODE (operands[1]) == MEM);
27819
+ gcc_assert (GET_CODE (operands[2]) == CONST_INT);
27821
+ operands[1] = XEXP (operands[1], 0);
27823
+ if (DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_ELFv2)
27825
+ rs6000_sibcall_aix (operands[0], operands[1], operands[2], operands[3]);
27830
;; this and similar patterns must be marked as using LR, otherwise
27831
;; dataflow will try to delete the store into it. This is true
27832
;; even when the actual reg to jump to is in CTR, when LR was
27833
@@ -11123,7 +12145,6 @@
27834
[(set_attr "type" "branch")
27835
(set_attr "length" "4,8")])
27838
(define_insn "*sibcall_value_local64"
27839
[(set (match_operand 0 "" "")
27840
(call (mem:SI (match_operand:DI 1 "current_file_function_operand" "s,s"))
27841
@@ -11145,35 +12166,6 @@
27842
[(set_attr "type" "branch")
27843
(set_attr "length" "4,8")])
27845
-(define_insn "*sibcall_nonlocal_aix<mode>"
27846
- [(call (mem:SI (match_operand:P 0 "call_operand" "s,c"))
27847
- (match_operand 1 "" "g,g"))
27848
- (use (match_operand:SI 2 "immediate_operand" "O,O"))
27849
- (use (reg:SI LR_REGNO))
27851
- "DEFAULT_ABI == ABI_AIX
27852
- && (INTVAL (operands[2]) & CALL_LONG) == 0"
27856
- [(set_attr "type" "branch")
27857
- (set_attr "length" "4")])
27859
-(define_insn "*sibcall_value_nonlocal_aix<mode>"
27860
- [(set (match_operand 0 "" "")
27861
- (call (mem:SI (match_operand:P 1 "call_operand" "s,c"))
27862
- (match_operand 2 "" "g,g")))
27863
- (use (match_operand:SI 3 "immediate_operand" "O,O"))
27864
- (use (reg:SI LR_REGNO))
27866
- "DEFAULT_ABI == ABI_AIX
27867
- && (INTVAL (operands[3]) & CALL_LONG) == 0"
27871
- [(set_attr "type" "branch")
27872
- (set_attr "length" "4")])
27874
(define_insn "*sibcall_nonlocal_sysv<mode>"
27875
[(call (mem:SI (match_operand:P 0 "call_operand" "s,s,c,c"))
27876
(match_operand 1 "" ""))
27877
@@ -11204,27 +12196,6 @@
27878
[(set_attr "type" "branch")
27879
(set_attr "length" "4,8,4,8")])
27881
-(define_expand "sibcall_value"
27882
- [(parallel [(set (match_operand 0 "register_operand" "")
27883
- (call (mem:SI (match_operand 1 "address_operand" ""))
27884
- (match_operand 2 "" "")))
27885
- (use (match_operand 3 "" ""))
27886
- (use (reg:SI LR_REGNO))
27887
- (simple_return)])]
27892
- if (MACHOPIC_INDIRECT)
27893
- operands[1] = machopic_indirect_call_target (operands[1]);
27896
- gcc_assert (GET_CODE (operands[1]) == MEM);
27897
- gcc_assert (GET_CODE (operands[2]) == CONST_INT);
27899
- operands[1] = XEXP (operands[1], 0);
27902
(define_insn "*sibcall_value_nonlocal_sysv<mode>"
27903
[(set (match_operand 0 "" "")
27904
(call (mem:SI (match_operand:P 1 "call_operand" "s,s,c,c"))
27905
@@ -11256,6 +12227,31 @@
27906
[(set_attr "type" "branch")
27907
(set_attr "length" "4,8,4,8")])
27909
+;; AIX ABI sibling call patterns.
27911
+(define_insn "*sibcall_aix<mode>"
27912
+ [(call (mem:SI (match_operand:P 0 "call_operand" "s,c"))
27913
+ (match_operand 1 "" "g,g"))
27915
+ "DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_ELFv2"
27919
+ [(set_attr "type" "branch")
27920
+ (set_attr "length" "4")])
27922
+(define_insn "*sibcall_value_aix<mode>"
27923
+ [(set (match_operand 0 "" "")
27924
+ (call (mem:SI (match_operand:P 1 "call_operand" "s,c"))
27925
+ (match_operand 2 "" "g,g")))
27927
+ "DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_ELFv2"
27931
+ [(set_attr "type" "branch")
27932
+ (set_attr "length" "4")])
27934
(define_expand "sibcall_epilogue"
27935
[(use (const_int 0))]
27937
@@ -11294,7 +12290,14 @@
27938
operands[1] = gen_rtx_REG (Pmode, 0);
27939
return "st<wd>%U0%X0 %1,%0";
27941
- [(set_attr "type" "store")
27942
+ [(set (attr "type")
27944
+ (match_test "update_indexed_address_mem (operands[0], VOIDmode)")
27945
+ (const_string "store_ux")
27947
+ (match_test "update_address_mem (operands[0], VOIDmode)")
27948
+ (const_string "store_u")
27949
+ (const_string "store"))))
27950
(set_attr "length" "4")])
27952
(define_insn "probe_stack_range<P:mode>"
27953
@@ -11589,23 +12592,6 @@
27954
[(set (match_dup 3) (compare:CCUNS (match_dup 1) (match_dup 2)))
27955
(set (match_dup 0) (plus:SI (match_dup 1) (match_dup 4)))])
27957
-(define_insn "*cmpsf_internal1"
27958
- [(set (match_operand:CCFP 0 "cc_reg_operand" "=y")
27959
- (compare:CCFP (match_operand:SF 1 "gpc_reg_operand" "f")
27960
- (match_operand:SF 2 "gpc_reg_operand" "f")))]
27961
- "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT"
27963
- [(set_attr "type" "fpcompare")])
27965
-(define_insn "*cmpdf_internal1"
27966
- [(set (match_operand:CCFP 0 "cc_reg_operand" "=y")
27967
- (compare:CCFP (match_operand:DF 1 "gpc_reg_operand" "d")
27968
- (match_operand:DF 2 "gpc_reg_operand" "d")))]
27969
- "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
27970
- && !VECTOR_UNIT_VSX_P (DFmode)"
27972
- [(set_attr "type" "fpcompare")])
27974
;; Only need to compare second words if first words equal
27975
(define_insn "*cmptf_internal1"
27976
[(set (match_operand:CCFP 0 "cc_reg_operand" "=y")
27977
@@ -13501,6 +14487,14 @@
27979
[(set_attr "type" "mfcr")])
27981
+(define_insn "*crsave"
27982
+ [(match_parallel 0 "crsave_operation"
27983
+ [(set (match_operand:SI 1 "memory_operand" "=m")
27984
+ (match_operand:SI 2 "gpc_reg_operand" "r"))])]
27987
+ [(set_attr "type" "store")])
27989
(define_insn "*stmw"
27990
[(match_parallel 0 "stmw_operation"
27991
[(set (match_operand:SI 1 "memory_operand" "=m")
27992
@@ -13885,7 +14879,7 @@
27993
(match_operand:P 2 "gpc_reg_operand" "r")] UNSPEC_BPERM))]
27996
- [(set_attr "type" "integer")])
27997
+ [(set_attr "type" "popcnt")])
28000
;; Builtin fma support. Handle
28001
@@ -13900,6 +14894,20 @@
28005
+(define_insn "*fma<mode>4_fpr"
28006
+ [(set (match_operand:SFDF 0 "gpc_reg_operand" "=<Ff>,<Fv>,<Fv>")
28008
+ (match_operand:SFDF 1 "gpc_reg_operand" "%<Ff>,<Fv>,<Fv>")
28009
+ (match_operand:SFDF 2 "gpc_reg_operand" "<Ff>,<Fv>,0")
28010
+ (match_operand:SFDF 3 "gpc_reg_operand" "<Ff>,0,<Fv>")))]
28011
+ "TARGET_<MODE>_FPR"
28013
+ fmadd<Ftrad> %0,%1,%2,%3
28014
+ xsmadda<Fvsx> %x0,%x1,%x2
28015
+ xsmaddm<Fvsx> %x0,%x1,%x3"
28016
+ [(set_attr "type" "fp")
28017
+ (set_attr "fp_type" "fp_maddsub_<Fs>")])
28019
; Altivec only has fma and nfms.
28020
(define_expand "fms<mode>4"
28021
[(set (match_operand:FMA_F 0 "register_operand" "")
28022
@@ -13910,6 +14918,20 @@
28023
"!VECTOR_UNIT_ALTIVEC_P (<MODE>mode)"
28026
+(define_insn "*fms<mode>4_fpr"
28027
+ [(set (match_operand:SFDF 0 "gpc_reg_operand" "=<Ff>,<Fv>,<Fv>")
28029
+ (match_operand:SFDF 1 "gpc_reg_operand" "<Ff>,<Fv>,<Fv>")
28030
+ (match_operand:SFDF 2 "gpc_reg_operand" "<Ff>,<Fv>,0")
28031
+ (neg:SFDF (match_operand:SFDF 3 "gpc_reg_operand" "<Ff>,0,<Fv>"))))]
28032
+ "TARGET_<MODE>_FPR"
28034
+ fmsub<Ftrad> %0,%1,%2,%3
28035
+ xsmsuba<Fvsx> %x0,%x1,%x2
28036
+ xsmsubm<Fvsx> %x0,%x1,%x3"
28037
+ [(set_attr "type" "fp")
28038
+ (set_attr "fp_type" "fp_maddsub_<Fs>")])
28040
;; If signed zeros are ignored, -(a * b - c) = -a * b + c.
28041
(define_expand "fnma<mode>4"
28042
[(set (match_operand:FMA_F 0 "register_operand" "")
28043
@@ -13943,6 +14965,21 @@
28044
"!VECTOR_UNIT_ALTIVEC_P (<MODE>mode)"
28047
+(define_insn "*nfma<mode>4_fpr"
28048
+ [(set (match_operand:SFDF 0 "gpc_reg_operand" "=<Ff>,<Fv>,<Fv>")
28051
+ (match_operand:SFDF 1 "gpc_reg_operand" "<Ff>,<Fv>,<Fv>")
28052
+ (match_operand:SFDF 2 "gpc_reg_operand" "<Ff>,<Fv>,0")
28053
+ (match_operand:SFDF 3 "gpc_reg_operand" "<Ff>,0,<Fv>"))))]
28054
+ "TARGET_<MODE>_FPR"
28056
+ fnmadd<Ftrad> %0,%1,%2,%3
28057
+ xsnmadda<Fvsx> %x0,%x1,%x2
28058
+ xsnmaddm<Fvsx> %x0,%x1,%x3"
28059
+ [(set_attr "type" "fp")
28060
+ (set_attr "fp_type" "fp_maddsub_<Fs>")])
28062
; Not an official optab name, but used from builtins.
28063
(define_expand "nfms<mode>4"
28064
[(set (match_operand:FMA_F 0 "register_operand" "")
28065
@@ -13954,6 +14991,23 @@
28069
+(define_insn "*nfmssf4_fpr"
28070
+ [(set (match_operand:SFDF 0 "gpc_reg_operand" "=<Ff>,<Fv>,<Fv>")
28073
+ (match_operand:SFDF 1 "gpc_reg_operand" "<Ff>,<Fv>,<Fv>")
28074
+ (match_operand:SFDF 2 "gpc_reg_operand" "<Ff>,<Fv>,0")
28076
+ (match_operand:SFDF 3 "gpc_reg_operand" "<Ff>,0,<Fv>")))))]
28077
+ "TARGET_<MODE>_FPR"
28079
+ fnmsub<Ftrad> %0,%1,%2,%3
28080
+ xsnmsuba<Fvsx> %x0,%x1,%x2
28081
+ xsnmsubm<Fvsx> %x0,%x1,%x3"
28082
+ [(set_attr "type" "fp")
28083
+ (set_attr "fp_type" "fp_maddsub_<Fs>")])
28086
(define_expand "rs6000_get_timebase"
28087
[(use (match_operand:DI 0 "gpc_reg_operand" ""))]
28089
@@ -14020,7 +15074,44 @@
28093
+;; Power8 fusion support for fusing an addis instruction with a D-form load of
28094
+;; a GPR. The addis instruction must be adjacent to the load, and use the same
28095
+;; register that is being loaded. The fused ops must be physically adjacent.
28097
+;; We use define_peephole for the actual addis/load, and the register used to
28098
+;; hold the addis value must be the same as the register being loaded. We use
28099
+;; define_peephole2 to change the register used for addis to be the register
28100
+;; being loaded, since we can look at whether it is dead after the load insn.
28103
+ [(set (match_operand:P 0 "base_reg_operand" "")
28104
+ (match_operand:P 1 "fusion_gpr_addis" ""))
28105
+ (set (match_operand:INT1 2 "base_reg_operand" "")
28106
+ (match_operand:INT1 3 "fusion_gpr_mem_load" ""))]
28107
+ "TARGET_P8_FUSION && fusion_gpr_load_p (operands, false)"
28109
+ return emit_fusion_gpr_load (operands);
28111
+ [(set_attr "type" "load")
28112
+ (set_attr "length" "8")])
28115
+ [(set (match_operand:P 0 "base_reg_operand" "")
28116
+ (match_operand:P 1 "fusion_gpr_addis" ""))
28117
+ (set (match_operand:INT1 2 "base_reg_operand" "")
28118
+ (match_operand:INT1 3 "fusion_gpr_mem_load" ""))]
28119
+ "TARGET_P8_FUSION
28120
+ && (REGNO (operands[0]) != REGNO (operands[2])
28121
+ || GET_CODE (operands[3]) == SIGN_EXTEND)
28122
+ && fusion_gpr_load_p (operands, true)"
28125
+ expand_fusion_gpr_load (operands);
28131
(include "sync.md")
28132
(include "vector.md")
28134
@@ -14028,3 +15119,5 @@
28137
(include "paired.md")
28138
+(include "crypto.md")
28139
+(include "htm.md")
28140
--- a/src/gcc/config/rs6000/option-defaults.h
28141
+++ b/src/gcc/config/rs6000/option-defaults.h
28143
--with-float is ignored if -mhard-float or -msoft-float are
28145
#define OPTION_DEFAULT_SPECS \
28146
+ {"abi", "%{!mabi=elfv*:-mabi=%(VALUE)}" }, \
28147
{"tune", "%{!mtune=*:%{!mcpu=*:-mtune=%(VALUE)}}" }, \
28148
{"tune_32", "%{" OPT_ARCH32 ":%{!mtune=*:%{!mcpu=*:-mtune=%(VALUE)}}}" }, \
28149
{"tune_64", "%{" OPT_ARCH64 ":%{!mtune=*:%{!mcpu=*:-mtune=%(VALUE)}}}" }, \
28150
--- a/src/gcc/config/rs6000/rs6000-opts.h
28151
+++ b/src/gcc/config/rs6000/rs6000-opts.h
28161
/* FP processor type. */
28162
@@ -100,7 +101,8 @@
28163
/* Enumeration to give which calling sequence to use. */
28166
- ABI_AIX, /* IBM's AIX */
28167
+ ABI_AIX, /* IBM's AIX, or Linux ELFv1 */
28168
+ ABI_ELFv2, /* Linux ELFv2 ABI */
28169
ABI_V4, /* System V.4/eabi */
28170
ABI_DARWIN /* Apple's Darwin (OS X kernel) */
28172
@@ -131,11 +133,14 @@
28176
-/* Describe which vector unit to use for a given machine mode. */
28177
+/* Describe which vector unit to use for a given machine mode. The
28178
+ VECTOR_MEM_* and VECTOR_UNIT_* macros assume that Altivec, VSX, and
28179
+ P8_VECTOR are contiguous. */
28180
enum rs6000_vector {
28181
VECTOR_NONE, /* Type is not a vector or not supported */
28182
VECTOR_ALTIVEC, /* Use altivec for vector processing */
28183
VECTOR_VSX, /* Use VSX for vector processing */
28184
+ VECTOR_P8_VECTOR, /* Use ISA 2.07 VSX for vector processing */
28185
VECTOR_PAIRED, /* Use paired floating point for vectors */
28186
VECTOR_SPE, /* Use SPE for vector processing */
28187
VECTOR_OTHER /* Some other vector unit */
28188
--- a/src/gcc/config/rs6000/driver-rs6000.c
28189
+++ b/src/gcc/config/rs6000/driver-rs6000.c
28190
@@ -167,7 +167,7 @@
28195
+ static char buf[1024];
28199
--- a/src/gcc/config/rs6000/altivec.h
28200
+++ b/src/gcc/config/rs6000/altivec.h
28201
@@ -321,6 +321,42 @@
28202
#define vec_vsx_st __builtin_vec_vsx_st
28206
+/* Vector additions added in ISA 2.07. */
28207
+#define vec_eqv __builtin_vec_eqv
28208
+#define vec_nand __builtin_vec_nand
28209
+#define vec_orc __builtin_vec_orc
28210
+#define vec_vaddudm __builtin_vec_vaddudm
28211
+#define vec_vclz __builtin_vec_vclz
28212
+#define vec_vclzb __builtin_vec_vclzb
28213
+#define vec_vclzd __builtin_vec_vclzd
28214
+#define vec_vclzh __builtin_vec_vclzh
28215
+#define vec_vclzw __builtin_vec_vclzw
28216
+#define vec_vgbbd __builtin_vec_vgbbd
28217
+#define vec_vmaxsd __builtin_vec_vmaxsd
28218
+#define vec_vmaxud __builtin_vec_vmaxud
28219
+#define vec_vminsd __builtin_vec_vminsd
28220
+#define vec_vminud __builtin_vec_vminud
28221
+#define vec_vmrgew __builtin_vec_vmrgew
28222
+#define vec_vmrgow __builtin_vec_vmrgow
28223
+#define vec_vpksdss __builtin_vec_vpksdss
28224
+#define vec_vpksdus __builtin_vec_vpksdus
28225
+#define vec_vpkudum __builtin_vec_vpkudum
28226
+#define vec_vpkudus __builtin_vec_vpkudus
28227
+#define vec_vpopcnt __builtin_vec_vpopcnt
28228
+#define vec_vpopcntb __builtin_vec_vpopcntb
28229
+#define vec_vpopcntd __builtin_vec_vpopcntd
28230
+#define vec_vpopcnth __builtin_vec_vpopcnth
28231
+#define vec_vpopcntw __builtin_vec_vpopcntw
28232
+#define vec_vrld __builtin_vec_vrld
28233
+#define vec_vsld __builtin_vec_vsld
28234
+#define vec_vsrad __builtin_vec_vsrad
28235
+#define vec_vsrd __builtin_vec_vsrd
28236
+#define vec_vsubudm __builtin_vec_vsubudm
28237
+#define vec_vupkhsw __builtin_vec_vupkhsw
28238
+#define vec_vupklsw __builtin_vec_vupklsw
28242
For C++, we use templates in order to allow non-parenthesized arguments.
28243
For C, instead, we use macros since non-parenthesized arguments were
28244
--- a/src/gcc/config/rs6000/sysv4.h
28245
+++ b/src/gcc/config/rs6000/sysv4.h
28247
& (OPTION_MASK_RELOCATABLE \
28248
| OPTION_MASK_MINIMAL_TOC)) \
28250
- || DEFAULT_ABI == ABI_AIX)
28251
+ || DEFAULT_ABI != ABI_V4)
28253
#define TARGET_BITFIELD_TYPE (! TARGET_NO_BITFIELD_TYPE)
28254
#define TARGET_BIG_ENDIAN (! TARGET_LITTLE_ENDIAN)
28255
@@ -147,7 +147,7 @@
28256
rs6000_sdata_name); \
28259
- else if (flag_pic && DEFAULT_ABI != ABI_AIX \
28260
+ else if (flag_pic && DEFAULT_ABI == ABI_V4 \
28261
&& (rs6000_sdata == SDATA_EABI \
28262
|| rs6000_sdata == SDATA_SYSV)) \
28264
@@ -173,14 +173,14 @@
28265
error ("-mrelocatable and -mno-minimal-toc are incompatible"); \
28268
- if (TARGET_RELOCATABLE && rs6000_current_abi == ABI_AIX) \
28269
+ if (TARGET_RELOCATABLE && rs6000_current_abi != ABI_V4) \
28271
rs6000_isa_flags &= ~OPTION_MASK_RELOCATABLE; \
28272
error ("-mrelocatable and -mcall-%s are incompatible", \
28273
rs6000_abi_name); \
28276
- if (!TARGET_64BIT && flag_pic > 1 && rs6000_current_abi == ABI_AIX) \
28277
+ if (!TARGET_64BIT && flag_pic > 1 && rs6000_current_abi != ABI_V4) \
28280
error ("-fPIC and -mcall-%s are incompatible", \
28281
@@ -193,7 +193,7 @@
28284
/* Treat -fPIC the same as -mrelocatable. */ \
28285
- if (flag_pic > 1 && DEFAULT_ABI != ABI_AIX) \
28286
+ if (flag_pic > 1 && DEFAULT_ABI == ABI_V4) \
28288
rs6000_isa_flags |= OPTION_MASK_RELOCATABLE | OPTION_MASK_MINIMAL_TOC; \
28289
TARGET_NO_FP_IN_TOC = 1; \
28290
@@ -317,7 +317,7 @@
28292
/* Put PC relative got entries in .got2. */
28293
#define MINIMAL_TOC_SECTION_ASM_OP \
28294
- (TARGET_RELOCATABLE || (flag_pic && DEFAULT_ABI != ABI_AIX) \
28295
+ (TARGET_RELOCATABLE || (flag_pic && DEFAULT_ABI == ABI_V4) \
28296
? "\t.section\t\".got2\",\"aw\"" : "\t.section\t\".got1\",\"aw\"")
28298
#define SDATA_SECTION_ASM_OP "\t.section\t\".sdata\",\"aw\""
28299
@@ -538,12 +538,7 @@
28301
#define CC1_ENDIAN_BIG_SPEC ""
28303
-#define CC1_ENDIAN_LITTLE_SPEC "\
28304
-%{!mstrict-align: %{!mno-strict-align: \
28305
- %{!mcall-i960-old: \
28309
+#define CC1_ENDIAN_LITTLE_SPEC ""
28311
#define CC1_ENDIAN_DEFAULT_SPEC "%(cc1_endian_big)"
28313
--- a/src/libgo/configure
28314
+++ b/src/libgo/configure
28315
@@ -6501,7 +6501,7 @@
28319
-x86_64-*kfreebsd*-gnu|x86_64-*linux*|ppc*-*linux*|powerpc*-*linux*| \
28320
+x86_64-*kfreebsd*-gnu|x86_64-*linux*|powerpc*-*linux*| \
28321
s390*-*linux*|s390*-*tpf*|sparc*-*linux*)
28322
# Find out which ABI we are using.
28323
echo 'int i;' > conftest.$ac_ext
28324
@@ -6519,7 +6519,10 @@
28326
LD="${LD-ld} -m elf_i386"
28328
- ppc64-*linux*|powerpc64-*linux*)
28329
+ powerpc64le-*linux*)
28330
+ LD="${LD-ld} -m elf32lppclinux"
28332
+ powerpc64-*linux*)
28333
LD="${LD-ld} -m elf32ppclinux"
28336
@@ -6538,7 +6541,10 @@
28338
LD="${LD-ld} -m elf_x86_64"
28340
- ppc*-*linux*|powerpc*-*linux*)
28341
+ powerpcle-*linux*)
28342
+ LD="${LD-ld} -m elf64lppc"
28345
LD="${LD-ld} -m elf64ppc"
28347
s390*-*linux*|s390*-*tpf*)
28348
@@ -11105,7 +11111,7 @@
28349
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
28350
lt_status=$lt_dlunknown
28351
cat > conftest.$ac_ext <<_LT_EOF
28352
-#line 11108 "configure"
28353
+#line 11114 "configure"
28354
#include "confdefs.h"
28357
@@ -11211,7 +11217,7 @@
28358
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
28359
lt_status=$lt_dlunknown
28360
cat > conftest.$ac_ext <<_LT_EOF
28361
-#line 11214 "configure"
28362
+#line 11220 "configure"
28363
#include "confdefs.h"
28366
--- a/src/libgo/testsuite/gotest
28367
+++ b/src/libgo/testsuite/gotest
28368
@@ -369,7 +369,7 @@
28372
- ppc64) text="D" ;;
28373
+ ppc64) text="[TD]" ;;
28376
symtogo='sed -e s/_test/XXXtest/ -e s/.*_\([^_]*\.\)/\1/ -e s/XXXtest/_test/'
28377
--- a/src/libgo/config/libtool.m4
28378
+++ b/src/libgo/config/libtool.m4
28379
@@ -1225,7 +1225,7 @@
28383
-x86_64-*kfreebsd*-gnu|x86_64-*linux*|ppc*-*linux*|powerpc*-*linux*| \
28384
+x86_64-*kfreebsd*-gnu|x86_64-*linux*|powerpc*-*linux*| \
28385
s390*-*linux*|s390*-*tpf*|sparc*-*linux*)
28386
# Find out which ABI we are using.
28387
echo 'int i;' > conftest.$ac_ext
28388
@@ -1239,7 +1239,10 @@
28390
LD="${LD-ld} -m elf_i386"
28392
- ppc64-*linux*|powerpc64-*linux*)
28393
+ powerpc64le-*linux*)
28394
+ LD="${LD-ld} -m elf32lppclinux"
28396
+ powerpc64-*linux*)
28397
LD="${LD-ld} -m elf32ppclinux"
28400
@@ -1258,7 +1261,10 @@
28402
LD="${LD-ld} -m elf_x86_64"
28404
- ppc*-*linux*|powerpc*-*linux*)
28405
+ powerpcle-*linux*)
28406
+ LD="${LD-ld} -m elf64lppc"
28409
LD="${LD-ld} -m elf64ppc"
28411
s390*-*linux*|s390*-*tpf*)
28412
--- a/src/config.sub
28413
+++ b/src/config.sub
28416
# Configuration validation subroutine script.
28417
-# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
28418
-# 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010,
28419
-# 2011, 2012, 2013 Free Software Foundation, Inc.
28420
+# Copyright 1992-2013 Free Software Foundation, Inc.
28422
-timestamp='2013-01-11'
28423
+timestamp='2013-10-01'
28425
# This file is free software; you can redistribute it and/or modify it
28426
# under the terms of the GNU General Public License as published by
28429
GNU config.sub ($timestamp)
28431
-Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
28432
-2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011,
28433
-2012, 2013 Free Software Foundation, Inc.
28434
+Copyright 1992-2013 Free Software Foundation, Inc.
28436
This is free software; see the source for copying conditions. There is NO
28437
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
28438
@@ -256,12 +252,12 @@
28439
| alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \
28440
| alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \
28444
| arm | arm[bl]e | arme[lb] | armv[2-8] | armv[3-8][lb] | armv7[arm] \
28448
- | c4x | clipper \
28449
+ | c4x | c8051 | clipper \
28450
| d10v | d30v | dlx | dsp16xx \
28452
| fido | fr30 | frv \
28453
@@ -269,6 +265,7 @@
28455
| i370 | i860 | i960 | ia64 \
28460
| m32c | m32r | m32rle | m68000 | m68k | m88k \
28461
@@ -297,10 +294,10 @@
28464
| nds32 | nds32le | nds32be \
28466
+ | nios | nios2 | nios2eb | nios2el \
28471
| pdp10 | pdp11 | pj | pjl \
28472
| powerpc | powerpc64 | powerpc64le | powerpcle \
28474
@@ -328,7 +325,7 @@
28476
basic_machine=tic6x-unknown
28478
- m6811 | m68hc11 | m6812 | m68hc12 | m68hcs12x | picochip)
28479
+ m6811 | m68hc11 | m6812 | m68hc12 | m68hcs12x | nvptx | picochip)
28480
basic_machine=$basic_machine-unknown
28483
@@ -370,13 +367,13 @@
28484
| aarch64-* | aarch64_be-* \
28485
| alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \
28486
| alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \
28487
- | alphapca5[67]-* | alpha64pca5[67]-* | arc-* \
28488
+ | alphapca5[67]-* | alpha64pca5[67]-* | arc-* | arceb-* \
28489
| arm-* | armbe-* | armle-* | armeb-* | armv*-* \
28490
| avr-* | avr32-* \
28491
| be32-* | be64-* \
28492
| bfin-* | bs2000-* \
28493
| c[123]* | c30-* | [cjt]90-* | c4x-* \
28494
- | clipper-* | craynv-* | cydra-* \
28495
+ | c8051-* | clipper-* | craynv-* | cydra-* \
28496
| d10v-* | d30v-* | dlx-* \
28498
| f30[01]-* | f700-* | fido-* | fr30-* | frv-* | fx80-* \
28499
@@ -385,6 +382,7 @@
28501
| i*86-* | i860-* | i960-* | ia64-* \
28502
| ip2k-* | iq2000-* \
28504
| le32-* | le64-* \
28506
| m32c-* | m32r-* | m32rle-* \
28507
@@ -414,7 +412,7 @@
28510
| nds32-* | nds32le-* | nds32be-* \
28511
- | nios-* | nios2-* \
28512
+ | nios-* | nios2-* | nios2eb-* | nios2el-* \
28513
| none-* | np1-* | ns16k-* | ns32k-* \
28516
@@ -798,7 +796,7 @@
28520
- basic_machine=i386-pc
28521
+ basic_machine=i686-pc
28525
@@ -834,7 +832,7 @@
28526
basic_machine=`echo $basic_machine | sed -e 's/ms1-/mt-/'`
28529
- basic_machine=i386-pc
28530
+ basic_machine=i686-pc
28534
@@ -1550,6 +1548,9 @@
28544
@@ -1593,6 +1594,9 @@
28554
--- a/src/ChangeLog.ibm
28555
+++ b/src/ChangeLog.ibm
28557
+2013-12-10 Alan Modra <amodra@gmail.com>
28559
+ Apply gcc-4_8-branch r205803
28560
+ 2013-12-05 Alan Modra <amodra@gmail.com>
28561
+ * gcc/configure.ac (BUILD_CXXFLAGS) Don't use ALL_CXXFLAGS for
28563
+ <recursive call for build != host>: Clear GMPINC. Don't bother
28565
+ * gcc/configure: Regenerate.
28567
+2013-11-18 Alan Modra <amodra@gmail.com>
28569
+ Backport mainline r205844.
28570
+ * libffi/src/powerpc/ffitarget.h: Import from upstream.
28571
+ * libffi/src/powerpc/ffi_powerpc.h: Likewise.
28572
+ * libffi/src/powerpc/ffi.c: Likewise.
28573
+ * libffi/src/powerpc/ffi_sysv.c: Likewise.
28574
+ * libffi/src/powerpc/ffi_linux64.c: Likewise.
28575
+ * libffi/src/powerpc/sysv.S: Likewise.
28576
+ * libffi/src/powerpc/ppc_closure.S: Likewise.
28577
+ * libffi/src/powerpc/linux64.S: Likewise.
28578
+ * libffi/src/powerpc/linux64_closure.S: Likewise.
28579
+ * libffi/src/types.c: Likewise.
28580
+ * libffi/Makefile.am (EXTRA_DIST): Add new src/powerpc files.
28581
+ (nodist_libffi_la_SOURCES <POWERPC, POWERPC_FREEBSD>): Likewise.
28582
+ * libffi/configure.ac (HAVE_LONG_DOUBLE_VARIANT): Define for powerpc.
28583
+ * libffi/include/ffi.h.in (ffi_prep_types): Declare.
28584
+ * libffi/src/prep_cif.c (ffi_prep_cif_core): Call ffi_prep_types.
28585
+ * libffi/configure: Regenerate.
28586
+ * libffi/fficonfig.h.in: Regenerate.
28587
+ * libffi/Makefile.in: Regenerate.
28588
+ * libffi/man/Makefile.in: Regenerate.
28589
+ * libffi/include/Makefile.in: Regenerate.
28590
+ * libffi/testsuite/Makefile.in: Regenerate.
28592
+2013-11-22 Ulrich Weigand <Ulrich.Weigand@de.ibm.com>
28594
+ * libgo/config/libtool.m4: Update to mainline version.
28595
+ * libgo/configure: Regenerate.
28597
+2013-11-19 Ulrich Weigand <Ulrich.Weigand@de.ibm.com>
28599
+ Backport from mainline r205000.
28601
+ gotest: Recognize PPC ELF v2 function pointers in text section.
28603
+2013-11-18 Alan Modra <amodra@gmail.com>
28605
+ * libffi/src/powerpc/ppc_closure.S: Don't bl .Luint128.
28607
+ * libffi/src/powerpc/ffitarget.h: Import from upstream.
28608
+ * libffi/src/powerpc/ffi.c: Likewise.
28609
+ * libffi/src/powerpc/linux64.S: Likewise.
28610
+ * libffi/src/powerpc/linux64_closure.S: Likewise.
28611
+ * libffi/doc/libffi.texi: Likewise.
28612
+ * libffi/testsuite/libffi.call/cls_double_va.c: Likewise.
28613
+ * libffi/testsuite/libffi.call/cls_longdouble_va.c: Likewise.
28615
+2013-11-17 Ulrich Weigand <Ulrich.Weigand@de.ibm.com>
28617
+ * libgo/config/libtool.m4: Update to mainline version.
28618
+ * libgo/configure: Regenerate.
28620
+2013-11-15 Ulrich Weigand <Ulrich.Weigand@de.ibm.com>
28622
+ * libtool.m4: Update to mainline version.
28623
+ * libjava/libltdl/acinclude.m4: Likewise.
28625
+ * gcc/configure: Regenerate.
28626
+ * boehm-gc/configure: Regenerate.
28627
+ * libatomic/configure: Regenerate.
28628
+ * libbacktrace/configure: Regenerate.
28629
+ * libffi/configure: Regenerate.
28630
+ * libgfortran/configure: Regenerate.
28631
+ * libgomp/configure: Regenerate.
28632
+ * libitm/configure: Regenerate.
28633
+ * libjava/configure: Regenerate.
28634
+ * libjava/libltdl/configure: Regenerate.
28635
+ * libjava/classpath/configure: Regenerate.
28636
+ * libmudflap/configure: Regenerate.
28637
+ * libobjc/configure: Regenerate.
28638
+ * libquadmath/configure: Regenerate.
28639
+ * libsanitizer/configure: Regenerate.
28640
+ * libssp/configure: Regenerate.
28641
+ * libstdc++-v3/configure: Regenerate.
28642
+ * lto-plugin/configure: Regenerate.
28643
+ * zlib/configure: Regenerate.
28645
+2013-11-15 Ulrich Weigand <Ulrich.Weigand@de.ibm.com>
28647
+ Backport from mainline r203071:
28649
+ 2013-10-01 Joern Rennecke <joern.rennecke@embecosm.com>
28651
+ Import from savannah.gnu.org:
28652
+ * config.guess: Update to 2013-06-10 version.
28653
+ * config.sub: Update to 2013-10-01 version.
28655
+2013-11-12 Bill Schmidt <wschmidt@linux.ibm.com>
28657
+ Backport from mainline
28658
+ 2013-09-20 Alan Modra <amodra@gmail.com>
28660
+ * libtool.m4 (_LT_ENABLE_LOCK <ld -m flags>): Remove non-canonical
28661
+ ppc host match. Support little-endian powerpc linux hosts.
28663
--- a/src/libobjc/configure
28664
+++ b/src/libobjc/configure
28665
@@ -6056,7 +6056,7 @@
28669
-x86_64-*kfreebsd*-gnu|x86_64-*linux*|ppc*-*linux*|powerpc*-*linux*| \
28670
+x86_64-*kfreebsd*-gnu|x86_64-*linux*|powerpc*-*linux*| \
28671
s390*-*linux*|s390*-*tpf*|sparc*-*linux*)
28672
# Find out which ABI we are using.
28673
echo 'int i;' > conftest.$ac_ext
28674
@@ -6081,7 +6081,10 @@
28678
- ppc64-*linux*|powerpc64-*linux*)
28679
+ powerpc64le-*linux*)
28680
+ LD="${LD-ld} -m elf32lppclinux"
28682
+ powerpc64-*linux*)
28683
LD="${LD-ld} -m elf32ppclinux"
28686
@@ -6100,7 +6103,10 @@
28688
LD="${LD-ld} -m elf_x86_64"
28690
- ppc*-*linux*|powerpc*-*linux*)
28691
+ powerpcle-*linux*)
28692
+ LD="${LD-ld} -m elf64lppc"
28695
LD="${LD-ld} -m elf64ppc"
28697
s390*-*linux*|s390*-*tpf*)
28698
@@ -10595,7 +10601,7 @@
28699
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
28700
lt_status=$lt_dlunknown
28701
cat > conftest.$ac_ext <<_LT_EOF
28702
-#line 10598 "configure"
28703
+#line 10604 "configure"
28704
#include "confdefs.h"
28707
@@ -10701,7 +10707,7 @@
28708
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
28709
lt_status=$lt_dlunknown
28710
cat > conftest.$ac_ext <<_LT_EOF
28711
-#line 10704 "configure"
28712
+#line 10710 "configure"
28713
#include "confdefs.h"
28716
@@ -11472,7 +11478,7 @@
28717
enableval=$enable_sjlj_exceptions; :
28719
cat > conftest.$ac_ext << EOF
28720
-#line 11475 "configure"
28721
+#line 11481 "configure"
28724
@implementation Frob
28725
--- a/src/libgfortran/configure
28726
+++ b/src/libgfortran/configure
28727
@@ -8062,7 +8062,7 @@
28731
-x86_64-*kfreebsd*-gnu|x86_64-*linux*|ppc*-*linux*|powerpc*-*linux*| \
28732
+x86_64-*kfreebsd*-gnu|x86_64-*linux*|powerpc*-*linux*| \
28733
s390*-*linux*|s390*-*tpf*|sparc*-*linux*)
28734
# Find out which ABI we are using.
28735
echo 'int i;' > conftest.$ac_ext
28736
@@ -8087,7 +8087,10 @@
28740
- ppc64-*linux*|powerpc64-*linux*)
28741
+ powerpc64le-*linux*)
28742
+ LD="${LD-ld} -m elf32lppclinux"
28744
+ powerpc64-*linux*)
28745
LD="${LD-ld} -m elf32ppclinux"
28748
@@ -8106,7 +8109,10 @@
28750
LD="${LD-ld} -m elf_x86_64"
28752
- ppc*-*linux*|powerpc*-*linux*)
28753
+ powerpcle-*linux*)
28754
+ LD="${LD-ld} -m elf64lppc"
28757
LD="${LD-ld} -m elf64ppc"
28759
s390*-*linux*|s390*-*tpf*)
28760
@@ -12333,7 +12339,7 @@
28761
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
28762
lt_status=$lt_dlunknown
28763
cat > conftest.$ac_ext <<_LT_EOF
28764
-#line 12336 "configure"
28765
+#line 12342 "configure"
28766
#include "confdefs.h"
28769
@@ -12439,7 +12445,7 @@
28770
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
28771
lt_status=$lt_dlunknown
28772
cat > conftest.$ac_ext <<_LT_EOF
28773
-#line 12442 "configure"
28774
+#line 12448 "configure"
28775
#include "confdefs.h"
28778
--- a/src/libffi/configure
28779
+++ b/src/libffi/configure
28780
@@ -613,6 +613,7 @@
28781
FFI_EXEC_TRAMPOLINE_TABLE
28782
FFI_EXEC_TRAMPOLINE_TABLE_FALSE
28783
FFI_EXEC_TRAMPOLINE_TABLE_TRUE
28784
+HAVE_LONG_DOUBLE_VARIANT
28788
@@ -6392,7 +6393,7 @@
28792
-x86_64-*kfreebsd*-gnu|x86_64-*linux*|ppc*-*linux*|powerpc*-*linux*| \
28793
+x86_64-*kfreebsd*-gnu|x86_64-*linux*|powerpc*-*linux*| \
28794
s390*-*linux*|s390*-*tpf*|sparc*-*linux*)
28795
# Find out which ABI we are using.
28796
echo 'int i;' > conftest.$ac_ext
28797
@@ -6417,7 +6418,10 @@
28801
- ppc64-*linux*|powerpc64-*linux*)
28802
+ powerpc64le-*linux*)
28803
+ LD="${LD-ld} -m elf32lppclinux"
28805
+ powerpc64-*linux*)
28806
LD="${LD-ld} -m elf32ppclinux"
28809
@@ -6436,7 +6440,10 @@
28811
LD="${LD-ld} -m elf_x86_64"
28813
- ppc*-*linux*|powerpc*-*linux*)
28814
+ powerpcle-*linux*)
28815
+ LD="${LD-ld} -m elf64lppc"
28818
LD="${LD-ld} -m elf64ppc"
28820
s390*-*linux*|s390*-*tpf*)
28821
@@ -10900,7 +10907,7 @@
28822
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
28823
lt_status=$lt_dlunknown
28824
cat > conftest.$ac_ext <<_LT_EOF
28825
-#line 10903 "configure"
28826
+#line 10910 "configure"
28827
#include "confdefs.h"
28830
@@ -11006,7 +11013,7 @@
28831
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
28832
lt_status=$lt_dlunknown
28833
cat > conftest.$ac_ext <<_LT_EOF
28834
-#line 11009 "configure"
28835
+#line 11016 "configure"
28836
#include "confdefs.h"
28839
@@ -11443,6 +11450,7 @@
28842
TARGETDIR="unknown"
28843
+HAVE_LONG_DOUBLE_VARIANT=0
28846
TARGET=AARCH64; TARGETDIR=aarch64
28847
@@ -11540,6 +11548,7 @@
28849
powerpc*-*-linux* | powerpc-*-sysv*)
28850
TARGET=POWERPC; TARGETDIR=powerpc
28851
+ HAVE_LONG_DOUBLE_VARIANT=1
28853
powerpc-*-amigaos*)
28854
TARGET=POWERPC; TARGETDIR=powerpc
28855
@@ -11555,6 +11564,7 @@
28857
powerpc-*-freebsd* | powerpc-*-openbsd*)
28858
TARGET=POWERPC_FREEBSD; TARGETDIR=powerpc
28859
+ HAVE_LONG_DOUBLE_VARIANT=1
28861
powerpc64-*-freebsd*)
28862
TARGET=POWERPC; TARGETDIR=powerpc
28863
@@ -12230,17 +12240,25 @@
28864
# Also AC_SUBST this variable for ffi.h.
28865
if test -z "$HAVE_LONG_DOUBLE"; then
28867
- if test $ac_cv_sizeof_double != $ac_cv_sizeof_long_double; then
28868
- if test $ac_cv_sizeof_long_double != 0; then
28869
+ if test $ac_cv_sizeof_long_double != 0; then
28870
+ if test $HAVE_LONG_DOUBLE_VARIANT != 0; then
28872
+$as_echo "#define HAVE_LONG_DOUBLE_VARIANT 1" >>confdefs.h
28876
+ if test $ac_cv_sizeof_double != $ac_cv_sizeof_long_double; then
28877
+ HAVE_LONG_DOUBLE=1
28879
$as_echo "#define HAVE_LONG_DOUBLE 1" >>confdefs.h
28888
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether byte ordering is bigendian" >&5
28889
$as_echo_n "checking whether byte ordering is bigendian... " >&6; }
28890
if test "${ac_cv_c_bigendian+set}" = set; then :
28891
--- a/src/libffi/Makefile.in
28892
+++ b/src/libffi/Makefile.in
28893
@@ -48,10 +48,10 @@
28894
@IA64_TRUE@am__append_11 = src/ia64/ffi.c src/ia64/unix.S
28895
@M32R_TRUE@am__append_12 = src/m32r/sysv.S src/m32r/ffi.c
28896
@M68K_TRUE@am__append_13 = src/m68k/ffi.c src/m68k/sysv.S
28897
-@POWERPC_TRUE@am__append_14 = src/powerpc/ffi.c src/powerpc/sysv.S src/powerpc/ppc_closure.S src/powerpc/linux64.S src/powerpc/linux64_closure.S
28898
+@POWERPC_TRUE@am__append_14 = src/powerpc/ffi.c src/powerpc/ffi_sysv.c src/powerpc/ffi_linux64.c src/powerpc/sysv.S src/powerpc/ppc_closure.S src/powerpc/linux64.S src/powerpc/linux64_closure.S
28899
@POWERPC_AIX_TRUE@am__append_15 = src/powerpc/ffi_darwin.c src/powerpc/aix.S src/powerpc/aix_closure.S
28900
@POWERPC_DARWIN_TRUE@am__append_16 = src/powerpc/ffi_darwin.c src/powerpc/darwin.S src/powerpc/darwin_closure.S
28901
-@POWERPC_FREEBSD_TRUE@am__append_17 = src/powerpc/ffi.c src/powerpc/sysv.S src/powerpc/ppc_closure.S
28902
+@POWERPC_FREEBSD_TRUE@am__append_17 = src/powerpc/ffi.c src/powerpc/ffi_sysv.c src/powerpc/sysv.S src/powerpc/ppc_closure.S
28903
@AARCH64_TRUE@am__append_18 = src/aarch64/sysv.S src/aarch64/ffi.c
28904
@ARM_TRUE@am__append_19 = src/arm/sysv.S src/arm/ffi.c
28905
@ARM_TRUE@@FFI_EXEC_TRAMPOLINE_TABLE_TRUE@am__append_20 = src/arm/trampoline.S
28906
@@ -133,7 +133,9 @@
28907
@IA64_TRUE@am__objects_11 = src/ia64/ffi.lo src/ia64/unix.lo
28908
@M32R_TRUE@am__objects_12 = src/m32r/sysv.lo src/m32r/ffi.lo
28909
@M68K_TRUE@am__objects_13 = src/m68k/ffi.lo src/m68k/sysv.lo
28910
-@POWERPC_TRUE@am__objects_14 = src/powerpc/ffi.lo src/powerpc/sysv.lo \
28911
+@POWERPC_TRUE@am__objects_14 = src/powerpc/ffi.lo \
28912
+@POWERPC_TRUE@ src/powerpc/ffi_sysv.lo \
28913
+@POWERPC_TRUE@ src/powerpc/ffi_linux64.lo src/powerpc/sysv.lo \
28914
@POWERPC_TRUE@ src/powerpc/ppc_closure.lo \
28915
@POWERPC_TRUE@ src/powerpc/linux64.lo \
28916
@POWERPC_TRUE@ src/powerpc/linux64_closure.lo
28917
@@ -144,6 +146,7 @@
28918
@POWERPC_DARWIN_TRUE@ src/powerpc/darwin.lo \
28919
@POWERPC_DARWIN_TRUE@ src/powerpc/darwin_closure.lo
28920
@POWERPC_FREEBSD_TRUE@am__objects_17 = src/powerpc/ffi.lo \
28921
+@POWERPC_FREEBSD_TRUE@ src/powerpc/ffi_sysv.lo \
28922
@POWERPC_FREEBSD_TRUE@ src/powerpc/sysv.lo \
28923
@POWERPC_FREEBSD_TRUE@ src/powerpc/ppc_closure.lo
28924
@AARCH64_TRUE@am__objects_18 = src/aarch64/sysv.lo src/aarch64/ffi.lo
28925
@@ -278,6 +281,7 @@
28928
HAVE_LONG_DOUBLE = @HAVE_LONG_DOUBLE@
28929
+HAVE_LONG_DOUBLE_VARIANT = @HAVE_LONG_DOUBLE_VARIANT@
28930
INSTALL = @INSTALL@
28931
INSTALL_DATA = @INSTALL_DATA@
28932
INSTALL_PROGRAM = @INSTALL_PROGRAM@
28933
@@ -387,10 +391,12 @@
28934
src/ia64/unix.S src/mips/ffi.c src/mips/n32.S src/mips/o32.S \
28935
src/mips/ffitarget.h src/m32r/ffi.c src/m32r/sysv.S \
28936
src/m32r/ffitarget.h src/m68k/ffi.c src/m68k/sysv.S \
28937
- src/m68k/ffitarget.h src/powerpc/ffi.c src/powerpc/sysv.S \
28938
- src/powerpc/linux64.S src/powerpc/linux64_closure.S \
28939
- src/powerpc/ppc_closure.S src/powerpc/asm.h \
28940
- src/powerpc/aix.S src/powerpc/darwin.S \
28941
+ src/m68k/ffitarget.h \
28942
+ src/powerpc/ffi.c src/powerpc/ffi_powerpc.h \
28943
+ src/powerpc/ffi_sysv.c src/powerpc/ffi_linux64.c \
28944
+ src/powerpc/sysv.S src/powerpc/linux64.S \
28945
+ src/powerpc/linux64_closure.S src/powerpc/ppc_closure.S \
28946
+ src/powerpc/asm.h src/powerpc/aix.S src/powerpc/darwin.S \
28947
src/powerpc/aix_closure.S src/powerpc/darwin_closure.S \
28948
src/powerpc/ffi_darwin.c src/powerpc/ffitarget.h \
28949
src/s390/ffi.c src/s390/sysv.S src/s390/ffitarget.h \
28950
@@ -711,6 +717,10 @@
28951
@: > src/powerpc/$(DEPDIR)/$(am__dirstamp)
28952
src/powerpc/ffi.lo: src/powerpc/$(am__dirstamp) \
28953
src/powerpc/$(DEPDIR)/$(am__dirstamp)
28954
+src/powerpc/ffi_sysv.lo: src/powerpc/$(am__dirstamp) \
28955
+ src/powerpc/$(DEPDIR)/$(am__dirstamp)
28956
+src/powerpc/ffi_linux64.lo: src/powerpc/$(am__dirstamp) \
28957
+ src/powerpc/$(DEPDIR)/$(am__dirstamp)
28958
src/powerpc/sysv.lo: src/powerpc/$(am__dirstamp) \
28959
src/powerpc/$(DEPDIR)/$(am__dirstamp)
28960
src/powerpc/ppc_closure.lo: src/powerpc/$(am__dirstamp) \
28961
@@ -912,6 +922,10 @@
28962
-rm -f src/powerpc/ffi.lo
28963
-rm -f src/powerpc/ffi_darwin.$(OBJEXT)
28964
-rm -f src/powerpc/ffi_darwin.lo
28965
+ -rm -f src/powerpc/ffi_linux64.$(OBJEXT)
28966
+ -rm -f src/powerpc/ffi_linux64.lo
28967
+ -rm -f src/powerpc/ffi_sysv.$(OBJEXT)
28968
+ -rm -f src/powerpc/ffi_sysv.lo
28969
-rm -f src/powerpc/linux64.$(OBJEXT)
28970
-rm -f src/powerpc/linux64.lo
28971
-rm -f src/powerpc/linux64_closure.$(OBJEXT)
28972
@@ -1009,6 +1023,8 @@
28973
@AMDEP_TRUE@@am__include@ @am__quote@src/powerpc/$(DEPDIR)/darwin_closure.Plo@am__quote@
28974
@AMDEP_TRUE@@am__include@ @am__quote@src/powerpc/$(DEPDIR)/ffi.Plo@am__quote@
28975
@AMDEP_TRUE@@am__include@ @am__quote@src/powerpc/$(DEPDIR)/ffi_darwin.Plo@am__quote@
28976
+@AMDEP_TRUE@@am__include@ @am__quote@src/powerpc/$(DEPDIR)/ffi_linux64.Plo@am__quote@
28977
+@AMDEP_TRUE@@am__include@ @am__quote@src/powerpc/$(DEPDIR)/ffi_sysv.Plo@am__quote@
28978
@AMDEP_TRUE@@am__include@ @am__quote@src/powerpc/$(DEPDIR)/linux64.Plo@am__quote@
28979
@AMDEP_TRUE@@am__include@ @am__quote@src/powerpc/$(DEPDIR)/linux64_closure.Plo@am__quote@
28980
@AMDEP_TRUE@@am__include@ @am__quote@src/powerpc/$(DEPDIR)/ppc_closure.Plo@am__quote@
28981
--- a/src/libffi/include/ffi.h.in
28982
+++ b/src/libffi/include/ffi.h.in
28983
@@ -207,6 +207,11 @@
28987
+#if HAVE_LONG_DOUBLE_VARIANT
28988
+/* Used to adjust size/alignment of ffi types. */
28989
+void ffi_prep_types (ffi_abi abi);
28992
/* Used internally, but overridden by some architectures */
28993
ffi_status ffi_prep_cif_core(ffi_cif *cif,
28995
--- a/src/libffi/include/Makefile.in
28996
+++ b/src/libffi/include/Makefile.in
28997
@@ -113,6 +113,7 @@
29000
HAVE_LONG_DOUBLE = @HAVE_LONG_DOUBLE@
29001
+HAVE_LONG_DOUBLE_VARIANT = @HAVE_LONG_DOUBLE_VARIANT@
29002
INSTALL = @INSTALL@
29003
INSTALL_DATA = @INSTALL_DATA@
29004
INSTALL_PROGRAM = @INSTALL_PROGRAM@
29005
--- a/src/libffi/fficonfig.h.in
29006
+++ b/src/libffi/fficonfig.h.in
29008
/* Define if you have the long double type and it is bigger than a double */
29009
#undef HAVE_LONG_DOUBLE
29011
+/* Define if you support more than one size of the long double type */
29012
+#undef HAVE_LONG_DOUBLE_VARIANT
29014
/* Define to 1 if you have the `memcpy' function. */
29017
--- a/src/libffi/src/powerpc/ppc_closure.S
29018
+++ b/src/libffi/src/powerpc/ppc_closure.S
29021
.file "ppc_closure.S"
29023
-#ifndef __powerpc64__
29026
ENTRY(ffi_closure_SYSV)
29028
@@ -238,7 +238,7 @@
29035
# The return types below are only used when the ABI type is FFI_SYSV.
29036
# case FFI_SYSV_TYPE_SMALL_STRUCT + 1. One byte struct.
29037
@@ -378,8 +378,7 @@
29043
#if defined __ELF__ && defined __linux__
29044
.section .note.GNU-stack,"",@progbits
29047
--- a/src/libffi/src/powerpc/ffitarget.h
29048
+++ b/src/libffi/src/powerpc/ffitarget.h
29049
@@ -60,45 +60,76 @@
29050
typedef enum ffi_abi {
29058
- FFI_LINUX_SOFT_FLOAT,
29059
-# if defined(POWERPC64)
29060
- FFI_DEFAULT_ABI = FFI_LINUX64,
29061
-# elif defined(__NO_FPRS__)
29062
- FFI_DEFAULT_ABI = FFI_LINUX_SOFT_FLOAT,
29063
-# elif (__LDBL_MANT_DIG__ == 106)
29064
- FFI_DEFAULT_ABI = FFI_LINUX,
29066
- FFI_DEFAULT_ABI = FFI_GCC_SYSV,
29070
-#ifdef POWERPC_AIX
29071
+#if defined (POWERPC_AIX)
29074
FFI_DEFAULT_ABI = FFI_AIX,
29078
-#ifdef POWERPC_DARWIN
29079
+#elif defined (POWERPC_DARWIN)
29082
FFI_DEFAULT_ABI = FFI_DARWIN,
29086
-#ifdef POWERPC_FREEBSD
29091
- FFI_LINUX_SOFT_FLOAT,
29092
- FFI_DEFAULT_ABI = FFI_SYSV,
29094
+ /* The FFI_COMPAT values are used by old code. Since libffi may be
29095
+ a shared library we have to support old values for backwards
29096
+ compatibility. */
29098
+ FFI_COMPAT_GCC_SYSV,
29099
+ FFI_COMPAT_LINUX64,
29100
+ FFI_COMPAT_LINUX,
29101
+ FFI_COMPAT_LINUX_SOFT_FLOAT,
29103
+# if defined (POWERPC64)
29104
+ /* This bit, always set in new code, must not be set in any of the
29105
+ old FFI_COMPAT values that might be used for 64-bit linux. We
29106
+ only need worry about FFI_COMPAT_LINUX64, but to be safe avoid
29107
+ all old values. */
29109
+ /* This and following bits can reuse FFI_COMPAT values. */
29110
+ FFI_LINUX_STRUCT_ALIGN = 1,
29111
+ FFI_LINUX_LONG_DOUBLE_128 = 2,
29112
+ FFI_DEFAULT_ABI = (FFI_LINUX
29113
+# ifdef __STRUCT_PARM_ALIGN__
29114
+ | FFI_LINUX_STRUCT_ALIGN
29116
+# ifdef __LONG_DOUBLE_128__
29117
+ | FFI_LINUX_LONG_DOUBLE_128
29120
+ FFI_LAST_ABI = 12
29123
+ /* This bit, always set in new code, must not be set in any of the
29124
+ old FFI_COMPAT values that might be used for 32-bit linux/sysv/bsd. */
29126
+ /* This and following bits can reuse FFI_COMPAT values. */
29127
+ FFI_SYSV_SOFT_FLOAT = 1,
29128
+ FFI_SYSV_STRUCT_RET = 2,
29129
+ FFI_SYSV_IBM_LONG_DOUBLE = 4,
29130
+ FFI_SYSV_LONG_DOUBLE_128 = 16,
29132
+ FFI_DEFAULT_ABI = (FFI_SYSV
29133
+# ifdef __NO_FPRS__
29134
+ | FFI_SYSV_SOFT_FLOAT
29136
+# if (defined (__SVR4_STRUCT_RETURN) \
29137
+ || defined (POWERPC_FREEBSD) && !defined (__AIX_STRUCT_RETURN))
29138
+ | FFI_SYSV_STRUCT_RET
29140
+# if __LDBL_MANT_DIG__ == 106
29141
+ | FFI_SYSV_IBM_LONG_DOUBLE
29143
+# ifdef __LONG_DOUBLE_128__
29144
+ | FFI_SYSV_LONG_DOUBLE_128
29147
+ FFI_LAST_ABI = 32
29155
@@ -106,6 +137,10 @@
29157
#define FFI_CLOSURES 1
29158
#define FFI_NATIVE_RAW_API 0
29159
+#if defined (POWERPC) || defined (POWERPC_FREEBSD)
29160
+# define FFI_TARGET_SPECIFIC_VARIADIC 1
29161
+# define FFI_EXTRA_CIF_FIELDS unsigned nfixedargs
29164
/* For additional types like the below, take care about the order in
29165
ppc_closures.S. They must follow after the FFI_TYPE_LAST. */
29166
@@ -113,19 +148,26 @@
29167
/* Needed for soft-float long-double-128 support. */
29168
#define FFI_TYPE_UINT128 (FFI_TYPE_LAST + 1)
29170
-/* Needed for FFI_SYSV small structure returns.
29171
- We use two flag bits, (FLAG_SYSV_SMST_R3, FLAG_SYSV_SMST_R4) which are
29172
- defined in ffi.c, to determine the exact return type and its size. */
29173
+/* Needed for FFI_SYSV small structure returns. */
29174
#define FFI_SYSV_TYPE_SMALL_STRUCT (FFI_TYPE_LAST + 2)
29176
-#if defined(POWERPC64) || defined(POWERPC_AIX)
29177
+/* Used by ELFv2 for homogenous structure returns. */
29178
+#define FFI_V2_TYPE_FLOAT_HOMOG (FFI_TYPE_LAST + 1)
29179
+#define FFI_V2_TYPE_DOUBLE_HOMOG (FFI_TYPE_LAST + 2)
29180
+#define FFI_V2_TYPE_SMALL_STRUCT (FFI_TYPE_LAST + 3)
29182
+#if _CALL_ELF == 2
29183
+# define FFI_TRAMPOLINE_SIZE 32
29185
+# if defined(POWERPC64) || defined(POWERPC_AIX)
29186
# if defined(POWERPC_DARWIN64)
29187
# define FFI_TRAMPOLINE_SIZE 48
29189
# define FFI_TRAMPOLINE_SIZE 24
29191
-#else /* POWERPC || POWERPC_AIX */
29192
+# else /* POWERPC || POWERPC_AIX */
29193
# define FFI_TRAMPOLINE_SIZE 40
29198
--- a/src/libffi/src/powerpc/ffi.c
29199
+++ b/src/libffi/src/powerpc/ffi.c
29201
/* -----------------------------------------------------------------------
29202
- ffi.c - Copyright (C) 2011 Anthony Green
29203
+ ffi.c - Copyright (C) 2013 IBM
29204
+ Copyright (C) 2011 Anthony Green
29205
Copyright (C) 2011 Kyle Moffett
29206
Copyright (C) 2008 Red Hat, Inc
29207
Copyright (C) 2007, 2008 Free Software Foundation, Inc
29208
@@ -27,966 +28,104 @@
29209
OTHER DEALINGS IN THE SOFTWARE.
29210
----------------------------------------------------------------------- */
29213
-#include <ffi_common.h>
29215
+#include "ffi_common.h"
29216
+#include "ffi_powerpc.h"
29218
-#include <stdlib.h>
29219
-#include <stdio.h>
29222
-extern void ffi_closure_SYSV (void);
29223
-extern void FFI_HIDDEN ffi_closure_LINUX64 (void);
29226
- /* The assembly depends on these exact flags. */
29227
- FLAG_RETURNS_SMST = 1 << (31-31), /* Used for FFI_SYSV small structs. */
29228
- FLAG_RETURNS_NOTHING = 1 << (31-30), /* These go in cr7 */
29229
-#ifndef __NO_FPRS__
29230
- FLAG_RETURNS_FP = 1 << (31-29),
29232
- FLAG_RETURNS_64BITS = 1 << (31-28),
29234
- FLAG_RETURNS_128BITS = 1 << (31-27), /* cr6 */
29236
- FLAG_ARG_NEEDS_COPY = 1 << (31- 7),
29237
-#ifndef __NO_FPRS__
29238
- FLAG_FP_ARGUMENTS = 1 << (31- 6), /* cr1.eq; specified by ABI */
29240
- FLAG_4_GPR_ARGUMENTS = 1 << (31- 5),
29241
- FLAG_RETVAL_REFERENCE = 1 << (31- 4)
29244
-/* About the SYSV ABI. */
29245
-#define ASM_NEEDS_REGISTERS 4
29246
-#define NUM_GPR_ARG_REGISTERS 8
29247
-#ifndef __NO_FPRS__
29248
-# define NUM_FPR_ARG_REGISTERS 8
29251
-/* ffi_prep_args_SYSV is called by the assembly routine once stack space
29252
- has been allocated for the function's arguments.
29254
- The stack layout we want looks like this:
29256
- | Return address from ffi_call_SYSV 4bytes | higher addresses
29257
- |--------------------------------------------|
29258
- | Previous backchain pointer 4 | stack pointer here
29259
- |--------------------------------------------|<+ <<< on entry to
29260
- | Saved r28-r31 4*4 | | ffi_call_SYSV
29261
- |--------------------------------------------| |
29262
- | GPR registers r3-r10 8*4 | | ffi_call_SYSV
29263
- |--------------------------------------------| |
29264
- | FPR registers f1-f8 (optional) 8*8 | |
29265
- |--------------------------------------------| | stack |
29266
- | Space for copied structures | | grows |
29267
- |--------------------------------------------| | down V
29268
- | Parameters that didn't fit in registers | |
29269
- |--------------------------------------------| | lower addresses
29270
- | Space for callee's LR 4 | |
29271
- |--------------------------------------------| | stack pointer here
29272
- | Current backchain pointer 4 |-/ during
29273
- |--------------------------------------------| <<< ffi_call_SYSV
29278
-ffi_prep_args_SYSV (extended_cif *ecif, unsigned *const stack)
29279
+#if HAVE_LONG_DOUBLE_VARIANT
29280
+/* Adjust ffi_type_longdouble. */
29282
+ffi_prep_types (ffi_abi abi)
29284
- const unsigned bytes = ecif->cif->bytes;
29285
- const unsigned flags = ecif->cif->flags;
29295
- /* 'stacktop' points at the previous backchain pointer. */
29298
- /* 'gpr_base' points at the space for gpr3, and grows upwards as
29299
- we use GPR registers. */
29301
- int intarg_count;
29303
-#ifndef __NO_FPRS__
29304
- /* 'fpr_base' points at the space for fpr1, and grows upwards as
29305
- we use FPR registers. */
29310
- /* 'copy_space' grows down as we put structures in it. It should
29311
- stay 16-byte aligned. */
29314
- /* 'next_arg' grows up as we put parameters in it. */
29319
-#ifndef __NO_FPRS__
29320
- double double_tmp;
29325
- signed char **sc;
29326
- unsigned char **uc;
29327
- signed short **ss;
29328
- unsigned short **us;
29329
- unsigned int **ui;
29334
- size_t struct_copy_size;
29335
- unsigned gprvalue;
29337
- stacktop.c = (char *) stack + bytes;
29338
- gpr_base.u = stacktop.u - ASM_NEEDS_REGISTERS - NUM_GPR_ARG_REGISTERS;
29339
- intarg_count = 0;
29340
-#ifndef __NO_FPRS__
29341
- fpr_base.d = gpr_base.d - NUM_FPR_ARG_REGISTERS;
29343
- copy_space.c = ((flags & FLAG_FP_ARGUMENTS) ? fpr_base.c : gpr_base.c);
29345
- copy_space.c = gpr_base.c;
29347
- next_arg.u = stack + 2;
29349
- /* Check that everything starts aligned properly. */
29350
- FFI_ASSERT (((unsigned long) (char *) stack & 0xF) == 0);
29351
- FFI_ASSERT (((unsigned long) copy_space.c & 0xF) == 0);
29352
- FFI_ASSERT (((unsigned long) stacktop.c & 0xF) == 0);
29353
- FFI_ASSERT ((bytes & 0xF) == 0);
29354
- FFI_ASSERT (copy_space.c >= next_arg.c);
29356
- /* Deal with return values that are actually pass-by-reference. */
29357
- if (flags & FLAG_RETVAL_REFERENCE)
29359
- *gpr_base.u++ = (unsigned long) (char *) ecif->rvalue;
29363
- /* Now for the arguments. */
29364
- p_argv.v = ecif->avalue;
29365
- for (ptr = ecif->cif->arg_types, i = ecif->cif->nargs;
29367
- i--, ptr++, p_argv.v++)
29369
- unsigned short typenum = (*ptr)->type;
29371
- /* We may need to handle some values depending on ABI */
29372
- if (ecif->cif->abi == FFI_LINUX_SOFT_FLOAT) {
29373
- if (typenum == FFI_TYPE_FLOAT)
29374
- typenum = FFI_TYPE_UINT32;
29375
- if (typenum == FFI_TYPE_DOUBLE)
29376
- typenum = FFI_TYPE_UINT64;
29377
- if (typenum == FFI_TYPE_LONGDOUBLE)
29378
- typenum = FFI_TYPE_UINT128;
29379
- } else if (ecif->cif->abi != FFI_LINUX) {
29380
-#if FFI_TYPE_LONGDOUBLE != FFI_TYPE_DOUBLE
29381
- if (typenum == FFI_TYPE_LONGDOUBLE)
29382
- typenum = FFI_TYPE_STRUCT;
29386
- /* Now test the translated value */
29387
- switch (typenum) {
29388
-#ifndef __NO_FPRS__
29389
- case FFI_TYPE_FLOAT:
29390
- /* With FFI_LINUX_SOFT_FLOAT floats are handled like UINT32. */
29391
- double_tmp = **p_argv.f;
29392
- if (fparg_count >= NUM_FPR_ARG_REGISTERS)
29394
- *next_arg.f = (float) double_tmp;
29399
- *fpr_base.d++ = double_tmp;
29401
- FFI_ASSERT (flags & FLAG_FP_ARGUMENTS);
29404
- case FFI_TYPE_DOUBLE:
29405
- /* With FFI_LINUX_SOFT_FLOAT doubles are handled like UINT64. */
29406
- double_tmp = **p_argv.d;
29408
- if (fparg_count >= NUM_FPR_ARG_REGISTERS)
29410
- if (intarg_count >= NUM_GPR_ARG_REGISTERS
29411
- && intarg_count % 2 != 0)
29416
- *next_arg.d = double_tmp;
29420
- *fpr_base.d++ = double_tmp;
29422
- FFI_ASSERT (flags & FLAG_FP_ARGUMENTS);
29425
-#if FFI_TYPE_LONGDOUBLE != FFI_TYPE_DOUBLE
29426
- case FFI_TYPE_LONGDOUBLE:
29427
- double_tmp = (*p_argv.d)[0];
29429
- if (fparg_count >= NUM_FPR_ARG_REGISTERS - 1)
29431
- if (intarg_count >= NUM_GPR_ARG_REGISTERS
29432
- && intarg_count % 2 != 0)
29437
- *next_arg.d = double_tmp;
29439
- double_tmp = (*p_argv.d)[1];
29440
- *next_arg.d = double_tmp;
29445
- *fpr_base.d++ = double_tmp;
29446
- double_tmp = (*p_argv.d)[1];
29447
- *fpr_base.d++ = double_tmp;
29450
- fparg_count += 2;
29451
- FFI_ASSERT (flags & FLAG_FP_ARGUMENTS);
29454
-#endif /* have FPRs */
29457
- * The soft float ABI for long doubles works like this, a long double
29458
- * is passed in four consecutive GPRs if available. A maximum of 2
29459
- * long doubles can be passed in gprs. If we do not have 4 GPRs
29460
- * left, the long double is passed on the stack, 4-byte aligned.
29462
- case FFI_TYPE_UINT128: {
29463
- unsigned int int_tmp = (*p_argv.ui)[0];
29465
- if (intarg_count >= NUM_GPR_ARG_REGISTERS - 3) {
29466
- if (intarg_count < NUM_GPR_ARG_REGISTERS)
29467
- intarg_count += NUM_GPR_ARG_REGISTERS - intarg_count;
29468
- *(next_arg.u++) = int_tmp;
29469
- for (ii = 1; ii < 4; ii++) {
29470
- int_tmp = (*p_argv.ui)[ii];
29471
- *(next_arg.u++) = int_tmp;
29474
- *(gpr_base.u++) = int_tmp;
29475
- for (ii = 1; ii < 4; ii++) {
29476
- int_tmp = (*p_argv.ui)[ii];
29477
- *(gpr_base.u++) = int_tmp;
29480
- intarg_count += 4;
29484
- case FFI_TYPE_UINT64:
29485
- case FFI_TYPE_SINT64:
29486
- if (intarg_count == NUM_GPR_ARG_REGISTERS-1)
29488
- if (intarg_count >= NUM_GPR_ARG_REGISTERS)
29490
- if (intarg_count % 2 != 0)
29495
- *next_arg.ll = **p_argv.ll;
29500
- /* whoops: abi states only certain register pairs
29501
- * can be used for passing long long int
29502
- * specifically (r3,r4), (r5,r6), (r7,r8),
29503
- * (r9,r10) and if next arg is long long but
29504
- * not correct starting register of pair then skip
29505
- * until the proper starting register
29507
- if (intarg_count % 2 != 0)
29512
- *gpr_base.ll++ = **p_argv.ll;
29514
- intarg_count += 2;
29517
- case FFI_TYPE_STRUCT:
29518
- struct_copy_size = ((*ptr)->size + 15) & ~0xF;
29519
- copy_space.c -= struct_copy_size;
29520
- memcpy (copy_space.c, *p_argv.c, (*ptr)->size);
29522
- gprvalue = (unsigned long) copy_space.c;
29524
- FFI_ASSERT (copy_space.c > next_arg.c);
29525
- FFI_ASSERT (flags & FLAG_ARG_NEEDS_COPY);
29528
- case FFI_TYPE_UINT8:
29529
- gprvalue = **p_argv.uc;
29531
- case FFI_TYPE_SINT8:
29532
- gprvalue = **p_argv.sc;
29534
- case FFI_TYPE_UINT16:
29535
- gprvalue = **p_argv.us;
29537
- case FFI_TYPE_SINT16:
29538
- gprvalue = **p_argv.ss;
29541
- case FFI_TYPE_INT:
29542
- case FFI_TYPE_UINT32:
29543
- case FFI_TYPE_SINT32:
29544
- case FFI_TYPE_POINTER:
29546
- gprvalue = **p_argv.ui;
29549
- if (intarg_count >= NUM_GPR_ARG_REGISTERS)
29550
- *next_arg.u++ = gprvalue;
29552
- *gpr_base.u++ = gprvalue;
29558
- /* Check that we didn't overrun the stack... */
29559
- FFI_ASSERT (copy_space.c >= next_arg.c);
29560
- FFI_ASSERT (gpr_base.u <= stacktop.u - ASM_NEEDS_REGISTERS);
29561
-#ifndef __NO_FPRS__
29562
- FFI_ASSERT (fpr_base.u
29563
- <= stacktop.u - ASM_NEEDS_REGISTERS - NUM_GPR_ARG_REGISTERS);
29565
- FFI_ASSERT (flags & FLAG_4_GPR_ARGUMENTS || intarg_count <= 4);
29566
+# if FFI_TYPE_LONGDOUBLE != FFI_TYPE_DOUBLE
29568
+ ffi_prep_types_linux64 (abi);
29570
+ ffi_prep_types_sysv (abi);
29575
-/* About the LINUX64 ABI. */
29577
- NUM_GPR_ARG_REGISTERS64 = 8,
29578
- NUM_FPR_ARG_REGISTERS64 = 13
29580
-enum { ASM_NEEDS_REGISTERS64 = 4 };
29582
-/* ffi_prep_args64 is called by the assembly routine once stack space
29583
- has been allocated for the function's arguments.
29585
- The stack layout we want looks like this:
29587
- | Ret addr from ffi_call_LINUX64 8bytes | higher addresses
29588
- |--------------------------------------------|
29589
- | CR save area 8bytes |
29590
- |--------------------------------------------|
29591
- | Previous backchain pointer 8 | stack pointer here
29592
- |--------------------------------------------|<+ <<< on entry to
29593
- | Saved r28-r31 4*8 | | ffi_call_LINUX64
29594
- |--------------------------------------------| |
29595
- | GPR registers r3-r10 8*8 | |
29596
- |--------------------------------------------| |
29597
- | FPR registers f1-f13 (optional) 13*8 | |
29598
- |--------------------------------------------| |
29599
- | Parameter save area | |
29600
- |--------------------------------------------| |
29601
- | TOC save area 8 | |
29602
- |--------------------------------------------| | stack |
29603
- | Linker doubleword 8 | | grows |
29604
- |--------------------------------------------| | down V
29605
- | Compiler doubleword 8 | |
29606
- |--------------------------------------------| | lower addresses
29607
- | Space for callee's LR 8 | |
29608
- |--------------------------------------------| |
29609
- | CR save area 8 | |
29610
- |--------------------------------------------| | stack pointer here
29611
- | Current backchain pointer 8 |-/ during
29612
- |--------------------------------------------| <<< ffi_call_LINUX64
29617
-ffi_prep_args64 (extended_cif *ecif, unsigned long *const stack)
29619
- const unsigned long bytes = ecif->cif->bytes;
29620
- const unsigned long flags = ecif->cif->flags;
29624
- unsigned long *ul;
29629
- /* 'stacktop' points at the previous backchain pointer. */
29632
- /* 'next_arg' points at the space for gpr3, and grows upwards as
29633
- we use GPR registers, then continues at rest. */
29639
- /* 'fpr_base' points at the space for fpr3, and grows upwards as
29640
- we use FPR registers. */
29646
- double double_tmp;
29650
- signed char **sc;
29651
- unsigned char **uc;
29652
- signed short **ss;
29653
- unsigned short **us;
29655
- unsigned int **ui;
29656
- unsigned long **ul;
29660
- unsigned long gprvalue;
29662
- stacktop.c = (char *) stack + bytes;
29663
- gpr_base.ul = stacktop.ul - ASM_NEEDS_REGISTERS64 - NUM_GPR_ARG_REGISTERS64;
29664
- gpr_end.ul = gpr_base.ul + NUM_GPR_ARG_REGISTERS64;
29665
- rest.ul = stack + 6 + NUM_GPR_ARG_REGISTERS64;
29666
- fpr_base.d = gpr_base.d - NUM_FPR_ARG_REGISTERS64;
29668
- next_arg.ul = gpr_base.ul;
29670
- /* Check that everything starts aligned properly. */
29671
- FFI_ASSERT (((unsigned long) (char *) stack & 0xF) == 0);
29672
- FFI_ASSERT (((unsigned long) stacktop.c & 0xF) == 0);
29673
- FFI_ASSERT ((bytes & 0xF) == 0);
29675
- /* Deal with return values that are actually pass-by-reference. */
29676
- if (flags & FLAG_RETVAL_REFERENCE)
29677
- *next_arg.ul++ = (unsigned long) (char *) ecif->rvalue;
29679
- /* Now for the arguments. */
29680
- p_argv.v = ecif->avalue;
29681
- for (ptr = ecif->cif->arg_types, i = ecif->cif->nargs;
29683
- i--, ptr++, p_argv.v++)
29685
- switch ((*ptr)->type)
29687
- case FFI_TYPE_FLOAT:
29688
- double_tmp = **p_argv.f;
29689
- *next_arg.f = (float) double_tmp;
29690
- if (++next_arg.ul == gpr_end.ul)
29691
- next_arg.ul = rest.ul;
29692
- if (fparg_count < NUM_FPR_ARG_REGISTERS64)
29693
- *fpr_base.d++ = double_tmp;
29695
- FFI_ASSERT (flags & FLAG_FP_ARGUMENTS);
29698
- case FFI_TYPE_DOUBLE:
29699
- double_tmp = **p_argv.d;
29700
- *next_arg.d = double_tmp;
29701
- if (++next_arg.ul == gpr_end.ul)
29702
- next_arg.ul = rest.ul;
29703
- if (fparg_count < NUM_FPR_ARG_REGISTERS64)
29704
- *fpr_base.d++ = double_tmp;
29706
- FFI_ASSERT (flags & FLAG_FP_ARGUMENTS);
29709
-#if FFI_TYPE_LONGDOUBLE != FFI_TYPE_DOUBLE
29710
- case FFI_TYPE_LONGDOUBLE:
29711
- double_tmp = (*p_argv.d)[0];
29712
- *next_arg.d = double_tmp;
29713
- if (++next_arg.ul == gpr_end.ul)
29714
- next_arg.ul = rest.ul;
29715
- if (fparg_count < NUM_FPR_ARG_REGISTERS64)
29716
- *fpr_base.d++ = double_tmp;
29718
- double_tmp = (*p_argv.d)[1];
29719
- *next_arg.d = double_tmp;
29720
- if (++next_arg.ul == gpr_end.ul)
29721
- next_arg.ul = rest.ul;
29722
- if (fparg_count < NUM_FPR_ARG_REGISTERS64)
29723
- *fpr_base.d++ = double_tmp;
29725
- FFI_ASSERT (__LDBL_MANT_DIG__ == 106);
29726
- FFI_ASSERT (flags & FLAG_FP_ARGUMENTS);
29730
- case FFI_TYPE_STRUCT:
29731
- words = ((*ptr)->size + 7) / 8;
29732
- if (next_arg.ul >= gpr_base.ul && next_arg.ul + words > gpr_end.ul)
29734
- size_t first = gpr_end.c - next_arg.c;
29735
- memcpy (next_arg.c, *p_argv.c, first);
29736
- memcpy (rest.c, *p_argv.c + first, (*ptr)->size - first);
29737
- next_arg.c = rest.c + words * 8 - first;
29741
- char *where = next_arg.c;
29743
-#ifndef __LITTLE_ENDIAN__
29744
- /* Structures with size less than eight bytes are passed
29746
- if ((*ptr)->size < 8)
29747
- where += 8 - (*ptr)->size;
29749
- memcpy (where, *p_argv.c, (*ptr)->size);
29750
- next_arg.ul += words;
29751
- if (next_arg.ul == gpr_end.ul)
29752
- next_arg.ul = rest.ul;
29756
- case FFI_TYPE_UINT8:
29757
- gprvalue = **p_argv.uc;
29759
- case FFI_TYPE_SINT8:
29760
- gprvalue = **p_argv.sc;
29762
- case FFI_TYPE_UINT16:
29763
- gprvalue = **p_argv.us;
29765
- case FFI_TYPE_SINT16:
29766
- gprvalue = **p_argv.ss;
29768
- case FFI_TYPE_UINT32:
29769
- gprvalue = **p_argv.ui;
29771
- case FFI_TYPE_INT:
29772
- case FFI_TYPE_SINT32:
29773
- gprvalue = **p_argv.si;
29776
- case FFI_TYPE_UINT64:
29777
- case FFI_TYPE_SINT64:
29778
- case FFI_TYPE_POINTER:
29779
- gprvalue = **p_argv.ul;
29781
- *next_arg.ul++ = gprvalue;
29782
- if (next_arg.ul == gpr_end.ul)
29783
- next_arg.ul = rest.ul;
29788
- FFI_ASSERT (flags & FLAG_4_GPR_ARGUMENTS
29789
- || (next_arg.ul >= gpr_base.ul
29790
- && next_arg.ul <= gpr_base.ul + 4));
29795
/* Perform machine dependent cif processing */
29797
+ffi_status FFI_HIDDEN
29798
ffi_prep_cif_machdep (ffi_cif *cif)
29800
- /* All this is for the SYSV and LINUX64 ABI. */
29804
- int fparg_count = 0, intarg_count = 0;
29805
- unsigned flags = 0;
29806
- unsigned struct_copy_size = 0;
29807
- unsigned type = cif->rtype->type;
29808
- unsigned size = cif->rtype->size;
29810
- if (cif->abi != FFI_LINUX64)
29812
- /* All the machine-independent calculation of cif->bytes will be wrong.
29813
- Redo the calculation for SYSV. */
29815
- /* Space for the frame pointer, callee's LR, and the asm's temp regs. */
29816
- bytes = (2 + ASM_NEEDS_REGISTERS) * sizeof (int);
29818
- /* Space for the GPR registers. */
29819
- bytes += NUM_GPR_ARG_REGISTERS * sizeof (int);
29823
- /* 64-bit ABI. */
29825
- /* Space for backchain, CR, LR, cc/ld doubleword, TOC and the asm's temp
29827
- bytes = (6 + ASM_NEEDS_REGISTERS64) * sizeof (long);
29829
- /* Space for the mandatory parm save area and general registers. */
29830
- bytes += 2 * NUM_GPR_ARG_REGISTERS64 * sizeof (long);
29833
- /* Return value handling. The rules for SYSV are as follows:
29834
- - 32-bit (or less) integer values are returned in gpr3;
29835
- - Structures of size <= 4 bytes also returned in gpr3;
29836
- - 64-bit integer values and structures between 5 and 8 bytes are returned
29837
- in gpr3 and gpr4;
29838
- - Single/double FP values are returned in fpr1;
29839
- - Larger structures are allocated space and a pointer is passed as
29840
- the first argument.
29841
- - long doubles (if not equivalent to double) are returned in
29842
- fpr1,fpr2 for Linux and as for large structs for SysV.
29844
- - integer values in gpr3;
29845
- - Structures/Unions by reference;
29846
- - Single/double FP values in fpr1, long double in fpr1,fpr2.
29847
- - soft-float float/doubles are treated as UINT32/UINT64 respectivley.
29848
- - soft-float long doubles are returned in gpr3-gpr6. */
29849
- /* First translate for softfloat/nonlinux */
29850
- if (cif->abi == FFI_LINUX_SOFT_FLOAT) {
29851
- if (type == FFI_TYPE_FLOAT)
29852
- type = FFI_TYPE_UINT32;
29853
- if (type == FFI_TYPE_DOUBLE)
29854
- type = FFI_TYPE_UINT64;
29855
- if (type == FFI_TYPE_LONGDOUBLE)
29856
- type = FFI_TYPE_UINT128;
29857
- } else if (cif->abi != FFI_LINUX && cif->abi != FFI_LINUX64) {
29858
-#if FFI_TYPE_LONGDOUBLE != FFI_TYPE_DOUBLE
29859
- if (type == FFI_TYPE_LONGDOUBLE)
29860
- type = FFI_TYPE_STRUCT;
29862
+ return ffi_prep_cif_linux64 (cif);
29864
+ return ffi_prep_cif_sysv (cif);
29871
-#ifndef __NO_FPRS__
29872
-#if FFI_TYPE_LONGDOUBLE != FFI_TYPE_DOUBLE
29873
- case FFI_TYPE_LONGDOUBLE:
29874
- flags |= FLAG_RETURNS_128BITS;
29875
- /* Fall through. */
29876
+ffi_status FFI_HIDDEN
29877
+ffi_prep_cif_machdep_var (ffi_cif *cif,
29878
+ unsigned int nfixedargs MAYBE_UNUSED,
29879
+ unsigned int ntotalargs MAYBE_UNUSED)
29882
+ return ffi_prep_cif_linux64_var (cif, nfixedargs, ntotalargs);
29884
+ return ffi_prep_cif_sysv (cif);
29886
- case FFI_TYPE_DOUBLE:
29887
- flags |= FLAG_RETURNS_64BITS;
29888
- /* Fall through. */
29889
- case FFI_TYPE_FLOAT:
29890
- flags |= FLAG_RETURNS_FP;
29894
- case FFI_TYPE_UINT128:
29895
- flags |= FLAG_RETURNS_128BITS;
29896
- /* Fall through. */
29897
- case FFI_TYPE_UINT64:
29898
- case FFI_TYPE_SINT64:
29899
- flags |= FLAG_RETURNS_64BITS;
29902
- case FFI_TYPE_STRUCT:
29904
- * The final SYSV ABI says that structures smaller or equal 8 bytes
29905
- * are returned in r3/r4. The FFI_GCC_SYSV ABI instead returns them
29908
- * NOTE: The assembly code can safely assume that it just needs to
29909
- * store both r3 and r4 into a 8-byte word-aligned buffer, as
29910
- * we allocate a temporary buffer in ffi_call() if this flag is
29913
- if (cif->abi == FFI_SYSV && size <= 8)
29914
- flags |= FLAG_RETURNS_SMST;
29916
- flags |= FLAG_RETVAL_REFERENCE;
29917
- /* Fall through. */
29918
- case FFI_TYPE_VOID:
29919
- flags |= FLAG_RETURNS_NOTHING;
29923
- /* Returns 32-bit integer, or similar. Nothing to do here. */
29927
- if (cif->abi != FFI_LINUX64)
29928
- /* The first NUM_GPR_ARG_REGISTERS words of integer arguments, and the
29929
- first NUM_FPR_ARG_REGISTERS fp arguments, go in registers; the rest
29930
- goes on the stack. Structures and long doubles (if not equivalent
29931
- to double) are passed as a pointer to a copy of the structure.
29932
- Stuff on the stack needs to keep proper alignment. */
29933
- for (ptr = cif->arg_types, i = cif->nargs; i > 0; i--, ptr++)
29935
- unsigned short typenum = (*ptr)->type;
29937
- /* We may need to handle some values depending on ABI */
29938
- if (cif->abi == FFI_LINUX_SOFT_FLOAT) {
29939
- if (typenum == FFI_TYPE_FLOAT)
29940
- typenum = FFI_TYPE_UINT32;
29941
- if (typenum == FFI_TYPE_DOUBLE)
29942
- typenum = FFI_TYPE_UINT64;
29943
- if (typenum == FFI_TYPE_LONGDOUBLE)
29944
- typenum = FFI_TYPE_UINT128;
29945
- } else if (cif->abi != FFI_LINUX && cif->abi != FFI_LINUX64) {
29946
-#if FFI_TYPE_LONGDOUBLE != FFI_TYPE_DOUBLE
29947
- if (typenum == FFI_TYPE_LONGDOUBLE)
29948
- typenum = FFI_TYPE_STRUCT;
29952
- switch (typenum) {
29953
-#ifndef __NO_FPRS__
29954
- case FFI_TYPE_FLOAT:
29956
- /* floating singles are not 8-aligned on stack */
29959
-#if FFI_TYPE_LONGDOUBLE != FFI_TYPE_DOUBLE
29960
- case FFI_TYPE_LONGDOUBLE:
29964
- case FFI_TYPE_DOUBLE:
29966
- /* If this FP arg is going on the stack, it must be
29967
- 8-byte-aligned. */
29968
- if (fparg_count > NUM_FPR_ARG_REGISTERS
29969
- && intarg_count >= NUM_GPR_ARG_REGISTERS
29970
- && intarg_count % 2 != 0)
29974
- case FFI_TYPE_UINT128:
29976
- * A long double in FFI_LINUX_SOFT_FLOAT can use only a set
29977
- * of four consecutive gprs. If we do not have enough, we
29978
- * have to adjust the intarg_count value.
29980
- if (intarg_count >= NUM_GPR_ARG_REGISTERS - 3
29981
- && intarg_count < NUM_GPR_ARG_REGISTERS)
29982
- intarg_count = NUM_GPR_ARG_REGISTERS;
29983
- intarg_count += 4;
29986
- case FFI_TYPE_UINT64:
29987
- case FFI_TYPE_SINT64:
29988
- /* 'long long' arguments are passed as two words, but
29989
- either both words must fit in registers or both go
29990
- on the stack. If they go on the stack, they must
29991
- be 8-byte-aligned.
29993
- Also, only certain register pairs can be used for
29994
- passing long long int -- specifically (r3,r4), (r5,r6),
29995
- (r7,r8), (r9,r10).
29997
- if (intarg_count == NUM_GPR_ARG_REGISTERS-1
29998
- || intarg_count % 2 != 0)
30000
- intarg_count += 2;
30003
- case FFI_TYPE_STRUCT:
30004
- /* We must allocate space for a copy of these to enforce
30005
- pass-by-value. Pad the space up to a multiple of 16
30006
- bytes (the maximum alignment required for anything under
30007
- the SYSV ABI). */
30008
- struct_copy_size += ((*ptr)->size + 15) & ~0xF;
30009
- /* Fall through (allocate space for the pointer). */
30011
- case FFI_TYPE_POINTER:
30012
- case FFI_TYPE_INT:
30013
- case FFI_TYPE_UINT32:
30014
- case FFI_TYPE_SINT32:
30015
- case FFI_TYPE_UINT16:
30016
- case FFI_TYPE_SINT16:
30017
- case FFI_TYPE_UINT8:
30018
- case FFI_TYPE_SINT8:
30019
- /* Everything else is passed as a 4-byte word in a GPR, either
30020
- the object itself or a pointer to it. */
30028
- for (ptr = cif->arg_types, i = cif->nargs; i > 0; i--, ptr++)
30030
- switch ((*ptr)->type)
30032
-#if FFI_TYPE_LONGDOUBLE != FFI_TYPE_DOUBLE
30033
- case FFI_TYPE_LONGDOUBLE:
30034
- if (cif->abi == FFI_LINUX_SOFT_FLOAT)
30035
- intarg_count += 4;
30038
- fparg_count += 2;
30039
- intarg_count += 2;
30043
- case FFI_TYPE_FLOAT:
30044
- case FFI_TYPE_DOUBLE:
30049
- case FFI_TYPE_STRUCT:
30050
- intarg_count += ((*ptr)->size + 7) / 8;
30053
- case FFI_TYPE_POINTER:
30054
- case FFI_TYPE_UINT64:
30055
- case FFI_TYPE_SINT64:
30056
- case FFI_TYPE_INT:
30057
- case FFI_TYPE_UINT32:
30058
- case FFI_TYPE_SINT32:
30059
- case FFI_TYPE_UINT16:
30060
- case FFI_TYPE_SINT16:
30061
- case FFI_TYPE_UINT8:
30062
- case FFI_TYPE_SINT8:
30063
- /* Everything else is passed as a 8-byte word in a GPR, either
30064
- the object itself or a pointer to it. */
30072
-#ifndef __NO_FPRS__
30073
- if (fparg_count != 0)
30074
- flags |= FLAG_FP_ARGUMENTS;
30076
- if (intarg_count > 4)
30077
- flags |= FLAG_4_GPR_ARGUMENTS;
30078
- if (struct_copy_size != 0)
30079
- flags |= FLAG_ARG_NEEDS_COPY;
30081
- if (cif->abi != FFI_LINUX64)
30083
-#ifndef __NO_FPRS__
30084
- /* Space for the FPR registers, if needed. */
30085
- if (fparg_count != 0)
30086
- bytes += NUM_FPR_ARG_REGISTERS * sizeof (double);
30089
- /* Stack space. */
30090
- if (intarg_count > NUM_GPR_ARG_REGISTERS)
30091
- bytes += (intarg_count - NUM_GPR_ARG_REGISTERS) * sizeof (int);
30092
-#ifndef __NO_FPRS__
30093
- if (fparg_count > NUM_FPR_ARG_REGISTERS)
30094
- bytes += (fparg_count - NUM_FPR_ARG_REGISTERS) * sizeof (double);
30099
-#ifndef __NO_FPRS__
30100
- /* Space for the FPR registers, if needed. */
30101
- if (fparg_count != 0)
30102
- bytes += NUM_FPR_ARG_REGISTERS64 * sizeof (double);
30105
- /* Stack space. */
30106
- if (intarg_count > NUM_GPR_ARG_REGISTERS64)
30107
- bytes += (intarg_count - NUM_GPR_ARG_REGISTERS64) * sizeof (long);
30110
- /* The stack space allocated needs to be a multiple of 16 bytes. */
30111
- bytes = (bytes + 15) & ~0xF;
30113
- /* Add in the space for the copied structures. */
30114
- bytes += struct_copy_size;
30116
- cif->flags = flags;
30117
- cif->bytes = bytes;
30122
-extern void ffi_call_SYSV(extended_cif *, unsigned, unsigned, unsigned *,
30123
- void (*fn)(void));
30124
-extern void FFI_HIDDEN ffi_call_LINUX64(extended_cif *, unsigned long,
30125
- unsigned long, unsigned long *,
30126
- void (*fn)(void));
30129
ffi_call(ffi_cif *cif, void (*fn)(void), void *rvalue, void **avalue)
30132
- * The final SYSV ABI says that structures smaller or equal 8 bytes
30133
- * are returned in r3/r4. The FFI_GCC_SYSV ABI instead returns them
30136
- * Just to keep things simple for the assembly code, we will always
30137
- * bounce-buffer struct return values less than or equal to 8 bytes.
30138
- * This allows the ASM to handle SYSV small structures by directly
30139
- * writing r3 and r4 to memory without worrying about struct size.
30141
- unsigned int smst_buffer[2];
30142
+ /* The final SYSV ABI says that structures smaller or equal 8 bytes
30143
+ are returned in r3/r4. A draft ABI used by linux instead returns
30146
+ We bounce-buffer SYSV small struct return values so that sysv.S
30147
+ can write r3 and r4 to memory without worrying about struct size.
30149
+ For ELFv2 ABI, use a bounce buffer for homogeneous structs too,
30150
+ for similar reasons. */
30151
+ unsigned long smst_buffer[8];
30153
- unsigned int rsize = 0;
30156
ecif.avalue = avalue;
30158
- /* Ensure that we have a valid struct return value */
30159
ecif.rvalue = rvalue;
30160
- if (cif->rtype->type == FFI_TYPE_STRUCT) {
30161
- rsize = cif->rtype->size;
30163
- ecif.rvalue = smst_buffer;
30164
- else if (!rvalue)
30165
- ecif.rvalue = alloca(rsize);
30167
+ if ((cif->flags & FLAG_RETURNS_SMST) != 0)
30168
+ ecif.rvalue = smst_buffer;
30169
+ /* Ensure that we have a valid struct return value.
30170
+ FIXME: Isn't this just papering over a user problem? */
30171
+ else if (!rvalue && cif->rtype->type == FFI_TYPE_STRUCT)
30172
+ ecif.rvalue = alloca (cif->rtype->size);
30174
- switch (cif->abi)
30177
-# ifndef __NO_FPRS__
30179
- case FFI_GCC_SYSV:
30182
- case FFI_LINUX_SOFT_FLOAT:
30183
- ffi_call_SYSV (&ecif, -cif->bytes, cif->flags, ecif.rvalue, fn);
30186
+ ffi_call_LINUX64 (&ecif, -(long) cif->bytes, cif->flags, ecif.rvalue, fn);
30188
- case FFI_LINUX64:
30189
- ffi_call_LINUX64 (&ecif, -(long) cif->bytes, cif->flags, ecif.rvalue, fn);
30191
+ ffi_call_SYSV (&ecif, -cif->bytes, cif->flags, ecif.rvalue, fn);
30198
/* Check for a bounce-buffered return value */
30199
if (rvalue && ecif.rvalue == smst_buffer)
30200
- memcpy(rvalue, smst_buffer, rsize);
30202
+ unsigned int rsize = cif->rtype->size;
30203
+#ifndef __LITTLE_ENDIAN__
30204
+ /* The SYSV ABI returns a structure of up to 4 bytes in size
30205
+ left-padded in r3. */
30206
+# ifndef POWERPC64
30208
+ memcpy (rvalue, (char *) smst_buffer + 4 - rsize, rsize);
30211
+ /* The SYSV ABI returns a structure of up to 8 bytes in size
30212
+ left-padded in r3/r4, and the ELFv2 ABI similarly returns a
30213
+ structure of up to 8 bytes in size left-padded in r3. */
30215
+ memcpy (rvalue, (char *) smst_buffer + 8 - rsize, rsize);
30218
+ memcpy (rvalue, smst_buffer, rsize);
30224
-#define MIN_CACHE_LINE_SIZE 8
30227
-flush_icache (char *wraddr, char *xaddr, int size)
30230
- for (i = 0; i < size; i += MIN_CACHE_LINE_SIZE)
30231
- __asm__ volatile ("icbi 0,%0;" "dcbf 0,%1;"
30232
- : : "r" (xaddr + i), "r" (wraddr + i) : "memory");
30233
- __asm__ volatile ("icbi 0,%0;" "dcbf 0,%1;" "sync;" "isync;"
30234
- : : "r"(xaddr + size - 1), "r"(wraddr + size - 1)
30240
ffi_prep_closure_loc (ffi_closure *closure,
30242
@@ -995,487 +134,8 @@
30246
- void **tramp = (void **) &closure->tramp[0];
30248
- if (cif->abi != FFI_LINUX64)
30249
- return FFI_BAD_ABI;
30250
- /* Copy function address and TOC from ffi_closure_LINUX64. */
30251
- memcpy (tramp, (char *) ffi_closure_LINUX64, 16);
30252
- tramp[2] = codeloc;
30253
+ return ffi_prep_closure_loc_linux64 (closure, cif, fun, user_data, codeloc);
30255
- unsigned int *tramp;
30257
- if (! (cif->abi == FFI_GCC_SYSV
30258
- || cif->abi == FFI_SYSV
30259
- || cif->abi == FFI_LINUX
30260
- || cif->abi == FFI_LINUX_SOFT_FLOAT))
30261
- return FFI_BAD_ABI;
30263
- tramp = (unsigned int *) &closure->tramp[0];
30264
- tramp[0] = 0x7c0802a6; /* mflr r0 */
30265
- tramp[1] = 0x4800000d; /* bl 10 <trampoline_initial+0x10> */
30266
- tramp[4] = 0x7d6802a6; /* mflr r11 */
30267
- tramp[5] = 0x7c0803a6; /* mtlr r0 */
30268
- tramp[6] = 0x800b0000; /* lwz r0,0(r11) */
30269
- tramp[7] = 0x816b0004; /* lwz r11,4(r11) */
30270
- tramp[8] = 0x7c0903a6; /* mtctr r0 */
30271
- tramp[9] = 0x4e800420; /* bctr */
30272
- *(void **) &tramp[2] = (void *) ffi_closure_SYSV; /* function */
30273
- *(void **) &tramp[3] = codeloc; /* context */
30275
- /* Flush the icache. */
30276
- flush_icache ((char *)tramp, (char *)codeloc, FFI_TRAMPOLINE_SIZE);
30277
+ return ffi_prep_closure_loc_sysv (closure, cif, fun, user_data, codeloc);
30280
- closure->cif = cif;
30281
- closure->fun = fun;
30282
- closure->user_data = user_data;
30293
-int ffi_closure_helper_SYSV (ffi_closure *, void *, unsigned long *,
30294
- ffi_dblfl *, unsigned long *);
30296
-/* Basically the trampoline invokes ffi_closure_SYSV, and on
30297
- * entry, r11 holds the address of the closure.
30298
- * After storing the registers that could possibly contain
30299
- * parameters to be passed into the stack frame and setting
30300
- * up space for a return value, ffi_closure_SYSV invokes the
30301
- * following helper function to do most of the work
30305
-ffi_closure_helper_SYSV (ffi_closure *closure, void *rvalue,
30306
- unsigned long *pgr, ffi_dblfl *pfr,
30307
- unsigned long *pst)
30309
- /* rvalue is the pointer to space for return value in closure assembly */
30310
- /* pgr is the pointer to where r3-r10 are stored in ffi_closure_SYSV */
30311
- /* pfr is the pointer to where f1-f8 are stored in ffi_closure_SYSV */
30312
- /* pst is the pointer to outgoing parameter stack in original caller */
30315
- ffi_type ** arg_types;
30317
-#ifndef __NO_FPRS__
30318
- long nf = 0; /* number of floating registers already used */
30320
- long ng = 0; /* number of general registers already used */
30322
- ffi_cif *cif = closure->cif;
30323
- unsigned size = cif->rtype->size;
30324
- unsigned short rtypenum = cif->rtype->type;
30326
- avalue = alloca (cif->nargs * sizeof (void *));
30328
- /* First translate for softfloat/nonlinux */
30329
- if (cif->abi == FFI_LINUX_SOFT_FLOAT) {
30330
- if (rtypenum == FFI_TYPE_FLOAT)
30331
- rtypenum = FFI_TYPE_UINT32;
30332
- if (rtypenum == FFI_TYPE_DOUBLE)
30333
- rtypenum = FFI_TYPE_UINT64;
30334
- if (rtypenum == FFI_TYPE_LONGDOUBLE)
30335
- rtypenum = FFI_TYPE_UINT128;
30336
- } else if (cif->abi != FFI_LINUX && cif->abi != FFI_LINUX64) {
30337
-#if FFI_TYPE_LONGDOUBLE != FFI_TYPE_DOUBLE
30338
- if (rtypenum == FFI_TYPE_LONGDOUBLE)
30339
- rtypenum = FFI_TYPE_STRUCT;
30344
- /* Copy the caller's structure return value address so that the closure
30345
- returns the data directly to the caller.
30346
- For FFI_SYSV the result is passed in r3/r4 if the struct size is less
30347
- or equal 8 bytes. */
30348
- if (rtypenum == FFI_TYPE_STRUCT && ((cif->abi != FFI_SYSV) || (size > 8))) {
30349
- rvalue = (void *) *pgr;
30355
- avn = cif->nargs;
30356
- arg_types = cif->arg_types;
30358
- /* Grab the addresses of the arguments from the stack frame. */
30359
- while (i < avn) {
30360
- unsigned short typenum = arg_types[i]->type;
30362
- /* We may need to handle some values depending on ABI */
30363
- if (cif->abi == FFI_LINUX_SOFT_FLOAT) {
30364
- if (typenum == FFI_TYPE_FLOAT)
30365
- typenum = FFI_TYPE_UINT32;
30366
- if (typenum == FFI_TYPE_DOUBLE)
30367
- typenum = FFI_TYPE_UINT64;
30368
- if (typenum == FFI_TYPE_LONGDOUBLE)
30369
- typenum = FFI_TYPE_UINT128;
30370
- } else if (cif->abi != FFI_LINUX && cif->abi != FFI_LINUX64) {
30371
-#if FFI_TYPE_LONGDOUBLE != FFI_TYPE_DOUBLE
30372
- if (typenum == FFI_TYPE_LONGDOUBLE)
30373
- typenum = FFI_TYPE_STRUCT;
30377
- switch (typenum) {
30378
-#ifndef __NO_FPRS__
30379
- case FFI_TYPE_FLOAT:
30380
- /* unfortunately float values are stored as doubles
30381
- * in the ffi_closure_SYSV code (since we don't check
30382
- * the type in that routine).
30385
- /* there are 8 64bit floating point registers */
30389
- double temp = pfr->d;
30390
- pfr->f = (float) temp;
30397
- /* FIXME? here we are really changing the values
30398
- * stored in the original calling routines outgoing
30399
- * parameter stack. This is probably a really
30400
- * naughty thing to do but...
30407
- case FFI_TYPE_DOUBLE:
30408
- /* On the outgoing stack all values are aligned to 8 */
30409
- /* there are 8 64bit floating point registers */
30419
- if (((long) pst) & 4)
30426
-#if FFI_TYPE_LONGDOUBLE != FFI_TYPE_DOUBLE
30427
- case FFI_TYPE_LONGDOUBLE:
30436
- if (((long) pst) & 4)
30444
-#endif /* have FPRS */
30446
- case FFI_TYPE_UINT128:
30448
- * Test if for the whole long double, 4 gprs are available.
30449
- * otherwise the stuff ends up on the stack.
30462
- case FFI_TYPE_SINT8:
30463
- case FFI_TYPE_UINT8:
30464
-#ifndef __LITTLE_ENDIAN__
30465
- /* there are 8 gpr registers used to pass values */
30468
- avalue[i] = (char *) pgr + 3;
30474
- avalue[i] = (char *) pst + 3;
30479
- case FFI_TYPE_SINT16:
30480
- case FFI_TYPE_UINT16:
30481
-#ifndef __LITTLE_ENDIAN__
30482
- /* there are 8 gpr registers used to pass values */
30485
- avalue[i] = (char *) pgr + 2;
30491
- avalue[i] = (char *) pst + 2;
30496
- case FFI_TYPE_SINT32:
30497
- case FFI_TYPE_UINT32:
30498
- case FFI_TYPE_POINTER:
30499
- /* there are 8 gpr registers used to pass values */
30513
- case FFI_TYPE_STRUCT:
30514
- /* Structs are passed by reference. The address will appear in a
30515
- gpr if it is one of the first 8 arguments. */
30518
- avalue[i] = (void *) *pgr;
30524
- avalue[i] = (void *) *pst;
30529
- case FFI_TYPE_SINT64:
30530
- case FFI_TYPE_UINT64:
30531
- /* passing long long ints are complex, they must
30532
- * be passed in suitable register pairs such as
30533
- * (r3,r4) or (r5,r6) or (r6,r7), or (r7,r8) or (r9,r10)
30534
- * and if the entire pair aren't available then the outgoing
30535
- * parameter stack is used for both but an alignment of 8
30536
- * must will be kept. So we must either look in pgr
30537
- * or pst to find the correct address for this type
30544
- /* skip r4, r6, r8 as starting points */
30554
- if (((long) pst) & 4)
30570
- (closure->fun) (cif, rvalue, avalue, closure->user_data);
30572
- /* Tell ffi_closure_SYSV how to perform return type promotions.
30573
- Because the FFI_SYSV ABI returns the structures <= 8 bytes in r3/r4
30574
- we have to tell ffi_closure_SYSV how to treat them. We combine the base
30575
- type FFI_SYSV_TYPE_SMALL_STRUCT - 1 with the size of the struct.
30576
- So a one byte struct gets the return type 16. Return type 1 to 15 are
30577
- already used and we never have a struct with size zero. That is the reason
30578
- for the subtraction of 1. See the comment in ffitarget.h about ordering.
30580
- if (cif->abi == FFI_SYSV && rtypenum == FFI_TYPE_STRUCT && size <= 8)
30581
- return (FFI_SYSV_TYPE_SMALL_STRUCT - 1) + size;
30585
-int FFI_HIDDEN ffi_closure_helper_LINUX64 (ffi_closure *, void *,
30586
- unsigned long *, ffi_dblfl *);
30589
-ffi_closure_helper_LINUX64 (ffi_closure *closure, void *rvalue,
30590
- unsigned long *pst, ffi_dblfl *pfr)
30592
- /* rvalue is the pointer to space for return value in closure assembly */
30593
- /* pst is the pointer to parameter save area
30594
- (r3-r10 are stored into its first 8 slots by ffi_closure_LINUX64) */
30595
- /* pfr is the pointer to where f1-f13 are stored in ffi_closure_LINUX64 */
30598
- ffi_type **arg_types;
30601
- ffi_dblfl *end_pfr = pfr + NUM_FPR_ARG_REGISTERS64;
30603
- cif = closure->cif;
30604
- avalue = alloca (cif->nargs * sizeof (void *));
30606
- /* Copy the caller's structure return value address so that the closure
30607
- returns the data directly to the caller. */
30608
- if (cif->rtype->type == FFI_TYPE_STRUCT)
30610
- rvalue = (void *) *pst;
30615
- avn = cif->nargs;
30616
- arg_types = cif->arg_types;
30618
- /* Grab the addresses of the arguments from the stack frame. */
30621
- switch (arg_types[i]->type)
30623
- case FFI_TYPE_SINT8:
30624
- case FFI_TYPE_UINT8:
30625
-#ifndef __LITTLE_ENDIAN__
30626
- avalue[i] = (char *) pst + 7;
30630
- case FFI_TYPE_SINT16:
30631
- case FFI_TYPE_UINT16:
30632
-#ifndef __LITTLE_ENDIAN__
30633
- avalue[i] = (char *) pst + 6;
30637
- case FFI_TYPE_SINT32:
30638
- case FFI_TYPE_UINT32:
30639
-#ifndef __LITTLE_ENDIAN__
30640
- avalue[i] = (char *) pst + 4;
30644
- case FFI_TYPE_SINT64:
30645
- case FFI_TYPE_UINT64:
30646
- case FFI_TYPE_POINTER:
30651
- case FFI_TYPE_STRUCT:
30652
-#ifndef __LITTLE_ENDIAN__
30653
- /* Structures with size less than eight bytes are passed
30655
- if (arg_types[i]->size < 8)
30656
- avalue[i] = (char *) pst + 8 - arg_types[i]->size;
30660
- pst += (arg_types[i]->size + 7) / 8;
30663
- case FFI_TYPE_FLOAT:
30664
- /* unfortunately float values are stored as doubles
30665
- * in the ffi_closure_LINUX64 code (since we don't check
30666
- * the type in that routine).
30669
- /* there are 13 64bit floating point registers */
30671
- if (pfr < end_pfr)
30673
- double temp = pfr->d;
30674
- pfr->f = (float) temp;
30683
- case FFI_TYPE_DOUBLE:
30684
- /* On the outgoing stack all values are aligned to 8 */
30685
- /* there are 13 64bit floating point registers */
30687
- if (pfr < end_pfr)
30697
-#if FFI_TYPE_LONGDOUBLE != FFI_TYPE_DOUBLE
30698
- case FFI_TYPE_LONGDOUBLE:
30699
- if (pfr + 1 < end_pfr)
30706
- if (pfr < end_pfr)
30708
- /* Passed partly in f13 and partly on the stack.
30709
- Move it all to the stack. */
30710
- *pst = *(unsigned long *) pfr;
30727
- (closure->fun) (cif, rvalue, avalue, closure->user_data);
30729
- /* Tell ffi_closure_LINUX64 how to perform return type promotions. */
30730
- return cif->rtype->type;
30732
--- a/src/libffi/src/powerpc/sysv.S
30733
+++ b/src/libffi/src/powerpc/sysv.S
30736
#include <powerpc/asm.h>
30738
-#ifndef __powerpc64__
30740
.globl ffi_prep_args_SYSV
30741
ENTRY(ffi_call_SYSV)
30743
@@ -213,8 +213,8 @@
30749
#if defined __ELF__ && defined __linux__
30750
.section .note.GNU-stack,"",@progbits
30753
--- a/src/libffi/src/powerpc/linux64_closure.S
30754
+++ b/src/libffi/src/powerpc/linux64_closure.S
30755
@@ -30,18 +30,25 @@
30757
.file "linux64_closure.S"
30759
-#ifdef __powerpc64__
30761
FFI_HIDDEN (ffi_closure_LINUX64)
30762
.globl ffi_closure_LINUX64
30763
+# if _CALL_ELF == 2
30765
+ffi_closure_LINUX64:
30766
+ addis %r2, %r12, .TOC.-ffi_closure_LINUX64@ha
30767
+ addi %r2, %r2, .TOC.-ffi_closure_LINUX64@l
30768
+ .localentry ffi_closure_LINUX64, . - ffi_closure_LINUX64
30770
.section ".opd","aw"
30772
ffi_closure_LINUX64:
30773
-#ifdef _CALL_LINUX
30774
+# ifdef _CALL_LINUX
30775
.quad .L.ffi_closure_LINUX64,.TOC.@tocbase,0
30776
.type ffi_closure_LINUX64,@function
30778
.L.ffi_closure_LINUX64:
30781
FFI_HIDDEN (.ffi_closure_LINUX64)
30782
.globl .ffi_closure_LINUX64
30783
.quad .ffi_closure_LINUX64,.TOC.@tocbase,0
30784
@@ -49,61 +56,101 @@
30785
.type .ffi_closure_LINUX64,@function
30787
.ffi_closure_LINUX64:
30792
+# if _CALL_ELF == 2
30793
+# 32 byte special reg save area + 64 byte parm save area
30794
+# + 64 byte retval area + 13*8 fpr save area + round to 16
30795
+# define STACKFRAME 272
30796
+# define PARMSAVE 32
30797
+# define RETVAL PARMSAVE+64
30799
+# 48 bytes special reg save area + 64 bytes parm save area
30800
+# + 16 bytes retval area + 13*8 bytes fpr save area + round to 16
30801
+# define STACKFRAME 240
30802
+# define PARMSAVE 48
30803
+# define RETVAL PARMSAVE+64
30807
- # save general regs into parm save area
30812
+# if _CALL_ELF == 2
30813
+ ld %r12, FFI_TRAMPOLINE_SIZE(%r11) # closure->cif
30815
+ lwz %r12, 28(%r12) # cif->flags
30817
+ addi %r12, %r1, PARMSAVE
30819
+ # Our caller has not allocated a parameter save area.
30820
+ # We need to allocate one here and use it to pass gprs to
30821
+ # ffi_closure_helper_LINUX64.
30822
+ addi %r12, %r1, -STACKFRAME+PARMSAVE
30825
+ # Save general regs into parm save area
30828
+ std %r5, 16(%r12)
30829
+ std %r6, 24(%r12)
30830
+ std %r7, 32(%r12)
30831
+ std %r8, 40(%r12)
30832
+ std %r9, 48(%r12)
30833
+ std %r10, 56(%r12)
30838
- std %r10, 104(%r1)
30839
+ # load up the pointer to the parm save area
30843
+ # Save general regs into parm save area
30844
+ # This is the parameter save area set up by our caller.
30845
+ std %r3, PARMSAVE+0(%r1)
30846
+ std %r4, PARMSAVE+8(%r1)
30847
+ std %r5, PARMSAVE+16(%r1)
30848
+ std %r6, PARMSAVE+24(%r1)
30849
+ std %r7, PARMSAVE+32(%r1)
30850
+ std %r8, PARMSAVE+40(%r1)
30851
+ std %r9, PARMSAVE+48(%r1)
30852
+ std %r10, PARMSAVE+56(%r1)
30856
- # mandatory 48 bytes special reg save area + 64 bytes parm save area
30857
- # + 16 bytes retval area + 13*8 bytes fpr save area + round to 16
30858
- stdu %r1, -240(%r1)
30860
+ # load up the pointer to the parm save area
30861
+ addi %r5, %r1, PARMSAVE
30864
# next save fpr 1 to fpr 13
30865
- stfd %f1, 128+(0*8)(%r1)
30866
- stfd %f2, 128+(1*8)(%r1)
30867
- stfd %f3, 128+(2*8)(%r1)
30868
- stfd %f4, 128+(3*8)(%r1)
30869
- stfd %f5, 128+(4*8)(%r1)
30870
- stfd %f6, 128+(5*8)(%r1)
30871
- stfd %f7, 128+(6*8)(%r1)
30872
- stfd %f8, 128+(7*8)(%r1)
30873
- stfd %f9, 128+(8*8)(%r1)
30874
- stfd %f10, 128+(9*8)(%r1)
30875
- stfd %f11, 128+(10*8)(%r1)
30876
- stfd %f12, 128+(11*8)(%r1)
30877
- stfd %f13, 128+(12*8)(%r1)
30878
+ stfd %f1, -104+(0*8)(%r1)
30879
+ stfd %f2, -104+(1*8)(%r1)
30880
+ stfd %f3, -104+(2*8)(%r1)
30881
+ stfd %f4, -104+(3*8)(%r1)
30882
+ stfd %f5, -104+(4*8)(%r1)
30883
+ stfd %f6, -104+(5*8)(%r1)
30884
+ stfd %f7, -104+(6*8)(%r1)
30885
+ stfd %f8, -104+(7*8)(%r1)
30886
+ stfd %f9, -104+(8*8)(%r1)
30887
+ stfd %f10, -104+(9*8)(%r1)
30888
+ stfd %f11, -104+(10*8)(%r1)
30889
+ stfd %f12, -104+(11*8)(%r1)
30890
+ stfd %f13, -104+(12*8)(%r1)
30892
- # set up registers for the routine that actually does the work
30893
- # get the context pointer from the trampoline
30895
+ # load up the pointer to the saved fpr registers */
30896
+ addi %r6, %r1, -104
30898
- # now load up the pointer to the result storage
30899
- addi %r4, %r1, 112
30900
+ # load up the pointer to the result storage
30901
+ addi %r4, %r1, -STACKFRAME+RETVAL
30903
- # now load up the pointer to the parameter save area
30904
- # in the previous frame
30905
- addi %r5, %r1, 240 + 48
30906
+ stdu %r1, -STACKFRAME(%r1)
30909
- # now load up the pointer to the saved fpr registers */
30910
- addi %r6, %r1, 128
30911
+ # get the context pointer from the trampoline
30915
-#ifdef _CALL_LINUX
30916
+# if defined _CALL_LINUX || _CALL_ELF == 2
30917
bl ffi_closure_helper_LINUX64
30920
bl .ffi_closure_helper_LINUX64
30925
# now r3 contains the return type
30926
@@ -112,10 +159,12 @@
30928
# look up the proper starting point in table
30929
# by using return type as offset
30930
+ ld %r0, STACKFRAME+16(%r1)
30931
+ cmpldi %r3, FFI_V2_TYPE_SMALL_STRUCT
30933
mflr %r4 # move address of .Lret to r4
30934
sldi %r3, %r3, 4 # now multiply return type by 16
30935
addi %r4, %r4, .Lret_type0 - .Lret
30936
- ld %r0, 240+16(%r1)
30937
add %r3, %r3, %r4 # add contents of table to table address
30940
@@ -128,117 +177,175 @@
30942
# case FFI_TYPE_VOID
30944
- addi %r1, %r1, 240
30945
+ addi %r1, %r1, STACKFRAME
30948
# case FFI_TYPE_INT
30949
-#ifdef __LITTLE_ENDIAN__
30950
- lwa %r3, 112+0(%r1)
30952
- lwa %r3, 112+4(%r1)
30954
+# ifdef __LITTLE_ENDIAN__
30955
+ lwa %r3, RETVAL+0(%r1)
30957
+ lwa %r3, RETVAL+4(%r1)
30960
- addi %r1, %r1, 240
30961
+ addi %r1, %r1, STACKFRAME
30963
# case FFI_TYPE_FLOAT
30964
- lfs %f1, 112+0(%r1)
30965
+ lfs %f1, RETVAL+0(%r1)
30967
- addi %r1, %r1, 240
30968
+ addi %r1, %r1, STACKFRAME
30970
# case FFI_TYPE_DOUBLE
30971
- lfd %f1, 112+0(%r1)
30972
+ lfd %f1, RETVAL+0(%r1)
30974
- addi %r1, %r1, 240
30975
+ addi %r1, %r1, STACKFRAME
30977
# case FFI_TYPE_LONGDOUBLE
30978
- lfd %f1, 112+0(%r1)
30979
+ lfd %f1, RETVAL+0(%r1)
30981
- lfd %f2, 112+8(%r1)
30982
+ lfd %f2, RETVAL+8(%r1)
30984
# case FFI_TYPE_UINT8
30985
-#ifdef __LITTLE_ENDIAN__
30986
- lbz %r3, 112+0(%r1)
30988
- lbz %r3, 112+7(%r1)
30990
+# ifdef __LITTLE_ENDIAN__
30991
+ lbz %r3, RETVAL+0(%r1)
30993
+ lbz %r3, RETVAL+7(%r1)
30996
- addi %r1, %r1, 240
30997
+ addi %r1, %r1, STACKFRAME
30999
# case FFI_TYPE_SINT8
31000
-#ifdef __LITTLE_ENDIAN__
31001
- lbz %r3, 112+0(%r1)
31003
- lbz %r3, 112+7(%r1)
31005
+# ifdef __LITTLE_ENDIAN__
31006
+ lbz %r3, RETVAL+0(%r1)
31008
+ lbz %r3, RETVAL+7(%r1)
31013
# case FFI_TYPE_UINT16
31014
-#ifdef __LITTLE_ENDIAN__
31015
- lhz %r3, 112+0(%r1)
31017
- lhz %r3, 112+6(%r1)
31019
+# ifdef __LITTLE_ENDIAN__
31020
+ lhz %r3, RETVAL+0(%r1)
31022
+ lhz %r3, RETVAL+6(%r1)
31026
- addi %r1, %r1, 240
31027
+ addi %r1, %r1, STACKFRAME
31029
# case FFI_TYPE_SINT16
31030
-#ifdef __LITTLE_ENDIAN__
31031
- lha %r3, 112+0(%r1)
31033
- lha %r3, 112+6(%r1)
31035
+# ifdef __LITTLE_ENDIAN__
31036
+ lha %r3, RETVAL+0(%r1)
31038
+ lha %r3, RETVAL+6(%r1)
31041
- addi %r1, %r1, 240
31042
+ addi %r1, %r1, STACKFRAME
31044
# case FFI_TYPE_UINT32
31045
-#ifdef __LITTLE_ENDIAN__
31046
- lwz %r3, 112+0(%r1)
31048
- lwz %r3, 112+4(%r1)
31050
+# ifdef __LITTLE_ENDIAN__
31051
+ lwz %r3, RETVAL+0(%r1)
31053
+ lwz %r3, RETVAL+4(%r1)
31056
- addi %r1, %r1, 240
31057
+ addi %r1, %r1, STACKFRAME
31059
# case FFI_TYPE_SINT32
31060
-#ifdef __LITTLE_ENDIAN__
31061
- lwa %r3, 112+0(%r1)
31063
- lwa %r3, 112+4(%r1)
31065
+# ifdef __LITTLE_ENDIAN__
31066
+ lwa %r3, RETVAL+0(%r1)
31068
+ lwa %r3, RETVAL+4(%r1)
31071
- addi %r1, %r1, 240
31072
+ addi %r1, %r1, STACKFRAME
31074
# case FFI_TYPE_UINT64
31075
- ld %r3, 112+0(%r1)
31076
+ ld %r3, RETVAL+0(%r1)
31078
- addi %r1, %r1, 240
31079
+ addi %r1, %r1, STACKFRAME
31081
# case FFI_TYPE_SINT64
31082
- ld %r3, 112+0(%r1)
31083
+ ld %r3, RETVAL+0(%r1)
31085
- addi %r1, %r1, 240
31086
+ addi %r1, %r1, STACKFRAME
31088
# case FFI_TYPE_STRUCT
31090
- addi %r1, %r1, 240
31091
+ addi %r1, %r1, STACKFRAME
31094
# case FFI_TYPE_POINTER
31095
- ld %r3, 112+0(%r1)
31096
+ ld %r3, RETVAL+0(%r1)
31098
- addi %r1, %r1, 240
31099
+ addi %r1, %r1, STACKFRAME
31102
+# case FFI_V2_TYPE_FLOAT_HOMOG
31103
+ lfs %f1, RETVAL+0(%r1)
31104
+ lfs %f2, RETVAL+4(%r1)
31105
+ lfs %f3, RETVAL+8(%r1)
31107
+# case FFI_V2_TYPE_DOUBLE_HOMOG
31108
+ lfd %f1, RETVAL+0(%r1)
31109
+ lfd %f2, RETVAL+8(%r1)
31110
+ lfd %f3, RETVAL+16(%r1)
31111
+ lfd %f4, RETVAL+24(%r1)
31113
+ lfd %f5, RETVAL+32(%r1)
31114
+ lfd %f6, RETVAL+40(%r1)
31115
+ lfd %f7, RETVAL+48(%r1)
31116
+ lfd %f8, RETVAL+56(%r1)
31117
+ addi %r1, %r1, STACKFRAME
31120
+ lfs %f4, RETVAL+12(%r1)
31122
+ lfs %f5, RETVAL+16(%r1)
31123
+ lfs %f6, RETVAL+20(%r1)
31124
+ lfs %f7, RETVAL+24(%r1)
31125
+ lfs %f8, RETVAL+28(%r1)
31126
+ addi %r1, %r1, STACKFRAME
31129
+# ifdef __LITTLE_ENDIAN__
31130
+ ld %r3,RETVAL+0(%r1)
31132
+ ld %r4,RETVAL+8(%r1)
31133
+ addi %r1, %r1, STACKFRAME
31136
+ # A struct smaller than a dword is returned in the low bits of r3
31137
+ # ie. right justified. Larger structs are passed left justified
31138
+ # in r3 and r4. The return value area on the stack will have
31139
+ # the structs as they are usually stored in memory.
31140
+ cmpldi %r3, FFI_V2_TYPE_SMALL_STRUCT + 7 # size 8 bytes?
31142
+ ld %r3,RETVAL+0(%r1)
31145
+ ld %r4,RETVAL+8(%r1)
31146
+ addi %r1, %r1, STACKFRAME
31149
+ addi %r5, %r5, FFI_V2_TYPE_SMALL_STRUCT + 7
31152
+ addi %r1, %r1, STACKFRAME
31153
+ srd %r3, %r3, %r5
31159
.byte 0,12,0,1,128,0,0,0
31160
-#ifdef _CALL_LINUX
31161
+# if _CALL_ELF == 2
31162
+ .size ffi_closure_LINUX64,.-ffi_closure_LINUX64
31164
+# ifdef _CALL_LINUX
31165
.size ffi_closure_LINUX64,.-.L.ffi_closure_LINUX64
31168
.size .ffi_closure_LINUX64,.-.ffi_closure_LINUX64
31173
.section .eh_frame,EH_FRAME_FLAGS,@progbits
31175
@@ -267,14 +374,14 @@
31176
.byte 0x2 # DW_CFA_advance_loc1
31178
.byte 0xe # DW_CFA_def_cfa_offset
31180
+ .uleb128 STACKFRAME
31181
.byte 0x11 # DW_CFA_offset_extended_sf
31188
-#if defined __ELF__ && defined __linux__
31189
+# if defined __ELF__ && defined __linux__
31190
.section .note.GNU-stack,"",@progbits
31193
--- a/src/libffi/src/powerpc/ffi_powerpc.h
31194
+++ b/src/libffi/src/powerpc/ffi_powerpc.h
31196
+/* -----------------------------------------------------------------------
31197
+ ffi_powerpc.h - Copyright (C) 2013 IBM
31198
+ Copyright (C) 2011 Anthony Green
31199
+ Copyright (C) 2011 Kyle Moffett
31200
+ Copyright (C) 2008 Red Hat, Inc
31201
+ Copyright (C) 2007, 2008 Free Software Foundation, Inc
31202
+ Copyright (c) 1998 Geoffrey Keating
31204
+ PowerPC Foreign Function Interface
31206
+ Permission is hereby granted, free of charge, to any person obtaining
31207
+ a copy of this software and associated documentation files (the
31208
+ ``Software''), to deal in the Software without restriction, including
31209
+ without limitation the rights to use, copy, modify, merge, publish,
31210
+ distribute, sublicense, and/or sell copies of the Software, and to
31211
+ permit persons to whom the Software is furnished to do so, subject to
31212
+ the following conditions:
31214
+ The above copyright notice and this permission notice shall be included
31215
+ in all copies or substantial portions of the Software.
31217
+ THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, EXPRESS
31218
+ OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
31219
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
31220
+ IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY CLAIM, DAMAGES OR
31221
+ OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
31222
+ ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
31223
+ OTHER DEALINGS IN THE SOFTWARE.
31224
+ ----------------------------------------------------------------------- */
31227
+ /* The assembly depends on these exact flags. */
31228
+ /* These go in cr7 */
31229
+ FLAG_RETURNS_SMST = 1 << (31-31), /* Used for FFI_SYSV small structs. */
31230
+ FLAG_RETURNS_NOTHING = 1 << (31-30),
31231
+ FLAG_RETURNS_FP = 1 << (31-29),
31232
+ FLAG_RETURNS_64BITS = 1 << (31-28),
31234
+ /* This goes in cr6 */
31235
+ FLAG_RETURNS_128BITS = 1 << (31-27),
31237
+ FLAG_COMPAT = 1 << (31- 8), /* Not used by assembly */
31239
+ /* These go in cr1 */
31240
+ FLAG_ARG_NEEDS_COPY = 1 << (31- 7), /* Used by sysv code */
31241
+ FLAG_ARG_NEEDS_PSAVE = FLAG_ARG_NEEDS_COPY, /* Used by linux64 code */
31242
+ FLAG_FP_ARGUMENTS = 1 << (31- 6), /* cr1.eq; specified by ABI */
31243
+ FLAG_4_GPR_ARGUMENTS = 1 << (31- 5),
31244
+ FLAG_RETVAL_REFERENCE = 1 << (31- 4)
31253
+void FFI_HIDDEN ffi_closure_SYSV (void);
31254
+void FFI_HIDDEN ffi_call_SYSV(extended_cif *, unsigned, unsigned, unsigned *,
31257
+void FFI_HIDDEN ffi_prep_types_sysv (ffi_abi);
31258
+ffi_status FFI_HIDDEN ffi_prep_cif_sysv (ffi_cif *);
31259
+int FFI_HIDDEN ffi_closure_helper_SYSV (ffi_closure *, void *, unsigned long *,
31260
+ ffi_dblfl *, unsigned long *);
31262
+void FFI_HIDDEN ffi_call_LINUX64(extended_cif *, unsigned long, unsigned long,
31263
+ unsigned long *, void (*)(void));
31264
+void FFI_HIDDEN ffi_closure_LINUX64 (void);
31266
+void FFI_HIDDEN ffi_prep_types_linux64 (ffi_abi);
31267
+ffi_status FFI_HIDDEN ffi_prep_cif_linux64 (ffi_cif *);
31268
+ffi_status FFI_HIDDEN ffi_prep_cif_linux64_var (ffi_cif *, unsigned int,
31270
+void FFI_HIDDEN ffi_prep_args64 (extended_cif *, unsigned long *const);
31271
+int FFI_HIDDEN ffi_closure_helper_LINUX64 (ffi_closure *, void *,
31272
+ unsigned long *, ffi_dblfl *);
31273
--- a/src/libffi/src/powerpc/ffi_sysv.c
31274
+++ b/src/libffi/src/powerpc/ffi_sysv.c
31276
+/* -----------------------------------------------------------------------
31277
+ ffi_sysv.c - Copyright (C) 2013 IBM
31278
+ Copyright (C) 2011 Anthony Green
31279
+ Copyright (C) 2011 Kyle Moffett
31280
+ Copyright (C) 2008 Red Hat, Inc
31281
+ Copyright (C) 2007, 2008 Free Software Foundation, Inc
31282
+ Copyright (c) 1998 Geoffrey Keating
31284
+ PowerPC Foreign Function Interface
31286
+ Permission is hereby granted, free of charge, to any person obtaining
31287
+ a copy of this software and associated documentation files (the
31288
+ ``Software''), to deal in the Software without restriction, including
31289
+ without limitation the rights to use, copy, modify, merge, publish,
31290
+ distribute, sublicense, and/or sell copies of the Software, and to
31291
+ permit persons to whom the Software is furnished to do so, subject to
31292
+ the following conditions:
31294
+ The above copyright notice and this permission notice shall be included
31295
+ in all copies or substantial portions of the Software.
31297
+ THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, EXPRESS
31298
+ OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
31299
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
31300
+ IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY CLAIM, DAMAGES OR
31301
+ OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
31302
+ ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
31303
+ OTHER DEALINGS IN THE SOFTWARE.
31304
+ ----------------------------------------------------------------------- */
31309
+#include "ffi_common.h"
31310
+#include "ffi_powerpc.h"
31313
+/* About the SYSV ABI. */
31314
+#define ASM_NEEDS_REGISTERS 4
31315
+#define NUM_GPR_ARG_REGISTERS 8
31316
+#define NUM_FPR_ARG_REGISTERS 8
31319
+#if HAVE_LONG_DOUBLE_VARIANT && FFI_TYPE_LONGDOUBLE != FFI_TYPE_DOUBLE
31320
+/* Adjust size of ffi_type_longdouble. */
31322
+ffi_prep_types_sysv (ffi_abi abi)
31324
+ if ((abi & (FFI_SYSV | FFI_SYSV_LONG_DOUBLE_128)) == FFI_SYSV)
31326
+ ffi_type_longdouble.size = 8;
31327
+ ffi_type_longdouble.alignment = 8;
31331
+ ffi_type_longdouble.size = 16;
31332
+ ffi_type_longdouble.alignment = 16;
31337
+/* Transform long double, double and float to other types as per abi. */
31339
+translate_float (int abi, int type)
31341
+#if FFI_TYPE_LONGDOUBLE != FFI_TYPE_DOUBLE
31342
+ if (type == FFI_TYPE_LONGDOUBLE
31343
+ && (abi & FFI_SYSV_LONG_DOUBLE_128) == 0)
31344
+ type = FFI_TYPE_DOUBLE;
31346
+ if ((abi & FFI_SYSV_SOFT_FLOAT) != 0)
31348
+ if (type == FFI_TYPE_FLOAT)
31349
+ type = FFI_TYPE_UINT32;
31350
+ else if (type == FFI_TYPE_DOUBLE)
31351
+ type = FFI_TYPE_UINT64;
31352
+#if FFI_TYPE_LONGDOUBLE != FFI_TYPE_DOUBLE
31353
+ else if (type == FFI_TYPE_LONGDOUBLE)
31354
+ type = FFI_TYPE_UINT128;
31356
+ else if ((abi & FFI_SYSV_IBM_LONG_DOUBLE) == 0)
31358
+ if (type == FFI_TYPE_LONGDOUBLE)
31359
+ type = FFI_TYPE_STRUCT;
31365
+/* Perform machine dependent cif processing */
31367
+ffi_prep_cif_sysv_core (ffi_cif *cif)
31371
+ unsigned i, fparg_count = 0, intarg_count = 0;
31372
+ unsigned flags = cif->flags;
31373
+ unsigned struct_copy_size = 0;
31374
+ unsigned type = cif->rtype->type;
31375
+ unsigned size = cif->rtype->size;
31377
+ /* The machine-independent calculation of cif->bytes doesn't work
31378
+ for us. Redo the calculation. */
31380
+ /* Space for the frame pointer, callee's LR, and the asm's temp regs. */
31381
+ bytes = (2 + ASM_NEEDS_REGISTERS) * sizeof (int);
31383
+ /* Space for the GPR registers. */
31384
+ bytes += NUM_GPR_ARG_REGISTERS * sizeof (int);
31386
+ /* Return value handling. The rules for SYSV are as follows:
31387
+ - 32-bit (or less) integer values are returned in gpr3;
31388
+ - Structures of size <= 4 bytes also returned in gpr3;
31389
+ - 64-bit integer values and structures between 5 and 8 bytes are returned
31390
+ in gpr3 and gpr4;
31391
+ - Larger structures are allocated space and a pointer is passed as
31392
+ the first argument.
31393
+ - Single/double FP values are returned in fpr1;
31394
+ - long doubles (if not equivalent to double) are returned in
31395
+ fpr1,fpr2 for Linux and as for large structs for SysV. */
31397
+ type = translate_float (cif->abi, type);
31401
+#if FFI_TYPE_LONGDOUBLE != FFI_TYPE_DOUBLE
31402
+ case FFI_TYPE_LONGDOUBLE:
31403
+ flags |= FLAG_RETURNS_128BITS;
31404
+ /* Fall through. */
31406
+ case FFI_TYPE_DOUBLE:
31407
+ flags |= FLAG_RETURNS_64BITS;
31408
+ /* Fall through. */
31409
+ case FFI_TYPE_FLOAT:
31410
+ flags |= FLAG_RETURNS_FP;
31411
+#ifdef __NO_FPRS__
31412
+ return FFI_BAD_ABI;
31416
+ case FFI_TYPE_UINT128:
31417
+ flags |= FLAG_RETURNS_128BITS;
31418
+ /* Fall through. */
31419
+ case FFI_TYPE_UINT64:
31420
+ case FFI_TYPE_SINT64:
31421
+ flags |= FLAG_RETURNS_64BITS;
31424
+ case FFI_TYPE_STRUCT:
31425
+ /* The final SYSV ABI says that structures smaller or equal 8 bytes
31426
+ are returned in r3/r4. A draft ABI used by linux instead
31427
+ returns them in memory. */
31428
+ if ((cif->abi & FFI_SYSV_STRUCT_RET) != 0 && size <= 8)
31430
+ flags |= FLAG_RETURNS_SMST;
31434
+ flags |= FLAG_RETVAL_REFERENCE;
31435
+ /* Fall through. */
31436
+ case FFI_TYPE_VOID:
31437
+ flags |= FLAG_RETURNS_NOTHING;
31441
+ /* Returns 32-bit integer, or similar. Nothing to do here. */
31445
+ /* The first NUM_GPR_ARG_REGISTERS words of integer arguments, and the
31446
+ first NUM_FPR_ARG_REGISTERS fp arguments, go in registers; the rest
31447
+ goes on the stack. Structures and long doubles (if not equivalent
31448
+ to double) are passed as a pointer to a copy of the structure.
31449
+ Stuff on the stack needs to keep proper alignment. */
31450
+ for (ptr = cif->arg_types, i = cif->nargs; i > 0; i--, ptr++)
31452
+ unsigned short typenum = (*ptr)->type;
31454
+ typenum = translate_float (cif->abi, typenum);
31458
+#if FFI_TYPE_LONGDOUBLE != FFI_TYPE_DOUBLE
31459
+ case FFI_TYPE_LONGDOUBLE:
31463
+ case FFI_TYPE_DOUBLE:
31465
+ /* If this FP arg is going on the stack, it must be
31466
+ 8-byte-aligned. */
31467
+ if (fparg_count > NUM_FPR_ARG_REGISTERS
31468
+ && intarg_count >= NUM_GPR_ARG_REGISTERS
31469
+ && intarg_count % 2 != 0)
31471
+#ifdef __NO_FPRS__
31472
+ return FFI_BAD_ABI;
31476
+ case FFI_TYPE_FLOAT:
31478
+#ifdef __NO_FPRS__
31479
+ return FFI_BAD_ABI;
31483
+ case FFI_TYPE_UINT128:
31484
+ /* A long double in FFI_LINUX_SOFT_FLOAT can use only a set
31485
+ of four consecutive gprs. If we do not have enough, we
31486
+ have to adjust the intarg_count value. */
31487
+ if (intarg_count >= NUM_GPR_ARG_REGISTERS - 3
31488
+ && intarg_count < NUM_GPR_ARG_REGISTERS)
31489
+ intarg_count = NUM_GPR_ARG_REGISTERS;
31490
+ intarg_count += 4;
31493
+ case FFI_TYPE_UINT64:
31494
+ case FFI_TYPE_SINT64:
31495
+ /* 'long long' arguments are passed as two words, but
31496
+ either both words must fit in registers or both go
31497
+ on the stack. If they go on the stack, they must
31498
+ be 8-byte-aligned.
31500
+ Also, only certain register pairs can be used for
31501
+ passing long long int -- specifically (r3,r4), (r5,r6),
31502
+ (r7,r8), (r9,r10). */
31503
+ if (intarg_count == NUM_GPR_ARG_REGISTERS-1
31504
+ || intarg_count % 2 != 0)
31506
+ intarg_count += 2;
31509
+ case FFI_TYPE_STRUCT:
31510
+ /* We must allocate space for a copy of these to enforce
31511
+ pass-by-value. Pad the space up to a multiple of 16
31512
+ bytes (the maximum alignment required for anything under
31513
+ the SYSV ABI). */
31514
+ struct_copy_size += ((*ptr)->size + 15) & ~0xF;
31515
+ /* Fall through (allocate space for the pointer). */
31517
+ case FFI_TYPE_POINTER:
31518
+ case FFI_TYPE_INT:
31519
+ case FFI_TYPE_UINT32:
31520
+ case FFI_TYPE_SINT32:
31521
+ case FFI_TYPE_UINT16:
31522
+ case FFI_TYPE_SINT16:
31523
+ case FFI_TYPE_UINT8:
31524
+ case FFI_TYPE_SINT8:
31525
+ /* Everything else is passed as a 4-byte word in a GPR, either
31526
+ the object itself or a pointer to it. */
31535
+ if (fparg_count != 0)
31536
+ flags |= FLAG_FP_ARGUMENTS;
31537
+ if (intarg_count > 4)
31538
+ flags |= FLAG_4_GPR_ARGUMENTS;
31539
+ if (struct_copy_size != 0)
31540
+ flags |= FLAG_ARG_NEEDS_COPY;
31542
+ /* Space for the FPR registers, if needed. */
31543
+ if (fparg_count != 0)
31544
+ bytes += NUM_FPR_ARG_REGISTERS * sizeof (double);
31546
+ /* Stack space. */
31547
+ if (intarg_count > NUM_GPR_ARG_REGISTERS)
31548
+ bytes += (intarg_count - NUM_GPR_ARG_REGISTERS) * sizeof (int);
31549
+ if (fparg_count > NUM_FPR_ARG_REGISTERS)
31550
+ bytes += (fparg_count - NUM_FPR_ARG_REGISTERS) * sizeof (double);
31552
+ /* The stack space allocated needs to be a multiple of 16 bytes. */
31553
+ bytes = (bytes + 15) & ~0xF;
31555
+ /* Add in the space for the copied structures. */
31556
+ bytes += struct_copy_size;
31558
+ cif->flags = flags;
31559
+ cif->bytes = bytes;
31564
+ffi_status FFI_HIDDEN
31565
+ffi_prep_cif_sysv (ffi_cif *cif)
31567
+ if ((cif->abi & FFI_SYSV) == 0)
31569
+ /* This call is from old code. Translate to new ABI values. */
31570
+ cif->flags |= FLAG_COMPAT;
31571
+ switch (cif->abi)
31574
+ return FFI_BAD_ABI;
31576
+ case FFI_COMPAT_SYSV:
31577
+ cif->abi = FFI_SYSV | FFI_SYSV_STRUCT_RET | FFI_SYSV_LONG_DOUBLE_128;
31580
+ case FFI_COMPAT_GCC_SYSV:
31581
+ cif->abi = FFI_SYSV | FFI_SYSV_LONG_DOUBLE_128;
31584
+ case FFI_COMPAT_LINUX:
31585
+ cif->abi = (FFI_SYSV | FFI_SYSV_IBM_LONG_DOUBLE
31586
+ | FFI_SYSV_LONG_DOUBLE_128);
31589
+ case FFI_COMPAT_LINUX_SOFT_FLOAT:
31590
+ cif->abi = (FFI_SYSV | FFI_SYSV_SOFT_FLOAT | FFI_SYSV_IBM_LONG_DOUBLE
31591
+ | FFI_SYSV_LONG_DOUBLE_128);
31595
+ return ffi_prep_cif_sysv_core (cif);
31598
+/* ffi_prep_args_SYSV is called by the assembly routine once stack space
31599
+ has been allocated for the function's arguments.
31601
+ The stack layout we want looks like this:
31603
+ | Return address from ffi_call_SYSV 4bytes | higher addresses
31604
+ |--------------------------------------------|
31605
+ | Previous backchain pointer 4 | stack pointer here
31606
+ |--------------------------------------------|<+ <<< on entry to
31607
+ | Saved r28-r31 4*4 | | ffi_call_SYSV
31608
+ |--------------------------------------------| |
31609
+ | GPR registers r3-r10 8*4 | | ffi_call_SYSV
31610
+ |--------------------------------------------| |
31611
+ | FPR registers f1-f8 (optional) 8*8 | |
31612
+ |--------------------------------------------| | stack |
31613
+ | Space for copied structures | | grows |
31614
+ |--------------------------------------------| | down V
31615
+ | Parameters that didn't fit in registers | |
31616
+ |--------------------------------------------| | lower addresses
31617
+ | Space for callee's LR 4 | |
31618
+ |--------------------------------------------| | stack pointer here
31619
+ | Current backchain pointer 4 |-/ during
31620
+ |--------------------------------------------| <<< ffi_call_SYSV
31625
+ffi_prep_args_SYSV (extended_cif *ecif, unsigned *const stack)
31627
+ const unsigned bytes = ecif->cif->bytes;
31628
+ const unsigned flags = ecif->cif->flags;
31639
+ /* 'stacktop' points at the previous backchain pointer. */
31642
+ /* 'gpr_base' points at the space for gpr3, and grows upwards as
31643
+ we use GPR registers. */
31645
+ int intarg_count;
31647
+#ifndef __NO_FPRS__
31648
+ /* 'fpr_base' points at the space for fpr1, and grows upwards as
31649
+ we use FPR registers. */
31654
+ /* 'copy_space' grows down as we put structures in it. It should
31655
+ stay 16-byte aligned. */
31658
+ /* 'next_arg' grows up as we put parameters in it. */
31663
+#ifndef __NO_FPRS__
31664
+ double double_tmp;
31670
+ signed char **sc;
31671
+ unsigned char **uc;
31672
+ signed short **ss;
31673
+ unsigned short **us;
31674
+ unsigned int **ui;
31679
+ size_t struct_copy_size;
31680
+ unsigned gprvalue;
31682
+ stacktop.c = (char *) stack + bytes;
31683
+ gpr_base.u = stacktop.u - ASM_NEEDS_REGISTERS - NUM_GPR_ARG_REGISTERS;
31684
+ intarg_count = 0;
31685
+#ifndef __NO_FPRS__
31686
+ fpr_base.d = gpr_base.d - NUM_FPR_ARG_REGISTERS;
31688
+ copy_space.c = ((flags & FLAG_FP_ARGUMENTS) ? fpr_base.c : gpr_base.c);
31690
+ copy_space.c = gpr_base.c;
31692
+ next_arg.u = stack + 2;
31694
+ /* Check that everything starts aligned properly. */
31695
+ FFI_ASSERT (((unsigned long) (char *) stack & 0xF) == 0);
31696
+ FFI_ASSERT (((unsigned long) copy_space.c & 0xF) == 0);
31697
+ FFI_ASSERT (((unsigned long) stacktop.c & 0xF) == 0);
31698
+ FFI_ASSERT ((bytes & 0xF) == 0);
31699
+ FFI_ASSERT (copy_space.c >= next_arg.c);
31701
+ /* Deal with return values that are actually pass-by-reference. */
31702
+ if (flags & FLAG_RETVAL_REFERENCE)
31704
+ *gpr_base.u++ = (unsigned long) (char *) ecif->rvalue;
31708
+ /* Now for the arguments. */
31709
+ p_argv.v = ecif->avalue;
31710
+ for (ptr = ecif->cif->arg_types, i = ecif->cif->nargs;
31712
+ i--, ptr++, p_argv.v++)
31714
+ unsigned int typenum = (*ptr)->type;
31716
+ typenum = translate_float (ecif->cif->abi, typenum);
31718
+ /* Now test the translated value */
31721
+#ifndef __NO_FPRS__
31722
+# if FFI_TYPE_LONGDOUBLE != FFI_TYPE_DOUBLE
31723
+ case FFI_TYPE_LONGDOUBLE:
31724
+ double_tmp = (*p_argv.d)[0];
31726
+ if (fparg_count >= NUM_FPR_ARG_REGISTERS - 1)
31728
+ if (intarg_count >= NUM_GPR_ARG_REGISTERS
31729
+ && intarg_count % 2 != 0)
31734
+ *next_arg.d = double_tmp;
31736
+ double_tmp = (*p_argv.d)[1];
31737
+ *next_arg.d = double_tmp;
31742
+ *fpr_base.d++ = double_tmp;
31743
+ double_tmp = (*p_argv.d)[1];
31744
+ *fpr_base.d++ = double_tmp;
31747
+ fparg_count += 2;
31748
+ FFI_ASSERT (flags & FLAG_FP_ARGUMENTS);
31751
+ case FFI_TYPE_DOUBLE:
31752
+ double_tmp = **p_argv.d;
31754
+ if (fparg_count >= NUM_FPR_ARG_REGISTERS)
31756
+ if (intarg_count >= NUM_GPR_ARG_REGISTERS
31757
+ && intarg_count % 2 != 0)
31762
+ *next_arg.d = double_tmp;
31766
+ *fpr_base.d++ = double_tmp;
31768
+ FFI_ASSERT (flags & FLAG_FP_ARGUMENTS);
31771
+ case FFI_TYPE_FLOAT:
31772
+ double_tmp = **p_argv.f;
31773
+ if (fparg_count >= NUM_FPR_ARG_REGISTERS)
31775
+ *next_arg.f = (float) double_tmp;
31780
+ *fpr_base.d++ = double_tmp;
31782
+ FFI_ASSERT (flags & FLAG_FP_ARGUMENTS);
31784
+#endif /* have FPRs */
31786
+ case FFI_TYPE_UINT128:
31787
+ /* The soft float ABI for long doubles works like this, a long double
31788
+ is passed in four consecutive GPRs if available. A maximum of 2
31789
+ long doubles can be passed in gprs. If we do not have 4 GPRs
31790
+ left, the long double is passed on the stack, 4-byte aligned. */
31792
+ unsigned int int_tmp;
31794
+ if (intarg_count >= NUM_GPR_ARG_REGISTERS - 3)
31796
+ if (intarg_count < NUM_GPR_ARG_REGISTERS)
31797
+ intarg_count = NUM_GPR_ARG_REGISTERS;
31798
+ for (ii = 0; ii < 4; ii++)
31800
+ int_tmp = (*p_argv.ui)[ii];
31801
+ *next_arg.u++ = int_tmp;
31806
+ for (ii = 0; ii < 4; ii++)
31808
+ int_tmp = (*p_argv.ui)[ii];
31809
+ *gpr_base.u++ = int_tmp;
31812
+ intarg_count += 4;
31816
+ case FFI_TYPE_UINT64:
31817
+ case FFI_TYPE_SINT64:
31818
+ if (intarg_count == NUM_GPR_ARG_REGISTERS-1)
31820
+ if (intarg_count >= NUM_GPR_ARG_REGISTERS)
31822
+ if (intarg_count % 2 != 0)
31827
+ *next_arg.ll = **p_argv.ll;
31832
+ /* The abi states only certain register pairs can be
31833
+ used for passing long long int specifically (r3,r4),
31834
+ (r5,r6), (r7,r8), (r9,r10). If next arg is long long
31835
+ but not correct starting register of pair then skip
31836
+ until the proper starting register. */
31837
+ if (intarg_count % 2 != 0)
31842
+ *gpr_base.ll++ = **p_argv.ll;
31844
+ intarg_count += 2;
31847
+ case FFI_TYPE_STRUCT:
31848
+ struct_copy_size = ((*ptr)->size + 15) & ~0xF;
31849
+ copy_space.c -= struct_copy_size;
31850
+ memcpy (copy_space.c, *p_argv.c, (*ptr)->size);
31852
+ gprvalue = (unsigned long) copy_space.c;
31854
+ FFI_ASSERT (copy_space.c > next_arg.c);
31855
+ FFI_ASSERT (flags & FLAG_ARG_NEEDS_COPY);
31858
+ case FFI_TYPE_UINT8:
31859
+ gprvalue = **p_argv.uc;
31861
+ case FFI_TYPE_SINT8:
31862
+ gprvalue = **p_argv.sc;
31864
+ case FFI_TYPE_UINT16:
31865
+ gprvalue = **p_argv.us;
31867
+ case FFI_TYPE_SINT16:
31868
+ gprvalue = **p_argv.ss;
31871
+ case FFI_TYPE_INT:
31872
+ case FFI_TYPE_UINT32:
31873
+ case FFI_TYPE_SINT32:
31874
+ case FFI_TYPE_POINTER:
31876
+ gprvalue = **p_argv.ui;
31879
+ if (intarg_count >= NUM_GPR_ARG_REGISTERS)
31880
+ *next_arg.u++ = gprvalue;
31882
+ *gpr_base.u++ = gprvalue;
31888
+ /* Check that we didn't overrun the stack... */
31889
+ FFI_ASSERT (copy_space.c >= next_arg.c);
31890
+ FFI_ASSERT (gpr_base.u <= stacktop.u - ASM_NEEDS_REGISTERS);
31891
+ /* The assert below is testing that the number of integer arguments agrees
31892
+ with the number found in ffi_prep_cif_machdep(). However, intarg_count
31893
+ is incremented whenever we place an FP arg on the stack, so account for
31894
+ that before our assert test. */
31895
+#ifndef __NO_FPRS__
31896
+ if (fparg_count > NUM_FPR_ARG_REGISTERS)
31897
+ intarg_count -= fparg_count - NUM_FPR_ARG_REGISTERS;
31898
+ FFI_ASSERT (fpr_base.u
31899
+ <= stacktop.u - ASM_NEEDS_REGISTERS - NUM_GPR_ARG_REGISTERS);
31901
+ FFI_ASSERT (flags & FLAG_4_GPR_ARGUMENTS || intarg_count <= 4);
31904
+#define MIN_CACHE_LINE_SIZE 8
31907
+flush_icache (char *wraddr, char *xaddr, int size)
31910
+ for (i = 0; i < size; i += MIN_CACHE_LINE_SIZE)
31911
+ __asm__ volatile ("icbi 0,%0;" "dcbf 0,%1;"
31912
+ : : "r" (xaddr + i), "r" (wraddr + i) : "memory");
31913
+ __asm__ volatile ("icbi 0,%0;" "dcbf 0,%1;" "sync;" "isync;"
31914
+ : : "r"(xaddr + size - 1), "r"(wraddr + size - 1)
31918
+ffi_status FFI_HIDDEN
31919
+ffi_prep_closure_loc_sysv (ffi_closure *closure,
31921
+ void (*fun) (ffi_cif *, void *, void **, void *),
31925
+ unsigned int *tramp;
31927
+ if (cif->abi < FFI_SYSV || cif->abi >= FFI_LAST_ABI)
31928
+ return FFI_BAD_ABI;
31930
+ tramp = (unsigned int *) &closure->tramp[0];
31931
+ tramp[0] = 0x7c0802a6; /* mflr r0 */
31932
+ tramp[1] = 0x4800000d; /* bl 10 <trampoline_initial+0x10> */
31933
+ tramp[4] = 0x7d6802a6; /* mflr r11 */
31934
+ tramp[5] = 0x7c0803a6; /* mtlr r0 */
31935
+ tramp[6] = 0x800b0000; /* lwz r0,0(r11) */
31936
+ tramp[7] = 0x816b0004; /* lwz r11,4(r11) */
31937
+ tramp[8] = 0x7c0903a6; /* mtctr r0 */
31938
+ tramp[9] = 0x4e800420; /* bctr */
31939
+ *(void **) &tramp[2] = (void *) ffi_closure_SYSV; /* function */
31940
+ *(void **) &tramp[3] = codeloc; /* context */
31942
+ /* Flush the icache. */
31943
+ flush_icache ((char *)tramp, (char *)codeloc, FFI_TRAMPOLINE_SIZE);
31945
+ closure->cif = cif;
31946
+ closure->fun = fun;
31947
+ closure->user_data = user_data;
31952
+/* Basically the trampoline invokes ffi_closure_SYSV, and on
31953
+ entry, r11 holds the address of the closure.
31954
+ After storing the registers that could possibly contain
31955
+ parameters to be passed into the stack frame and setting
31956
+ up space for a return value, ffi_closure_SYSV invokes the
31957
+ following helper function to do most of the work. */
31960
+ffi_closure_helper_SYSV (ffi_closure *closure, void *rvalue,
31961
+ unsigned long *pgr, ffi_dblfl *pfr,
31962
+ unsigned long *pst)
31964
+ /* rvalue is the pointer to space for return value in closure assembly */
31965
+ /* pgr is the pointer to where r3-r10 are stored in ffi_closure_SYSV */
31966
+ /* pfr is the pointer to where f1-f8 are stored in ffi_closure_SYSV */
31967
+ /* pst is the pointer to outgoing parameter stack in original caller */
31970
+ ffi_type ** arg_types;
31972
+#ifndef __NO_FPRS__
31973
+ long nf = 0; /* number of floating registers already used */
31975
+ long ng = 0; /* number of general registers already used */
31977
+ ffi_cif *cif = closure->cif;
31978
+ unsigned size = cif->rtype->size;
31979
+ unsigned short rtypenum = cif->rtype->type;
31981
+ avalue = alloca (cif->nargs * sizeof (void *));
31983
+ /* First translate for softfloat/nonlinux */
31984
+ rtypenum = translate_float (cif->abi, rtypenum);
31986
+ /* Copy the caller's structure return value address so that the closure
31987
+ returns the data directly to the caller.
31988
+ For FFI_SYSV the result is passed in r3/r4 if the struct size is less
31989
+ or equal 8 bytes. */
31990
+ if (rtypenum == FFI_TYPE_STRUCT
31991
+ && !((cif->abi & FFI_SYSV_STRUCT_RET) != 0 && size <= 8))
31993
+ rvalue = (void *) *pgr;
31999
+ avn = cif->nargs;
32000
+ arg_types = cif->arg_types;
32002
+ /* Grab the addresses of the arguments from the stack frame. */
32003
+ while (i < avn) {
32004
+ unsigned short typenum = arg_types[i]->type;
32006
+ /* We may need to handle some values depending on ABI. */
32007
+ typenum = translate_float (cif->abi, typenum);
32011
+#ifndef __NO_FPRS__
32012
+ case FFI_TYPE_FLOAT:
32013
+ /* Unfortunately float values are stored as doubles
32014
+ in the ffi_closure_SYSV code (since we don't check
32015
+ the type in that routine). */
32016
+ if (nf < NUM_FPR_ARG_REGISTERS)
32018
+ /* FIXME? here we are really changing the values
32019
+ stored in the original calling routines outgoing
32020
+ parameter stack. This is probably a really
32021
+ naughty thing to do but... */
32022
+ double temp = pfr->d;
32023
+ pfr->f = (float) temp;
32035
+ case FFI_TYPE_DOUBLE:
32036
+ if (nf < NUM_FPR_ARG_REGISTERS)
32044
+ if (((long) pst) & 4)
32051
+# if FFI_TYPE_LONGDOUBLE != FFI_TYPE_DOUBLE
32052
+ case FFI_TYPE_LONGDOUBLE:
32053
+ if (nf < NUM_FPR_ARG_REGISTERS - 1)
32061
+ if (((long) pst) & 4)
32071
+ case FFI_TYPE_UINT128:
32072
+ /* Test if for the whole long double, 4 gprs are available.
32073
+ otherwise the stuff ends up on the stack. */
32074
+ if (ng < NUM_GPR_ARG_REGISTERS - 3)
32088
+ case FFI_TYPE_SINT8:
32089
+ case FFI_TYPE_UINT8:
32090
+#ifndef __LITTLE_ENDIAN__
32091
+ if (ng < NUM_GPR_ARG_REGISTERS)
32093
+ avalue[i] = (char *) pgr + 3;
32099
+ avalue[i] = (char *) pst + 3;
32105
+ case FFI_TYPE_SINT16:
32106
+ case FFI_TYPE_UINT16:
32107
+#ifndef __LITTLE_ENDIAN__
32108
+ if (ng < NUM_GPR_ARG_REGISTERS)
32110
+ avalue[i] = (char *) pgr + 2;
32116
+ avalue[i] = (char *) pst + 2;
32122
+ case FFI_TYPE_SINT32:
32123
+ case FFI_TYPE_UINT32:
32124
+ case FFI_TYPE_POINTER:
32125
+ if (ng < NUM_GPR_ARG_REGISTERS)
32138
+ case FFI_TYPE_STRUCT:
32139
+ /* Structs are passed by reference. The address will appear in a
32140
+ gpr if it is one of the first 8 arguments. */
32141
+ if (ng < NUM_GPR_ARG_REGISTERS)
32143
+ avalue[i] = (void *) *pgr;
32149
+ avalue[i] = (void *) *pst;
32154
+ case FFI_TYPE_SINT64:
32155
+ case FFI_TYPE_UINT64:
32156
+ /* Passing long long ints are complex, they must
32157
+ be passed in suitable register pairs such as
32158
+ (r3,r4) or (r5,r6) or (r6,r7), or (r7,r8) or (r9,r10)
32159
+ and if the entire pair aren't available then the outgoing
32160
+ parameter stack is used for both but an alignment of 8
32161
+ must will be kept. So we must either look in pgr
32162
+ or pst to find the correct address for this type
32164
+ if (ng < NUM_GPR_ARG_REGISTERS - 1)
32168
+ /* skip r4, r6, r8 as starting points */
32178
+ if (((long) pst) & 4)
32182
+ ng = NUM_GPR_ARG_REGISTERS;
32193
+ (closure->fun) (cif, rvalue, avalue, closure->user_data);
32195
+ /* Tell ffi_closure_SYSV how to perform return type promotions.
32196
+ Because the FFI_SYSV ABI returns the structures <= 8 bytes in
32197
+ r3/r4 we have to tell ffi_closure_SYSV how to treat them. We
32198
+ combine the base type FFI_SYSV_TYPE_SMALL_STRUCT with the size of
32199
+ the struct less one. We never have a struct with size zero.
32200
+ See the comment in ffitarget.h about ordering. */
32201
+ if (rtypenum == FFI_TYPE_STRUCT
32202
+ && (cif->abi & FFI_SYSV_STRUCT_RET) != 0 && size <= 8)
32203
+ return FFI_SYSV_TYPE_SMALL_STRUCT - 1 + size;
32207
--- a/src/libffi/src/powerpc/linux64.S
32208
+++ b/src/libffi/src/powerpc/linux64.S
32209
@@ -29,18 +29,25 @@
32210
#include <fficonfig.h>
32213
-#ifdef __powerpc64__
32215
.hidden ffi_call_LINUX64
32216
.globl ffi_call_LINUX64
32217
+# if _CALL_ELF == 2
32220
+ addis %r2, %r12, .TOC.-ffi_call_LINUX64@ha
32221
+ addi %r2, %r2, .TOC.-ffi_call_LINUX64@l
32222
+ .localentry ffi_call_LINUX64, . - ffi_call_LINUX64
32224
.section ".opd","aw"
32227
-#ifdef _CALL_LINUX
32228
+# ifdef _CALL_LINUX
32229
.quad .L.ffi_call_LINUX64,.TOC.@tocbase,0
32230
.type ffi_call_LINUX64,@function
32232
.L.ffi_call_LINUX64:
32235
.hidden .ffi_call_LINUX64
32236
.globl .ffi_call_LINUX64
32237
.quad .ffi_call_LINUX64,.TOC.@tocbase,0
32239
.type .ffi_call_LINUX64,@function
32248
@@ -63,26 +71,35 @@
32249
mr %r31, %r5 /* flags, */
32250
mr %r30, %r6 /* rvalue, */
32251
mr %r29, %r7 /* function address. */
32252
+/* Save toc pointer, not for the ffi_prep_args64 call, but for the later
32253
+ bctrl function call. */
32254
+# if _CALL_ELF == 2
32260
/* Call ffi_prep_args64. */
32262
-#ifdef _CALL_LINUX
32263
+# if defined _CALL_LINUX || _CALL_ELF == 2
32267
bl .ffi_prep_args64
32272
+# if _CALL_ELF == 2
32280
/* Now do the call. */
32281
/* Set up cr1 with bits 4-7 of the flags. */
32284
/* Get the address to call into CTR. */
32287
/* Load all those argument registers. */
32288
ld %r3, -32-(8*8)(%r28)
32289
ld %r4, -32-(7*8)(%r28)
32290
@@ -117,12 +134,17 @@
32292
/* This must follow the call immediately, the unwinder
32293
uses this to find out if r2 has been saved or not. */
32294
+# if _CALL_ELF == 2
32300
/* Now, deal with the return value. */
32302
- bt- 30, .Ldone_return_value
32303
- bt- 29, .Lfp_return_value
32304
+ bt 31, .Lstruct_return_value
32305
+ bt 30, .Ldone_return_value
32306
+ bt 29, .Lfp_return_value
32308
/* Fall through... */
32310
@@ -130,7 +152,7 @@
32311
/* Restore the registers we used and return. */
32314
- ld %r28, -32(%r1)
32315
+ ld %r28, -32(%r28)
32319
@@ -147,14 +169,48 @@
32320
.Lfloat_return_value:
32322
b .Ldone_return_value
32324
+.Lstruct_return_value:
32325
+ bf 29, .Lsmall_struct
32326
+ bf 28, .Lfloat_homog_return_value
32327
+ stfd %f1, 0(%r30)
32328
+ stfd %f2, 8(%r30)
32329
+ stfd %f3, 16(%r30)
32330
+ stfd %f4, 24(%r30)
32331
+ stfd %f5, 32(%r30)
32332
+ stfd %f6, 40(%r30)
32333
+ stfd %f7, 48(%r30)
32334
+ stfd %f8, 56(%r30)
32335
+ b .Ldone_return_value
32337
+.Lfloat_homog_return_value:
32338
+ stfs %f1, 0(%r30)
32339
+ stfs %f2, 4(%r30)
32340
+ stfs %f3, 8(%r30)
32341
+ stfs %f4, 12(%r30)
32342
+ stfs %f5, 16(%r30)
32343
+ stfs %f6, 20(%r30)
32344
+ stfs %f7, 24(%r30)
32345
+ stfs %f8, 28(%r30)
32346
+ b .Ldone_return_value
32351
+ b .Ldone_return_value
32355
.byte 0,12,0,1,128,4,0,0
32356
-#ifdef _CALL_LINUX
32357
+# if _CALL_ELF == 2
32358
+ .size ffi_call_LINUX64,.-ffi_call_LINUX64
32360
+# ifdef _CALL_LINUX
32361
.size ffi_call_LINUX64,.-.L.ffi_call_LINUX64
32364
.size .ffi_call_LINUX64,.-.ffi_call_LINUX64
32369
.section .eh_frame,EH_FRAME_FLAGS,@progbits
32371
@@ -197,8 +253,8 @@
32377
-#if defined __ELF__ && defined __linux__
32378
+# if (defined __ELF__ && defined __linux__) || _CALL_ELF == 2
32379
.section .note.GNU-stack,"",@progbits
32382
--- a/src/libffi/src/powerpc/ffi_linux64.c
32383
+++ b/src/libffi/src/powerpc/ffi_linux64.c
32385
+/* -----------------------------------------------------------------------
32386
+ ffi_linux64.c - Copyright (C) 2013 IBM
32387
+ Copyright (C) 2011 Anthony Green
32388
+ Copyright (C) 2011 Kyle Moffett
32389
+ Copyright (C) 2008 Red Hat, Inc
32390
+ Copyright (C) 2007, 2008 Free Software Foundation, Inc
32391
+ Copyright (c) 1998 Geoffrey Keating
32393
+ PowerPC Foreign Function Interface
32395
+ Permission is hereby granted, free of charge, to any person obtaining
32396
+ a copy of this software and associated documentation files (the
32397
+ ``Software''), to deal in the Software without restriction, including
32398
+ without limitation the rights to use, copy, modify, merge, publish,
32399
+ distribute, sublicense, and/or sell copies of the Software, and to
32400
+ permit persons to whom the Software is furnished to do so, subject to
32401
+ the following conditions:
32403
+ The above copyright notice and this permission notice shall be included
32404
+ in all copies or substantial portions of the Software.
32406
+ THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, EXPRESS
32407
+ OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
32408
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
32409
+ IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY CLAIM, DAMAGES OR
32410
+ OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
32411
+ ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
32412
+ OTHER DEALINGS IN THE SOFTWARE.
32413
+ ----------------------------------------------------------------------- */
32418
+#include "ffi_common.h"
32419
+#include "ffi_powerpc.h"
32422
+/* About the LINUX64 ABI. */
32424
+ NUM_GPR_ARG_REGISTERS64 = 8,
32425
+ NUM_FPR_ARG_REGISTERS64 = 13
32427
+enum { ASM_NEEDS_REGISTERS64 = 4 };
32430
+#if HAVE_LONG_DOUBLE_VARIANT && FFI_TYPE_LONGDOUBLE != FFI_TYPE_DOUBLE
32431
+/* Adjust size of ffi_type_longdouble. */
32433
+ffi_prep_types_linux64 (ffi_abi abi)
32435
+ if ((abi & (FFI_LINUX | FFI_LINUX_LONG_DOUBLE_128)) == FFI_LINUX)
32437
+ ffi_type_longdouble.size = 8;
32438
+ ffi_type_longdouble.alignment = 8;
32442
+ ffi_type_longdouble.size = 16;
32443
+ ffi_type_longdouble.alignment = 16;
32449
+#if _CALL_ELF == 2
32450
+static unsigned int
32451
+discover_homogeneous_aggregate (const ffi_type *t, unsigned int *elnum)
32455
+ case FFI_TYPE_FLOAT:
32456
+ case FFI_TYPE_DOUBLE:
32458
+ return (int) t->type;
32460
+ case FFI_TYPE_STRUCT:;
32462
+ unsigned int base_elt = 0, total_elnum = 0;
32463
+ ffi_type **el = t->elements;
32466
+ unsigned int el_elt, el_elnum = 0;
32467
+ el_elt = discover_homogeneous_aggregate (*el, &el_elnum);
32469
+ || (base_elt && base_elt != el_elt))
32471
+ base_elt = el_elt;
32472
+ total_elnum += el_elnum;
32473
+ if (total_elnum > 8)
32477
+ *elnum = total_elnum;
32488
+/* Perform machine dependent cif processing */
32490
+ffi_prep_cif_linux64_core (ffi_cif *cif)
32494
+ unsigned i, fparg_count = 0, intarg_count = 0;
32495
+ unsigned flags = cif->flags;
32496
+#if _CALL_ELF == 2
32497
+ unsigned int elt, elnum;
32500
+#if FFI_TYPE_LONGDOUBLE == FFI_TYPE_DOUBLE
32501
+ /* If compiled without long double support.. */
32502
+ if ((cif->abi & FFI_LINUX_LONG_DOUBLE_128) != 0)
32503
+ return FFI_BAD_ABI;
32506
+ /* The machine-independent calculation of cif->bytes doesn't work
32507
+ for us. Redo the calculation. */
32508
+#if _CALL_ELF == 2
32509
+ /* Space for backchain, CR, LR, TOC and the asm's temp regs. */
32510
+ bytes = (4 + ASM_NEEDS_REGISTERS64) * sizeof (long);
32512
+ /* Space for the general registers. */
32513
+ bytes += NUM_GPR_ARG_REGISTERS64 * sizeof (long);
32515
+ /* Space for backchain, CR, LR, cc/ld doubleword, TOC and the asm's temp
32517
+ bytes = (6 + ASM_NEEDS_REGISTERS64) * sizeof (long);
32519
+ /* Space for the mandatory parm save area and general registers. */
32520
+ bytes += 2 * NUM_GPR_ARG_REGISTERS64 * sizeof (long);
32523
+ /* Return value handling. */
32524
+ switch (cif->rtype->type)
32526
+#if FFI_TYPE_LONGDOUBLE != FFI_TYPE_DOUBLE
32527
+ case FFI_TYPE_LONGDOUBLE:
32528
+ if ((cif->abi & FFI_LINUX_LONG_DOUBLE_128) != 0)
32529
+ flags |= FLAG_RETURNS_128BITS;
32530
+ /* Fall through. */
32532
+ case FFI_TYPE_DOUBLE:
32533
+ flags |= FLAG_RETURNS_64BITS;
32534
+ /* Fall through. */
32535
+ case FFI_TYPE_FLOAT:
32536
+ flags |= FLAG_RETURNS_FP;
32539
+ case FFI_TYPE_UINT128:
32540
+ flags |= FLAG_RETURNS_128BITS;
32541
+ /* Fall through. */
32542
+ case FFI_TYPE_UINT64:
32543
+ case FFI_TYPE_SINT64:
32544
+ flags |= FLAG_RETURNS_64BITS;
32547
+ case FFI_TYPE_STRUCT:
32548
+#if _CALL_ELF == 2
32549
+ elt = discover_homogeneous_aggregate (cif->rtype, &elnum);
32552
+ if (elt == FFI_TYPE_DOUBLE)
32553
+ flags |= FLAG_RETURNS_64BITS;
32554
+ flags |= FLAG_RETURNS_FP | FLAG_RETURNS_SMST;
32557
+ if (cif->rtype->size <= 16)
32559
+ flags |= FLAG_RETURNS_SMST;
32564
+ flags |= FLAG_RETVAL_REFERENCE;
32565
+ /* Fall through. */
32566
+ case FFI_TYPE_VOID:
32567
+ flags |= FLAG_RETURNS_NOTHING;
32571
+ /* Returns 32-bit integer, or similar. Nothing to do here. */
32575
+ for (ptr = cif->arg_types, i = cif->nargs; i > 0; i--, ptr++)
32577
+ unsigned int align;
32579
+ switch ((*ptr)->type)
32581
+#if FFI_TYPE_LONGDOUBLE != FFI_TYPE_DOUBLE
32582
+ case FFI_TYPE_LONGDOUBLE:
32583
+ if ((cif->abi & FFI_LINUX_LONG_DOUBLE_128) != 0)
32588
+ /* Fall through. */
32590
+ case FFI_TYPE_DOUBLE:
32591
+ case FFI_TYPE_FLOAT:
32594
+ if (fparg_count > NUM_FPR_ARG_REGISTERS64)
32595
+ flags |= FLAG_ARG_NEEDS_PSAVE;
32598
+ case FFI_TYPE_STRUCT:
32599
+ if ((cif->abi & FFI_LINUX_STRUCT_ALIGN) != 0)
32601
+ align = (*ptr)->alignment;
32604
+ align = align / 8;
32606
+ intarg_count = ALIGN (intarg_count, align);
32608
+ intarg_count += ((*ptr)->size + 7) / 8;
32609
+#if _CALL_ELF == 2
32610
+ elt = discover_homogeneous_aggregate (*ptr, &elnum);
32613
+ fparg_count += elnum;
32614
+ if (fparg_count > NUM_FPR_ARG_REGISTERS64)
32615
+ flags |= FLAG_ARG_NEEDS_PSAVE;
32620
+ if (intarg_count > NUM_GPR_ARG_REGISTERS64)
32621
+ flags |= FLAG_ARG_NEEDS_PSAVE;
32625
+ case FFI_TYPE_POINTER:
32626
+ case FFI_TYPE_UINT64:
32627
+ case FFI_TYPE_SINT64:
32628
+ case FFI_TYPE_INT:
32629
+ case FFI_TYPE_UINT32:
32630
+ case FFI_TYPE_SINT32:
32631
+ case FFI_TYPE_UINT16:
32632
+ case FFI_TYPE_SINT16:
32633
+ case FFI_TYPE_UINT8:
32634
+ case FFI_TYPE_SINT8:
32635
+ /* Everything else is passed as a 8-byte word in a GPR, either
32636
+ the object itself or a pointer to it. */
32638
+ if (intarg_count > NUM_GPR_ARG_REGISTERS64)
32639
+ flags |= FLAG_ARG_NEEDS_PSAVE;
32646
+ if (fparg_count != 0)
32647
+ flags |= FLAG_FP_ARGUMENTS;
32648
+ if (intarg_count > 4)
32649
+ flags |= FLAG_4_GPR_ARGUMENTS;
32651
+ /* Space for the FPR registers, if needed. */
32652
+ if (fparg_count != 0)
32653
+ bytes += NUM_FPR_ARG_REGISTERS64 * sizeof (double);
32655
+ /* Stack space. */
32656
+#if _CALL_ELF == 2
32657
+ if ((flags & FLAG_ARG_NEEDS_PSAVE) != 0)
32658
+ bytes += intarg_count * sizeof (long);
32660
+ if (intarg_count > NUM_GPR_ARG_REGISTERS64)
32661
+ bytes += (intarg_count - NUM_GPR_ARG_REGISTERS64) * sizeof (long);
32664
+ /* The stack space allocated needs to be a multiple of 16 bytes. */
32665
+ bytes = (bytes + 15) & ~0xF;
32667
+ cif->flags = flags;
32668
+ cif->bytes = bytes;
32673
+ffi_status FFI_HIDDEN
32674
+ffi_prep_cif_linux64 (ffi_cif *cif)
32676
+ if ((cif->abi & FFI_LINUX) != 0)
32677
+ cif->nfixedargs = cif->nargs;
32678
+#if _CALL_ELF != 2
32679
+ else if (cif->abi == FFI_COMPAT_LINUX64)
32681
+ /* This call is from old code. Don't touch cif->nfixedargs
32682
+ since old code will be using a smaller cif. */
32683
+ cif->flags |= FLAG_COMPAT;
32684
+ /* Translate to new abi value. */
32685
+ cif->abi = FFI_LINUX | FFI_LINUX_LONG_DOUBLE_128;
32689
+ return FFI_BAD_ABI;
32690
+ return ffi_prep_cif_linux64_core (cif);
32693
+ffi_status FFI_HIDDEN
32694
+ffi_prep_cif_linux64_var (ffi_cif *cif,
32695
+ unsigned int nfixedargs,
32696
+ unsigned int ntotalargs MAYBE_UNUSED)
32698
+ if ((cif->abi & FFI_LINUX) != 0)
32699
+ cif->nfixedargs = nfixedargs;
32700
+#if _CALL_ELF != 2
32701
+ else if (cif->abi == FFI_COMPAT_LINUX64)
32703
+ /* This call is from old code. Don't touch cif->nfixedargs
32704
+ since old code will be using a smaller cif. */
32705
+ cif->flags |= FLAG_COMPAT;
32706
+ /* Translate to new abi value. */
32707
+ cif->abi = FFI_LINUX | FFI_LINUX_LONG_DOUBLE_128;
32711
+ return FFI_BAD_ABI;
32712
+#if _CALL_ELF == 2
32713
+ cif->flags |= FLAG_ARG_NEEDS_PSAVE;
32715
+ return ffi_prep_cif_linux64_core (cif);
32719
+/* ffi_prep_args64 is called by the assembly routine once stack space
32720
+ has been allocated for the function's arguments.
32722
+ The stack layout we want looks like this:
32724
+ | Ret addr from ffi_call_LINUX64 8bytes | higher addresses
32725
+ |--------------------------------------------|
32726
+ | CR save area 8bytes |
32727
+ |--------------------------------------------|
32728
+ | Previous backchain pointer 8 | stack pointer here
32729
+ |--------------------------------------------|<+ <<< on entry to
32730
+ | Saved r28-r31 4*8 | | ffi_call_LINUX64
32731
+ |--------------------------------------------| |
32732
+ | GPR registers r3-r10 8*8 | |
32733
+ |--------------------------------------------| |
32734
+ | FPR registers f1-f13 (optional) 13*8 | |
32735
+ |--------------------------------------------| |
32736
+ | Parameter save area | |
32737
+ |--------------------------------------------| |
32738
+ | TOC save area 8 | |
32739
+ |--------------------------------------------| | stack |
32740
+ | Linker doubleword 8 | | grows |
32741
+ |--------------------------------------------| | down V
32742
+ | Compiler doubleword 8 | |
32743
+ |--------------------------------------------| | lower addresses
32744
+ | Space for callee's LR 8 | |
32745
+ |--------------------------------------------| |
32746
+ | CR save area 8 | |
32747
+ |--------------------------------------------| | stack pointer here
32748
+ | Current backchain pointer 8 |-/ during
32749
+ |--------------------------------------------| <<< ffi_call_LINUX64
32754
+ffi_prep_args64 (extended_cif *ecif, unsigned long *const stack)
32756
+ const unsigned long bytes = ecif->cif->bytes;
32757
+ const unsigned long flags = ecif->cif->flags;
32762
+ unsigned long *ul;
32768
+ /* 'stacktop' points at the previous backchain pointer. */
32771
+ /* 'next_arg' points at the space for gpr3, and grows upwards as
32772
+ we use GPR registers, then continues at rest. */
32778
+ /* 'fpr_base' points at the space for fpr3, and grows upwards as
32779
+ we use FPR registers. */
32781
+ unsigned int fparg_count;
32783
+ unsigned int i, words, nargs, nfixedargs;
32785
+ double double_tmp;
32790
+ signed char **sc;
32791
+ unsigned char **uc;
32792
+ signed short **ss;
32793
+ unsigned short **us;
32795
+ unsigned int **ui;
32796
+ unsigned long **ul;
32800
+ unsigned long gprvalue;
32801
+ unsigned long align;
32803
+ stacktop.c = (char *) stack + bytes;
32804
+ gpr_base.ul = stacktop.ul - ASM_NEEDS_REGISTERS64 - NUM_GPR_ARG_REGISTERS64;
32805
+ gpr_end.ul = gpr_base.ul + NUM_GPR_ARG_REGISTERS64;
32806
+#if _CALL_ELF == 2
32807
+ rest.ul = stack + 4 + NUM_GPR_ARG_REGISTERS64;
32809
+ rest.ul = stack + 6 + NUM_GPR_ARG_REGISTERS64;
32811
+ fpr_base.d = gpr_base.d - NUM_FPR_ARG_REGISTERS64;
32813
+ next_arg.ul = gpr_base.ul;
32815
+ /* Check that everything starts aligned properly. */
32816
+ FFI_ASSERT (((unsigned long) (char *) stack & 0xF) == 0);
32817
+ FFI_ASSERT (((unsigned long) stacktop.c & 0xF) == 0);
32818
+ FFI_ASSERT ((bytes & 0xF) == 0);
32820
+ /* Deal with return values that are actually pass-by-reference. */
32821
+ if (flags & FLAG_RETVAL_REFERENCE)
32822
+ *next_arg.ul++ = (unsigned long) (char *) ecif->rvalue;
32824
+ /* Now for the arguments. */
32825
+ p_argv.v = ecif->avalue;
32826
+ nargs = ecif->cif->nargs;
32827
+#if _CALL_ELF != 2
32828
+ nfixedargs = (unsigned) -1;
32829
+ if ((flags & FLAG_COMPAT) == 0)
32831
+ nfixedargs = ecif->cif->nfixedargs;
32832
+ for (ptr = ecif->cif->arg_types, i = 0;
32834
+ i++, ptr++, p_argv.v++)
32836
+#if _CALL_ELF == 2
32837
+ unsigned int elt, elnum;
32840
+ switch ((*ptr)->type)
32842
+#if FFI_TYPE_LONGDOUBLE != FFI_TYPE_DOUBLE
32843
+ case FFI_TYPE_LONGDOUBLE:
32844
+ if ((ecif->cif->abi & FFI_LINUX_LONG_DOUBLE_128) != 0)
32846
+ double_tmp = (*p_argv.d)[0];
32847
+ if (fparg_count < NUM_FPR_ARG_REGISTERS64 && i < nfixedargs)
32849
+ *fpr_base.d++ = double_tmp;
32850
+# if _CALL_ELF != 2
32851
+ if ((flags & FLAG_COMPAT) != 0)
32852
+ *next_arg.d = double_tmp;
32856
+ *next_arg.d = double_tmp;
32857
+ if (++next_arg.ul == gpr_end.ul)
32858
+ next_arg.ul = rest.ul;
32860
+ double_tmp = (*p_argv.d)[1];
32861
+ if (fparg_count < NUM_FPR_ARG_REGISTERS64 && i < nfixedargs)
32863
+ *fpr_base.d++ = double_tmp;
32864
+# if _CALL_ELF != 2
32865
+ if ((flags & FLAG_COMPAT) != 0)
32866
+ *next_arg.d = double_tmp;
32870
+ *next_arg.d = double_tmp;
32871
+ if (++next_arg.ul == gpr_end.ul)
32872
+ next_arg.ul = rest.ul;
32874
+ FFI_ASSERT (__LDBL_MANT_DIG__ == 106);
32875
+ FFI_ASSERT (flags & FLAG_FP_ARGUMENTS);
32878
+ /* Fall through. */
32880
+ case FFI_TYPE_DOUBLE:
32881
+ double_tmp = **p_argv.d;
32882
+ if (fparg_count < NUM_FPR_ARG_REGISTERS64 && i < nfixedargs)
32884
+ *fpr_base.d++ = double_tmp;
32885
+#if _CALL_ELF != 2
32886
+ if ((flags & FLAG_COMPAT) != 0)
32887
+ *next_arg.d = double_tmp;
32891
+ *next_arg.d = double_tmp;
32892
+ if (++next_arg.ul == gpr_end.ul)
32893
+ next_arg.ul = rest.ul;
32895
+ FFI_ASSERT (flags & FLAG_FP_ARGUMENTS);
32898
+ case FFI_TYPE_FLOAT:
32899
+ double_tmp = **p_argv.f;
32900
+ if (fparg_count < NUM_FPR_ARG_REGISTERS64 && i < nfixedargs)
32902
+ *fpr_base.d++ = double_tmp;
32903
+#if _CALL_ELF != 2
32904
+ if ((flags & FLAG_COMPAT) != 0)
32905
+ *next_arg.f = (float) double_tmp;
32909
+ *next_arg.f = (float) double_tmp;
32910
+ if (++next_arg.ul == gpr_end.ul)
32911
+ next_arg.ul = rest.ul;
32913
+ FFI_ASSERT (flags & FLAG_FP_ARGUMENTS);
32916
+ case FFI_TYPE_STRUCT:
32917
+ if ((ecif->cif->abi & FFI_LINUX_STRUCT_ALIGN) != 0)
32919
+ align = (*ptr)->alignment;
32923
+ next_arg.p = ALIGN (next_arg.p, align);
32925
+#if _CALL_ELF == 2
32926
+ elt = discover_homogeneous_aggregate (*ptr, &elnum);
32935
+ arg.v = *p_argv.v;
32936
+ if (elt == FFI_TYPE_FLOAT)
32940
+ double_tmp = *arg.f++;
32941
+ if (fparg_count < NUM_FPR_ARG_REGISTERS64
32942
+ && i < nfixedargs)
32943
+ *fpr_base.d++ = double_tmp;
32945
+ *next_arg.f = (float) double_tmp;
32946
+ if (++next_arg.f == gpr_end.f)
32947
+ next_arg.f = rest.f;
32950
+ while (--elnum != 0);
32951
+ if ((next_arg.p & 3) != 0)
32953
+ if (++next_arg.f == gpr_end.f)
32954
+ next_arg.f = rest.f;
32960
+ double_tmp = *arg.d++;
32961
+ if (fparg_count < NUM_FPR_ARG_REGISTERS64 && i < nfixedargs)
32962
+ *fpr_base.d++ = double_tmp;
32964
+ *next_arg.d = double_tmp;
32965
+ if (++next_arg.d == gpr_end.d)
32966
+ next_arg.d = rest.d;
32969
+ while (--elnum != 0);
32974
+ words = ((*ptr)->size + 7) / 8;
32975
+ if (next_arg.ul >= gpr_base.ul && next_arg.ul + words > gpr_end.ul)
32977
+ size_t first = gpr_end.c - next_arg.c;
32978
+ memcpy (next_arg.c, *p_argv.c, first);
32979
+ memcpy (rest.c, *p_argv.c + first, (*ptr)->size - first);
32980
+ next_arg.c = rest.c + words * 8 - first;
32984
+ char *where = next_arg.c;
32986
+#ifndef __LITTLE_ENDIAN__
32987
+ /* Structures with size less than eight bytes are passed
32989
+ if ((*ptr)->size < 8)
32990
+ where += 8 - (*ptr)->size;
32992
+ memcpy (where, *p_argv.c, (*ptr)->size);
32993
+ next_arg.ul += words;
32994
+ if (next_arg.ul == gpr_end.ul)
32995
+ next_arg.ul = rest.ul;
33000
+ case FFI_TYPE_UINT8:
33001
+ gprvalue = **p_argv.uc;
33003
+ case FFI_TYPE_SINT8:
33004
+ gprvalue = **p_argv.sc;
33006
+ case FFI_TYPE_UINT16:
33007
+ gprvalue = **p_argv.us;
33009
+ case FFI_TYPE_SINT16:
33010
+ gprvalue = **p_argv.ss;
33012
+ case FFI_TYPE_UINT32:
33013
+ gprvalue = **p_argv.ui;
33015
+ case FFI_TYPE_INT:
33016
+ case FFI_TYPE_SINT32:
33017
+ gprvalue = **p_argv.si;
33020
+ case FFI_TYPE_UINT64:
33021
+ case FFI_TYPE_SINT64:
33022
+ case FFI_TYPE_POINTER:
33023
+ gprvalue = **p_argv.ul;
33025
+ *next_arg.ul++ = gprvalue;
33026
+ if (next_arg.ul == gpr_end.ul)
33027
+ next_arg.ul = rest.ul;
33032
+ FFI_ASSERT (flags & FLAG_4_GPR_ARGUMENTS
33033
+ || (next_arg.ul >= gpr_base.ul
33034
+ && next_arg.ul <= gpr_base.ul + 4));
33038
+#if _CALL_ELF == 2
33039
+#define MIN_CACHE_LINE_SIZE 8
33042
+flush_icache (char *wraddr, char *xaddr, int size)
33045
+ for (i = 0; i < size; i += MIN_CACHE_LINE_SIZE)
33046
+ __asm__ volatile ("icbi 0,%0;" "dcbf 0,%1;"
33047
+ : : "r" (xaddr + i), "r" (wraddr + i) : "memory");
33048
+ __asm__ volatile ("icbi 0,%0;" "dcbf 0,%1;" "sync;" "isync;"
33049
+ : : "r"(xaddr + size - 1), "r"(wraddr + size - 1)
33055
+ffi_prep_closure_loc_linux64 (ffi_closure *closure,
33057
+ void (*fun) (ffi_cif *, void *, void **, void *),
33061
+#if _CALL_ELF == 2
33062
+ unsigned int *tramp = (unsigned int *) &closure->tramp[0];
33064
+ if (cif->abi < FFI_LINUX || cif->abi >= FFI_LAST_ABI)
33065
+ return FFI_BAD_ABI;
33067
+ tramp[0] = 0xe96c0018; /* 0: ld 11,2f-0b(12) */
33068
+ tramp[1] = 0xe98c0010; /* ld 12,1f-0b(12) */
33069
+ tramp[2] = 0x7d8903a6; /* mtctr 12 */
33070
+ tramp[3] = 0x4e800420; /* bctr */
33071
+ /* 1: .quad function_addr */
33072
+ /* 2: .quad context */
33073
+ *(void **) &tramp[4] = (void *) ffi_closure_LINUX64;
33074
+ *(void **) &tramp[6] = codeloc;
33075
+ flush_icache ((char *)tramp, (char *)codeloc, FFI_TRAMPOLINE_SIZE);
33077
+ void **tramp = (void **) &closure->tramp[0];
33079
+ if (cif->abi < FFI_LINUX || cif->abi >= FFI_LAST_ABI)
33080
+ return FFI_BAD_ABI;
33082
+ /* Copy function address and TOC from ffi_closure_LINUX64. */
33083
+ memcpy (tramp, (char *) ffi_closure_LINUX64, 16);
33084
+ tramp[2] = codeloc;
33087
+ closure->cif = cif;
33088
+ closure->fun = fun;
33089
+ closure->user_data = user_data;
33096
+ffi_closure_helper_LINUX64 (ffi_closure *closure, void *rvalue,
33097
+ unsigned long *pst, ffi_dblfl *pfr)
33099
+ /* rvalue is the pointer to space for return value in closure assembly */
33100
+ /* pst is the pointer to parameter save area
33101
+ (r3-r10 are stored into its first 8 slots by ffi_closure_LINUX64) */
33102
+ /* pfr is the pointer to where f1-f13 are stored in ffi_closure_LINUX64 */
33105
+ ffi_type **arg_types;
33106
+ unsigned long i, avn, nfixedargs;
33108
+ ffi_dblfl *end_pfr = pfr + NUM_FPR_ARG_REGISTERS64;
33109
+ unsigned long align;
33111
+ cif = closure->cif;
33112
+ avalue = alloca (cif->nargs * sizeof (void *));
33114
+ /* Copy the caller's structure return value address so that the
33115
+ closure returns the data directly to the caller. */
33116
+ if (cif->rtype->type == FFI_TYPE_STRUCT
33117
+ && (cif->flags & FLAG_RETURNS_SMST) == 0)
33119
+ rvalue = (void *) *pst;
33124
+ avn = cif->nargs;
33125
+#if _CALL_ELF != 2
33126
+ nfixedargs = (unsigned) -1;
33127
+ if ((cif->flags & FLAG_COMPAT) == 0)
33129
+ nfixedargs = cif->nfixedargs;
33130
+ arg_types = cif->arg_types;
33132
+ /* Grab the addresses of the arguments from the stack frame. */
33135
+ unsigned int elt, elnum;
33137
+ switch (arg_types[i]->type)
33139
+ case FFI_TYPE_SINT8:
33140
+ case FFI_TYPE_UINT8:
33141
+#ifndef __LITTLE_ENDIAN__
33142
+ avalue[i] = (char *) pst + 7;
33147
+ case FFI_TYPE_SINT16:
33148
+ case FFI_TYPE_UINT16:
33149
+#ifndef __LITTLE_ENDIAN__
33150
+ avalue[i] = (char *) pst + 6;
33155
+ case FFI_TYPE_SINT32:
33156
+ case FFI_TYPE_UINT32:
33157
+#ifndef __LITTLE_ENDIAN__
33158
+ avalue[i] = (char *) pst + 4;
33163
+ case FFI_TYPE_SINT64:
33164
+ case FFI_TYPE_UINT64:
33165
+ case FFI_TYPE_POINTER:
33170
+ case FFI_TYPE_STRUCT:
33171
+ if ((cif->abi & FFI_LINUX_STRUCT_ALIGN) != 0)
33173
+ align = arg_types[i]->alignment;
33177
+ pst = (unsigned long *) ALIGN ((size_t) pst, align);
33180
+#if _CALL_ELF == 2
33181
+ elt = discover_homogeneous_aggregate (arg_types[i], &elnum);
33187
+ unsigned long *ul;
33193
+ /* Repackage the aggregate from its parts. The
33194
+ aggregate size is not greater than the space taken by
33195
+ the registers so store back to the register/parameter
33197
+ if (pfr + elnum <= end_pfr)
33202
+ avalue[i] = to.v;
33204
+ if (elt == FFI_TYPE_FLOAT)
33208
+ if (pfr < end_pfr && i < nfixedargs)
33210
+ *to.f = (float) pfr->d;
33218
+ while (--elnum != 0);
33224
+ if (pfr < end_pfr && i < nfixedargs)
33234
+ while (--elnum != 0);
33239
+#ifndef __LITTLE_ENDIAN__
33240
+ /* Structures with size less than eight bytes are passed
33242
+ if (arg_types[i]->size < 8)
33243
+ avalue[i] = (char *) pst + 8 - arg_types[i]->size;
33248
+ pst += (arg_types[i]->size + 7) / 8;
33251
+#if FFI_TYPE_LONGDOUBLE != FFI_TYPE_DOUBLE
33252
+ case FFI_TYPE_LONGDOUBLE:
33253
+ if ((cif->abi & FFI_LINUX_LONG_DOUBLE_128) != 0)
33255
+ if (pfr + 1 < end_pfr && i + 1 < nfixedargs)
33262
+ if (pfr < end_pfr && i < nfixedargs)
33264
+ /* Passed partly in f13 and partly on the stack.
33265
+ Move it all to the stack. */
33266
+ *pst = *(unsigned long *) pfr;
33274
+ /* Fall through. */
33276
+ case FFI_TYPE_DOUBLE:
33277
+ /* On the outgoing stack all values are aligned to 8 */
33278
+ /* there are 13 64bit floating point registers */
33280
+ if (pfr < end_pfr && i < nfixedargs)
33290
+ case FFI_TYPE_FLOAT:
33291
+ if (pfr < end_pfr && i < nfixedargs)
33293
+ /* Float values are stored as doubles in the
33294
+ ffi_closure_LINUX64 code. Fix them here. */
33295
+ pfr->f = (float) pfr->d;
33312
+ (closure->fun) (cif, rvalue, avalue, closure->user_data);
33314
+ /* Tell ffi_closure_LINUX64 how to perform return type promotions. */
33315
+ if ((cif->flags & FLAG_RETURNS_SMST) != 0)
33317
+ if ((cif->flags & FLAG_RETURNS_FP) == 0)
33318
+ return FFI_V2_TYPE_SMALL_STRUCT + cif->rtype->size - 1;
33319
+ else if ((cif->flags & FLAG_RETURNS_64BITS) != 0)
33320
+ return FFI_V2_TYPE_DOUBLE_HOMOG;
33322
+ return FFI_V2_TYPE_FLOAT_HOMOG;
33324
+ return cif->rtype->type;
33327
--- a/src/libffi/src/types.c
33328
+++ b/src/libffi/src/types.c
33333
+#define FFI_NONCONST_TYPEDEF(name, type, id) \
33334
+struct struct_align_##name { \
33338
+ffi_type ffi_type_##name = { \
33340
+ offsetof(struct struct_align_##name, x), \
33344
/* Size and alignment are fake here. They must not be 0. */
33345
const ffi_type ffi_type_void = {
33346
1, 1, FFI_TYPE_VOID, NULL
33349
const ffi_type ffi_type_longdouble = { 16, 16, 4, NULL };
33350
#elif FFI_TYPE_LONGDOUBLE != FFI_TYPE_DOUBLE
33351
+# if HAVE_LONG_DOUBLE_VARIANT
33352
+FFI_NONCONST_TYPEDEF(longdouble, long double, FFI_TYPE_LONGDOUBLE);
33354
FFI_TYPEDEF(longdouble, long double, FFI_TYPE_LONGDOUBLE);
33357
--- a/src/libffi/src/prep_cif.c
33358
+++ b/src/libffi/src/prep_cif.c
33359
@@ -126,6 +126,10 @@
33363
+#if HAVE_LONG_DOUBLE_VARIANT
33364
+ ffi_prep_types (abi);
33367
/* Initialize the return type if necessary */
33368
if ((cif->rtype->size == 0) && (initialize_aggregate(cif->rtype) != FFI_OK))
33369
return FFI_BAD_TYPEDEF;
33370
--- a/src/libffi/testsuite/Makefile.in
33371
+++ b/src/libffi/testsuite/Makefile.in
33375
HAVE_LONG_DOUBLE = @HAVE_LONG_DOUBLE@
33376
+HAVE_LONG_DOUBLE_VARIANT = @HAVE_LONG_DOUBLE_VARIANT@
33377
INSTALL = @INSTALL@
33378
INSTALL_DATA = @INSTALL_DATA@
33379
INSTALL_PROGRAM = @INSTALL_PROGRAM@
33380
--- a/src/libffi/testsuite/libffi.call/cls_double_va.c
33381
+++ b/src/libffi/testsuite/libffi.call/cls_double_va.c
33382
@@ -38,26 +38,24 @@
33384
/* This printf call is variadic */
33385
CHECK(ffi_prep_cif_var(&cif, FFI_DEFAULT_ABI, 1, 2, &ffi_type_sint,
33386
- arg_types) == FFI_OK);
33387
+ arg_types) == FFI_OK);
33390
args[1] = &doubleArg;
33393
ffi_call(&cif, FFI_FN(printf), &res, args);
33394
- // { dg-output "7.0" }
33395
+ /* { dg-output "7.0" } */
33396
printf("res: %d\n", (int) res);
33397
- // { dg-output "\nres: 4" }
33398
+ /* { dg-output "\nres: 4" } */
33400
- /* The call to cls_double_va_fn is static, so have to use a normal prep_cif */
33401
- CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 2, &ffi_type_sint, arg_types) == FFI_OK);
33402
+ CHECK(ffi_prep_closure_loc(pcl, &cif, cls_double_va_fn, NULL,
33403
+ code) == FFI_OK);
33405
- CHECK(ffi_prep_closure_loc(pcl, &cif, cls_double_va_fn, NULL, code) == FFI_OK);
33407
- res = ((int(*)(char*, double))(code))(format, doubleArg);
33408
- // { dg-output "\n7.0" }
33409
+ res = ((int(*)(char*, ...))(code))(format, doubleArg);
33410
+ /* { dg-output "\n7.0" } */
33411
printf("res: %d\n", (int) res);
33412
- // { dg-output "\nres: 4" }
33413
+ /* { dg-output "\nres: 4" } */
33417
--- a/src/libffi/testsuite/libffi.call/cls_longdouble_va.c
33418
+++ b/src/libffi/testsuite/libffi.call/cls_longdouble_va.c
33419
@@ -38,27 +38,24 @@
33421
/* This printf call is variadic */
33422
CHECK(ffi_prep_cif_var(&cif, FFI_DEFAULT_ABI, 1, 2, &ffi_type_sint,
33423
- arg_types) == FFI_OK);
33424
+ arg_types) == FFI_OK);
33430
ffi_call(&cif, FFI_FN(printf), &res, args);
33431
- // { dg-output "7.0" }
33432
+ /* { dg-output "7.0" } */
33433
printf("res: %d\n", (int) res);
33434
- // { dg-output "\nres: 4" }
33435
+ /* { dg-output "\nres: 4" } */
33437
- /* The call to cls_longdouble_va_fn is static, so have to use a normal prep_cif */
33438
- CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 2, &ffi_type_sint,
33439
- arg_types) == FFI_OK);
33440
+ CHECK(ffi_prep_closure_loc(pcl, &cif, cls_longdouble_va_fn, NULL,
33441
+ code) == FFI_OK);
33443
- CHECK(ffi_prep_closure_loc(pcl, &cif, cls_longdouble_va_fn, NULL, code) == FFI_OK);
33445
- res = ((int(*)(char*, long double))(code))(format, ldArg);
33446
- // { dg-output "\n7.0" }
33447
+ res = ((int(*)(char*, ...))(code))(format, ldArg);
33448
+ /* { dg-output "\n7.0" } */
33449
printf("res: %d\n", (int) res);
33450
- // { dg-output "\nres: 4" }
33451
+ /* { dg-output "\nres: 4" } */
33455
--- a/src/libffi/configure.ac
33456
+++ b/src/libffi/configure.ac
33458
AM_CONDITIONAL(TESTSUBDIR, test -d $srcdir/testsuite)
33460
TARGETDIR="unknown"
33461
+HAVE_LONG_DOUBLE_VARIANT=0
33464
TARGET=AARCH64; TARGETDIR=aarch64
33465
@@ -162,6 +163,7 @@
33467
powerpc*-*-linux* | powerpc-*-sysv*)
33468
TARGET=POWERPC; TARGETDIR=powerpc
33469
+ HAVE_LONG_DOUBLE_VARIANT=1
33471
powerpc-*-amigaos*)
33472
TARGET=POWERPC; TARGETDIR=powerpc
33473
@@ -177,6 +179,7 @@
33475
powerpc-*-freebsd* | powerpc-*-openbsd*)
33476
TARGET=POWERPC_FREEBSD; TARGETDIR=powerpc
33477
+ HAVE_LONG_DOUBLE_VARIANT=1
33479
powerpc64-*-freebsd*)
33480
TARGET=POWERPC; TARGETDIR=powerpc
33481
@@ -273,14 +276,20 @@
33482
# Also AC_SUBST this variable for ffi.h.
33483
if test -z "$HAVE_LONG_DOUBLE"; then
33485
- if test $ac_cv_sizeof_double != $ac_cv_sizeof_long_double; then
33486
- if test $ac_cv_sizeof_long_double != 0; then
33487
+ if test $ac_cv_sizeof_long_double != 0; then
33488
+ if test $HAVE_LONG_DOUBLE_VARIANT != 0; then
33489
+ AC_DEFINE(HAVE_LONG_DOUBLE_VARIANT, 1, [Define if you support more than one size of the long double type])
33491
- AC_DEFINE(HAVE_LONG_DOUBLE, 1, [Define if you have the long double type and it is bigger than a double])
33493
+ if test $ac_cv_sizeof_double != $ac_cv_sizeof_long_double; then
33494
+ HAVE_LONG_DOUBLE=1
33495
+ AC_DEFINE(HAVE_LONG_DOUBLE, 1, [Define if you have the long double type and it is bigger than a double])
33500
AC_SUBST(HAVE_LONG_DOUBLE)
33501
+AC_SUBST(HAVE_LONG_DOUBLE_VARIANT)
33505
--- a/src/libffi/doc/libffi.texi
33506
+++ b/src/libffi/doc/libffi.texi
33507
@@ -184,11 +184,11 @@
33509
@var{rvalue} is a pointer to a chunk of memory that will hold the
33510
result of the function call. This must be large enough to hold the
33511
-result and must be suitably aligned; it is the caller's responsibility
33512
+result, no smaller than the system register size (generally 32 or 64
33513
+bits), and must be suitably aligned; it is the caller's responsibility
33514
to ensure this. If @var{cif} declares that the function returns
33515
@code{void} (using @code{ffi_type_void}), then @var{rvalue} is
33516
-ignored. If @var{rvalue} is @samp{NULL}, then the return value is
33520
@var{avalues} is a vector of @code{void *} pointers that point to the
33521
memory locations holding the argument values for a call. If @var{cif}
33522
@@ -214,7 +214,7 @@
33529
/* Initialize the argument info vectors */
33530
args[0] = &ffi_type_pointer;
33531
@@ -222,7 +222,7 @@
33533
/* Initialize the cif */
33534
if (ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 1,
33535
- &ffi_type_uint, args) == FFI_OK)
33536
+ &ffi_type_sint, args) == FFI_OK)
33538
s = "Hello World!";
33539
ffi_call(&cif, puts, &rc, values);
33540
@@ -360,7 +360,7 @@
33541
new @code{ffi_type} object for it.
33545
+@deftp {Data type} ffi_type
33546
The @code{ffi_type} has the following members:
33549
@@ -414,6 +414,7 @@
33552
tm_type.size = tm_type.alignment = 0;
33553
+ tm_type.type = FFI_TYPE_STRUCT;
33554
tm_type.elements = &tm_type_elements;
33556
for (i = 0; i < 9; i++)
33557
@@ -540,21 +541,23 @@
33560
/* Acts like puts with the file given at time of enclosure. */
33561
-void puts_binding(ffi_cif *cif, unsigned int *ret, void* args[],
33563
+void puts_binding(ffi_cif *cif, void *ret, void* args[],
33566
- *ret = fputs(*(char **)args[0], stream);
33567
+ *(ffi_arg *)ret = fputs(*(char **)args[0], (FILE *)stream);
33570
+typedef int (*puts_t)(char *);
33576
ffi_closure *closure;
33578
- int (*bound_puts)(char *);
33579
+ void *bound_puts;
33583
/* Allocate closure and bound_puts */
33584
closure = ffi_closure_alloc(sizeof(ffi_closure), &bound_puts);
33586
@@ -565,13 +568,13 @@
33588
/* Initialize the cif */
33589
if (ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 1,
33590
- &ffi_type_uint, args) == FFI_OK)
33591
+ &ffi_type_sint, args) == FFI_OK)
33593
/* Initialize the closure, setting stream to stdout */
33594
- if (ffi_prep_closure_loc(closure, &cif, puts_binding,
33595
+ if (ffi_prep_closure_loc(closure, &cif, puts_binding,
33596
stdout, bound_puts) == FFI_OK)
33598
- rc = bound_puts("Hello World!");
33599
+ rc = ((puts_t)bound_puts)("Hello World!");
33600
/* rc now holds the result of the call to fputs */
33603
--- a/src/libffi/Makefile.am
33604
+++ b/src/libffi/Makefile.am
33605
@@ -15,10 +15,12 @@
33606
src/ia64/unix.S src/mips/ffi.c src/mips/n32.S src/mips/o32.S \
33607
src/mips/ffitarget.h src/m32r/ffi.c src/m32r/sysv.S \
33608
src/m32r/ffitarget.h src/m68k/ffi.c src/m68k/sysv.S \
33609
- src/m68k/ffitarget.h src/powerpc/ffi.c src/powerpc/sysv.S \
33610
- src/powerpc/linux64.S src/powerpc/linux64_closure.S \
33611
- src/powerpc/ppc_closure.S src/powerpc/asm.h \
33612
- src/powerpc/aix.S src/powerpc/darwin.S \
33613
+ src/m68k/ffitarget.h \
33614
+ src/powerpc/ffi.c src/powerpc/ffi_powerpc.h \
33615
+ src/powerpc/ffi_sysv.c src/powerpc/ffi_linux64.c \
33616
+ src/powerpc/sysv.S src/powerpc/linux64.S \
33617
+ src/powerpc/linux64_closure.S src/powerpc/ppc_closure.S \
33618
+ src/powerpc/asm.h src/powerpc/aix.S src/powerpc/darwin.S \
33619
src/powerpc/aix_closure.S src/powerpc/darwin_closure.S \
33620
src/powerpc/ffi_darwin.c src/powerpc/ffitarget.h \
33621
src/s390/ffi.c src/s390/sysv.S src/s390/ffitarget.h \
33622
@@ -179,7 +181,7 @@
33623
nodist_libffi_la_SOURCES += src/m68k/ffi.c src/m68k/sysv.S
33626
-nodist_libffi_la_SOURCES += src/powerpc/ffi.c src/powerpc/sysv.S src/powerpc/ppc_closure.S src/powerpc/linux64.S src/powerpc/linux64_closure.S
33627
+nodist_libffi_la_SOURCES += src/powerpc/ffi.c src/powerpc/ffi_sysv.c src/powerpc/ffi_linux64.c src/powerpc/sysv.S src/powerpc/ppc_closure.S src/powerpc/linux64.S src/powerpc/linux64_closure.S
33630
nodist_libffi_la_SOURCES += src/powerpc/ffi_darwin.c src/powerpc/aix.S src/powerpc/aix_closure.S
33631
@@ -188,7 +190,7 @@
33632
nodist_libffi_la_SOURCES += src/powerpc/ffi_darwin.c src/powerpc/darwin.S src/powerpc/darwin_closure.S
33635
-nodist_libffi_la_SOURCES += src/powerpc/ffi.c src/powerpc/sysv.S src/powerpc/ppc_closure.S
33636
+nodist_libffi_la_SOURCES += src/powerpc/ffi.c src/powerpc/ffi_sysv.c src/powerpc/sysv.S src/powerpc/ppc_closure.S
33639
nodist_libffi_la_SOURCES += src/aarch64/sysv.S src/aarch64/ffi.c
33640
--- a/src/libffi/man/Makefile.in
33641
+++ b/src/libffi/man/Makefile.in
33642
@@ -111,6 +111,7 @@
33645
HAVE_LONG_DOUBLE = @HAVE_LONG_DOUBLE@
33646
+HAVE_LONG_DOUBLE_VARIANT = @HAVE_LONG_DOUBLE_VARIANT@
33647
INSTALL = @INSTALL@
33648
INSTALL_DATA = @INSTALL_DATA@
33649
INSTALL_PROGRAM = @INSTALL_PROGRAM@
33650
--- a/src/libssp/configure
33651
+++ b/src/libssp/configure
33652
@@ -6385,7 +6385,7 @@
33656
-x86_64-*kfreebsd*-gnu|x86_64-*linux*|ppc*-*linux*|powerpc*-*linux*| \
33657
+x86_64-*kfreebsd*-gnu|x86_64-*linux*|powerpc*-*linux*| \
33658
s390*-*linux*|s390*-*tpf*|sparc*-*linux*)
33659
# Find out which ABI we are using.
33660
echo 'int i;' > conftest.$ac_ext
33661
@@ -6410,7 +6410,10 @@
33665
- ppc64-*linux*|powerpc64-*linux*)
33666
+ powerpc64le-*linux*)
33667
+ LD="${LD-ld} -m elf32lppclinux"
33669
+ powerpc64-*linux*)
33670
LD="${LD-ld} -m elf32ppclinux"
33673
@@ -6429,7 +6432,10 @@
33675
LD="${LD-ld} -m elf_x86_64"
33677
- ppc*-*linux*|powerpc*-*linux*)
33678
+ powerpcle-*linux*)
33679
+ LD="${LD-ld} -m elf64lppc"
33682
LD="${LD-ld} -m elf64ppc"
33684
s390*-*linux*|s390*-*tpf*)
33685
@@ -10658,7 +10664,7 @@
33686
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
33687
lt_status=$lt_dlunknown
33688
cat > conftest.$ac_ext <<_LT_EOF
33689
-#line 10661 "configure"
33690
+#line 10667 "configure"
33691
#include "confdefs.h"
33694
@@ -10764,7 +10770,7 @@
33695
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
33696
lt_status=$lt_dlunknown
33697
cat > conftest.$ac_ext <<_LT_EOF
33698
-#line 10767 "configure"
33699
+#line 10773 "configure"
33700
#include "confdefs.h"
33703
--- a/src/libcpp/ChangeLog.ibm
33704
+++ b/src/libcpp/ChangeLog.ibm
33706
+2013-11-18 Bill Schmidt <wschmidt@linux.vnet.ibm.com>
33708
+ * lex.c (search_line_fast): Correct for little endian.
33710
--- a/src/libcpp/lex.c
33711
+++ b/src/libcpp/lex.c
33712
@@ -559,8 +559,13 @@
33713
beginning with all ones and shifting in zeros according to the
33714
mis-alignment. The LVSR instruction pulls the exact shift we
33715
want from the address. */
33716
+#ifdef __BIG_ENDIAN__
33717
mask = __builtin_vec_lvsr(0, s);
33718
mask = __builtin_vec_perm(zero, ones, mask);
33720
+ mask = __builtin_vec_lvsl(0, s);
33721
+ mask = __builtin_vec_perm(ones, zero, mask);
33725
/* While altivec loads mask addresses, we still need to align S so
33726
@@ -624,7 +629,11 @@
33727
/* L now contains 0xff in bytes for which we matched one of the
33728
relevant characters. We can find the byte index by finding
33729
its bit index and dividing by 8. */
33730
+#ifdef __BIG_ENDIAN__
33731
l = __builtin_clzl(l) >> 3;
33733
+ l = __builtin_ctzl(l) >> 3;