gallivm: fix 64->16 f2f16
authorDave Airlie <airlied@redhat.com>
Thu, 8 Oct 2020 03:17:56 +0000 (13:17 +1000)
committerDave Airlie <airlied@redhat.com>
Sun, 25 Oct 2020 23:55:35 +0000 (09:55 +1000)
llvm appears to callout to a library to do 64-bit->16-bit
fp trunc, just trunc to 32-bit first to avoid it.

Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7309>

.gitlab-ci/piglit/cl.txt
src/gallium/auxiliary/gallivm/lp_bld_nir.c

index ecd8d6e..8b693ca 100644 (file)
@@ -194,18 +194,12 @@ program/execute/vload/vload-half-private: skip
 program/execute/vstore/vstore-half-global: skip
 program/execute/vstore/vstore-half-local: skip
 program/execute/vstore/vstore-half-private: skip
-program/execute/vstore/vstore_half-double-global: crash
-program/execute/vstore/vstore_half-double-local: crash
-program/execute/vstore/vstore_half-double-private: crash
-program/execute/vstore/vstorea_half-double-global: crash
-program/execute/vstore/vstorea_half-double-local: crash
-program/execute/vstore/vstorea_half-double-private: crash
 summary:
        name:  results
        ----  --------
-       pass:     3560
+       pass:     3627
        fail:      107
-      crash:       18
+      crash:       12
        skip:       73
     timeout:        4
        warn:        0
@@ -215,4 +209,4 @@ summary:
     changes:        0
       fixes:        0
 regressions:        0
-      total:     3762
+      total:     3823
index 2805434..7c4db4f 100644 (file)
@@ -492,6 +492,9 @@ static LLVMValueRef do_alu_action(struct lp_build_nir_context *bld_base,
       result = flt_to_bool32(bld_base, src_bit_size[0], src[0]);
       break;
    case nir_op_f2f16:
+      if (src_bit_size[0] == 64)
+         src[0] = LLVMBuildFPTrunc(builder, src[0],
+                                   bld_base->base.vec_type, "");
       result = LLVMBuildFPTrunc(builder, src[0],
                                 LLVMVectorType(LLVMHalfTypeInContext(gallivm->context), bld_base->base.type.length), "");
       break;