X86 new registers not being allocated

Hi all,

I have a bunch of new registers set up in X86RegisterInfo.td, the important part being

def PR128 : RegisterClass<“X86”, [i128],
128, (sequence “POI%u”, 0, 7)>;

def VR128 : RegisterClass<“X86”, [v4f32, v2f64, v16i8, v8i16, v4i32, v2i64],
128, (add PR128, FR32)>;

I have an entry in X86ISelLowering.cpp:

addRegisterClass(MVT::i128, &X86::PR128RegClass);

and in findRepresentativeClass():

case MVT::i128:
RRC = &X86::PR128RegClass;

But even though my nodes have MVT::i128 value type, they get allocated to XMM registers. I have, of course, removed i128 from FR128. What am I missing?


Hi Barbora,

What is important for using new registers is to have instructions that are “compatible" with them.

In a nutshell, if you don’t have any instruction that uses your new register class, then it won’t be used. Basically, it is useless to have a value living in a container you cannot address.