| 1 |
// RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -fclangir -emit-cir %s -o %t.cir |
| 2 |
// RUN: FileCheck --input-file=%t.cir %s -check-prefix=CIR |
| 3 |
// RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -fclangir -emit-llvm %s -o %t.ll |
| 4 |
// RUN: FileCheck --input-file=%t.ll %s -check-prefix=LLVM |
| 5 |
// RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -emit-llvm %s -o %t.ll |
| 6 |
// RUN: FileCheck --input-file=%t.ll %s -check-prefix=OGCG |
| 7 |
|
| 8 |
// Test address space 1 |
| 9 |
// CIR: cir.func {{.*}} @foo(%arg0: !cir.ptr<!s32i, target_address_space(1)> |
| 10 |
// LLVM: define dso_local void @foo(ptr addrspace(1) %0) |
| 11 |
// OGCG: define dso_local void @foo(ptr addrspace(1) noundef %arg) |
| 12 |
void foo(int __attribute__((address_space(1))) *arg) { |
| 13 |
return; |
| 14 |
} |
| 15 |
|
| 16 |
// Test explicit address space 0 (should be same as default) |
| 17 |
// CIR: cir.func {{.*}} @bar(%arg0: !cir.ptr<!s32i, target_address_space(0)> |
| 18 |
// LLVM: define dso_local void @bar(ptr %0) |
| 19 |
// OGCG: define dso_local void @bar(ptr noundef %arg) |
| 20 |
void bar(int __attribute__((address_space(0))) *arg) { |
| 21 |
return; |
| 22 |
} |
| 23 |
|
| 24 |
// Test default address space (no attribute) |
| 25 |
// CIR: cir.func {{.*}} @baz(%arg0: !cir.ptr<!s32i> |
| 26 |
// LLVM: define dso_local void @baz(ptr %0) |
| 27 |
// OGCG: define dso_local void @baz(ptr noundef %arg) |
| 28 |
void baz(int *arg) { |
| 29 |
return; |
| 30 |
} |