diff options
author | Nicolai Hähnle <[email protected]> | 2017-06-25 12:57:02 +0200 |
---|---|---|
committer | Dave Airlie <[email protected]> | 2017-06-27 10:28:30 +1000 |
commit | 6ecef25545c2a7578588c337e84b2f8779eb3478 (patch) | |
tree | e0a73a88436ed9257bb94843ceb6cefafdd939b6 /src/amd | |
parent | dacf73e527a94d58407e23d3b1884d377d357f88 (diff) |
ac/nir: implement nir_op_f2b
Reviewed-by: Bas Nieuwenhuizen <[email protected]>
Signed-off-by: Dave Airlie <[email protected]>
Diffstat (limited to 'src/amd')
-rw-r--r-- | src/amd/common/ac_nir_to_llvm.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/amd/common/ac_nir_to_llvm.c b/src/amd/common/ac_nir_to_llvm.c index 8c781f2a79e..aec5d39e53e 100644 --- a/src/amd/common/ac_nir_to_llvm.c +++ b/src/amd/common/ac_nir_to_llvm.c @@ -1287,6 +1287,15 @@ static LLVMValueRef emit_b2f(struct nir_to_llvm_context *ctx, return LLVMBuildAnd(ctx->builder, src0, LLVMBuildBitCast(ctx->builder, LLVMConstReal(ctx->f32, 1.0), ctx->i32, ""), ""); } +static LLVMValueRef emit_f2b(struct ac_llvm_context *ctx, + LLVMValueRef src0) +{ + src0 = to_float(ctx, src0); + return LLVMBuildSExt(ctx->builder, + LLVMBuildFCmp(ctx->builder, LLVMRealUNE, src0, ctx->f32_0, ""), + ctx->i32, ""); +} + static LLVMValueRef emit_b2i(struct ac_llvm_context *ctx, LLVMValueRef src0) { @@ -1822,6 +1831,9 @@ static void visit_alu(struct nir_to_llvm_context *ctx, const nir_alu_instr *inst case nir_op_b2f: result = emit_b2f(ctx, src[0]); break; + case nir_op_f2b: + result = emit_f2b(&ctx->ac, src[0]); + break; case nir_op_b2i: result = emit_b2i(&ctx->ac, src[0]); break; |