From 7dfb15fff1d765689353419c0a0ac9c96786b021 Mon Sep 17 00:00:00 2001 From: Samuel Pitoiset Date: Mon, 14 Oct 2019 15:36:37 +0200 Subject: [PATCH] ac/llvm: add AC_FLOAT_MODE_ROUND_TO_ZERO Because some instructions will be optimized by the backend compiler, the driver has to manually flush to zero to keep the result exact. Signed-off-by: Samuel Pitoiset Reviewed-by: Bas Nieuwenhuizen --- src/amd/llvm/ac_llvm_build.c | 1 + src/amd/llvm/ac_llvm_build.h | 2 ++ src/amd/llvm/ac_llvm_helper.cpp | 1 + src/amd/llvm/ac_llvm_util.h | 1 + 4 files changed, 5 insertions(+) diff --git a/src/amd/llvm/ac_llvm_build.c b/src/amd/llvm/ac_llvm_build.c index 87adf2b4432..d9ece7049c7 100644 --- a/src/amd/llvm/ac_llvm_build.c +++ b/src/amd/llvm/ac_llvm_build.c @@ -73,6 +73,7 @@ ac_llvm_context_init(struct ac_llvm_context *ctx, ctx->family = family; ctx->wave_size = wave_size; ctx->ballot_mask_bits = ballot_mask_bits; + ctx->float_mode = float_mode; ctx->module = ac_create_module(wave_size == 32 ? compiler->tm_wave32 : compiler->tm, ctx->context); diff --git a/src/amd/llvm/ac_llvm_build.h b/src/amd/llvm/ac_llvm_build.h index a67e1d49d4d..8cd15cbe99f 100644 --- a/src/amd/llvm/ac_llvm_build.h +++ b/src/amd/llvm/ac_llvm_build.h @@ -120,6 +120,8 @@ struct ac_llvm_context { unsigned wave_size; unsigned ballot_mask_bits; + unsigned float_mode; + LLVMValueRef lds; }; diff --git a/src/amd/llvm/ac_llvm_helper.cpp b/src/amd/llvm/ac_llvm_helper.cpp index b7a72ee3fdd..7f3ff71fd9c 100644 --- a/src/amd/llvm/ac_llvm_helper.cpp +++ b/src/amd/llvm/ac_llvm_helper.cpp @@ -82,6 +82,7 @@ LLVMBuilderRef ac_create_builder(LLVMContextRef ctx, switch (float_mode) { case AC_FLOAT_MODE_DEFAULT: + case AC_FLOAT_MODE_DENORM_FLUSH_TO_ZERO: break; case AC_FLOAT_MODE_NO_SIGNED_ZEROS_FP_MATH: flags.setNoSignedZeros(); diff --git a/src/amd/llvm/ac_llvm_util.h b/src/amd/llvm/ac_llvm_util.h index 60c9a17e447..a864f524fbe 100644 --- a/src/amd/llvm/ac_llvm_util.h +++ b/src/amd/llvm/ac_llvm_util.h @@ -73,6 +73,7 @@ enum ac_float_mode { AC_FLOAT_MODE_DEFAULT, AC_FLOAT_MODE_NO_SIGNED_ZEROS_FP_MATH, AC_FLOAT_MODE_UNSAFE_FP_MATH, + AC_FLOAT_MODE_DENORM_FLUSH_TO_ZERO, }; /* Per-thread persistent LLVM objects. */ -- 2.30.2