It appears impossible to match memory-to-memory instructions (except for MOV). The MSP430 supports these. The following test case tries to match the pattern that generates "add.w &foo,&bar":
It appears impossible to match memory-to-memory instructions (except for MOV).
The MSP430 supports these. The following test case tries to match the
pattern that generates "add.w &foo,&bar":
IsLegalAndProfitableToFold() rejects the pattern. (Yes, I had OptLevel > None).
Before I dig further, can anyone answer the question: Does LLVM currently allow
a matching a pattern with two loads?
The difficulty with matching these kind of patterns is to avoid cyclic dag (tm). IsLegalAndProfitableToFold is probably checking for such possibilities and rejected the match. X86 isel goes to great pain to pre-process the dag to allow (store (op (load))) instructions to match. You can take a look at it.
I will look at the x86 stuff. However x86 doesn't have instructions that have dags (store (op (load), (load))) of the sort I'm trying to match. So I'm not too hopeful I'll find an easy fix.