[llvm-dev] [GlobalISel] Legalize generic instructions that also depend on type of scalar, not only scalar size

Petar Avramovic via llvm-dev llvm-dev at lists.llvm.org
Fri Sep 21 02:28:27 PDT 2018


Hi,

Mips32 has 64 bit floating point instructions, while i64 instructions 
have to be emulated with i32 instructions. This means that G_LOAD should 
be custom legalized for s64 integer value, and be legal for s64 floating 
point value. There are also other generic instructions with the same 
problem: G_STORE, G_SELECT, G_EXTRACT, and G_INSERT.

There are also other configurations where integer and floating point 
instructions of the same size are not simultaneously available. This 
problem was already addressed here 
http://lists.llvm.org/pipermail/llvm-dev/2017-July/114978.html for 
G_LOAD/G_STORE.

Legality of an instruction should not depend on surrounding 
instructions. Because of that, approach from regbankselect that iterates 
through uses of G_LOAD def register and checks if some of the uses was 
an generic floating point instruction should not be an option for legalizer.

Since GlobalISel Legalizer cannot distinguish between them using only 
LLT, only other option that I can see at this moment is having "F" 
variant of the generic instruction (like this is the case with G_ADD and 
G_FADD).

Is this change possible? Or are there some other approaches for dealing 
with this problem?

Petar




More information about the llvm-dev mailing list