diff options
author | Andreas Krebbel <krebbel@linux.ibm.com> | 2019-03-13 09:51:38 +0000 |
---|---|---|
committer | Andreas Krebbel <krebbel@gcc.gnu.org> | 2019-03-13 09:51:38 +0000 |
commit | f5eb41ce2d72f465fe53a33461c635f66be04a0f (patch) | |
tree | afd657e05093177f3b48748e0cbd759fb5f21cf6 /gcc | |
parent | 4344ab1c80fe364488ecb01021a07259df0ae5ef (diff) | |
download | gcc-f5eb41ce2d72f465fe53a33461c635f66be04a0f.zip gcc-f5eb41ce2d72f465fe53a33461c635f66be04a0f.tar.gz gcc-f5eb41ce2d72f465fe53a33461c635f66be04a0f.tar.bz2 |
S/390: Fix immediate vector operands for some builtins.
This fixes a problem with vec_add/sub_u128 builtins. The
s390_expand_builtin backend function is supposed to convert the
operand to TImode *AND* load it into a vector register. The current
implementation did only the conversion and gave up then.
gcc/ChangeLog:
2019-03-13 Andreas Krebbel <krebbel@linux.ibm.com>
Backport from mainline
2019-03-11 Andreas Krebbel <krebbel@linux.ibm.com>
* config/s390/s390.c (s390_expand_builtin): Do the copy_to_reg not
only on the else branch.
gcc/testsuite/ChangeLog:
2019-03-13 Andreas Krebbel <krebbel@linux.ibm.com>
Backport from mainline
2019-03-11 Andreas Krebbel <krebbel@linux.ibm.com>
* gcc.target/s390/zvector/vec-addc-u128.c: New test.
From-SVN: r269643
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ChangeLog | 8 | ||||
-rw-r--r-- | gcc/config/s390/s390.c | 14 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 7 | ||||
-rw-r--r-- | gcc/testsuite/gcc.target/s390/zvector/vec-addc-u128.c | 10 |
4 files changed, 35 insertions, 4 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index fefba6f..e97bd4a 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,6 +1,14 @@ 2019-03-13 Andreas Krebbel <krebbel@linux.ibm.com> Backport from mainline + 2019-03-11 Andreas Krebbel <krebbel@linux.ibm.com> + + * config/s390/s390.c (s390_expand_builtin): Do the copy_to_reg not + only on the else branch. + +2019-03-13 Andreas Krebbel <krebbel@linux.ibm.com> + + Backport from mainline 2019-02-07 Andreas Krebbel <krebbel@linux.ibm.com> * config/s390/s390-builtin-types.def: Add new types. diff --git a/gcc/config/s390/s390.c b/gcc/config/s390/s390.c index 8921f6d..f2b6676 100644 --- a/gcc/config/s390/s390.c +++ b/gcc/config/s390/s390.c @@ -937,6 +937,8 @@ s390_expand_builtin (tree exp, rtx target, rtx subtarget ATTRIBUTE_UNUSED, continue; } + /* A memory operand is rejected by the memory_operand predicate. + Try making the address legal by copying it into a register. */ if (MEM_P (op[arity]) && insn_op->predicate == memory_operand && (GET_MODE (XEXP (op[arity], 0)) == Pmode @@ -960,10 +962,14 @@ s390_expand_builtin (tree exp, rtx target, rtx subtarget ATTRIBUTE_UNUSED, { op[arity] = tmp_rtx; } - else if (GET_MODE (op[arity]) == insn_op->mode - || GET_MODE (op[arity]) == VOIDmode - || (insn_op->predicate == address_operand - && GET_MODE (op[arity]) == Pmode)) + + /* The predicate rejects the operand although the mode is fine. + Copy the operand to register. */ + if (!insn_op->predicate (op[arity], insn_op->mode) + && (GET_MODE (op[arity]) == insn_op->mode + || GET_MODE (op[arity]) == VOIDmode + || (insn_op->predicate == address_operand + && GET_MODE (op[arity]) == Pmode))) { /* An address_operand usually has VOIDmode in the expander so we cannot use this. */ diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index a0cacfa..51a1713 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,6 +1,13 @@ 2019-03-13 Andreas Krebbel <krebbel@linux.ibm.com> Backport from mainline + 2019-03-11 Andreas Krebbel <krebbel@linux.ibm.com> + + * gcc.target/s390/zvector/vec-addc-u128.c: New test. + +2019-03-13 Andreas Krebbel <krebbel@linux.ibm.com> + + Backport from mainline 2019-02-07 Andreas Krebbel <krebbel@linux.ibm.com> * gcc.target/s390/zvector/xl-xst-align-1.c: New test. diff --git a/gcc/testsuite/gcc.target/s390/zvector/vec-addc-u128.c b/gcc/testsuite/gcc.target/s390/zvector/vec-addc-u128.c new file mode 100644 index 0000000..3ab0c71 --- /dev/null +++ b/gcc/testsuite/gcc.target/s390/zvector/vec-addc-u128.c @@ -0,0 +1,10 @@ +/* { dg-do compile { target { s390*-*-* } } } */ +/* { dg-options "-O3 -mzarch -march=z13 -mzvector -fno-asynchronous-unwind-tables" } */ + +#include <vecintrin.h> + +vector unsigned char test(void) +{ + vector unsigned char a = { 0 }; + return __builtin_s390_vec_addc_u128 (a, a); +} |