aco: fix nir_op_pack_32_2x16_split if one operand is a constant
authorSamuel Pitoiset <samuel.pitoiset@gmail.com>
Sat, 4 Apr 2020 08:07:51 +0000 (10:07 +0200)
committerMarge Bot <eric+marge@anholt.net>
Mon, 13 Apr 2020 11:51:17 +0000 (11:51 +0000)
Because 16-bit constants are represented with the s1 RegClass, we
have to extract the low half.

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/4509>

src/amd/compiler/aco_instruction_selection.cpp

index f713a7610083ba4330f6eb826e9835c4de3b312b..bc973a05e5a326f113f47335cd10f5b751a0c624 100644 (file)
@@ -2771,6 +2771,8 @@ void visit_alu_instr(isel_context *ctx, nir_alu_instr *instr)
       Temp src0 = get_alu_src(ctx, instr->src[0]);
       Temp src1 = get_alu_src(ctx, instr->src[1]);
       if (dst.regClass() == v1) {
+         src0 = emit_extract_vector(ctx, src0, 0, v2b);
+         src1 = emit_extract_vector(ctx, src1, 0, v2b);
          bld.pseudo(aco_opcode::p_create_vector, Definition(dst), src0, src1);
       } else {
          src0 = bld.sop2(aco_opcode::s_and_b32, bld.def(s1), bld.def(s1, scc), src0, Operand(0xFFFFu));