ac: set fast math flags when RADV_DEBUG="unsafemath" is used
authorSamuel Pitoiset <samuel.pitoiset@gmail.com>
Mon, 15 Jan 2018 13:51:44 +0000 (14:51 +0100)
committerSamuel Pitoiset <samuel.pitoiset@gmail.com>
Tue, 16 Jan 2018 20:39:55 +0000 (21:39 +0100)
When that debug option is not used, we use the default float mode
because the no signed zeros optimisation is not Vulkan compatible.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
src/amd/common/ac_nir_to_llvm.c

index aca9a0a2601ea8beec29f64b92622128af906917..635a74d243055cbda9d5e2812b4003055a20738b 100644 (file)
@@ -6683,7 +6683,11 @@ LLVMModuleRef ac_translate_nir_to_llvm(LLVMTargetMachineRef tm,
        LLVMDisposeTargetData(data_layout);
        LLVMDisposeMessage(data_layout_str);
 
-       ctx.builder = LLVMCreateBuilderInContext(ctx.context);
+       enum ac_float_mode float_mode =
+               options->unsafe_math ? AC_FLOAT_MODE_UNSAFE_FP_MATH :
+                                      AC_FLOAT_MODE_DEFAULT;
+
+       ctx.builder = ac_create_builder(ctx.context, float_mode);
        ctx.ac.builder = ctx.builder;
 
        memset(shader_info, 0, sizeof(*shader_info));
@@ -7095,7 +7099,11 @@ void ac_create_gs_copy_shader(LLVMTargetMachineRef tm,
        ctx.is_gs_copy_shader = true;
        LLVMSetTarget(ctx.module, "amdgcn--");
 
-       ctx.builder = LLVMCreateBuilderInContext(ctx.context);
+       enum ac_float_mode float_mode =
+               options->unsafe_math ? AC_FLOAT_MODE_UNSAFE_FP_MATH :
+                                      AC_FLOAT_MODE_DEFAULT;
+
+       ctx.builder = ac_create_builder(ctx.context, float_mode);
        ctx.ac.builder = ctx.builder;
        ctx.stage = MESA_SHADER_VERTEX;