Doubts about lowering of UMUL_LOHI

Hi,

When expanding multiply operation in LegalizeTypes LLVM generates some nodes such as UMUL_LOHI (please refer file LegalizeIntegerTypes.cpp – function - ExpandIntegerResult). However while lowering this operation in LegalizeDAG (please refer file LegalizeDAG.cpp - function - LegalizeOp) the comment says

“These nodes will only be produced by target-specific lowering……”.

LLVM, therefore, does not call the LowerOperation for these operations. Function setOperationAction(UMUL_LOHI, ValueType, Custom) does not work for these nodes.

My Doubts

  1. Why is there such contradiction in the code and comment?

  2. Why is custom legalization of this node not allowed?

  3. My target does not have any instruction directly matching to this operation. How should this node be legalized?

Regards

Sachin

2) Why is custom legalization of this node not allowed?

No target has needed it so far. Why do you need it?

3) My target does not have any instruction directly matching to this
operation. How should this node be legalized?

If your target doesn't have this operation, you should mark it Expand;
legalization will take care of the rest.

-Eli

From: llvmdev-bounces@cs.uiuc.edu [mailto:llvmdev-bounces@cs.uiuc.edu]

On

Behalf Of Eli Friedman
Sent: Thursday, December 18, 2008 1:52 PM
To: LLVM Developers Mailing List
Subject: Re: [LLVMdev] Doubts about lowering of UMUL_LOHI

> 2) Why is custom legalization of this node not allowed?

No target has needed it so far. Why do you need it?

I may not need this.

I have an 8-bit target. Also there is no instruction for multiply
operation. Therefore I want to make a library call for this operation. I
think better option would be to have library calls for types MVT::i8 and
MVT::i16 in RTLIB enum.

Currently this enum does not list any calls for types less than
MVT::i32.

Regards
Sachin

> 3) My target does not have any instruction directly matching

to