[PATCH] D50222: [CodeGen] [SelectionDAG] More efficient code for X % C == 0 (UREM case)

Dmytro Shynkevych via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Sep 10 21:34:43 PDT 2018


hermord updated this revision to Diff 164794.
hermord added a comment.

Apologies again for the delay.

- Made cosmetic changes as directed by @lebedev.ri and added vector tests.
- Disabled the fold for vector divisors with even values (see inline comment and `test_urem_even_vec_i16`).

Nonsplat divisors, nonzero C2 and possibly target customization (something like `bool shouldBuildUREMEqFold(SDValue Divisor, SDValue CompTarget, bool isSREM, const DAGCombinerInfo &DCI)`?) will be in separate patches.

The splat tests are only partly the same as the scalar ones because bit30/bit31 is not handled any differently in vectors and so is redundant; on the other hand, testing the `<4 x i16>` case turned out to be valuable (identified the ROTR-induced crash descibed in inline comment).


Repository:
  rL LLVM

https://reviews.llvm.org/D50222

Files:
  include/llvm/CodeGen/TargetLowering.h
  lib/CodeGen/SelectionDAG/TargetLowering.cpp
  test/CodeGen/AArch64/urem-seteq-optsize.ll
  test/CodeGen/AArch64/urem-seteq-vec-nonsplat.ll
  test/CodeGen/AArch64/urem-seteq-vec-splat.ll
  test/CodeGen/AArch64/urem-seteq.ll
  test/CodeGen/X86/jump_sign.ll
  test/CodeGen/X86/urem-seteq-optsize.ll
  test/CodeGen/X86/urem-seteq-vec-nonsplat.ll
  test/CodeGen/X86/urem-seteq-vec-splat.ll
  test/CodeGen/X86/urem-seteq.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D50222.164794.patch
Type: text/x-patch
Size: 58138 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180911/d69dc3b8/attachment.bin>


More information about the llvm-commits mailing list