* [i386] Simplify vector_all_ones_operand
@ 2015-08-20 10:22 Richard Sandiford
2015-08-20 11:25 ` Uros Bizjak
0 siblings, 1 reply; 2+ messages in thread
From: Richard Sandiford @ 2015-08-20 10:22 UTC (permalink / raw)
To: gcc-patches; +Cc: ubizjak
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"
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [i386] Simplify vector_all_ones_operand
2015-08-20 10:22 [i386] Simplify vector_all_ones_operand Richard Sandiford
@ 2015-08-20 11:25 ` Uros Bizjak
0 siblings, 0 replies; 2+ messages in thread
From: Uros Bizjak @ 2015-08-20 11:25 UTC (permalink / raw)
To: gcc-patches, Uros Bizjak, richard.sandiford
On Thu, Aug 20, 2015 at 12:02 PM, Richard Sandiford
<richard.sandiford@arm.com> wrote:
> 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.
OK.
Thanks,
Uros.
> 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"
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2015-08-20 11:24 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-08-20 10:22 [i386] Simplify vector_all_ones_operand Richard Sandiford
2015-08-20 11:25 ` Uros Bizjak
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).