On failing to find sequences that can be converted into dual macs, try to find sequential 16-bit loads that are used by muls which we can then use smultb, smulbt, smultt with a wide load.
|662 ↗||(On Diff #165086)|
I think the alias checks are the same as in MatchSMLAD, so it looks like we can share that, and avoid the duplication here. I could definitely live with that being done in a follow up patch.
|28 ↗||(On Diff #165086)|
These tests are not ideal, in the sense we are not directly checking for the smultb, smulbt, smultt patterns here. Instead, we rely on these ashr + mul patterns that we now generate, to be picked up and turned in to smlab variants later, like it is tested in test/CodeGen/ARM/smul.ll. And thus, since breaking these shr + mul rewrite patterns would give problems in smul.ll, I think these tests in their current form are acceptable as I understood that turning these tests in to llc tests would complicate things a bit.
The patch caused an assert on some vectorized code because I missed a check that the muls are plain integer types. parallel-dsp-top-bottom-neg-vec.ll has been added which was the reproducer provided.
Two breaking assumptions were that:
- the base load would be before the offset load.
- each load would only have one user - this is true but I also really meant and assumed that the sext of the load has one user.
So, I've rewritten the sext user replacement code as the previous version was horrible. I've also added some code to reorder the load and address calculations. The way I've figured out the ordering looks bad, but I couldn't find a simple way in the APIs to find this kind of info out.
I've also created a ParallelDSP subdirectory for the tests and moved the smlad stuff into it as well.
|719 ↗||(On Diff #167745)|
Nit: this loop is doing the same things as the previous loop, can we make and call a function?
|730 ↗||(On Diff #167745)|
Nit: looks like this is workaround for not having comparison operators on these iterators. Perhaps we can put this in little helper function too, sweep it under the carpet a little bit, but with a TODO/FIXME and some comments added to it. If a helper function is too much (this function MatchTopBottomMuls is becoming rather big), than at lease some comments here.