The v8m.base ISA contains movw, which can operate on an unsigned 16-bit value. Add the pattern that converts an add with a negative value, that could fit into 16-bits when negated, into a sub with that positive value.
Details
Diff Detail
Event Timeline
test/CodeGen/ARM/sub.ll | ||
---|---|---|
9–10 | because we're testing arm and thumb code, where we maybe using the destructive form. |
lib/Target/ARM/ARMInstrThumb.td | ||
---|---|---|
1326 | Should this be t2MOVi16? |
lib/Target/ARM/ARMInstrThumb.td | ||
---|---|---|
1326 | yup, cheers! |
Before I put this in ISelDAGToDAG, is there a way to reference machine instructions from across different tablegen files..?
As far as understand, ARMInstrThumb.td is just #included in the other tablegen file. I guess the ordering might be important for them. Would it work better if it's defined in ARMInstrThumb2.td?
I've opted for putting the pattern in ARMInstrInfo once everything has been included. Also added encodings to the test to ensure we're now using the correct movw.
It looks like there are already a couple of patterns in ARMInstrThumb2.td for thumb1 instructions. I think with a comment it would be fine to put it in there. HasV8MBaseline tends to cross Thumb1/Thumb2 already.
Cheers Dave!
I've moved the pattern to where the accompanying T2 patterns are defined.
Should this be t2MOVi16?