• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1; RUN: llc -mtriple=x86_64-apple-darwin -mcpu=corei7                             < %s | FileCheck %s
2; RUN: llc -mtriple=x86_64-apple-darwin -mcpu=corei7 -fast-isel -fast-isel-abort=1 < %s | FileCheck %s --check-prefix=FAST
3
4; Test the webkit_jscc calling convention.
5; One argument will be passed in register, the other will be pushed on the stack.
6; Return value in $rax.
7define void @jscall_patchpoint_codegen(i64 %p1, i64 %p2, i64 %p3, i64 %p4) {
8entry:
9; CHECK-LABEL: jscall_patchpoint_codegen:
10; CHECK:      Ltmp
11; CHECK:      movq %r{{.+}}, (%rsp)
12; CHECK:      movq %r{{.+}}, %rax
13; CHECK:      Ltmp
14; CHECK-NEXT: movabsq $-559038736, %r11
15; CHECK-NEXT: callq *%r11
16; CHECK:      movq %rax, (%rsp)
17; CHECK:      callq
18; FAST-LABEL: jscall_patchpoint_codegen:
19; FAST:       Ltmp
20; FAST:       movq %r{{.+}}, (%rsp)
21; FAST:       movq %r{{.+}}, %rax
22; FAST:       Ltmp
23; FAST-NEXT:  movabsq $-559038736, %r11
24; FAST-NEXT:  callq *%r11
25; FAST:       movq %rax, (%rsp)
26; FAST:       callq
27  %resolveCall2 = inttoptr i64 -559038736 to i8*
28  %result = tail call webkit_jscc i64 (i64, i32, i8*, i32, ...) @llvm.experimental.patchpoint.i64(i64 5, i32 15, i8* %resolveCall2, i32 2, i64 %p4, i64 %p2)
29  %resolveCall3 = inttoptr i64 -559038737 to i8*
30  tail call webkit_jscc void (i64, i32, i8*, i32, ...) @llvm.experimental.patchpoint.void(i64 6, i32 15, i8* %resolveCall3, i32 2, i64 %p4, i64 %result)
31  ret void
32}
33
34; Test if the arguments are properly aligned and that we don't store undef arguments.
35define i64 @jscall_patchpoint_codegen2(i64 %callee) {
36entry:
37; CHECK-LABEL: jscall_patchpoint_codegen2:
38; CHECK:      Ltmp
39; CHECK:      movq $6, 24(%rsp)
40; CHECK-NEXT: movl $4, 16(%rsp)
41; CHECK-NEXT: movq $2, (%rsp)
42; CHECK:      Ltmp
43; CHECK-NEXT: movabsq $-559038736, %r11
44; CHECK-NEXT: callq *%r11
45; FAST-LABEL: jscall_patchpoint_codegen2:
46; FAST:       Ltmp
47; FAST:       movq $2, (%rsp)
48; FAST-NEXT:  movl $4, 16(%rsp)
49; FAST-NEXT:  movq $6, 24(%rsp)
50; FAST:       Ltmp
51; FAST-NEXT:  movabsq $-559038736, %r11
52; FAST-NEXT:  callq *%r11
53  %call = inttoptr i64 -559038736 to i8*
54  %result = call webkit_jscc i64 (i64, i32, i8*, i32, ...) @llvm.experimental.patchpoint.i64(i64 7, i32 15, i8* %call, i32 6, i64 %callee, i64 2, i64 undef, i32 4, i32 undef, i64 6)
55  ret i64 %result
56}
57
58; Test if the arguments are properly aligned and that we don't store undef arguments.
59define i64 @jscall_patchpoint_codegen3(i64 %callee) {
60entry:
61; CHECK-LABEL: jscall_patchpoint_codegen3:
62; CHECK:      Ltmp
63; CHECK:      movq $10, 48(%rsp)
64; CHECK-NEXT: movl  $8, 36(%rsp)
65; CHECK-NEXT: movq  $6, 24(%rsp)
66; CHECK-NEXT: movl  $4, 16(%rsp)
67; CHECK-NEXT: movq  $2, (%rsp)
68; CHECK:      Ltmp
69; CHECK-NEXT: movabsq $-559038736, %r11
70; CHECK-NEXT: callq *%r11
71; FAST-LABEL: jscall_patchpoint_codegen3:
72; FAST:       Ltmp
73; FAST:       movq  $2, (%rsp)
74; FAST-NEXT:  movl  $4, 16(%rsp)
75; FAST-NEXT:  movq  $6, 24(%rsp)
76; FAST-NEXT:  movl  $8, 36(%rsp)
77; FAST-NEXT:  movq $10, 48(%rsp)
78; FAST:       Ltmp
79; FAST-NEXT:  movabsq $-559038736, %r11
80; FAST-NEXT:  callq *%r11
81  %call = inttoptr i64 -559038736 to i8*
82  %result = call webkit_jscc i64 (i64, i32, i8*, i32, ...) @llvm.experimental.patchpoint.i64(i64 7, i32 15, i8* %call, i32 10, i64 %callee, i64 2, i64 undef, i32 4, i32 undef, i64 6, i32 undef, i32 8, i32 undef, i64 10)
83  ret i64 %result
84}
85
86declare void @llvm.experimental.patchpoint.void(i64, i32, i8*, i32, ...)
87declare i64 @llvm.experimental.patchpoint.i64(i64, i32, i8*, i32, ...)
88
89