ac: set new LLVM denormal flags
authorMarek Olšák <marek.olsak@amd.com>
Mon, 6 Jan 2020 20:27:15 +0000 (15:27 -0500)
committerMarge Bot <eric+marge@anholt.net>
Tue, 17 Mar 2020 20:47:48 +0000 (20:47 +0000)
See: https://reviews.llvm.org/D71358

Acked-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4196>

src/amd/llvm/ac_llvm_build.c

index 93e2e28121348cbfb13bceac09b0cc776a9e8364..dcbd4efeacf2e0755291ff55fcbdf2e141105338 100644 (file)
@@ -4984,6 +4984,15 @@ ac_build_main(const struct ac_shader_args *args,
        }
 
        ctx->main_function = main_function;
+
+       if (LLVM_VERSION_MAJOR >= 11) {
+               /* Enable denormals for FP16 and FP64: */
+               LLVMAddTargetDependentFunctionAttr(main_function, "denormal-fp-math",
+                                                  "ieee,ieee");
+               /* Disable denormals for FP32: */
+               LLVMAddTargetDependentFunctionAttr(main_function, "denormal-fp-math-f32",
+                                                  "preserve-sign,preserve-sign");
+       }
        return main_function;
 }