| 1 |
// RUN: %clang_cc1 -std=c++20 -triple x86_64-unknown-linux-gnu -fclangir -emit-cir %s -o %t.cir |
| 2 |
// RUN: FileCheck --check-prefix=CIR --input-file=%t.cir %s |
| 3 |
// RUN: %clang_cc1 -std=c++20 -triple x86_64-unknown-linux-gnu -fclangir -emit-llvm %s -o %t-cir.ll |
| 4 |
// RUN: FileCheck --check-prefix=LLVM --input-file=%t-cir.ll %s |
| 5 |
// RUN: %clang_cc1 -std=c++20 -triple x86_64-unknown-linux-gnu -emit-llvm %s -o %t.ll |
| 6 |
// RUN: FileCheck --check-prefix=OGCG --input-file=%t.ll %s |
| 7 |
|
| 8 |
|
| 9 |
void test_builtins_basic() { |
| 10 |
__builtin_operator_delete(__builtin_operator_new(4)); |
| 11 |
// CIR-LABEL: test_builtins_basic |
| 12 |
// CIR: [[P:%.*]] = cir.call @_Znwm({{%.*}}) : (!u64i) -> !cir.ptr<!void> |
| 13 |
// CIR: cir.call @_ZdlPv([[P]]) {{.*}}: (!cir.ptr<!void>) -> () |
| 14 |
// CIR: cir.return |
| 15 |
|
| 16 |
// LLVM-LABEL: test_builtins_basic |
| 17 |
// LLVM: [[P:%.*]] = call ptr @_Znwm(i64 4) |
| 18 |
// LLVM: call void @_ZdlPv(ptr [[P]]) |
| 19 |
// LLVM: ret void |
| 20 |
|
| 21 |
// OGCG-LABEL: test_builtins_basic |
| 22 |
// OGCG: [[P:%.*]] = call {{.*}} ptr @_Znwm(i64 {{.*}} 4) |
| 23 |
// OGCG: call void @_ZdlPv(ptr {{.*}} [[P]]) |
| 24 |
// OGCG: ret void |
| 25 |
} |
| 26 |
|
| 27 |
void test_sized_delete() { |
| 28 |
__builtin_operator_delete(__builtin_operator_new(4), 4); |
| 29 |
|
| 30 |
// CIR-LABEL: test_sized_delete |
| 31 |
// CIR: [[P:%.*]] = cir.call @_Znwm({{%.*}}) : (!u64i) -> !cir.ptr<!void> |
| 32 |
// CIR: cir.call @_ZdlPvm([[P]], {{%.*}}) {{.*}}: (!cir.ptr<!void>, !u64i) -> () |
| 33 |
// CIR: cir.return |
| 34 |
|
| 35 |
// LLVM-LABEL: test_sized_delete |
| 36 |
// LLVM: [[P:%.*]] = call ptr @_Znwm(i64 4) |
| 37 |
// LLVM: call void @_ZdlPvm(ptr [[P]], i64 4) |
| 38 |
// LLVM: ret void |
| 39 |
|
| 40 |
// OGCG-LABEL: test_sized_delete |
| 41 |
// OGCG: [[P:%.*]] = call {{.*}} ptr @_Znwm(i64 {{.*}} 4) |
| 42 |
// OGCG: call void @_ZdlPvm(ptr {{.*}} [[P]], i64 {{.*}} 4) |
| 43 |
// OGCG: ret void |
| 44 |
} |