[PATCH] D68203: Add support for (expressing) vscale.

Sjoerd Meijer via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jan 8 06:16:59 PST 2020


SjoerdMeijer added inline comments.


================
Comment at: llvm/docs/LangRef.rst:17751
+
+``vscale`` is a positive value that is constant throughout the program
+but is unknown at compile time. The ``scaling`` immediate can be used
----------------
nit: perhaps "throughout the program" -> "throughout the program execution"?


================
Comment at: llvm/docs/LangRef.rst:17753
+but is unknown at compile time. The ``scaling`` immediate can be used
+for convenience and is multiplied at runtime with ``vscale``.
+
----------------
nit: perhaps just omit "for convenience"?


================
Comment at: llvm/docs/LangRef.rst:17769
 
+
 .. _int_memcpy_element_unordered_atomic:
----------------
nit: unrelated change, don't need this newline?


================
Comment at: llvm/include/llvm/CodeGen/ISDOpcodes.h:919
+    /// VSCALE(IMM) - Returns the runtime scaling factor used to calculate the
+    /// number of elements within a scalable vector.  IMM is a constant integer
+    /// multiplier that is applied to the runtime value and is usually some
----------------
nit: extra whitespace before IMM


================
Comment at: llvm/include/llvm/CodeGen/ISDOpcodes.h:920
+    /// number of elements within a scalable vector.  IMM is a constant integer
+    /// multiplier that is applied to the runtime value and is usually some
+    /// multiple of MVT.getVectorNumElements().
----------------
Just curious, what do you mean by "usually", i.e. if it is not getVectorNumElements(), what else can it be?


================
Comment at: llvm/test/CodeGen/AArch64/sve-vscale.ll:20
+; CHECK-NEXT:  ret
+define i32 @rdvl_arg() nounwind {
+  %vscale = call i32 @llvm.vscale(i32 16)
----------------
I don't think I understand this and test case above (haven't looked at the other yet). Essentially I don't understand why we remove the mul with 16.... which we are optimsing away? Is this correct? Where does this constant 16 comes from and what is the meaning of it? It could be I don't understand the RDVL instruction, or the vscale intrinsic definition. Can you explain this?


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D68203/new/

https://reviews.llvm.org/D68203





More information about the llvm-commits mailing list