diff options
author | liuhongt <hongtao.liu@intel.com> | 2022-01-24 11:05:47 +0800 |
---|---|---|
committer | liuhongt <hongtao.liu@intel.com> | 2022-02-13 17:57:38 +0800 |
commit | 7e204bd2f189850cb940677c99d8d93eb7dd40cd (patch) | |
tree | 3d8eb6dd756e3aa0792cd257f77689c2450155ac /gcc/testsuite | |
parent | 23756b70630d6576c9d498cc85ae1dde38a1d5d0 (diff) | |
download | gcc-7e204bd2f189850cb940677c99d8d93eb7dd40cd.zip gcc-7e204bd2f189850cb940677c99d8d93eb7dd40cd.tar.gz gcc-7e204bd2f189850cb940677c99d8d93eb7dd40cd.tar.bz2 |
Add vect_recog_cond_expr_convert_pattern.
The pattern converts (cond (cmp a b) (convert c) (convert d))
to (convert (cond (cmp a b) c d)) when
1) types_match (c, d)
2) single_use for (convert c) and (convert d)
3) TYPE_PRECISION (TREE_TYPE (c)) == TYPE_PRECISION (TREE_TYPE (a))
4) INTEGERAL_TYPE_P (TREE_TYPE (c))
The pattern can save packing of mask and data(partial for data, 2 vs
1).
gcc/ChangeLog:
PR target/103771
* match.pd (cond_expr_convert_p): New match.
* tree-vect-patterns.cc (gimple_cond_expr_convert_p): Declare.
(vect_recog_cond_expr_convert_pattern): New.
gcc/testsuite/ChangeLog:
* gcc.target/i386/pr103771-2.c: New test.
* gcc.target/i386/pr103771-3.c: New test.
Diffstat (limited to 'gcc/testsuite')
-rw-r--r-- | gcc/testsuite/gcc.target/i386/pr103771-2.c | 8 | ||||
-rw-r--r-- | gcc/testsuite/gcc.target/i386/pr103771-3.c | 21 |
2 files changed, 29 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.target/i386/pr103771-2.c b/gcc/testsuite/gcc.target/i386/pr103771-2.c new file mode 100644 index 0000000..962a3a7 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/pr103771-2.c @@ -0,0 +1,8 @@ +/* { dg-do compile } */ +/* { dg-options "-march=cascadelake -O3" } */ +/* { dg-final { scan-assembler-not "kunpck" } } */ +/* { dg-final { scan-assembler-not "kand" } } */ +/* { dg-final { scan-assembler-not "kor" } } */ +/* { dg-final { scan-assembler-not "kshift" } } */ + +#include "pr103771.c" diff --git a/gcc/testsuite/gcc.target/i386/pr103771-3.c b/gcc/testsuite/gcc.target/i386/pr103771-3.c new file mode 100644 index 0000000..ef379b2 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/pr103771-3.c @@ -0,0 +1,21 @@ +/* { dg-do compile } */ +/* { dg-options "-march=cascadelake -O3" } */ +/* { dg-final { scan-assembler-not "kunpck" } } */ +/* { dg-final { scan-assembler-not "kand" } } */ +/* { dg-final { scan-assembler-not "kor" } } */ +/* { dg-final { scan-assembler-not "kshift" } } */ + +typedef unsigned char uint8_t; + +static uint8_t x264_clip_uint8 (int x, unsigned int y) +{ + return x & (~255) ? (-x) >> 31 : y; +} + +void +mc_weight (uint8_t* __restrict dst, uint8_t* __restrict src, + int i_width,int i_scale, unsigned int* __restrict y) +{ + for(int x = 0; x < i_width; x++) + dst[x] = x264_clip_uint8 (src[x] * i_scale, y[x]); +} |