diff options
author | Marek Olšák <[email protected]> | 2019-10-08 00:08:19 -0400 |
---|---|---|
committer | Marek Olšák <[email protected]> | 2019-10-10 15:57:50 -0400 |
commit | b7fc082b2876864ac3088aa9d25930fe8b81c372 (patch) | |
tree | a6d6cb96cb3bccf805653101c83585cbe5826121 /src/amd | |
parent | 09e0e4c93c3fe03d6ab664813f64378095c72454 (diff) |
ac/nir: add back nir_op_fmod
radeonsi doesn't lower it for doubles.
This partially reverts commit d861401554b52b2c2fc6721c69bdfe1697ee608f.
Reviewed-by: Timothy Arceri <[email protected]>
Reviewed-by: Kenneth Graunke <[email protected]>
Diffstat (limited to 'src/amd')
-rw-r--r-- | src/amd/llvm/ac_nir_to_llvm.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/amd/llvm/ac_nir_to_llvm.c b/src/amd/llvm/ac_nir_to_llvm.c index 41b71cd63a5..b08483e5cf4 100644 --- a/src/amd/llvm/ac_nir_to_llvm.c +++ b/src/amd/llvm/ac_nir_to_llvm.c @@ -548,6 +548,17 @@ static void visit_alu(struct ac_nir_context *ctx, const nir_alu_instr *instr) case nir_op_umod: result = LLVMBuildURem(ctx->ac.builder, src[0], src[1], ""); break; + case nir_op_fmod: + /* lower_fmod only lower 16-bit and 32-bit fmod */ + assert(instr->dest.dest.ssa.bit_size == 64); + src[0] = ac_to_float(&ctx->ac, src[0]); + src[1] = ac_to_float(&ctx->ac, src[1]); + result = ac_build_fdiv(&ctx->ac, src[0], src[1]); + result = emit_intrin_1f_param(&ctx->ac, "llvm.floor", + ac_to_float_type(&ctx->ac, def_type), result); + result = LLVMBuildFMul(ctx->ac.builder, src[1] , result, ""); + result = LLVMBuildFSub(ctx->ac.builder, src[0], result, ""); + break; case nir_op_irem: result = LLVMBuildSRem(ctx->ac.builder, src[0], src[1], ""); break; |