https://gcc.gnu.org/g:c8fdecf39434eb09b328a1a51535cac6704f7aff
commit r16-978-gc8fdecf39434eb09b328a1a51535cac6704f7aff Author: Kugan Vivekanandarajah <kvivekana...@nvidia.com> Date: Fri May 30 07:23:37 2025 +1000 [AUTOFDO] Enable autofdo tests for aarch64 autofdo tests are now running only for x86. This patch makes it run for aarch64 too. Verified that perf and create_gcov are running as expected. gcc/ChangeLog: * config/aarch64/gcc-auto-profile: Make script executable. gcc/testsuite/ChangeLog: * lib/target-supports.exp: Enable autofdo tests for aarch64. Signed-off-by: Kugan Vivekanandarajah <kvivekana...@nvidia.com> Diff: --- gcc/config/aarch64/gcc-auto-profile | 0 gcc/testsuite/lib/target-supports.exp | 35 +++++++++++++++++++++++++++++------ 2 files changed, 29 insertions(+), 6 deletions(-) diff --git a/gcc/config/aarch64/gcc-auto-profile b/gcc/config/aarch64/gcc-auto-profile old mode 100644 new mode 100755 diff --git a/gcc/testsuite/lib/target-supports.exp b/gcc/testsuite/lib/target-supports.exp index 6286e361fed0..75d723c63275 100644 --- a/gcc/testsuite/lib/target-supports.exp +++ b/gcc/testsuite/lib/target-supports.exp @@ -759,7 +759,13 @@ proc check_effective_target_keeps_null_pointer_checks { } { # this allows parallelism of 16 and higher of parallel gcc-auto-profile proc profopt-perf-wrapper { } { global srcdir - return "$srcdir/../config/i386/gcc-auto-profile --all -m8 " + if { [check_effective_target_x86] } { + return "$srcdir/../config/i386/gcc-auto-profile -m8" + } + if { [istarget aarch64*-*-*] } { + return "$srcdir/../config/aarch64/gcc-auto-profile -m8" + } + return "" } # Return true if profiling is supported on the target. @@ -778,8 +784,7 @@ proc check_profiling_available { test_what } { } if { $test_what == "-fauto-profile" } { - if { !([check_effective_target_x86] && [istarget *-*-linux*]) } { - verbose "autofdo only supported on linux" + if { !([check_effective_target_autofdo]) } { return 0 } # not cross compiling? @@ -787,13 +792,14 @@ proc check_profiling_available { test_what } { verbose "autofdo not supported for non native builds" return 0 } - set event [profopt-perf-wrapper] - if {$event == "" } { + set wrapper [profopt-perf-wrapper] + if {$wrapper == "" } { verbose "autofdo not supported" return 0 } + puts $wrapper global srcdir - set status [remote_exec host "$srcdir/../config/i386/gcc-auto-profile" "-m8 true -v >/dev/null"] + set status [remote_exec host "$wrapper true -v >/dev/null"] if { [lindex $status 0] != 0 } { verbose "autofdo not supported because perf does not work" return 0 @@ -1423,6 +1429,23 @@ proc check_effective_target_fpic { } { return 0 } +# Check if target supports autofdo. + +proc check_effective_target_autofdo { } { + if { !([istarget *-*-linux*]) } { + verbose "autofdo only supported on linux" + return 0 + } + if { [check_effective_target_x86] } { + return 1 + } + if { [istarget aarch64*-*-*] } { + return 1 + } + return 0 +} + + # On AArch64, if -fpic is not supported, then we will fall back to -fPIC # silently. So, we can't rely on above "check_effective_target_fpic" as it # assumes compiler will give warning if -fpic not supported. Here we check