On Fri, Apr 22, 2016 at 8:20 PM, H.J. Lu <hjl.to...@gmail.com> wrote:
> On Fri, Apr 22, 2016 at 10:29 AM, Uros Bizjak <ubiz...@gmail.com> wrote:
>> On Fri, Apr 22, 2016 at 7:10 PM, Uros Bizjak <ubiz...@gmail.com> wrote:
>>> On Fri, Apr 22, 2016 at 4:19 PM, H.J. Lu <hjl.to...@gmail.com> wrote:
>>>> On Fri, Apr 22, 2016 at 5:11 AM, Uros Bizjak <ubiz...@gmail.com> wrote:
>>>>> On Thu, Apr 21, 2016 at 10:58 PM, H.J. Lu <hjl.to...@gmail.com> wrote:
>>>>>
>>>>>> Here is the updated patch with my standard_sse_constant_p change and
>>>>>> your SSE/AVX pattern change.  I didn't include your
>>>>>> standard_sse_constant_opcode since it didn't compile nor is needed
>>>>>> for this purpose.
>>>>>
>>>>> H.J.,
>>>>>
>>>>> please test the attached patch that finally rewrites and improves SSE
>>>>> constants handling.
>>>>>
>>>>> This is what I want to commit, a follow-up patch will further clean
>>>>> standard_sse_constant_opcode wrt TARGET_AVX512VL.
>>>>>
>>>>
>>>> It doesn't address my problem which is "Allow all 1s of integer as
>>>> standard SSE constants".  The key here is "integer".  I'd like to use
>>>> SSE/AVX store TI/OI/XI integers with -1.
>>>
>>> Yes, my patch *should* work for this. Please note that
>>> all_ones_operand should catch all cases your additional patch adds.
>>>
>>> ;; 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 (mode == VOIDmode)
>>>     mode = GET_MODE (op);
>>>   return op == CONSTM1_RTX (mode);
>>> })
>>>
>>>
>>> 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);
>> })
>>
>
> No.  I need a predicate, all_ones_operand or all_zeros_operand,
> i.e., standard_sse_constant_p (op, mode) != 0.

The predicate (standard_sse_constant_p) still works this way, but you
have to provide non-VOID mode in case modeless (-1) is passed. Please
note that VOID mode with modeless (-1) will ICE by design, since
standard_sse_constant_p is not able to determine if insn is supported
by target ISA.

Uros.

Reply via email to