public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH i386 AVX512] [37/n] Extend max/min insn patterns.
@ 2014-09-11 13:08 Kirill Yukhin
  2014-09-11 18:10 ` Uros Bizjak
  0 siblings, 1 reply; 3+ messages in thread
From: Kirill Yukhin @ 2014-09-11 13:08 UTC (permalink / raw)
  To: Uros Bizjak; +Cc: Jakub Jelinek, Richard Henderson, GCC Patches, kirill.yukhin

Hello,
Patch in the bottom extends integer max/min patterns.
Also, it seems, like rounding variant was generated
for maxmin patterns. Bug fixed.

Bootstrapped.
AVX-512* tests on top of patch-set all pass
under simulator.

Is it ok for trunk?

gcc/
	* config/i386/sse.md (VI128_256): Delete.
	(define_mode_iterator VI124_256): New.
	(define_mode_iterator VI124_256_AVX512F_AVX512BW): Ditto.
	(define_expand "<code><mode>3<mask_name><round_name>"): Delete.
	(define_expand "<code><VI124_256_AVX512F_AVX512BW:mode>3"): New.
	(define_insn "*avx2_<code><VI124_256:mode>3"): Rename from
	"*avx2_<code><mode>3<mask_name><round_name>" and update mode iterator.
	(define_expand "<code><VI48_AVX512VL:mode>3_mask"): New.
	(define_insn "*avx512bw_<code><VI48_AVX512VL:mode>3<mask_name>"): Ditto.
	(define_insn "<mask_codefor><code><mode>3<mask_name>"): Update mode
	iterator.
	(define_expand "<code><mode:VI8_AVX2>3"): Update pettern generation
	in presence of AVX-512.
--
Thanks, K

diff --git a/gcc/config/i386/sse.md b/gcc/config/i386/sse.md
index 40b8f83..92f94b9 100644
--- a/gcc/config/i386/sse.md
+++ b/gcc/config/i386/sse.md
@@ -290,9 +290,6 @@
 (define_mode_iterator VI8_256_512
   [V8DI (V4DI "TARGET_AVX512VL")])
 
-(define_mode_iterator VI128_256
-  [V4DI V2DI V4SI (V16QI "TARGET_AVX512BW") (V8HI "TARGET_AVX512BW")])
-
 (define_mode_iterator VI1_AVX2
   [(V32QI "TARGET_AVX2") V16QI])
 
@@ -499,8 +496,12 @@
 (define_mode_iterator VI48_128 [V4SI V2DI])
 
 ;; Various 256bit and 512 vector integer mode combinations
-(define_mode_iterator VI124_256_48_512
-  [V32QI V16HI V8SI (V8DI "TARGET_AVX512F") (V16SI "TARGET_AVX512F")])
+(define_mode_iterator VI124_256 [V32QI V16HI V8SI])
+(define_mode_iterator VI124_256_AVX512F_AVX512BW
+  [V32QI V16HI V8SI
+   (V64QI "TARGET_AVX512BW")
+   (V32HI "TARGET_AVX512BW")
+   (V16SI "TARGET_AVX512F")])
 (define_mode_iterator VI48_256 [V8SI V4DI])
 (define_mode_iterator VI48_512 [V16SI V8DI])
 (define_mode_iterator VI4_256_8_512 [V8SI V8DI])
@@ -9449,71 +9450,100 @@
   [(set_attr "prefix" "evex")
    (set_attr "mode" "<sseinsnmode>")])
 
-(define_expand "<code><mode>3<mask_name><round_name>"
-  [(set (match_operand:VI124_256_48_512 0 "register_operand")
-	(maxmin:VI124_256_48_512
-	  (match_operand:VI124_256_48_512 1 "<round_nimm_predicate>")
-	  (match_operand:VI124_256_48_512 2 "<round_nimm_predicate>")))]
-  "TARGET_AVX2 && <mask_mode512bit_condition> && <round_mode512bit_condition>"
+(define_expand "<code><mode>3"
+  [(set (match_operand:VI124_256_AVX512F_AVX512BW 0 "register_operand")
+	(maxmin:VI124_256_AVX512F_AVX512BW
+	  (match_operand:VI124_256_AVX512F_AVX512BW 1 "nonimmediate_operand")
+	  (match_operand:VI124_256_AVX512F_AVX512BW 2 "nonimmediate_operand")))]
+  "TARGET_AVX2"
   "ix86_fixup_binary_operands_no_copy (<CODE>, <MODE>mode, operands);")
 
-(define_insn "*avx2_<code><mode>3<mask_name><round_name>"
-  [(set (match_operand:VI124_256_48_512 0 "register_operand" "=v")
-	(maxmin:VI124_256_48_512
-	  (match_operand:VI124_256_48_512 1 "<round_nimm_predicate>" "%v")
-	  (match_operand:VI124_256_48_512 2 "<round_nimm_predicate>" "<round_constraint>")))]
-  "TARGET_AVX2 && ix86_binary_operator_ok (<CODE>, <MODE>mode, operands)
-   && <mask_mode512bit_condition> && <round_mode512bit_condition>"
-  "vp<maxmin_int><ssemodesuffix>\t{<round_mask_op3>%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2<round_mask_op3>}"
+(define_insn "*avx2_<code><mode>3"
+  [(set (match_operand:VI124_256 0 "register_operand" "=v")
+	(maxmin:VI124_256
+	  (match_operand:VI124_256 1 "nonimmediate_operand" "%v")
+	  (match_operand:VI124_256 2 "nonimmediate_operand" "vm")))]
+  "TARGET_AVX2 && ix86_binary_operator_ok (<CODE>, <MODE>mode, operands)"
+  "vp<maxmin_int><ssemodesuffix>\t{%2, %1, %0|%0, %1, %2}"
   [(set_attr "type" "sseiadd")
    (set_attr "prefix_extra" "1")
-   (set_attr "prefix" "maybe_evex")
+   (set_attr "prefix" "vex")
    (set_attr "mode" "OI")])
 
+(define_expand "<code><mode>3_mask"
+  [(set (match_operand:VI48_AVX512VL 0 "register_operand")
+	(vec_merge:VI48_AVX512VL
+	  (maxmin:VI48_AVX512VL
+	    (match_operand:VI48_AVX512VL 1 "nonimmediate_operand")
+	    (match_operand:VI48_AVX512VL 2 "nonimmediate_operand"))
+	  (match_operand:VI48_AVX512VL 3 "vector_move_operand")
+	  (match_operand:<avx512fmaskmode> 4 "register_operand")))]
+  "TARGET_AVX512F"
+  "ix86_fixup_binary_operands_no_copy (<CODE>, <MODE>mode, operands);")
+
+(define_insn "*avx512bw_<code><mode>3<mask_name>"
+  [(set (match_operand:VI48_AVX512VL 0 "register_operand" "=v")
+	(maxmin:VI48_AVX512VL
+	  (match_operand:VI48_AVX512VL 1 "nonimmediate_operand" "%v")
+	  (match_operand:VI48_AVX512VL 2 "nonimmediate_operand" "vm")))]
+  "TARGET_AVX512F && ix86_binary_operator_ok (<CODE>, <MODE>mode, operands)"
+  "vp<maxmin_int><ssemodesuffix>\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
+  [(set_attr "type" "sseiadd")
+   (set_attr "prefix_extra" "1")
+   (set_attr "prefix" "maybe_evex")
+   (set_attr "mode" "<sseinsnmode>")])
+
 (define_insn "<mask_codefor><code><mode>3<mask_name>"
-  [(set (match_operand:VI128_256 0 "register_operand" "=v")
-        (maxmin:VI128_256
-          (match_operand:VI128_256 1 "register_operand" "v")
-          (match_operand:VI128_256 2 "nonimmediate_operand" "vm")))]
-  "TARGET_AVX512VL"
+  [(set (match_operand:VI12_AVX512VL 0 "register_operand" "=v")
+        (maxmin:VI12_AVX512VL
+          (match_operand:VI12_AVX512VL 1 "register_operand" "v")
+          (match_operand:VI12_AVX512VL 2 "nonimmediate_operand" "vm")))]
+  "TARGET_AVX512BW"
   "vp<maxmin_int><ssemodesuffix>\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
   [(set_attr "type" "sseiadd")
    (set_attr "prefix" "evex")
    (set_attr "mode" "<sseinsnmode>")])
 
 (define_expand "<code><mode>3"
-  [(set (match_operand:VI8_AVX2 0 "register_operand")
-	(maxmin:VI8_AVX2
-	  (match_operand:VI8_AVX2 1 "register_operand")
-	  (match_operand:VI8_AVX2 2 "register_operand")))]
+  [(set (match_operand:VI8_AVX2_AVX512BW 0 "register_operand")
+	(maxmin:VI8_AVX2_AVX512BW
+	  (match_operand:VI8_AVX2_AVX512BW 1 "register_operand")
+	  (match_operand:VI8_AVX2_AVX512BW 2 "register_operand")))]
   "TARGET_SSE4_2"
 {
-  enum rtx_code code;
-  rtx xops[6];
-  bool ok;
+  if (TARGET_AVX512F
+      && (<MODE>mode == V8DImode || TARGET_AVX512VL))
+    ix86_fixup_binary_operands_no_copy (<CODE>, <MODE>mode, operands);
+  else 
+    {
+      enum rtx_code code;
+      rtx xops[6];
+      bool ok;
 
-  xops[0] = operands[0];
 
-  if (<CODE> == SMAX || <CODE> == UMAX)
-    {
-      xops[1] = operands[1];
-      xops[2] = operands[2];
-    }
-  else
-    {
-      xops[1] = operands[2];
-      xops[2] = operands[1];
-    }
+      xops[0] = operands[0];
+
+      if (<CODE> == SMAX || <CODE> == UMAX)
+	{
+	  xops[1] = operands[1];
+	  xops[2] = operands[2];
+	}
+      else
+	{
+	  xops[1] = operands[2];
+	  xops[2] = operands[1];
+	}
 
-  code = (<CODE> == UMAX || <CODE> == UMIN) ? GTU : GT;
+      code = (<CODE> == UMAX || <CODE> == UMIN) ? GTU : GT;
 
-  xops[3] = gen_rtx_fmt_ee (code, VOIDmode, operands[1], operands[2]);
-  xops[4] = operands[1];
-  xops[5] = operands[2];
+      xops[3] = gen_rtx_fmt_ee (code, VOIDmode, operands[1], operands[2]);
+      xops[4] = operands[1];
+      xops[5] = operands[2];
 
-  ok = ix86_expand_int_vcond (xops);
-  gcc_assert (ok);
-  DONE;
+      ok = ix86_expand_int_vcond (xops);
+      gcc_assert (ok);
+      DONE;
+    }
 })
 
 (define_expand "<code><mode>3"

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH i386 AVX512] [37/n] Extend max/min insn patterns.
  2014-09-11 13:08 [PATCH i386 AVX512] [37/n] Extend max/min insn patterns Kirill Yukhin
@ 2014-09-11 18:10 ` Uros Bizjak
  2014-09-11 18:21   ` H.J. Lu
  0 siblings, 1 reply; 3+ messages in thread
From: Uros Bizjak @ 2014-09-11 18:10 UTC (permalink / raw)
  To: Kirill Yukhin; +Cc: Jakub Jelinek, Richard Henderson, GCC Patches

On Thu, Sep 11, 2014 at 3:00 PM, Kirill Yukhin <kirill.yukhin@gmail.com> wrote:

> Patch in the bottom extends integer max/min patterns.
> Also, it seems, like rounding variant was generated
> for maxmin patterns. Bug fixed.
>
> Bootstrapped.
> AVX-512* tests on top of patch-set all pass
> under simulator.
>
> Is it ok for trunk?
>
> gcc/
>         * config/i386/sse.md (VI128_256): Delete.
>         (define_mode_iterator VI124_256): New.
>         (define_mode_iterator VI124_256_AVX512F_AVX512BW): Ditto.
>         (define_expand "<code><mode>3<mask_name><round_name>"): Delete.
>         (define_expand "<code><VI124_256_AVX512F_AVX512BW:mode>3"): New.
>         (define_insn "*avx2_<code><VI124_256:mode>3"): Rename from
>         "*avx2_<code><mode>3<mask_name><round_name>" and update mode iterator.
>         (define_expand "<code><VI48_AVX512VL:mode>3_mask"): New.
>         (define_insn "*avx512bw_<code><VI48_AVX512VL:mode>3<mask_name>"): Ditto.
>         (define_insn "<mask_codefor><code><mode>3<mask_name>"): Update mode
>         iterator.
>         (define_expand "<code><mode:VI8_AVX2>3"): Update pettern generation

"<code><VI8_AVX2:mode>3"

>         in presence of AVX-512.

The patch is OK.

(BTW: Sometimes "svn diff -x -upw" comes handy to exclude whitespace
changes. I don't know the equivalent option for git, though.)

Thanks,
Uros.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH i386 AVX512] [37/n] Extend max/min insn patterns.
  2014-09-11 18:10 ` Uros Bizjak
