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:
10 ; CHECK: movq %r{{.+}}, (%rsp)
11 ; CHECK: movq %r{{.+}}, %rax
13 ; CHECK-NEXT: movabsq $-559038736, %r11
14 ; CHECK-NEXT: callq *%r11
15 ; CHECK: movq %rax, (%rsp)
17 ; FAST-LABEL: jscall_patchpoint_codegen:
18 ; FAST: movq %r{{.+}}, (%rsp)
19 ; FAST: movq %r{{.+}}, %rax
21 ; FAST-NEXT: movabsq $-559038736, %r11
22 ; FAST-NEXT: callq *%r11
23 ; FAST: movq %rax, (%rsp)
25 %resolveCall2 = inttoptr i64 -559038736 to i8*
26 %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)
27 %resolveCall3 = inttoptr i64 -559038737 to i8*
28 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)
32 ; Test if the arguments are properly aligned and that we don't store undef arguments.
33 define i64 @jscall_patchpoint_codegen2(i64 %callee) {
35 ; CHECK-LABEL: jscall_patchpoint_codegen2:
36 ; CHECK: movq $6, 24(%rsp)
37 ; CHECK-NEXT: movl $4, 16(%rsp)
38 ; CHECK-NEXT: movq $2, (%rsp)
40 ; CHECK-NEXT: movabsq $-559038736, %r11
41 ; CHECK-NEXT: callq *%r11
42 ; FAST-LABEL: jscall_patchpoint_codegen2:
43 ; FAST: movq $2, (%rsp)
44 ; FAST-NEXT: movl $4, 16(%rsp)
45 ; FAST-NEXT: movq $6, 24(%rsp)
47 ; FAST-NEXT: movabsq $-559038736, %r11
48 ; FAST-NEXT: callq *%r11
49 %call = inttoptr i64 -559038736 to i8*
50 %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)
54 ; Test if the arguments are properly aligned and that we don't store undef arguments.
55 define i64 @jscall_patchpoint_codegen3(i64 %callee) {
57 ; CHECK-LABEL: jscall_patchpoint_codegen3:
58 ; CHECK: movq $10, 48(%rsp)
59 ; CHECK-NEXT: movl $8, 36(%rsp)
60 ; CHECK-NEXT: movq $6, 24(%rsp)
61 ; CHECK-NEXT: movl $4, 16(%rsp)
62 ; CHECK-NEXT: movq $2, (%rsp)
64 ; CHECK-NEXT: movabsq $-559038736, %r11
65 ; CHECK-NEXT: callq *%r11
66 ; FAST-LABEL: jscall_patchpoint_codegen3:
67 ; FAST: movq $2, (%rsp)
68 ; FAST-NEXT: movl $4, 16(%rsp)
69 ; FAST-NEXT: movq $6, 24(%rsp)
70 ; FAST-NEXT: movl $8, 36(%rsp)
71 ; FAST-NEXT: movq $10, 48(%rsp)
73 ; FAST-NEXT: movabsq $-559038736, %r11
74 ; FAST-NEXT: callq *%r11
75 %call = inttoptr i64 -559038736 to i8*
76 %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)
80 declare void @llvm.experimental.patchpoint.void(i64, i32, i8*, i32, ...)
81 declare i64 @llvm.experimental.patchpoint.i64(i64, i32, i8*, i32, ...)