Restrict the two sources of vect_recog_cond_expr_convert_pattern to be of the same...
authorliuhongt <hongtao.liu@intel.com>
Wed, 16 Feb 2022 04:15:18 +0000 (12:15 +0800)
committerliuhongt <hongtao.liu@intel.com>
Thu, 17 Feb 2022 10:58:22 +0000 (18:58 +0800)
commit754dce903ca28c4c2f2bc8614a8de5e631655f2e
treed433f227d832ec19e1cd87a5c5ed1bba6abadb41
parent1c2b44b52364cb5661095b346de794bc7ff02866
Restrict the two sources of vect_recog_cond_expr_convert_pattern to be of the same type when convert is extension.

It's not equal to transform

 (cond (cmp @1 @2) (convert@3 @4) (convert@5 @6))

 to

 (convert (cmp @1 @2) (convert)@4 @6)

when(convert@3 @4) is extension because it's zero_extend vs sign_extend.

gcc/ChangeLog:

PR tree-optimization/104551
PR tree-optimization/103771
* match.pd (cond_expr_convert_p): Add types_match check when
convert is extension.
* tree-vect-patterns.cc
(gimple_cond_expr_convert_p): Adjust comments.
(vect_recog_cond_expr_convert_pattern): Ditto.

gcc/testsuite/ChangeLog:

* gcc.target/i386/pr104551.c: New test.
gcc/match.pd
gcc/testsuite/gcc.target/i386/pr104551.c [new file with mode: 0644]
gcc/tree-vect-patterns.cc