1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --no_x86_scrub_sp
2 ; RUN: llc < %s | FileCheck %s -check-prefixes=CHECK-USER
3 ; RUN: llc -O0 < %s | FileCheck %s -check-prefixes=CHECK0-USER
4 ; RUN: llc -code-model=kernel < %s | FileCheck %s -check-prefixes=CHECK-KERNEL
5 ; RUN: llc -O0 -code-model=kernel < %s | FileCheck %s -check-prefixes=CHECK0-KERNEL
7 target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
8 target triple = "x86_64-unknown-linux-gnu"
10 %struct.__uintr_frame = type { i64, i64, i64 }
12 ; #include <x86gprintrin.h>
15 ; __attribute__ ((interrupt))
16 ; test_uintr_isr_cc_empty(struct __uintr_frame *frame, unsigned long long uirrv)
20 define dso_local x86_intrcc void @test_uintr_isr_cc_empty(ptr nocapture byval(%struct.__uintr_frame) %frame, i64 %uirrv) #0 {
21 ; CHECK-USER-LABEL: test_uintr_isr_cc_empty:
22 ; CHECK-USER: # %bb.0: # %entry
23 ; CHECK-USER-NEXT: pushq %rax
24 ; CHECK-USER-NEXT: cld
25 ; CHECK-USER-NEXT: addq $16, %rsp
26 ; CHECK-USER-NEXT: uiret
28 ; CHECK0-USER-LABEL: test_uintr_isr_cc_empty:
29 ; CHECK0-USER: # %bb.0: # %entry
30 ; CHECK0-USER-NEXT: pushq %rax
31 ; CHECK0-USER-NEXT: cld
32 ; CHECK0-USER-NEXT: addq $16, %rsp
33 ; CHECK0-USER-NEXT: uiret
35 ; CHECK-KERNEL-LABEL: test_uintr_isr_cc_empty:
36 ; CHECK-KERNEL: # %bb.0: # %entry
37 ; CHECK-KERNEL-NEXT: pushq %rax
38 ; CHECK-KERNEL-NEXT: cld
39 ; CHECK-KERNEL-NEXT: addq $16, %rsp
40 ; CHECK-KERNEL-NEXT: iretq
42 ; CHECK0-KERNEL-LABEL: test_uintr_isr_cc_empty:
43 ; CHECK0-KERNEL: # %bb.0: # %entry
44 ; CHECK0-KERNEL-NEXT: pushq %rax
45 ; CHECK0-KERNEL-NEXT: cld
46 ; CHECK0-KERNEL-NEXT: addq $16, %rsp
47 ; CHECK0-KERNEL-NEXT: iretq
52 ; unsigned long long g_rip;
53 ; unsigned long long g_rflags;
54 ; unsigned long long g_rsp;
55 ; unsigned long long g_uirrv;
58 ; __attribute__((interrupt))
59 ; test_uintr_isr_cc_args(struct __uintr_frame *frame, unsigned long long uirrv)
62 ; g_rflags = frame->rflags;
66 @g_rip = dso_local local_unnamed_addr global i64 0, align 8
67 @g_rflags = dso_local local_unnamed_addr global i64 0, align 8
68 @g_rsp = dso_local local_unnamed_addr global i64 0, align 8
69 @g_uirrv = dso_local local_unnamed_addr global i64 0, align 8
71 define dso_local x86_intrcc void @test_uintr_isr_cc_args(ptr nocapture readonly byval(%struct.__uintr_frame) %frame, i64 %uirrv) #0 {
72 ; CHECK-USER-LABEL: test_uintr_isr_cc_args:
73 ; CHECK-USER: # %bb.0: # %entry
74 ; CHECK-USER-NEXT: pushq %rax
75 ; CHECK-USER-NEXT: pushq %rax
76 ; CHECK-USER-NEXT: pushq %rdx
77 ; CHECK-USER-NEXT: pushq %rcx
78 ; CHECK-USER-NEXT: cld
79 ; CHECK-USER-NEXT: movq 32(%rsp), %rax
80 ; CHECK-USER-NEXT: movq 40(%rsp), %rcx
81 ; CHECK-USER-NEXT: movq 48(%rsp), %rdx
82 ; CHECK-USER-NEXT: movq %rcx, g_rip(%rip)
83 ; CHECK-USER-NEXT: movq %rdx, g_rflags(%rip)
84 ; CHECK-USER-NEXT: movq 56(%rsp), %rcx
85 ; CHECK-USER-NEXT: movq %rcx, g_rsp(%rip)
86 ; CHECK-USER-NEXT: movq %rax, g_uirrv(%rip)
87 ; CHECK-USER-NEXT: popq %rcx
88 ; CHECK-USER-NEXT: popq %rdx
89 ; CHECK-USER-NEXT: popq %rax
90 ; CHECK-USER-NEXT: addq $16, %rsp
91 ; CHECK-USER-NEXT: uiret
93 ; CHECK0-USER-LABEL: test_uintr_isr_cc_args:
94 ; CHECK0-USER: # %bb.0: # %entry
95 ; CHECK0-USER-NEXT: pushq %rax
96 ; CHECK0-USER-NEXT: pushq %rax
97 ; CHECK0-USER-NEXT: pushq %rdx
98 ; CHECK0-USER-NEXT: pushq %rcx
99 ; CHECK0-USER-NEXT: cld
100 ; CHECK0-USER-NEXT: movq 32(%rsp), %rax
101 ; CHECK0-USER-NEXT: leaq 40(%rsp), %rcx
102 ; CHECK0-USER-NEXT: movq (%rcx), %rdx
103 ; CHECK0-USER-NEXT: movq %rdx, g_rip(%rip)
104 ; CHECK0-USER-NEXT: movq 8(%rcx), %rdx
105 ; CHECK0-USER-NEXT: movq %rdx, g_rflags(%rip)
106 ; CHECK0-USER-NEXT: movq 16(%rcx), %rcx
107 ; CHECK0-USER-NEXT: movq %rcx, g_rsp(%rip)
108 ; CHECK0-USER-NEXT: movq %rax, g_uirrv(%rip)
109 ; CHECK0-USER-NEXT: popq %rcx
110 ; CHECK0-USER-NEXT: popq %rdx
111 ; CHECK0-USER-NEXT: popq %rax
112 ; CHECK0-USER-NEXT: addq $16, %rsp
113 ; CHECK0-USER-NEXT: uiret
115 ; CHECK-KERNEL-LABEL: test_uintr_isr_cc_args:
116 ; CHECK-KERNEL: # %bb.0: # %entry
117 ; CHECK-KERNEL-NEXT: pushq %rax
118 ; CHECK-KERNEL-NEXT: pushq %rax
119 ; CHECK-KERNEL-NEXT: pushq %rdx
120 ; CHECK-KERNEL-NEXT: pushq %rcx
121 ; CHECK-KERNEL-NEXT: cld
122 ; CHECK-KERNEL-NEXT: movq 32(%rsp), %rax
123 ; CHECK-KERNEL-NEXT: movq 40(%rsp), %rcx
124 ; CHECK-KERNEL-NEXT: movq 48(%rsp), %rdx
125 ; CHECK-KERNEL-NEXT: movq %rcx, g_rip(%rip)
126 ; CHECK-KERNEL-NEXT: movq %rdx, g_rflags(%rip)
127 ; CHECK-KERNEL-NEXT: movq 56(%rsp), %rcx
128 ; CHECK-KERNEL-NEXT: movq %rcx, g_rsp(%rip)
129 ; CHECK-KERNEL-NEXT: movq %rax, g_uirrv(%rip)
130 ; CHECK-KERNEL-NEXT: popq %rcx
131 ; CHECK-KERNEL-NEXT: popq %rdx
132 ; CHECK-KERNEL-NEXT: popq %rax
133 ; CHECK-KERNEL-NEXT: addq $16, %rsp
134 ; CHECK-KERNEL-NEXT: iretq
136 ; CHECK0-KERNEL-LABEL: test_uintr_isr_cc_args:
137 ; CHECK0-KERNEL: # %bb.0: # %entry
138 ; CHECK0-KERNEL-NEXT: pushq %rax
139 ; CHECK0-KERNEL-NEXT: pushq %rax
140 ; CHECK0-KERNEL-NEXT: pushq %rdx
141 ; CHECK0-KERNEL-NEXT: pushq %rcx
142 ; CHECK0-KERNEL-NEXT: cld
143 ; CHECK0-KERNEL-NEXT: movq 32(%rsp), %rax
144 ; CHECK0-KERNEL-NEXT: leaq 40(%rsp), %rcx
145 ; CHECK0-KERNEL-NEXT: movq (%rcx), %rdx
146 ; CHECK0-KERNEL-NEXT: movq %rdx, g_rip(%rip)
147 ; CHECK0-KERNEL-NEXT: movq 8(%rcx), %rdx
148 ; CHECK0-KERNEL-NEXT: movq %rdx, g_rflags(%rip)
149 ; CHECK0-KERNEL-NEXT: movq 16(%rcx), %rcx
150 ; CHECK0-KERNEL-NEXT: movq %rcx, g_rsp(%rip)
151 ; CHECK0-KERNEL-NEXT: movq %rax, g_uirrv(%rip)
152 ; CHECK0-KERNEL-NEXT: popq %rcx
153 ; CHECK0-KERNEL-NEXT: popq %rdx
154 ; CHECK0-KERNEL-NEXT: popq %rax
155 ; CHECK0-KERNEL-NEXT: addq $16, %rsp
156 ; CHECK0-KERNEL-NEXT: iretq
158 %0 = load i64, ptr %frame, align 8
159 store i64 %0, ptr @g_rip, align 8
160 %rflags = getelementptr inbounds %struct.__uintr_frame, ptr %frame, i64 0, i32 1
161 %1 = load i64, ptr %rflags, align 8
162 store i64 %1, ptr @g_rflags, align 8
163 %rsp = getelementptr inbounds %struct.__uintr_frame, ptr %frame, i64 0, i32 2
164 %2 = load i64, ptr %rsp, align 8
165 store i64 %2, ptr @g_rsp, align 8
166 store i64 %uirrv, ptr @g_uirrv, align 8
170 attributes #0 = { nofree norecurse nounwind willreturn "disable-tail-calls"="true" "frame-pointer"="none" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+uintr" "tune-cpu"="generic" }