[llvm] [NVPTX] Make i16x2 a native type and add supported vec instructions (PR #65432)

Artem Belevich via llvm-commits llvm-commits at lists.llvm.org
Wed Sep 6 16:01:20 PDT 2023


================
@@ -3300,6 +3328,13 @@ def : Pat<(bf16 (extractelt (v2bf16 Int32Regs:$src), 1)),
 def : Pat<(v2bf16 (build_vector (bf16 Int16Regs:$a), (bf16 Int16Regs:$b))),
           (V2I16toI32 Int16Regs:$a, Int16Regs:$b)>;
 
+def : Pat<(i16 (extractelt (v2i16 Int32Regs:$src), 0)),
----------------
Artem-B wrote:

At the moment it's a bit cumbersome. You iterate with `foreach foo =  [a,b,c,d] ` over a scalar value. Could be a string with the register type.
Then create an instance of a helper class specialized by it, and which will have fields populated with the values you will need. Somewhat extreme example is WMMA_REGS in llvm/include/llvm/IR/IntrinsicsNVVM.td

We have a pending patch which will add lambdas and functions to tablegen which would make all of this easier, but for now it's awkward. If it turns out to be too much hassle, just place f16/bf16/i16 extractelt/build_vector next to each other, so it's easy to see that they are repeated.

https://github.com/llvm/llvm-project/pull/65432


More information about the llvm-commits mailing list