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