From 01e3391a9085119eea88593f6b6a766294ee3631 Mon Sep 17 00:00:00 2001 From: Kirill Yukhin Date: Wed, 2 Dec 2015 11:07:42 +0000 Subject: [PATCH] AVX-512. Split out mask version for vec_extract_hi_. gcc/ * config/i386/sse.md (define_insn "vec_extract_hi__maskm"): Remove "prefix_extra". (define_insn "vec_extract_hi__mask"): New. (define_insn "vec_extract_hi_"): Remove masking. gcc/testsuite/ * gcc.target/i386/avx512vl-vextractf32x4-1.c: Fix scan pattern. From-SVN: r231167 --- gcc/config/i386/sse.md | 44 +++++++++++-------- .../i386/avx512vl-vextractf32x4-1.c | 2 +- 2 files changed, 27 insertions(+), 19 deletions(-) diff --git a/gcc/config/i386/sse.md b/gcc/config/i386/sse.md index e7b517aeb6c..680d813472d 100644 --- a/gcc/config/i386/sse.md +++ b/gcc/config/i386/sse.md @@ -7534,32 +7534,40 @@ && rtx_equal_p (operands[2], operands[0])" "vextract32x4\t{$0x1, %1, %0%{%3%}|%0%{%3%}, %1, 0x1}" [(set_attr "type" "sselog1") - (set_attr "prefix_extra" "1") (set_attr "length_immediate" "1") (set_attr "prefix" "evex") (set_attr "mode" "")]) -(define_insn "vec_extract_hi_" - [(set (match_operand: 0 "" "=") +(define_insn "vec_extract_hi__mask" + [(set (match_operand: 0 "register_operand" "=v") + (vec_merge: + (vec_select: + (match_operand:VI4F_256 1 "register_operand" "v") + (parallel [(const_int 4) (const_int 5) + (const_int 6) (const_int 7)])) + (match_operand: 2 "vector_move_operand" "0C") + (match_operand: 3 "register_operand" "Yk")))] + "TARGET_AVX512VL" + "vextract32x4\t{$0x1, %1, %0%{%3%}%N2|%0%{%3%}%N2, %1, 0x1}" + [(set_attr "type" "sselog1") + (set_attr "length_immediate" "1") + (set_attr "prefix" "evex") + (set_attr "mode" "")]) + +(define_insn "vec_extract_hi_" + [(set (match_operand: 0 "nonimmediate_operand" "=xm, vm") (vec_select: - (match_operand:VI4F_256 1 "register_operand" "v") + (match_operand:VI4F_256 1 "register_operand" "x, v") (parallel [(const_int 4) (const_int 5) (const_int 6) (const_int 7)])))] - "TARGET_AVX && " -{ - if (TARGET_AVX512VL) - return "vextract32x4\t{$0x1, %1, %0|%0, %1, 0x1}"; - else - return "vextract\t{$0x1, %1, %0|%0, %1, 0x1}"; -} - [(set_attr "type" "sselog1") - (set_attr "prefix_extra" "1") + "TARGET_AVX" + "@ + vextract\t{$0x1, %1, %0|%0, %1, 0x1} + vextract32x4\t{$0x1, %1, %0|%0, %1, 0x1}" + [(set_attr "isa" "*, avx512vl") + (set_attr "prefix" "vex, evex") + (set_attr "type" "sselog1") (set_attr "length_immediate" "1") - (set (attr "prefix") - (if_then_else - (match_test "TARGET_AVX512VL") - (const_string "evex") - (const_string "vex"))) (set_attr "mode" "")]) (define_insn_and_split "vec_extract_lo_v32hi" diff --git a/gcc/testsuite/gcc.target/i386/avx512vl-vextractf32x4-1.c b/gcc/testsuite/gcc.target/i386/avx512vl-vextractf32x4-1.c index c01835ce097..26313f44062 100644 --- a/gcc/testsuite/gcc.target/i386/avx512vl-vextractf32x4-1.c +++ b/gcc/testsuite/gcc.target/i386/avx512vl-vextractf32x4-1.c @@ -1,6 +1,6 @@ /* { dg-do compile } */ /* { dg-options "-mavx512vl -O2" } */ -/* { dg-final { scan-assembler-times "vextractf32x4\[ \\t\]+\[^\{\n\]*%xmm\[0-9\]+(?:\n|\[ \\t\]+#)" 1 } } */ +/* { dg-final { scan-assembler-times "vextractf(?:128|32x4)\[ \\t\]+\[^\{\n\]*%xmm\[0-9\]+(?:\n|\[ \\t\]+#)" 1 } } */ /* { dg-final { scan-assembler-times "vextractf32x4\[ \\t\]+\[^\{\n\]*%xmm\[0-9\]+\{%k\[1-7\]\}\{z\}(?:\n|\[ \\t\]+#)" 1 } } */ /* { dg-final { scan-assembler-times "vextractf32x4\[ \\t\]+\[^\{\n\]*%xmm\[0-9\]+\{%k\[1-7\]\}(?:\n|\[ \\t\]+#)" 1 } } */ -- 2.30.2