This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH, PR middle-end/68134] Reject scalar modes in default get_mask_mode hook


On 17/11/15 11:49, Ilya Enkovich wrote:
Hi,

Default hook for get_mask_mode is supposed to return integer vector modes.  This means it should reject calar modes returned by mode_for_vector.  Bootstrapped and regtested on x86_64-unknown-linux-gnu, regtested on aarch64-unknown-linux-gnu.  OK for trunk?

Thanks,
Ilya
--
gcc/

2015-11-17  Ilya Enkovich  <enkovich.gnu@gmail.com>

	PR middle-end/68134
	* targhooks.c (default_get_mask_mode): Filter out
	scalar modes returned by mode_for_vector.

I've been playing around with a patch that expands arbitrary VEC_COND_EXPRs using the vec_cmp and vcond_mask optabs - allowing platforms to drop the ugly vcond<mode><mode> pattern (for which a cross-product of modes is usually required) where vcond = vec_cmp + vcond_mask. (E.g. ARM and AArch64.)

Mostly this is fairly straightforward, relatively little midend code is required, and the backend cleans up quite a bit. However, I get stuck on the case of singleton vectors (64x1). No surprises there, then...

The PR/68134 fix, makes the 'mask mode' for comparing 64x1 vectors, into BLKmode, so that we get past this in expand_vector_operations:

/* A scalar operation pretending to be a vector one.  */
  if (VECTOR_BOOLEAN_TYPE_P (type)
      && !VECTOR_MODE_P (TYPE_MODE (type))
      && TYPE_MODE (type) != BLKmode)
    return;

and we do the operation piecewise. (Which is what we want; there is only one piece!)

However, with my vec_cmp + vcond_mask changes, dropping vconddidi, this means we look for a vcond_maskdiblk and vec_cmpdiblk. Which doesn't really feel right - it feels like the 64x1 mask should be a DImode, just like other 64x1 vectors.

So, I'm left thinking - is there a better way to look for "scalar operations pretending to be vector ones", such that we can get a DImode vec<bool> through the above? What exactly do we want that check to do? In my AArch64 testing, I was able to take it out altogether and get all tests passing...? (I don't have AVX512 hardware)

Thanks, Alan


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]