]> granicus.if.org Git - llvm/commit
Merging r322724:
authorHans Wennborg <hans@hanshq.net>
Thu, 18 Jan 2018 11:16:33 +0000 (11:16 +0000)
committerHans Wennborg <hans@hanshq.net>
Thu, 18 Jan 2018 11:16:33 +0000 (11:16 +0000)
commit6079bf56feb869e1d033bd4c51d8f4cbd31ec25a
tree5fd9348b3d060acf84e8a44a47d2f0648dd7a814
parent071c94c5100559babf54314cb94709be6eb250fd
Merging r322724:
------------------------------------------------------------------------
r322724 | ctopper | 2018-01-17 10:46:01 -0800 (Wed, 17 Jan 2018) | 7 lines

[X86] When legalizing (v64i1 select i8, v64i1, v64i1) make sure not to introduce bitcasts to i64 in 32-bit mode

We legalize selects of masks with scalar conditions using a bitcast to an integer type. But if we are in 32-bit mode we can't convert v64i1 to i64. So instead split the v64i1 to v32i1 and concat it back together. Each half will then be legalized by bitcasting to i32 which is fine.

The test case is a little indirect. If we have the v64i1 select in IR it will get legalized by legalize vector ops which has a run of type legalization after it. That type legalization run is able to fix this i64 bitcast. So in order to avoid that we need a build_vector of a splat which legalize vector ops will ignore. Legalize DAG will then turn that into a select via LowerBUILD_VECTORvXi1. And the select will get legalized. In this case there is no type legalizer run to cleanup the bitcast.

This fixes pr35972.
------------------------------------------------------------------------

git-svn-id: https://llvm.org/svn/llvm-project/llvm/branches/release_60@322835 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Target/X86/X86ISelLowering.cpp
test/CodeGen/X86/pr35972.ll [new file with mode: 0644]