aco: implement 16-bit nir_op_ffract
authorSamuel Pitoiset <samuel.pitoiset@gmail.com>
Fri, 3 Apr 2020 09:07:24 +0000 (11:07 +0200)
committerSamuel Pitoiset <samuel.pitoiset@gmail.com>
Fri, 10 Apr 2020 06:05:04 +0000 (08:05 +0200)
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Daniel Schürmann <daniel@schuermann.dev>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4452>

src/amd/compiler/aco_instruction_selection.cpp

index 1c601f161c1f541afd0557c6a610766e954a1aaf..f86540944c769f76e189238e81d2d6067ad543a0 100644 (file)
@@ -1844,9 +1844,13 @@ void visit_alu_instr(isel_context *ctx, nir_alu_instr *instr)
       break;
    }
    case nir_op_ffract: {
-      if (dst.size() == 1) {
+      if (dst.regClass() == v2b) {
+         Temp src = get_alu_src(ctx, instr->src[0]);
+         Temp tmp = bld.vop1(aco_opcode::v_fract_f16, bld.def(v1), src);
+         bld.pseudo(aco_opcode::p_split_vector, Definition(dst), bld.def(v2b), tmp);
+      } else if (dst.regClass() == v1) {
          emit_vop1_instruction(ctx, instr, aco_opcode::v_fract_f32, dst);
-      } else if (dst.size() == 2) {
+      } else if (dst.regClass() == v2) {
          emit_vop1_instruction(ctx, instr, aco_opcode::v_fract_f64, dst);
       } else {
          fprintf(stderr, "Unimplemented NIR instr bit size: ");