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
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.
7 define void @jscall_patchpoint_codegen(i64 %p1, i64 %p2, i64 %p3, i64 %p4) {
9 ; CHECK-LABEL: jscall_patchpoint_codegen:
11 ; CHECK: movq %r{{.+}}, (%rsp)
12 ; CHECK: movq %r{{.+}}, %rax
14 ; CHECK-NEXT: movabsq $-559038736, %r11
15 ; CHECK-NEXT: callq *%r11
16 ; CHECK: movq %rax, (%rsp)
18 ; FAST-LABEL: jscall_patchpoint_codegen:
20 ; FAST: movq %r{{.+}}, (%rsp)
21 ; FAST: movq %r{{.+}}, %rax
23 ; FAST-NEXT: movabsq $-559038736, %r11
24 ; FAST-NEXT: callq *%r11
25 ; FAST: movq %rax, (%rsp)
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)
34 ; Test if the arguments are properly aligned and that we don't store undef arguments.
35 define i64 @jscall_patchpoint_codegen2(i64 %callee) {
37 ; CHECK-LABEL: jscall_patchpoint_codegen2:
39 ; CHECK: movq $6, 24(%rsp)
40 ; CHECK-NEXT: movl $4, 16(%rsp)
41 ; CHECK-NEXT: movq $2, (%rsp)
43 ; CHECK-NEXT: movabsq $-559038736, %r11
44 ; CHECK-NEXT: callq *%r11
45 ; FAST-LABEL: jscall_patchpoint_codegen2:
47 ; FAST: movq $2, (%rsp)
48 ; FAST-NEXT: movl $4, 16(%rsp)
49 ; FAST-NEXT: movq $6, 24(%rsp)
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)
58 ; Test if the arguments are properly aligned and that we don't store undef arguments.
59 define i64 @jscall_patchpoint_codegen3(i64 %callee) {
61 ; CHECK-LABEL: jscall_patchpoint_codegen3:
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)
69 ; CHECK-NEXT: movabsq $-559038736, %r11
70 ; CHECK-NEXT: callq *%r11
71 ; FAST-LABEL: jscall_patchpoint_codegen3:
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)
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)
86 declare void @llvm.experimental.patchpoint.void(i64, i32, i8*, i32, ...)
87 declare i64 @llvm.experimental.patchpoint.i64(i64, i32, i8*, i32, ...)