31 lines · c
1// RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -fclangir -emit-cir %s -o %t.cir2// RUN: FileCheck --input-file=%t.cir %s -check-prefix=CIR3// RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -fclangir -emit-llvm %s -o %t.ll4// RUN: FileCheck --input-file=%t.ll %s -check-prefix=LLVM5// RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -emit-llvm %s -o %t.ll6// RUN: FileCheck --input-file=%t.ll %s -check-prefix=OGCG7 8// Test address space 19// CIR: cir.func dso_local @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)12void 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 dso_local @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)20void bar(int __attribute__((address_space(0))) *arg) {21 return;22}23 24// Test default address space (no attribute)25// CIR: cir.func dso_local @baz(%arg0: !cir.ptr<!s32i>26// LLVM: define dso_local void @baz(ptr %0)27// OGCG: define dso_local void @baz(ptr noundef %arg)28void baz(int *arg) {29 return;30}31