This is an archive of the discontinued LLVM Phabricator instance.

[X86][SSE] Split large PAVGB/PAVGW vectors to legal widths
ClosedPublic

Authored by RKSimon on Dec 20 2017, 6:13 AM.

Details

Summary

Patch to allow detectAVGPattern handle vectors larger than the legal size (128 SSE2, 256 AVX2, 512 AVX512BW), splitting the vectors accordingly.

Diff Detail

Repository
rL LLVM

Event Timeline

RKSimon created this revision.Dec 20 2017, 6:13 AM

What happens with types that are multiple of 128 bits,

lib/Target/X86/X86ISelLowering.cpp
33862 ↗(On Diff #127698)

Isn't the modulo guaranteed true by the isPowerOf2_32(NumElems) check above? And if it wasn't it would mean we would do something different for a 384-bit vector with only SSE2(since its divisible by 128) than we would for AVX2(since its not divisible by 256)

RKSimon updated this revision to Diff 127869.Dec 21 2017, 5:54 AM

Don't bother checking for whole vector sizes - the isPowerOf2_32 test will handle it.

@craig.topper I added a v48i8 test at rL321261 - do you think its worth me generalizing this further to support irregular sized vectors like that?

craig.topper accepted this revision.Dec 21 2017, 10:01 AM

I'm fine not supporting irregular vectors.

LGTM

This revision is now accepted and ready to land.Dec 21 2017, 10:01 AM
This revision was automatically updated to reflect the committed changes.
llvm/trunk/test/CodeGen/X86/avg-mask.ll