Page MenuHomePhabricator

[X86] Generate testl instruction through truncates.
ClosedPublic

Authored by deadalnix on Jan 31 2018, 8:23 AM.

Details

Summary

This was introduced in D42646 but ended up being reverted because the original implementation was buggy.

Depends on D42646

Diff Detail

Repository
rL LLVM

Event Timeline

deadalnix created this revision.Jan 31 2018, 8:23 AM

This looks good modulo test cases.

@niravd I added a test case in rL323868 . The problem was by trying to extract the lower 32 bits of a 16 bit register, which is obviously not possible.

lib/Target/X86/X86ISelDAGToDAG.cpp
3049 ↗(On Diff #132179)

The problem doesn't happen with i8 because it is checked here.

3074 ↗(On Diff #132179)

We check more i16 here to avoid running into the same problem we did before.

niravd accepted this revision.Jan 31 2018, 9:45 AM

LGTM modulo comment nit.

lib/Target/X86/X86ISelDAGToDAG.cpp
3074 ↗(On Diff #132179)

The i16 comparision took me a moment to understand. Can you leave a comment here explaining that N0 must be of size at least i32?

This revision is now accepted and ready to land.Jan 31 2018, 9:45 AM

Add a comment to explain the check for MVT::i16 .

This revision was automatically updated to reflect the committed changes.