diff --git a/clang/lib/CIR/CodeGen/CIRGenBuiltin.cpp b/clang/lib/CIR/CodeGen/CIRGenBuiltin.cpp index ab4525d38b55..27816d833e91 100644 --- a/clang/lib/CIR/CodeGen/CIRGenBuiltin.cpp +++ b/clang/lib/CIR/CodeGen/CIRGenBuiltin.cpp @@ -337,7 +337,9 @@ RValue CIRGenFunction::buildBuiltinExpr(const GlobalDecl GD, unsigned BuiltinID, // '#pragma float_control(precise, on)'. This pragma disables fast-math, // which implies math-errno. if (E->hasStoredFPFeatures()) { - llvm_unreachable("NYI"); + FPOptionsOverride OP = E->getFPFeatures(); + if (OP.hasMathErrnoOverride()) + ErrnoOverriden = OP.getMathErrnoOverride(); } // True if 'atttibute__((optnone)) is used. This attibute overrides // fast-math which implies math-errno. @@ -1627,4 +1629,4 @@ mlir::cir::FuncOp CIRGenModule::getBuiltinLibFunction(const FunctionDecl *FD, auto Ty = getTypes().ConvertType(FD->getType()); return GetOrCreateCIRFunction(Name, Ty, D, /*ForVTable=*/false); -} \ No newline at end of file +} diff --git a/clang/test/CIR/CodeGen/builtin-abort.c b/clang/test/CIR/CodeGen/builtin-abort.c new file mode 100644 index 000000000000..d60d0efedd50 --- /dev/null +++ b/clang/test/CIR/CodeGen/builtin-abort.c @@ -0,0 +1,15 @@ +// RUN: %clang_cc1 -triple aarch64-none-linux-android21 -fclangir -emit-cir %s -o %t.cir +// RUN: FileCheck --check-prefix=CIR --input-file=%t.cir %s +// RUN: %clang_cc1 -triple aarch64-none-linux-android21 -fclangir -emit-llvm %s -o %t.ll +// RUN: FileCheck --input-file=%t.ll %s -check-prefix=LLVM + +void abort(); +void test() { abort(); } + +// TODO: Add test to test unreachable when CIR support for NORETURN is added. + +// CIR-LABEL: test +// CIR: cir.call @abort() : () -> () + +// LLVM-LABEL: test +// LLVM: call void @abort()