brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.7 KiB · d540bfc Raw
45 lines · cpp
1// RUN: %clang_cc1 -std=c++20 -triple x86_64-unknown-linux-gnu -fclangir -emit-cir %s -o %t.cir2// RUN: FileCheck --check-prefix=CIR --input-file=%t.cir %s3// RUN: %clang_cc1 -std=c++20 -triple x86_64-unknown-linux-gnu -fclangir -emit-llvm %s -o %t-cir.ll4// RUN: FileCheck --check-prefix=LLVM --input-file=%t-cir.ll %s5// RUN: %clang_cc1 -std=c++20 -triple x86_64-unknown-linux-gnu -emit-llvm %s -o %t.ll6// RUN: FileCheck --check-prefix=OGCG --input-file=%t.ll %s7 8 9void test_builtins_basic() {10  __builtin_operator_delete(__builtin_operator_new(4));11  // CIR-LABEL: test_builtins_basic12  // CIR: [[P:%.*]] = cir.call @_Znwm({{%.*}}) : (!u64i) -> !cir.ptr<!void>13  // CIR: cir.call @_ZdlPv([[P]]) {{.*}}: (!cir.ptr<!void>) -> ()14  // CIR: cir.return15 16  // LLVM-LABEL: test_builtins_basic17  // LLVM: [[P:%.*]] = call ptr @_Znwm(i64 4)18  // LLVM: call void @_ZdlPv(ptr [[P]])19  // LLVM: ret void20 21  // OGCG-LABEL: test_builtins_basic22  // OGCG: [[P:%.*]] = call {{.*}} ptr @_Znwm(i64 {{.*}} 4)23  // OGCG: call void @_ZdlPv(ptr {{.*}} [[P]])24  // OGCG: ret void25}26 27void test_sized_delete() {28  __builtin_operator_delete(__builtin_operator_new(4), 4);29 30  // CIR-LABEL: test_sized_delete31  // CIR: [[P:%.*]] = cir.call @_Znwm({{%.*}}) : (!u64i) -> !cir.ptr<!void>32  // CIR: cir.call @_ZdlPvm([[P]], {{%.*}}) {{.*}}: (!cir.ptr<!void>, !u64i) -> ()33  // CIR: cir.return34 35  // LLVM-LABEL: test_sized_delete36  // LLVM: [[P:%.*]] = call ptr @_Znwm(i64 4)37  // LLVM: call void @_ZdlPvm(ptr [[P]], i64 4)38  // LLVM: ret void39 40  // OGCG-LABEL: test_sized_delete41  // OGCG: [[P:%.*]] = call {{.*}} ptr @_Znwm(i64 {{.*}} 4)42  // OGCG: call void @_ZdlPvm(ptr {{.*}} [[P]], i64 {{.*}} 4)43  // OGCG: ret void44}45