From dc4f29bc9a9dfcc68b20c0ce767cc3d6fb7409d4 Mon Sep 17 00:00:00 2001 From: Andreas Krebbel Date: Fri, 24 Mar 2017 13:51:32 +0000 Subject: [PATCH] S/390: PR79893: Add diagnostics vec_load_bndry builtin. The boundary argument of the vec_load_bndry builtin needs to be rewritten. At that point it must be constant already. The current diagnostics in s390_expand_builtins is too late for this. The patch adds an additional check for that builtin which will be triggered already during preprocessing. Regression tested on s390x. gcc/testsuite/ChangeLog: 2017-03-24 Andreas Krebbel PR target/79893 * gcc.target/s390/zvector/pr79893.c: New test. gcc/ChangeLog: 2017-03-24 Andreas Krebbel PR target/79893 * config/s390/s390-c.c (s390_adjust_builtin_arglist): Issue an error if the boundary argument is not constant. From-SVN: r246442 --- gcc/ChangeLog | 6 ++++++ gcc/config/s390/s390-c.c | 12 ++++++++++-- gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/gcc.target/s390/zvector/pr79893.c | 9 +++++++++ 4 files changed, 30 insertions(+), 2 deletions(-) create mode 100644 gcc/testsuite/gcc.target/s390/zvector/pr79893.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 12525c64953..e3fcfbe0a4f 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2017-03-24 Andreas Krebbel + + PR target/79893 + * config/s390/s390-c.c (s390_adjust_builtin_arglist): Issue an + error if the boundary argument is not constant. + 2017-03-24 Jakub Jelinek PR rtl-optimization/80112 diff --git a/gcc/config/s390/s390-c.c b/gcc/config/s390/s390-c.c index 8cdac7e6e7c..0521e1eeb55 100644 --- a/gcc/config/s390/s390-c.c +++ b/gcc/config/s390/s390-c.c @@ -673,10 +673,18 @@ s390_adjust_builtin_arglist (unsigned int ob_fcode, tree decl, case S390_OVERLOADED_BUILTIN_s390_vec_load_bndry: { int code; - if (dest_arg_index == 1) { - switch (tree_to_uhwi ((**arglist)[src_arg_index])) + tree arg = (**arglist)[src_arg_index]; + + if (TREE_CODE (arg) != INTEGER_CST) + { + error ("constant value required for builtin %qF argument %d", + decl, src_arg_index + 1); + return; + } + + switch (tree_to_uhwi (arg)) { case 64: code = 0; break; case 128: code = 1; break; diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index a53ffefb6e3..96eedbd2cee 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2017-03-24 Andreas Krebbel + + PR target/79893 + * gcc.target/s390/zvector/pr79893.c: New test. + 2017-03-24 Jakub Jelinek PR rtl-optimization/80112 diff --git a/gcc/testsuite/gcc.target/s390/zvector/pr79893.c b/gcc/testsuite/gcc.target/s390/zvector/pr79893.c new file mode 100644 index 00000000000..ad6ca309ae8 --- /dev/null +++ b/gcc/testsuite/gcc.target/s390/zvector/pr79893.c @@ -0,0 +1,9 @@ +/* { dg-do compile { target { s390*-*-* } } } */ +/* { dg-options "-march=z13 -mzarch -mzvector" } */ + +#include + +void +foo(signed char *p, int i) { + vec_load_bndry(p, i); /* { dg-error "constant value required for builtin.*2" } */ +} -- 2.30.2