error:Ran out of lanemask bits to represent subregisterr

Mr. krzysztof I have seen similar question asked by you on llvm group. Could you please help me here to address this issue.

i am trying to construct a register of size 65536 bit by combining 2 registers of 32768 bits. both the 32768 bit registers are different so i have to use the following method

let SubRegIndices = [sub_32768bit, sub_32768bit_hi], CoveredBySubRegs = 1 in

but i am getting following error…

error:Ran out of lanemask bits to represent subregister sub_32768bit_hi_then_sub_16384bit_hi_then_sub_8192bit_hi_then_sub_4096bit_hi_then_sub_2048bit_hi_then_sub_32bit_hi_then

now how to increase lanemask bits? what changes are required??

Kindly help.

The LaneBitmask is implemented in include/llvm/MC/LaneBitmask.h. You will need to change the underlying type and the associated member functions.
If you have a large number of lanes, you will need to replace it with a type that can contain as many independent bits as you need (BitVector would be an ultimate solution). You may run into some problems with the uses of the member function "getAsInteger", but you can change those to something equivalent according to the type you use.


Thank You.

I have replaced all the occurrences of unsigned with uint64_t in Lanemask.h and in all other related files like codegenregisters.cpp, codegenregisters.h, MIParser.cpp etc… Also i changed Log2_32 to Log2_64 and replaced 4 with 8 in codegenregisters.cpp, but still getting the same error:

error:Ran out of lanemask bits to represent subregister sub_32768bit_hi_then_sub_16384bit_hi_then_sub_8192bit_hi_then_sub_4096bit_hi_then_sub_2048bit_hi_then_sub_32bit_hi_then

Now what to do?

Please help.

Did you change the hardcoded 32 right before the line that prints that error in CodeGenRegisters.cpp to 64?

As you mentioned i changed 32 to 64 but now some new errors come which require to change unsigned to uint64_t in mentioned files. i have changed in mentioned files but still errors come to change in other files…

What to do?

It is possible that you have more than 64 lanes. In such case you would need to reimplement LaneBitmask with a larger underlying type. Most of the functionality is already localized to the header file, the only exception may be the "getAsInteger" function. It shouldn't be too hard to fix up the uses to deal with a different underlying type.


You are right. Regarding lanes i can comment only when the other things run fine.

Here I am stuck with unsigned vs uint64_t. it looks as if i need to replace each occurrence of unsigned with uint64_t.
Should i do it for complete llvm folder or codegen only??

i am continuously getting such errors which require changing unsigned with uint64_t.

What to do now???

LaneBitmask should be self-contained. If 64 bits aren't enough, there is no point in using uint64_t, you need something wider.


LaneMask isn’t as self contained as it should be. 64 bits is enough here. The problem is accidental leaking of the current size.

For example there was a hard coded compare with 32 in tablegen until I fixed it recently.

This is most likely the only example. I actually tested it with uint64_t (but without exceeding 32 lanes).


What about the static asserts protecting a Log call and another in the parser?

Those couldn't be done generically, that's why the asserts were added.


I have made changes in 3 files:
LaneBitmask.h, codegenregisters.cpp and miparser.cpp. files are attached here.

Now i am getting following errors. which means file is not generated successfully.

/PIM/lib/Target/X86/MCTargetDesc/X86BaseInfo.h:733:24: error:
no member named ‘XMM8’ in namespace ‘llvm::X86’
if ((RegNo >= X86::XMM8 && RegNo <= X86::XMM31) ||

fatal error: too many errors emitted, stopping now [-ferror-limit=]
20 errors generated.

When i comment out the line to construct 65536 bit register in it run fine.

What to do?

CodeGenRegisters.cpp (80.2 KB)

LaneBitmask.h (2.91 KB)

MIParser.cpp (74.5 KB)

Can you send the generated file as well.

the file is not generated thats why getting such errors

Could you share your .td file?

Also, could you generate the .inc file by hand and show the output?

You could use something like this to generate it:
llvm-tblgen -gen-register-info -I.../lib/Target/<your-target> -I.../lib/Target -I.../include/llvm/Target <your-target>.td -o -

What is the relationship of your target with X86? Are you trying to add something to it, or are you working on a separate target?


Also every line in CodeGenRegisters.cpp that does something like this Idx.LaneMask = LaneBitmask(1 << Bit); Needs to use 1ULL instead of just 1. Alternatively use my patch from r308042.

My code is attached here. I m trying to add in x86 for my target in this initial phase. Maybe later i will use separate target.

CODE.txt (7.62 KB)

ok Craig i will try this as well and update you soon

I tried reproducing the problem, but the file doesn't have everything I need (the class R_CLASS is not defined for example).

Craig's getLane patch fixes the shifts, but if you want to use a larger type than uint64_t, there is more work to do. I'll try to come up with something tomorrow.