[LLVMdev] Multiply i8 operands promotes to i32

Pedro Malagón malagon at die.upm.es
Mon Oct 8 07:44:24 PDT 2012


Hi,

I am generating an assembly file with llc. If I get MUL_I8 and MUL_I16,
with the cli option "msp430-hwmult-mode" it makes a libcall to the
functions Anton just attached.

However, those functions are not included in the assembler I use (nor is
the __mulsi3). I use the debian package for msp430. I am going to add
Anton's files and a new one for mulsi3. I was developing mine and I am
going to save time. The only thing I might have to change is the address
of MPY registers, as they depend on the MSP430 you are using
(MSP430f5438 MPY address is 0x4C0 for example)


Thanks,
Pedro



El 08/10/2012 14:48, Anton Korobeynikov escribió:
>> At -O0, you don't.  __mulsi3 is the obvious lowering, and you're doing
>> something wrong if your tools don't provide it.
> MSP430 is 16 bit target, so mulsi is a bit expensive there, mulhi /
> mulqi can be implemented via hardware multiplier.
>
> There are several problems wrt 16 bit support inside LLVM in general
> and msp430 in particular:
>
> 1. In some places LLVM expectes 32 bit or 64 bit target (e.g. i32
> arguments length argument of memcpy, etc.)
> 2. On MSP430 the multiplier is an external device, so you either need
> to be sure that there are no muls, etc. inside interrupts, or disable
> interrupts while accessing the multiplier.
>
> I'm attaching some old proof-of-concept code for compiler-rt which
> implementes "hi" and "qi" operations. Most probably it needs to be
> modified to be fit into current compiler-rt codebase.
>


-- 
Pedro Malagón - Profesor ayudante
91 549 57 00 - ext. 4220
Departamento de Ingeniería Electrónica
Escuela Técnica Superior de Ingenieros de Telecomunicación
Universidad Politécnica de Madrid




More information about the llvm-dev mailing list