[LLVMdev] Question on tablegen

Manjunath Kudlur keveman at gmail.com
Tue May 5 22:23:13 PDT 2009


Hello,

I am trying to create a machine instruction for "extractelement". I
want to translate
r <- extractelement v, 0
to
mov r, v.x

I was looking at the dag I can use and I found vector_extract. The
inputs for this SDnode are a register and a iPtr constant. With that,
I need to create 4 separate def's to extract element 0, 1, 2, and 3
and translate to v.x, v.y, v.z, and v.w. I was wondering if I can use
the dag's 2nd input as an index into a list of strings and form the
assembly instruction, something like !strconcat("mov $dst, v.",
elemnames[$input]). I am still trying to learn the tablegen syntax and
semantics, so how to do this is not clear to me. I will appreciate any
suggestions on how to do this, or pointers to other places where
similar things are done.

Thanks,
Manjunath



More information about the llvm-dev mailing list