[PATCH][RFC] 256bit AVX vectorization support

Richard Henderson rth@redhat.com
Wed Oct 13 16:50:00 GMT 2010


On 10/13/2010 09:19 AM, H.J. Lu wrote:
> +(define_mode_iterator STORENT_MODE
> +  [(SF "TARGET_SSE4A") (DF "TARGET_SSE4A")
> +   (SI "TARGET_SSE2") (V2DI "TARGET_SSE2") (V2DF "TARGET_SSE2")
> +   (V4SF "TARGET_SSE")
> +   (V4DF "TARGET_AVX") (V8SF "TARGET_AVX")])

Since all modes have a condition here ...

>  (define_expand "storent<mode>"
> +  [(set (match_operand:STORENT_MODE 0 "memory_operand" "")
> +	(unspec:STORENT_MODE
> +	  [(match_operand:STORENT_MODE 1 "register_operand" "")]
>  	  UNSPEC_MOVNT))]
> +  "TARGET_SSE")

... I think you don't need one here.


>  (define_expand "<code><mode>2"
> +  [(set (match_operand:AVX256MODEF2P 0 "register_operand" "")
> +	(absneg:AVX256MODEF2P
> +	  (match_operand:AVX256MODEF2P 1 "register_operand" "")))]
> +  "AVX256_VEC_FLOAT_MODE_P (<MODE>mode)"
> +  "ix86_expand_fp_absneg_operator (<CODE>, <MODE>mode, operands); DONE;")
...
>  (define_expand "copysign<mode>3"
>    [(set (match_dup 4)
> +	(and:AVX256MODEF2P 
> +	  (not:AVX256MODEF2P (match_dup 3))
> +	  (match_operand:AVX256MODEF2P 1 "nonimmediate_operand" "")))
> +   (set (match_dup 5)
> +	(and:AVX256MODEF2P (match_dup 3)
> +			   (match_operand:AVX256MODEF2P 2 "nonimmediate_operand" "")))
> +   (set (match_operand:AVX256MODEF2P 0 "register_operand" "")
> +	(ior:AVX256MODEF2P (match_dup 4) (match_dup 5)))]
> +  "AVX256_VEC_FLOAT_MODE_P (<MODE>mode)"
...
>  (define_expand "vec_extract<mode>"
> +  [(match_operand:<avxscalarmode> 0 "register_operand" "")
> +   (match_operand:AVX256MODEF2P 1 "register_operand" "")
> +   (match_operand 2 "const_int_operand" "")]
> +  "TARGET_AVX"

However my same comment about not duplicating expander patterns
applies to these other instances as well.

> +(define_insn "*vec_concat_lo_<mode>_avx"

You didn't understand my comment about avx_vpermilp_parallel at
all, you merely doubled the number of patterns.  My point is
that you would only need 1 (one) pattern.

Please examine 

(define_insn "*avx_vpermilp<mode>"
  [(set (match_operand:AVXMODEF2P 0 "register_operand" "=x")
        (vec_select:AVXMODEF2P
          (match_operand:AVXMODEF2P 1 "nonimmediate_operand" "xm")
          (match_parallel 2 "avx_vpermilp_<mode>_operand"
            [(match_operand 3 "const_int_operand" "")])))]
  "TARGET_AVX"
{
  int mask = avx_vpermilp_parallel (operands[2], <MODE>mode) - 1;
  operands[2] = GEN_INT (mask);
  return "vpermil<ssemodesuffix>\t{%2, %1, %0|%0, %1, %2}";
}

and see how you can use the exact same technique for vperm2f128.


r~



More information about the Gcc-patches mailing list