[PATCH] [X86 DAG] Lower vselects with a constant condition as blend+imm if possible

Filipe Cabecinhas filcab+llvm.phabricator at gmail.com
Thu May 15 16:57:38 PDT 2014


Hi Nadav,

I'm not very familiar with the cost model part, but I couldn't find proper
places that I have to change:
I'm assuming you're talking about getCmpSelInstrCost() in
X86TargetTransformInfo, is this right?

If so, the function only seems to get the types of the instruction's
condition and result, not the proper arguments.
If we don't get the arguments, we can't be sure if this will be a cheap
vselect.

Even with that, the BaseTargetTransformInfo only cares about nodes set to
Expand. All other nodes' cost (Legal, Custom, Promote) are the type
legalization cost + 1 (BasicTargetTransformInfo.cpp:445).
X86TargetTransformInfo.cpp:576 has the X86 specialization, but this one
just adds what's on the cost table to the type legalization. I don't think
it's really needed to add cost table entries just to, in the end, have the
same behaviour as we now have.

I also added a test for the costs to lower a vselect, since we had none.
But I can commit it without the table changes.
What do you think? I have the tables ready to commit anyway, but I don't
think we need to.

 Filipe

http://reviews.llvm.org/D3752






More information about the llvm-commits mailing list