Port-vax archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: gcc vax bug in built-in ffs function/displacement indexed addressing
On Fri, 6 Jan 2017, Paul Koning wrote:
> >> My VAX architecture handbook says that the operand type of that
> >> operand is "$
> >
> > Doh! So does mine.
> >
> > opcode startpos.rl, size.rb, base.vb, {field.rv}, findpos.wl
> >
> > I can only infer I was looking at the implicit field.rv operand.
The {field.rv} specifier appears to be a notational convention only
standing for the three first operands, and does not appear as an actual
instruction operand in assembly or disassembly. The document is lacking a
description of this convention or at least I cannot find it either.
> >> So yes, that looks like a wrong code bug. Perhaps the code generator
> >> just h$
> >
> > If so, it's probably worth checking the other bitfield instructions
> > too.
>
> >From a quick look at the VAX stuff in gcc/config/vax, I see this in
> >builtins.md:
>
> (define_insn "ffssi2_internal"
> [(set (match_operand:SI 0 "nonimmediate_operand" "=rQ")
> (ffs:SI (match_operand:SI 1 "general_operand" "nrmT")))
> (set (cc0) (match_dup 0))]
> ""
> "ffs $0,$32,%1,%0")
>
> I believe the issue is that the check for "can we use indexing" (in
> vax.c) assumes that the answer is yes if the offset is a value
> multiplied by sizeof(operand). In this case, I assume that the operand
> is a 32 bit integer. The trouble is that FFS operates on values up to
> 32 bits but indexes as if it were a byte operand.
The operand size is specified by its mode being SI here, that is a 32-bit
integer indeed.
> I'm not sure if constraint "Q" means what I hope it does, but if yes,
> the fix might be to replace the nrmT in that second match_operand by
> nrQT.
Offhand the predicate might need to be changed accordingly as well so
that it only passes through a memory operand expression which will later
match one of the constraints given. NB these days it can be easily done
with the use of `satisfies_constraint_<name>' functions, where <name> is
the constraint intended, so that code used for constraint matching does
not have to be replicated in predicates.
Maciej
Home |
Main Index |
Thread Index |
Old Index