freedreno/ir3: Implement f2b16 and i2b16
authorNeil Roberts <nroberts@igalia.com>
Wed, 27 Feb 2019 10:58:18 +0000 (11:58 +0100)
committerNeil Roberts <nroberts@igalia.com>
Wed, 20 Nov 2019 13:09:43 +0000 (14:09 +0100)
Reviewed-by: Rob Clark <robdclark@gmail.com>
src/freedreno/ir3/ir3_compiler_nir.c

index f4ff6a6314aed59f5e74d667d4cb88b1546a6114..895ba9771ddb558a6e5db95a9302e0dc1f45a3bc 100644 (file)
@@ -385,6 +385,12 @@ emit_alu(struct ir3_context *ctx, nir_alu_instr *alu)
                                                        create_cov(ctx, src[0], 32, nir_op_f2f16),
                                                        16, nir_op_f2f32);
                break;
+       case nir_op_f2b16: {
+               struct ir3_instruction *zero = create_immed_typed(b, 0, TYPE_F16);
+               dst[0] = ir3_CMPS_F(b, src[0], 0, zero, 0);
+               dst[0]->cat2.condition = IR3_COND_NE;
+               break;
+       }
        case nir_op_f2b32:
                dst[0] = ir3_CMPS_F(b, src[0], 0, create_immed(b, fui(0.0)), 0);
                dst[0]->cat2.condition = IR3_COND_NE;
@@ -400,6 +406,12 @@ emit_alu(struct ir3_context *ctx, nir_alu_instr *alu)
        case nir_op_b2i32:
                dst[0] = ir3_b2n(b, src[0]);
                break;
+       case nir_op_i2b16: {
+               struct ir3_instruction *zero = create_immed_typed(b, 0, TYPE_S16);
+               dst[0] = ir3_CMPS_S(b, src[0], 0, zero, 0);
+               dst[0]->cat2.condition = IR3_COND_NE;
+               break;
+       }
        case nir_op_i2b32:
                dst[0] = ir3_CMPS_S(b, src[0], 0, create_immed(b, 0), 0);
                dst[0]->cat2.condition = IR3_COND_NE;