HomePhabricator

[X86] Override BuildSDIVPow2 for X86.

Authored by craig.topper on Sep 5 2019, 11:15 AM.

Description

[X86] Override BuildSDIVPow2 for X86.

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.

Differential Revision: https://reviews.llvm.org/D67087

llvm-svn: 371104

Details

Committed
craig.topperSep 5 2019, 11:15 AM
Differential Revision
D67087: [X86] Override BuildSDIVPow2 for X86.
Parents
rG00e04b0a6d51: [Support] Add writeFileAtomically() to FileUtilities
Branches
Unknown
Tags
Unknown