From f04bffb04a4dae3e1a1f87f53c4591fc48bb8058 Mon Sep 17 00:00:00 2001 From: Uros Bizjak Date: Fri, 2 Aug 2019 17:46:02 +0200 Subject: [PATCH] re PR tree-optimization/91201 (SIMD not generated for horizontal sum of bytes in array) PR target/91201 * config/i386/sse.md (*vec_extractv16qi_zext): New insn pattern. testsuite/ChangeLog: PR target/91201 * gcc.target/i386/sse4_1-pr91201.c: New test. From-SVN: r274018 --- gcc/ChangeLog | 5 +++++ gcc/config/i386/sse.md | 19 +++++++++++++++++++ gcc/testsuite/ChangeLog | 5 +++++ .../gcc.target/i386/sse4_1-pr91201.c | 12 ++++++++++++ 4 files changed, 41 insertions(+) create mode 100644 gcc/testsuite/gcc.target/i386/sse4_1-pr91201.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 6c1372efde1..e63e09d258e 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2019-08-02 Uroš Bizjak + + PR target/91201 + * config/i386/sse.md (*vec_extractv16qi_zext): New insn pattern. + 2019-08-02 Alexander Monakov * tree-ssa-loop-im.c (sort_bbs_in_loop_postorder_cmp): Simplify casts diff --git a/gcc/config/i386/sse.md b/gcc/config/i386/sse.md index 56a89154e54..3391724fd8d 100644 --- a/gcc/config/i386/sse.md +++ b/gcc/config/i386/sse.md @@ -14970,6 +14970,25 @@ (set_attr "prefix" "maybe_vex") (set_attr "mode" "TI")]) +(define_insn "*vec_extractv16qi_zext" + [(set (match_operand:HI 0 "register_operand" "=r,r") + (zero_extend:HI + (vec_select:QI + (match_operand:V16QI 1 "register_operand" "x,v") + (parallel + [(match_operand:SI 2 "const_0_to_15_operand")]))))] + "TARGET_SSE4_1" + "@ + %vpextrb\t{%2, %1, %k0|%k0, %1, %2} + vpextrb\t{%2, %1, %k0|%k0, %1, %2}" + [(set_attr "isa" "*,avx512bw") + (set_attr "type" "sselog1") + (set_attr "prefix_data16" "1") + (set_attr "prefix_extra" "1") + (set_attr "length_immediate" "1") + (set_attr "prefix" "maybe_vex") + (set_attr "mode" "TI")]) + (define_insn "*vec_extract_mem" [(set (match_operand: 0 "register_operand" "=r") (vec_select: diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 00d664f961e..45d941d7e6e 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2019-08-02 Uroš Bizjak + + PR target/91201 + * gcc.target/i386/sse4_1-pr91201.c: New test. + 2019-08-02 Marek Polacek PR c++/91230 - wrong error with __PRETTY_FUNCTION__ and generic lambda. diff --git a/gcc/testsuite/gcc.target/i386/sse4_1-pr91201.c b/gcc/testsuite/gcc.target/i386/sse4_1-pr91201.c new file mode 100644 index 00000000000..095d18ef895 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/sse4_1-pr91201.c @@ -0,0 +1,12 @@ +/* PR tree-optimization/91201 */ +/* { dg-do compile } */ +/* { dg-options "-Os -msse4.1 -masm=att" } */ +/* { dg-final { scan-assembler-not "\tmovzb(w|l)" } } */ + +typedef unsigned char V __attribute__((vector_size (16))); + +unsigned short +foo (V x) +{ + return x[0]; +} -- 2.30.2