This is an archive of the discontinued LLVM Phabricator instance.

[TargetLowering] Add vector BITCAST support to SimplifyDemandedVectorElts
ClosedPublic

Authored by RKSimon on Feb 23 2018, 5:32 AM.

Diff Detail

Repository
rL LLVM

Event Timeline

RKSimon created this revision.Feb 23 2018, 5:32 AM
spatel added inline comments.Mar 6 2018, 10:05 AM
lib/CodeGen/SelectionDAG/TargetLowering.cpp
1359 ↗(On Diff #135629)

rename to SrcDemandedElts?

1361–1362 ↗(On Diff #135629)

I think this would read more clearly as:
"Bitcast large element source vector to small element vector."
because that matches how it would be written in LLVM:
bitcast <4 x i32> to <16 x i8>
and:
"We demand any larger source element if any smaller demanded element of this vector maps to it."

1385–1386 ↗(On Diff #135629)

Similar to above:
"Bitcast small element source vector to large element vector (eg, bitcast <16 x i8> to <4 x i32>). We demand all smaller source elements covered by the larger demanded element of this vector."

1398 ↗(On Diff #135629)

if -> it

test/CodeGen/X86/vector-shuffle-256-v16.ll
4606–4609 ↗(On Diff #135629)

I haven't looked at this in a while, so not sure what's happening here, but this should just be:
vbroadcastss (%rdi), %ymm0 ?

RKSimon added inline comments.Mar 6 2018, 10:49 AM
test/CodeGen/X86/vector-shuffle-256-v16.ll
4606–4609 ↗(On Diff #135629)

Its only broadcasting the lower i16 of the i32, so no unfortunately - in fact I think the test was added to make sure we don't do this.

RKSimon updated this revision to Diff 137234.Mar 6 2018, 10:50 AM

Address Sanjay's comments

spatel accepted this revision.Mar 6 2018, 11:31 AM

LGTM.

test/CodeGen/X86/vector-shuffle-256-v16.ll
4606–4609 ↗(On Diff #135629)

Oops, I should've noticed that from the AVX2 code.

This revision is now accepted and ready to land.Mar 6 2018, 11:31 AM
This revision was automatically updated to reflect the committed changes.