nir: use bitfield_insert instead of bfi in nir_lower_double_ops
authorBen Skeggs <bskeggs@redhat.com>
Sat, 6 Jun 2020 06:58:00 +0000 (16:58 +1000)
committerBen Skeggs <bskeggs@redhat.com>
Mon, 8 Jun 2020 22:38:22 +0000 (08:38 +1000)
NVIDIA hardware doesn't have an equivilant to bfi, but we do already have
a lowering for bitfield_insert->bfi.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5373>

src/compiler/nir/nir_lower_double_ops.c

index f9c93a910a5210d8e0e5bced31cdffb955b28a8a..73226fd62ef20ff6ffde222ae91e101cf9594e8b 100644 (file)
@@ -49,7 +49,9 @@ set_exponent(nir_builder *b, nir_ssa_def *src, nir_ssa_def *exp)
    /* The exponent is bits 52-62, or 20-30 of the high word, so set the exponent
     * to 1023
     */
-   nir_ssa_def *new_hi = nir_bfi(b, nir_imm_int(b, 0x7ff00000), exp, hi);
+   nir_ssa_def *new_hi = nir_bitfield_insert(b, hi, exp,
+                                             nir_imm_int(b, 20),
+                                             nir_imm_int(b, 11));
    /* recombine */
    return nir_pack_64_2x32_split(b, lo, new_hi);
 }