[PATCH] D67087: [X86] Override BuildSDIVPow2 for X86.

Craig Topper via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Sep 2 16:00:21 PDT 2019


craig.topper created this revision.
craig.topper added reviewers: RKSimon, spatel, lebedev.ri, xbolva00.
Herald added subscribers: hiraditya, kristof.beyls, javed.absar.
Herald added a project: LLVM.

As noted in PR43197, we can use test+add+cmov+sra to implement
signed division by a power of 2.

This is based off the similar version in AArch64, but I've
adjusted it to use target independent nodes where AArch64 uses
target specific CMP and CSEL nodes. I've also blocked INT_MIN
as the transform isn't valid for that.

I've limited this to i32 and i64 on 64-bit targets for now and only
when CMOV is supported. i8 and i16 need further investigation to be
sure they get promoted to i32 well.

I adjusted a few tests to enable cmov to demonstrate the new
codegen. I also changed twoaddr-coalesce-3.ll to 32-bit mode
without cmov to avoid perturbing the scenario that is being
set up there.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D67087

Files:
  llvm/lib/Target/X86/X86ISelLowering.cpp
  llvm/lib/Target/X86/X86ISelLowering.h
  llvm/test/CodeGen/X86/pr32588.ll
  llvm/test/CodeGen/X86/rem.ll
  llvm/test/CodeGen/X86/srem-seteq.ll
  llvm/test/CodeGen/X86/twoaddr-coalesce-3.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D67087.218396.patch
Type: text/x-patch
Size: 6363 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190902/9d923ebe/attachment.bin>


More information about the llvm-commits mailing list