This should fix:
https://llvm.org/bugs/show_bug.cgi?id=30433
Details
Diff Detail
Event Timeline
LGTM.
Note that since sign-mask and mag-mask are complementary, we could avoid one constant-pool load with ANDNPS.
Thanks, Zvi. I thought about that, but this is a general problem: AFAIK, we just don't have very good constant combining/hoisting logic in the backend. I noticed this recently in:
https://llvm.org/bugs/show_bug.cgi?id=28672#c3
Also, see:
https://llvm.org/bugs/show_bug.cgi?id=25554
https://llvm.org/bugs/show_bug.cgi?id=24448
https://llvm.org/bugs/show_bug.cgi?id=27202
It seems like constant combining at the machine level could be its own pass, so we shouldn't have to special-case situations like this one.
Patch updated:
Simon added cost model and SLP vectorizer tests that are affected by the new legalization parameters. I scanned those diffs, and they all look like improvements, but some adjustments may be warranted to fine-tune the cost model.
...and closing based on commit r283119:
http://llvm.org/viewvc/llvm-project?rev=283119&view=rev