1 # This whole file adapted from libgomp.c/c.exp.
3 if [info exists lang_library_path] then {
4 unset lang_library_path
7 if [info exists lang_test_file] then {
10 if [info exists lang_include_flags] then {
11 unset lang_include_flags
14 load_lib libgomp-dg.exp
15 load_gcc_lib gcc-dg.exp
16 load_gcc_lib torture-options.exp
18 proc check_effective_target_c { } {
21 proc check_effective_target_c++ { } {
30 lappend ALWAYS_CFLAGS "additional_flags=-fopenacc"
32 # Gather a list of all tests.
33 set tests [lsort [concat \
34 [find $srcdir/$subdir *.c] \
35 [find $srcdir/$subdir/../libgomp.oacc-c-c++-common *.c]]]
37 set ld_library_path $always_ld_library_path
38 append ld_library_path [gcc-set-multilib-library-path $GCC_UNDER_TEST]
39 set_ld_library_path_env_vars
41 # Test with available OpenACC device types.
42 set SAVE_ALWAYS_CFLAGS "$ALWAYS_CFLAGS"
43 global openacc_device_type
44 foreach openacc_device_type $openacc_device_types_s {
45 set ALWAYS_CFLAGS "$SAVE_ALWAYS_CFLAGS"
46 set tagopt "-DACC_DEVICE_TYPE_$openacc_device_type=1"
48 switch $openacc_device_type {
53 if { ![check_effective_target_openacc_nvidia_accel_present] } {
54 # Don't bother; execution testing is going to FAIL.
55 untested "$subdir $openacc_device_type offloading: supported, but hardware not accessible"
59 # Copy ptx file (TEMPORARY)
60 remote_download host $srcdir/libgomp.oacc-c-c++-common/subr.ptx
63 lappend ALWAYS_CFLAGS "additional_flags=-I${srcdir}/libgomp.oacc-c-c++-common"
68 error "Unknown OpenACC device type: $openacc_device_type"
71 set tagopt "$tagopt -DACC_MEM_SHARED=$acc_mem_shared"
73 setenv ACC_DEVICE_TYPE $openacc_device_type
75 # To get better test coverage for device-specific code that is only
76 # ever used in offloading configurations, we'd like more thorough
77 # testing for test cases that deal with offloading, which most of all
78 # OpenACC test cases are. We enable torture testing, but limit it to
79 # -O0 and -O2 only, to avoid testing times exploding too much, under
80 # the assumption that between -O0 and -O[something] there is the
81 # biggest difference in the overall structure of the generated code.
82 switch $openacc_device_type {
84 set-torture-options [list \
88 set-torture-options [list \
94 gcc-dg-runtest $tests "$tagopt" ""