[LLVMdev] How to legalize i32xi32=i64 multiply

Tim Northover t.p.northover at gmail.com
Thu Feb 20 23:14:44 PST 2014


Hi Mark,

> The problem here is the multiply is ordered wrong.  I think I have the glue
> specified correctly in the code sequence I show at the top.  What am I
> missing?

There are a couple of possibilities. First, I wouldn't worry about
that printout of the DAG, it takes that form even when the glue is
doing its job properly (e.g x86 div). The dependencies are still in
place via the addresses.

The most likely issue is that glue only works when there's the
potential for a dependency. The MPYDF instruction needs to be marked
as defining the accumulator somehow, probably via a "let Defs =
[ACCHI, ACCLO]" line in its .td definition. Without that, I don't
think LLVM uses glue for its ordering, and even more problems will
crop up later (MPYDF won't take part in liveness tracking for ACC,
which is really bad).

The other slight oddity is using glue in a tree structure. I've only
ever seen it in a linear path (e.g. lo using hi's glue rather than
mpy's). I don't know if this is an actual issue, or LLVM can cope with
both, but if all else fails...

Cheers.

Tim.



More information about the llvm-dev mailing list