1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc -O3 < %s | FileCheck %s
4 target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128"
5 target triple = "x86_64-unknown-unknown"
7 ; Check that we don't crash on handling of various types of constants
8 ; (including non-integer constants)
9 define void @test_legal_constants() gc "statepoint-example" {
10 ; CHECK-LABEL: test_legal_constants:
12 ; CHECK-NEXT: pushq %rax
13 ; CHECK-NEXT: .cfi_def_cfa_offset 16
14 ; CHECK-NEXT: callq foo@PLT
16 ; CHECK-NEXT: popq %rax
17 ; CHECK-NEXT: .cfi_def_cfa_offset 8
19 %statepoint_token = call token (i64, i32, ptr, i32, i32, ...) @llvm.experimental.gc.statepoint.p0(i64 2882400000, i32 0, ptr elementtype(void ()) @foo, i32 0, i32 2, i32 0, i32 0) #0 [ "deopt" (float 2.0, double 3.0, i8 5, i16 22, i32 8, i64 9, ptr addrspace(1) null) ]
23 ; Ensure we can allocate and assign values in registers for each type
24 define void @test_registers(float %v1, double %v2, i8 %v3, i16 %v4, i32 %v5, i64 %v6, ptr addrspace(1) %v7) gc "statepoint-example" {
25 ; CHECK-LABEL: test_registers:
27 ; CHECK-NEXT: pushq %rax
28 ; CHECK-NEXT: .cfi_def_cfa_offset 16
29 ; CHECK-NEXT: movq %r8, (%rsp)
30 ; CHECK-NEXT: callq foo@PLT
32 ; CHECK-NEXT: popq %rax
33 ; CHECK-NEXT: .cfi_def_cfa_offset 8
35 %statepoint_token = call token (i64, i32, ptr, i32, i32, ...) @llvm.experimental.gc.statepoint.p0(i64 2882400000, i32 0, ptr elementtype(void ()) @foo, i32 0, i32 2, i32 0, i32 0) #0 [ "deopt" (float %v1, double %v2, i8 %v3, i16 %v4, i32 %v5, i64 %v6, ptr addrspace(1) %v7) ]
39 ; For constants which definitely *don't* fit in registers, can we still
40 ; encode them in the stackmap?
41 define void @test_illegal_constants() gc "statepoint-example" {
42 ; CHECK-LABEL: test_illegal_constants:
44 ; CHECK-NEXT: subq $248, %rsp
45 ; CHECK-NEXT: .cfi_def_cfa_offset 256
46 ; CHECK-NEXT: xorps %xmm0, %xmm0
47 ; CHECK-NEXT: movaps %xmm0, {{[0-9]+}}(%rsp)
48 ; CHECK-NEXT: movaps %xmm0, {{[0-9]+}}(%rsp)
49 ; CHECK-NEXT: movaps %xmm0, {{[0-9]+}}(%rsp)
50 ; CHECK-NEXT: movaps %xmm0, {{[0-9]+}}(%rsp)
51 ; CHECK-NEXT: movaps %xmm0, {{[0-9]+}}(%rsp)
52 ; CHECK-NEXT: movaps %xmm0, {{[0-9]+}}(%rsp)
53 ; CHECK-NEXT: movaps %xmm0, {{[0-9]+}}(%rsp)
54 ; CHECK-NEXT: movaps %xmm0, {{[0-9]+}}(%rsp)
55 ; CHECK-NEXT: movaps %xmm0, {{[0-9]+}}(%rsp)
56 ; CHECK-NEXT: movaps %xmm0, {{[0-9]+}}(%rsp)
57 ; CHECK-NEXT: movaps %xmm0, {{[0-9]+}}(%rsp)
58 ; CHECK-NEXT: movq $0, {{[0-9]+}}(%rsp)
59 ; CHECK-NEXT: movq $144, {{[0-9]+}}(%rsp)
60 ; CHECK-NEXT: movq $0, {{[0-9]+}}(%rsp)
61 ; CHECK-NEXT: movq $144, (%rsp)
62 ; CHECK-NEXT: movq $0, {{[0-9]+}}(%rsp)
63 ; CHECK-NEXT: movq $144, {{[0-9]+}}(%rsp)
64 ; CHECK-NEXT: movq $0, {{[0-9]+}}(%rsp)
65 ; CHECK-NEXT: movq $144, {{[0-9]+}}(%rsp)
66 ; CHECK-NEXT: callq foo@PLT
68 ; CHECK-NEXT: addq $248, %rsp
69 ; CHECK-NEXT: .cfi_def_cfa_offset 8
71 %statepoint_token = call token (i64, i32, ptr, i32, i32, ...) @llvm.experimental.gc.statepoint.p0(i64 2882400000, i32 0, ptr elementtype(void ()) @foo, i32 0, i32 2, i32 0, i32 0) #0 [ "deopt" (i128 144, i256 144, i512 144, i1024 144) ]
75 ; Ensure we don't crash w/a value which can't fit in a
76 ; register, and must be spilled.
77 define void @test_illegal_values(i128 %v1, i256 %v2, i512 %v3, i1024 %v4) gc "statepoint-example" {
78 ; CHECK-LABEL: test_illegal_values:
80 ; CHECK-NEXT: subq $248, %rsp
81 ; CHECK-NEXT: .cfi_def_cfa_offset 256
82 ; CHECK-NEXT: movaps {{[0-9]+}}(%rsp), %xmm0
83 ; CHECK-NEXT: movaps {{[0-9]+}}(%rsp), %xmm1
84 ; CHECK-NEXT: movaps {{[0-9]+}}(%rsp), %xmm2
85 ; CHECK-NEXT: movaps {{[0-9]+}}(%rsp), %xmm3
86 ; CHECK-NEXT: movaps {{[0-9]+}}(%rsp), %xmm4
87 ; CHECK-NEXT: movaps {{[0-9]+}}(%rsp), %xmm5
88 ; CHECK-NEXT: movaps {{[0-9]+}}(%rsp), %xmm6
89 ; CHECK-NEXT: movaps {{[0-9]+}}(%rsp), %xmm7
90 ; CHECK-NEXT: movaps {{[0-9]+}}(%rsp), %xmm8
91 ; CHECK-NEXT: movaps {{[0-9]+}}(%rsp), %xmm9
92 ; CHECK-NEXT: movaps {{[0-9]+}}(%rsp), %xmm10
93 ; CHECK-NEXT: movaps {{[0-9]+}}(%rsp), %xmm11
94 ; CHECK-NEXT: movq %r9, {{[0-9]+}}(%rsp)
95 ; CHECK-NEXT: movq %r8, {{[0-9]+}}(%rsp)
96 ; CHECK-NEXT: movq %rcx, {{[0-9]+}}(%rsp)
97 ; CHECK-NEXT: movq %rdx, {{[0-9]+}}(%rsp)
98 ; CHECK-NEXT: movq %rsi, {{[0-9]+}}(%rsp)
99 ; CHECK-NEXT: movq %rdi, (%rsp)
100 ; CHECK-NEXT: movaps %xmm11, {{[0-9]+}}(%rsp)
101 ; CHECK-NEXT: movaps %xmm10, {{[0-9]+}}(%rsp)
102 ; CHECK-NEXT: movaps %xmm9, {{[0-9]+}}(%rsp)
103 ; CHECK-NEXT: movaps %xmm8, {{[0-9]+}}(%rsp)
104 ; CHECK-NEXT: movaps %xmm7, {{[0-9]+}}(%rsp)
105 ; CHECK-NEXT: movaps %xmm6, {{[0-9]+}}(%rsp)
106 ; CHECK-NEXT: movaps %xmm5, {{[0-9]+}}(%rsp)
107 ; CHECK-NEXT: movaps %xmm4, {{[0-9]+}}(%rsp)
108 ; CHECK-NEXT: movaps %xmm3, {{[0-9]+}}(%rsp)
109 ; CHECK-NEXT: movaps %xmm2, {{[0-9]+}}(%rsp)
110 ; CHECK-NEXT: movaps %xmm1, {{[0-9]+}}(%rsp)
111 ; CHECK-NEXT: movaps %xmm0, {{[0-9]+}}(%rsp)
112 ; CHECK-NEXT: callq foo@PLT
113 ; CHECK-NEXT: .Ltmp3:
114 ; CHECK-NEXT: addq $248, %rsp
115 ; CHECK-NEXT: .cfi_def_cfa_offset 8
117 %statepoint_token = call token (i64, i32, ptr, i32, i32, ...) @llvm.experimental.gc.statepoint.p0(i64 2882400000, i32 0, ptr elementtype(void ()) @foo, i32 0, i32 2, i32 0, i32 0) #0 [ "deopt" (i128 %v1, i256 %v2, i512 %v3, i1024 %v4) ]
122 ;; TODO: Add a test for illegal register values (i.e. spilling). A
123 ;; trivial one currently crashes.
127 declare token @llvm.experimental.gc.statepoint.p0(i64 , i32 , ptr, i32 , i32 , ...)
129 attributes #0 = { "deopt-lowering"="live-in" }