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

Demikhovsky, Elena elena.demikhovsky at intel.com
Mon Aug 18 00:31:01 PDT 2014


Hi Adam,

Some things that I see:

1) I suggest to rename EltNum to NumOfElts

2)
+  // Corresponding write-mask register class.
+  RegisterClass KRC = !cast<RegisterClass>("VK" # EltNum # "WM");
+
+  // The GPR register class that can hold the write mask.
+  RegisterClass MRC = !cast<RegisterClass>("GR" # EltNum);

VK2 is possible, GR2 is not. 

2) I don't think that default rc is good. Let everybody specify register class explicitly.
+class X86VectorVTInfo<int EltNum, ValueType EltVT, RegisterClass rc = VR512,
+                      string suffix = ""> {

3) Let's assume that I'm building
def v16f32_info :  X86VectorVTInfo<16, f32, VR512, "ps">
how FloatVT will look like?
Do we need IntVT for completeness?

4) I suggest to add broadcast string {1toX} to the info.



-  Elena


-----Original Message-----
From: Adam Nemet [mailto:anemet at apple.com] 
Sent: Monday, August 18, 2014 09:17
To: Demikhovsky, Elena; Khasanov, Robert
Cc: llvm-commits
Subject: [PATCH][AVX512] Add class to group common template arguments related to vector type

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

---------------------------------------------------------------------
Intel Israel (74) Limited

This e-mail and any attachments may contain confidential material for
the sole use of the intended recipient(s). Any review or distribution
by others is strictly prohibited. If you are not the intended
recipient, please contact the sender and delete all copies.





More information about the llvm-commits mailing list