This is an archive of the discontinued LLVM Phabricator instance.

adding pattern for broadcastm
ClosedPublic

Authored by jina.nahias on Sep 27 2017, 4:11 AM.

Diff Detail

Event Timeline

jina.nahias created this revision.Sep 27 2017, 4:11 AM
jina.nahias retitled this revision from addung pattern for broadcastm to adding pattern for broadcastm.
RKSimon edited edge metadata.Sep 27 2017, 5:25 AM

Please remember to create your diff with context: http://llvm.org/docs/Phabricator.html

test/CodeGen/X86/broadcastm-lowering.ll
3

Please don't use -mcpu, use -mattr instead. Something like:

; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mcpu=+avx512f | FileCheck %s --check-prefix=ALL --check-prefix=AVX512F
; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mattr=+avx512vl,+avx512dq  | FileCheck %s --check-prefix=ALL --check-prefix=AVX512DQVL

Also, should i686 triples be tested as well? Not sure if any non-legal i64 issues will arise

zvi edited edge metadata.Sep 27 2017, 5:38 AM

The title should have an X86 label, and can you please add a cover message in the summary?

lib/Target/X86/X86ISelLowering.cpp
6695

Would isSplatZeroExtended be a better name?
(const BuildVectorSDNode *Op, unsigned &NumElts, MVT& EltType)

6749

Please add a comment explaining the change here and in the Summary. Maybe something like:
t0 = (zext_i64 (bitcast_i8 v2i1 X))
t1 = (build_vector t0 t0)
->
(VBROADCASTM v2i1 X)

6749

Checking

zvi added inline comments.Sep 27 2017, 5:46 AM
test/CodeGen/X86/broadcastm-lowering.ll
2

instead of -mcpu=skx , you should use -mattr which is more robust to scheduling changes:
-mattr=+avx512cd,+avx512vl

and similarly for knl:
-mattr=+avx512cd

zvi added inline comments.Sep 27 2017, 5:47 AM
test/CodeGen/X86/broadcastm-lowering.ll
3

Simon has already mentioned this

craig.topper added inline comments.Sep 27 2017, 11:56 PM
lib/Target/X86/X86ISelLowering.cpp
6606

vedtor->vector

Also the first word of each sentence in the comment should be capitalized.

6629

I think this line should be indented 2 additional spaces?

6636

Am I missing something or is this variable and several above it dead?

6671

Use is512BitVector here.

6678

Does this overflow 80 columns?

jina.nahias added inline comments.Sep 28 2017, 12:30 AM
lib/Target/X86/X86ISelLowering.cpp
6636

those variables are sending as reference to this function.

RKSimon added inline comments.Sep 29 2017, 3:01 AM
test/CodeGen/X86/broadcastm-lowering.ll
3

Please can you tidy the prefixes: AVX512CD, AVX512VLCDBW and X86-AVX512VLCDBW would be more closely match convention.

Thanks please can you now commit broadcastm-lowering.ll with trunk's current codegen so that this patch shows the codegen diff?

This revision was automatically updated to reflect the committed changes.
RKSimon reopened this revision.Oct 1 2017, 8:12 AM

A few minor comments

lib/Target/X86/X86ISelLowering.cpp
6608

Describe the function NumElt and EltType, also I'm not convinced that 'isSplatZeroExtended' is suitably descriptive of what the function is actually doing.

6611
unsigned NumElts = Op->getNumOperands();
unsigned Delta = NumElts;
6613

Comment describing the search you're doing in the loop

for (unsigned i = 1; i < NumElts; i++) {
6624

Comment the loop

for (unsigned i = Delta; i < NumElts; i++) {
6633

Op->getSimpleValueType(0).getScalaraSizeInBits()

jina.nahias added inline comments.Oct 2 2017, 11:33 PM
lib/Target/X86/X86ISelLowering.cpp
6608

i could not find a better name. do you have one?

jina.nahias marked 10 inline comments as done.Oct 7 2017, 11:40 PM

I have fixed all comments.
ping.

m_zuckerman added inline comments.Oct 24 2017, 9:56 AM
lib/Target/X86/X86ISelLowering.cpp
6605

Please, add example of the pattern that you are looking for

6639

Use NumElts /Delta

6673

Why do you set the NumElt to one?
I prefer
unsigned NumElts =BVOp->getNumOperands()
and if it equal to one exit the function (early exiting)

m_zuckerman added inline comments.Oct 30 2017, 1:16 AM
lib/Target/X86/X86ISelLowering.cpp
6674

if(NumElts!=1&&SDValue ZeroExtended = isSplatZeroExtended(BVOp, NumElts, EltType))

m_zuckerman added inline comments.Oct 30 2017, 1:42 AM
lib/Target/X86/X86ISelLowering.cpp
6674

sorry without NumElts!=1

This revision is now accepted and ready to land.Oct 30 2017, 2:21 AM
This revision was automatically updated to reflect the committed changes.

committed in r316921