[LLVMdev] Adding multiples-of-8 integer types to MVT

Duncan Sands baldrick at free.fr
Fri Dec 11 23:42:37 PST 2009


Hi Ken,

> What would do you think of modifying case (3) slightly as follows?

well, that special cases the smallest legal type, which might not be
a good idea.  Imagine that i10 is legal, and also i32.  Is it better
to turn i40 into four lots of i10 or two lots of i32 with a promotion?
Expansion is expensive, so two lots of i32 would be best.  I suggest the
following scheme:

(3) Suppose T is larger than the largest legal type.  Look at all the
legal types LT for which
   bitwidth T <= 2 * bitwidth of LT
If there is one, take the smallest one (SLT) and promote T to 2*SLT.
If there are none (because bitwidth T is too big), look at all the
legal types LT for which
   bitwidth T <= 4 * bitwidth of LT
If there is one, take the smallest one (SLT) and promote T to 4*SLT.
Continue with 8*, 16* etc.

For example, if i24 and i32 are the legal types, with this algorithm
types i33, ..., i48 would be promoted to i48 then expanded to two lots
of i24.  Types i49, ..., i64 would be promoted to i64 then expanded to
two lots of i32.

For example, if i10 and i32 are the legal types, i40 would be promoted
to i64 then expanded to two lots of i32.

Ciao,

Duncan.



More information about the llvm-dev mailing list