From 55d153b9f598c77510a483ba768eca2103bf850b Mon Sep 17 00:00:00 2001 From: Jesse Natalie Date: Thu, 18 Mar 2021 18:46:09 -0700 Subject: [PATCH] nir: Temporarily disable optimizations for MSVC ARM64 There's currently an MSVC optimizer bug which causes a stack overflow in the compiler if it attempts to optimize fsat. Acked-by: Rob Clark Acked-by: Jason Ekstrand Part-of: --- src/compiler/nir/nir_constant_expressions.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/compiler/nir/nir_constant_expressions.py b/src/compiler/nir/nir_constant_expressions.py index 90ee5c339b6..606e974353f 100644 --- a/src/compiler/nir/nir_constant_expressions.py +++ b/src/compiler/nir/nir_constant_expressions.py @@ -459,6 +459,11 @@ struct ${type}${width}_vec { % for name, op in sorted(opcodes.items()): +% if op.name == "fsat": +#if defined(_MSC_VER) && (defined(_M_ARM64) || defined(_M_ARM64EC)) +#pragma optimize("", off) /* Temporary work-around for MSVC compiler bug, present in VS2019 16.9.2 */ +#endif +% endif static void evaluate_${name}(nir_const_value *_dst_val, UNUSED unsigned num_components, @@ -482,6 +487,11 @@ evaluate_${name}(nir_const_value *_dst_val, ${evaluate_op(op, 0, execution_mode)} % endif } +% if op.name == "fsat": +#if defined(_MSC_VER) && (defined(_M_ARM64) || defined(_M_ARM64EC)) +#pragma optimize("", on) /* Temporary work-around for MSVC compiler bug, present in VS2019 16.9.2 */ +#endif +% endif % endfor void