brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.5 KiB · 0e43480 Raw
43 lines · cpp
1// RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -Wno-unused-value -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 -Wno-unused-value -fclangir -emit-llvm %s -o %t-cir.ll4// RUN: FileCheck --input-file=%t-cir.ll %s -check-prefix=LLVM5// RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -Wno-unused-value -emit-llvm %s -o %t.ll6// RUN: FileCheck --input-file=%t.ll %s -check-prefix=OGCG7 8double fabs(double x) {9  return __builtin_fabs(x);10}11 12// CIR: {{.*}} = cir.fabs {{.*}} : !cir.double13// LLVM: {{.*}} = call double @llvm.fabs.f64(double {{.*}})14// OGCG: {{.*}} = call double @llvm.fabs.f64(double {{.*}})15 16extern "C" void *test_return_address(void) {17  return __builtin_return_address(1);18 19  // CIR-LABEL: test_return_address20  // CIR: [[ARG:%.*]] = cir.const #cir.int<1> : !u32i21  // CIR: {{%.*}} = cir.return_address([[ARG]])22 23  // LLVM-LABEL: @test_return_address24  // LLVM: {{%.*}} = call ptr @llvm.returnaddress(i32 1)25 26  // OGCG-LABEL: @test_return_address27  // OGCG: {{%.*}} = call ptr @llvm.returnaddress(i32 1)28}29 30extern "C" void *test_frame_address(void) {31  return __builtin_frame_address(1);32 33  // CIR-LABEL: test_frame_address34  // CIR: [[ARG:%.*]] = cir.const #cir.int<1> : !u32i35  // CIR: {{%.*}} = cir.frame_address([[ARG]])36 37  // LLVM-LABEL: @test_frame_address38  // LLVM: {{%.*}} = call ptr @llvm.frameaddress.p0(i32 1)39 40  // OGCG-LABEL: @test_frame_address41  // OGCG: {{%.*}} = call ptr @llvm.frameaddress.p0(i32 1)42}43