On Tue, 15 Aug 2023 at 14:28, Richard Sandiford <richard.sandif...@arm.com> wrote: > > Richard Biener <rguent...@suse.de> writes: > > On Mon, 14 Aug 2023, Prathamesh Kulkarni wrote: > >> On Mon, 7 Aug 2023 at 13:19, Richard Biener <richard.guent...@gmail.com> > >> wrote: > >> > It doesn't seem to make a difference for x86. That said, the "fix" is > >> > probably sticking the correct target on the dump-check, it seems > >> > that vect_fold_extract_last is no longer correct here. > >> Um sorry, I did go thru various checks in target-supports.exp, but not > >> sure which one will be appropriate for this case, > >> and am stuck here :/ Could you please suggest how to proceed ? > > > > Maybe Richard S. knows the magic thing to test, he originally > > implemented the direct conversion support. I suggest to implement > > such dg-checks if they are not present (I can't find them), > > possibly quite specific to the modes involved (like we have > > other checks with _qi_to_hi suffixes, for float modes maybe > > just _float). > > Yeah, can't remember specific selectors for that feature. TBH I think > most (all?) of the tests were AArch64-specific. Hi, As Richi mentioned above, the test now vectorizes on AArch64 because it has support for direct conversion between vectors while x86 doesn't. IIUC this is because supportable_convert_operation returns true for V4HI -> V4SI on Aarch64 since it can use extend_v4hiv4si2 for doing the conversion ?
In the attached patch, I added a new target check vect_extend which (currently) returns 1 only for aarch64*-*-*, which makes the test PASS on both the targets, altho I am not sure if this is entirely correct. Does the patch look OK ? Thanks, Prathamesh > > Thanks, > Richard
diff --git a/gcc/testsuite/gcc.dg/vect/pr65947-7.c b/gcc/testsuite/gcc.dg/vect/pr65947-7.c index 16cdcd1c6eb..c8623854af5 100644 --- a/gcc/testsuite/gcc.dg/vect/pr65947-7.c +++ b/gcc/testsuite/gcc.dg/vect/pr65947-7.c @@ -52,5 +52,4 @@ main (void) return 0; } -/* { dg-final { scan-tree-dump "LOOP VECTORIZED" "vect" { target vect_fold_extract_last } } } */ -/* { dg-final { scan-tree-dump-not "LOOP VECTORIZED" "vect" { target { ! vect_fold_extract_last } } } } */ +/* { dg-final { scan-tree-dump "LOOP VECTORIZED" "vect" { target vect_extend } } } */ diff --git a/gcc/testsuite/lib/target-supports.exp b/gcc/testsuite/lib/target-supports.exp index 92b6f69730e..29ef64b84f3 100644 --- a/gcc/testsuite/lib/target-supports.exp +++ b/gcc/testsuite/lib/target-supports.exp @@ -7768,6 +7768,16 @@ proc check_effective_target_vect_unpack { } { || [istarget amdgcn*-*-*] }}] } +# Return 1 if the target plus current options supports vector +# conversion of chars (to shorts) and shorts (to ints), 0 otherwise. +# +# This won't change for different subtargets so cache the result. + +proc check_effective_target_vect_extend { } { + return [check_cached_effective_target_indexed vect_extend { + expr { [istarget aarch64*-*-*]}}] +} + # Return 1 if the target plus current options does not guarantee # that its STACK_BOUNDARY is >= the reguired vector alignment. #