public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* Defining constraint for registers tuple
@ 2011-07-29 10:56 Kirill Yukhin
  2011-07-29 14:55 ` Ian Lance Taylor
  0 siblings, 1 reply; 6+ messages in thread
From: Kirill Yukhin @ 2011-07-29 10:56 UTC (permalink / raw)
  To: gcc; +Cc: Kirill Yukhin

Hi guys,
I'm working on implementation of `mulx` (which is part of BMI2). One
of improvements compared generic `mul` is that it allows to specify
destination registers.
For `mul` we have `A` constraint, which stands for AX:DX pair.
So, is there a possibility to relax such cinstraint and allow any pair
of registers as destination?

Thanks, K

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Defining constraint for registers tuple
  2011-07-29 10:56 Defining constraint for registers tuple Kirill Yukhin
@ 2011-07-29 14:55 ` Ian Lance Taylor
  2011-08-01 12:28   ` Kirill Yukhin
  0 siblings, 1 reply; 6+ messages in thread
From: Ian Lance Taylor @ 2011-07-29 14:55 UTC (permalink / raw)
  To: Kirill Yukhin; +Cc: gcc

Kirill Yukhin <kirill.yukhin@gmail.com> writes:

> I'm working on implementation of `mulx` (which is part of BMI2). One
> of improvements compared generic `mul` is that it allows to specify
> destination registers.
> For `mul` we have `A` constraint, which stands for AX:DX pair.
> So, is there a possibility to relax such cinstraint and allow any pair
> of registers as destination?

Don't change the constraint, just add an alternative.  Or use a
different insn with an insn predicate.

Ian

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Defining constraint for registers tuple
  2011-07-29 14:55 ` Ian Lance Taylor
@ 2011-08-01 12:28   ` Kirill Yukhin
  2011-08-16 11:20     ` Kirill Yukhin
  0 siblings, 1 reply; 6+ messages in thread
From: Kirill Yukhin @ 2011-08-01 12:28 UTC (permalink / raw)
  To: Ian Lance Taylor; +Cc: gcc

> Don't change the constraint, just add an alternative.  Or use a
> different insn with an insn predicate.

This is misunderstanding beacuse of my great English :)

I am not going to update existing constraint. I am going to implement new one.
Actually, I am looking for some expample, where similar constraint
might be implemented already.

--
Thanks, K

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Defining constraint for registers tuple
  2011-08-01 12:28   ` Kirill Yukhin
@ 2011-08-16 11:20     ` Kirill Yukhin
  2011-08-16 14:58       ` Richard Henderson
  0 siblings, 1 reply; 6+ messages in thread
From: Kirill Yukhin @ 2011-08-16 11:20 UTC (permalink / raw)
  To: Ian Lance Taylor, Uros Bizjak, H.J. Lu; +Cc: gcc

Hi guys,
the question is still opened. Let me try to explain further.

The new MULX instruction is capable to store result of unsigned
multiply to arbitrary pair of GPRs (one of operands still must be DX).
But I have no idea, how to implement such a constraint.
Here is define_insn which is works but uses i386's "A" constraint. It
is much worse than using any pair of registers.
(define_insn "*bmi2_mulx<mode><dwi>3"
  [(set (match_operand:<DWI> 0 "register_operand" "=A")
        (mult:<DWI>
          (zero_extend:<DWI>
            (match_operand:DWIH 1 "nonimmediate_operand" "d"))
          (zero_extend:<DWI>
            (match_operand:DWIH 2 "nonimmediate_operand" "rm"))))]
 "TARGET_BMI2 && !(MEM_P (operands[1]) && MEM_P (operands[2]))"
  "mulx\t%2, %%eax, %%edx"
  [(set_attr "type" "imul")
   (set_attr "length_immediate" "0")
   (set_attr "mode" "<MODE>")])

Maybe there is examples from other ports? Any help is appreciated

Thanks, K



On Mon, Aug 1, 2011 at 4:28 PM, Kirill Yukhin <kirill.yukhin@gmail.com> wrote:
>> Don't change the constraint, just add an alternative.  Or use a
>> different insn with an insn predicate.
>
> This is misunderstanding beacuse of my great English :)
>
> I am not going to update existing constraint. I am going to implement new one.
> Actually, I am looking for some expample, where similar constraint
> might be implemented already.
>
> --
> Thanks, K
>

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Defining constraint for registers tuple
  2011-08-16 11:20     ` Kirill Yukhin
@ 2011-08-16 14:58       ` Richard Henderson
  2011-08-16 17:32         ` Kirill Yukhin
  0 siblings, 1 reply; 6+ messages in thread
From: Richard Henderson @ 2011-08-16 14:58 UTC (permalink / raw)
  To: Kirill Yukhin; +Cc: Ian Lance Taylor, Uros Bizjak, H.J. Lu, gcc

On 08/16/2011 04:20 AM, Kirill Yukhin wrote:
> Hi guys,
> the question is still opened. Let me try to explain further.
> 
> The new MULX instruction is capable to store result of unsigned
> multiply to arbitrary pair of GPRs (one of operands still must be DX).
> But I have no idea, how to implement such a constraint.
> Here is define_insn which is works but uses i386's "A" constraint. It
> is much worse than using any pair of registers.

See {u}mulsidi3_internal in mn10300.md for an example of a
double-word multiplication with two independent outputs.


r~

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Defining constraint for registers tuple
  2011-08-16 14:58       ` Richard Henderson
@ 2011-08-16 17:32         ` Kirill Yukhin
  0 siblings, 0 replies; 6+ messages in thread
From: Kirill Yukhin @ 2011-08-16 17:32 UTC (permalink / raw)
  To: Richard Henderson; +Cc: Ian Lance Taylor, Uros Bizjak, H.J. Lu, gcc

That is exactly it! Thank you very much!
BMI2 support is almost here :)

--
K

On Tue, Aug 16, 2011 at 6:58 PM, Richard Henderson <rth@redhat.com> wrote:
> On 08/16/2011 04:20 AM, Kirill Yukhin wrote:
>> Hi guys,
>> the question is still opened. Let me try to explain further.
>>
>> The new MULX instruction is capable to store result of unsigned
>> multiply to arbitrary pair of GPRs (one of operands still must be DX).
>> But I have no idea, how to implement such a constraint.
>> Here is define_insn which is works but uses i386's "A" constraint. It
>> is much worse than using any pair of registers.
>
> See {u}mulsidi3_internal in mn10300.md for an example of a
> double-word multiplication with two independent outputs.
>
>
> r~
>

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2011-08-16 17:32 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-07-29 10:56 Defining constraint for registers tuple Kirill Yukhin
2011-07-29 14:55 ` Ian Lance Taylor
2011-08-01 12:28   ` Kirill Yukhin
2011-08-16 11:20     ` Kirill Yukhin
2011-08-16 14:58       ` Richard Henderson
2011-08-16 17:32         ` Kirill Yukhin

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).