This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[i386] Simplify vector_all_ones_operand
- From: Richard Sandiford <richard dot sandiford at arm dot com>
- To: gcc-patches at gcc dot gnu dot org
- Cc: ubizjak at gmail dot com
- Date: Thu, 20 Aug 2015 11:02:40 +0100
- Subject: [i386] Simplify vector_all_ones_operand
- Authentication-results: sourceware.org; auth=none
gen_rtx_CONST_VECTOR ensures that there is a single instance of:
(const_vector:M [(const_int -1) ... (const_int -1)])
for each M, so pointer equality with CONSTM1_RTX is enough.
This seemed like a better fix than using the helper functions
that I'm about to post.
Bootstrapped & regression-tested on x86_64-linux-gnu. OK to install?
Thanks,
Richard
gcc/
* config/i386/predicates.md (vector_all_ones_operand): Use
CONSTM1_RTX to simplify definition.
diff --git a/gcc/config/i386/predicates.md b/gcc/config/i386/predicates.md
index a9c8623..bc76a5b 100644
--- a/gcc/config/i386/predicates.md
+++ b/gcc/config/i386/predicates.md
@@ -912,25 +912,9 @@
/* Return true if operand is a vector constant that is all ones. */
(define_predicate "vector_all_ones_operand"
- (match_code "const_vector")
-{
- int nunits = GET_MODE_NUNITS (mode);
-
- if (GET_CODE (op) == CONST_VECTOR
- && CONST_VECTOR_NUNITS (op) == nunits)
- {
- int i;
- for (i = 0; i < nunits; ++i)
- {
- rtx x = CONST_VECTOR_ELT (op, i);
- if (x != constm1_rtx)
- return false;
- }
- return true;
- }
-
- return false;
-})
+ (and (match_code "const_vector")
+ (match_test "INTEGRAL_MODE_P (GET_MODE (op))")
+ (match_test "op == CONSTM1_RTX (GET_MODE (op))")))
; Return true when OP is operand acceptable for standard SSE move.
(define_predicate "vector_move_operand"