[LLVMdev] Signed/Unsigned Instruction selection.
Tim Northover
t.p.northover at gmail.com
Wed Jul 9 02:10:50 PDT 2014
> The sign information is no more available in the selection DAG.
> So how can I generate different instructions for binary operators with
> signed/unsigned operands in the assembler (e.g. mul/mulu)?
Instructions where it actually matters (assuming 2s-complement
representation) have different nodes in the DAG. If you look at
include/llvm/CodeGen/ISDOpcodes.h you'll see separate UDIV and SDIV
nodes, for example.
It only usually affects multiplications if you're doing an extend at
the same time (hence the MULHS, SMUL_LOHI and friends) or care about
overflow (hence SMULO/UMULO).
Cheers.
Tim.
More information about the llvm-dev
mailing list