This is an archive of the discontinued LLVM Phabricator instance.

[X86] Promote 16-bit cmovs to 32-bits
ClosedPublic

Authored by craig.topper on Feb 14 2018, 6:52 PM.

Details

Summary

This allows us to avoid an opsize prefix. And forcing some move immediates to i32 avoid a length changing prefix on those instructions.

This mostly replaces the existing combine we had for zext/sext+cmov of constants. I left in a case for sign extending a 32 bit cmov of constants to 64 bits.

Diff Detail

Repository
rL LLVM

Event Timeline

Just create the cmovs as i32 when they are created. Add a DAG combine for sign_extend_reg to avoid regressing the tests in cmov_promotion.ll

My previous approach was trying to follow closer to how and/or/xor/etc. are promoted, but I don't know that we need to follow that. This patch gets rid of the 16-bit cmovs and doesn't regress any of our tests. That's probably a good enough starting point.

RKSimon added inline comments.Feb 18 2018, 11:38 AM
lib/Target/X86/X86ISelLowering.cpp
35946 ↗(On Diff #134781)

CMovOp1

Fix typo spotted by Simon

RKSimon accepted this revision.Feb 20 2018, 5:09 AM

LGTM

test/CodeGen/X86/select.ll
942 ↗(On Diff #134845)

Those repeated 32-bit immediates are annoying.

This revision is now accepted and ready to land.Feb 20 2018, 5:09 AM
This revision was automatically updated to reflect the committed changes.