[PATCH] D27392: Vectorcall Calling Convention - Adding CodeGen Complete Support

Reid Kleckner via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Dec 8 11:07:20 PST 2016


rnk added inline comments.


================
Comment at: lib/Target/X86/X86CallingConv.cpp:65
+                                           X86::ZMM3, X86::ZMM4, X86::ZMM5};
+    return makeArrayRef(std::begin(RegListZMM), std::end(RegListZMM));
+  }
----------------
ArrayRefs are implicitly constructable from C arrays. You should be able to just return RegListZMM here and throughout this file. If not, makeArrayRef takes C arrays and will do the right thing.


================
Comment at: lib/Target/X86/X86CallingConv.cpp:130
+  // "A vector type is either a floating-point type庸or example,
+  //  a float or double熔r an SIMD vector type庸or example, __m128 or __m256."
+  if (!ValVT.isFloatingPoint() &&
----------------
mojibake


================
Comment at: lib/Target/X86/X86CallingConv.td:631
-
-  // 256-bit vectors use YMM registers.
-  CCIfType<[v32i8, v16i16, v8i32, v4i64, v8f32, v4f64],
----------------
Ouch. I locally confirmed this is correct, but why design a new calling convention that doesn't handle the latest vector types... =P


================
Comment at: test/CodeGen/X86/vectorcall.ll:75
 ; CHECK-LABEL: {{^}}test_vec_2@@104:
-; CHECK: movaps (%{{[re]}}cx), %xmm0
+; CHECK: movaps {{[0-9]*}}(%{{[re](bp|ax|cx)}}), %xmm0
+
----------------
This was testing that %r is passed indirectly. I'm guessing the rules are that %r is passed by pointer on 32-bit because the stack is unaligned and that %r is passed directly on x64 where the stack is aligned enough to do so. I'd split out separate checks for X86 and X64 in that case.


================
Comment at: test/CodeGen/X86/vectorcall.ll:75
 ; CHECK-LABEL: {{^}}test_vec_2@@104:
-; CHECK: movaps (%{{[re]}}cx), %xmm0
+; CHECK: movaps {{[0-9]*}}(%{{[re](bp|ax|cx)}}), %xmm0
+
----------------
ignore the comment above, I can't seem to delete it from phab. :(


================
Comment at: test/CodeGen/X86/vectorcall.ll:75
 ; CHECK-LABEL: {{^}}test_vec_2@@104:
-; CHECK: movaps (%{{[re]}}cx), %xmm0
+; CHECK: movaps {{[0-9]*}}(%{{[re](bp|ax|cx)}}), %xmm0
+
----------------
This was testing that %r is passed indirectly in the first integer register parameter, but I guess that's incorrect because of the way __vectorcall pins arguments to registers based on their exact argument position. We should check for the load off the stack to capture the correct behavior. Something like this:
  mov{{[l|q}} {{[0-9]+}}(%rsp), %[[r_reg:[^ ]*]]
  movaps %[[r_reg]], %xmm0


Repository:
  rL LLVM

https://reviews.llvm.org/D27392





More information about the llvm-commits mailing list