@ 2014-09-11 18:21   ` H.J. Lu
  0 siblings, 0 replies; 3+ messages in thread
From: H.J. Lu @ 2014-09-11 18:21 UTC (permalink / raw)
  To: Uros Bizjak; +Cc: Kirill Yukhin, Jakub Jelinek, Richard Henderson, GCC Patches

On Thu, Sep 11, 2014 at 11:10 AM, Uros Bizjak <ubizjak@gmail.com> wrote:
> On Thu, Sep 11, 2014 at 3:00 PM, Kirill Yukhin <kirill.yukhin@gmail.com> wrote:
>
>> Patch in the bottom extends integer max/min patterns.
>> Also, it seems, like rounding variant was generated
>> for maxmin patterns. Bug fixed.
>>
>> Bootstrapped.
>> AVX-512* tests on top of patch-set all pass
>> under simulator.
>>
>> Is it ok for trunk?
>>
>> gcc/
>>         * config/i386/sse.md (VI128_256): Delete.
>>         (define_mode_iterator VI124_256): New.
>>         (define_mode_iterator VI124_256_AVX512F_AVX512BW): Ditto.
>>         (define_expand "<code><mode>3<mask_name><round_name>"): Delete.
>>         (define_expand "<code><VI124_256_AVX512F_AVX512BW:mode>3"): New.
>>         (define_insn "*avx2_<code><VI124_256:mode>3"): Rename from
>>         "*avx2_<code><mode>3<mask_name><round_name>" and update mode iterator.
>>         (define_expand "<code><VI48_AVX512VL:mode>3_mask"): New.
>>         (define_insn "*avx512bw_<code><VI48_AVX512VL:mode>3<mask_name>"): Ditto.
>>         (define_insn "<mask_codefor><code><mode>3<mask_name>"): Update mode
>>         iterator.
>>         (define_expand "<code><mode:VI8_AVX2>3"): Update pettern generation
>
> "<code><VI8_AVX2:mode>3"
>
>>         in presence of AVX-512.
>
> The patch is OK.
>
> (BTW: Sometimes "svn diff -x -upw" comes handy to exclude whitespace
> changes. I don't know the equivalent option for git, though.)
>

git diff -w

       -w, --ignore-all-space
           Ignore whitespace when comparing lines. This ignores
differences even if one
           line has whitespace where the other line has none.

-- 
H.J.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2014-09-11 18:21 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-09-11 13:08 [PATCH i386 AVX512] [37/n] Extend max/min insn patterns Kirill Yukhin
2014-09-11 18:10 ` Uros Bizjak
2014-09-11 18:21   ` H.J. Lu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).