[LLVMdev] PPC Isel complex patterns
Mariusz Grad
mariusz.grad at pwr.wroc.pl
Thu May 8 09:58:31 PDT 2008
Hi all,
I have problem with specifying complex patterns in PPC Isel backend.
I would like to fetch few instructions into one like that:
def MatchPAT1 : Pat<(or
(or
(shl GPRC:$rA, (i32 imm:$imm24)),
(and (shl GPRC:$rA, (i32 imm:$imm8)), 0xFF0000)
),
(or
(srl GPRC:$rA, (i32 imm:$imm24)),
(and (shl GPRC:$rA, (i32 imm:$imm8)),0xFF00)
)), (myinstr GPRC:$rA)>;
That pattern corresponds to i32 bswap intrinsic.
The thing is that such complex pattern matching does not work.
I can specify really simple patterns like: shl GPRC:$rA, (i32 imm:
$imm8) and they work fine but
whenever I try to fetch something more complex like: (and (shl GPRC:
$rA, (i32 imm:$imm8)),0xFF00) they do not work.
Im doing printouts of DAG after legalization (llc -view-legalize-dags)
and that complex pattern which I specify seems to be correct.
It seems that the problem is with function:
SDNode *PPCDAGToDAGISel::Select(SDOperand Op) in PPCISelDAGtoDAG.cpp
file
with case ISD::ADD when it checks whenever and'ed constant is rotated
first.
In such case he puts PPC::RLWINM instruction into DAG (return CurDAG-
>SelectNodeTo(N, PPC::RLWINM, MVT::i32, Ops, 4);)
My question is: can I use patterns to fetch that - if yes, then how
(there is no RLWINM SDNode).
When that function is used, after or before legalization?
I don't see anything on my printouts and that's a little confusing.
Best greetings,
Mariusz.
--
mg
More information about the llvm-dev
mailing list