[PATCH][AVX512] Add class to group common template arguments related to vector type

Adam Nemet anemet at apple.com
Sun Aug 17 23:16:49 PDT 2014


Hi,

We discussed the issue of generality vs. readability of the AVX512 classes
recently.  I proposed this approach to try to hide and centralize the mappings
we commonly perform based on the vector type.  A new class X86VectorVTInfo
captures these.

The idea is to pass an instance of this class to classes/multiclasses instead
of the corresponding ValueType.  Then the class/multiclass can use its field
for things that derive from the type rather than passing all those as separate
arguments.

I modified avx512_valign to demonstrate this new approach.  As you can see
instead of 7 related template parameters we now have one.  The downside is
that we have to refer to fields for the derived values.  I named the argument
'_' in order to make this as invisible as possible.  Please let me know if you
absolutely hate this.  (Also once we allow local initializations in
multiclasses we can recover the original version by assigning the fields to
local variables.)

Another possible use-case for this class is to directly map things, e.g.:

  RegisterClass KRC = X86VectorVTInfo<32, i16>.KRC

Please let me know if it looks good.

Adam

-------------- next part --------------
A non-text attachment was scrubbed...
Name: AVX512-Add-class-to-group-common-template-arguments-.patch
Type: application/octet-stream
Size: 4724 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20140818/7a829bd4/attachment.obj>


More information about the llvm-commits mailing list