diff options
author | Samuel Pitoiset <[email protected]> | 2018-01-31 11:23:58 +0100 |
---|---|---|
committer | Samuel Pitoiset <[email protected]> | 2018-01-31 14:10:24 +0100 |
commit | 26cc3e74b97864a8b879b169bdd6357c6e0ca2b1 (patch) | |
tree | acdc9828d9d521469e7e9153176af9dd8e6d275b /src/amd | |
parent | 2f0db33527fc5415858e60d76d5b82c5492151fa (diff) |
ac/nir: fix emission of ffract for 64-bit
Signed-off-by: Samuel Pitoiset <[email protected]>
Reviewed-by: Bas Nieuwenhuizen <[email protected]>
Diffstat (limited to 'src/amd')
-rw-r--r-- | src/amd/common/ac_nir_to_llvm.c | 23 |
1 files changed, 16 insertions, 7 deletions
diff --git a/src/amd/common/ac_nir_to_llvm.c b/src/amd/common/ac_nir_to_llvm.c index fd5989389b7..04fe51935a7 100644 --- a/src/amd/common/ac_nir_to_llvm.c +++ b/src/amd/common/ac_nir_to_llvm.c @@ -1383,15 +1383,24 @@ static LLVMValueRef emit_isign(struct ac_llvm_context *ctx, } static LLVMValueRef emit_ffract(struct ac_llvm_context *ctx, - LLVMValueRef src0) + LLVMValueRef src0, unsigned bitsize) { - const char *intr = "llvm.floor.f32"; + LLVMTypeRef type; + char *intr; + + if (bitsize == 32) { + intr = "llvm.floor.f32"; + type = ctx->f32; + } else { + intr = "llvm.floor.f64"; + type = ctx->f64; + } + LLVMValueRef fsrc0 = ac_to_float(ctx, src0); LLVMValueRef params[] = { fsrc0, }; - LLVMValueRef floor = ac_build_intrinsic(ctx, intr, - ctx->f32, params, 1, + LLVMValueRef floor = ac_build_intrinsic(ctx, intr, type, params, 1, AC_FUNC_ATTR_READNONE); return LLVMBuildFSub(ctx->builder, fsrc0, floor, ""); } @@ -1845,7 +1854,7 @@ static void visit_alu(struct ac_nir_context *ctx, const nir_alu_instr *instr) ac_to_float_type(&ctx->ac, def_type),src[0]); break; case nir_op_ffract: - result = emit_ffract(&ctx->ac, src[0]); + result = emit_ffract(&ctx->ac, src[0], instr->dest.dest.ssa.bit_size); break; case nir_op_fsin: result = emit_intrin_1f_param(&ctx->ac, "llvm.sin", @@ -4026,8 +4035,8 @@ static LLVMValueRef load_sample_pos(struct ac_nir_context *ctx) { LLVMValueRef values[2]; - values[0] = emit_ffract(&ctx->ac, ctx->abi->frag_pos[0]); - values[1] = emit_ffract(&ctx->ac, ctx->abi->frag_pos[1]); + values[0] = emit_ffract(&ctx->ac, ctx->abi->frag_pos[0], 32); + values[1] = emit_ffract(&ctx->ac, ctx->abi->frag_pos[1], 32); return ac_build_gather_values(&ctx->ac, values, 2); } |