aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/lib
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/testsuite/lib')
-rw-r--r--gcc/testsuite/lib/g++-dg.exp130
-rw-r--r--gcc/testsuite/lib/gm2-dg.exp37
-rw-r--r--gcc/testsuite/lib/htmltest.py89
-rw-r--r--gcc/testsuite/lib/sarif.py15
-rw-r--r--gcc/testsuite/lib/target-supports.exp158
5 files changed, 338 insertions, 91 deletions
diff --git a/gcc/testsuite/lib/g++-dg.exp b/gcc/testsuite/lib/g++-dg.exp
index 26bda65..042a917 100644
--- a/gcc/testsuite/lib/g++-dg.exp
+++ b/gcc/testsuite/lib/g++-dg.exp
@@ -27,6 +27,79 @@ proc g++-dg-prune { system text } {
return [gcc-dg-prune $system $text]
}
+# Return a list of -std flags to use for TEST.
+proc g++-std-flags { test } {
+ # If the testcase specifies a standard, use that one.
+ # If not, run it under several standards, allowing GNU extensions
+ # if there's a dg-options line.
+ if ![search_for $test "-std=*++"] {
+ if [search_for $test "dg-options"] {
+ set std_prefix "-std=gnu++"
+ } else {
+ set std_prefix "-std=c++"
+ }
+
+ set low 0
+ # Some directories expect certain minimums.
+ if { [string match "*/coroutines/*" $test] } { set low 20 }
+ if { [string match "*/modules/*" $test] } { set low 17 }
+
+ # See g++.exp for the initial value of this list.
+ global gpp_std_list
+ if { [llength $gpp_std_list] > 0 } {
+ set std_list {}
+ foreach ver $gpp_std_list {
+ set cmpver $ver
+ if { $ver == 98 } { set cmpver 03 }
+ if { $ver ni $std_list
+ && $cmpver >= $low } {
+ lappend std_list $ver
+ }
+ }
+ } else {
+ # If the test mentions specific C++ versions, test those.
+ set lines [get_matching_lines $test {\{ dg* c++[0-9][0-9]}]
+ set std_list {}
+ foreach line $lines {
+ regexp {c\+\+([0-9][0-9])} $line -> ver
+ lappend std_list $ver
+
+ if { $ver == 98 } {
+ # Leave low alone.
+ } elseif { [regexp {dg-do|dg-require-effective-target} $line] } {
+ set low $ver
+ }
+ }
+ #verbose "low: $low" 1
+
+ set std_list [lsort -unique $std_list]
+
+ # If fewer than 3 specific versions are mentioned, add more.
+ # The order of this list is significant: first $cxx_default,
+ # then the oldest and newest, then others in rough order of
+ # importance based on test coverage and usage.
+ foreach ver { 17 98 26 11 20 14 23 } {
+ set cmpver $ver
+ if { $ver == 98 } { set cmpver 03 }
+ if { [llength $std_list] < 3
+ && $ver ni $std_list
+ && $cmpver >= $low } {
+ lappend std_list $ver
+ }
+ }
+ verbose "std_list: $std_list" 1
+ }
+ set option_list { }
+ foreach x $std_list {
+ if { $x eq "impcx" } then { set x "26 -fimplicit-constexpr" }
+ lappend option_list "${std_prefix}$x"
+ }
+ } else {
+ set option_list { "" }
+ }
+ return $option_list
+}
+
# Modified dg-runtest that runs tests in multiple standard modes,
# unless they specifically specify one standard.
proc g++-dg-runtest { testcases flags default-extra-flags } {
@@ -38,62 +111,7 @@ proc g++-dg-runtest { testcases flags default-extra-flags } {
continue
}
- # If the testcase specifies a standard, use that one.
- # If not, run it under several standards, allowing GNU extensions
- # if there's a dg-options line.
- if ![search_for $test "-std=*++"] {
- if [search_for $test "dg-options"] {
- set std_prefix "-std=gnu++"
- } else {
- set std_prefix "-std=c++"
- }
-
- # See g++.exp for the initial value of this list.
- global gpp_std_list
- if { [llength $gpp_std_list] > 0 } {
- set std_list $gpp_std_list
- } else {
- # If the test mentions specific C++ versions, test those.
- set lines [get_matching_lines $test {\{ dg* c++[0-9][0-9]}]
- set std_list {}
- set low 0
- foreach line $lines {
- regexp {c\+\+([0-9][0-9])} $line -> ver
- lappend std_list $ver
-
- if { $ver == 98 } {
- # Leave low alone.
- } elseif { [regexp {dg-do|dg-require-effective-target} $line] } {
- set low $ver
- }
- }
- #verbose "low: $low" 1
-
- set std_list [lsort -unique $std_list]
-
- # If fewer than 3 specific versions are mentioned, add more.
- # The order of this list is significant: first $cxx_default,
- # then the oldest and newest, then others in rough order of
- # importance based on test coverage and usage.
- foreach ver { 17 98 26 11 20 14 23 } {
- set cmpver $ver
- if { $ver == 98 } { set cmpver 03 }
- if { [llength $std_list] < 3
- && $ver ni $std_list
- && $cmpver > $low } {
- lappend std_list $ver
- }
- }
- verbose "std_list: $std_list" 1
- }
- set option_list { }
- foreach x $std_list {
- if { $x eq "impcx" } then { set x "26 -fimplicit-constexpr" }
- lappend option_list "${std_prefix}$x"
- }
- } else {
- set option_list { "" }
- }
+ set option_list [g++-std-flags $test]
set nshort [file tail [file dirname $test]]/[file tail $test]
diff --git a/gcc/testsuite/lib/gm2-dg.exp b/gcc/testsuite/lib/gm2-dg.exp
index eaed554..5a36507 100644
--- a/gcc/testsuite/lib/gm2-dg.exp
+++ b/gcc/testsuite/lib/gm2-dg.exp
@@ -65,7 +65,7 @@ proc gm2-dg-runtest { testcases flags default-extra-flags } {
if [expr [search_for $test "dg-do run"]] {
set option_list $TORTURE_OPTIONS
} else {
- set option_list [list { -O } ]
+ set option_list [list { -O -O2 } ]
}
set nshort [file tail [file dirname $test]]/[file tail $test]
@@ -77,3 +77,38 @@ proc gm2-dg-runtest { testcases flags default-extra-flags } {
}
}
+
+# Check if frontend has been configured with option.
+# This checks a configure build option was used and not
+# the availability of a compiler command line option.
+
+proc gm2-dg-frontend-configure-check { option } {
+ global GCC_UNDER_TEST
+
+ # ignore any arguments after the command
+ set compiler [lindex $GCC_UNDER_TEST 0]
+
+ if ![is_remote host] {
+ set compiler_name [which $compiler]
+ } else {
+ set compiler_name $compiler
+ }
+
+ # verify that the compiler exists
+ if { $compiler_name != 0 } then {
+ set tmp [remote_exec host "$compiler -v"]
+ set status [lindex $tmp 0]
+ set output [lindex $tmp 1]
+ regexp "Configured with.*\[\n\r\]" $output config
+ set option "*${option}*"
+ if { [string match $option $config] } {
+ return 1
+ } else {
+ return 0
+ }
+ } else {
+ # compiler does not exist (this should have already been detected)
+ warning "$compiler does not exist"
+ return 0
+ }
+}
diff --git a/gcc/testsuite/lib/htmltest.py b/gcc/testsuite/lib/htmltest.py
index b249ea6..35f524c 100644
--- a/gcc/testsuite/lib/htmltest.py
+++ b/gcc/testsuite/lib/htmltest.py
@@ -7,3 +7,92 @@ def html_tree_from_env():
html_filename += '.html'
print('html_filename: %r' % html_filename)
return ET.parse(html_filename)
+
+XHTML = 'http://www.w3.org/1999/xhtml'
+SVG = 'http://www.w3.org/2000/svg'
+ns = {'xhtml': XHTML,
+ 'svg' : SVG}
+
+def make_tag(local_name):
+ return f'{{{XHTML}}}' + local_name
+
+def assert_tag(element, expected):
+ assert element.tag == make_tag(expected)
+
+def assert_class(element, expected):
+ assert element.attrib['class'] == expected
+
+def assert_quoted_line(tr, expected_line_num, expected_src):
+ """Verify that tr is a line of quoted source."""
+ tds = tr.findall('xhtml:td', ns)
+ assert len(tds) == 3
+ assert_class(tds[0], 'linenum')
+ assert tds[0].text == expected_line_num
+ assert_class(tds[1], 'left-margin')
+ assert tds[1].text == ' '
+ assert_class(tds[2], 'source')
+ assert tds[2].text == expected_src
+
+def assert_annotation_line(tr, expected_src,
+ expected_line_num=' ',
+ expected_left_margin=' '):
+ """Verify that tr is an annotation line."""
+ tds = tr.findall('xhtml:td', ns)
+ assert len(tds) == 3
+ assert_class(tds[0], 'linenum')
+ assert tds[0].text == expected_line_num
+ assert_class(tds[1], 'left-margin')
+ assert tds[1].text == expected_left_margin
+ assert_class(tds[2], 'annotation')
+ assert tds[2].text == expected_src
+
+def assert_frame(frame, expected_fnname):
+ """
+ Assert that frame is of class 'stack-frame'
+ and has a child showing the expected fnname.
+ """
+ assert_class(frame, 'stack-frame')
+ funcname = frame[0]
+ assert_class(funcname, 'frame-funcname')
+ span = funcname[0]
+ assert_tag(span, 'span')
+ assert span.text == expected_fnname
+
+def assert_event_range_with_margin(element):
+ """
+ Verify that "element" is an event-range-with-margin
+ """
+ assert_tag(element, 'table')
+ assert_class(element, 'event-range-with-margin')
+ tr = element.find('xhtml:tr', ns)
+ assert tr is not None
+ td = tr.find('xhtml:td', ns)
+ assert_class(td, 'event-range')
+
+ events_hdr = td.find('xhtml:div', ns)
+ assert_class(events_hdr, 'events-hdr')
+
+ #...etc
+
+def get_diag_by_index(html_tree, index):
+ root = html_tree.getroot ()
+ assert root.tag == make_tag('html')
+
+ body = root.find('xhtml:body', ns)
+ assert body is not None
+
+ diag_list = body.find('xhtml:div', ns)
+ assert diag_list is not None
+ assert_class(diag_list, 'gcc-diagnostic-list')
+
+ diag = diag_list.find(f"xhtml:div[@id='gcc-diag-{index}']", ns)
+ return diag
+
+def get_message_within_diag(diag_element):
+ msg = diag_element.find("xhtml:div[@class='gcc-message']", ns)
+ return msg
+
+def get_locus_within_diag(diag_element):
+ src = diag_element.find('xhtml:table', ns)
+ assert_class(src, 'locus')
+ return src
diff --git a/gcc/testsuite/lib/sarif.py b/gcc/testsuite/lib/sarif.py
index 7daf35b..384de2f 100644
--- a/gcc/testsuite/lib/sarif.py
+++ b/gcc/testsuite/lib/sarif.py
@@ -1,5 +1,6 @@
import json
import os
+import xml.etree.ElementTree as ET
def sarif_from_env():
# return parsed JSON content a SARIF_PATH file
@@ -21,3 +22,17 @@ def get_location_snippet_text(location):
def get_location_relationships(location):
return location['relationships']
+
+def get_result_by_index(sarif, idx):
+ runs = sarif['runs']
+ run = runs[0]
+ results = run['results']
+ return results[idx]
+
+def get_xml_state(events, event_idx):
+ xml_src = events[event_idx]['properties']['gcc/diagnostic_event/xml_state']
+ if 0:
+ print(xml_src)
+ xml = ET.fromstring(xml_src)
+ assert xml.tag == 'state-diagram'
+ return xml
diff --git a/gcc/testsuite/lib/target-supports.exp b/gcc/testsuite/lib/target-supports.exp
index 24d0b3d..25ceeea 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
@@ -1092,6 +1098,16 @@ proc check_effective_target_tls {} {
}]
}
+# Return 1 if we can link using TLS, 0 otherwise.
+
+proc check_effective_target_tls_link {} {
+ return [check_no_compiler_messages tls_link executable {
+ __thread int i;
+ int main (void) { return i; }
+ void g (int j) { i = j; }
+ }]
+}
+
# Return 1 if *native* thread local storage (TLS) is supported, 0 otherwise.
proc check_effective_target_tls_native {} {
@@ -1423,6 +1439,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
@@ -6631,17 +6664,23 @@ proc add_options_for_arm_v8_1m_mve_fp { flags } {
proc check_effective_target_arm_v8_1a_neon_ok_nocache { } {
global et_arm_v8_1a_neon_flags
set et_arm_v8_1a_neon_flags ""
+ set cpu_unset ""
if { ![istarget arm*-*-*] && ![istarget aarch64*-*-*] } {
return 0;
}
+ if { [istarget arm*-*-*] } {
+ set cpu_unset "-mcpu=unset"
+ }
+
# Iterate through sets of options to find the compiler flags that
# need to be added to the -march option. Start with the empty set
# since AArch64 only needs the -march setting.
foreach flags {"" "-mfpu=neon-fp-armv8" "-mfloat-abi=softfp" \
"-mfpu=neon-fp-armv8 -mfloat-abi=softfp"} {
- foreach arches { "-mcpu=unset -march=armv8-a+rdma" "-mcpu=unset -march=armv8.1-a" } {
+ foreach arches [list "$cpu_unset -march=armv8-a+rdma" \
+ "$cpu_unset -march=armv8.1-a" ] {
if { [check_no_compiler_messages_nocache arm_v8_1a_neon_ok object {
#if !defined (__ARM_FEATURE_QRDMX)
#error "__ARM_FEATURE_QRDMX not defined"
@@ -6668,11 +6707,16 @@ proc check_effective_target_arm_v8_1a_neon_ok { } {
proc check_effective_target_arm_v8_2a_fp16_scalar_ok_nocache { } {
global et_arm_v8_2a_fp16_scalar_flags
set et_arm_v8_2a_fp16_scalar_flags ""
+ set cpu_unset ""
if { ![istarget arm*-*-*] && ![istarget aarch64*-*-*] } {
return 0;
}
+ if { [istarget arm*-*-*] } {
+ set cpu_unset "-mcpu=unset"
+ }
+
# Iterate through sets of options to find the compiler flags that
# need to be added to the -march option.
foreach flags {"" "-mfpu=fp-armv8" "-mfloat-abi=softfp" \
@@ -6682,8 +6726,8 @@ proc check_effective_target_arm_v8_2a_fp16_scalar_ok_nocache { } {
#if !defined (__ARM_FEATURE_FP16_SCALAR_ARITHMETIC)
#error "__ARM_FEATURE_FP16_SCALAR_ARITHMETIC not defined"
#endif
- } "$flags -mcpu=unset -march=armv8.2-a+fp16"] } {
- set et_arm_v8_2a_fp16_scalar_flags "$flags -mcpu=unset -march=armv8.2-a+fp16"
+ } "$flags $cpu_unset -march=armv8.2-a+fp16"] } {
+ set et_arm_v8_2a_fp16_scalar_flags "$flags $cpu_unset -march=armv8.2-a+fp16"
return 1
}
}
@@ -6703,11 +6747,16 @@ proc check_effective_target_arm_v8_2a_fp16_scalar_ok { } {
proc check_effective_target_arm_v8_2a_fp16_neon_ok_nocache { } {
global et_arm_v8_2a_fp16_neon_flags
set et_arm_v8_2a_fp16_neon_flags ""
+ set cpu_unset ""
if { ![istarget arm*-*-*] && ![istarget aarch64*-*-*] } {
return 0;
}
+ if { [istarget arm*-*-*] } {
+ set cpu_unset "-mcpu=unset"
+ }
+
# Iterate through sets of options to find the compiler flags that
# need to be added to the -march option.
foreach flags {"" "-mfpu=neon-fp-armv8" "-mfloat-abi=softfp" \
@@ -6717,8 +6766,8 @@ proc check_effective_target_arm_v8_2a_fp16_neon_ok_nocache { } {
#if !defined (__ARM_FEATURE_FP16_VECTOR_ARITHMETIC)
#error "__ARM_FEATURE_FP16_VECTOR_ARITHMETIC not defined"
#endif
- } "$flags -mcpu=unset -march=armv8.2-a+fp16"] } {
- set et_arm_v8_2a_fp16_neon_flags "$flags -mcpu=unset -march=armv8.2-a+fp16"
+ } "$flags $cpu_unset -march=armv8.2-a+fp16"] } {
+ set et_arm_v8_2a_fp16_neon_flags "$flags $cpu_unset -march=armv8.2-a+fp16"
return 1
}
}
@@ -6738,11 +6787,16 @@ proc check_effective_target_arm_v8_2a_fp16_neon_ok { } {
proc check_effective_target_arm_v8_2a_dotprod_neon_ok_nocache { } {
global et_arm_v8_2a_dotprod_neon_flags
set et_arm_v8_2a_dotprod_neon_flags ""
+ set cpu_unset ""
if { ![istarget arm*-*-*] && ![istarget aarch64*-*-*] } {
return 0;
}
+ if { [istarget arm*-*-*] } {
+ set cpu_unset "-mcpu=unset"
+ }
+
# Iterate through sets of options to find the compiler flags that
# need to be added to the -march option.
foreach flags {"" "-mfloat-abi=softfp -mfpu=neon-fp-armv8" "-mfloat-abi=hard -mfpu=neon-fp-armv8"} {
@@ -6752,8 +6806,8 @@ proc check_effective_target_arm_v8_2a_dotprod_neon_ok_nocache { } {
#if !defined (__ARM_FEATURE_DOTPROD)
#error "__ARM_FEATURE_DOTPROD not defined"
#endif
- } "$flags -mcpu=unset -march=armv8.2-a+dotprod"] } {
- set et_arm_v8_2a_dotprod_neon_flags "$flags -mcpu=unset -march=armv8.2-a+dotprod"
+ } "$flags $cpu_unset -march=armv8.2-a+dotprod"] } {
+ set et_arm_v8_2a_dotprod_neon_flags "$flags $cpu_unset -march=armv8.2-a+dotprod"
return 1
}
}
@@ -6827,11 +6881,16 @@ proc add_options_for_arm_v8_2a_dotprod_neon { flags } {
proc check_effective_target_arm_v8_2a_i8mm_ok_nocache { } {
global et_arm_v8_2a_i8mm_flags
set et_arm_v8_2a_i8mm_flags ""
+ set cpu_unset ""
if { ![istarget arm*-*-*] && ![istarget aarch64*-*-*] } {
return 0;
}
+ if { [istarget arm*-*-*] } {
+ set cpu_unset "-mcpu=unset"
+ }
+
# Iterate through sets of options to find the compiler flags that
# need to be added to the -march option.
foreach flags {"" "-mfloat-abi=softfp -mfpu=neon-fp-armv8" "-mfloat-abi=hard -mfpu=neon-fp-armv8" } {
@@ -6841,8 +6900,8 @@ proc check_effective_target_arm_v8_2a_i8mm_ok_nocache { } {
#if !defined (__ARM_FEATURE_MATMUL_INT8)
#error "__ARM_FEATURE_MATMUL_INT8 not defined"
#endif
- } "$flags -mcpu=unset -march=armv8.2-a+i8mm"] } {
- set et_arm_v8_2a_i8mm_flags "$flags -mcpu=unset -march=armv8.2-a+i8mm"
+ } "$flags $cpu_unset -march=armv8.2-a+i8mm"] } {
+ set et_arm_v8_2a_i8mm_flags "$flags $cpu_unset -march=armv8.2-a+i8mm"
return 1
}
}
@@ -6914,19 +6973,24 @@ proc add_options_for_arm_fp16fml_neon { flags } {
proc check_effective_target_arm_v8_2a_bf16_neon_ok_nocache { } {
global et_arm_v8_2a_bf16_neon_flags
set et_arm_v8_2a_bf16_neon_flags ""
+ set cpu_unset ""
if { ![istarget arm*-*-*] && ![istarget aarch64*-*-*] } {
return 0;
}
+ if { [istarget arm*-*-*] } {
+ set cpu_unset "-mcpu=unset"
+ }
+
foreach flags {"" "-mfloat-abi=softfp -mfpu=neon-fp-armv8" "-mfloat-abi=hard -mfpu=neon-fp-armv8" } {
if { [check_no_compiler_messages_nocache arm_v8_2a_bf16_neon_ok object {
#include <arm_neon.h>
#if !defined (__ARM_FEATURE_BF16_VECTOR_ARITHMETIC)
#error "__ARM_FEATURE_BF16_VECTOR_ARITHMETIC not defined"
#endif
- } "$flags -mcpu=unset -march=armv8.2-a+bf16"] } {
- set et_arm_v8_2a_bf16_neon_flags "$flags -mcpu=unset -march=armv8.2-a+bf16"
+ } "$flags $cpu_unset -march=armv8.2-a+bf16"] } {
+ set et_arm_v8_2a_bf16_neon_flags "$flags $cpu_unset -march=armv8.2-a+bf16"
return 1
}
}
@@ -7436,19 +7500,6 @@ proc check_effective_target_arm_softfloat { } {
}]
}
-# Return 1 if this is an ARM target supporting -mcpu=iwmmxt.
-# Some multilibs may be incompatible with this option.
-
-proc check_effective_target_arm_iwmmxt_ok { } {
- if { [check_effective_target_arm32] } {
- return [check_no_compiler_messages arm_iwmmxt_ok object {
- int dummy;
- } "-mcpu=iwmmxt"]
- } else {
- return 0
- }
-}
-
# Return true if LDRD/STRD instructions are prefered over LDM/STM instructions
# for an ARM target.
proc check_effective_target_arm_prefer_ldrd_strd { } {
@@ -12391,6 +12442,21 @@ proc check_effective_target_aarch64_tiny { } {
}
}
+# Return 1 if Gas supports AEABI build attributes on AArch64 target
+proc check_effective_target_aarch64_gas_has_build_attributes { } {
+ if { ![istarget aarch64*-*-*] } {
+ return 0
+ }
+
+ return [check_no_compiler_messages aarch64_gas_has_build_attributes object {
+ /* Assembly */
+ .aeabi_subsection aeabi_feature_and_bits, optional, ULEB128
+ .aeabi_attribute Tag_Feature_BTI, 1
+ .aeabi_attribute Tag_Feature_PAC, 1
+ .aeabi_attribute Tag_Feature_GCS, 1
+ }]
+}
+
# Create functions to check that the AArch64 assembler supports the
# various architecture extensions via the .arch_extension pseudo-op.
@@ -13417,11 +13483,16 @@ proc check_effective_target_inff { } {
proc check_effective_target_arm_v8_3a_complex_neon_ok_nocache { } {
global et_arm_v8_3a_complex_neon_flags
set et_arm_v8_3a_complex_neon_flags ""
+ set cpu_unset ""
if { ![istarget arm*-*-*] && ![istarget aarch64*-*-*] } {
return 0;
}
+ if { [istarget arm*-*-*] } {
+ set cpu_unset "-mcpu=unset"
+ }
+
# Iterate through sets of options to find the compiler flags that
# need to be added to the -march option.
foreach flags {"" "-mfloat-abi=softfp -mfpu=auto" "-mfloat-abi=hard -mfpu=auto"} {
@@ -13430,8 +13501,8 @@ proc check_effective_target_arm_v8_3a_complex_neon_ok_nocache { } {
#if !defined (__ARM_FEATURE_COMPLEX)
#error "__ARM_FEATURE_COMPLEX not defined"
#endif
- } "$flags -mcpu=unset -march=armv8.3-a"] } {
- set et_arm_v8_3a_complex_neon_flags "$flags -mcpu=unset -march=armv8.3-a"
+ } "$flags $cpu_unset -march=armv8.3-a"] } {
+ set et_arm_v8_3a_complex_neon_flags "$flags $cpu_unset -march=armv8.3-a"
return 1;
}
}
@@ -13459,11 +13530,16 @@ proc add_options_for_arm_v8_3a_complex_neon { flags } {
proc check_effective_target_arm_v8_3a_fp16_complex_neon_ok_nocache { } {
global et_arm_v8_3a_fp16_complex_neon_flags
set et_arm_v8_3a_fp16_complex_neon_flags ""
+ set cpu_unset ""
if { ![istarget arm*-*-*] && ![istarget aarch64*-*-*] } {
return 0;
}
+ if { [istarget arm*-*-*] } {
+ set cpu_unset "-mcpu=unset"
+ }
+
# Iterate through sets of options to find the compiler flags that
# need to be added to the -march option.
foreach flags {"" "-mfloat-abi=softfp -mfpu=auto" "-mfloat-abi=hard -mfpu=auto"} {
@@ -13472,9 +13548,9 @@ proc check_effective_target_arm_v8_3a_fp16_complex_neon_ok_nocache { } {
#if !defined (__ARM_FEATURE_COMPLEX)
#error "__ARM_FEATURE_COMPLEX not defined"
#endif
- } "$flags -mcpu=unset -march=armv8.3-a+fp16"] } {
+ } "$flags $cpu_unset -march=armv8.3-a+fp16"] } {
set et_arm_v8_3a_fp16_complex_neon_flags \
- "$flags -mcpu=unset -march=armv8.3-a+fp16"
+ "$flags $cpu_unset -march=armv8.3-a+fp16"
return 1;
}
}
@@ -14419,3 +14495,17 @@ proc check_effective_target_xtensa_atomic { } {
#endif
}]
}
+
+# Return 1 if pi-based trigonometry function is foldable
+# We should remove this after bumping the minimum mpfr version to 4.2.0.
+proc check_effective_target_foldable_pi_based_trigonometry { } {
+ return [check_runtime foldable_pi_based_trigonometry {
+ int
+ main ()
+ {
+ if (!__builtin_constant_p (__builtin_acospi (0.5)))
+ __builtin_abort ();
+ return 0;
+ }
+ }]
+}