aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Krebbel <krebbel@linux.ibm.com>2020-10-22 12:24:22 +0200
committerAndreas Krebbel <krebbel@linux.ibm.com>2020-10-22 12:38:48 +0200
commitf3cf5174b19a89aeed5aa2ba82a373ded35a4a96 (patch)
tree07b577b7e13538db0fc1c5e1cbf4b27ddd297b98
parente3f25eac67aee77af0b2038cd4d6cbd36d7f1030 (diff)
downloadgcc-f3cf5174b19a89aeed5aa2ba82a373ded35a4a96.zip
gcc-f3cf5174b19a89aeed5aa2ba82a373ded35a4a96.tar.gz
gcc-f3cf5174b19a89aeed5aa2ba82a373ded35a4a96.tar.bz2
Fix PR97502
The S/390 backend does not define vec_cmp expanders so far. We relied solely on expanding vcond. With commit 502d63b6d various testcases started to ICE now. This patch just adds the missing expanders to prevent the ICE. However, there are still a couple of performance-related testcase regressions with the vcond lowering which have to be fixed independently. gcc/ChangeLog: PR target/97502 * config/s390/vector.md ("vec_cmp<VI_HW:mode><VI_HW:mode>") ("vec_cmpu<VI_HW:mode><VI_HW:mode>"): New expanders. gcc/testsuite/ChangeLog: * gcc.dg/pr97502.c: New test.
-rw-r--r--gcc/config/s390/vector.md24
-rw-r--r--gcc/testsuite/gcc.dg/pr97502.c15
2 files changed, 38 insertions, 1 deletions
diff --git a/gcc/config/s390/vector.md b/gcc/config/s390/vector.md
index e9332ba..3c01cd1 100644
--- a/gcc/config/s390/vector.md
+++ b/gcc/config/s390/vector.md
@@ -1441,7 +1441,29 @@
;; Integer compares
;;
-(define_insn "*vec_cmp<VICMP_HW_OP:code><VI:mode>_nocc"
+(define_expand "vec_cmp<VI_HW:mode><VI_HW:mode>"
+ [(set (match_operand:VI_HW 0 "register_operand" "")
+ (match_operator:VI_HW 1 ""
+ [(match_operand:VI_HW 2 "register_operand" "")
+ (match_operand:VI_HW 3 "register_operand" "")]))]
+ "TARGET_VX"
+{
+ s390_expand_vec_compare (operands[0], GET_CODE(operands[1]), operands[2], operands[3]);
+ DONE;
+})
+
+(define_expand "vec_cmpu<VI_HW:mode><VI_HW:mode>"
+ [(set (match_operand:VI_HW 0 "register_operand" "")
+ (match_operator:VI_HW 1 ""
+ [(match_operand:VI_HW 2 "register_operand" "")
+ (match_operand:VI_HW 3 "register_operand" "")]))]
+ "TARGET_VX"
+{
+ s390_expand_vec_compare (operands[0], GET_CODE(operands[1]), operands[2], operands[3]);
+ DONE;
+})
+
+(define_insn "*vec_cmp<VICMP_HW_OP:code><VI:mode><VI:mode>_nocc"
[(set (match_operand:VI 2 "register_operand" "=v")
(VICMP_HW_OP:VI (match_operand:VI 0 "register_operand" "v")
(match_operand:VI 1 "register_operand" "v")))]
diff --git a/gcc/testsuite/gcc.dg/pr97502.c b/gcc/testsuite/gcc.dg/pr97502.c
new file mode 100644
index 0000000..d87af9c
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr97502.c
@@ -0,0 +1,15 @@
+/* { dg-do compile } */
+/* { dg-options "-O3" } */
+
+extern char v[54];
+void bar (char *);
+void
+foo (void)
+{
+ int i;
+ char c[32];
+ bar (c);
+ for (i = 0; i < 32; i++)
+ c[i] = c[i] && !v[i];
+ bar (c);
+}