From d0939f42dd84ca03212caf0b6937cf201a16a44f Mon Sep 17 00:00:00 2001 From: Kewen Lin Date: Sun, 30 Aug 2020 19:52:03 -0500 Subject: testsuite: Update some vect cases for partial vectors This patch is to adjust some existing vectorization test cases to work well with the newly introduced partial vector usages. Bootstrapped/regtested on aarch64-linux-gnu and powerpc64le-linux-gnu P9 (with explicit param vect-partial-vector-usage=1 and enablement on check_effective_target_vect_partial_vectors_usage_1 check). gcc/ChangeLog: * doc/sourcebuild.texi (vect_len_load_store, vect_partial_vectors_usage_1, vect_partial_vectors_usage_2, vect_partial_vectors): Document. gcc/testsuite/ChangeLog: * gcc.dg/vect/bb-slp-pr69907.c: Adjust for partial vector usages. * gcc.dg/vect/slp-3.c: Likewise. * gcc.dg/vect/slp-multitypes-11.c: Likewise. * gcc.dg/vect/slp-perm-1.c: Likewise. * gcc.dg/vect/slp-perm-5.c: Likewise. * gcc.dg/vect/slp-perm-6.c: Likewise. * gcc.dg/vect/slp-perm-7.c: Likewise. * gcc.dg/vect/slp-perm-8.c: Likewise. * gcc.dg/vect/slp-perm-9.c: Likewise. * gcc.dg/vect/vect-version-2.c: Likewise. * lib/target-supports.exp (check_vect_partial_vector_usage): New function. (check_effective_target_vect_len_load_store): Likewise. (check_effective_target_vect_partial_vectors_usage_1): Likewise. (check_effective_target_vect_partial_vectors_usage_2): Likewise. (check_effective_target_vect_partial_vectors): Likewise. --- gcc/testsuite/lib/target-supports.exp | 61 +++++++++++++++++++++++++++++++++++ 1 file changed, 61 insertions(+) (limited to 'gcc/testsuite/lib') diff --git a/gcc/testsuite/lib/target-supports.exp b/gcc/testsuite/lib/target-supports.exp index f3fc5b8..46e8cdd 100644 --- a/gcc/testsuite/lib/target-supports.exp +++ b/gcc/testsuite/lib/target-supports.exp @@ -7081,6 +7081,67 @@ proc check_effective_target_vect_fully_masked { } { || [istarget amdgcn*-*-*] }] } +# Return true if the target supports the @code{len_load} and +# @code{len_store} optabs. + +proc check_effective_target_vect_len_load_store { } { + return 0 +} + +# Return the value of parameter vect-partial-vector-usage specified for +# target by checking the output of "-Q --help=params". Return zero if +# the desirable pattern isn't found. + +proc check_vect_partial_vector_usage { } { + global tool + + return [check_cached_effective_target vect_partial_vector_usage { + set result [check_compile vect_partial_vector_usage assembly { + int i; + } "-Q --help=params" ] + + # Get compiler emitted messages and delete generated file. + set lines [lindex $result 0] + set output [lindex $result 1] + remote_file build delete $output + + set pattern {=vect-partial-vector-usage=<0,2>\s+([0-2])} + # Capture the usage value to val, set it to zero if not found. + if { ![regexp $pattern $lines whole val] } then { + set val 0 + } + + return $val + }] +} + +# Return true if the target supports loop vectorization with partial vectors +# and @code{vect-partial-vector-usage} is set to 1. + +proc check_effective_target_vect_partial_vectors_usage_1 { } { + return [expr { ([check_effective_target_vect_fully_masked] + || [check_effective_target_vect_len_load_store]) + && [check_vect_partial_vector_usage] == 1 }] +} + +# Return true if the target supports loop vectorization with partial vectors +# and @code{vect-partial-vector-usage} is set to 2. + +proc check_effective_target_vect_partial_vectors_usage_2 { } { + return [expr { ([check_effective_target_vect_fully_masked] + || [check_effective_target_vect_len_load_store]) + && [check_vect_partial_vector_usage] == 2 }] +} + +# Return true if the target supports loop vectorization with partial vectors +# and @code{vect-partial-vector-usage} is nonzero. + +proc check_effective_target_vect_partial_vectors { } { + return [expr { ([check_effective_target_vect_fully_masked] + || [check_effective_target_vect_len_load_store]) + && [check_vect_partial_vector_usage] != 0 }] +} + # Return 1 if the target doesn't prefer any alignment beyond element # alignment during vectorization. -- cgit v1.1