Skip to content

nir/lower_io: Set src_type if store intrinsic supports it

Christian Gmeiner requested to merge austriancoder/mesa:nir-src-type into main

What does this MR do and why?

nir/lower_io: Set src_type if store intrinsic supports it

etnaviv supports different inline immediate types (float, int, ...),
which are stored in 20bit per src in the encoded instruction.

Let's have a look at the follwing nir shader:

impl __wrapped_test {
    block b0:  // preds:
    32    %0 = load_const (0x00000000)
    32    %1 = @load_kernel_input (%0 (0x0)) (base=0, range=4, align_mul=256, align_offset=0)
    32    %2 = load_const (0xffffffff = -nan = -1 = 4294967295)
               @store_global (%2 (0xffffffff), %1) (wrmask=x, access=none, align_mul=4, align_offset=0)
               // succs: b1
    block b1:
}

As nir is un-typed, it is not possible to choose the correct immed type.

With this change, all store instruction's that are supporting the SRC_TYPE
index, will gain the needed information.

impl __wrapped_test {
    block b0:  // preds:
    32    %5 = load_const (0x00000000)
    32    %4 = @load_kernel_input (%5 (0x0)) (base=0, range=4, align_mul=256, align_offset=0)
    32    %3 = load_const (0xffffffff = -nan = -1 = 4294967295)
               @store_global (%3 (0xffffffff), %4) (wrmask=x, access=none, align_mul=4, align_offset=0, src_type=uint32)
               // succs: b1
    block b1:
}

Signed-off-by: Christian Gmeiner <cgmeiner@igalia.com>

Merge request reports