[PATCH] D41560: [X86] Make v2i1 and v4i1 legal types without VLX

Craig Topper via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Dec 24 01:01:19 PST 2017


craig.topper created this revision.
craig.topper added reviewers: RKSimon, zvi, guyblank.

There are few oddities that occur due to v1i1, v8i1, v16i1 being legal without v2i1 and v4i1 being legal when we don't have VLX. Particularly during legalization of v2i32/v4i32/v2i64/v4i64 masked gather/scatter/load/store. We end up promoting the mask argument to these during type legalization and then have to widen the promoted type to v8iX/v16iX and truncate it to get the element size back down to v8i1/v16i1 to use a 512-bit operation. Since need to fill the upper bits of the mask we have to fill with 0s at the promoted type.

It would be better if we could just have the v2i1/v4i1 types as legal so they don't undergo any promotion. Then we can just widen with 0s directly in a k register. There are no real v4i1/v2i1 instructions anyway. Everything is done on a larger register anyway.

This also fixes an issue that we couldn't implement a masked vextractf32x4 from zmm to xmm properly.

We now have to support widening more compares to 512-bit to get a mask result out so new tablegen patterns got added.

I had to hack the legalizer for widening the operand of a setcc a bit so it didn't try create a setcc returning v4i32, extract from it, then try to promote it using a sign extend to v2i1. Now we create the setcc with v4i1 if the original setcc's result type is v2i1. Then extract that and don't sign extend it at all.

There's definitely room for improvement with some follow up patches.


https://reviews.llvm.org/D41560

Files:
  lib/CodeGen/SelectionDAG/LegalizeVectorTypes.cpp
  lib/Target/X86/X86ISelDAGToDAG.cpp
  lib/Target/X86/X86ISelLowering.cpp
  lib/Target/X86/X86InstrAVX512.td
  lib/Target/X86/X86InstrVecCompiler.td
  test/Analysis/CostModel/X86/cast.ll
  test/CodeGen/X86/avx512-calling-conv.ll
  test/CodeGen/X86/avx512-cvt.ll
  test/CodeGen/X86/avx512-ext.ll
  test/CodeGen/X86/avx512-insert-extract.ll
  test/CodeGen/X86/avx512-intrinsics-upgrade.ll
  test/CodeGen/X86/avx512-intrinsics.ll
  test/CodeGen/X86/avx512-mask-op.ll
  test/CodeGen/X86/avx512-vec-cmp.ll
  test/CodeGen/X86/avx512dq-intrinsics-upgrade.ll
  test/CodeGen/X86/avx512dq-intrinsics.ll
  test/CodeGen/X86/avx512vl-vec-cmp.ll
  test/CodeGen/X86/avx512vl-vec-masked-cmp.ll
  test/CodeGen/X86/compress_expand.ll
  test/CodeGen/X86/gpr-to-mask.ll
  test/CodeGen/X86/masked_gather_scatter.ll
  test/CodeGen/X86/masked_memop.ll
  test/CodeGen/X86/pr33349.ll
  test/CodeGen/X86/sse-fsignum.ll
  test/CodeGen/X86/vector-shuffle-v1.ll
  test/CodeGen/X86/vselect-pcmp.ll





More information about the llvm-commits mailing list