Hi Juzhe,

I'm happy to take the hunks, just that I can't test it and don't know the 
specifics of how it lens work.
I still need to read up on it.

I tried adding that chunk in, but for the first bit `lens` seems undefined, and 
the second bit it seems `bias` is undefined.

I'll also need what to do for vectorizable_live_operations how to get the first 
element rather than the last.

Thanks,
Tamar

From: juzhe.zh...@rivai.ai <juzhe.zh...@rivai.ai>
Sent: Thursday, November 30, 2023 4:48 AM
To: gcc-patches <gcc-patches@gcc.gnu.org>
Cc: Richard Biener <richard.guent...@gmail.com>; Tamar Christina 
<tamar.christ...@arm.com>
Subject: [PATCH 9/21]middle-end: implement vectorizable_early_exit for codegen 
of exit code

Hi, Richard and Tamar.

I am sorry for bothering you.
Hope you don't mind I give some comments:

Can we support partial vector for length ?

IMHO, we can do that as follows:

bool length_loop_p = LOOP_VINFO_FULLY_WITH_LENGTH_P (loop_vinfo);

if (LOOP_VINFO_CAN_USE_PARTIAL_VECTORS_P (loop_vinfo))
  {
    if (direct_internal_fn_supported_p (IFN_VCOND_MASK_LEN, vectype,
                                        OPTIMIZE_FOR_SPEED))
      vect_record_loop_len (loop_vinfo, lens, ncopies, vectype, 1);
    else
      vect_record_loop_mask (loop_vinfo, masks, ncopies, truth_type, NULL);
  }

if (length_loop_p)
  {
    tree len = vect_get_loop_len (loop_vinfo, gsi, loop_lens, 1, vectype, 0, 0);
    /* Use VCOND_MASK_LEN (all true, cond, all false, len, bias) to generate
       final mask = i < len + bias ? cond[i] : false.  */
    cond = gimple_build (&cond_gsi, IFN_VCOND_MASK_LEN, truth_type,
                         all true mask, cond, all false mask, len, bias);
  }
else if (masked_loop_p)
  {
    tree mask
      = vect_get_loop_mask (loop_vinfo, gsi, masks, ncopies, truth_type, 0);
    cond
      = prepare_vec_mask (loop_vinfo, TREE_TYPE (mask), mask, cond, &cond_gsi);
  }

This is a prototype. Is this idea reasonable to Richi ?

Thanks.

________________________________
juzhe.zh...@rivai.ai<mailto:juzhe.zh...@rivai.ai>

Reply via email to