From: Andreas Krebbel Date: Fri, 19 Feb 2016 10:34:12 +0000 (+0000) Subject: S/390: z13 fix mode in vcond expansion X-Git-Tag: basepoints/gcc-7~867 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d0a859e621fad9894d5d29b8afd639d777c0626a;p=thirdparty%2Fgcc.git S/390: z13 fix mode in vcond expansion For floating point vector compares the target mode is an integer mode which accidently was used as register mode when forcing the compare operands into regs. gcc/ChangeLog: * config/s390/s390.c (s390_expand_vcond): Use the compare operand mode. gcc/testsuite/ChangeLog: * gcc.target/s390/vector/vec-vcond-1.c: New test. From-SVN: r233552 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index d6c0aa9c9e5b..1378f5bc7845 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2016-02-19 Andreas Krebbel + + * config/s390/s390.c (s390_expand_vcond): Use the compare operand + mode. + 2016-02-19 Andreas Krebbel * config/s390/s390-protos.h: Add s390_expand_vec_movstr prototype. diff --git a/gcc/config/s390/s390.c b/gcc/config/s390/s390.c index da05a0495575..cd53b15f1122 100644 --- a/gcc/config/s390/s390.c +++ b/gcc/config/s390/s390.c @@ -6329,10 +6329,10 @@ s390_expand_vcond (rtx target, rtx then, rtx els, can be handled by the optimization above but not by the following code. Hence, force them into registers here. */ if (!REG_P (cmp_op1)) - cmp_op1 = force_reg (target_mode, cmp_op1); + cmp_op1 = force_reg (GET_MODE (cmp_op1), cmp_op1); if (!REG_P (cmp_op2)) - cmp_op2 = force_reg (target_mode, cmp_op2); + cmp_op2 = force_reg (GET_MODE (cmp_op2), cmp_op2); s390_expand_vec_compare (result_target, cond, cmp_op1, cmp_op2); diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 2c1567a4b66d..abb2ed6ad3e9 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,7 @@ +2016-02-19 Andreas Krebbel + + * gcc.target/s390/vector/vec-vcond-1.c: New test. + 2016-02-19 Andreas Krebbel * gcc.target/s390/md/movstr-1.c: Allow also the z13 strings diff --git a/gcc/testsuite/gcc.target/s390/vector/vec-vcond-1.c b/gcc/testsuite/gcc.target/s390/vector/vec-vcond-1.c new file mode 100644 index 000000000000..ec65c6fbba40 --- /dev/null +++ b/gcc/testsuite/gcc.target/s390/vector/vec-vcond-1.c @@ -0,0 +1,23 @@ +/* A const vector operand is forced into a register in + s390_expand_vcond. + This testcase once failed because the target mode (v2di) was picked + for the reg instead of the mode of the other comparison + operand. */ + +/* { dg-do compile { target { s390*-*-* } } } */ +/* { dg-options "-O3 -mzarch -march=z13" } */ + +typedef __attribute__((vector_size(16))) long v2di; +typedef __attribute__((vector_size(16))) double v2df; + +v2di +foo (v2df a) +{ + return a == (v2df){ 0.0, 0.0 }; +} + +v2di +bar (v2df a) +{ + return (v2df){ 1.0, 1.0 } == (v2df){ 0.0, 0.0 }; +}