This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] Allow all 1s of integer as standard SSE constants
- From: Uros Bizjak <ubizjak at gmail dot com>
- To: Uros Bizjak <ubizjak at gmail dot com>, "H.J. Lu" <hjl dot tools at gmail dot com>, "gcc-patches at gcc dot gnu dot org" <gcc-patches at gcc dot gnu dot org>, Richard Sandiford <rdsandiford at googlemail dot com>
- Date: Mon, 25 Apr 2016 21:51:30 +0200
- Subject: Re: [PATCH] Allow all 1s of integer as standard SSE constants
- Authentication-results: sourceware.org; auth=none
- References: <20160420195359 dot GA3113 at intel dot com> <CAFULd4ZJrw9hWtkxCZmRHinz+aACOvnkRU4FUXVYcFD4_qjeVA at mail dot gmail dot com> <CAFULd4Y8HGC=+iFtp9PmqW2XcVwnhNygH6si0J1OCNWipGjBLg at mail dot gmail dot com> <CAFULd4b3WPYGr=uL=1D7RmnrYBeviVt0=-ckgT-8zJJcae+m3A at mail dot gmail dot com> <CAMe9rOr9B+X-H0PmBt=fsO3BmQR_MrF3nAg2pdsOoa3NpNV3PA at mail dot gmail dot com> <CAFULd4auhHb54j3GwZRCUiuAxdPcbKk+oA4+paWU=tWsQ+7Whw at mail dot gmail dot com> <CAMe9rOovKPRPNZyaq+-uWz3kwFXJRrTuh4-cFrxYMaWaUZJoYg at mail dot gmail dot com> <CAFULd4bu+r+AFgWg+W+xtKUP=diOdsfh-dxCScFZTyEf+Uu+xg at mail dot gmail dot com> <CAMe9rOrx2R+bDOHZxcp_tcMBpgD0zVsxM7L0FMOAzHKXLQPuGg at mail dot gmail dot com> <CAFULd4ab3zoOWqe3KnMHgjnRusPFoBdvFxWpb5hAMoZG24OgZw at mail dot gmail dot com> <CAMe9rOo3HzitjaH2sF7vio+OVekQVjn0WrL4D5pLkXVbtxmXNA at mail dot gmail dot com> <CAMe9rOrnJhtFN+AuPznhHh6K7Bs0hdGvcNiv-dcSz2smd37Dcg at mail dot gmail dot com> <CAFULd4a56mPORpFoiKd5XHXgRe8gPoJU+aNK_VYsU+7wc3WB0Q at mail dot gmail dot com> <CAMe9rOofVGmbb_jQ2+QwHTRs54Tbf+--kHYYPmZeV0sg_GMstw at mail dot gmail dot com> <CAMe9rOp0A1Y9kC3SA6R_Z-Az-t7Oc8VwEqaKxD8FAzv_e6j6qQ at mail dot gmail dot com> <CAFULd4YO4+aZjSnBW-KS3i2i4HqyNYn0Jsq0q7T8mC0uLw9vrA at mail dot gmail dot com> <CAMe9rOr3hrRo6HBQ8N3fu6bE-shTJ2H25zBPt=wn6rJ+Tbpg=A at mail dot gmail dot com> <CAFULd4Z_dE+kE+3CjKgWX2sSYx3dAE2pWtHynVFNP76Myjx7Ng at mail dot gmail dot com> <CAFULd4adPBsDUOKetJJygxs5Ey0F=xy14AcrZF=zEnU83o4uAg at mail dot gmail dot com> <87shy93214 dot fsf at googlemail dot com>
On Mon, Apr 25, 2016 at 9:45 PM, Richard Sandiford
<rdsandiford@googlemail.com> wrote:
>>> Can you please investigate, what is wrong with all_ones_operand so it
>>> doesn't accept all (-1) operands?
>>
>> Does following work:
>>
>> ;; Return true if operand is a (vector) constant with all bits set.
>> (define_predicate "all_ones_operand"
>> (match_code "const_int,const_wide_int,const_vector")
>> {
>> if (op == constm1_rtx)
>> return true;
>>
>> if (CONST_INT_P (op))
>> return INTVAL (op) == HOST_WIDE_INT_M1;
>>
>> if (mode == VOIDmode)
>> mode = GET_MODE (op);
>> return op == CONSTM1_RTX (mode);
>> })
>
> const_wide_int isn't necessary here. An all-1s integer will always
> use CONST_INT, regardless of the mode size.
>
> I think this reduces to:
>
> (define_predicate "all_ones_operand"
> (match_code "const_int,const_vector")
> {
> if (CONST_INT_P (op))
> return INTVAL (op) == HOST_WIDE_INT_M1;
> return op == CONSTM1_RTX (GET_MODE (op));
> }
>
> (which is still more complex than it should be -- roll on CONST_INTs
> with modes. :-))
This is now implemented in a different way, but nevertheless some
const_wide_int codes were removed from other predicates in a follow-up
patch.
Uros.