This is an archive of the discontinued LLVM Phabricator instance.

[x86] fix horizontal binop matching for 256-bit vectors (PR40243)
ClosedPublic

Authored by spatel on Jan 8 2019, 12:54 PM.

Details

Summary

This is a partial fix for:
https://bugs.llvm.org/show_bug.cgi?id=40243
...as seen in the integer test, we still need to correct the result when using the existing (old) horizontal op matching function because it does not model the way x86 256-bit horizontal ops return results (each 128-bit half is its own horizontal-op). A potential follow-up change for that is discussed in the bug report.

This generally duplicates a lot of the existing matching code, but we can't just remove that without introducing regressions, so the existing code is renamed and used less often. I'm hoping to get some kind of fix for the miscompile bug in before the release.

I have a follow-up patch that addresses the 'TODO' comment about allowing non-matching vector sizes between the extracts and build vector.

Diff Detail

Repository
rL LLVM

Event Timeline

spatel created this revision.Jan 8 2019, 12:54 PM
spatel marked an inline comment as done.Jan 8 2019, 1:40 PM
spatel added inline comments.
lib/Target/X86/X86ISelLowering.cpp
7925 ↗(On Diff #180720)

In case it's not clear (it took me a long time to spot this), this is the logic difference in the new matcher (along with nested loops). See line 8268 in this patch.

andreadb accepted this revision.Jan 9 2019, 8:40 AM

Looks good to me.

This revision is now accepted and ready to land.Jan 9 2019, 8:40 AM
This revision was automatically updated to reflect the committed changes.