return LLVMBuildAnd(ctx->builder, src0, LLVMBuildBitCast(ctx->builder, LLVMConstReal(ctx->f32, 1.0), ctx->i32, ""), "");
}
+static LLVMValueRef emit_b2i(struct ac_llvm_context *ctx,
+ LLVMValueRef src0)
+{
+ return LLVMBuildAnd(ctx->builder, src0, ctx->i32_1, "");
+}
+
+static LLVMValueRef emit_i2b(struct ac_llvm_context *ctx,
+ LLVMValueRef src0)
+{
+ return LLVMBuildSExt(ctx->builder,
+ LLVMBuildICmp(ctx->builder, LLVMIntNE, src0, ctx->i32_0, ""),
+ ctx->i32, "");
+}
+
static LLVMValueRef emit_f2f16(struct nir_to_llvm_context *ctx,
LLVMValueRef src0)
{
case nir_op_b2f:
result = emit_b2f(ctx, src[0]);
break;
+ case nir_op_b2i:
+ result = emit_b2i(&ctx->ac, src[0]);
+ break;
+ case nir_op_i2b:
+ result = emit_i2b(&ctx->ac, src[0]);
+ break;
case nir_op_fquantize2f16:
result = emit_f2f16(ctx, src[0]);
break;