1 ; RUN: llc < %s | FileCheck %s -check-prefix=CHECK -check-prefix=CHECK-BE
2 ; RUN: llc -fast-isel -fast-isel-abort=1 < %s | FileCheck %s -check-prefix=CHECK -check-prefix=CHECK-BE
3 ; RUN: llc -mtriple=powerpc64le-unknown-linux-gnu < %s | FileCheck %s -check-prefix=CHECK -check-prefix=CHECK-LE
4 ; RUN: llc -mtriple=powerpc64le-unknown-linux-gnu -fast-isel -fast-isel-abort=1 < %s | FileCheck %s -check-prefix=CHECK -check-prefix=CHECK-LE
6 target triple = "powerpc64-unknown-linux-gnu"
8 ; Trivial patchpoint codegen
10 define i64 @trivial_patchpoint_codegen(i64 %p1, i64 %p2, i64 %p3, i64 %p4) {
12 ; CHECK-LABEL: trivial_patchpoint_codegen:
15 ; CHECK-NEXT: rldic 12, 12, 32, 16
16 ; CHECK-NEXT: oris 12, 12, 48879
17 ; CHECK-NEXT: ori 12, 12, 51966
18 ; CHECK-NEXT: mtctr 12
22 ; CHECK-NEXT: rldic 12, 12, 32, 16
23 ; CHECK-NEXT: oris 12, 12, 48879
24 ; CHECK-NEXT: ori 12, 12, 51967
25 ; CHECK-NEXT: mtctr 12
30 %resolveCall2 = inttoptr i64 244837814094590 to i8*
31 %result = tail call i64 (i64, i32, i8*, i32, ...)* @llvm.experimental.patchpoint.i64(i64 2, i32 24, i8* %resolveCall2, i32 4, i64 %p1, i64 %p2, i64 %p3, i64 %p4)
32 %resolveCall3 = inttoptr i64 244837814094591 to i8*
33 tail call void (i64, i32, i8*, i32, ...)* @llvm.experimental.patchpoint.void(i64 3, i32 24, i8* %resolveCall3, i32 2, i64 %p1, i64 %result)
37 ; Caller frame metadata with stackmaps. This should not be optimized
40 ; CHECK-LABEL: caller_meta_leaf
41 ; CHECK-BE: stdu 1, -80(1)
42 ; CHECK-LE: stdu 1, -64(1)
44 ; CHECK-BE: addi 1, 1, 80
45 ; CHECK-LE: addi 1, 1, 64
48 define void @caller_meta_leaf() {
50 %metadata = alloca i64, i32 3, align 8
51 store i64 11, i64* %metadata
52 store i64 12, i64* %metadata
53 store i64 13, i64* %metadata
54 call void (i64, i32, ...)* @llvm.experimental.stackmap(i64 4, i32 0, i64* %metadata)
58 ; Test patchpoints reusing the same TargetConstant.
59 ; <rdar:15390785> Assertion failed: (CI.getNumArgOperands() >= NumArgs + 4)
60 ; There is no way to verify this, since it depends on memory allocation.
61 ; But I think it's useful to include as a working example.
62 define i64 @testLowerConstant(i64 %arg, i64 %tmp2, i64 %tmp10, i64* %tmp33, i64 %tmp79) {
64 %tmp80 = add i64 %tmp79, -16
65 %tmp81 = inttoptr i64 %tmp80 to i64*
66 %tmp82 = load i64, i64* %tmp81, align 8
67 tail call void (i64, i32, ...)* @llvm.experimental.stackmap(i64 14, i32 8, i64 %arg, i64 %tmp2, i64 %tmp10, i64 %tmp82)
68 tail call void (i64, i32, i8*, i32, ...)* @llvm.experimental.patchpoint.void(i64 15, i32 32, i8* null, i32 3, i64 %arg, i64 %tmp10, i64 %tmp82)
69 %tmp83 = load i64, i64* %tmp33, align 8
70 %tmp84 = add i64 %tmp83, -24
71 %tmp85 = inttoptr i64 %tmp84 to i64*
72 %tmp86 = load i64, i64* %tmp85, align 8
73 tail call void (i64, i32, ...)* @llvm.experimental.stackmap(i64 17, i32 8, i64 %arg, i64 %tmp10, i64 %tmp86)
74 tail call void (i64, i32, i8*, i32, ...)* @llvm.experimental.patchpoint.void(i64 18, i32 32, i8* null, i32 3, i64 %arg, i64 %tmp10, i64 %tmp86)
78 ; Test small patchpoints that don't emit calls.
79 define void @small_patchpoint_codegen(i64 %p1, i64 %p2, i64 %p3, i64 %p4) {
81 ; CHECK-LABEL: small_patchpoint_codegen:
90 %result = tail call i64 (i64, i32, i8*, i32, ...)* @llvm.experimental.patchpoint.i64(i64 5, i32 20, i8* null, i32 2, i64 %p1, i64 %p2)
94 declare void @llvm.experimental.stackmap(i64, i32, ...)
95 declare void @llvm.experimental.patchpoint.void(i64, i32, i8*, i32, ...)
96 declare i64 @llvm.experimental.patchpoint.i64(i64, i32, i8*, i32, ...)