This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[PATCH] (gimple) Allow integer return type from vector compares
- From: Will Schmidt <will_schmidt at vnet dot ibm dot com>
- To: GCC Patches <gcc-patches at gcc dot gnu dot org>
- Cc: Richard Biener <richard dot guenther at gmail dot com>, Segher Boessenkool <segher at kernel dot crashing dot org>, Bill Schmidt <wschmidt at linux dot vnet dot ibm dot com>, David Edelsohn <dje dot gcc at gmail dot com>
- Date: Thu, 12 Oct 2017 15:02:57 -0500
- Subject: [PATCH] (gimple) Allow integer return type from vector compares
- Authentication-results: sourceware.org; auth=none
- Reply-to: will_schmidt at vnet dot ibm dot com
Hi,
Update the logic in verify_gimple_comparision to allow a vector integer result
from a vector comparison, where it previously was limited to only allowing
compares with boolean results. This allows powerpc intrinsics such as this
one to build (after gimple folding):
vector bool int vec_cmpeq (vector signed int, vector signed int);
This has been tested in conjunction with the "rs6000 GIMPLE folding for vector
compares" patch (posted separately) on p6 and newer.
OK for trunk?
Thanks,
-Will
[gcc]
2017-10-12 Will Schmidt <will_schmidt@vnet.ibm.com>
* gcc/tree-cfg.c: (@ verify_gimple_comparison ): allow boolean result
from vector compares.
diff --git a/gcc/tree-cfg.c b/gcc/tree-cfg.c
index b5e0460..adf3607 100644
--- a/gcc/tree-cfg.c
+++ b/gcc/tree-cfg.c
@@ -3624,14 +3624,16 @@ verify_gimple_comparison (tree type, tree op0, tree op1, enum tree_code code)
debug_generic_expr (op0_type);
debug_generic_expr (op1_type);
return true;
}
}
- /* Or a boolean vector type with the same element count
- as the comparison operand types. */
+ /* Or a vector type with the same element count
+ as the comparison operand types. The vector type may
+ be boolean or integer. */
else if (TREE_CODE (type) == VECTOR_TYPE
- && TREE_CODE (TREE_TYPE (type)) == BOOLEAN_TYPE)
+ && (( TREE_CODE (TREE_TYPE (type)) == BOOLEAN_TYPE)
+ || ( TREE_CODE (TREE_TYPE (type)) == INTEGER_TYPE)))
{
if (TREE_CODE (op0_type) != VECTOR_TYPE
|| TREE_CODE (op1_type) != VECTOR_TYPE)
{
error ("non-vector operands in vector comparison");