xref: /llvm-project/llvm/test/CodeGen/X86/x64-cet-intrinsics.ll (revision 1c674666fa3bc0cf6d62d920bdddc846b8105d12)
1; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2; RUN: llc < %s -mtriple=x86_64-apple-darwin -mattr=+shstk --show-mc-encoding | FileCheck %s
3; RUN: llc < %s -mtriple=x86_64-apple-darwin -mattr=+shstk,+egpr --show-mc-encoding | FileCheck %s -check-prefix=EGPR
4
5define void @test_incsspd(i32 %a) local_unnamed_addr {
6; CHECK-LABEL: test_incsspd:
7; CHECK:       ## %bb.0: ## %entry
8; CHECK-NEXT:    incsspd %edi ## encoding: [0xf3,0x0f,0xae,0xef]
9; CHECK-NEXT:    retq ## encoding: [0xc3]
10;
11; EGPR-LABEL: test_incsspd:
12; EGPR:       ## %bb.0: ## %entry
13; EGPR-NEXT:    incsspd %edi ## encoding: [0xf3,0x0f,0xae,0xef]
14; EGPR-NEXT:    retq ## encoding: [0xc3]
15entry:
16  tail call void @llvm.x86.incsspd(i32 %a)
17  ret void
18}
19
20declare void @llvm.x86.incsspd(i32)
21
22define void @test_incsspq(i32 %a) local_unnamed_addr {
23; CHECK-LABEL: test_incsspq:
24; CHECK:       ## %bb.0: ## %entry
25; CHECK-NEXT:    movslq %edi, %rax ## encoding: [0x48,0x63,0xc7]
26; CHECK-NEXT:    incsspq %rax ## encoding: [0xf3,0x48,0x0f,0xae,0xe8]
27; CHECK-NEXT:    retq ## encoding: [0xc3]
28;
29; EGPR-LABEL: test_incsspq:
30; EGPR:       ## %bb.0: ## %entry
31; EGPR-NEXT:    movslq %edi, %rax ## encoding: [0x48,0x63,0xc7]
32; EGPR-NEXT:    incsspq %rax ## encoding: [0xf3,0x48,0x0f,0xae,0xe8]
33; EGPR-NEXT:    retq ## encoding: [0xc3]
34entry:
35  %conv.i = sext i32 %a to i64
36  tail call void @llvm.x86.incsspq(i64 %conv.i)
37  ret void
38}
39
40declare void @llvm.x86.incsspq(i64)
41
42define i32 @test_rdsspd(i32 %a) {
43; CHECK-LABEL: test_rdsspd:
44; CHECK:       ## %bb.0: ## %entry
45; CHECK-NEXT:    movl %edi, %eax ## encoding: [0x89,0xf8]
46; CHECK-NEXT:    rdsspd %eax ## encoding: [0xf3,0x0f,0x1e,0xc8]
47; CHECK-NEXT:    retq ## encoding: [0xc3]
48;
49; EGPR-LABEL: test_rdsspd:
50; EGPR:       ## %bb.0: ## %entry
51; EGPR-NEXT:    movl %edi, %eax ## encoding: [0x89,0xf8]
52; EGPR-NEXT:    rdsspd %eax ## encoding: [0xf3,0x0f,0x1e,0xc8]
53; EGPR-NEXT:    retq ## encoding: [0xc3]
54entry:
55  %0 = call i32 @llvm.x86.rdsspd(i32 %a)
56  ret i32 %0
57}
58
59declare i32 @llvm.x86.rdsspd(i32)
60
61define i64 @test_rdsspq(i64 %a) {
62; CHECK-LABEL: test_rdsspq:
63; CHECK:       ## %bb.0: ## %entry
64; CHECK-NEXT:    movq %rdi, %rax ## encoding: [0x48,0x89,0xf8]
65; CHECK-NEXT:    rdsspq %rax ## encoding: [0xf3,0x48,0x0f,0x1e,0xc8]
66; CHECK-NEXT:    retq ## encoding: [0xc3]
67;
68; EGPR-LABEL: test_rdsspq:
69; EGPR:       ## %bb.0: ## %entry
70; EGPR-NEXT:    movq %rdi, %rax ## encoding: [0x48,0x89,0xf8]
71; EGPR-NEXT:    rdsspq %rax ## encoding: [0xf3,0x48,0x0f,0x1e,0xc8]
72; EGPR-NEXT:    retq ## encoding: [0xc3]
73entry:
74  %0 = call i64 @llvm.x86.rdsspq(i64 %a)
75  ret i64 %0
76}
77
78declare i64 @llvm.x86.rdsspq(i64)
79
80define void @test_saveprevssp() {
81; CHECK-LABEL: test_saveprevssp:
82; CHECK:       ## %bb.0: ## %entry
83; CHECK-NEXT:    saveprevssp ## encoding: [0xf3,0x0f,0x01,0xea]
84; CHECK-NEXT:    retq ## encoding: [0xc3]
85;
86; EGPR-LABEL: test_saveprevssp:
87; EGPR:       ## %bb.0: ## %entry
88; EGPR-NEXT:    saveprevssp ## encoding: [0xf3,0x0f,0x01,0xea]
89; EGPR-NEXT:    retq ## encoding: [0xc3]
90entry:
91  tail call void @llvm.x86.saveprevssp()
92  ret void
93}
94
95declare void @llvm.x86.saveprevssp()
96
97define void @test_rstorssp(ptr %__p) {
98; CHECK-LABEL: test_rstorssp:
99; CHECK:       ## %bb.0: ## %entry
100; CHECK-NEXT:    rstorssp (%rdi) ## encoding: [0xf3,0x0f,0x01,0x2f]
101; CHECK-NEXT:    retq ## encoding: [0xc3]
102;
103; EGPR-LABEL: test_rstorssp:
104; EGPR:       ## %bb.0: ## %entry
105; EGPR-NEXT:    rstorssp (%rdi) ## encoding: [0xf3,0x0f,0x01,0x2f]
106; EGPR-NEXT:    retq ## encoding: [0xc3]
107entry:
108  tail call void @llvm.x86.rstorssp(ptr %__p)
109  ret void
110}
111
112declare void @llvm.x86.rstorssp(ptr)
113
114define void @test_wrssd(i32 %a, ptr %__p) {
115; CHECK-LABEL: test_wrssd:
116; CHECK:       ## %bb.0: ## %entry
117; CHECK-NEXT:    wrssd %edi, (%rsi) ## encoding: [0x0f,0x38,0xf6,0x3e]
118; CHECK-NEXT:    retq ## encoding: [0xc3]
119;
120; EGPR-LABEL: test_wrssd:
121; EGPR:       ## %bb.0: ## %entry
122; EGPR-NEXT:    wrssd %edi, (%rsi) ## EVEX TO LEGACY Compression encoding: [0x0f,0x38,0xf6,0x3e]
123; EGPR-NEXT:    retq ## encoding: [0xc3]
124entry:
125  tail call void @llvm.x86.wrssd(i32 %a, ptr %__p)
126  ret void
127}
128
129declare void @llvm.x86.wrssd(i32, ptr)
130
131define void @test_wrssq(i64 %a, ptr %__p) {
132; CHECK-LABEL: test_wrssq:
133; CHECK:       ## %bb.0: ## %entry
134; CHECK-NEXT:    wrssq %rdi, (%rsi) ## encoding: [0x48,0x0f,0x38,0xf6,0x3e]
135; CHECK-NEXT:    retq ## encoding: [0xc3]
136;
137; EGPR-LABEL: test_wrssq:
138; EGPR:       ## %bb.0: ## %entry
139; EGPR-NEXT:    wrssq %rdi, (%rsi) ## EVEX TO LEGACY Compression encoding: [0x48,0x0f,0x38,0xf6,0x3e]
140; EGPR-NEXT:    retq ## encoding: [0xc3]
141entry:
142  tail call void @llvm.x86.wrssq(i64 %a, ptr %__p)
143  ret void
144}
145
146declare void @llvm.x86.wrssq(i64, ptr)
147
148define void @test_wrussd(i32 %a, ptr %__p) {
149; CHECK-LABEL: test_wrussd:
150; CHECK:       ## %bb.0: ## %entry
151; CHECK-NEXT:    wrussd %edi, (%rsi) ## encoding: [0x66,0x0f,0x38,0xf5,0x3e]
152; CHECK-NEXT:    retq ## encoding: [0xc3]
153;
154; EGPR-LABEL: test_wrussd:
155; EGPR:       ## %bb.0: ## %entry
156; EGPR-NEXT:    wrussd %edi, (%rsi) ## EVEX TO LEGACY Compression encoding: [0x66,0x0f,0x38,0xf5,0x3e]
157; EGPR-NEXT:    retq ## encoding: [0xc3]
158entry:
159  tail call void @llvm.x86.wrussd(i32 %a, ptr %__p)
160  ret void
161}
162
163declare void @llvm.x86.wrussd(i32, ptr)
164
165define void @test_wrussq(i64 %a, ptr %__p) {
166; CHECK-LABEL: test_wrussq:
167; CHECK:       ## %bb.0: ## %entry
168; CHECK-NEXT:    wrussq %rdi, (%rsi) ## encoding: [0x66,0x48,0x0f,0x38,0xf5,0x3e]
169; CHECK-NEXT:    retq ## encoding: [0xc3]
170;
171; EGPR-LABEL: test_wrussq:
172; EGPR:       ## %bb.0: ## %entry
173; EGPR-NEXT:    wrussq %rdi, (%rsi) ## EVEX TO LEGACY Compression encoding: [0x66,0x48,0x0f,0x38,0xf5,0x3e]
174; EGPR-NEXT:    retq ## encoding: [0xc3]
175entry:
176  tail call void @llvm.x86.wrussq(i64 %a, ptr %__p)
177  ret void
178}
179
180declare void @llvm.x86.wrussq(i64, ptr)
181
182define void @test_setssbsy() {
183; CHECK-LABEL: test_setssbsy:
184; CHECK:       ## %bb.0: ## %entry
185; CHECK-NEXT:    setssbsy ## encoding: [0xf3,0x0f,0x01,0xe8]
186; CHECK-NEXT:    retq ## encoding: [0xc3]
187;
188; EGPR-LABEL: test_setssbsy:
189; EGPR:       ## %bb.0: ## %entry
190; EGPR-NEXT:    setssbsy ## encoding: [0xf3,0x0f,0x01,0xe8]
191; EGPR-NEXT:    retq ## encoding: [0xc3]
192entry:
193  tail call void @llvm.x86.setssbsy()
194  ret void
195}
196
197declare void @llvm.x86.setssbsy()
198
199define void @test_clrssbsy(ptr %__p) {
200; CHECK-LABEL: test_clrssbsy:
201; CHECK:       ## %bb.0: ## %entry
202; CHECK-NEXT:    clrssbsy (%rdi) ## encoding: [0xf3,0x0f,0xae,0x37]
203; CHECK-NEXT:    retq ## encoding: [0xc3]
204;
205; EGPR-LABEL: test_clrssbsy:
206; EGPR:       ## %bb.0: ## %entry
207; EGPR-NEXT:    clrssbsy (%rdi) ## encoding: [0xf3,0x0f,0xae,0x37]
208; EGPR-NEXT:    retq ## encoding: [0xc3]
209entry:
210  tail call void @llvm.x86.clrssbsy(ptr %__p)
211  ret void
212}
213
214declare void @llvm.x86.clrssbsy(ptr %__p)
215