• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1; When we accept small parameters on Windows, make sure we do not assume they
2; are zero or sign extended in memory or in registers.
3
4; RUN: llc < %s -mtriple=x86_64-windows-msvc | FileCheck %s --check-prefix=WIN64
5; RUN: llc < %s -mtriple=x86_64-windows-gnu | FileCheck %s --check-prefix=WIN64
6; RUN: llc < %s -mtriple=i686-windows-msvc | FileCheck %s --check-prefix=WIN32
7; RUN: llc < %s -mtriple=i686-windows-gnu | FileCheck %s --check-prefix=WIN32
8
9define void @call() {
10entry:
11  %rv = call i32 @manyargs(i8 1, i16 2, i8 3, i16 4, i8 5, i16 6)
12  ret void
13}
14
15define i32 @manyargs(i8 %a, i16 %b, i8 %c, i16 %d, i8 %e, i16 %f) {
16entry:
17  %aa = sext i8 %a to i32
18  %bb = sext i16 %b to i32
19  %cc = zext i8 %c to i32
20  %dd = zext i16 %d to i32
21  %ee = zext i8 %e to i32
22  %ff = zext i16 %f to i32
23  %t0 = add i32 %aa, %bb
24  %t1 = add i32 %t0, %cc
25  %t2 = add i32 %t1, %dd
26  %t3 = add i32 %t2, %ee
27  %t4 = add i32 %t3, %ff
28  ret i32 %t4
29}
30
31; WIN64-LABEL: call:
32; WIN64-DAG: movw $6, 40(%rsp)
33; WIN64-DAG: movb $5, 32(%rsp)
34; WIN64-DAG: movb $1, %cl
35; WIN64-DAG: movw $2, %dx
36; WIN64-DAG: movb $3, %r8b
37; WIN64-DAG: movw $4, %r9w
38; WIN64: callq manyargs
39
40; WIN64-LABEL: manyargs:
41; WIN64-DAG: movsbl %cl,
42; WIN64-DAG: movswl %dx,
43; WIN64-DAG: movzbl %r8b,
44; WIN64-DAG: movzwl %r9w,
45; WIN64-DAG: movzbl 40(%rsp),
46; WIN64-DAG: movzwl 48(%rsp),
47; WIN64: retq
48
49
50; WIN32-LABEL: _call:
51; WIN32: pushl $6
52; WIN32: pushl $5
53; WIN32: pushl $4
54; WIN32: pushl $3
55; WIN32: pushl $2
56; WIN32: pushl $1
57; WIN32: calll _manyargs
58
59; WIN32-LABEL: _manyargs:
60; WIN32: pushl %ebx
61; WIN32: pushl %edi
62; WIN32: pushl %esi
63; WIN32-DAG: movsbl 16(%esp),
64; WIN32-DAG: movswl 20(%esp),
65; WIN32-DAG: movzbl 24(%esp),
66; WIN32-DAG: movzwl 28(%esp),
67; WIN32-DAG: movzbl 32(%esp),
68; WIN32-DAG: movzwl 36(%esp),
69; WIN32: retl
70
71