[LLVMdev] BITCAST v32i1 to i32

Lai laishengzhang at gmail.com
Sun May 18 08:44:09 PDT 2014


Hi everyone.

I am doing a project on which I want to take the advantage of
two Haswell instructions, pext and pdep, with bmi2 attribute
in LLVM.

I have made the v32i1 legal by
addRegisterClass(MVT::v32i1, &X86::GR32RegClass);
And my code could transform the specific VECTOR_SHUFFLE Node
into x86.bmi.pext.32 Node.
0x27a7710: i32 = llvm.x86.bmi.pext.32 [ORD=1] 0x27a6d10: i32 =
Constant<2761>, 0x27a7510, 0x27a7610: i32 = Constant<-1152>
  0x27a7510: i32 = bitcast [ORD=1] 0x27a6c10
    0x27a6c10: v32i1,ch = CopyFromReg [ID=5] 0x277f9c8: ch = EntryToken
[ID=0], 0x27a6b10: v32i1 = Register %vreg0 [ID=1]

But the llc said that
 LLVM ERROR: Cannot select: 0x27a7510: i32 = bitcast 0x27a6c10 [ORD=1]
[ID=7]
  0x27a6c10: v32i1,ch = CopyFromReg 0x277f9c8, 0x27a6b10 [ID=6]
    0x27a6b10: v32i1 = Register %vreg0 [ID=1]

And I followed the file X86InstrSSE.td, writing the following in the file
X86InstrInfo.td:
let Predicates = [HasBMI2] in {
  def : Pat <(i32 (bitconvert (v32i1 GR32:$src))), (i32 GR32:$src)>;
}
the error raised in compilation:
anonymous.159:     (bitconvert:i32 GR32:<empty>:$src)
Included from /home/lai/git/llvm/lib/Target/X86/X86.td:336:
/home/lai/git/llvm/lib/Target/X86/X86InstrInfo.td:1921:3: error: In
anonymous.159: Type inference contradiction found, merging 'i32' into
'v32i1'
    def : Pat <(i32 (bitconvert (v32i1 GR32:$src))), (i32 GR32:$src)>;
    ^

How can I fix this? I'm working on llvm3.4. Thanks

Lai
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20140518/de5933f5/attachment.html>


More information about the llvm-dev mailing list