https://gcc.gnu.org/bugzilla/show_bug.cgi?id=120846

--- Comment #4 from Jorn Wolfgang Rennecke <amylaar at gcc dot gnu.org> ---
(In reply to Richard Biener from comment #1)
> I guess the testcase assumes that the qi->si case gets an intermediate
> qi->hi promotion and then dotprod_hisi being used.  But it fails to check
> for the ability to do qi->hi promotion.  Is that what your target is missing?

I have seven eSi-RISC descriptions for different subtargets that I use for
routine testing.  One is 16 bit, and has no enabled dot_prod patterns.  The
other six are all 32 bit and have [us]dot_prodsiv2hi patterns (after renaming
for gcc15).  One of those six also has hardware support for vectors of 8 bytes,
including dot product, although the port defines them for 128 bit vectors
instead to improve scheduling.
That subtarget also supports vectors of half words (16 bit) and words (32 bit)
of these sizes, and a dotproduct for these halfword vectors.

Technically, the subtargets corresponding to the six 32 bit description files
all have vec_unpack[us]_{hi,lo}_v8qi patterns enabled, but the modes are only
allowed in registers for the one that has full byte vector support.

I tried to define a separate check for hisi dot product.  (eSi-RISC has
either both or none of the signed/unsigned variants, so there was no need to
differentiate that.  Also, there's no qisi dot product without a hisi dot
product.  Although that might be different for other targets.)
So I copied check_effective_target_vect_dotprod_hisi to a new proc
check_effective_target_vect_dotprod_qisi, and adjusted both for eSi-RISC.

Then changed the testcase like this:

Index: gcc.dg/vect/vect-dotprod-conv-optab.c
===================================================================
--- gcc.dg/vect/vect-dotprod-conv-optab.c       (revision 6735)
+++ gcc.dg/vect/vect-dotprod-conv-optab.c       (working copy)
@@ -37,5 +37,7 @@
   return sum;
 }

-/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 4 "vect" } } */
+/* See https://gcc.gnu.org/bugzilla/show_bug.cgi?id=120846 */
+/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 4 "vect" { target
vec
t_dotprod_qisi } } } */
+/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 2 "vect" { target {
!
 vect_dotprod_qisi } } } } */
 /* { dg-final { scan-tree-dump-times "vect_recog_dot_prod_pattern: detected" 4 
"vect" } } */


This makes the "vectorized 1 loops" tests succeed.
However, there is still a problem with the "vect_recog_dot_prod_pattern:
detected" test.

eSi-RISC TARGET_VECTORIZE_AUTOVECTORIZE_VECTOR_MODES pushes different sets of
vector modes depending on the supported instructions.
E.g., in the case of esirisc-esi3260vfxp-sim, that's:
V4SImode V8HImode V16QImode V4SFmode V2SImode V4HImode V8QImode V2SFmode
V1SImode V2HImode V4QImode

So there  are more matches than expected:

for file in esirisc-esi*-sim; do echo $file;grep -B1
'dotprod-conv-optab.c.*detected' $file/gcc.log; done
esirisc-esi1600-sim
esirisc-esi3200-sim
PASS: gcc.dg/vect/vect-dotprod-conv-optab.c scan-tree-dump-times vect
"vectorized 1 loops" 2
PASS: gcc.dg/vect/vect-dotprod-conv-optab.c scan-tree-dump-times vect
"vect_recog_dot_prod_pattern: detected" 4
--
PASS: gcc.dg/vect/vect-dotprod-conv-optab.c -flto -ffat-lto-objects 
scan-tree-dump-times vect "vectorized 1 loops" 2
PASS: gcc.dg/vect/vect-dotprod-conv-optab.c -flto -ffat-lto-objects 
scan-tree-dump-times vect "vect_recog_dot_prod_pattern: detected" 4
esirisc-esi3250dfp-sim
gcc.dg/vect/vect-dotprod-conv-optab.c: pattern found 16 times
FAIL: gcc.dg/vect/vect-dotprod-conv-optab.c scan-tree-dump-times vect
"vect_recog_dot_prod_pattern: detected" 4
--
gcc.dg/vect/vect-dotprod-conv-optab.c -flto -ffat-lto-objects : pattern found
16 times
FAIL: gcc.dg/vect/vect-dotprod-conv-optab.c -flto -ffat-lto-objects 
scan-tree-dump-times vect "vect_recog_dot_prod_pattern: detected" 4
esirisc-esi3250sfp-sim
gcc.dg/vect/vect-dotprod-conv-optab.c: pattern found 8 times
FAIL: gcc.dg/vect/vect-dotprod-conv-optab.c scan-tree-dump-times vect
"vect_recog_dot_prod_pattern: detected" 4
--
gcc.dg/vect/vect-dotprod-conv-optab.c -flto -ffat-lto-objects : pattern found 8
times
FAIL: gcc.dg/vect/vect-dotprod-conv-optab.c -flto -ffat-lto-objects 
scan-tree-dump-times vect "vect_recog_dot_prod_pattern: detected" 4
esirisc-esi3250-sim
PASS: gcc.dg/vect/vect-dotprod-conv-optab.c scan-tree-dump-times vect
"vectorized 1 loops" 2
PASS: gcc.dg/vect/vect-dotprod-conv-optab.c scan-tree-dump-times vect
"vect_recog_dot_prod_pattern: detected" 4
--
PASS: gcc.dg/vect/vect-dotprod-conv-optab.c -flto -ffat-lto-objects 
scan-tree-dump-times vect "vectorized 1 loops" 2
PASS: gcc.dg/vect/vect-dotprod-conv-optab.c -flto -ffat-lto-objects 
scan-tree-dump-times vect "vect_recog_dot_prod_pattern: detected" 4
esirisc-esi3260vfxp-sim
gcc.dg/vect/vect-dotprod-conv-optab.c: pattern found 24 times
FAIL: gcc.dg/vect/vect-dotprod-conv-optab.c scan-tree-dump-times vect
"vect_recog_dot_prod_pattern: detected" 4
--
gcc.dg/vect/vect-dotprod-conv-optab.c -flto -ffat-lto-objects : pattern found
24 times
FAIL: gcc.dg/vect/vect-dotprod-conv-optab.c -flto -ffat-lto-objects 
scan-tree-dump-times vect "vect_recog_dot_prod_pattern: detected" 4
esirisc-esi3260vsfp-sim
gcc.dg/vect/vect-dotprod-conv-optab.c -flto -ffat-lto-objects : pattern found
12 times
FAIL: gcc.dg/vect/vect-dotprod-conv-optab.c -flto -ffat-lto-objects 
scan-tree-dump-times vect "vect_recog_dot_prod_pattern: detected" 4
--
gcc.dg/vect/vect-dotprod-conv-optab.c: pattern found 12 times
FAIL: gcc.dg/vect/vect-dotprod-conv-optab.c scan-tree-dump-times vect
"vect_recog_dot_prod_pattern: detected" 4

Reply via email to