diff --git a/src/compiler/llvm_codegen.c b/src/compiler/llvm_codegen.c index 5bebe717b..9824e70d1 100644 --- a/src/compiler/llvm_codegen.c +++ b/src/compiler/llvm_codegen.c @@ -641,11 +641,15 @@ static void llvm_codegen_setup() intrinsic_id.exp2 = lookup_intrinsic("llvm.exp2"); intrinsic_id.fabs = lookup_intrinsic("llvm.fabs"); intrinsic_id.floor = lookup_intrinsic("llvm.floor"); - intrinsic_id.flt_rounds = lookup_intrinsic("llvm.flt.rounds"); intrinsic_id.fma = lookup_intrinsic("llvm.fma"); intrinsic_id.frameaddress = lookup_intrinsic("llvm.frameaddress"); intrinsic_id.fshl = lookup_intrinsic("llvm.fshl"); intrinsic_id.fshr = lookup_intrinsic("llvm.fshr"); +#if LLVM_VERSION_MAJOR < 16 + intrinsic_id.get_rounding = lookup_intrinsic("llvm.flt.rounds"); +#else + intrinsic_id.get_rounding = lookup_intrinsic("llvm.get.rounding"); +#endif intrinsic_id.lifetime_end = lookup_intrinsic("llvm.lifetime.end"); intrinsic_id.lifetime_start = lookup_intrinsic("llvm.lifetime.start"); intrinsic_id.llrint = lookup_intrinsic("llvm.llrint"); diff --git a/src/compiler/llvm_codegen_builtins.c b/src/compiler/llvm_codegen_builtins.c index cf5db496e..f462bd470 100644 --- a/src/compiler/llvm_codegen_builtins.c +++ b/src/compiler/llvm_codegen_builtins.c @@ -688,7 +688,7 @@ void llvm_emit_builtin_call(GenContext *c, BEValue *result_value, Expr *expr) llvm_emit_simple_builtin(c, result_value, expr, intrinsic_id.fshr); return; case BUILTIN_GET_ROUNDING_MODE: - llvm_value_set(result_value, llvm_emit_call_intrinsic(c, intrinsic_id.flt_rounds, NULL, 0, NULL, 0), expr->type); + llvm_value_set(result_value, llvm_emit_call_intrinsic(c, intrinsic_id.get_rounding, NULL, 0, NULL, 0), expr->type); return; case BUILTIN_LOG: llvm_emit_simple_builtin(c, result_value, expr, intrinsic_id.log); diff --git a/src/compiler/llvm_codegen_internal.h b/src/compiler/llvm_codegen_internal.h index c9b068ed0..8ec85522d 100644 --- a/src/compiler/llvm_codegen_internal.h +++ b/src/compiler/llvm_codegen_internal.h @@ -133,12 +133,12 @@ typedef struct unsigned exp2; unsigned fabs; unsigned floor; - unsigned flt_rounds; unsigned fma; unsigned fmuladd; unsigned frameaddress; unsigned fshl; unsigned fshr; + unsigned get_rounding; unsigned lifetime_end; unsigned lifetime_start; unsigned llrint;