[Reland][Runtimes] Merge 'compile_commands.json' files from runtimes build (#116303)
[llvm-project.git] / clang / test / CodeGenCXX / attr-x86-no_caller_saved_registers.cpp
blob68fc10305218cd590656a5c06b0c36cfc2602259
1 // RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu %s -emit-llvm -o - | FileCheck %s
2 // RUN: %clang_cc1 -triple x86_64-pc-win32 %s -emit-llvm -o - | FileCheck %s
4 // CHECK: foo{{[^#]*}}#[[ATTRS:[0-9]+]]
5 __attribute__((no_caller_saved_registers)) void foo() {}
6 namespace S {
7 // CHECK: bar{{[^#]*}}#[[ATTRS]]
8 __attribute__((no_caller_saved_registers)) void bar(int *a) { foo(); }
11 struct St {
12 static void baz(int *a) __attribute__((no_caller_saved_registers)) { S::bar(a); }
15 __attribute((no_caller_saved_registers)) void (*foobar)(void);
17 // CHECK-LABEL: @main
18 int main(int argc, char **argv) {
19 St::baz(&argc);
20 // CHECK: [[FOOBAR:%.+]] = load ptr, ptr @{{.*}}foobar{{.*}},
21 // CHECK-NEXT: call void [[FOOBAR]]() #[[ATTRS1:.+]]
22 foobar();
23 return 0;
26 // CHECK: baz{{[^#]*}}#[[ATTRS]]
28 // CHECK: attributes #[[ATTRS]] = {
29 // CHECK-SAME: "no_caller_saved_registers"
30 // CHECK-SAME: }
31 // CHECK: attributes #[[ATTRS1]] = { "no_caller_saved_registers" }