* type promotion
@ 2014-01-29 20:12 Umesh Kalappa
2014-02-09 12:27 ` Richard Sandiford
0 siblings, 1 reply; 2+ messages in thread
From: Umesh Kalappa @ 2014-01-29 20:12 UTC (permalink / raw)
To: gcc
Hi All,
Was porting gcc 4.8.1 to the private target which has 8 bit regs and
can be used as pair for 16bit like AB ,CD but not BC or AD.
I was stuck in the type promotion like
int i;
unsigned char c;
int test ()
{
i =c;
}
defined the zero_extendqihi2 pattern for the above c construct like
(define_expand zero_extendqihi2
[(set (operand:hi 0 "" """)
(zero_extend:hi (operand:qi 1)))]
""
if(!reload_completed)
{
if(operands[1] != REG)
operands[1]= force_reg(QI,operands[1]);
/* Here i need to enforce gcc to use the next consective paired reg
like B if operands[1] is in A reg or D if operands[1] is in C */
}
)
How do i module the above reguirement in the backend ?
Thank you
~Umesh
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: type promotion
2014-01-29 20:12 type promotion Umesh Kalappa
@ 2014-02-09 12:27 ` Richard Sandiford
0 siblings, 0 replies; 2+ messages in thread
From: Richard Sandiford @ 2014-02-09 12:27 UTC (permalink / raw)
To: Umesh Kalappa; +Cc: gcc
Sorry for the late answer.
Umesh Kalappa <umesh.kalappa0@gmail.com> writes:
> Was porting gcc 4.8.1 to the private target which has 8 bit regs and
> can be used as pair for 16bit like AB ,CD but not BC or AD.
>
> I was stuck in the type promotion like
>
> int i;
> unsigned char c;
>
> int test ()
> {
> i =c;
> }
>
> defined the zero_extendqihi2 pattern for the above c construct like
>
> (define_expand zero_extendqihi2
> [(set (operand:hi 0 "" """)
> (zero_extend:hi (operand:qi 1)))]
> ""
> if(!reload_completed)
> {
> if(operands[1] != REG)
> operands[1]= force_reg(QI,operands[1]);
>
> /* Here i need to enforce gcc to use the next consective paired reg
> like B if operands[1] is in A reg or D if operands[1] is in C */
> }
> )
>
> How do i module the above reguirement in the backend ?
You might have already solved this by now, but this kind of restriction
is usually modelled via HARD_REGNO_MODE_OK. A and C would be “OK”
for HImode but B and D wouldn't.
Did you single out zero_extend because the QImode input also needs
to follow the same rules? If so, the way to model that depends on
the restriction. If the QImode input to the zero_extend must be in
the low 8 bits of the output register then you can use matching
constraints like "0" for the input operand. (It's OK to match
operands of different sizes like this.) If instead the QImode
input is independent of the HImode output but can only go in
certain registers (perhaps just A or C, for example) then you
can define a register class that just includes those registers.
You'd then need an associated define_register_constraint.
Thanks,
Richard
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2014-02-09 12:27 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-01-29 20:12 type promotion Umesh Kalappa
2014-02-09 12:27 ` Richard Sandiford
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).