[LLVMdev] Lowering operations to 8-bit!

Chris Lattner
Fri, 28 Sep 2007 03:27:05 -0000

On Sep 27, 2007, at 4:35 PM, <Alireza.Moshtaghi at microchip.com>
<Alireza.Moshtaghi at microchip.com> wrote:

> I'm working on version 2.0
> The assertion at line 2380 of LegalizeDAG.cpp fails when it is
> trying to
> lower the add with i16.
>
> assertion reads:
> assert(MVT::isVector(Node->getValueType(0)) &&
>   "Cannot expand this binary operation!");
>
> I am trying to compile a very simple program as follows:
>
> short var;
> void foo(void)
> {
> 	Var++;
> }
>
> The input bytecode, (in addition to the debug stuff) contains:
>
> 	%tmp  = load i16* @var        ;<i16> [#uses=1]
> 	%tmp1 = add  i16  %tmp, 1     ;<i16> [#uses=1]
> 	store  i16 %tmp1, i16* @var
> 	br  label %return
> return:         ;preds = %entry
>
> Is the above giving any clue, or you need more info?

I'd suggest trying mainline or LLVM 2.1.  In 2.1 (but not 2.0) it is
possible to implement 128-bit addition on a 32-bit cpu.  This seems
similar to your situation.

-Chris