mirror of
https://github.com/c3lang/c3c.git
synced 2026-02-27 20:11:17 +00:00
Add $$select. "--fp-math" options. Fixed issue with accidentally silent error on failed vector conversions.
This commit is contained in:
committed by
Christoffer Lerno
parent
b894e5be69
commit
4ef74a1205
@@ -60,7 +60,12 @@ typedef enum
|
||||
AR_COFF,
|
||||
} ArFormat;
|
||||
|
||||
|
||||
typedef enum
|
||||
{
|
||||
STRICT,
|
||||
RELAXED,
|
||||
FAST
|
||||
} FastMathOption;
|
||||
|
||||
static bool llvm_link(ObjFormat format, const char **args, int arg_count, const char** error_string)
|
||||
{
|
||||
@@ -179,6 +184,26 @@ extern "C" {
|
||||
machine->Options.UseInitArray = use_init_array;
|
||||
}
|
||||
|
||||
void LLVMBuilderSetFastMathFlags(LLVMBuilderRef Builder, FastMathOption option)
|
||||
{
|
||||
llvm::FastMathFlags math_flags {};
|
||||
switch (option)
|
||||
{
|
||||
case RELAXED:
|
||||
math_flags.setAllowReassoc(true);
|
||||
math_flags.setAllowReciprocal(true);
|
||||
math_flags.setAllowContract(true);
|
||||
break;
|
||||
case FAST:
|
||||
math_flags.setFast(true);
|
||||
break;
|
||||
case STRICT:
|
||||
default:
|
||||
return;
|
||||
}
|
||||
llvm::unwrap(Builder)->setFastMathFlags(math_flags);
|
||||
}
|
||||
|
||||
LLVMValueRef LLVMConstBswap(LLVMValueRef ConstantVal)
|
||||
{
|
||||
llvm::Constant *Val = llvm::unwrap<llvm::Constant>(ConstantVal);
|
||||
|
||||
Reference in New Issue
Block a user