[PATCH] D44876: [X86] Assign i8/i16 to the stack for Win64 as well.

Martin Storsjö via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sat Mar 24 16:05:26 PDT 2018


mstorsjo created this revision.
mstorsjo added reviewers: rnk, craig.topper.

This makes sure that a i8/i16 parameter after the 4th parameter gets assigned to the stack, instead of continuing matching in the generic CC_X86_64_C, after SVN r328386. (After that change, such a param would end up assigned to EDI.)


Repository:
  rL LLVM

https://reviews.llvm.org/D44876

Files:
  lib/Target/X86/X86CallingConv.td
  test/CodeGen/X86/win64-smallparams.ll


Index: test/CodeGen/X86/win64-smallparams.ll
===================================================================
--- /dev/null
+++ test/CodeGen/X86/win64-smallparams.ll
@@ -0,0 +1,19 @@
+; RUN: llc < %s -mtriple=x86_64-windows-msvc | FileCheck %s --check-prefix=CHECK
+; RUN: llc < %s -mtriple=x86_64-windows-gnu | FileCheck %s --check-prefix=CHECK
+
+define dso_local void @call() {
+entry:
+  tail call void @manyargs(i8 1, i16 2, i8 3, i16 4, i8 5, i16 6)
+  ret void
+}
+
+declare dso_local void @manyargs(i8, i16, i8, i16, i8, i16)
+
+; CHECK-LABEL: call:
+; CHECK-DAG: movw $6, 40(%rsp)
+; CHECK-DAG: movb $5, 32(%rsp)
+; CHECK-DAG: movb $1, %cl
+; CHECK-DAG: movw $2, %dx
+; CHECK-DAG: movb $3, %r8b
+; CHECK-DAG: movw $4, %r9w
+; CHECK: callq manyargs
Index: lib/Target/X86/X86CallingConv.td
===================================================================
--- lib/Target/X86/X86CallingConv.td
+++ lib/Target/X86/X86CallingConv.td
@@ -642,7 +642,7 @@
 
   // Integer/FP values get stored in stack slots that are 8 bytes in size and
   // 8-byte aligned if there are no more registers to hold them.
-  CCIfType<[i32, i64, f32, f64], CCAssignToStack<8, 8>>
+  CCIfType<[i8, i16, i32, i64, f32, f64], CCAssignToStack<8, 8>>
 ]>;
 
 def CC_X86_Win64_VectorCall : CallingConv<[


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D44876.139729.patch
Type: text/x-patch
Size: 1284 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180324/cef8bcb6/attachment.bin>


More information about the llvm-commits mailing list