[LLVMdev] Multiply i8 operands promotes to i32

Anton Korobeynikov anton at korobeynikov.info
Mon Oct 8 05:48:10 PDT 2012


> 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.

-- 
With best regards, Anton Korobeynikov
Faculty of Mathematics and Mechanics, Saint Petersburg State University
-------------- next part --------------
A non-text attachment was scrubbed...
Name: mulhi3hw_noint.S
Type: application/octet-stream
Size: 509 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20121008/34bf46a4/attachment.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: mulhi3hw.S
Type: application/octet-stream
Size: 541 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20121008/34bf46a4/attachment-0001.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: mulqi3hw_noint.S
Type: application/octet-stream
Size: 510 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20121008/34bf46a4/attachment-0002.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: mulqi3hw.S
Type: application/octet-stream
Size: 541 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20121008/34bf46a4/attachment-0003.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: umulhi3hw_noint.S
Type: application/octet-stream
Size: 511 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20121008/34bf46a4/attachment-0004.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: umulhi3hw.S
Type: application/octet-stream
Size: 542 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20121008/34bf46a4/attachment-0005.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: umulqi3hw_noint.S
Type: application/octet-stream
Size: 511 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20121008/34bf46a4/attachment-0006.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: umulqi3hw.S
Type: application/octet-stream
Size: 542 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20121008/34bf46a4/attachment-0007.obj>


More information about the llvm-dev mailing list