]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
Only emulate integral vectors.
authorJuergen Christ <jchrist@linux.ibm.com>
Mon, 19 Feb 2024 09:10:35 +0000 (10:10 +0100)
committerJuergen Christ <jchrist@linux.ibm.com>
Wed, 28 Feb 2024 10:17:30 +0000 (11:17 +0100)
The emulation via word mode tries to perform integer arithmetic on floating
point values instead of floating point arithmetic.  This leads to
mis-compilations.

Failure occured on s390x on these existing test cases:
gcc.dg/vect/tsvc/vect-tsvc-s112.c
gcc.dg/vect/tsvc/vect-tsvc-s113.c
gcc.dg/vect/tsvc/vect-tsvc-s119.c
gcc.dg/vect/tsvc/vect-tsvc-s121.c
gcc.dg/vect/tsvc/vect-tsvc-s131.c
gcc.dg/vect/tsvc/vect-tsvc-s132.c
gcc.dg/vect/tsvc/vect-tsvc-s2233.c
gcc.dg/vect/tsvc/vect-tsvc-s421.c
gcc.dg/vect/vect-alias-check-14.c
gcc.target/s390/vector/partial/s390-vec-length-epil-run-1.c
gcc.target/s390/vector/partial/s390-vec-length-epil-run-3.c
gcc.target/s390/vector/partial/s390-vec-length-full-run-3.c

gcc/ChangeLog:

PR tree-optimization/114075

* tree-vect-stmts.cc (vectorizable_operation): Don't emulate floating
point vectors

Signed-off-by: Juergen Christ <jchrist@linux.ibm.com>
gcc/tree-vect-stmts.cc

index 1dbe1115da4d7dd4fc590e5830a9c7f05be6945a..be0e1a9c69da43f63e79dcd9c05b3a1181426ef1 100644 (file)
@@ -6756,7 +6756,8 @@ vectorizable_operation (vec_info *vinfo,
         those through even when the mode isn't word_mode.  For
         ops we have to lower the lowering code assumes we are
         dealing with word_mode.  */
-      if ((((code == PLUS_EXPR || code == MINUS_EXPR || code == NEGATE_EXPR)
+      if (!INTEGRAL_TYPE_P (TREE_TYPE (vectype))
+         || (((code == PLUS_EXPR || code == MINUS_EXPR || code == NEGATE_EXPR)
            || !target_support_p)
           && maybe_ne (GET_MODE_SIZE (vec_mode), UNITS_PER_WORD))
          /* Check only during analysis.  */