| 1 |
# Regression driver for SLS mitigation on AArch64. |
| 2 |
# Copyright (C) 2020-2025 Free Software Foundation, Inc. |
| 3 |
# Contributed by ARM Ltd. |
| 4 |
# |
| 5 |
# This file is part of GCC. |
| 6 |
# |
| 7 |
# GCC is free software; you can redistribute it and/or modify it |
| 8 |
# under the terms of the GNU General Public License as published by |
| 9 |
# the Free Software Foundation; either version 3, or (at your option) |
| 10 |
# any later version. |
| 11 |
# |
| 12 |
# GCC is distributed in the hope that it will be useful, but |
| 13 |
# WITHOUT ANY WARRANTY; without even the implied warranty of |
| 14 |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 15 |
# General Public License for more details. |
| 16 |
# |
| 17 |
# You should have received a copy of the GNU General Public License |
| 18 |
# along with GCC; see the file COPYING3. If not see |
| 19 |
# <http://www.gnu.org/licenses/>. */ |
| 20 |
|
| 21 |
# Exit immediately if this isn't an AArch64 target. |
| 22 |
if {![istarget aarch64*-*-*] } then { |
| 23 |
return |
| 24 |
} |
| 25 |
|
| 26 |
# Load support procs. |
| 27 |
load_lib gcc-dg.exp |
| 28 |
load_lib torture-options.exp |
| 29 |
|
| 30 |
# If a testcase doesn't have special options, use these. |
| 31 |
global DEFAULT_CFLAGS |
| 32 |
if ![info exists DEFAULT_CFLAGS] then { |
| 33 |
set DEFAULT_CFLAGS " " |
| 34 |
} |
| 35 |
|
| 36 |
# Initialize `dg'. |
| 37 |
dg-init |
| 38 |
torture-init |
| 39 |
|
| 40 |
# Use different architectures as well as the normal optimisation options. |
| 41 |
# (i.e. use both SB and DSB+ISB barriers). |
| 42 |
|
| 43 |
set save-dg-do-what-default ${dg-do-what-default} |
| 44 |
# Main loop. |
| 45 |
# Run with torture tests (i.e. a bunch of different optimisation levels) just |
| 46 |
# to increase test coverage. |
| 47 |
set dg-do-what-default assemble |
| 48 |
gcc-dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.\[cCS\]]] \ |
| 49 |
"-save-temps" $DEFAULT_CFLAGS |
| 50 |
|
| 51 |
# Run the same tests but this time with SB extension. |
| 52 |
# Since not all supported assemblers will support that extension we decide |
| 53 |
# whether to assemble or just compile based on whether the extension is |
| 54 |
# supported for the available assembler. |
| 55 |
|
| 56 |
set templist {} |
| 57 |
foreach x $DG_TORTURE_OPTIONS { |
| 58 |
lappend templist "$x -march=armv8.3-a+sb " |
| 59 |
lappend templist "$x -march=armv8-a+sb " |
| 60 |
} |
| 61 |
set-torture-options $templist |
| 62 |
if { [check_effective_target_aarch64_asm_sb_ok] } { |
| 63 |
set dg-do-what-default assemble |
| 64 |
} else { |
| 65 |
set dg-do-what-default compile |
| 66 |
} |
| 67 |
gcc-dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.\[cCS\]]] \ |
| 68 |
"-save-temps" $DEFAULT_CFLAGS |
| 69 |
set dg-do-what-default ${save-dg-do-what-default} |
| 70 |
|
| 71 |
# All done. |
| 72 |
torture-finish |
| 73 |
dg-finish |